1e1db7cd1Smrg# generated automatically by aclocal 1.17 -*- Autoconf -*-
28f34cbf9Ssnj
3e1db7cd1Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
4bbe1b32bSmrg
5bbe1b32bSmrg# This file is free software; the Free Software Foundation
6bbe1b32bSmrg# gives unlimited permission to copy and/or distribute it,
7bbe1b32bSmrg# with or without modifications, as long as this notice is preserved.
8bbe1b32bSmrg
9bbe1b32bSmrg# This program is distributed in the hope that it will be useful,
10bbe1b32bSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11bbe1b32bSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12bbe1b32bSmrg# PARTICULAR PURPOSE.
13bbe1b32bSmrg
148f34cbf9Ssnjm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1530f8ce46Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1630f8ce46Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17e1db7cd1Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
18e1db7cd1Smrg[m4_warning([this file was generated for autoconf 2.72.
1930f8ce46SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2030f8ce46SmrgIf you have problems, you may need to regenerate the build system entirely.
218f34cbf9SsnjTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22bbe1b32bSmrg
23e1db7cd1Smrg# Copyright (C) 2002-2024 Free Software Foundation, Inc.
2440c5823bSmrg#
2576028eb6Smrg# This file is free software; the Free Software Foundation
2676028eb6Smrg# gives unlimited permission to copy and/or distribute it,
2776028eb6Smrg# with or without modifications, as long as this notice is preserved.
28bbe1b32bSmrg
2976028eb6Smrg# AM_AUTOMAKE_VERSION(VERSION)
3076028eb6Smrg# ----------------------------
3176028eb6Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3276028eb6Smrg# generated from the m4 files accompanying Automake X.Y.
3376028eb6Smrg# (This private macro should not be called outside this file.)
3476028eb6SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35e1db7cd1Smrg[am__api_version='1.17'
3676028eb6Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3776028eb6Smrgdnl require some minimum version.  Point them to the right macro.
38e1db7cd1Smrgm4_if([$1], [1.17], [],
3976028eb6Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4076028eb6Smrg])
41bbe1b32bSmrg
4276028eb6Smrg# _AM_AUTOCONF_VERSION(VERSION)
4376028eb6Smrg# -----------------------------
4476028eb6Smrg# aclocal traces this macro to find the Autoconf version.
4576028eb6Smrg# This is a private macro too.  Using m4_define simplifies
4676028eb6Smrg# the logic in aclocal, which can simply ignore this definition.
4776028eb6Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48bbe1b32bSmrg
4976028eb6Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5076028eb6Smrg# -------------------------------
5176028eb6Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5276028eb6Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5376028eb6SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54e1db7cd1Smrg[AM_AUTOMAKE_VERSION([1.17])dnl
5576028eb6Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5676028eb6Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5776028eb6Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58bbe1b32bSmrg
5976028eb6Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6040c5823bSmrg
61e1db7cd1Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
62bbe1b32bSmrg#
6376028eb6Smrg# This file is free software; the Free Software Foundation
6476028eb6Smrg# gives unlimited permission to copy and/or distribute it,
6576028eb6Smrg# with or without modifications, as long as this notice is preserved.
6640c5823bSmrg
6776028eb6Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6876028eb6Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6976028eb6Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70bbe1b32bSmrg#
7176028eb6Smrg# Of course, Automake must honor this variable whenever it calls a
7276028eb6Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7376028eb6Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7476028eb6Smrg# depending on how configure is run.  This is pretty annoying, since
7576028eb6Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7676028eb6Smrg# source directory, any form will work fine, but in subdirectories a
7776028eb6Smrg# relative path needs to be adjusted first.
78bbe1b32bSmrg#
7976028eb6Smrg# $ac_aux_dir/missing
8076028eb6Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8176028eb6Smrg# $top_srcdir/$ac_aux_dir/missing
8276028eb6Smrg#    fails if $ac_aux_dir is absolute,
8376028eb6Smrg#    fails when called from a subdirectory in a VPATH build with
8476028eb6Smrg#          a relative $ac_aux_dir
8540c5823bSmrg#
8676028eb6Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8776028eb6Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8876028eb6Smrg# harmless because $srcdir is '.', but things will broke when you
8976028eb6Smrg# start a VPATH build or use an absolute $srcdir.
9040c5823bSmrg#
9176028eb6Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9276028eb6Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9376028eb6Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9476028eb6Smrg# and then we would define $MISSING as
9576028eb6Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9676028eb6Smrg# This will work as long as MISSING is not called from configure, because
9776028eb6Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9876028eb6Smrg# However there are other variables, like CC, which are often used in
9976028eb6Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10040c5823bSmrg#
10176028eb6Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10276028eb6Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10376028eb6Smrg# configured tree to be moved without reconfiguration.
104bbe1b32bSmrg
10576028eb6SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10676028eb6Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10776028eb6Smrg# Expand $ac_aux_dir to an absolute path.
10876028eb6Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10940c5823bSmrg])
110bbe1b32bSmrg
11176028eb6Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112bbe1b32bSmrg
113e1db7cd1Smrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
114bbe1b32bSmrg#
11576028eb6Smrg# This file is free software; the Free Software Foundation
11676028eb6Smrg# gives unlimited permission to copy and/or distribute it,
11776028eb6Smrg# with or without modifications, as long as this notice is preserved.
118bbe1b32bSmrg
11976028eb6Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12076028eb6Smrg# -------------------------------------
12176028eb6Smrg# Define a conditional.
12276028eb6SmrgAC_DEFUN([AM_CONDITIONAL],
12376028eb6Smrg[AC_PREREQ([2.52])dnl
12476028eb6Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12576028eb6Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12676028eb6SmrgAC_SUBST([$1_TRUE])dnl
12776028eb6SmrgAC_SUBST([$1_FALSE])dnl
12876028eb6Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12976028eb6Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13076028eb6Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13176028eb6Smrgif $2; then
13276028eb6Smrg  $1_TRUE=
13376028eb6Smrg  $1_FALSE='#'
13476028eb6Smrgelse
13576028eb6Smrg  $1_TRUE='#'
13676028eb6Smrg  $1_FALSE=
13776028eb6Smrgfi
13876028eb6SmrgAC_CONFIG_COMMANDS_PRE(
13976028eb6Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14076028eb6Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14176028eb6SmrgUsually this means the macro was only invoked conditionally.]])
14276028eb6Smrgfi])])
143bbe1b32bSmrg
144e1db7cd1Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
14540c5823bSmrg#
14676028eb6Smrg# This file is free software; the Free Software Foundation
14776028eb6Smrg# gives unlimited permission to copy and/or distribute it,
14876028eb6Smrg# with or without modifications, as long as this notice is preserved.
14930f8ce46Smrg
150bbe1b32bSmrg
15176028eb6Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15276028eb6Smrg# written in clear, in which case automake, when reading aclocal.m4,
15376028eb6Smrg# will think it sees a *use*, and therefore will trigger all it's
15476028eb6Smrg# C support machinery.  Also note that it means that autoscan, seeing
15576028eb6Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156bbe1b32bSmrg
157bbe1b32bSmrg
15876028eb6Smrg# _AM_DEPENDENCIES(NAME)
15976028eb6Smrg# ----------------------
16076028eb6Smrg# See how the compiler implements dependency checking.
16176028eb6Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16276028eb6Smrg# We try a few techniques and use that to set a single cache variable.
16340c5823bSmrg#
16476028eb6Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16576028eb6Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16676028eb6Smrg# dependency, and given that the user is not expected to run this macro,
16776028eb6Smrg# just rely on AC_PROG_CC.
16876028eb6SmrgAC_DEFUN([_AM_DEPENDENCIES],
16976028eb6Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17076028eb6SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17176028eb6SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17276028eb6SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173bbe1b32bSmrg
17476028eb6Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17576028eb6Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17676028eb6Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17776028eb6Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17876028eb6Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17976028eb6Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18076028eb6Smrg                    [depcc="$$1"   am_compiler_list=])
181bbe1b32bSmrg
18276028eb6SmrgAC_CACHE_CHECK([dependency style of $depcc],
18376028eb6Smrg               [am_cv_$1_dependencies_compiler_type],
18476028eb6Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18576028eb6Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
18676028eb6Smrg  # making bogus files that we don't know about and never remove.  For
18776028eb6Smrg  # instance it was reported that on HP-UX the gcc test will end up
18876028eb6Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18976028eb6Smrg  # in D".
19076028eb6Smrg  rm -rf conftest.dir
19176028eb6Smrg  mkdir conftest.dir
19276028eb6Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19376028eb6Smrg  # using a relative directory.
19476028eb6Smrg  cp "$am_depcomp" conftest.dir
19576028eb6Smrg  cd conftest.dir
19676028eb6Smrg  # We will build objects and dependencies in a subdirectory because
19776028eb6Smrg  # it helps to detect inapplicable dependency modes.  For instance
19876028eb6Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19976028eb6Smrg  # side effect of compilation, but ICC will put the dependencies in
20076028eb6Smrg  # the current directory while Tru64 will put them in the object
20176028eb6Smrg  # directory.
20276028eb6Smrg  mkdir sub
203bbe1b32bSmrg
20476028eb6Smrg  am_cv_$1_dependencies_compiler_type=none
20576028eb6Smrg  if test "$am_compiler_list" = ""; then
20676028eb6Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20776028eb6Smrg  fi
20876028eb6Smrg  am__universal=false
20976028eb6Smrg  m4_case([$1], [CC],
21076028eb6Smrg    [case " $depcc " in #(
21176028eb6Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21276028eb6Smrg     esac],
21376028eb6Smrg    [CXX],
21476028eb6Smrg    [case " $depcc " in #(
21576028eb6Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21676028eb6Smrg     esac])
217bbe1b32bSmrg
21876028eb6Smrg  for depmode in $am_compiler_list; do
21976028eb6Smrg    # Setup a source with many dependencies, because some compilers
22076028eb6Smrg    # like to wrap large dependency lists on column 80 (with \), and
22176028eb6Smrg    # we should not choose a depcomp mode which is confused by this.
22276028eb6Smrg    #
22376028eb6Smrg    # We need to recreate these files for each test, as the compiler may
22476028eb6Smrg    # overwrite some of them when testing with obscure command lines.
22576028eb6Smrg    # This happens at least with the AIX C compiler.
22676028eb6Smrg    : > sub/conftest.c
22776028eb6Smrg    for i in 1 2 3 4 5 6; do
22876028eb6Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22976028eb6Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23076028eb6Smrg      # Solaris 10 /bin/sh.
23176028eb6Smrg      echo '/* dummy */' > sub/conftst$i.h
23276028eb6Smrg    done
23376028eb6Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234bbe1b32bSmrg
23576028eb6Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23676028eb6Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23776028eb6Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23876028eb6Smrg    # versions had trouble with output in subdirs.
23976028eb6Smrg    am__obj=sub/conftest.${OBJEXT-o}
24076028eb6Smrg    am__minus_obj="-o $am__obj"
24176028eb6Smrg    case $depmode in
24276028eb6Smrg    gcc)
24376028eb6Smrg      # This depmode causes a compiler race in universal mode.
24476028eb6Smrg      test "$am__universal" = false || continue
24576028eb6Smrg      ;;
24676028eb6Smrg    nosideeffect)
24776028eb6Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24876028eb6Smrg      # only be used when explicitly requested.
24976028eb6Smrg      if test "x$enable_dependency_tracking" = xyes; then
25076028eb6Smrg	continue
25176028eb6Smrg      else
25276028eb6Smrg	break
25376028eb6Smrg      fi
25476028eb6Smrg      ;;
25576028eb6Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25676028eb6Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25776028eb6Smrg      # not run yet.  These depmodes are late enough in the game, and
25876028eb6Smrg      # so weak that their functioning should not be impacted.
25976028eb6Smrg      am__obj=conftest.${OBJEXT-o}
26076028eb6Smrg      am__minus_obj=
26176028eb6Smrg      ;;
26276028eb6Smrg    none) break ;;
26376028eb6Smrg    esac
26476028eb6Smrg    if depmode=$depmode \
26576028eb6Smrg       source=sub/conftest.c object=$am__obj \
26676028eb6Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26776028eb6Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26876028eb6Smrg         >/dev/null 2>conftest.err &&
26976028eb6Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27076028eb6Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27176028eb6Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27276028eb6Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27376028eb6Smrg      # icc doesn't choke on unknown options, it will just issue warnings
27476028eb6Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
27576028eb6Smrg      # that says an option was ignored or not supported.
276e1db7cd1Smrg      # When given -MP, icc 7.0 and 7.1 complain thus:
27776028eb6Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27876028eb6Smrg      # The diagnosis changed in icc 8.0:
27976028eb6Smrg      #   icc: Command line remark: option '-MP' not supported
28076028eb6Smrg      if (grep 'ignoring option' conftest.err ||
28176028eb6Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28276028eb6Smrg        am_cv_$1_dependencies_compiler_type=$depmode
28376028eb6Smrg        break
28476028eb6Smrg      fi
28576028eb6Smrg    fi
28676028eb6Smrg  done
287bbe1b32bSmrg
28876028eb6Smrg  cd ..
28976028eb6Smrg  rm -rf conftest.dir
29076028eb6Smrgelse
29176028eb6Smrg  am_cv_$1_dependencies_compiler_type=none
29276028eb6Smrgfi
29376028eb6Smrg])
29476028eb6SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29576028eb6SmrgAM_CONDITIONAL([am__fastdep$1], [
29676028eb6Smrg  test "x$enable_dependency_tracking" != xno \
29776028eb6Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29840c5823bSmrg])
299bbe1b32bSmrg
300bbe1b32bSmrg
30176028eb6Smrg# AM_SET_DEPDIR
30276028eb6Smrg# -------------
30376028eb6Smrg# Choose a directory name for dependency files.
30476028eb6Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30576028eb6SmrgAC_DEFUN([AM_SET_DEPDIR],
30676028eb6Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30776028eb6SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30876028eb6Smrg])
30940c5823bSmrg
31040c5823bSmrg
31176028eb6Smrg# AM_DEP_TRACK
31276028eb6Smrg# ------------
31376028eb6SmrgAC_DEFUN([AM_DEP_TRACK],
31476028eb6Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31576028eb6SmrgAS_HELP_STRING(
31676028eb6Smrg  [--enable-dependency-tracking],
31776028eb6Smrg  [do not reject slow dependency extractors])
31876028eb6SmrgAS_HELP_STRING(
31976028eb6Smrg  [--disable-dependency-tracking],
32076028eb6Smrg  [speeds up one-time build])])
32176028eb6Smrgif test "x$enable_dependency_tracking" != xno; then
32276028eb6Smrg  am_depcomp="$ac_aux_dir/depcomp"
32376028eb6Smrg  AMDEPBACKSLASH='\'
32476028eb6Smrg  am__nodep='_no'
32576028eb6Smrgfi
32676028eb6SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32776028eb6SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32876028eb6Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32976028eb6SmrgAC_SUBST([am__nodep])dnl
33076028eb6Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33140c5823bSmrg])
332bbe1b32bSmrg
33376028eb6Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33476028eb6Smrg
335e1db7cd1Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
336bbe1b32bSmrg#
33776028eb6Smrg# This file is free software; the Free Software Foundation
33876028eb6Smrg# gives unlimited permission to copy and/or distribute it,
33976028eb6Smrg# with or without modifications, as long as this notice is preserved.
340bbe1b32bSmrg
34176028eb6Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34276028eb6Smrg# ------------------------------
34376028eb6SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34476028eb6Smrg[{
34576028eb6Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
34676028eb6Smrg  # are listed without --file.  Let's play safe and only enable the eval
34776028eb6Smrg  # if we detect the quoting.
34876028eb6Smrg  # TODO: see whether this extra hack can be removed once we start
34976028eb6Smrg  # requiring Autoconf 2.70 or later.
35076028eb6Smrg  AS_CASE([$CONFIG_FILES],
35176028eb6Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
35276028eb6Smrg          [*], [set x $CONFIG_FILES])
35376028eb6Smrg  shift
35476028eb6Smrg  # Used to flag and report bootstrapping failures.
35576028eb6Smrg  am_rc=0
35676028eb6Smrg  for am_mf
35776028eb6Smrg  do
35876028eb6Smrg    # Strip MF so we end up with the name of the file.
35976028eb6Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
36076028eb6Smrg    # Check whether this is an Automake generated Makefile which includes
36176028eb6Smrg    # dependency-tracking related rules and includes.
36276028eb6Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
36376028eb6Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
36476028eb6Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
36576028eb6Smrg      || continue
36676028eb6Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
36776028eb6Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
36876028eb6Smrg    AM_RUN_LOG([cd "$am_dirpart" \
36976028eb6Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
37076028eb6Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
37176028eb6Smrg  done
37276028eb6Smrg  if test $am_rc -ne 0; then
37376028eb6Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
37476028eb6Smrg    for automatic dependency tracking.  If GNU make was not used, consider
37576028eb6Smrg    re-running the configure script with MAKE="gmake" (or whatever is
37676028eb6Smrg    necessary).  You can also try re-running configure with the
37776028eb6Smrg    '--disable-dependency-tracking' option to at least be able to build
37876028eb6Smrg    the package (albeit without support for automatic dependency tracking).])
37976028eb6Smrg  fi
38076028eb6Smrg  AS_UNSET([am_dirpart])
38176028eb6Smrg  AS_UNSET([am_filepart])
38276028eb6Smrg  AS_UNSET([am_mf])
38376028eb6Smrg  AS_UNSET([am_rc])
38476028eb6Smrg  rm -f conftest-deps.mk
38576028eb6Smrg}
38676028eb6Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387bbe1b32bSmrg
3888f34cbf9Ssnj
38976028eb6Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39076028eb6Smrg# -----------------------------
39176028eb6Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
39240c5823bSmrg#
39376028eb6Smrg# This code is only required when automatic dependency tracking is enabled.
39476028eb6Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
39576028eb6Smrg# order to bootstrap the dependency handling code.
39676028eb6SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
39776028eb6Smrg[AC_CONFIG_COMMANDS([depfiles],
39876028eb6Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
39976028eb6Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400bbe1b32bSmrg
40176028eb6Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402bbe1b32bSmrg
403e1db7cd1Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
40476028eb6Smrg#
40576028eb6Smrg# This file is free software; the Free Software Foundation
40676028eb6Smrg# gives unlimited permission to copy and/or distribute it,
40776028eb6Smrg# with or without modifications, as long as this notice is preserved.
408bbe1b32bSmrg
40976028eb6Smrg# This macro actually does too much.  Some checks are only needed if
41076028eb6Smrg# your package does certain things.  But this isn't really a big deal.
41140c5823bSmrg
41276028eb6Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41376028eb6Smrgm4_define([AC_PROG_CC],
41476028eb6Smrgm4_defn([AC_PROG_CC])
41576028eb6Smrg[_AM_PROG_CC_C_O
41676028eb6Smrg])
41740c5823bSmrg
41876028eb6Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41976028eb6Smrg# AM_INIT_AUTOMAKE([OPTIONS])
42076028eb6Smrg# -----------------------------------------------
42176028eb6Smrg# The call with PACKAGE and VERSION arguments is the old style
42276028eb6Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42376028eb6Smrg# and VERSION should now be passed to AC_INIT and removed from
42476028eb6Smrg# the call to AM_INIT_AUTOMAKE.
42576028eb6Smrg# We support both call styles for the transition.  After
42676028eb6Smrg# the next Automake release, Autoconf can make the AC_INIT
42776028eb6Smrg# arguments mandatory, and then we can depend on a new Autoconf
42876028eb6Smrg# release and drop the old call support.
42976028eb6SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43076028eb6Smrg[AC_PREREQ([2.65])dnl
43176028eb6Smrgm4_ifdef([_$0_ALREADY_INIT],
43276028eb6Smrg  [m4_fatal([$0 expanded multiple times
43376028eb6Smrg]m4_defn([_$0_ALREADY_INIT]))],
43476028eb6Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
43576028eb6Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43676028eb6Smrgdnl the ones we care about.
43776028eb6Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43876028eb6SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43976028eb6SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44076028eb6Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44176028eb6Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44276028eb6Smrg  # is not polluted with repeated "-I."
44376028eb6Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44476028eb6Smrg  # test to see if srcdir already configured
44576028eb6Smrg  if test -f $srcdir/config.status; then
44676028eb6Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44776028eb6Smrg  fi
44876028eb6Smrgfi
449bbe1b32bSmrg
45076028eb6Smrg# test whether we have cygpath
45176028eb6Smrgif test -z "$CYGPATH_W"; then
45276028eb6Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45376028eb6Smrg    CYGPATH_W='cygpath -w'
45476028eb6Smrg  else
45576028eb6Smrg    CYGPATH_W=echo
45676028eb6Smrg  fi
45740c5823bSmrgfi
45876028eb6SmrgAC_SUBST([CYGPATH_W])
459bbe1b32bSmrg
46076028eb6Smrg# Define the identity of the package.
46176028eb6Smrgdnl Distinguish between old-style and new-style calls.
46276028eb6Smrgm4_ifval([$2],
46376028eb6Smrg[AC_DIAGNOSE([obsolete],
46476028eb6Smrg             [$0: two- and three-arguments forms are deprecated.])
46576028eb6Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46676028eb6Smrg AC_SUBST([PACKAGE], [$1])dnl
46776028eb6Smrg AC_SUBST([VERSION], [$2])],
46876028eb6Smrg[_AM_SET_OPTIONS([$1])dnl
46976028eb6Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47076028eb6Smrgm4_if(
47176028eb6Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47276028eb6Smrg  [ok:ok],,
47376028eb6Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47476028eb6Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47576028eb6Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4768f34cbf9Ssnj
47776028eb6Smrg_AM_IF_OPTION([no-define],,
47876028eb6Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47976028eb6Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4808f34cbf9Ssnj
48176028eb6Smrg# Some tools Automake needs.
48276028eb6SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48376028eb6SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48476028eb6SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48576028eb6SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48676028eb6SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48776028eb6SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48876028eb6SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48976028eb6SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49076028eb6SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49176028eb6SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49276028eb6Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49376028eb6Smrg# dies out for good.  For more background, see:
49476028eb6Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49576028eb6Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49676028eb6SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49776028eb6Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
49876028eb6Smrg# system "awk" is bad on some platforms.
49976028eb6SmrgAC_REQUIRE([AC_PROG_AWK])dnl
50076028eb6SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50176028eb6SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50276028eb6Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50376028eb6Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50476028eb6Smrg			     [_AM_PROG_TAR([v7])])])
50576028eb6Smrg_AM_IF_OPTION([no-dependencies],,
50676028eb6Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50776028eb6Smrg		  [_AM_DEPENDENCIES([CC])],
50876028eb6Smrg		  [m4_define([AC_PROG_CC],
50976028eb6Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51076028eb6SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51176028eb6Smrg		  [_AM_DEPENDENCIES([CXX])],
51276028eb6Smrg		  [m4_define([AC_PROG_CXX],
51376028eb6Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51476028eb6SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51576028eb6Smrg		  [_AM_DEPENDENCIES([OBJC])],
51676028eb6Smrg		  [m4_define([AC_PROG_OBJC],
51776028eb6Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51876028eb6SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51976028eb6Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52076028eb6Smrg		  [m4_define([AC_PROG_OBJCXX],
52176028eb6Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52276028eb6Smrg])
52376028eb6Smrg# Variables for tags utilities; see am/tags.am
52476028eb6Smrgif test -z "$CTAGS"; then
52576028eb6Smrg  CTAGS=ctags
52676028eb6Smrgfi
52776028eb6SmrgAC_SUBST([CTAGS])
52876028eb6Smrgif test -z "$ETAGS"; then
52976028eb6Smrg  ETAGS=etags
53076028eb6Smrgfi
53176028eb6SmrgAC_SUBST([ETAGS])
53276028eb6Smrgif test -z "$CSCOPE"; then
53376028eb6Smrg  CSCOPE=cscope
53476028eb6Smrgfi
53576028eb6SmrgAC_SUBST([CSCOPE])
5368f34cbf9Ssnj
537e1db7cd1SmrgAC_REQUIRE([_AM_SILENT_RULES])dnl
53876028eb6Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53976028eb6Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54076028eb6Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
54176028eb6SmrgAC_CONFIG_COMMANDS_PRE(dnl
54276028eb6Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
54376028eb6Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5448f34cbf9Ssnj
545e1db7cd1SmrgAC_REQUIRE([_AM_PROG_RM_F])
546e1db7cd1SmrgAC_REQUIRE([_AM_PROG_XARGS_N])
54730f8ce46Smrg
54876028eb6Smrgdnl The trailing newline in this macro's definition is deliberate, for
54976028eb6Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
55076028eb6Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
55176028eb6Smrg])
552bbe1b32bSmrg
55376028eb6Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
55476028eb6Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
55576028eb6Smrgdnl mangled by Autoconf and run in a shell conditional statement.
55676028eb6Smrgm4_define([_AC_COMPILER_EXEEXT],
55776028eb6Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
558bbe1b32bSmrg
55976028eb6Smrg# When config.status generates a header, we must update the stamp-h file.
56076028eb6Smrg# This file resides in the same directory as the config header
56176028eb6Smrg# that is generated.  The stamp files are numbered to have different names.
56240c5823bSmrg
56376028eb6Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
56476028eb6Smrg# loop where config.status creates the headers, so we can generate
56576028eb6Smrg# our stamp files there.
56676028eb6SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
56776028eb6Smrg[# Compute $1's index in $config_headers.
56876028eb6Smrg_am_arg=$1
56976028eb6Smrg_am_stamp_count=1
57076028eb6Smrgfor _am_header in $config_headers :; do
57176028eb6Smrg  case $_am_header in
57276028eb6Smrg    $_am_arg | $_am_arg:* )
57376028eb6Smrg      break ;;
57476028eb6Smrg    * )
57576028eb6Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
57676028eb6Smrg  esac
57776028eb6Smrgdone
57876028eb6Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
579bbe1b32bSmrg
580e1db7cd1Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
58176028eb6Smrg#
58276028eb6Smrg# This file is free software; the Free Software Foundation
58376028eb6Smrg# gives unlimited permission to copy and/or distribute it,
58476028eb6Smrg# with or without modifications, as long as this notice is preserved.
585bbe1b32bSmrg
58676028eb6Smrg# AM_PROG_INSTALL_SH
58776028eb6Smrg# ------------------
58876028eb6Smrg# Define $install_sh.
58976028eb6SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
59076028eb6Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
59176028eb6Smrgif test x"${install_sh+set}" != xset; then
59276028eb6Smrg  case $am_aux_dir in
59376028eb6Smrg  *\ * | *\	*)
59476028eb6Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
59576028eb6Smrg  *)
59676028eb6Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
59776028eb6Smrg  esac
59876028eb6Smrgfi
59976028eb6SmrgAC_SUBST([install_sh])])
600bbe1b32bSmrg
601e1db7cd1Smrg# Copyright (C) 2003-2024 Free Software Foundation, Inc.
60276028eb6Smrg#
60376028eb6Smrg# This file is free software; the Free Software Foundation
60476028eb6Smrg# gives unlimited permission to copy and/or distribute it,
60576028eb6Smrg# with or without modifications, as long as this notice is preserved.
606bbe1b32bSmrg
60776028eb6Smrg# Check whether the underlying file-system supports filenames
60876028eb6Smrg# with a leading dot.  For instance MS-DOS doesn't.
60976028eb6SmrgAC_DEFUN([AM_SET_LEADING_DOT],
61076028eb6Smrg[rm -rf .tst 2>/dev/null
61176028eb6Smrgmkdir .tst 2>/dev/null
61276028eb6Smrgif test -d .tst; then
61376028eb6Smrg  am__leading_dot=.
61476028eb6Smrgelse
61576028eb6Smrg  am__leading_dot=_
61676028eb6Smrgfi
61776028eb6Smrgrmdir .tst 2>/dev/null
61876028eb6SmrgAC_SUBST([am__leading_dot])])
619bbe1b32bSmrg
62076028eb6Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
621bbe1b32bSmrg
622e1db7cd1Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
62376028eb6Smrg#
62476028eb6Smrg# This file is free software; the Free Software Foundation
62576028eb6Smrg# gives unlimited permission to copy and/or distribute it,
62676028eb6Smrg# with or without modifications, as long as this notice is preserved.
62740c5823bSmrg
62876028eb6Smrg# AM_MAKE_INCLUDE()
62976028eb6Smrg# -----------------
63076028eb6Smrg# Check whether make has an 'include' directive that can support all
63176028eb6Smrg# the idioms we need for our automatic dependency tracking code.
63276028eb6SmrgAC_DEFUN([AM_MAKE_INCLUDE],
63376028eb6Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
63476028eb6Smrgcat > confinc.mk << 'END'
63576028eb6Smrgam__doit:
63676028eb6Smrg	@echo this is the am__doit target >confinc.out
63776028eb6Smrg.PHONY: am__doit
63876028eb6SmrgEND
63976028eb6Smrgam__include="#"
64076028eb6Smrgam__quote=
64176028eb6Smrg# BSD make does it like this.
64276028eb6Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
64376028eb6Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
64476028eb6Smrgecho 'include confinc.mk # ignored' > confmf.GNU
64576028eb6Smrg_am_result=no
64676028eb6Smrgfor s in GNU BSD; do
64776028eb6Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
64876028eb6Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
64976028eb6Smrg      ['0:this is the am__doit target'],
65076028eb6Smrg      [AS_CASE([$s],
65176028eb6Smrg          [BSD], [am__include='.include' am__quote='"'],
65276028eb6Smrg          [am__include='include' am__quote=''])])
65376028eb6Smrg  if test "$am__include" != "#"; then
65476028eb6Smrg    _am_result="yes ($s style)"
65576028eb6Smrg    break
65676028eb6Smrg  fi
65776028eb6Smrgdone
65876028eb6Smrgrm -f confinc.* confmf.*
65976028eb6SmrgAC_MSG_RESULT([${_am_result}])
66076028eb6SmrgAC_SUBST([am__include])])
66176028eb6SmrgAC_SUBST([am__quote])])
66240c5823bSmrg
66376028eb6Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
66440c5823bSmrg
665e1db7cd1Smrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
66640c5823bSmrg#
66776028eb6Smrg# This file is free software; the Free Software Foundation
66876028eb6Smrg# gives unlimited permission to copy and/or distribute it,
66976028eb6Smrg# with or without modifications, as long as this notice is preserved.
67040c5823bSmrg
67176028eb6Smrg# AM_MISSING_PROG(NAME, PROGRAM)
67276028eb6Smrg# ------------------------------
67376028eb6SmrgAC_DEFUN([AM_MISSING_PROG],
67476028eb6Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
67576028eb6Smrg$1=${$1-"${am_missing_run}$2"}
67676028eb6SmrgAC_SUBST($1)])
67740c5823bSmrg
67876028eb6Smrg# AM_MISSING_HAS_RUN
67976028eb6Smrg# ------------------
68076028eb6Smrg# Define MISSING if not defined so far and test if it is modern enough.
68176028eb6Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
68276028eb6SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
68376028eb6Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
68476028eb6SmrgAC_REQUIRE_AUX_FILE([missing])dnl
68576028eb6Smrgif test x"${MISSING+set}" != xset; then
68676028eb6Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
687bbe1b32bSmrgfi
68876028eb6Smrg# Use eval to expand $SHELL
68976028eb6Smrgif eval "$MISSING --is-lightweight"; then
69076028eb6Smrg  am_missing_run="$MISSING "
69140c5823bSmrgelse
69276028eb6Smrg  am_missing_run=
69376028eb6Smrg  AC_MSG_WARN(['missing' script is too old or missing])
69440c5823bSmrgfi
69576028eb6Smrg])
696bbe1b32bSmrg
69776028eb6Smrg# Helper functions for option handling.                     -*- Autoconf -*-
69876028eb6Smrg
699e1db7cd1Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
700bbe1b32bSmrg#
70176028eb6Smrg# This file is free software; the Free Software Foundation
70276028eb6Smrg# gives unlimited permission to copy and/or distribute it,
70376028eb6Smrg# with or without modifications, as long as this notice is preserved.
704bbe1b32bSmrg
70576028eb6Smrg# _AM_MANGLE_OPTION(NAME)
70676028eb6Smrg# -----------------------
70776028eb6SmrgAC_DEFUN([_AM_MANGLE_OPTION],
70876028eb6Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
709bbe1b32bSmrg
71076028eb6Smrg# _AM_SET_OPTION(NAME)
71176028eb6Smrg# --------------------
71276028eb6Smrg# Set option NAME.  Presently that only means defining a flag for this option.
71376028eb6SmrgAC_DEFUN([_AM_SET_OPTION],
71476028eb6Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
715bbe1b32bSmrg
71676028eb6Smrg# _AM_SET_OPTIONS(OPTIONS)
71776028eb6Smrg# ------------------------
71876028eb6Smrg# OPTIONS is a space-separated list of Automake options.
71976028eb6SmrgAC_DEFUN([_AM_SET_OPTIONS],
72076028eb6Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
721bbe1b32bSmrg
72276028eb6Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
72376028eb6Smrg# -------------------------------------------
72476028eb6Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
72576028eb6SmrgAC_DEFUN([_AM_IF_OPTION],
72676028eb6Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
727bbe1b32bSmrg
728e1db7cd1Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
72976028eb6Smrg#
73076028eb6Smrg# This file is free software; the Free Software Foundation
73176028eb6Smrg# gives unlimited permission to copy and/or distribute it,
73276028eb6Smrg# with or without modifications, as long as this notice is preserved.
733bbe1b32bSmrg
73476028eb6Smrg# _AM_PROG_CC_C_O
73576028eb6Smrg# ---------------
73676028eb6Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
73776028eb6Smrg# to automatically call this.
73876028eb6SmrgAC_DEFUN([_AM_PROG_CC_C_O],
73976028eb6Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
74076028eb6SmrgAC_REQUIRE_AUX_FILE([compile])dnl
74176028eb6SmrgAC_LANG_PUSH([C])dnl
74276028eb6SmrgAC_CACHE_CHECK(
74376028eb6Smrg  [whether $CC understands -c and -o together],
74476028eb6Smrg  [am_cv_prog_cc_c_o],
74576028eb6Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
74676028eb6Smrg  # Make sure it works both with $CC and with simple cc.
74776028eb6Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
74876028eb6Smrg  # compilers refuse to overwrite an existing .o file with -o,
74976028eb6Smrg  # though they will create one.
75076028eb6Smrg  am_cv_prog_cc_c_o=yes
75176028eb6Smrg  for am_i in 1 2; do
75276028eb6Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
75376028eb6Smrg         && test -f conftest2.$ac_objext; then
75476028eb6Smrg      : OK
75576028eb6Smrg    else
75676028eb6Smrg      am_cv_prog_cc_c_o=no
75776028eb6Smrg      break
75876028eb6Smrg    fi
75976028eb6Smrg  done
76076028eb6Smrg  rm -f core conftest*
76176028eb6Smrg  unset am_i])
76276028eb6Smrgif test "$am_cv_prog_cc_c_o" != yes; then
76376028eb6Smrg   # Losing compiler, so override with the script.
76476028eb6Smrg   # FIXME: It is wrong to rewrite CC.
76576028eb6Smrg   # But if we don't then we get into trouble of one sort or another.
76676028eb6Smrg   # A longer-term fix would be to have automake use am__CC in this case,
76776028eb6Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
76876028eb6Smrg   CC="$am_aux_dir/compile $CC"
76940c5823bSmrgfi
77076028eb6SmrgAC_LANG_POP([C])])
7718f34cbf9Ssnj
77276028eb6Smrg# For backward compatibility.
77376028eb6SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
774bbe1b32bSmrg
775e1db7cd1Smrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
776e1db7cd1Smrg#
777e1db7cd1Smrg# This file is free software; the Free Software Foundation
778e1db7cd1Smrg# gives unlimited permission to copy and/or distribute it,
779e1db7cd1Smrg# with or without modifications, as long as this notice is preserved.
780e1db7cd1Smrg
781e1db7cd1Smrg# _AM_PROG_RM_F
782e1db7cd1Smrg# ---------------
783e1db7cd1Smrg# Check whether 'rm -f' without any arguments works.
784e1db7cd1Smrg# https://bugs.gnu.org/10828
785e1db7cd1SmrgAC_DEFUN([_AM_PROG_RM_F],
786e1db7cd1Smrg[am__rm_f_notfound=
787e1db7cd1SmrgAS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
788e1db7cd1SmrgAC_SUBST(am__rm_f_notfound)
789e1db7cd1Smrg])
790e1db7cd1Smrg
791e1db7cd1Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
79240c5823bSmrg#
79376028eb6Smrg# This file is free software; the Free Software Foundation
79476028eb6Smrg# gives unlimited permission to copy and/or distribute it,
79576028eb6Smrg# with or without modifications, as long as this notice is preserved.
7968f34cbf9Ssnj
79776028eb6Smrg# AM_RUN_LOG(COMMAND)
79876028eb6Smrg# -------------------
79976028eb6Smrg# Run COMMAND, save the exit status in ac_status, and log it.
80076028eb6Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
80176028eb6SmrgAC_DEFUN([AM_RUN_LOG],
80276028eb6Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
80376028eb6Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
80476028eb6Smrg   ac_status=$?
80576028eb6Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
80676028eb6Smrg   (exit $ac_status); }])
807bbe1b32bSmrg
80876028eb6Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
80940c5823bSmrg
810e1db7cd1Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
81130f8ce46Smrg#
81276028eb6Smrg# This file is free software; the Free Software Foundation
81376028eb6Smrg# gives unlimited permission to copy and/or distribute it,
81476028eb6Smrg# with or without modifications, as long as this notice is preserved.
81530f8ce46Smrg
816e1db7cd1Smrg# _AM_SLEEP_FRACTIONAL_SECONDS
817e1db7cd1Smrg# ----------------------------
818e1db7cd1SmrgAC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
819e1db7cd1SmrgAC_CACHE_CHECK([whether sleep supports fractional seconds],
820e1db7cd1Smrg               am_cv_sleep_fractional_seconds, [dnl
821e1db7cd1SmrgAS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
822e1db7cd1Smrg                                 [am_cv_sleep_fractional_seconds=no])
823e1db7cd1Smrg])])
824e1db7cd1Smrg
825e1db7cd1Smrg# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
826e1db7cd1Smrg# -----------------------------------
827e1db7cd1Smrg# Determine the filesystem's resolution for file modification
828e1db7cd1Smrg# timestamps.  The coarsest we know of is FAT, with a resolution
829e1db7cd1Smrg# of only two seconds, even with the most recent "exFAT" extensions.
830e1db7cd1Smrg# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
831e1db7cd1Smrg# nanosecond, matching clock_gettime.  However, it is probably not
832e1db7cd1Smrg# possible to delay execution of a shell script for less than one
833e1db7cd1Smrg# millisecond, due to process creation overhead and scheduling
834e1db7cd1Smrg# granularity, so we don't check for anything finer than that. (See below.)
835e1db7cd1SmrgAC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
836e1db7cd1SmrgAC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
837e1db7cd1SmrgAC_CACHE_CHECK([filesystem timestamp resolution],
838e1db7cd1Smrg               am_cv_filesystem_timestamp_resolution, [dnl
839e1db7cd1Smrg# Default to the worst case.
840e1db7cd1Smrgam_cv_filesystem_timestamp_resolution=2
841e1db7cd1Smrg
842e1db7cd1Smrg# Only try to go finer than 1 sec if sleep can do it.
843e1db7cd1Smrg# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
844e1db7cd1Smrg# - 1 sec is not much of a win compared to 2 sec, and
845e1db7cd1Smrg# - it takes 2 seconds to perform the test whether 1 sec works.
846e1db7cd1Smrg# 
847e1db7cd1Smrg# Instead, just use the default 2s on platforms that have 1s resolution,
848e1db7cd1Smrg# accept the extra 1s delay when using $sleep in the Automake tests, in
849e1db7cd1Smrg# exchange for not incurring the 2s delay for running the test for all
850e1db7cd1Smrg# packages.
851e1db7cd1Smrg#
852e1db7cd1Smrgam_try_resolutions=
853e1db7cd1Smrgif test "$am_cv_sleep_fractional_seconds" = yes; then
854e1db7cd1Smrg  # Even a millisecond often causes a bunch of false positives,
855e1db7cd1Smrg  # so just try a hundredth of a second. The time saved between .001 and
856e1db7cd1Smrg  # .01 is not terribly consequential.
857e1db7cd1Smrg  am_try_resolutions="0.01 0.1 $am_try_resolutions"
858e1db7cd1Smrgfi
859e1db7cd1Smrg
860e1db7cd1Smrg# In order to catch current-generation FAT out, we must *modify* files
861e1db7cd1Smrg# that already exist; the *creation* timestamp is finer.  Use names
862e1db7cd1Smrg# that make ls -t sort them differently when they have equal
863e1db7cd1Smrg# timestamps than when they have distinct timestamps, keeping
864e1db7cd1Smrg# in mind that ls -t prints the *newest* file first.
865e1db7cd1Smrgrm -f conftest.ts?
866e1db7cd1Smrg: > conftest.ts1
867e1db7cd1Smrg: > conftest.ts2
868e1db7cd1Smrg: > conftest.ts3
869e1db7cd1Smrg
870e1db7cd1Smrg# Make sure ls -t actually works.  Do 'set' in a subshell so we don't
871e1db7cd1Smrg# clobber the current shell's arguments. (Outer-level square brackets
872e1db7cd1Smrg# are removed by m4; they're present so that m4 does not expand
873e1db7cd1Smrg# <dollar><star>; be careful, easy to get confused.)
874e1db7cd1Smrgif (
875e1db7cd1Smrg     set X `[ls -t conftest.ts[12]]` &&
876e1db7cd1Smrg     {
877e1db7cd1Smrg       test "$[]*" != "X conftest.ts1 conftest.ts2" ||
878e1db7cd1Smrg       test "$[]*" != "X conftest.ts2 conftest.ts1";
879e1db7cd1Smrg     }
880e1db7cd1Smrg); then :; else
881e1db7cd1Smrg  # If neither matched, then we have a broken ls.  This can happen
882e1db7cd1Smrg  # if, for instance, CONFIG_SHELL is bash and it inherits a
883e1db7cd1Smrg  # broken ls alias from the environment.  This has actually
884e1db7cd1Smrg  # happened.  Such a system could not be considered "sane".
885e1db7cd1Smrg  _AS_ECHO_UNQUOTED(
886e1db7cd1Smrg    ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
887e1db7cd1Smrg    [AS_MESSAGE_LOG_FD])
888e1db7cd1Smrg  AC_MSG_FAILURE([ls -t produces unexpected output.
889e1db7cd1SmrgMake sure there is not a broken ls alias in your environment.])
890e1db7cd1Smrgfi
891e1db7cd1Smrg
892e1db7cd1Smrgfor am_try_res in $am_try_resolutions; do
893e1db7cd1Smrg  # Any one fine-grained sleep might happen to cross the boundary
894e1db7cd1Smrg  # between two values of a coarser actual resolution, but if we do
895e1db7cd1Smrg  # two fine-grained sleeps in a row, at least one of them will fall
896e1db7cd1Smrg  # entirely within a coarse interval.
897e1db7cd1Smrg  echo alpha > conftest.ts1
898e1db7cd1Smrg  sleep $am_try_res
899e1db7cd1Smrg  echo beta > conftest.ts2
900e1db7cd1Smrg  sleep $am_try_res
901e1db7cd1Smrg  echo gamma > conftest.ts3
902e1db7cd1Smrg
903e1db7cd1Smrg  # We assume that 'ls -t' will make use of high-resolution
904e1db7cd1Smrg  # timestamps if the operating system supports them at all.
905e1db7cd1Smrg  if (set X `ls -t conftest.ts?` &&
906e1db7cd1Smrg      test "$[]2" = conftest.ts3 &&
907e1db7cd1Smrg      test "$[]3" = conftest.ts2 &&
908e1db7cd1Smrg      test "$[]4" = conftest.ts1); then
909e1db7cd1Smrg    #
910e1db7cd1Smrg    # Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
911e1db7cd1Smrg    # because we don't need to test make.
912e1db7cd1Smrg    make_ok=true
913e1db7cd1Smrg    if test $am_try_res != 1; then
914e1db7cd1Smrg      # But if we've succeeded so far with a subsecond resolution, we
915e1db7cd1Smrg      # have one more thing to check: make. It can happen that
916e1db7cd1Smrg      # everything else supports the subsecond mtimes, but make doesn't;
917e1db7cd1Smrg      # notably on macOS, which ships make 3.81 from 2006 (the last one
918e1db7cd1Smrg      # released under GPLv2). https://bugs.gnu.org/68808
919e1db7cd1Smrg      # 
920e1db7cd1Smrg      # We test $MAKE if it is defined in the environment, else "make".
921e1db7cd1Smrg      # It might get overridden later, but our hope is that in practice
922e1db7cd1Smrg      # it does not matter: it is the system "make" which is (by far)
923e1db7cd1Smrg      # the most likely to be broken, whereas if the user overrides it,
924e1db7cd1Smrg      # probably they did so with a better, or at least not worse, make.
925e1db7cd1Smrg      # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
926e1db7cd1Smrg      #
927e1db7cd1Smrg      # Create a Makefile (real tab character here):
928e1db7cd1Smrg      rm -f conftest.mk
929e1db7cd1Smrg      echo 'conftest.ts1: conftest.ts2' >conftest.mk
930e1db7cd1Smrg      echo '	touch conftest.ts2' >>conftest.mk
931e1db7cd1Smrg      #
932e1db7cd1Smrg      # Now, running
933e1db7cd1Smrg      #   touch conftest.ts1; touch conftest.ts2; make
934e1db7cd1Smrg      # should touch ts1 because ts2 is newer. This could happen by luck,
935e1db7cd1Smrg      # but most often, it will fail if make's support is insufficient. So
936e1db7cd1Smrg      # test for several consecutive successes.
937e1db7cd1Smrg      #
938e1db7cd1Smrg      # (We reuse conftest.ts[12] because we still want to modify existing
939e1db7cd1Smrg      # files, not create new ones, per above.)
940e1db7cd1Smrg      n=0
941e1db7cd1Smrg      make=${MAKE-make}
942e1db7cd1Smrg      until test $n -eq 3; do
943e1db7cd1Smrg        echo one > conftest.ts1
944e1db7cd1Smrg        sleep $am_try_res
945e1db7cd1Smrg        echo two > conftest.ts2 # ts2 should now be newer than ts1
946e1db7cd1Smrg        if $make -f conftest.mk | grep 'up to date' >/dev/null; then
947e1db7cd1Smrg          make_ok=false
948e1db7cd1Smrg          break # out of $n loop
949e1db7cd1Smrg        fi
950e1db7cd1Smrg        n=`expr $n + 1`
951e1db7cd1Smrg      done
952e1db7cd1Smrg    fi
953e1db7cd1Smrg    #
954e1db7cd1Smrg    if $make_ok; then
955e1db7cd1Smrg      # Everything we know to check worked out, so call this resolution good.
956e1db7cd1Smrg      am_cv_filesystem_timestamp_resolution=$am_try_res
957e1db7cd1Smrg      break # out of $am_try_res loop
958e1db7cd1Smrg    fi
959e1db7cd1Smrg    # Otherwise, we'll go on to check the next resolution.
960e1db7cd1Smrg  fi
961e1db7cd1Smrgdone
962e1db7cd1Smrgrm -f conftest.ts?
963e1db7cd1Smrg# (end _am_filesystem_timestamp_resolution)
964e1db7cd1Smrg])])
965e1db7cd1Smrg
96676028eb6Smrg# AM_SANITY_CHECK
96776028eb6Smrg# ---------------
96876028eb6SmrgAC_DEFUN([AM_SANITY_CHECK],
969e1db7cd1Smrg[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
970e1db7cd1Smrg# This check should not be cached, as it may vary across builds of
971e1db7cd1Smrg# different projects.
972e1db7cd1SmrgAC_MSG_CHECKING([whether build environment is sane])
97376028eb6Smrg# Reject unsafe characters in $srcdir or the absolute working directory
97476028eb6Smrg# name.  Accept space and tab only in the latter.
97576028eb6Smrgam_lf='
97676028eb6Smrg'
97776028eb6Smrgcase `pwd` in
97876028eb6Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
97976028eb6Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
98076028eb6Smrgesac
98176028eb6Smrgcase $srcdir in
98276028eb6Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
98376028eb6Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
98476028eb6Smrgesac
98540c5823bSmrg
98676028eb6Smrg# Do 'set' in a subshell so we don't clobber the current shell's
98776028eb6Smrg# arguments.  Must try -L first in case configure is actually a
98876028eb6Smrg# symlink; some systems play weird games with the mod time of symlinks
98976028eb6Smrg# (eg FreeBSD returns the mod time of the symlink's containing
99076028eb6Smrg# directory).
991e1db7cd1Smrgam_build_env_is_sane=no
992e1db7cd1Smrgam_has_slept=no
993e1db7cd1Smrgrm -f conftest.file
994e1db7cd1Smrgfor am_try in 1 2; do
995e1db7cd1Smrg  echo "timestamp, slept: $am_has_slept" > conftest.file
996e1db7cd1Smrg  if (
997e1db7cd1Smrg    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
998e1db7cd1Smrg    if test "$[]*" = "X"; then
999e1db7cd1Smrg      # -L didn't work.
1000e1db7cd1Smrg      set X `ls -t "$srcdir/configure" conftest.file`
1001e1db7cd1Smrg    fi
1002e1db7cd1Smrg    test "$[]2" = conftest.file
1003e1db7cd1Smrg  ); then
1004e1db7cd1Smrg    am_build_env_is_sane=yes
1005e1db7cd1Smrg    break
1006e1db7cd1Smrg  fi
1007e1db7cd1Smrg  # Just in case.
1008e1db7cd1Smrg  sleep "$am_cv_filesystem_timestamp_resolution"
1009e1db7cd1Smrg  am_has_slept=yes
1010e1db7cd1Smrgdone
1011e1db7cd1Smrg
1012e1db7cd1SmrgAC_MSG_RESULT([$am_build_env_is_sane])
1013e1db7cd1Smrgif test "$am_build_env_is_sane" = no; then
1014e1db7cd1Smrg  AC_MSG_ERROR([newly created file is older than distributed files!
101576028eb6SmrgCheck your system clock])
10168f34cbf9Ssnjfi
1017e1db7cd1Smrg
101876028eb6Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
101976028eb6Smrg# generated files are strictly newer.
102076028eb6Smrgam_sleep_pid=
1021e1db7cd1SmrgAS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
1022e1db7cd1Smrg  ( sleep "$am_cv_filesystem_timestamp_resolution" ) &
102376028eb6Smrg  am_sleep_pid=$!
1024e1db7cd1Smrg])
102576028eb6SmrgAC_CONFIG_COMMANDS_PRE(
102676028eb6Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
102776028eb6Smrg   if test -n "$am_sleep_pid"; then
102876028eb6Smrg     # Hide warnings about reused PIDs.
102976028eb6Smrg     wait $am_sleep_pid 2>/dev/null
103076028eb6Smrg   fi
103176028eb6Smrg   AC_MSG_RESULT([done])])
103276028eb6Smrgrm -f conftest.file
103376028eb6Smrg])
1034bbe1b32bSmrg
1035e1db7cd1Smrg# Copyright (C) 2009-2024 Free Software Foundation, Inc.
10368f34cbf9Ssnj#
103776028eb6Smrg# This file is free software; the Free Software Foundation
103876028eb6Smrg# gives unlimited permission to copy and/or distribute it,
103976028eb6Smrg# with or without modifications, as long as this notice is preserved.
104030f8ce46Smrg
1041e1db7cd1Smrg# _AM_SILENT_RULES
1042e1db7cd1Smrg# ----------------
1043e1db7cd1Smrg# Enable less verbose build rules support.
1044e1db7cd1SmrgAC_DEFUN([_AM_SILENT_RULES],
1045e1db7cd1Smrg[AM_DEFAULT_VERBOSITY=1
1046e1db7cd1SmrgAC_ARG_ENABLE([silent-rules], [dnl
104776028eb6SmrgAS_HELP_STRING(
104876028eb6Smrg  [--enable-silent-rules],
104976028eb6Smrg  [less verbose build output (undo: "make V=1")])
105076028eb6SmrgAS_HELP_STRING(
105176028eb6Smrg  [--disable-silent-rules],
105276028eb6Smrg  [verbose build output (undo: "make V=0")])dnl
105376028eb6Smrg])
105476028eb6Smrgdnl
105576028eb6Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
105676028eb6Smrgdnl do not support nested variable expansions.
105776028eb6Smrgdnl See automake bug#9928 and bug#10237.
105876028eb6Smrgam_make=${MAKE-make}
105976028eb6SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
106076028eb6Smrg   [am_cv_make_support_nested_variables],
106176028eb6Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
106276028eb6SmrgBAR0=false
106376028eb6SmrgBAR1=true
106476028eb6SmrgV=1
106576028eb6Smrgam__doit:
106676028eb6Smrg	@$(TRUE)
106776028eb6Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
106876028eb6Smrg  am_cv_make_support_nested_variables=yes
106976028eb6Smrgelse
107076028eb6Smrg  am_cv_make_support_nested_variables=no
107176028eb6Smrgfi])
107276028eb6SmrgAC_SUBST([AM_V])dnl
107376028eb6SmrgAM_SUBST_NOTMAKE([AM_V])dnl
107476028eb6SmrgAC_SUBST([AM_DEFAULT_V])dnl
107576028eb6SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
107676028eb6SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
107776028eb6SmrgAM_BACKSLASH='\'
107876028eb6SmrgAC_SUBST([AM_BACKSLASH])dnl
107976028eb6Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
1080e1db7cd1Smrgdnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
1081e1db7cd1Smrgdnl to AM_SILENT_RULES to change the default value.
1082e1db7cd1SmrgAC_CONFIG_COMMANDS_PRE([dnl
1083e1db7cd1Smrgcase $enable_silent_rules in @%:@ (((
1084e1db7cd1Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
1085e1db7cd1Smrg   no) AM_DEFAULT_VERBOSITY=1;;
1086e1db7cd1Smrgesac
1087e1db7cd1Smrgif test $am_cv_make_support_nested_variables = yes; then
1088e1db7cd1Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
1089e1db7cd1Smrg  AM_V='$(V)'
1090e1db7cd1Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
1091e1db7cd1Smrgelse
1092e1db7cd1Smrg  AM_V=$AM_DEFAULT_VERBOSITY
1093e1db7cd1Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
1094e1db7cd1Smrgfi
1095e1db7cd1Smrg])dnl
109676028eb6Smrg])
109734f90d55Smrg
1098e1db7cd1Smrg# AM_SILENT_RULES([DEFAULT])
1099e1db7cd1Smrg# --------------------------
1100e1db7cd1Smrg# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
1101e1db7cd1Smrg# empty being verbose).
1102e1db7cd1SmrgAC_DEFUN([AM_SILENT_RULES],
1103e1db7cd1Smrg[AC_REQUIRE([_AM_SILENT_RULES])
1104e1db7cd1SmrgAM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
1105e1db7cd1Smrg
1106e1db7cd1Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
110776028eb6Smrg#
110876028eb6Smrg# This file is free software; the Free Software Foundation
110976028eb6Smrg# gives unlimited permission to copy and/or distribute it,
111076028eb6Smrg# with or without modifications, as long as this notice is preserved.
111134f90d55Smrg
111276028eb6Smrg# AM_PROG_INSTALL_STRIP
111376028eb6Smrg# ---------------------
111476028eb6Smrg# One issue with vendor 'install' (even GNU) is that you can't
111576028eb6Smrg# specify the program used to strip binaries.  This is especially
111676028eb6Smrg# annoying in cross-compiling environments, where the build's strip
111776028eb6Smrg# is unlikely to handle the host's binaries.
111876028eb6Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
111976028eb6Smrg# always use install-sh in "make install-strip", and initialize
112076028eb6Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
112176028eb6SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
112276028eb6Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
112376028eb6Smrg# Installed binaries are usually stripped using 'strip' when the user
112476028eb6Smrg# run "make install-strip".  However 'strip' might not be the right
112576028eb6Smrg# tool to use in cross-compilation environments, therefore Automake
112676028eb6Smrg# will honor the 'STRIP' environment variable to overrule this program.
112776028eb6Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
112876028eb6Smrgif test "$cross_compiling" != no; then
112976028eb6Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
113040c5823bSmrgfi
113176028eb6SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
113276028eb6SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
113334f90d55Smrg
1134e1db7cd1Smrg# Copyright (C) 2006-2024 Free Software Foundation, Inc.
113576028eb6Smrg#
113676028eb6Smrg# This file is free software; the Free Software Foundation
113776028eb6Smrg# gives unlimited permission to copy and/or distribute it,
113876028eb6Smrg# with or without modifications, as long as this notice is preserved.
113934f90d55Smrg
114076028eb6Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
114176028eb6Smrg# ---------------------------
114276028eb6Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
114376028eb6Smrg# This macro is traced by Automake.
114476028eb6SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
114534f90d55Smrg
114676028eb6Smrg# AM_SUBST_NOTMAKE(VARIABLE)
114776028eb6Smrg# --------------------------
114876028eb6Smrg# Public sister of _AM_SUBST_NOTMAKE.
114976028eb6SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
115034f90d55Smrg
115176028eb6Smrg# Check how to create a tarball.                            -*- Autoconf -*-
115276028eb6Smrg
1153e1db7cd1Smrg# Copyright (C) 2004-2024 Free Software Foundation, Inc.
115434f90d55Smrg#
115576028eb6Smrg# This file is free software; the Free Software Foundation
115676028eb6Smrg# gives unlimited permission to copy and/or distribute it,
115776028eb6Smrg# with or without modifications, as long as this notice is preserved.
115876028eb6Smrg
115976028eb6Smrg# _AM_PROG_TAR(FORMAT)
116076028eb6Smrg# --------------------
116176028eb6Smrg# Check how to create a tarball in format FORMAT.
116276028eb6Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
116334f90d55Smrg#
116476028eb6Smrg# Substitute a variable $(am__tar) that is a command
116576028eb6Smrg# writing to stdout a FORMAT-tarball containing the directory
116676028eb6Smrg# $tardir.
116776028eb6Smrg#     tardir=directory && $(am__tar) > result.tar
116834f90d55Smrg#
116976028eb6Smrg# Substitute a variable $(am__untar) that extract such
117076028eb6Smrg# a tarball read from stdin.
117176028eb6Smrg#     $(am__untar) < result.tar
117240c5823bSmrg#
117376028eb6SmrgAC_DEFUN([_AM_PROG_TAR],
117476028eb6Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
117576028eb6Smrg# in the wild :-(  We should find a proper way to deprecate it ...
117676028eb6SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
117734f90d55Smrg
117876028eb6Smrg# We'll loop over all known methods to create a tar archive until one works.
117976028eb6Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
118034f90d55Smrg
118176028eb6Smrgm4_if([$1], [v7],
118276028eb6Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
118334f90d55Smrg
118476028eb6Smrg  [m4_case([$1],
118576028eb6Smrg    [ustar],
118676028eb6Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
118776028eb6Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
118876028eb6Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
118976028eb6Smrg      # and bug#13588).
119076028eb6Smrg      am_max_uid=2097151 # 2^21 - 1
119176028eb6Smrg      am_max_gid=$am_max_uid
119276028eb6Smrg      # The $UID and $GID variables are not portable, so we need to resort
119376028eb6Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
119476028eb6Smrg      # below are definitely unexpected, so allow the users to see them
119576028eb6Smrg      # (that is, avoid stderr redirection).
119676028eb6Smrg      am_uid=`id -u || echo unknown`
119776028eb6Smrg      am_gid=`id -g || echo unknown`
119876028eb6Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1199e1db7cd1Smrg      if test x$am_uid = xunknown; then
1200e1db7cd1Smrg        AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
1201e1db7cd1Smrg      elif test $am_uid -le $am_max_uid; then
1202e1db7cd1Smrg        AC_MSG_RESULT([yes])
120376028eb6Smrg      else
1204e1db7cd1Smrg        AC_MSG_RESULT([no])
1205e1db7cd1Smrg        _am_tools=none
120676028eb6Smrg      fi
120776028eb6Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1208e1db7cd1Smrg      if test x$gm_gid = xunknown; then
1209e1db7cd1Smrg        AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
1210e1db7cd1Smrg      elif test $am_gid -le $am_max_gid; then
1211e1db7cd1Smrg        AC_MSG_RESULT([yes])
121276028eb6Smrg      else
121376028eb6Smrg        AC_MSG_RESULT([no])
121476028eb6Smrg        _am_tools=none
121576028eb6Smrg      fi],
121634f90d55Smrg
121776028eb6Smrg  [pax],
121876028eb6Smrg    [],
121934f90d55Smrg
122076028eb6Smrg  [m4_fatal([Unknown tar format])])
122130f8ce46Smrg
122276028eb6Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
122330f8ce46Smrg
122476028eb6Smrg  # Go ahead even if we have the value already cached.  We do so because we
122576028eb6Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
122676028eb6Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
122730f8ce46Smrg
122876028eb6Smrg  for _am_tool in $_am_tools; do
122976028eb6Smrg    case $_am_tool in
123076028eb6Smrg    gnutar)
123176028eb6Smrg      for _am_tar in tar gnutar gtar; do
123276028eb6Smrg        AM_RUN_LOG([$_am_tar --version]) && break
123376028eb6Smrg      done
123476028eb6Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
123576028eb6Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
123676028eb6Smrg      am__untar="$_am_tar -xf -"
123776028eb6Smrg      ;;
123876028eb6Smrg    plaintar)
123976028eb6Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
124076028eb6Smrg      # ustar tarball either.
124176028eb6Smrg      (tar --version) >/dev/null 2>&1 && continue
124276028eb6Smrg      am__tar='tar chf - "$$tardir"'
124376028eb6Smrg      am__tar_='tar chf - "$tardir"'
124476028eb6Smrg      am__untar='tar xf -'
124576028eb6Smrg      ;;
124676028eb6Smrg    pax)
124776028eb6Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
124876028eb6Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
124976028eb6Smrg      am__untar='pax -r'
125076028eb6Smrg      ;;
125176028eb6Smrg    cpio)
125276028eb6Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
125376028eb6Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
125476028eb6Smrg      am__untar='cpio -i -H $1 -d'
125576028eb6Smrg      ;;
125676028eb6Smrg    none)
125776028eb6Smrg      am__tar=false
125876028eb6Smrg      am__tar_=false
125976028eb6Smrg      am__untar=false
126076028eb6Smrg      ;;
126176028eb6Smrg    esac
126230f8ce46Smrg
126376028eb6Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
126476028eb6Smrg    # and am__untar set.
126576028eb6Smrg    test -n "${am_cv_prog_tar_$1}" && break
126630f8ce46Smrg
126776028eb6Smrg    # tar/untar a dummy directory, and stop if the command works.
126876028eb6Smrg    rm -rf conftest.dir
126976028eb6Smrg    mkdir conftest.dir
127076028eb6Smrg    echo GrepMe > conftest.dir/file
127176028eb6Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
127276028eb6Smrg    rm -rf conftest.dir
127376028eb6Smrg    if test -s conftest.tar; then
127476028eb6Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
127576028eb6Smrg      AM_RUN_LOG([cat conftest.dir/file])
127676028eb6Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
127776028eb6Smrg    fi
127876028eb6Smrg  done
127976028eb6Smrg  rm -rf conftest.dir
128076028eb6Smrg
128176028eb6Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
128276028eb6Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
128376028eb6Smrg
128476028eb6SmrgAC_SUBST([am__tar])
128576028eb6SmrgAC_SUBST([am__untar])
128676028eb6Smrg]) # _AM_PROG_TAR
128776028eb6Smrg
1288e1db7cd1Smrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
1289e1db7cd1Smrg#
1290e1db7cd1Smrg# This file is free software; the Free Software Foundation
1291e1db7cd1Smrg# gives unlimited permission to copy and/or distribute it,
1292e1db7cd1Smrg# with or without modifications, as long as this notice is preserved.
1293e1db7cd1Smrg
1294e1db7cd1Smrg# _AM_PROG_XARGS_N
1295e1db7cd1Smrg# ----------------
1296e1db7cd1Smrg# Check whether 'xargs -n' works.  It should work everywhere, so the fallback
1297e1db7cd1Smrg# is not optimized at all as we never expect to use it.
1298e1db7cd1SmrgAC_DEFUN([_AM_PROG_XARGS_N],
1299e1db7cd1Smrg[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
1300e1db7cd1SmrgAS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
1301e1db7cd1Smrg3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
1302e1db7cd1SmrgAS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
1303e1db7cd1Smrg  am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
1304e1db7cd1Smrg])dnl
1305e1db7cd1SmrgAC_SUBST(am__xargs_n)
1306e1db7cd1Smrg])
1307e1db7cd1Smrg
130876028eb6Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
130976028eb6Smrgdnl serial 11 (pkg-config-0.29)
131076028eb6Smrgdnl
131176028eb6Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
131276028eb6Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
131376028eb6Smrgdnl
131476028eb6Smrgdnl This program is free software; you can redistribute it and/or modify
131576028eb6Smrgdnl it under the terms of the GNU General Public License as published by
131676028eb6Smrgdnl the Free Software Foundation; either version 2 of the License, or
131776028eb6Smrgdnl (at your option) any later version.
131876028eb6Smrgdnl
131976028eb6Smrgdnl This program is distributed in the hope that it will be useful, but
132076028eb6Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
132176028eb6Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
132276028eb6Smrgdnl General Public License for more details.
132376028eb6Smrgdnl
132476028eb6Smrgdnl You should have received a copy of the GNU General Public License
132576028eb6Smrgdnl along with this program; if not, write to the Free Software
132676028eb6Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
132776028eb6Smrgdnl 02111-1307, USA.
132876028eb6Smrgdnl
132976028eb6Smrgdnl As a special exception to the GNU General Public License, if you
133076028eb6Smrgdnl distribute this file as part of a program that contains a
133176028eb6Smrgdnl configuration script generated by Autoconf, you may include it under
133276028eb6Smrgdnl the same distribution terms that you use for the rest of that
133376028eb6Smrgdnl program.
133476028eb6Smrg
133576028eb6Smrgdnl PKG_PREREQ(MIN-VERSION)
133676028eb6Smrgdnl -----------------------
133776028eb6Smrgdnl Since: 0.29
133876028eb6Smrgdnl
133976028eb6Smrgdnl Verify that the version of the pkg-config macros are at least
134076028eb6Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
134176028eb6Smrgdnl installed version of pkg-config, this checks the developer's version
134276028eb6Smrgdnl of pkg.m4 when generating configure.
134376028eb6Smrgdnl
134476028eb6Smrgdnl To ensure that this macro is defined, also add:
134576028eb6Smrgdnl m4_ifndef([PKG_PREREQ],
134676028eb6Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
134776028eb6Smrgdnl
134876028eb6Smrgdnl See the "Since" comment for each macro you use to see what version
134976028eb6Smrgdnl of the macros you require.
135076028eb6Smrgm4_defun([PKG_PREREQ],
135176028eb6Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
135276028eb6Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
135376028eb6Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
135476028eb6Smrg])dnl PKG_PREREQ
135576028eb6Smrg
135676028eb6Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
135776028eb6Smrgdnl ----------------------------------
135876028eb6Smrgdnl Since: 0.16
135976028eb6Smrgdnl
136076028eb6Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
136176028eb6Smrgdnl first found in the path. Checks that the version of pkg-config found
136276028eb6Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
136376028eb6Smrgdnl used since that's the first version where most current features of
136476028eb6Smrgdnl pkg-config existed.
136576028eb6SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
136676028eb6Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
136776028eb6Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
136876028eb6Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
136976028eb6SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
137076028eb6SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
137176028eb6SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
137276028eb6Smrg
137376028eb6Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
137476028eb6Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
137540c5823bSmrgfi
137676028eb6Smrgif test -n "$PKG_CONFIG"; then
137776028eb6Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
137876028eb6Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
137976028eb6Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
138076028eb6Smrg		AC_MSG_RESULT([yes])
138176028eb6Smrg	else
138276028eb6Smrg		AC_MSG_RESULT([no])
138376028eb6Smrg		PKG_CONFIG=""
138476028eb6Smrg	fi
138576028eb6Smrgfi[]dnl
138676028eb6Smrg])dnl PKG_PROG_PKG_CONFIG
138776028eb6Smrg
138876028eb6Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
138976028eb6Smrgdnl -------------------------------------------------------------------
139076028eb6Smrgdnl Since: 0.18
139176028eb6Smrgdnl
139276028eb6Smrgdnl Check to see whether a particular set of modules exists. Similar to
139376028eb6Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
139476028eb6Smrgdnl
139576028eb6Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
139676028eb6Smrgdnl only at the first occurence in configure.ac, so if the first place
139776028eb6Smrgdnl it's called might be skipped (such as if it is within an "if", you
139876028eb6Smrgdnl have to call PKG_CHECK_EXISTS manually
139976028eb6SmrgAC_DEFUN([PKG_CHECK_EXISTS],
140076028eb6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
140176028eb6Smrgif test -n "$PKG_CONFIG" && \
140276028eb6Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
140376028eb6Smrg  m4_default([$2], [:])
140476028eb6Smrgm4_ifvaln([$3], [else
140576028eb6Smrg  $3])dnl
140640c5823bSmrgfi])
140740c5823bSmrg
140876028eb6Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
140976028eb6Smrgdnl ---------------------------------------------
141076028eb6Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
141176028eb6Smrgdnl pkg_failed based on the result.
141276028eb6Smrgm4_define([_PKG_CONFIG],
141376028eb6Smrg[if test -n "$$1"; then
141476028eb6Smrg    pkg_cv_[]$1="$$1"
141576028eb6Smrg elif test -n "$PKG_CONFIG"; then
141676028eb6Smrg    PKG_CHECK_EXISTS([$3],
141776028eb6Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
141876028eb6Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
141976028eb6Smrg		     [pkg_failed=yes])
142076028eb6Smrg else
142176028eb6Smrg    pkg_failed=untried
142276028eb6Smrgfi[]dnl
142376028eb6Smrg])dnl _PKG_CONFIG
142434f90d55Smrg
142576028eb6Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
142676028eb6Smrgdnl ---------------------------
142776028eb6Smrgdnl Internal check to see if pkg-config supports short errors.
142876028eb6SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
142976028eb6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
143076028eb6Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
143176028eb6Smrg        _pkg_short_errors_supported=yes
143240c5823bSmrgelse
143376028eb6Smrg        _pkg_short_errors_supported=no
143476028eb6Smrgfi[]dnl
143576028eb6Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
143630f8ce46Smrg
143730f8ce46Smrg
143876028eb6Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
143976028eb6Smrgdnl   [ACTION-IF-NOT-FOUND])
144076028eb6Smrgdnl --------------------------------------------------------------
144176028eb6Smrgdnl Since: 0.4.0
144276028eb6Smrgdnl
144376028eb6Smrgdnl Note that if there is a possibility the first call to
144476028eb6Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
144576028eb6Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
144676028eb6SmrgAC_DEFUN([PKG_CHECK_MODULES],
144776028eb6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
144876028eb6SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
144976028eb6SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
145030f8ce46Smrg
145176028eb6Smrgpkg_failed=no
145276028eb6SmrgAC_MSG_CHECKING([for $1])
145330f8ce46Smrg
145476028eb6Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
145576028eb6Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
145630f8ce46Smrg
145776028eb6Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
145876028eb6Smrgand $1[]_LIBS to avoid the need to call pkg-config.
145976028eb6SmrgSee the pkg-config man page for more details.])
146030f8ce46Smrg
146176028eb6Smrgif test $pkg_failed = yes; then
146276028eb6Smrg   	AC_MSG_RESULT([no])
146376028eb6Smrg        _PKG_SHORT_ERRORS_SUPPORTED
146476028eb6Smrg        if test $_pkg_short_errors_supported = yes; then
146576028eb6Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
146676028eb6Smrg        else 
146776028eb6Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
146876028eb6Smrg        fi
146976028eb6Smrg	# Put the nasty error message in config.log where it belongs
147076028eb6Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
147176028eb6Smrg
147276028eb6Smrg	m4_default([$4], [AC_MSG_ERROR(
147376028eb6Smrg[Package requirements ($2) were not met:
147476028eb6Smrg
147576028eb6Smrg$$1_PKG_ERRORS
147676028eb6Smrg
147776028eb6SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
147876028eb6Smrginstalled software in a non-standard prefix.
147930f8ce46Smrg
148076028eb6Smrg_PKG_TEXT])[]dnl
148176028eb6Smrg        ])
148276028eb6Smrgelif test $pkg_failed = untried; then
148376028eb6Smrg     	AC_MSG_RESULT([no])
148476028eb6Smrg	m4_default([$4], [AC_MSG_FAILURE(
148576028eb6Smrg[The pkg-config script could not be found or is too old.  Make sure it
148676028eb6Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
148776028eb6Smrgpath to pkg-config.
1488bbe1b32bSmrg
148976028eb6Smrg_PKG_TEXT
1490bbe1b32bSmrg
149176028eb6SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
149276028eb6Smrg        ])
149340c5823bSmrgelse
149476028eb6Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
149576028eb6Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
149676028eb6Smrg        AC_MSG_RESULT([yes])
149776028eb6Smrg	$3
149876028eb6Smrgfi[]dnl
149976028eb6Smrg])dnl PKG_CHECK_MODULES
1500bbe1b32bSmrg
150130f8ce46Smrg
150276028eb6Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
150376028eb6Smrgdnl   [ACTION-IF-NOT-FOUND])
150476028eb6Smrgdnl ---------------------------------------------------------------------
150576028eb6Smrgdnl Since: 0.29
150676028eb6Smrgdnl
150776028eb6Smrgdnl Checks for existence of MODULES and gathers its build flags with
150876028eb6Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
150976028eb6Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
151076028eb6Smrgdnl
151176028eb6Smrgdnl Note that if there is a possibility the first call to
151276028eb6Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
151376028eb6Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
151476028eb6Smrgdnl configure.ac.
151576028eb6SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
151676028eb6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
151776028eb6Smrg_save_PKG_CONFIG=$PKG_CONFIG
151876028eb6SmrgPKG_CONFIG="$PKG_CONFIG --static"
151976028eb6SmrgPKG_CHECK_MODULES($@)
152076028eb6SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
152176028eb6Smrg])dnl PKG_CHECK_MODULES_STATIC
1522bbe1b32bSmrg
1523ce6676dbSmrg
152476028eb6Smrgdnl PKG_INSTALLDIR([DIRECTORY])
152576028eb6Smrgdnl -------------------------
152676028eb6Smrgdnl Since: 0.27
152776028eb6Smrgdnl
152876028eb6Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
152976028eb6Smrgdnl should install pkg-config .pc files. By default the directory is
153076028eb6Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
153176028eb6Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
153276028eb6Smrgdnl parameter.
153376028eb6SmrgAC_DEFUN([PKG_INSTALLDIR],
153476028eb6Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
153576028eb6Smrgm4_pushdef([pkg_description],
153676028eb6Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
153776028eb6SmrgAC_ARG_WITH([pkgconfigdir],
153876028eb6Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
153976028eb6Smrg    [with_pkgconfigdir=]pkg_default)
154076028eb6SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
154176028eb6Smrgm4_popdef([pkg_default])
154276028eb6Smrgm4_popdef([pkg_description])
154376028eb6Smrg])dnl PKG_INSTALLDIR
1544ce6676dbSmrg
1545ce6676dbSmrg
154676028eb6Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
154776028eb6Smrgdnl --------------------------------
154876028eb6Smrgdnl Since: 0.27
154976028eb6Smrgdnl
155076028eb6Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
155176028eb6Smrgdnl module should install arch-independent pkg-config .pc files. By
155276028eb6Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
155376028eb6Smrgdnl changed by passing DIRECTORY. The user can override through the
155476028eb6Smrgdnl --with-noarch-pkgconfigdir parameter.
155576028eb6SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
155676028eb6Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
155776028eb6Smrgm4_pushdef([pkg_description],
155876028eb6Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
155976028eb6SmrgAC_ARG_WITH([noarch-pkgconfigdir],
156076028eb6Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
156176028eb6Smrg    [with_noarch_pkgconfigdir=]pkg_default)
156276028eb6SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
156376028eb6Smrgm4_popdef([pkg_default])
156476028eb6Smrgm4_popdef([pkg_description])
156576028eb6Smrg])dnl PKG_NOARCH_INSTALLDIR
1566ce6676dbSmrg
1567ce6676dbSmrg
156876028eb6Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
156976028eb6Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
157076028eb6Smrgdnl -------------------------------------------
157176028eb6Smrgdnl Since: 0.28
157276028eb6Smrgdnl
157376028eb6Smrgdnl Retrieves the value of the pkg-config variable for the given module.
157476028eb6SmrgAC_DEFUN([PKG_CHECK_VAR],
157576028eb6Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
157676028eb6SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1577ce6676dbSmrg
157876028eb6Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
157976028eb6SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1580ce6676dbSmrg
158176028eb6SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
158276028eb6Smrg])dnl PKG_CHECK_VAR
1583ce6676dbSmrg
158476028eb6Smrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
158576028eb6Smrgdnl
1586e1db7cd1Smrgdnl This file comes from X.Org's font-util 1.4.1
158776028eb6Smrgdnl
1588e1db7cd1Smrgdnl Copyright (c) 2009, 2023, Oracle and/or its affiliates.
158976028eb6Smrgdnl
159076028eb6Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
159176028eb6Smrgdnl copy of this software and associated documentation files (the "Software"),
159276028eb6Smrgdnl to deal in the Software without restriction, including without limitation
159376028eb6Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
159476028eb6Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
159576028eb6Smrgdnl Software is furnished to do so, subject to the following conditions:
159676028eb6Smrgdnl
159776028eb6Smrgdnl The above copyright notice and this permission notice (including the next
159876028eb6Smrgdnl paragraph) shall be included in all copies or substantial portions of the
159976028eb6Smrgdnl Software.
160076028eb6Smrgdnl
160176028eb6Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
160276028eb6Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
160376028eb6Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
160476028eb6Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
160576028eb6Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
160676028eb6Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
160776028eb6Smrgdnl DEALINGS IN THE SOFTWARE.
160876028eb6Smrgdnl
160976028eb6Smrgdnl --------------------------------------------------------------------
161076028eb6Smrgdnl
161176028eb6Smrgdnl Copyright 2005 Red Hat, Inc
161276028eb6Smrgdnl
161376028eb6Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
161476028eb6Smrgdnl documentation for any purpose is hereby granted without fee, provided that
161576028eb6Smrgdnl the above copyright notice appear in all copies and that both that
161676028eb6Smrgdnl copyright notice and this permission notice appear in supporting
161776028eb6Smrgdnl documentation.
161876028eb6Smrgdnl
161976028eb6Smrgdnl The above copyright notice and this permission notice shall be included
162076028eb6Smrgdnl in all copies or substantial portions of the Software.
162176028eb6Smrgdnl
162276028eb6Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
162376028eb6Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
162476028eb6Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
162576028eb6Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
162676028eb6Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
162776028eb6Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
162876028eb6Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
162976028eb6Smrgdnl
163076028eb6Smrgdnl Except as contained in this notice, the name of the copyright holders shall
163176028eb6Smrgdnl not be used in advertising or otherwise to promote the sale, use or
163276028eb6Smrgdnl other dealings in this Software without prior written authorization
163376028eb6Smrgdnl from the copyright holders.
163476028eb6Smrg
163576028eb6Smrg# XORG_FONT_MACROS_VERSION(required-version)
163676028eb6Smrg# ------------------------------------------
163776028eb6Smrg# Minimum version: 1.1.0
163840c5823bSmrg#
163976028eb6Smrg# If you're using a macro added in Version 1.1 or newer, include this in
164076028eb6Smrg# your configure.ac with the minimum required version, such as:
164176028eb6Smrg# XORG_FONT_MACROS_VERSION(1.1)
164240c5823bSmrg#
164376028eb6Smrg# To ensure that this macro is defined, also add:
164476028eb6Smrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
164576028eb6Smrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
164640c5823bSmrg#
164740c5823bSmrg#
164876028eb6Smrg# See the "minimum version" comment for each macro you use to see what
164976028eb6Smrg# version you require.
165076028eb6Smrgm4_defun([XORG_FONT_MACROS_VERSION],[
1651e1db7cd1Smrgm4_define([vers_have], [1.4.1])
165276028eb6Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
165376028eb6Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
165476028eb6Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
165576028eb6Smrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
165676028eb6Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
165776028eb6Smrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
165876028eb6Smrgm4_undefine([vers_have])
165976028eb6Smrgm4_undefine([maj_have])
166076028eb6Smrgm4_undefine([maj_needed])
166176028eb6Smrg]) # XORG_FONT_MACROS_VERSION
166240c5823bSmrg
166376028eb6Smrg# XORG_FONT_CHECK_{maps}()
166476028eb6Smrg# ------------------------
166576028eb6Smrg# Minimum version: 1.0.0
166676028eb6Smrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
166776028eb6Smrg# JISX0201 or KOI8_R.  By default, they are all enabled.
166840c5823bSmrg
166976028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
167076028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
167176028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
167276028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
167376028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
167476028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
167576028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
167676028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
167776028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
167876028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
167976028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
168076028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
168176028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
168276028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
168376028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
168476028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
168576028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
168676028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
1687ce6676dbSmrg
168876028eb6Smrg# XORG_FONT_CHECK_ENCODING(encoding)
168976028eb6Smrg# ----------------------------------
169076028eb6Smrg# Minimum version: 1.1.0
169176028eb6Smrg# This macro adds --enable/disable-<encoding>, enabled by default.
169276028eb6Smrg# It replaced individual copies of this code in the above macros in 1.1.
169376028eb6Smrg# Currently assumes encoding names will be all upper-case - add m4_toupper
169476028eb6Smrg# calls if this is not true in the future.
169540c5823bSmrg
169676028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
169776028eb6Smrg	AC_ARG_ENABLE(m4_tolower($1),
169876028eb6Smrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
169976028eb6Smrg				[Build $1 fonts (default: yes)]),
170076028eb6Smrg		[AS_TR_SH($1)=$enableval])
170176028eb6Smrg	AC_MSG_CHECKING([whether to build $1 fonts])
170276028eb6Smrg	AC_MSG_RESULT($[AS_TR_SH($1)])
170376028eb6Smrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
170476028eb6Smrg]) # XORG_FONT_CHECK_ENCODING
1705ce6676dbSmrg
170676028eb6Smrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
170776028eb6Smrg# -----------------------------------------------------
170876028eb6Smrg# Minimum version: 1.1.0
170976028eb6Smrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
171076028eb6Smrg# Add a shorthand --enable/disable-all-encodings option.
1711ce6676dbSmrg
171276028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
171376028eb6Smrg	AC_ARG_ENABLE([all-encodings],
171476028eb6Smrg		AS_HELP_STRING([--disable-all-encodings],
171576028eb6Smrg				[Disable building of all font encodings]),
171676028eb6Smrg		[m4_foreach_w([enc], [$1], [
171776028eb6Smrg			AS_TR_SH(enc)=$enableval
171876028eb6Smrg		])],
171976028eb6Smrg		[m4_foreach_w([enc], [$1], [
172076028eb6Smrg			AS_TR_SH(enc)=yes
172176028eb6Smrg		])])
172276028eb6Smrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
172376028eb6Smrg]) # XORG_FONT_CHECK_ENCODING_LIST
1724ce6676dbSmrg
172576028eb6Smrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
172676028eb6Smrg# ------------------------------------------
172776028eb6Smrg# Minimum version: 1.1.0
172840c5823bSmrg#
172976028eb6Smrg# Simple wrapper around AC_PATH_PROG that errors if not found
173040c5823bSmrg#
173176028eb6Smrg
173276028eb6SmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
173376028eb6Smrg	AC_PATH_PROG($1, $2)
173476028eb6Smrg	if test x"$$1" = x; then
173576028eb6Smrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
173676028eb6Smrg	fi
173776028eb6Smrg])
173876028eb6Smrg
173976028eb6Smrg
174076028eb6Smrg# XORG_FONT_FCCACHE()
174176028eb6Smrg# -------------------
174276028eb6Smrg# Minimum version: 1.1.0
174340c5823bSmrg#
174476028eb6Smrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
174576028eb6Smrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
174676028eb6Smrg# to run fc-cache if found and not installing to $DESTDIR and not
174776028eb6Smrg# cross-compiling
174840c5823bSmrg#
174976028eb6Smrg# fc-cache is optional, not required, and should be skipped when making
175076028eb6Smrg# packages (installing to $DESTDIR) or cross-compiling
175140c5823bSmrg#
175276028eb6SmrgAC_DEFUN([XORG_FONT_FCCACHE],[
175376028eb6Smrg	AC_PATH_PROG(FCCACHE, fc-cache)
175476028eb6Smrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
175576028eb6Smrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
175676028eb6Smrg		RUN_FCCACHE="${FCCACHE_WARN}"
175776028eb6Smrg	else
175876028eb6Smrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
175976028eb6Smrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
176076028eb6Smrg	fi
176176028eb6Smrg	AC_SUBST([RUN_FCCACHE])
176276028eb6Smrg])
176376028eb6Smrg
176476028eb6Smrg# XORG_FONT_MKFONTDIR()
176576028eb6Smrg# -------------------
176676028eb6Smrg# Minimum version: 1.3.0
176740c5823bSmrg#
176876028eb6Smrg# Set MKFONTDIR to path to mkfontdir.
176940c5823bSmrg#
177076028eb6Smrg# If cross-compiling, and if mkdir is not found, use a shell command
177176028eb6Smrg# which warns mkfontdir needs to be run on the target
177240c5823bSmrg#
177376028eb6Smrg# If not cross-compiling, mkfontdir must be found
177440c5823bSmrg#
177576028eb6SmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
177676028eb6Smrg	if test x"$cross_compiling" != x"no" ; then
177776028eb6Smrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
177876028eb6Smrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
1779ce6676dbSmrg
178076028eb6Smrg		if test x"$MKFONTDIR" = x; then
178176028eb6Smrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
178276028eb6Smrg		fi
178376028eb6Smrg	else
178476028eb6Smrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
178576028eb6Smrg	fi
178676028eb6Smrg
178776028eb6Smrg	AC_SUBST([MKFONTDIR])
178876028eb6Smrg])
178976028eb6Smrg
179076028eb6Smrg# XORG_FONT_COMMON_UTILS()
179176028eb6Smrg# ------------------------
179276028eb6Smrg# Minimum version: 1.1.0
179340c5823bSmrg#
179476028eb6Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
179576028eb6Smrg
179676028eb6SmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
179776028eb6Smrg	XORG_FONT_FCCACHE
179876028eb6Smrg	XORG_FONT_MKFONTDIR
179976028eb6Smrg])
180076028eb6Smrg
180176028eb6Smrg# XORG_FONT_SCALED_UTILS()
180276028eb6Smrg# ------------------------
180376028eb6Smrg# Minimum version: 1.1.0
180440c5823bSmrg#
180576028eb6Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
180676028eb6Smrg# (TrueType, OpenType, Type1)
180776028eb6Smrg
180876028eb6SmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
180976028eb6Smrg	XORG_FONT_COMMON_UTILS
181076028eb6Smrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
181176028eb6Smrg])
181276028eb6Smrg
181376028eb6Smrg# XORG_FONT_BDF_UTILS()
181476028eb6Smrg# ---------------------
181576028eb6Smrg# Minimum version: 1.1.0
181640c5823bSmrg#
181776028eb6Smrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
181876028eb6Smrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
181976028eb6Smrg# PCF output files created by bdftopcf
182076028eb6Smrg
182176028eb6SmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
182276028eb6Smrg	XORG_FONT_COMMON_UTILS
182376028eb6Smrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
182476028eb6Smrg	XORG_FONT_CHECK_COMPRESSION
182576028eb6Smrg])
182676028eb6Smrg
182776028eb6Smrg# XORG_FONT_CHECK_COMPRESSION()
182876028eb6Smrg# -----------------------------
182976028eb6Smrg# Minimum version: 1.1.0
183040c5823bSmrg#
183176028eb6Smrg# Offer a --with-compression flag to control what compression method is
183276028eb6Smrg# used for pcf font files.   Offers all the methods currently supported
183376028eb6Smrg# by libXfont, including no compression.
1834e1db7cd1Smrg#
1835e1db7cd1Smrg# If COMPRESS_FLAGS is not set, and the compression method has flags needed
1836e1db7cd1Smrg# for reproducible builds, such as gzip -n to not record timestamp, will
1837e1db7cd1Smrg# set COMPRESS_FLAGS to those options.
1838ce6676dbSmrg
183976028eb6SmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
184076028eb6Smrg	AC_MSG_CHECKING([font compression method])
184176028eb6Smrg	AC_ARG_WITH(compression,
184276028eb6Smrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
184376028eb6Smrg			 [compression method to use on pcf fonts])],
184476028eb6Smrg         [compression="$withval"], [compression="yes"])
184576028eb6Smrg	if test x"$compression" = "xyes" ; then
184676028eb6Smrg		compression="gzip"
184776028eb6Smrg	fi
184876028eb6Smrg	AC_MSG_RESULT([${compression}])
184976028eb6Smrg	case ${compression} in
185076028eb6Smrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
1851e1db7cd1Smrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;
1852e1db7cd1Smrg			COMPRESS_FLAGS="${COMPRESS_FLAGS--n}" ;;
185376028eb6Smrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
185476028eb6Smrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
185576028eb6Smrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
185676028eb6Smrg	esac
185776028eb6Smrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
185876028eb6Smrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
185976028eb6Smrg	fi
1860e1db7cd1Smrg	AC_MSG_CHECKING([options to font compression command])
1861e1db7cd1Smrg	AC_MSG_RESULT([${COMPRESS_FLAGS:-none}])
1862e1db7cd1Smrg	AC_SUBST([COMPRESS_FLAGS])
186376028eb6Smrg	AC_SUBST([COMPRESS_SUFFIX])
186476028eb6Smrg])
1865ce6676dbSmrg
186676028eb6Smrg# XORG_FONT_UCS2ANY()
186776028eb6Smrg# -------------------
186876028eb6Smrg# Minimum version: 1.1.0
186976028eb6Smrg#
187076028eb6Smrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
187176028eb6Smrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
187276028eb6Smrg# Also call pkg-config to find the directory with the encoding files needed
187376028eb6Smrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
1874ce6676dbSmrg
187576028eb6SmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
187676028eb6Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
187776028eb6Smrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
187876028eb6Smrg	PKG_CHECK_MODULES(MAPS, [fontutil])
187976028eb6Smrg	AC_MSG_CHECKING([for ucs2any encoding data files])
188076028eb6Smrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
188176028eb6Smrg	AC_SUBST(MAPFILES_PATH)
188276028eb6Smrg	AC_MSG_RESULT([${MAPFILES_PATH}])
188376028eb6Smrg])
1884ce6676dbSmrg
1885ce6676dbSmrg
188676028eb6Smrg
188776028eb6Smrg# XORG_FONT_FC_CONFDIR()
188876028eb6Smrg# --------------------
188976028eb6Smrg# Minimum version: 1.2.0
1890ce6676dbSmrg#
189176028eb6Smrg# Sets FC_CONFDIR to the fontconfig config directory
189276028eb6Smrg# (which should be --with-confdir=... when building fontconfig)
189376028eb6Smrg# found from:
189476028eb6Smrg#	--with-fc-confdir=...
189576028eb6Smrg#	pkg-config --variable=confdir fontconfig
189676028eb6Smrg#	${sysconfdir}/fonts
1897ce6676dbSmrg
189876028eb6SmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
189976028eb6Smrg	dnl Ensure $PKG_CONFIG is set first
190076028eb6Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1901ce6676dbSmrg
190276028eb6Smrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
190376028eb6Smrg	AC_ARG_WITH(fc-confdir,
190476028eb6Smrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
190576028eb6Smrg			   [Path to fontconfig's configuration directory]),
190676028eb6Smrg		    [FC_CONFDIR="$withval"])
190776028eb6Smrg	# if --with-fc-confdir was not specified
190876028eb6Smrg	if test "x${FC_CONFDIR}" = "x"; then
190976028eb6Smrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
191076028eb6Smrg	fi
191176028eb6Smrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
191276028eb6Smrg	if test "x${FC_CONFDIR}" = "x"; then
191376028eb6Smrg		FC_CONFDIR="${sysconfdir}/fonts"
191476028eb6Smrg	fi
191576028eb6Smrg	AC_SUBST(FC_CONFDIR)
191676028eb6Smrg	AC_MSG_RESULT([${FC_CONFDIR}])
191776028eb6Smrg])
1918ce6676dbSmrg
1919ce6676dbSmrg
192076028eb6Smrg
192176028eb6Smrg# XORG_FONTROOTDIR()
192276028eb6Smrg# --------------------
192340c5823bSmrg# Minimum version: 1.1.0
192430f8ce46Smrg#
192576028eb6Smrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
192676028eb6Smrg# found from:
192776028eb6Smrg#	--with-fontrootdir
192876028eb6Smrg#	pkg-config --variable=fontrootdir fontutil
192976028eb6Smrg#	${datadir}/fonts/X11
193030f8ce46Smrg
193176028eb6SmrgAC_DEFUN([XORG_FONTROOTDIR],[
193276028eb6Smrg	dnl Ensure $PKG_CONFIG is set first
193376028eb6Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
193440c5823bSmrg
193576028eb6Smrg	AC_MSG_CHECKING([for root directory for font files])
193676028eb6Smrg	AC_ARG_WITH(fontrootdir,
193776028eb6Smrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
193876028eb6Smrg			   [Path to root directory for font files]),
193976028eb6Smrg		    [FONTROOTDIR="$withval"])
194076028eb6Smrg	# if --with-fontrootdir not specified...
194176028eb6Smrg	if test "x${FONTROOTDIR}" = "x"; then
194276028eb6Smrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
194376028eb6Smrg	fi
194476028eb6Smrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
194576028eb6Smrg	if test "x${FONTROOTDIR}" = "x"; then
194676028eb6Smrg		FONTROOTDIR="${datadir}/fonts/X11"
194776028eb6Smrg	fi
194876028eb6Smrg	AC_SUBST(FONTROOTDIR)
194976028eb6Smrg	AC_MSG_RESULT([${FONTROOTDIR}])
195076028eb6Smrg])
195140c5823bSmrg
195276028eb6Smrg# XORG_FONTSUBDIR(variable, flag, subdir)
195376028eb6Smrg# ---------------------------------------
195476028eb6Smrg# Minimum version: 1.1.0
195576028eb6Smrg#
195676028eb6Smrg# Offer a --with-<flag> flag to control directory for font installation
195776028eb6Smrg# Default is the specified <subdir> of the font root directory.
195876028eb6Smrg# Sets <variable> to the selected directory
195930f8ce46Smrg
196076028eb6SmrgAC_DEFUN([XORG_FONTSUBDIR],[
196176028eb6Smrg	AC_REQUIRE([XORG_FONTROOTDIR])
196276028eb6Smrg
196376028eb6Smrg	AC_MSG_CHECKING([for directory for $3 files])
196476028eb6Smrg	AC_ARG_WITH($2,
196576028eb6Smrg		    [AS_HELP_STRING([--with-$2=DIR],
196676028eb6Smrg				    [Path to $3 files [FONTROOTDIR/$3]])],
196776028eb6Smrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
196876028eb6Smrg	AC_SUBST($1)
196976028eb6Smrg	AC_MSG_RESULT([${$1}])
197076028eb6Smrg]) # XORG_FONTSUBDIR
197130f8ce46Smrg
197276028eb6Smrg# XORG_FONTDIR(subdir)
197376028eb6Smrg# --------------------
197476028eb6Smrg# Minimum version: 1.1.0
197576028eb6Smrg#
197676028eb6Smrg# Offer a --with-fontdir flag to control directory for font installation
197776028eb6Smrg# Default is the specified subdir of the font root directory.
197876028eb6Smrg# Sets FONTDIR to the selected directory
197930f8ce46Smrg
198076028eb6SmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
198140c5823bSmrg
198276028eb6Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
198376028eb6Smrgdnl
1984e1db7cd1Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
198576028eb6Smrgdnl
198676028eb6Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
198776028eb6Smrgdnl copy of this software and associated documentation files (the "Software"),
198876028eb6Smrgdnl to deal in the Software without restriction, including without limitation
198976028eb6Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
199076028eb6Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
199176028eb6Smrgdnl Software is furnished to do so, subject to the following conditions:
199276028eb6Smrgdnl
199376028eb6Smrgdnl The above copyright notice and this permission notice (including the next
199476028eb6Smrgdnl paragraph) shall be included in all copies or substantial portions of the
199576028eb6Smrgdnl Software.
199676028eb6Smrgdnl
199776028eb6Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
199876028eb6Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
199976028eb6Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
200076028eb6Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
200176028eb6Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
200276028eb6Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
200376028eb6Smrgdnl DEALINGS IN THE SOFTWARE.
200476028eb6Smrg
200576028eb6Smrg# XORG_MACROS_VERSION(required-version)
200676028eb6Smrg# -------------------------------------
200740c5823bSmrg# Minimum version: 1.1.0
200834f90d55Smrg#
200976028eb6Smrg# If you're using a macro added in Version 1.1 or newer, include this in
201076028eb6Smrg# your configure.ac with the minimum required version, such as:
201176028eb6Smrg# XORG_MACROS_VERSION(1.1)
201234f90d55Smrg#
201376028eb6Smrg# To ensure that this macro is defined, also add:
201476028eb6Smrg# m4_ifndef([XORG_MACROS_VERSION],
201576028eb6Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
201634f90d55Smrg#
201776028eb6Smrg#
201876028eb6Smrg# See the "minimum version" comment for each macro you use to see what
201976028eb6Smrg# version you require.
202076028eb6Smrgm4_defun([XORG_MACROS_VERSION],[
2021e1db7cd1Smrgm4_define([vers_have], [1.20.1])
202276028eb6Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
202376028eb6Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
202476028eb6Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
202576028eb6Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
202676028eb6Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
202776028eb6Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
202876028eb6Smrgm4_undefine([vers_have])
202976028eb6Smrgm4_undefine([maj_have])
203076028eb6Smrgm4_undefine([maj_needed])
203176028eb6Smrg]) # XORG_MACROS_VERSION
203234f90d55Smrg
203376028eb6Smrg# XORG_PROG_RAWCPP()
203476028eb6Smrg# ------------------
203576028eb6Smrg# Minimum version: 1.0.0
203676028eb6Smrg#
203776028eb6Smrg# Find cpp program and necessary flags for use in pre-processing text files
203876028eb6Smrg# such as man pages and config files
203976028eb6SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
204076028eb6SmrgAC_REQUIRE([AC_PROG_CPP])
204176028eb6SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
204276028eb6Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
204340c5823bSmrg
204476028eb6Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
204576028eb6Smrg# which is not the best choice for supporting other OS'es, but covers most
204676028eb6Smrg# of the ones we need for now.
204776028eb6SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
204876028eb6SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
204976028eb6Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
205076028eb6Smrg	AC_MSG_RESULT([no])
205176028eb6Smrgelse
205276028eb6Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
205376028eb6Smrg		RAWCPPFLAGS=-undef
205476028eb6Smrg		AC_MSG_RESULT([yes])
205576028eb6Smrg	# under Cygwin unix is still defined even with -undef
205676028eb6Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
205776028eb6Smrg		RAWCPPFLAGS="-undef -ansi"
205876028eb6Smrg		AC_MSG_RESULT([yes, with -ansi])
205976028eb6Smrg	else
206076028eb6Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
206176028eb6Smrg	fi
206234f90d55Smrgfi
206376028eb6Smrgrm -f conftest.$ac_ext
206434f90d55Smrg
206576028eb6SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
206676028eb6SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
2067e1db7cd1Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
206876028eb6Smrg	AC_MSG_RESULT([no])
206976028eb6Smrgelse
2070e1db7cd1Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
207176028eb6Smrg		TRADITIONALCPPFLAGS="-traditional"
207276028eb6Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
207376028eb6Smrg		AC_MSG_RESULT([yes])
207476028eb6Smrg	else
207576028eb6Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
207676028eb6Smrg	fi
207776028eb6Smrgfi
207876028eb6Smrgrm -f conftest.$ac_ext
207976028eb6SmrgAC_SUBST(RAWCPPFLAGS)
208076028eb6SmrgAC_SUBST(TRADITIONALCPPFLAGS)
208176028eb6Smrg]) # XORG_PROG_RAWCPP
208240c5823bSmrg
208376028eb6Smrg# XORG_MANPAGE_SECTIONS()
208476028eb6Smrg# -----------------------
208576028eb6Smrg# Minimum version: 1.0.0
208634f90d55Smrg#
208776028eb6Smrg# Determine which sections man pages go in for the different man page types
208876028eb6Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
208976028eb6Smrg# Not sure if there's any better way than just hardcoding by OS name.
209076028eb6Smrg# Override default settings by setting environment variables
209176028eb6Smrg# Added MAN_SUBSTS in version 1.8
209276028eb6Smrg# Added AC_PROG_SED in version 1.8
209340c5823bSmrg
209476028eb6SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
209576028eb6SmrgAC_REQUIRE([AC_CANONICAL_HOST])
209676028eb6SmrgAC_REQUIRE([AC_PROG_SED])
209734f90d55Smrg
209876028eb6Smrgcase $host_os in
209976028eb6Smrg    solaris*)
210076028eb6Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
210176028eb6Smrg        # check for a man page file found in later versions that use
210276028eb6Smrg        # traditional section numbers instead
210376028eb6Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
210476028eb6Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
210576028eb6Smrg        ;;
210676028eb6Smrg    *) SYSV_MAN_SECTIONS=false ;;
210776028eb6Smrgesac
210840c5823bSmrg
210976028eb6Smrgif test x$APP_MAN_SUFFIX = x    ; then
211076028eb6Smrg    APP_MAN_SUFFIX=1
211176028eb6Smrgfi
211276028eb6Smrgif test x$APP_MAN_DIR = x    ; then
211376028eb6Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
211476028eb6Smrgfi
211540c5823bSmrg
211676028eb6Smrgif test x$LIB_MAN_SUFFIX = x    ; then
211776028eb6Smrg    LIB_MAN_SUFFIX=3
211876028eb6Smrgfi
211976028eb6Smrgif test x$LIB_MAN_DIR = x    ; then
212076028eb6Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
212176028eb6Smrgfi
212240c5823bSmrg
212376028eb6Smrgif test x$FILE_MAN_SUFFIX = x    ; then
212476028eb6Smrg    case $SYSV_MAN_SECTIONS in
212576028eb6Smrg	true)				FILE_MAN_SUFFIX=4  ;;
212676028eb6Smrg	*)				FILE_MAN_SUFFIX=5  ;;
212776028eb6Smrg    esac
212876028eb6Smrgfi
212976028eb6Smrgif test x$FILE_MAN_DIR = x    ; then
213076028eb6Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
213134f90d55Smrgfi
213234f90d55Smrg
213376028eb6Smrgif test x$MISC_MAN_SUFFIX = x    ; then
213476028eb6Smrg    case $SYSV_MAN_SECTIONS in
213576028eb6Smrg	true)				MISC_MAN_SUFFIX=5  ;;
213676028eb6Smrg	*)				MISC_MAN_SUFFIX=7  ;;
213776028eb6Smrg    esac
213876028eb6Smrgfi
213976028eb6Smrgif test x$MISC_MAN_DIR = x    ; then
214076028eb6Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
214140c5823bSmrgfi
214234f90d55Smrg
214376028eb6Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
214476028eb6Smrg    case $SYSV_MAN_SECTIONS in
214576028eb6Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
214676028eb6Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
214776028eb6Smrg    esac
214876028eb6Smrgfi
214976028eb6Smrgif test x$DRIVER_MAN_DIR = x    ; then
215076028eb6Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
215176028eb6Smrgfi
215240c5823bSmrg
215376028eb6Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
215476028eb6Smrg    case $SYSV_MAN_SECTIONS in
215576028eb6Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
215676028eb6Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
215776028eb6Smrg    esac
215876028eb6Smrgfi
215976028eb6Smrgif test x$ADMIN_MAN_DIR = x    ; then
216076028eb6Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
216176028eb6Smrgfi
216240c5823bSmrg
216340c5823bSmrg
216476028eb6SmrgAC_SUBST([APP_MAN_SUFFIX])
216576028eb6SmrgAC_SUBST([LIB_MAN_SUFFIX])
216676028eb6SmrgAC_SUBST([FILE_MAN_SUFFIX])
216776028eb6SmrgAC_SUBST([MISC_MAN_SUFFIX])
216876028eb6SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
216976028eb6SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
217076028eb6SmrgAC_SUBST([APP_MAN_DIR])
217176028eb6SmrgAC_SUBST([LIB_MAN_DIR])
217276028eb6SmrgAC_SUBST([FILE_MAN_DIR])
217376028eb6SmrgAC_SUBST([MISC_MAN_DIR])
217476028eb6SmrgAC_SUBST([DRIVER_MAN_DIR])
217576028eb6SmrgAC_SUBST([ADMIN_MAN_DIR])
217640c5823bSmrg
217776028eb6SmrgXORG_MAN_PAGE="X Version 11"
217876028eb6SmrgAC_SUBST([XORG_MAN_PAGE])
217976028eb6SmrgMAN_SUBSTS="\
218076028eb6Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
218176028eb6Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
218276028eb6Smrg	-e 's|__xservername__|Xorg|g' \
218376028eb6Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
218476028eb6Smrg	-e 's|__projectroot__|\$(prefix)|g' \
218576028eb6Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
218676028eb6Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
218776028eb6Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
218876028eb6Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
218976028eb6Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
219076028eb6Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
219176028eb6Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
219276028eb6SmrgAC_SUBST([MAN_SUBSTS])
219340c5823bSmrg
219476028eb6Smrg]) # XORG_MANPAGE_SECTIONS
219540c5823bSmrg
219676028eb6Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
219776028eb6Smrg# ------------------------
219876028eb6Smrg# Minimum version: 1.7.0
219930f8ce46Smrg#
220076028eb6Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
220176028eb6Smrg# provided by xorg-sgml-doctools, if installed.
220276028eb6SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
220376028eb6SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
220476028eb6SmrgXORG_SGML_PATH=
220576028eb6SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
220676028eb6Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
220776028eb6Smrg    [m4_ifval([$1],[:],
220876028eb6Smrg        [if test x"$cross_compiling" != x"yes" ; then
220976028eb6Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
221076028eb6Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
221176028eb6Smrg         fi])
221276028eb6Smrg    ])
221330f8ce46Smrg
221476028eb6Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
221576028eb6Smrg# the path and the name of the doc stylesheet
221676028eb6Smrgif test "x$XORG_SGML_PATH" != "x" ; then
221776028eb6Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
221876028eb6Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
221976028eb6Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
222030f8ce46Smrgelse
222176028eb6Smrg   AC_MSG_RESULT([no])
222230f8ce46Smrgfi
22238f34cbf9Ssnj
222476028eb6SmrgAC_SUBST(XORG_SGML_PATH)
222576028eb6SmrgAC_SUBST(STYLESHEET_SRCDIR)
222676028eb6SmrgAC_SUBST(XSL_STYLESHEET)
222776028eb6SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
222876028eb6Smrg]) # XORG_CHECK_SGML_DOCTOOLS
222940c5823bSmrg
223076028eb6Smrg# XORG_CHECK_LINUXDOC
223176028eb6Smrg# -------------------
223276028eb6Smrg# Minimum version: 1.0.0
223376028eb6Smrg#
223476028eb6Smrg# Defines the variable MAKE_TEXT if the necessary tools and
223576028eb6Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
223676028eb6Smrg# Whether or not the necessary tools and files are found can be checked
223776028eb6Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
223876028eb6SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
223976028eb6SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
224076028eb6SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
224140c5823bSmrg
224276028eb6SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
224340c5823bSmrg
224476028eb6SmrgAC_MSG_CHECKING([whether to build documentation])
224540c5823bSmrg
224676028eb6Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
224776028eb6Smrg   BUILDDOC=yes
224876028eb6Smrgelse
224976028eb6Smrg   BUILDDOC=no
225076028eb6Smrgfi
225140c5823bSmrg
225276028eb6SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
225376028eb6Smrg
225476028eb6SmrgAC_MSG_RESULT([$BUILDDOC])
225576028eb6Smrg
225676028eb6SmrgAC_MSG_CHECKING([whether to build pdf documentation])
225776028eb6Smrg
225876028eb6Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
225976028eb6Smrg   BUILDPDFDOC=yes
226040c5823bSmrgelse
226176028eb6Smrg   BUILDPDFDOC=no
22628f34cbf9Ssnjfi
22638f34cbf9Ssnj
226476028eb6SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
226530f8ce46Smrg
226676028eb6SmrgAC_MSG_RESULT([$BUILDPDFDOC])
226740c5823bSmrg
226876028eb6SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
226976028eb6SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
227076028eb6SmrgMAKE_PDF="$PS2PDF"
227176028eb6SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
227230f8ce46Smrg
227376028eb6SmrgAC_SUBST(MAKE_TEXT)
227476028eb6SmrgAC_SUBST(MAKE_PS)
227576028eb6SmrgAC_SUBST(MAKE_PDF)
227676028eb6SmrgAC_SUBST(MAKE_HTML)
227776028eb6Smrg]) # XORG_CHECK_LINUXDOC
227876028eb6Smrg
227976028eb6Smrg# XORG_CHECK_DOCBOOK
228076028eb6Smrg# -------------------
228176028eb6Smrg# Minimum version: 1.0.0
228276028eb6Smrg#
228376028eb6Smrg# Checks for the ability to build output formats from SGML DocBook source.
228476028eb6Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
228576028eb6Smrg# indicates whether the necessary tools and files are found and, if set,
228676028eb6Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
228776028eb6SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
228876028eb6SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
228930f8ce46Smrg
229076028eb6SmrgBUILDTXTDOC=no
229176028eb6SmrgBUILDPDFDOC=no
229276028eb6SmrgBUILDPSDOC=no
229376028eb6SmrgBUILDHTMLDOC=no
229430f8ce46Smrg
229576028eb6SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
229676028eb6SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
229776028eb6SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
229876028eb6SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
229930f8ce46Smrg
230076028eb6SmrgAC_MSG_CHECKING([whether to build text documentation])
230176028eb6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
230276028eb6Smrg   test x$BUILD_TXTDOC != xno; then
230376028eb6Smrg	BUILDTXTDOC=yes
230476028eb6Smrgfi
230576028eb6SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
230676028eb6SmrgAC_MSG_RESULT([$BUILDTXTDOC])
230730f8ce46Smrg
230876028eb6SmrgAC_MSG_CHECKING([whether to build PDF documentation])
230976028eb6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
231076028eb6Smrg   test x$BUILD_PDFDOC != xno; then
231176028eb6Smrg	BUILDPDFDOC=yes
231240c5823bSmrgfi
231376028eb6SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
231476028eb6SmrgAC_MSG_RESULT([$BUILDPDFDOC])
231540c5823bSmrg
231676028eb6SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
231776028eb6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
231876028eb6Smrg   test x$BUILD_PSDOC != xno; then
231976028eb6Smrg	BUILDPSDOC=yes
232076028eb6Smrgfi
232176028eb6SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
232276028eb6SmrgAC_MSG_RESULT([$BUILDPSDOC])
232340c5823bSmrg
232476028eb6SmrgAC_MSG_CHECKING([whether to build HTML documentation])
232576028eb6Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
232676028eb6Smrg   test x$BUILD_HTMLDOC != xno; then
232776028eb6Smrg	BUILDHTMLDOC=yes
232876028eb6Smrgfi
232976028eb6SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
233076028eb6SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
233130f8ce46Smrg
233276028eb6SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
233376028eb6SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
233476028eb6SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
233576028eb6SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
233634f90d55Smrg
233776028eb6SmrgAC_SUBST(MAKE_TEXT)
233876028eb6SmrgAC_SUBST(MAKE_PS)
233976028eb6SmrgAC_SUBST(MAKE_PDF)
234076028eb6SmrgAC_SUBST(MAKE_HTML)
234176028eb6Smrg]) # XORG_CHECK_DOCBOOK
234230f8ce46Smrg
234376028eb6Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
234440c5823bSmrg# ----------------
234576028eb6Smrg# Minimum version: 1.5.0
234676028eb6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23478f34cbf9Ssnj#
234876028eb6Smrg# Documentation tools are not always available on all platforms and sometimes
234976028eb6Smrg# not at the appropriate level. This macro enables a module to test for the
235076028eb6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2351e1db7cd1Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
235276028eb6Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
235376028eb6Smrg# --with-xmlto assumes 'auto'.
23548f34cbf9Ssnj#
235576028eb6Smrg# Interface to module:
235676028eb6Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
235776028eb6Smrg# XMLTO:	returns the path of the xmlto program found
235876028eb6Smrg#		returns the path set by the user in the environment
235976028eb6Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
236076028eb6Smrg#		'no' user instructs the module not to use xmlto
23618f34cbf9Ssnj#
236276028eb6Smrg# Added in version 1.10.0
236376028eb6Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
236476028eb6Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
236576028eb6Smrg#
236676028eb6Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
236776028eb6Smrg#
236876028eb6SmrgAC_DEFUN([XORG_WITH_XMLTO],[
236976028eb6SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
237076028eb6Smrgm4_define([_defopt], m4_default([$2], [auto]))
237176028eb6SmrgAC_ARG_WITH(xmlto,
237276028eb6Smrg	AS_HELP_STRING([--with-xmlto],
237376028eb6Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
237476028eb6Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
237576028eb6Smrgm4_undefine([_defopt])
237630f8ce46Smrg
237776028eb6Smrgif test "x$use_xmlto" = x"auto"; then
237876028eb6Smrg   AC_PATH_PROG([XMLTO], [xmlto])
237976028eb6Smrg   if test "x$XMLTO" = "x"; then
238076028eb6Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
238176028eb6Smrg	have_xmlto=no
238276028eb6Smrg   else
238376028eb6Smrg        have_xmlto=yes
238476028eb6Smrg   fi
238576028eb6Smrgelif test "x$use_xmlto" = x"yes" ; then
238676028eb6Smrg   AC_PATH_PROG([XMLTO], [xmlto])
238776028eb6Smrg   if test "x$XMLTO" = "x"; then
238876028eb6Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
238976028eb6Smrg   fi
239076028eb6Smrg   have_xmlto=yes
239176028eb6Smrgelif test "x$use_xmlto" = x"no" ; then
239276028eb6Smrg   if test "x$XMLTO" != "x"; then
239376028eb6Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
239476028eb6Smrg   fi
239576028eb6Smrg   have_xmlto=no
239676028eb6Smrgelse
239776028eb6Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
239876028eb6Smrgfi
239930f8ce46Smrg
240076028eb6Smrg# Test for a minimum version of xmlto, if provided.
240176028eb6Smrgm4_ifval([$1],
240276028eb6Smrg[if test "$have_xmlto" = yes; then
240376028eb6Smrg    # scrape the xmlto version
240476028eb6Smrg    AC_MSG_CHECKING([the xmlto version])
240576028eb6Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
240676028eb6Smrg    AC_MSG_RESULT([$xmlto_version])
240776028eb6Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
240876028eb6Smrg        [if test "x$use_xmlto" = xauto; then
240976028eb6Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
241076028eb6Smrg            have_xmlto=no
241176028eb6Smrg        else
241276028eb6Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
241376028eb6Smrg        fi])
241476028eb6Smrgfi])
241530f8ce46Smrg
241676028eb6Smrg# Test for the ability of xmlto to generate a text target
241776028eb6Smrg#
241876028eb6Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
241976028eb6Smrg# following test for empty XML docbook files.
242076028eb6Smrg# For compatibility reasons use the following empty XML docbook file and if
242176028eb6Smrg# it fails try it again with a non-empty XML file.
242276028eb6Smrghave_xmlto_text=no
242376028eb6Smrgcat > conftest.xml << "EOF"
242476028eb6SmrgEOF
242576028eb6SmrgAS_IF([test "$have_xmlto" = yes],
242676028eb6Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
242776028eb6Smrg             [have_xmlto_text=yes],
242876028eb6Smrg             [# Try it again with a non-empty XML file.
242976028eb6Smrg              cat > conftest.xml << "EOF"
243076028eb6Smrg<x></x>
243176028eb6SmrgEOF
243276028eb6Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
243376028eb6Smrg                    [have_xmlto_text=yes],
243476028eb6Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
243576028eb6Smrgrm -f conftest.xml
243676028eb6SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
243776028eb6SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
243876028eb6Smrg]) # XORG_WITH_XMLTO
243934f90d55Smrg
244076028eb6Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
244176028eb6Smrg# --------------------------------------------
244276028eb6Smrg# Minimum version: 1.12.0
244376028eb6Smrg# Minimum version for optional DEFAULT argument: 1.12.0
244476028eb6Smrg#
244576028eb6Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
244676028eb6Smrg# XML-based language used for the transformation of XML documents.
244776028eb6Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
244876028eb6Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
244976028eb6Smrg# The XSLT processor is often used as a standalone tool for transformations.
245076028eb6Smrg# It should not be assumed that this tool is used only to work with documnetation.
245176028eb6Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
245276028eb6Smrg#
245376028eb6Smrg# Interface to module:
245476028eb6Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
245576028eb6Smrg# XSLTPROC:	 returns the path of the xsltproc program found
245676028eb6Smrg#		 returns the path set by the user in the environment
245776028eb6Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
245876028eb6Smrg#		  'no' user instructs the module not to use xsltproc
245976028eb6Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
246076028eb6Smrg#
246176028eb6Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
246276028eb6Smrg#
246376028eb6SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
246476028eb6SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
246576028eb6Smrg# Preserves the interface, should it be implemented later
246676028eb6Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
246776028eb6Smrgm4_define([_defopt], m4_default([$2], [auto]))
246876028eb6SmrgAC_ARG_WITH(xsltproc,
246976028eb6Smrg	AS_HELP_STRING([--with-xsltproc],
247076028eb6Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
247176028eb6Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
247276028eb6Smrgm4_undefine([_defopt])
247340c5823bSmrg
247476028eb6Smrgif test "x$use_xsltproc" = x"auto"; then
247576028eb6Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
247676028eb6Smrg   if test "x$XSLTPROC" = "x"; then
247776028eb6Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
247876028eb6Smrg	have_xsltproc=no
247976028eb6Smrg   else
248076028eb6Smrg        have_xsltproc=yes
248176028eb6Smrg   fi
248276028eb6Smrgelif test "x$use_xsltproc" = x"yes" ; then
248376028eb6Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
248476028eb6Smrg   if test "x$XSLTPROC" = "x"; then
248576028eb6Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
248676028eb6Smrg   fi
248776028eb6Smrg   have_xsltproc=yes
248876028eb6Smrgelif test "x$use_xsltproc" = x"no" ; then
248976028eb6Smrg   if test "x$XSLTPROC" != "x"; then
249076028eb6Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
249176028eb6Smrg   fi
249276028eb6Smrg   have_xsltproc=no
249376028eb6Smrgelse
249476028eb6Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
249576028eb6Smrgfi
249640c5823bSmrg
249776028eb6SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
249876028eb6Smrg]) # XORG_WITH_XSLTPROC
249940c5823bSmrg
250076028eb6Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
250176028eb6Smrg# ----------------------------------------
250276028eb6Smrg# Minimum version: 1.15.0
250376028eb6Smrg#
250476028eb6Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
250576028eb6Smrg# scanning arbitrary text files, extracting information from those text files,
250676028eb6Smrg# and printing reports based on that information.
250776028eb6Smrg#
250876028eb6Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
250976028eb6Smrg#
251076028eb6Smrg# Interface to module:
251176028eb6Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
251276028eb6Smrg# PERL:	     returns the path of the perl program found
251376028eb6Smrg#	     returns the path set by the user in the environment
251476028eb6Smrg# --with-perl: 'yes' user instructs the module to use perl
251576028eb6Smrg#	       'no' user instructs the module not to use perl
251676028eb6Smrg# have_perl: returns yes if perl found in PATH or no
251776028eb6Smrg#
251876028eb6Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
251976028eb6Smrg#
252076028eb6SmrgAC_DEFUN([XORG_WITH_PERL],[
252176028eb6SmrgAC_ARG_VAR([PERL], [Path to perl command])
252276028eb6Smrg# Preserves the interface, should it be implemented later
252376028eb6Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
252476028eb6Smrgm4_define([_defopt], m4_default([$2], [auto]))
252576028eb6SmrgAC_ARG_WITH(perl,
252676028eb6Smrg	AS_HELP_STRING([--with-perl],
252776028eb6Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
252876028eb6Smrg	   [use_perl=$withval], [use_perl=]_defopt)
252976028eb6Smrgm4_undefine([_defopt])
253040c5823bSmrg
253176028eb6Smrgif test "x$use_perl" = x"auto"; then
253276028eb6Smrg   AC_PATH_PROG([PERL], [perl])
253376028eb6Smrg   if test "x$PERL" = "x"; then
253476028eb6Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
253576028eb6Smrg	have_perl=no
253676028eb6Smrg   else
253776028eb6Smrg        have_perl=yes
253876028eb6Smrg   fi
253976028eb6Smrgelif test "x$use_perl" = x"yes" ; then
254076028eb6Smrg   AC_PATH_PROG([PERL], [perl])
254176028eb6Smrg   if test "x$PERL" = "x"; then
254276028eb6Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
254376028eb6Smrg   fi
254476028eb6Smrg   have_perl=yes
254576028eb6Smrgelif test "x$use_perl" = x"no" ; then
254676028eb6Smrg   if test "x$PERL" != "x"; then
254776028eb6Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
254876028eb6Smrg   fi
254976028eb6Smrg   have_perl=no
255076028eb6Smrgelse
255176028eb6Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
255276028eb6Smrgfi
255340c5823bSmrg
255476028eb6SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
255576028eb6Smrg]) # XORG_WITH_PERL
255640c5823bSmrg
255776028eb6Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
255876028eb6Smrg# ----------------
255976028eb6Smrg# Minimum version: 1.5.0
256076028eb6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
256176028eb6Smrg#
256276028eb6Smrg# Documentation tools are not always available on all platforms and sometimes
256376028eb6Smrg# not at the appropriate level. This macro enables a module to test for the
256476028eb6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2565e1db7cd1Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
256676028eb6Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
256776028eb6Smrg# --with-asciidoc assumes 'auto'.
256876028eb6Smrg#
256976028eb6Smrg# Interface to module:
257076028eb6Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
257176028eb6Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
257276028eb6Smrg#		 returns the path set by the user in the environment
257376028eb6Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
257476028eb6Smrg#		  'no' user instructs the module not to use asciidoc
257576028eb6Smrg#
257676028eb6Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
257776028eb6Smrg#
257876028eb6SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
257976028eb6SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
258076028eb6Smrgm4_define([_defopt], m4_default([$2], [auto]))
258176028eb6SmrgAC_ARG_WITH(asciidoc,
258276028eb6Smrg	AS_HELP_STRING([--with-asciidoc],
258376028eb6Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
258476028eb6Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
258576028eb6Smrgm4_undefine([_defopt])
258640c5823bSmrg
258776028eb6Smrgif test "x$use_asciidoc" = x"auto"; then
258876028eb6Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
258976028eb6Smrg   if test "x$ASCIIDOC" = "x"; then
259076028eb6Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
259176028eb6Smrg	have_asciidoc=no
259276028eb6Smrg   else
259376028eb6Smrg        have_asciidoc=yes
259476028eb6Smrg   fi
259576028eb6Smrgelif test "x$use_asciidoc" = x"yes" ; then
259676028eb6Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
259776028eb6Smrg   if test "x$ASCIIDOC" = "x"; then
259876028eb6Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
259976028eb6Smrg   fi
260076028eb6Smrg   have_asciidoc=yes
260176028eb6Smrgelif test "x$use_asciidoc" = x"no" ; then
260276028eb6Smrg   if test "x$ASCIIDOC" != "x"; then
260376028eb6Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
260476028eb6Smrg   fi
260576028eb6Smrg   have_asciidoc=no
260676028eb6Smrgelse
260776028eb6Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
260876028eb6Smrgfi
260976028eb6Smrgm4_ifval([$1],
261076028eb6Smrg[if test "$have_asciidoc" = yes; then
261176028eb6Smrg    # scrape the asciidoc version
261276028eb6Smrg    AC_MSG_CHECKING([the asciidoc version])
261376028eb6Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
261476028eb6Smrg    AC_MSG_RESULT([$asciidoc_version])
261576028eb6Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
261676028eb6Smrg        [if test "x$use_asciidoc" = xauto; then
261776028eb6Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
261876028eb6Smrg            have_asciidoc=no
261976028eb6Smrg        else
262076028eb6Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
262176028eb6Smrg        fi])
262276028eb6Smrgfi])
262376028eb6SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
262476028eb6Smrg]) # XORG_WITH_ASCIIDOC
262540c5823bSmrg
262676028eb6Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
262776028eb6Smrg# -------------------------------------------
262876028eb6Smrg# Minimum version: 1.5.0
262976028eb6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
263076028eb6Smrg# Minimum version for optional DOT checking: 1.18.0
263134f90d55Smrg#
263276028eb6Smrg# Documentation tools are not always available on all platforms and sometimes
263376028eb6Smrg# not at the appropriate level. This macro enables a module to test for the
263476028eb6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2635e1db7cd1Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
263676028eb6Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
263776028eb6Smrg# --with-doxygen assumes 'auto'.
263876028eb6Smrg#
263976028eb6Smrg# Interface to module:
264076028eb6Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
264176028eb6Smrg# DOXYGEN:	 returns the path of the doxygen program found
264276028eb6Smrg#		 returns the path set by the user in the environment
264376028eb6Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
264476028eb6Smrg#		  'no' user instructs the module not to use doxygen
264576028eb6Smrg#
264676028eb6Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
264776028eb6Smrg#
264876028eb6SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
264976028eb6SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
265076028eb6SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
265176028eb6Smrgm4_define([_defopt], m4_default([$2], [auto]))
265276028eb6SmrgAC_ARG_WITH(doxygen,
265376028eb6Smrg	AS_HELP_STRING([--with-doxygen],
265476028eb6Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
265576028eb6Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
265676028eb6Smrgm4_undefine([_defopt])
265740c5823bSmrg
265876028eb6Smrgif test "x$use_doxygen" = x"auto"; then
265976028eb6Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
266076028eb6Smrg   if test "x$DOXYGEN" = "x"; then
266176028eb6Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
266276028eb6Smrg	have_doxygen=no
266376028eb6Smrg   else
266476028eb6Smrg        have_doxygen=yes
266576028eb6Smrg   fi
266676028eb6Smrgelif test "x$use_doxygen" = x"yes" ; then
266776028eb6Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
266876028eb6Smrg   if test "x$DOXYGEN" = "x"; then
266976028eb6Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
267076028eb6Smrg   fi
267176028eb6Smrg   have_doxygen=yes
267276028eb6Smrgelif test "x$use_doxygen" = x"no" ; then
267376028eb6Smrg   if test "x$DOXYGEN" != "x"; then
267476028eb6Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
267576028eb6Smrg   fi
267676028eb6Smrg   have_doxygen=no
267776028eb6Smrgelse
267876028eb6Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
267976028eb6Smrgfi
268076028eb6Smrgm4_ifval([$1],
268176028eb6Smrg[if test "$have_doxygen" = yes; then
268276028eb6Smrg    # scrape the doxygen version
268376028eb6Smrg    AC_MSG_CHECKING([the doxygen version])
268476028eb6Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
268576028eb6Smrg    AC_MSG_RESULT([$doxygen_version])
268676028eb6Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
268776028eb6Smrg        [if test "x$use_doxygen" = xauto; then
268876028eb6Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
268976028eb6Smrg            have_doxygen=no
269076028eb6Smrg        else
269176028eb6Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
269276028eb6Smrg        fi])
269376028eb6Smrgfi])
269440c5823bSmrg
269576028eb6Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
269676028eb6Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
269776028eb6Smrgdnl 	HAVE_DOT = @HAVE_DOT@
269876028eb6SmrgHAVE_DOT=no
269976028eb6Smrgif test "x$have_doxygen" = "xyes"; then
270076028eb6Smrg  AC_PATH_PROG([DOT], [dot])
270176028eb6Smrg    if test "x$DOT" != "x"; then
270276028eb6Smrg      HAVE_DOT=yes
270376028eb6Smrg    fi
270476028eb6Smrgfi
270540c5823bSmrg
270676028eb6SmrgAC_SUBST([HAVE_DOT])
270776028eb6SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
270876028eb6SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
270976028eb6Smrg]) # XORG_WITH_DOXYGEN
271040c5823bSmrg
271176028eb6Smrg# XORG_WITH_GROFF([DEFAULT])
271276028eb6Smrg# ----------------
271376028eb6Smrg# Minimum version: 1.6.0
271476028eb6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
271540c5823bSmrg#
271676028eb6Smrg# Documentation tools are not always available on all platforms and sometimes
271776028eb6Smrg# not at the appropriate level. This macro enables a module to test for the
271876028eb6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2719e1db7cd1Smrg# the --with-groff option, it allows maximum flexibility in making decisions
272076028eb6Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
272176028eb6Smrg# --with-groff assumes 'auto'.
272234f90d55Smrg#
272376028eb6Smrg# Interface to module:
272476028eb6Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
272576028eb6Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
272676028eb6Smrg# HAVE_GROFF_MS: the -ms macros package
272776028eb6Smrg# GROFF:	 returns the path of the groff program found
272876028eb6Smrg#		 returns the path set by the user in the environment
272976028eb6Smrg# --with-groff:	 'yes' user instructs the module to use groff
273076028eb6Smrg#		 'no' user instructs the module not to use groff
273134f90d55Smrg#
273276028eb6Smrg# Added in version 1.9.0:
273376028eb6Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
273476028eb6Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
273576028eb6Smrg#		   psselect from the psutils package.
273676028eb6Smrg#		   the ghostcript package. Refer to the grohtml man pages
273734f90d55Smrg#
273876028eb6Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
273934f90d55Smrg#
274076028eb6Smrg# OS and distros often splits groff in a basic and full package, the former
274176028eb6Smrg# having the groff program and the later having devices, fonts and macros
274276028eb6Smrg# Checking for the groff executable is not enough.
274334f90d55Smrg#
274476028eb6Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
274576028eb6Smrg# unset HAVE_GROFF or GROFF env variables.
274676028eb6Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
274740c5823bSmrg#
274876028eb6SmrgAC_DEFUN([XORG_WITH_GROFF],[
274976028eb6SmrgAC_ARG_VAR([GROFF], [Path to groff command])
275076028eb6Smrgm4_define([_defopt], m4_default([$1], [auto]))
275176028eb6SmrgAC_ARG_WITH(groff,
275276028eb6Smrg	AS_HELP_STRING([--with-groff],
275376028eb6Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
275476028eb6Smrg	   [use_groff=$withval], [use_groff=]_defopt)
275576028eb6Smrgm4_undefine([_defopt])
275634f90d55Smrg
275776028eb6Smrgif test "x$use_groff" = x"auto"; then
275876028eb6Smrg   AC_PATH_PROG([GROFF], [groff])
275976028eb6Smrg   if test "x$GROFF" = "x"; then
276076028eb6Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
276176028eb6Smrg	have_groff=no
276276028eb6Smrg   else
276376028eb6Smrg        have_groff=yes
276476028eb6Smrg   fi
276576028eb6Smrgelif test "x$use_groff" = x"yes" ; then
276676028eb6Smrg   AC_PATH_PROG([GROFF], [groff])
276776028eb6Smrg   if test "x$GROFF" = "x"; then
276876028eb6Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
276976028eb6Smrg   fi
277076028eb6Smrg   have_groff=yes
277176028eb6Smrgelif test "x$use_groff" = x"no" ; then
277276028eb6Smrg   if test "x$GROFF" != "x"; then
277376028eb6Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
277476028eb6Smrg   fi
277576028eb6Smrg   have_groff=no
277640c5823bSmrgelse
277776028eb6Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
277834f90d55Smrgfi
277940c5823bSmrg
278076028eb6Smrg# We have groff, test for the presence of the macro packages
278176028eb6Smrgif test "x$have_groff" = x"yes"; then
278276028eb6Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
278376028eb6Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
278476028eb6Smrg        groff_ms_works=yes
278576028eb6Smrg    else
278676028eb6Smrg        groff_ms_works=no
278776028eb6Smrg    fi
278876028eb6Smrg    AC_MSG_RESULT([$groff_ms_works])
278976028eb6Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
279076028eb6Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
279176028eb6Smrg        groff_mm_works=yes
279276028eb6Smrg    else
279376028eb6Smrg        groff_mm_works=no
279476028eb6Smrg    fi
279576028eb6Smrg    AC_MSG_RESULT([$groff_mm_works])
279676028eb6Smrgfi
279740c5823bSmrg
279876028eb6Smrg# We have groff, test for HTML dependencies, one command per package
279976028eb6Smrgif test "x$have_groff" = x"yes"; then
280076028eb6Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
280176028eb6Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
280276028eb6Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
280376028eb6Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
280476028eb6Smrg      have_groff_html=yes
280576028eb6Smrg   else
280676028eb6Smrg      have_groff_html=no
280776028eb6Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
280876028eb6Smrg   fi
280976028eb6Smrgfi
281040c5823bSmrg
281176028eb6Smrg# Set Automake conditionals for Makefiles
281276028eb6SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
281376028eb6SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
281476028eb6SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
281576028eb6SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
281676028eb6Smrg]) # XORG_WITH_GROFF
281740c5823bSmrg
281876028eb6Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
281976028eb6Smrg# ---------------------------------------
282076028eb6Smrg# Minimum version: 1.6.0
282176028eb6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
282276028eb6Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
282334f90d55Smrg#
282476028eb6Smrg# Documentation tools are not always available on all platforms and sometimes
282576028eb6Smrg# not at the appropriate level. This macro enables a module to test for the
282676028eb6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2827e1db7cd1Smrg# the --with-fop option, it allows maximum flexibility in making decisions
282876028eb6Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
282976028eb6Smrg# --with-fop assumes 'auto'.
283076028eb6Smrg#
283176028eb6Smrg# Interface to module:
283276028eb6Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
283376028eb6Smrg# FOP:	 	returns the path of the fop program found
283476028eb6Smrg#		returns the path set by the user in the environment
283576028eb6Smrg# --with-fop: 	'yes' user instructs the module to use fop
283676028eb6Smrg#		'no' user instructs the module not to use fop
283776028eb6Smrg#
283876028eb6Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
283976028eb6Smrg#
284076028eb6SmrgAC_DEFUN([XORG_WITH_FOP],[
284176028eb6SmrgAC_ARG_VAR([FOP], [Path to fop command])
284276028eb6Smrgm4_define([_defopt], m4_default([$2], [auto]))
284376028eb6SmrgAC_ARG_WITH(fop,
284476028eb6Smrg	AS_HELP_STRING([--with-fop],
284576028eb6Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
284676028eb6Smrg	   [use_fop=$withval], [use_fop=]_defopt)
284776028eb6Smrgm4_undefine([_defopt])
284834f90d55Smrg
284976028eb6Smrgif test "x$use_fop" = x"auto"; then
285076028eb6Smrg   AC_PATH_PROG([FOP], [fop])
285176028eb6Smrg   if test "x$FOP" = "x"; then
285276028eb6Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
285376028eb6Smrg	have_fop=no
285476028eb6Smrg   else
285576028eb6Smrg        have_fop=yes
285676028eb6Smrg   fi
285776028eb6Smrgelif test "x$use_fop" = x"yes" ; then
285876028eb6Smrg   AC_PATH_PROG([FOP], [fop])
285976028eb6Smrg   if test "x$FOP" = "x"; then
286076028eb6Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
286176028eb6Smrg   fi
286276028eb6Smrg   have_fop=yes
286376028eb6Smrgelif test "x$use_fop" = x"no" ; then
286476028eb6Smrg   if test "x$FOP" != "x"; then
286576028eb6Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
286676028eb6Smrg   fi
286776028eb6Smrg   have_fop=no
286834f90d55Smrgelse
286976028eb6Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
287034f90d55Smrgfi
287134f90d55Smrg
287276028eb6Smrg# Test for a minimum version of fop, if provided.
287376028eb6Smrgm4_ifval([$1],
287476028eb6Smrg[if test "$have_fop" = yes; then
287576028eb6Smrg    # scrape the fop version
287676028eb6Smrg    AC_MSG_CHECKING([for fop minimum version])
287776028eb6Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
287876028eb6Smrg    AC_MSG_RESULT([$fop_version])
287976028eb6Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
288076028eb6Smrg        [if test "x$use_fop" = xauto; then
288176028eb6Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
288276028eb6Smrg            have_fop=no
288376028eb6Smrg        else
288476028eb6Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
288576028eb6Smrg        fi])
288676028eb6Smrgfi])
288776028eb6SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
288876028eb6Smrg]) # XORG_WITH_FOP
288934f90d55Smrg
289076028eb6Smrg# XORG_WITH_M4([MIN-VERSION])
289176028eb6Smrg# ---------------------------
289276028eb6Smrg# Minimum version: 1.19.0
289376028eb6Smrg#
289476028eb6Smrg# This macro attempts to locate an m4 macro processor which supports
289576028eb6Smrg# -I option and is only useful for modules relying on M4 in order to
289676028eb6Smrg# expand macros in source code files.
289776028eb6Smrg#
289876028eb6Smrg# Interface to module:
289976028eb6Smrg# M4:	 	returns the path of the m4 program found
290076028eb6Smrg#		returns the path set by the user in the environment
290176028eb6Smrg#
290276028eb6SmrgAC_DEFUN([XORG_WITH_M4], [
290376028eb6SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
290476028eb6Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
290576028eb6Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
290676028eb6Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
290776028eb6Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
290876028eb6Smrg   [$PATH:/usr/gnu/bin])])
290934f90d55Smrg
291076028eb6SmrgAC_SUBST([M4], [$ac_cv_path_M4])
291176028eb6Smrg]) # XORG_WITH_M4
291234f90d55Smrg
291376028eb6Smrg# XORG_WITH_PS2PDF([DEFAULT])
291476028eb6Smrg# ----------------
291576028eb6Smrg# Minimum version: 1.6.0
291676028eb6Smrg# Minimum version for optional DEFAULT argument: 1.11.0
291776028eb6Smrg#
291876028eb6Smrg# Documentation tools are not always available on all platforms and sometimes
291976028eb6Smrg# not at the appropriate level. This macro enables a module to test for the
292076028eb6Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2921e1db7cd1Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
292276028eb6Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
292376028eb6Smrg# --with-ps2pdf assumes 'auto'.
292476028eb6Smrg#
292576028eb6Smrg# Interface to module:
292676028eb6Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
292776028eb6Smrg# PS2PDF:	returns the path of the ps2pdf program found
292876028eb6Smrg#		returns the path set by the user in the environment
292976028eb6Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
293076028eb6Smrg#		 'no' user instructs the module not to use ps2pdf
293176028eb6Smrg#
293276028eb6Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
293376028eb6Smrg#
293476028eb6SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
293576028eb6SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
293676028eb6Smrgm4_define([_defopt], m4_default([$1], [auto]))
293776028eb6SmrgAC_ARG_WITH(ps2pdf,
293876028eb6Smrg	AS_HELP_STRING([--with-ps2pdf],
293976028eb6Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
294076028eb6Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
294176028eb6Smrgm4_undefine([_defopt])
294234f90d55Smrg
294376028eb6Smrgif test "x$use_ps2pdf" = x"auto"; then
294476028eb6Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
294576028eb6Smrg   if test "x$PS2PDF" = "x"; then
294676028eb6Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
294776028eb6Smrg	have_ps2pdf=no
294876028eb6Smrg   else
294976028eb6Smrg        have_ps2pdf=yes
295076028eb6Smrg   fi
295176028eb6Smrgelif test "x$use_ps2pdf" = x"yes" ; then
295276028eb6Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
295376028eb6Smrg   if test "x$PS2PDF" = "x"; then
295476028eb6Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
295576028eb6Smrg   fi
295676028eb6Smrg   have_ps2pdf=yes
295776028eb6Smrgelif test "x$use_ps2pdf" = x"no" ; then
295876028eb6Smrg   if test "x$PS2PDF" != "x"; then
295976028eb6Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
296076028eb6Smrg   fi
296176028eb6Smrg   have_ps2pdf=no
296276028eb6Smrgelse
296376028eb6Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
296476028eb6Smrgfi
296576028eb6SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
296676028eb6Smrg]) # XORG_WITH_PS2PDF
296734f90d55Smrg
296876028eb6Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
296976028eb6Smrg# ----------------
297076028eb6Smrg# Minimum version: 1.6.0
2971ce6676dbSmrg#
297276028eb6Smrg# Documentation tools are not always available on all platforms and sometimes
297376028eb6Smrg# not at the appropriate level. This macro enables a builder to skip all
297476028eb6Smrg# documentation targets except traditional man pages.
297576028eb6Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2976e1db7cd1Smrg# maximum flexibility in controlling documentation building.
297776028eb6Smrg# Refer to:
297876028eb6Smrg# XORG_WITH_XMLTO         --with-xmlto
297976028eb6Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
298076028eb6Smrg# XORG_WITH_DOXYGEN       --with-doxygen
298176028eb6Smrg# XORG_WITH_FOP           --with-fop
298276028eb6Smrg# XORG_WITH_GROFF         --with-groff
298376028eb6Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
298476028eb6Smrg#
298576028eb6Smrg# Interface to module:
298676028eb6Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
298776028eb6Smrg# --enable-docs: 'yes' user instructs the module to generate docs
298876028eb6Smrg#		 'no' user instructs the module not to generate docs
298976028eb6Smrg# parm1:	specify the default value, yes or no.
299076028eb6Smrg#
299176028eb6SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
299276028eb6Smrgm4_define([docs_default], m4_default([$1], [yes]))
299376028eb6SmrgAC_ARG_ENABLE(docs,
299476028eb6Smrg	AS_HELP_STRING([--enable-docs],
299576028eb6Smrg	   [Enable building the documentation (default: ]docs_default[)]),
299676028eb6Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
299776028eb6Smrgm4_undefine([docs_default])
299876028eb6SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
299976028eb6SmrgAC_MSG_CHECKING([whether to build documentation])
300076028eb6SmrgAC_MSG_RESULT([$build_docs])
300176028eb6Smrg]) # XORG_ENABLE_DOCS
3002ce6676dbSmrg
300376028eb6Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
300476028eb6Smrg# ----------------
300576028eb6Smrg# Minimum version: 1.6.0
300676028eb6Smrg#
300776028eb6Smrg# This macro enables a builder to skip all developer documentation.
300876028eb6Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
3009e1db7cd1Smrg# maximum flexibility in controlling documentation building.
301076028eb6Smrg# Refer to:
301176028eb6Smrg# XORG_WITH_XMLTO         --with-xmlto
301276028eb6Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
301376028eb6Smrg# XORG_WITH_DOXYGEN       --with-doxygen
301476028eb6Smrg# XORG_WITH_FOP           --with-fop
301576028eb6Smrg# XORG_WITH_GROFF         --with-groff
301676028eb6Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
301776028eb6Smrg#
301876028eb6Smrg# Interface to module:
301976028eb6Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
302076028eb6Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
302176028eb6Smrg#			'no' user instructs the module not to generate developer docs
302276028eb6Smrg# parm1:		specify the default value, yes or no.
302376028eb6Smrg#
302476028eb6SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
302576028eb6Smrgm4_define([devel_default], m4_default([$1], [yes]))
302676028eb6SmrgAC_ARG_ENABLE(devel-docs,
302776028eb6Smrg	AS_HELP_STRING([--enable-devel-docs],
302876028eb6Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
302976028eb6Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
303076028eb6Smrgm4_undefine([devel_default])
303176028eb6SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
303276028eb6SmrgAC_MSG_CHECKING([whether to build developer documentation])
303376028eb6SmrgAC_MSG_RESULT([$build_devel_docs])
303476028eb6Smrg]) # XORG_ENABLE_DEVEL_DOCS
3035ce6676dbSmrg
303676028eb6Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
303776028eb6Smrg# ----------------
303876028eb6Smrg# Minimum version: 1.6.0
303976028eb6Smrg#
304076028eb6Smrg# This macro enables a builder to skip all functional specification targets.
304176028eb6Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
3042e1db7cd1Smrg# maximum flexibility in controlling documentation building.
304376028eb6Smrg# Refer to:
304476028eb6Smrg# XORG_WITH_XMLTO         --with-xmlto
304576028eb6Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
304676028eb6Smrg# XORG_WITH_DOXYGEN       --with-doxygen
304776028eb6Smrg# XORG_WITH_FOP           --with-fop
304876028eb6Smrg# XORG_WITH_GROFF         --with-groff
304976028eb6Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
305076028eb6Smrg#
305176028eb6Smrg# Interface to module:
305276028eb6Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
305376028eb6Smrg# --enable-specs:	'yes' user instructs the module to generate specs
305476028eb6Smrg#			'no' user instructs the module not to generate specs
305576028eb6Smrg# parm1:		specify the default value, yes or no.
305676028eb6Smrg#
305776028eb6SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
305876028eb6Smrgm4_define([spec_default], m4_default([$1], [yes]))
305976028eb6SmrgAC_ARG_ENABLE(specs,
306076028eb6Smrg	AS_HELP_STRING([--enable-specs],
306176028eb6Smrg	   [Enable building the specs (default: ]spec_default[)]),
306276028eb6Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
306376028eb6Smrgm4_undefine([spec_default])
306476028eb6SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
306576028eb6SmrgAC_MSG_CHECKING([whether to build functional specifications])
306676028eb6SmrgAC_MSG_RESULT([$build_specs])
306776028eb6Smrg]) # XORG_ENABLE_SPECS
3068ce6676dbSmrg
306976028eb6Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
307076028eb6Smrg# ----------------------------------------------
307176028eb6Smrg# Minimum version: 1.13.0
307230f8ce46Smrg#
307376028eb6Smrg# This macro enables a builder to enable/disable unit testing
307476028eb6Smrg# It makes no assumption about the test cases implementation
307576028eb6Smrg# Test cases may or may not use Automake "Support for test suites"
307676028eb6Smrg# They may or may not use the software utility library GLib
3077ce6676dbSmrg#
307876028eb6Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
307976028eb6Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
308076028eb6Smrg# The variable enable_unit_tests is used by other macros in this file.
308176028eb6Smrg#
308276028eb6Smrg# Interface to module:
308376028eb6Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
308476028eb6Smrg# enable_unit_tests:    used in configure.ac for additional configuration
308576028eb6Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
308676028eb6Smrg#			'no' user instructs the module not to build tests
308776028eb6Smrg# parm1:		specify the default value, yes or no.
308876028eb6Smrg#
308976028eb6SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
309076028eb6SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
309176028eb6SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
309276028eb6SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
309376028eb6Smrgm4_define([_defopt], m4_default([$1], [auto]))
309476028eb6SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
309576028eb6Smrg	[Enable building unit test cases (default: ]_defopt[)]),
309676028eb6Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
309776028eb6Smrgm4_undefine([_defopt])
309876028eb6SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
309976028eb6SmrgAC_MSG_CHECKING([whether to build unit test cases])
310076028eb6SmrgAC_MSG_RESULT([$enable_unit_tests])
310176028eb6Smrg]) # XORG_ENABLE_UNIT_TESTS
310230f8ce46Smrg
310376028eb6Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
310476028eb6Smrg# ------------------------------------------------------
310576028eb6Smrg# Minimum version: 1.17.0
310676028eb6Smrg#
310776028eb6Smrg# This macro enables a builder to enable/disable integration testing
310876028eb6Smrg# It makes no assumption about the test cases' implementation
310976028eb6Smrg# Test cases may or may not use Automake "Support for test suites"
311076028eb6Smrg#
311176028eb6Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
311276028eb6Smrg# usually requires less dependencies and may be built and run under less
311376028eb6Smrg# stringent environments than integration tests.
311476028eb6Smrg#
311576028eb6Smrg# Interface to module:
311676028eb6Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
311776028eb6Smrg# enable_integration_tests:   used in configure.ac for additional configuration
311876028eb6Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
311976028eb6Smrg#                             'no' user instructs the module not to build tests
312076028eb6Smrg# parm1:                      specify the default value, yes or no.
312176028eb6Smrg#
312276028eb6SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
312376028eb6SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
312476028eb6Smrgm4_define([_defopt], m4_default([$1], [auto]))
312576028eb6SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
312676028eb6Smrg	[Enable building integration test cases (default: ]_defopt[)]),
312776028eb6Smrg	[enable_integration_tests=$enableval],
312876028eb6Smrg	[enable_integration_tests=]_defopt)
312976028eb6Smrgm4_undefine([_defopt])
313076028eb6SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
313176028eb6Smrg	[test "x$enable_integration_tests" != xno])
313276028eb6SmrgAC_MSG_CHECKING([whether to build unit test cases])
313376028eb6SmrgAC_MSG_RESULT([$enable_integration_tests])
313476028eb6Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
313530f8ce46Smrg
313676028eb6Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
313776028eb6Smrg# ----------------------------------------
313876028eb6Smrg# Minimum version: 1.13.0
313976028eb6Smrg#
314076028eb6Smrg# GLib is a library which provides advanced data structures and functions.
314176028eb6Smrg# This macro enables a module to test for the presence of Glib.
314276028eb6Smrg#
314376028eb6Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
314476028eb6Smrg# Otherwise the value of $enable_unit_tests is blank.
314576028eb6Smrg#
314676028eb6Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
314776028eb6Smrg# test support usually requires less dependencies and may be built and run under
314876028eb6Smrg# less stringent environments than integration tests.
314976028eb6Smrg#
315076028eb6Smrg# Interface to module:
315176028eb6Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
315276028eb6Smrg# with_glib: used in configure.ac to know if GLib has been found
315376028eb6Smrg# --with-glib:	'yes' user instructs the module to use glib
315476028eb6Smrg#		'no' user instructs the module not to use glib
315576028eb6Smrg#
315676028eb6SmrgAC_DEFUN([XORG_WITH_GLIB],[
315776028eb6SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
315876028eb6Smrgm4_define([_defopt], m4_default([$2], [auto]))
315976028eb6SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
316076028eb6Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
316176028eb6Smrg	[with_glib=$withval], [with_glib=]_defopt)
316276028eb6Smrgm4_undefine([_defopt])
316330f8ce46Smrg
316476028eb6Smrghave_glib=no
316576028eb6Smrg# Do not probe GLib if user explicitly disabled unit testing
316676028eb6Smrgif test "x$enable_unit_tests" != x"no"; then
316776028eb6Smrg  # Do not probe GLib if user explicitly disabled it
316876028eb6Smrg  if test "x$with_glib" != x"no"; then
316976028eb6Smrg    m4_ifval(
317076028eb6Smrg      [$1],
317176028eb6Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
317276028eb6Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
317376028eb6Smrg    )
317440c5823bSmrg  fi
3175ce6676dbSmrgfi
317634f90d55Smrg
317776028eb6Smrg# Not having GLib when unit testing has been explicitly requested is an error
317876028eb6Smrgif test "x$enable_unit_tests" = x"yes"; then
317976028eb6Smrg  if test "x$have_glib" = x"no"; then
318076028eb6Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
318176028eb6Smrg  fi
318276028eb6Smrgfi
318334f90d55Smrg
318476028eb6Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
318576028eb6Smrgif test "x$enable_unit_tests" = x"no"; then
318676028eb6Smrg  if test "x$with_glib" = x"yes"; then
318776028eb6Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
318876028eb6Smrg  fi
318976028eb6Smrgfi
319034f90d55Smrg
319176028eb6Smrg# Not having GLib when it has been explicitly requested is an error
319276028eb6Smrgif test "x$with_glib" = x"yes"; then
319376028eb6Smrg  if test "x$have_glib" = x"no"; then
319476028eb6Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
319540c5823bSmrg  fi
319634f90d55Smrgfi
319734f90d55Smrg
319876028eb6SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
319976028eb6Smrg]) # XORG_WITH_GLIB
320034f90d55Smrg
320176028eb6Smrg# XORG_LD_WRAP([required|optional])
320276028eb6Smrg# ---------------------------------
320376028eb6Smrg# Minimum version: 1.13.0
320476028eb6Smrg#
320576028eb6Smrg# Check if linker supports -wrap, passed via compiler flags
320676028eb6Smrg#
320776028eb6Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
320876028eb6Smrg# Otherwise the value of $enable_unit_tests is blank.
320976028eb6Smrg#
321076028eb6Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
321176028eb6Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
321276028eb6Smrg# available, an argument of "optional" allows use when some unit tests require
321376028eb6Smrg# ld -wrap and others do not.
321476028eb6Smrg#
321576028eb6SmrgAC_DEFUN([XORG_LD_WRAP],[
321676028eb6SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
321776028eb6Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
321876028eb6Smrg                      void __wrap_exit(int status) { return; }],
321976028eb6Smrg                     [exit(0);])])
322076028eb6Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
322176028eb6Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
322276028eb6Smrg  if test "x$have_ld_wrap" = x"no"; then
322376028eb6Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
322476028eb6Smrg  fi
322576028eb6Smrgfi
322676028eb6SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
322776028eb6Smrg#
322876028eb6Smrg]) # XORG_LD_WRAP
322934f90d55Smrg
323076028eb6Smrg# XORG_CHECK_LINKER_FLAGS
323176028eb6Smrg# -----------------------
323276028eb6Smrg# SYNOPSIS
323376028eb6Smrg#
323476028eb6Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
323576028eb6Smrg#
323676028eb6Smrg# DESCRIPTION
323776028eb6Smrg#
323876028eb6Smrg#   Check whether the given linker FLAGS work with the current language's
323976028eb6Smrg#   linker, or whether they give an error.
324076028eb6Smrg#
324176028eb6Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
324276028eb6Smrg#   success/failure.
324376028eb6Smrg#
324476028eb6Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
324576028eb6Smrg#
324676028eb6Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
324776028eb6Smrg#
324876028eb6Smrg# LICENSE
324976028eb6Smrg#
325076028eb6Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
325176028eb6Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
325276028eb6Smrg#   Copyright (c) 2009 Matteo Frigo
325376028eb6Smrg#
325476028eb6Smrg#   This program is free software: you can redistribute it and/or modify it
325576028eb6Smrg#   under the terms of the GNU General Public License as published by the
325676028eb6Smrg#   Free Software Foundation, either version 3 of the License, or (at your
325776028eb6Smrg#   option) any later version.
325876028eb6Smrg#
325976028eb6Smrg#   This program is distributed in the hope that it will be useful, but
326076028eb6Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
326176028eb6Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
326276028eb6Smrg#   Public License for more details.
326376028eb6Smrg#
326476028eb6Smrg#   You should have received a copy of the GNU General Public License along
326576028eb6Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
326676028eb6Smrg#
326776028eb6Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
326876028eb6Smrg#   gives unlimited permission to copy, distribute and modify the configure
326976028eb6Smrg#   scripts that are the output of Autoconf when processing the Macro. You
327076028eb6Smrg#   need not follow the terms of the GNU General Public License when using
327176028eb6Smrg#   or distributing such scripts, even though portions of the text of the
327276028eb6Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
327376028eb6Smrg#   all other use of the material that constitutes the Autoconf Macro.
327476028eb6Smrg#
327576028eb6Smrg#   This special exception to the GPL applies to versions of the Autoconf
327676028eb6Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
327776028eb6Smrg#   modified version of the Autoconf Macro, you may extend this special
327876028eb6Smrg#   exception to the GPL to apply to your modified version as well.#
327976028eb6SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
328076028eb6Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
328176028eb6Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
328276028eb6SmrgAS_LITERAL_IF([$1],
328376028eb6Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
328476028eb6Smrg      ax_save_FLAGS=$LDFLAGS
328576028eb6Smrg      LDFLAGS="$1"
328676028eb6Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
328776028eb6Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
328876028eb6Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
328976028eb6Smrg      LDFLAGS=$ax_save_FLAGS])],
329076028eb6Smrg  [ax_save_FLAGS=$LDFLAGS
329176028eb6Smrg   LDFLAGS="$1"
329276028eb6Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
329376028eb6Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
329476028eb6Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
329576028eb6Smrg   LDFLAGS=$ax_save_FLAGS])
329676028eb6Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
329776028eb6SmrgAC_MSG_RESULT($xorg_check_linker_flags)
329876028eb6Smrgif test "x$xorg_check_linker_flags" = xyes; then
329976028eb6Smrg	m4_default([$2], :)
330076028eb6Smrgelse
330176028eb6Smrg	m4_default([$3], :)
330276028eb6Smrgfi
330376028eb6Smrg]) # XORG_CHECK_LINKER_FLAGS
330434f90d55Smrg
330576028eb6Smrg# XORG_MEMORY_CHECK_FLAGS
330676028eb6Smrg# -----------------------
330776028eb6Smrg# Minimum version: 1.16.0
330840c5823bSmrg#
330976028eb6Smrg# This macro attempts to find appropriate memory checking functionality
331076028eb6Smrg# for various platforms which unit testing code may use to catch various
331176028eb6Smrg# forms of memory allocation and access errors in testing.
331276028eb6Smrg#
331376028eb6Smrg# Interface to module:
331476028eb6Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
331576028eb6Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
331676028eb6Smrg#
331776028eb6Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
331876028eb6Smrg#
331976028eb6SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
332034f90d55Smrg
332176028eb6SmrgAC_REQUIRE([AC_CANONICAL_HOST])
332276028eb6SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
332376028eb6Smrg           [Environment variables to enable memory checking in tests])
332476028eb6Smrg
332576028eb6Smrg# Check for different types of support on different platforms
332676028eb6Smrgcase $host_os in
332776028eb6Smrg    solaris*)
332876028eb6Smrg        AC_CHECK_LIB([umem], [umem_alloc],
332976028eb6Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
333076028eb6Smrg        ;;
333176028eb6Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
333276028eb6Smrg        # both directly and inverted, so should not be 0 or 255.
333376028eb6Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
333476028eb6Smrg        ;;
333576028eb6Smrg    darwin*)
333676028eb6Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
333776028eb6Smrg        ;;
333876028eb6Smrg    *bsd*)
333976028eb6Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
334076028eb6Smrg        ;;
334176028eb6Smrgesac
334276028eb6Smrg
334376028eb6Smrg# User supplied flags override default flags
334476028eb6Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
334576028eb6Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
334640c5823bSmrgfi
334734f90d55Smrg
334876028eb6SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
334976028eb6Smrg]) # XORG_WITH_LINT
335076028eb6Smrg
335176028eb6Smrg# XORG_CHECK_MALLOC_ZERO
335276028eb6Smrg# ----------------------
335376028eb6Smrg# Minimum version: 1.0.0
335434f90d55Smrg#
335576028eb6Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
335676028eb6Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
335776028eb6Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
335876028eb6SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
335976028eb6SmrgAC_ARG_ENABLE(malloc0returnsnull,
336076028eb6Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
336176028eb6Smrg		       [malloc(0) returns NULL (default: auto)]),
336276028eb6Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
336376028eb6Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
336434f90d55Smrg
336576028eb6SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
336676028eb6Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
336776028eb6SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
336876028eb6Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
336976028eb6Smrg#include <stdlib.h>
337076028eb6Smrg],[
337176028eb6Smrg    char *m0, *r0, *c0, *p;
337276028eb6Smrg    m0 = malloc(0);
337376028eb6Smrg    p = malloc(10);
337476028eb6Smrg    r0 = realloc(p,0);
337576028eb6Smrg    c0 = calloc(0,10);
337676028eb6Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
337776028eb6Smrg])],
337876028eb6Smrg		[xorg_cv_malloc0_returns_null=yes],
337976028eb6Smrg		[xorg_cv_malloc0_returns_null=no])])
338076028eb6SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
338176028eb6Smrgfi
338276028eb6SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
338376028eb6Smrg
338476028eb6Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
338576028eb6Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
338676028eb6Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
338776028eb6Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
338834f90d55Smrgelse
338976028eb6Smrg	MALLOC_ZERO_CFLAGS=""
339076028eb6Smrg	XMALLOC_ZERO_CFLAGS=""
339176028eb6Smrg	XTMALLOC_ZERO_CFLAGS=""
339234f90d55Smrgfi
339334f90d55Smrg
339476028eb6SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
339576028eb6SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
339676028eb6SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
339776028eb6Smrg]) # XORG_CHECK_MALLOC_ZERO
339834f90d55Smrg
339976028eb6Smrg# XORG_WITH_LINT()
340076028eb6Smrg# ----------------
340176028eb6Smrg# Minimum version: 1.1.0
340240c5823bSmrg#
340376028eb6Smrg# This macro enables the use of a tool that flags some suspicious and
340476028eb6Smrg# non-portable constructs (likely to be bugs) in C language source code.
340576028eb6Smrg# It will attempt to locate the tool and use appropriate options.
340676028eb6Smrg# There are various lint type tools on different platforms.
340740c5823bSmrg#
340876028eb6Smrg# Interface to module:
340976028eb6Smrg# LINT:		returns the path to the tool found on the platform
341076028eb6Smrg#		or the value set to LINT on the configure cmd line
341176028eb6Smrg#		also an Automake conditional
341276028eb6Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
341376028eb6Smrg#
341476028eb6Smrg# --with-lint:	'yes' user instructs the module to use lint
341576028eb6Smrg#		'no' user instructs the module not to use lint (default)
341676028eb6Smrg#
341776028eb6Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
341876028eb6Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
341976028eb6Smrg#
342076028eb6SmrgAC_DEFUN([XORG_WITH_LINT],[
342134f90d55Smrg
342276028eb6SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
342376028eb6SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
342476028eb6SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
342576028eb6Smrg		[Use a lint-style source code checker (default: disabled)])],
342676028eb6Smrg		[use_lint=$withval], [use_lint=no])
342734f90d55Smrg
342876028eb6Smrg# Obtain platform specific info like program name and options
342976028eb6Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
343076028eb6Smrgcase $host_os in
343176028eb6Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
343276028eb6Smrg	lint_name=splint
343376028eb6Smrg	lint_options="-badflag"
343476028eb6Smrg	;;
343576028eb6Smrg  *freebsd* | *netbsd*)
343676028eb6Smrg	lint_name=lint
343776028eb6Smrg	lint_options="-u -b"
343876028eb6Smrg	;;
343976028eb6Smrg  *solaris*)
344076028eb6Smrg	lint_name=lint
344176028eb6Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
344276028eb6Smrg	;;
344376028eb6Smrgesac
344476028eb6Smrg
344576028eb6Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
344676028eb6Smrgif test "x$use_lint" = x"yes" ; then
344776028eb6Smrg   AC_PATH_PROG([LINT], [$lint_name])
344876028eb6Smrg   if test "x$LINT" = "x"; then
344976028eb6Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
345076028eb6Smrg   fi
345176028eb6Smrgelif test "x$use_lint" = x"no" ; then
345276028eb6Smrg   if test "x$LINT" != "x"; then
345376028eb6Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
345476028eb6Smrg   fi
345534f90d55Smrgelse
345676028eb6Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
345734f90d55Smrgfi
345834f90d55Smrg
345976028eb6Smrg# User supplied flags override default flags
346076028eb6Smrgif test "x$LINT_FLAGS" != "x"; then
346176028eb6Smrg   lint_options=$LINT_FLAGS
346276028eb6Smrgfi
346376028eb6Smrg
346476028eb6SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
346576028eb6SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
346676028eb6Smrg
346776028eb6Smrg]) # XORG_WITH_LINT
346834f90d55Smrg
346976028eb6Smrg# XORG_LINT_LIBRARY(LIBNAME)
347076028eb6Smrg# --------------------------
347176028eb6Smrg# Minimum version: 1.1.0
347234f90d55Smrg#
347376028eb6Smrg# Sets up flags for building lint libraries for checking programs that call
347476028eb6Smrg# functions in the library.
347576028eb6Smrg#
347676028eb6Smrg# Interface to module:
347776028eb6Smrg# LINTLIB		- Automake variable with the name of lint library file to make
347876028eb6Smrg# MAKE_LINT_LIB		- Automake conditional
347976028eb6Smrg#
348076028eb6Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
348176028eb6Smrg#			  - 'no' user instructs the module not to create a lint library (default)
348230f8ce46Smrg
348376028eb6SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
348476028eb6SmrgAC_REQUIRE([XORG_WITH_LINT])
348576028eb6SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
348676028eb6Smrg	[Create lint library (default: disabled)])],
348776028eb6Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
348840c5823bSmrg
348976028eb6Smrgif test "x$make_lint_lib" = x"yes" ; then
349076028eb6Smrg   LINTLIB=llib-l$1.ln
349176028eb6Smrg   if test "x$LINT" = "x"; then
349276028eb6Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
349376028eb6Smrg   fi
349476028eb6Smrgelif test "x$make_lint_lib" != x"no" ; then
349576028eb6Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
349676028eb6Smrgfi
349740c5823bSmrg
349876028eb6SmrgAC_SUBST(LINTLIB)
349976028eb6SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
350040c5823bSmrg
350176028eb6Smrg]) # XORG_LINT_LIBRARY
350240c5823bSmrg
350376028eb6Smrg# XORG_COMPILER_BRAND
350476028eb6Smrg# -------------------
350576028eb6Smrg# Minimum version: 1.14.0
350630f8ce46Smrg#
350776028eb6Smrg# Checks for various brands of compilers and sets flags as appropriate:
350876028eb6Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
350976028eb6Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
351076028eb6Smrg#   clang compiler - sets CLANGCC to "yes"
351176028eb6Smrg#   Intel compiler - sets INTELCC to "yes"
351276028eb6Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
351376028eb6Smrg#
351476028eb6SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
351576028eb6SmrgAC_LANG_CASE(
351676028eb6Smrg	[C], [
3517e1db7cd1Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3518e1db7cd1Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3519e1db7cd1Smrg		m4_version_prereq([2.70],
3520e1db7cd1Smrg			[AC_REQUIRE([AC_PROG_CC])],
3521e1db7cd1Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
352276028eb6Smrg	],
352376028eb6Smrg	[C++], [
352476028eb6Smrg		AC_REQUIRE([AC_PROG_CXX])
352576028eb6Smrg	]
352676028eb6Smrg)
352776028eb6SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
352876028eb6SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
352976028eb6SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
353076028eb6Smrg]) # XORG_COMPILER_BRAND
353140c5823bSmrg
353276028eb6Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
353340c5823bSmrg# ---------------
353476028eb6Smrg# Minimum version: 1.16.0
353576028eb6Smrg#
353676028eb6Smrg# Test if the compiler works when passed the given flag as a command line argument.
3537e1db7cd1Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
353876028eb6Smrg# next flag in the list until there are no more options.
353976028eb6Smrg#
354076028eb6Smrg# Note that this does not guarantee that the compiler supports the flag as some
354176028eb6Smrg# compilers will simply ignore arguments that they do not understand, but we do
354276028eb6Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
354376028eb6Smrg# -Werror=unused-command-line-argument
354476028eb6Smrg#
354576028eb6SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
354676028eb6Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
354776028eb6Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
354876028eb6Smrg
354976028eb6SmrgAC_LANG_COMPILER_REQUIRE
355076028eb6Smrg
355176028eb6SmrgAC_LANG_CASE(
355276028eb6Smrg	[C], [
3553e1db7cd1Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
3554e1db7cd1Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3555e1db7cd1Smrg		m4_version_prereq([2.70],
3556e1db7cd1Smrg			[AC_REQUIRE([AC_PROG_CC])],
3557e1db7cd1Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
355876028eb6Smrg		define([PREFIX], [C])
355976028eb6Smrg		define([CACHE_PREFIX], [cc])
356076028eb6Smrg		define([COMPILER], [$CC])
356176028eb6Smrg	],
356276028eb6Smrg	[C++], [
356376028eb6Smrg		define([PREFIX], [CXX])
356476028eb6Smrg		define([CACHE_PREFIX], [cxx])
356576028eb6Smrg		define([COMPILER], [$CXX])
356676028eb6Smrg	]
356776028eb6Smrg)
356876028eb6Smrg
356976028eb6Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
357076028eb6Smrg
357176028eb6Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
357276028eb6Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
357376028eb6Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
357476028eb6Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
357576028eb6Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
357676028eb6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
357776028eb6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
357876028eb6Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
357976028eb6Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
358040c5823bSmrgfi
358140c5823bSmrg
358276028eb6Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
358376028eb6Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
358476028eb6Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
358576028eb6Smrg	fi
358676028eb6Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
358776028eb6Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
358876028eb6Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
358976028eb6Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
359076028eb6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
359176028eb6Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
359276028eb6Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
359376028eb6Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
359476028eb6Smrgfi
359540c5823bSmrg
359676028eb6Smrgfound="no"
359776028eb6Smrgm4_foreach([flag], m4_cdr($@), [
359876028eb6Smrg	if test $found = "no" ; then
359976028eb6Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
360076028eb6Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
360176028eb6Smrg		fi
360230f8ce46Smrg
360376028eb6Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
360476028eb6Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
360576028eb6Smrg		fi
360634f90d55Smrg
360776028eb6Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
360834f90d55Smrg
360976028eb6Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
361076028eb6Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
361176028eb6Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
361276028eb6Smrg		AC_CACHE_VAL($cacheid,
361376028eb6Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
361476028eb6Smrg					     [eval $cacheid=yes],
361576028eb6Smrg					     [eval $cacheid=no])])
361634f90d55Smrg
361776028eb6Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
361876028eb6Smrg
361976028eb6Smrg		eval supported=\$$cacheid
362076028eb6Smrg		AC_MSG_RESULT([$supported])
362176028eb6Smrg		if test "$supported" = "yes" ; then
362276028eb6Smrg			$1="$$1 ]flag["
362376028eb6Smrg			found="yes"
362476028eb6Smrg		fi
362576028eb6Smrg	fi
362676028eb6Smrg])
362776028eb6Smrg]) # XORG_TESTSET_CFLAG
362876028eb6Smrg
362976028eb6Smrg# XORG_COMPILER_FLAGS
363040c5823bSmrg# ---------------
363176028eb6Smrg# Minimum version: 1.16.0
363276028eb6Smrg#
363376028eb6Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
363476028eb6Smrg# arguments supported by the selected compiler which do NOT alter the generated
363576028eb6Smrg# code.  These arguments will cause the compiler to print various warnings
363676028eb6Smrg# during compilation AND turn a conservative set of warnings into errors.
363776028eb6Smrg#
363876028eb6Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
363976028eb6Smrg# future versions of util-macros as options are added to new compilers.
364076028eb6Smrg#
364176028eb6SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
364276028eb6SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
364340c5823bSmrg
364476028eb6SmrgAC_ARG_ENABLE(selective-werror,
364576028eb6Smrg              AS_HELP_STRING([--disable-selective-werror],
364676028eb6Smrg                             [Turn off selective compiler errors. (default: enabled)]),
364776028eb6Smrg              [SELECTIVE_WERROR=$enableval],
364876028eb6Smrg              [SELECTIVE_WERROR=yes])
364934f90d55Smrg
365076028eb6SmrgAC_LANG_CASE(
365176028eb6Smrg        [C], [
365276028eb6Smrg                define([PREFIX], [C])
365376028eb6Smrg        ],
365476028eb6Smrg        [C++], [
365576028eb6Smrg                define([PREFIX], [CXX])
365676028eb6Smrg        ]
365776028eb6Smrg)
365876028eb6Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
365976028eb6Smrgif test "x$SUNCC" = "xyes"; then
366076028eb6Smrg    [BASE_]PREFIX[FLAGS]="-v"
366140c5823bSmrgelse
366276028eb6Smrg    [BASE_]PREFIX[FLAGS]=""
366340c5823bSmrgfi
366430f8ce46Smrg
366576028eb6Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
366676028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
366776028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
366876028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
366976028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
367030f8ce46Smrg
367176028eb6SmrgAC_LANG_CASE(
367276028eb6Smrg	[C], [
367376028eb6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
367476028eb6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
367576028eb6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
367676028eb6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
367776028eb6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
367876028eb6Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
367976028eb6Smrg	]
368076028eb6Smrg)
368176028eb6Smrg
368276028eb6Smrg# This chunk adds additional warnings that could catch undesired effects.
368376028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
368476028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
368576028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
368676028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
368776028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
368876028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
368976028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
369076028eb6Smrg
369176028eb6Smrg# These are currently disabled because they are noisy.  They will be enabled
369276028eb6Smrg# in the future once the codebase is sufficiently modernized to silence
369376028eb6Smrg# them.  For now, I don't want them to drown out the other warnings.
369476028eb6Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
369576028eb6Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
369676028eb6Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
369776028eb6Smrg
3698e1db7cd1Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
369976028eb6Smrg# when there are problems that should be fixed.
370076028eb6Smrg
370176028eb6Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
370276028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
370376028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
370476028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
370576028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
370676028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
370776028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
370876028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
370976028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
371076028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
371176028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
371276028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
371376028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
371476028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
371540c5823bSmrgelse
371676028eb6SmrgAC_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])
371776028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
371876028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
371976028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
372076028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
372176028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
372276028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
372376028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
372476028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
372576028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
372676028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
372776028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
372876028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
372976028eb6SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
373040c5823bSmrgfi
3731ce6676dbSmrg
373276028eb6SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
373376028eb6Smrg]) # XORG_COMPILER_FLAGS
373476028eb6Smrg
373576028eb6Smrg# XORG_CWARNFLAGS
373676028eb6Smrg# ---------------
373776028eb6Smrg# Minimum version: 1.2.0
373876028eb6Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3739ce6676dbSmrg#
374076028eb6Smrg# Defines CWARNFLAGS to enable C compiler warnings.
374176028eb6Smrg#
374276028eb6Smrg# This function is deprecated because it defines -fno-strict-aliasing
374376028eb6Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
374476028eb6Smrg# is needed, then it should be added explicitly in the module when
374576028eb6Smrg# it is updated to use BASE_CFLAGS.
374676028eb6Smrg#
374776028eb6SmrgAC_DEFUN([XORG_CWARNFLAGS], [
374876028eb6SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
374976028eb6SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
375076028eb6SmrgAC_LANG_CASE(
375176028eb6Smrg	[C], [
375276028eb6Smrg		CWARNFLAGS="$BASE_CFLAGS"
375376028eb6Smrg		if  test "x$GCC" = xyes ; then
375476028eb6Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
375576028eb6Smrg		fi
375676028eb6Smrg		AC_SUBST(CWARNFLAGS)
375776028eb6Smrg	]
375876028eb6Smrg)
375976028eb6Smrg]) # XORG_CWARNFLAGS
376040c5823bSmrg
376176028eb6Smrg# XORG_STRICT_OPTION
376276028eb6Smrg# -----------------------
376376028eb6Smrg# Minimum version: 1.3.0
376476028eb6Smrg#
376576028eb6Smrg# Add configure option to enable strict compilation flags, such as treating
376676028eb6Smrg# warnings as fatal errors.
376776028eb6Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
376876028eb6Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
376976028eb6Smrg#
377076028eb6Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
377176028eb6Smrg# when strict compilation is unconditionally desired.
377276028eb6SmrgAC_DEFUN([XORG_STRICT_OPTION], [
377376028eb6SmrgAC_REQUIRE([XORG_CWARNFLAGS])
377476028eb6SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
377576028eb6Smrg
377676028eb6SmrgAC_ARG_ENABLE(strict-compilation,
377776028eb6Smrg			  AS_HELP_STRING([--enable-strict-compilation],
377876028eb6Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
377976028eb6Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
378076028eb6Smrg
378176028eb6SmrgAC_LANG_CASE(
378276028eb6Smrg        [C], [
378376028eb6Smrg                define([PREFIX], [C])
378476028eb6Smrg        ],
378576028eb6Smrg        [C++], [
378676028eb6Smrg                define([PREFIX], [CXX])
378776028eb6Smrg        ]
378876028eb6Smrg)
378976028eb6Smrg
379076028eb6Smrg[STRICT_]PREFIX[FLAGS]=""
379176028eb6SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
379276028eb6SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
379376028eb6Smrg
379476028eb6Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
379576028eb6Smrg# activate it with -Werror, so we add it here explicitly.
379676028eb6SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
379776028eb6Smrg
379876028eb6Smrgif test "x$STRICT_COMPILE" = "xyes"; then
379976028eb6Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
380076028eb6Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
380140c5823bSmrgfi
380276028eb6SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
380376028eb6SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
380476028eb6SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
380576028eb6Smrg]) # XORG_STRICT_OPTION
380640c5823bSmrg
3807e1db7cd1Smrg# XORG_DEFAULT_NOCODE_OPTIONS
3808e1db7cd1Smrg# ---------------------------
3809e1db7cd1Smrg# Minimum version: 1.20.0
3810e1db7cd1Smrg#
3811e1db7cd1Smrg# Defines default options for X.Org modules which don't compile code,
3812e1db7cd1Smrg# such as fonts, bitmaps, cursors, and docs.
3813e1db7cd1Smrg#
3814e1db7cd1SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3815e1db7cd1SmrgAC_REQUIRE([AC_PROG_INSTALL])
3816e1db7cd1SmrgXORG_RELEASE_VERSION
3817e1db7cd1SmrgXORG_CHANGELOG
3818e1db7cd1SmrgXORG_INSTALL
3819e1db7cd1SmrgXORG_MANPAGE_SECTIONS
3820e1db7cd1Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3821e1db7cd1Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3822e1db7cd1Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3823e1db7cd1Smrg
382476028eb6Smrg# XORG_DEFAULT_OPTIONS
382576028eb6Smrg# --------------------
382676028eb6Smrg# Minimum version: 1.3.0
3827ce6676dbSmrg#
3828e1db7cd1Smrg# Defines default options for X.Org modules which compile code.
382976028eb6Smrg#
383076028eb6SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
383176028eb6SmrgAC_REQUIRE([AC_PROG_INSTALL])
383276028eb6SmrgXORG_COMPILER_FLAGS
383376028eb6SmrgXORG_CWARNFLAGS
383476028eb6SmrgXORG_STRICT_OPTION
3835e1db7cd1SmrgXORG_DEFAULT_NOCODE_OPTIONS
383676028eb6Smrg]) # XORG_DEFAULT_OPTIONS
3837ce6676dbSmrg
383876028eb6Smrg# XORG_INSTALL()
383976028eb6Smrg# ----------------
384076028eb6Smrg# Minimum version: 1.4.0
384176028eb6Smrg#
384276028eb6Smrg# Defines the variable INSTALL_CMD as the command to copy
384376028eb6Smrg# INSTALL from $prefix/share/util-macros.
384476028eb6Smrg#
384576028eb6SmrgAC_DEFUN([XORG_INSTALL], [
384676028eb6SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
384776028eb6Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
384876028eb6SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
384976028eb6Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
385076028eb6Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
385176028eb6Smrgtouch \$(top_srcdir)/INSTALL; \
385276028eb6Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
385376028eb6SmrgAC_SUBST([INSTALL_CMD])
385476028eb6Smrg]) # XORG_INSTALL
385576028eb6Smrgdnl Copyright 2005 Red Hat, Inc
385676028eb6Smrgdnl
385776028eb6Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
385876028eb6Smrgdnl documentation for any purpose is hereby granted without fee, provided that
385976028eb6Smrgdnl the above copyright notice appear in all copies and that both that
386076028eb6Smrgdnl copyright notice and this permission notice appear in supporting
386176028eb6Smrgdnl documentation.
386276028eb6Smrgdnl
386376028eb6Smrgdnl The above copyright notice and this permission notice shall be included
386476028eb6Smrgdnl in all copies or substantial portions of the Software.
386576028eb6Smrgdnl
386676028eb6Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
386776028eb6Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
386876028eb6Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
386976028eb6Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
387076028eb6Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
387176028eb6Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
387276028eb6Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
387376028eb6Smrgdnl
387476028eb6Smrgdnl Except as contained in this notice, the name of the copyright holders shall
387576028eb6Smrgdnl not be used in advertising or otherwise to promote the sale, use or
387676028eb6Smrgdnl other dealings in this Software without prior written authorization
387776028eb6Smrgdnl from the copyright holders.
387876028eb6Smrgdnl
387940c5823bSmrg
388076028eb6Smrg# XORG_RELEASE_VERSION
388176028eb6Smrg# --------------------
388276028eb6Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3883ce6676dbSmrg
388476028eb6SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
388576028eb6Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
388676028eb6Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
388776028eb6Smrg		[Major version of this package])
388876028eb6Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
388976028eb6Smrg	if test "x$PVM" = "x"; then
389076028eb6Smrg		PVM="0"
389176028eb6Smrg	fi
389276028eb6Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
389376028eb6Smrg		[$PVM],
389476028eb6Smrg		[Minor version of this package])
389576028eb6Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
389676028eb6Smrg	if test "x$PVP" = "x"; then
389776028eb6Smrg		PVP="0"
389876028eb6Smrg	fi
389976028eb6Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
390076028eb6Smrg		[$PVP],
390176028eb6Smrg		[Patch version of this package])
390276028eb6Smrg])
390376028eb6Smrg
390476028eb6Smrg# XORG_CHANGELOG()
390576028eb6Smrg# ----------------
390676028eb6Smrg# Minimum version: 1.2.0
390776028eb6Smrg#
390876028eb6Smrg# Defines the variable CHANGELOG_CMD as the command to generate
390976028eb6Smrg# ChangeLog from git.
391076028eb6Smrg#
391176028eb6Smrg#
391276028eb6SmrgAC_DEFUN([XORG_CHANGELOG], [
391376028eb6SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
391476028eb6Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
391576028eb6Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
391676028eb6Smrgtouch \$(top_srcdir)/ChangeLog; \
391776028eb6Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
391876028eb6SmrgAC_SUBST([CHANGELOG_CMD])
391976028eb6Smrg]) # XORG_CHANGELOG
392076028eb6Smrg
392176028eb6Smrgdnl
3922e1db7cd1Smrgdnl Copyright (c) 2005, Oracle and/or its affiliates.
392376028eb6Smrgdnl
392476028eb6Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
392576028eb6Smrgdnl copy of this software and associated documentation files (the "Software"),
392676028eb6Smrgdnl to deal in the Software without restriction, including without limitation
392776028eb6Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
392876028eb6Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
392976028eb6Smrgdnl Software is furnished to do so, subject to the following conditions:
393076028eb6Smrgdnl
393176028eb6Smrgdnl The above copyright notice and this permission notice (including the next
393276028eb6Smrgdnl paragraph) shall be included in all copies or substantial portions of the
393376028eb6Smrgdnl Software.
393476028eb6Smrgdnl
393576028eb6Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
393676028eb6Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
393776028eb6Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
393876028eb6Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
393976028eb6Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
394076028eb6Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
394176028eb6Smrgdnl DEALINGS IN THE SOFTWARE.
394276028eb6Smrgdnl
3943ce6676dbSmrg
394476028eb6Smrg# XTRANS_TCP_FLAGS()
394576028eb6Smrg# ------------------
394676028eb6Smrg# Find needed libraries for TCP sockets, and check for IPv6 support
394776028eb6SmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
394876028eb6Smrg # SVR4 hides these in libraries other than libc
394976028eb6Smrg AC_SEARCH_LIBS(socket, [socket])
395076028eb6Smrg AC_SEARCH_LIBS(gethostbyname, [nsl])
395176028eb6Smrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
395276028eb6Smrg   AC_CHECK_LIB([ws2_32],[main])
395376028eb6Smrg fi
3954ce6676dbSmrg
395576028eb6Smrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
395676028eb6Smrg AC_ARG_ENABLE(ipv6,
395776028eb6Smrg	AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
395876028eb6Smrg	[IPV6CONN=$enableval],
395976028eb6Smrg	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
396076028eb6Smrg AC_MSG_CHECKING([if IPv6 support should be built])
396176028eb6Smrg if test "$IPV6CONN" = "yes"; then
396276028eb6Smrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
396376028eb6Smrg fi
396476028eb6Smrg AC_MSG_RESULT($IPV6CONN)
3965ce6676dbSmrg
396676028eb6Smrg # 4.3BSD-Reno added a new member to struct sockaddr_in
396776028eb6Smrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
396876028eb6Smrg	AC_DEFINE([BSD44SOCKETS],1,
396976028eb6Smrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
397076028eb6Smrg#include <sys/types.h>
397176028eb6Smrg#include <sys/socket.h>
397276028eb6Smrg#include <netinet/in.h>
397376028eb6Smrg ])
397434f90d55Smrg
397576028eb6Smrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
397676028eb6Smrg AC_CHECK_TYPES([socklen_t], [], [], [
397776028eb6SmrgAC_INCLUDES_DEFAULT
397876028eb6Smrg#include <sys/socket.h>])
39798f34cbf9Ssnj
398076028eb6Smrg # XPG4v2/UNIX95 added msg_control - check to see if we need to define
398176028eb6Smrg # _XOPEN_SOURCE to get it (such as on Solaris)
398276028eb6Smrg AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
398376028eb6Smrg                 [
398476028eb6SmrgAC_INCLUDES_DEFAULT
398576028eb6Smrg#include <sys/socket.h>
398676028eb6Smrg                 ])
398776028eb6Smrg # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
398876028eb6Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
398976028eb6Smrg     unset ac_cv_member_struct_msghdr_msg_control
399076028eb6Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
399176028eb6Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
399276028eb6Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [600],
399376028eb6Smrg                       [Defined if needed to expose struct msghdr.msg_control])
399476028eb6Smrg                     ], [], [
399576028eb6Smrg#define _XOPEN_SOURCE 600
399676028eb6SmrgAC_INCLUDES_DEFAULT
399776028eb6Smrg#include <sys/socket.h>
399876028eb6Smrg                     ])
399976028eb6Smrg fi
400076028eb6Smrg # If that didn't work, fall back to XPG5/UNIX98 with C89
400176028eb6Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
400276028eb6Smrg     unset ac_cv_member_struct_msghdr_msg_control
400376028eb6Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
400476028eb6Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
400576028eb6Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [500],
400676028eb6Smrg                       [Defined if needed to expose struct msghdr.msg_control])
400776028eb6Smrg                     ], [], [
400876028eb6Smrg#define _XOPEN_SOURCE 500
400976028eb6SmrgAC_INCLUDES_DEFAULT
401076028eb6Smrg#include <sys/socket.h>
401176028eb6Smrg                     ])
401276028eb6Smrg fi
40138f34cbf9Ssnj
4014ce6676dbSmrg
401576028eb6Smrg]) # XTRANS_TCP_FLAGS
401634f90d55Smrg
401776028eb6Smrg# XTRANS_CONNECTION_FLAGS()
401876028eb6Smrg# -------------------------
401976028eb6Smrg# Standard checks for which Xtrans transports to use by the Xorg packages
402076028eb6Smrg# that use Xtrans functions
402176028eb6SmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
402276028eb6Smrg AC_REQUIRE([AC_CANONICAL_HOST])
402376028eb6Smrg [case $host_os in
402476028eb6Smrg	mingw*)	unixdef="no"   ;;
402576028eb6Smrg	*)	unixdef="yes"  ;;
402676028eb6Smrg esac]
402776028eb6Smrg AC_ARG_ENABLE(unix-transport,
402876028eb6Smrg	AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
402976028eb6Smrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
403076028eb6Smrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
403176028eb6Smrg if test "$UNIXCONN" = "yes"; then
403276028eb6Smrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
403376028eb6Smrg fi
403476028eb6Smrg AC_MSG_RESULT($UNIXCONN)
403576028eb6Smrg AC_ARG_ENABLE(tcp-transport,
403676028eb6Smrg	AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
403776028eb6Smrg	[TCPCONN=$enableval], [TCPCONN=yes])
403876028eb6Smrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
403976028eb6Smrg AC_MSG_RESULT($TCPCONN)
404076028eb6Smrg if test "$TCPCONN" = "yes"; then
404176028eb6Smrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
404276028eb6Smrg	XTRANS_TCP_FLAGS
404376028eb6Smrg fi
404476028eb6Smrg [case $host_os in
404576028eb6Smrg	solaris*)		localdef="yes" ;;
404676028eb6Smrg	*)			localdef="no"  ;;
404776028eb6Smrg esac]
404876028eb6Smrg AC_ARG_ENABLE(local-transport,
404976028eb6Smrg	AS_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
405076028eb6Smrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
405176028eb6Smrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
405276028eb6Smrg AC_MSG_RESULT($LOCALCONN)
405376028eb6Smrg if test "$LOCALCONN" = "yes"; then
405476028eb6Smrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
405576028eb6Smrg fi
4056ce6676dbSmrg
405776028eb6Smrg # Other functions Xtrans may need
405876028eb6Smrg AC_CHECK_FUNCS([strcasecmp strlcpy])
4059ce6676dbSmrg
406076028eb6Smrg]) # XTRANS_CONNECTION_FLAGS
4061ce6676dbSmrg
406240c5823bSmrg
406376028eb6Smrg# XTRANS_SECURE_RPC_FLAGS()
406476028eb6Smrg# -------------------------
406576028eb6Smrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
406676028eb6Smrg# so that any necessary networking libraries are already found
406776028eb6SmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
406876028eb6Smrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
406976028eb6Smrg AC_ARG_ENABLE(secure-rpc,
407076028eb6Smrg	AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
407176028eb6Smrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
407240c5823bSmrg
407376028eb6Smrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
407476028eb6Smrg	FOUND_SECURE_RPC="no"
407576028eb6Smrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
407676028eb6Smrg			[FOUND_SECURE_RPC="yes"])
407776028eb6Smrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
407876028eb6Smrg		if test "x$SECURE_RPC" = "xyes" ; then
407976028eb6Smrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
408076028eb6Smrg		fi
408176028eb6Smrg		SECURE_RPC="no"
408276028eb6Smrg	else
408376028eb6Smrg		dnl FreeBSD keeps getsecretkey in librpcsvc
408476028eb6Smrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
408576028eb6Smrg		SECURE_RPC="yes"
408676028eb6Smrg	fi
408776028eb6Smrg fi
408876028eb6Smrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
408976028eb6Smrg if test "x$SECURE_RPC" = "xyes" ; then
409076028eb6Smrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
409176028eb6Smrg fi
409276028eb6Smrg AC_MSG_RESULT($SECURE_RPC)
409376028eb6Smrg]) # XTRANS_SECURE_RPC_FLAGS
4094ce6676dbSmrg
4095ce6676dbSmrg
409640c5823bSmrgm4_include([m4/ax_define_dir.m4])
4097