179d5fcd7Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2f29dbc25Smrg
379d5fcd7Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4f29dbc25Smrg
504007ebaSmrg# This file is free software; the Free Software Foundation
604007ebaSmrg# gives unlimited permission to copy and/or distribute it,
704007ebaSmrg# with or without modifications, as long as this notice is preserved.
8f29dbc25Smrg
904007ebaSmrg# This program is distributed in the hope that it will be useful,
1004007ebaSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1104007ebaSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1204007ebaSmrg# PARTICULAR PURPOSE.
13f29dbc25Smrg
1404007ebaSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1504007ebaSmrgm4_ifndef([AC_AUTOCONF_VERSION],
1604007ebaSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1779d5fcd7Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
1879d5fcd7Smrg[m4_warning([this file was generated for autoconf 2.71.
1904007ebaSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2004007ebaSmrgIf you have problems, you may need to regenerate the build system entirely.
2104007ebaSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22f29dbc25Smrg
2379d5fcd7Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2479d5fcd7Smrg#
2579d5fcd7Smrg# This file is free software; the Free Software Foundation
2679d5fcd7Smrg# gives unlimited permission to copy and/or distribute it,
2779d5fcd7Smrg# with or without modifications, as long as this notice is preserved.
2805cf1079Smrg
2979d5fcd7Smrg# AM_AUTOMAKE_VERSION(VERSION)
3079d5fcd7Smrg# ----------------------------
3179d5fcd7Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3279d5fcd7Smrg# generated from the m4 files accompanying Automake X.Y.
3379d5fcd7Smrg# (This private macro should not be called outside this file.)
3479d5fcd7SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3579d5fcd7Smrg[am__api_version='1.16'
3679d5fcd7Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3779d5fcd7Smrgdnl require some minimum version.  Point them to the right macro.
3879d5fcd7Smrgm4_if([$1], [1.16.5], [],
3979d5fcd7Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4079d5fcd7Smrg])
4105cf1079Smrg
4279d5fcd7Smrg# _AM_AUTOCONF_VERSION(VERSION)
4379d5fcd7Smrg# -----------------------------
4479d5fcd7Smrg# aclocal traces this macro to find the Autoconf version.
4579d5fcd7Smrg# This is a private macro too.  Using m4_define simplifies
4679d5fcd7Smrg# the logic in aclocal, which can simply ignore this definition.
4779d5fcd7Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48170d5fdcSmrg
4979d5fcd7Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5079d5fcd7Smrg# -------------------------------
5179d5fcd7Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5279d5fcd7Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5379d5fcd7SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5479d5fcd7Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
5579d5fcd7Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5679d5fcd7Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5779d5fcd7Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58f29dbc25Smrg
5979d5fcd7Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60f29dbc25Smrg
6179d5fcd7Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6279d5fcd7Smrg#
6379d5fcd7Smrg# This file is free software; the Free Software Foundation
6479d5fcd7Smrg# gives unlimited permission to copy and/or distribute it,
6579d5fcd7Smrg# with or without modifications, as long as this notice is preserved.
66f29dbc25Smrg
6779d5fcd7Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6879d5fcd7Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6979d5fcd7Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7079d5fcd7Smrg#
7179d5fcd7Smrg# Of course, Automake must honor this variable whenever it calls a
7279d5fcd7Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7379d5fcd7Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7479d5fcd7Smrg# depending on how configure is run.  This is pretty annoying, since
7579d5fcd7Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7679d5fcd7Smrg# source directory, any form will work fine, but in subdirectories a
7779d5fcd7Smrg# relative path needs to be adjusted first.
7879d5fcd7Smrg#
7979d5fcd7Smrg# $ac_aux_dir/missing
8079d5fcd7Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8179d5fcd7Smrg# $top_srcdir/$ac_aux_dir/missing
8279d5fcd7Smrg#    fails if $ac_aux_dir is absolute,
8379d5fcd7Smrg#    fails when called from a subdirectory in a VPATH build with
8479d5fcd7Smrg#          a relative $ac_aux_dir
8579d5fcd7Smrg#
8679d5fcd7Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8779d5fcd7Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8879d5fcd7Smrg# harmless because $srcdir is '.', but things will broke when you
8979d5fcd7Smrg# start a VPATH build or use an absolute $srcdir.
9079d5fcd7Smrg#
9179d5fcd7Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9279d5fcd7Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9379d5fcd7Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9479d5fcd7Smrg# and then we would define $MISSING as
9579d5fcd7Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9679d5fcd7Smrg# This will work as long as MISSING is not called from configure, because
9779d5fcd7Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9879d5fcd7Smrg# However there are other variables, like CC, which are often used in
9979d5fcd7Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10079d5fcd7Smrg#
10179d5fcd7Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10279d5fcd7Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10379d5fcd7Smrg# configured tree to be moved without reconfiguration.
104f29dbc25Smrg
10579d5fcd7SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10679d5fcd7Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10779d5fcd7Smrg# Expand $ac_aux_dir to an absolute path.
10879d5fcd7Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10979d5fcd7Smrg])
110f29dbc25Smrg
11179d5fcd7Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112f29dbc25Smrg
11379d5fcd7Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11479d5fcd7Smrg#
11579d5fcd7Smrg# This file is free software; the Free Software Foundation
11679d5fcd7Smrg# gives unlimited permission to copy and/or distribute it,
11779d5fcd7Smrg# with or without modifications, as long as this notice is preserved.
118f29dbc25Smrg
11979d5fcd7Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12079d5fcd7Smrg# -------------------------------------
12179d5fcd7Smrg# Define a conditional.
12279d5fcd7SmrgAC_DEFUN([AM_CONDITIONAL],
12379d5fcd7Smrg[AC_PREREQ([2.52])dnl
12479d5fcd7Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12579d5fcd7Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12679d5fcd7SmrgAC_SUBST([$1_TRUE])dnl
12779d5fcd7SmrgAC_SUBST([$1_FALSE])dnl
12879d5fcd7Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12979d5fcd7Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13079d5fcd7Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13179d5fcd7Smrgif $2; then
13279d5fcd7Smrg  $1_TRUE=
13379d5fcd7Smrg  $1_FALSE='#'
13479d5fcd7Smrgelse
13579d5fcd7Smrg  $1_TRUE='#'
13679d5fcd7Smrg  $1_FALSE=
13779d5fcd7Smrgfi
13879d5fcd7SmrgAC_CONFIG_COMMANDS_PRE(
13979d5fcd7Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14079d5fcd7Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14179d5fcd7SmrgUsually this means the macro was only invoked conditionally.]])
14279d5fcd7Smrgfi])])
143f29dbc25Smrg
14479d5fcd7Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
14579d5fcd7Smrg#
14679d5fcd7Smrg# This file is free software; the Free Software Foundation
14779d5fcd7Smrg# gives unlimited permission to copy and/or distribute it,
14879d5fcd7Smrg# with or without modifications, as long as this notice is preserved.
149f29dbc25Smrg
150f29dbc25Smrg
15179d5fcd7Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15279d5fcd7Smrg# written in clear, in which case automake, when reading aclocal.m4,
15379d5fcd7Smrg# will think it sees a *use*, and therefore will trigger all it's
15479d5fcd7Smrg# C support machinery.  Also note that it means that autoscan, seeing
15579d5fcd7Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156f29dbc25Smrg
157f29dbc25Smrg
15879d5fcd7Smrg# _AM_DEPENDENCIES(NAME)
15979d5fcd7Smrg# ----------------------
16079d5fcd7Smrg# See how the compiler implements dependency checking.
16179d5fcd7Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16279d5fcd7Smrg# We try a few techniques and use that to set a single cache variable.
16379d5fcd7Smrg#
16479d5fcd7Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16579d5fcd7Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16679d5fcd7Smrg# dependency, and given that the user is not expected to run this macro,
16779d5fcd7Smrg# just rely on AC_PROG_CC.
16879d5fcd7SmrgAC_DEFUN([_AM_DEPENDENCIES],
16979d5fcd7Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17079d5fcd7SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17179d5fcd7SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17279d5fcd7SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173f29dbc25Smrg
17479d5fcd7Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17579d5fcd7Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17679d5fcd7Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17779d5fcd7Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17879d5fcd7Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17979d5fcd7Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18079d5fcd7Smrg                    [depcc="$$1"   am_compiler_list=])
181f29dbc25Smrg
18279d5fcd7SmrgAC_CACHE_CHECK([dependency style of $depcc],
18379d5fcd7Smrg               [am_cv_$1_dependencies_compiler_type],
18479d5fcd7Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18579d5fcd7Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
18679d5fcd7Smrg  # making bogus files that we don't know about and never remove.  For
18779d5fcd7Smrg  # instance it was reported that on HP-UX the gcc test will end up
18879d5fcd7Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18979d5fcd7Smrg  # in D".
19079d5fcd7Smrg  rm -rf conftest.dir
19179d5fcd7Smrg  mkdir conftest.dir
19279d5fcd7Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19379d5fcd7Smrg  # using a relative directory.
19479d5fcd7Smrg  cp "$am_depcomp" conftest.dir
19579d5fcd7Smrg  cd conftest.dir
19679d5fcd7Smrg  # We will build objects and dependencies in a subdirectory because
19779d5fcd7Smrg  # it helps to detect inapplicable dependency modes.  For instance
19879d5fcd7Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19979d5fcd7Smrg  # side effect of compilation, but ICC will put the dependencies in
20079d5fcd7Smrg  # the current directory while Tru64 will put them in the object
20179d5fcd7Smrg  # directory.
20279d5fcd7Smrg  mkdir sub
203f29dbc25Smrg
20479d5fcd7Smrg  am_cv_$1_dependencies_compiler_type=none
20579d5fcd7Smrg  if test "$am_compiler_list" = ""; then
20679d5fcd7Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20779d5fcd7Smrg  fi
20879d5fcd7Smrg  am__universal=false
20979d5fcd7Smrg  m4_case([$1], [CC],
21079d5fcd7Smrg    [case " $depcc " in #(
21179d5fcd7Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21279d5fcd7Smrg     esac],
21379d5fcd7Smrg    [CXX],
21479d5fcd7Smrg    [case " $depcc " in #(
21579d5fcd7Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21679d5fcd7Smrg     esac])
21705cf1079Smrg
21879d5fcd7Smrg  for depmode in $am_compiler_list; do
21979d5fcd7Smrg    # Setup a source with many dependencies, because some compilers
22079d5fcd7Smrg    # like to wrap large dependency lists on column 80 (with \), and
22179d5fcd7Smrg    # we should not choose a depcomp mode which is confused by this.
22279d5fcd7Smrg    #
22379d5fcd7Smrg    # We need to recreate these files for each test, as the compiler may
22479d5fcd7Smrg    # overwrite some of them when testing with obscure command lines.
22579d5fcd7Smrg    # This happens at least with the AIX C compiler.
22679d5fcd7Smrg    : > sub/conftest.c
22779d5fcd7Smrg    for i in 1 2 3 4 5 6; do
22879d5fcd7Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22979d5fcd7Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23079d5fcd7Smrg      # Solaris 10 /bin/sh.
23179d5fcd7Smrg      echo '/* dummy */' > sub/conftst$i.h
23279d5fcd7Smrg    done
23379d5fcd7Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23405cf1079Smrg
23579d5fcd7Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23679d5fcd7Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23779d5fcd7Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23879d5fcd7Smrg    # versions had trouble with output in subdirs.
23979d5fcd7Smrg    am__obj=sub/conftest.${OBJEXT-o}
24079d5fcd7Smrg    am__minus_obj="-o $am__obj"
24179d5fcd7Smrg    case $depmode in
24279d5fcd7Smrg    gcc)
24379d5fcd7Smrg      # This depmode causes a compiler race in universal mode.
24479d5fcd7Smrg      test "$am__universal" = false || continue
24579d5fcd7Smrg      ;;
24679d5fcd7Smrg    nosideeffect)
24779d5fcd7Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24879d5fcd7Smrg      # only be used when explicitly requested.
24979d5fcd7Smrg      if test "x$enable_dependency_tracking" = xyes; then
25079d5fcd7Smrg	continue
25179d5fcd7Smrg      else
25279d5fcd7Smrg	break
25379d5fcd7Smrg      fi
25479d5fcd7Smrg      ;;
25579d5fcd7Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25679d5fcd7Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25779d5fcd7Smrg      # not run yet.  These depmodes are late enough in the game, and
25879d5fcd7Smrg      # so weak that their functioning should not be impacted.
25979d5fcd7Smrg      am__obj=conftest.${OBJEXT-o}
26079d5fcd7Smrg      am__minus_obj=
26179d5fcd7Smrg      ;;
26279d5fcd7Smrg    none) break ;;
26379d5fcd7Smrg    esac
26479d5fcd7Smrg    if depmode=$depmode \
26579d5fcd7Smrg       source=sub/conftest.c object=$am__obj \
26679d5fcd7Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26779d5fcd7Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26879d5fcd7Smrg         >/dev/null 2>conftest.err &&
26979d5fcd7Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27079d5fcd7Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27179d5fcd7Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27279d5fcd7Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27379d5fcd7Smrg      # icc doesn't choke on unknown options, it will just issue warnings
27479d5fcd7Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
27579d5fcd7Smrg      # that says an option was ignored or not supported.
27679d5fcd7Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27779d5fcd7Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27879d5fcd7Smrg      # The diagnosis changed in icc 8.0:
27979d5fcd7Smrg      #   icc: Command line remark: option '-MP' not supported
28079d5fcd7Smrg      if (grep 'ignoring option' conftest.err ||
28179d5fcd7Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28279d5fcd7Smrg        am_cv_$1_dependencies_compiler_type=$depmode
28379d5fcd7Smrg        break
28479d5fcd7Smrg      fi
28579d5fcd7Smrg    fi
28679d5fcd7Smrg  done
287f29dbc25Smrg
28879d5fcd7Smrg  cd ..
28979d5fcd7Smrg  rm -rf conftest.dir
29079d5fcd7Smrgelse
29179d5fcd7Smrg  am_cv_$1_dependencies_compiler_type=none
29279d5fcd7Smrgfi
29379d5fcd7Smrg])
29479d5fcd7SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29579d5fcd7SmrgAM_CONDITIONAL([am__fastdep$1], [
29679d5fcd7Smrg  test "x$enable_dependency_tracking" != xno \
29779d5fcd7Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29879d5fcd7Smrg])
2997f419768Smrg
3007f419768Smrg
30179d5fcd7Smrg# AM_SET_DEPDIR
30279d5fcd7Smrg# -------------
30379d5fcd7Smrg# Choose a directory name for dependency files.
30479d5fcd7Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30579d5fcd7SmrgAC_DEFUN([AM_SET_DEPDIR],
30679d5fcd7Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30779d5fcd7SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30879d5fcd7Smrg])
3097f419768Smrg
3107f419768Smrg
31179d5fcd7Smrg# AM_DEP_TRACK
31279d5fcd7Smrg# ------------
31379d5fcd7SmrgAC_DEFUN([AM_DEP_TRACK],
31479d5fcd7Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31579d5fcd7SmrgAS_HELP_STRING(
31679d5fcd7Smrg  [--enable-dependency-tracking],
31779d5fcd7Smrg  [do not reject slow dependency extractors])
31879d5fcd7SmrgAS_HELP_STRING(
31979d5fcd7Smrg  [--disable-dependency-tracking],
32079d5fcd7Smrg  [speeds up one-time build])])
32179d5fcd7Smrgif test "x$enable_dependency_tracking" != xno; then
32279d5fcd7Smrg  am_depcomp="$ac_aux_dir/depcomp"
32379d5fcd7Smrg  AMDEPBACKSLASH='\'
32479d5fcd7Smrg  am__nodep='_no'
32579d5fcd7Smrgfi
32679d5fcd7SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32779d5fcd7SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32879d5fcd7Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32979d5fcd7SmrgAC_SUBST([am__nodep])dnl
33079d5fcd7Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33179d5fcd7Smrg])
3327f419768Smrg
33379d5fcd7Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334f29dbc25Smrg
33579d5fcd7Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
336f29dbc25Smrg#
33779d5fcd7Smrg# This file is free software; the Free Software Foundation
33879d5fcd7Smrg# gives unlimited permission to copy and/or distribute it,
33979d5fcd7Smrg# with or without modifications, as long as this notice is preserved.
340f29dbc25Smrg
34179d5fcd7Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34279d5fcd7Smrg# ------------------------------
34379d5fcd7SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34479d5fcd7Smrg[{
34579d5fcd7Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
34679d5fcd7Smrg  # are listed without --file.  Let's play safe and only enable the eval
34779d5fcd7Smrg  # if we detect the quoting.
34879d5fcd7Smrg  # TODO: see whether this extra hack can be removed once we start
34979d5fcd7Smrg  # requiring Autoconf 2.70 or later.
35079d5fcd7Smrg  AS_CASE([$CONFIG_FILES],
35179d5fcd7Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
35279d5fcd7Smrg          [*], [set x $CONFIG_FILES])
35379d5fcd7Smrg  shift
35479d5fcd7Smrg  # Used to flag and report bootstrapping failures.
35579d5fcd7Smrg  am_rc=0
35679d5fcd7Smrg  for am_mf
35779d5fcd7Smrg  do
35879d5fcd7Smrg    # Strip MF so we end up with the name of the file.
35979d5fcd7Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
36079d5fcd7Smrg    # Check whether this is an Automake generated Makefile which includes
36179d5fcd7Smrg    # dependency-tracking related rules and includes.
36279d5fcd7Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
36379d5fcd7Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
36479d5fcd7Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
36579d5fcd7Smrg      || continue
36679d5fcd7Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
36779d5fcd7Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
36879d5fcd7Smrg    AM_RUN_LOG([cd "$am_dirpart" \
36979d5fcd7Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
37079d5fcd7Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
37179d5fcd7Smrg  done
37279d5fcd7Smrg  if test $am_rc -ne 0; then
37379d5fcd7Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
37479d5fcd7Smrg    for automatic dependency tracking.  If GNU make was not used, consider
37579d5fcd7Smrg    re-running the configure script with MAKE="gmake" (or whatever is
37679d5fcd7Smrg    necessary).  You can also try re-running configure with the
37779d5fcd7Smrg    '--disable-dependency-tracking' option to at least be able to build
37879d5fcd7Smrg    the package (albeit without support for automatic dependency tracking).])
37979d5fcd7Smrg  fi
38079d5fcd7Smrg  AS_UNSET([am_dirpart])
38179d5fcd7Smrg  AS_UNSET([am_filepart])
38279d5fcd7Smrg  AS_UNSET([am_mf])
38379d5fcd7Smrg  AS_UNSET([am_rc])
38479d5fcd7Smrg  rm -f conftest-deps.mk
38579d5fcd7Smrg}
38679d5fcd7Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387f29dbc25Smrg
388f29dbc25Smrg
38979d5fcd7Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39079d5fcd7Smrg# -----------------------------
39179d5fcd7Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392f29dbc25Smrg#
39379d5fcd7Smrg# This code is only required when automatic dependency tracking is enabled.
39479d5fcd7Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
39579d5fcd7Smrg# order to bootstrap the dependency handling code.
39679d5fcd7SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
39779d5fcd7Smrg[AC_CONFIG_COMMANDS([depfiles],
39879d5fcd7Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
39979d5fcd7Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400f29dbc25Smrg
40179d5fcd7Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402f29dbc25Smrg
40379d5fcd7Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
40479d5fcd7Smrg#
40579d5fcd7Smrg# This file is free software; the Free Software Foundation
40679d5fcd7Smrg# gives unlimited permission to copy and/or distribute it,
40779d5fcd7Smrg# with or without modifications, as long as this notice is preserved.
408f29dbc25Smrg
40979d5fcd7Smrg# This macro actually does too much.  Some checks are only needed if
41079d5fcd7Smrg# your package does certain things.  But this isn't really a big deal.
411f29dbc25Smrg
41279d5fcd7Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41379d5fcd7Smrgm4_define([AC_PROG_CC],
41479d5fcd7Smrgm4_defn([AC_PROG_CC])
41579d5fcd7Smrg[_AM_PROG_CC_C_O
41679d5fcd7Smrg])
417f29dbc25Smrg
41879d5fcd7Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41979d5fcd7Smrg# AM_INIT_AUTOMAKE([OPTIONS])
42079d5fcd7Smrg# -----------------------------------------------
42179d5fcd7Smrg# The call with PACKAGE and VERSION arguments is the old style
42279d5fcd7Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42379d5fcd7Smrg# and VERSION should now be passed to AC_INIT and removed from
42479d5fcd7Smrg# the call to AM_INIT_AUTOMAKE.
42579d5fcd7Smrg# We support both call styles for the transition.  After
42679d5fcd7Smrg# the next Automake release, Autoconf can make the AC_INIT
42779d5fcd7Smrg# arguments mandatory, and then we can depend on a new Autoconf
42879d5fcd7Smrg# release and drop the old call support.
42979d5fcd7SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43079d5fcd7Smrg[AC_PREREQ([2.65])dnl
43179d5fcd7Smrgm4_ifdef([_$0_ALREADY_INIT],
43279d5fcd7Smrg  [m4_fatal([$0 expanded multiple times
43379d5fcd7Smrg]m4_defn([_$0_ALREADY_INIT]))],
43479d5fcd7Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
43579d5fcd7Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43679d5fcd7Smrgdnl the ones we care about.
43779d5fcd7Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43879d5fcd7SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43979d5fcd7SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44079d5fcd7Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44179d5fcd7Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44279d5fcd7Smrg  # is not polluted with repeated "-I."
44379d5fcd7Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44479d5fcd7Smrg  # test to see if srcdir already configured
44579d5fcd7Smrg  if test -f $srcdir/config.status; then
44679d5fcd7Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44779d5fcd7Smrg  fi
448f29dbc25Smrgfi
449f29dbc25Smrg
45079d5fcd7Smrg# test whether we have cygpath
45179d5fcd7Smrgif test -z "$CYGPATH_W"; then
45279d5fcd7Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45379d5fcd7Smrg    CYGPATH_W='cygpath -w'
45479d5fcd7Smrg  else
45579d5fcd7Smrg    CYGPATH_W=echo
45679d5fcd7Smrg  fi
457f29dbc25Smrgfi
45879d5fcd7SmrgAC_SUBST([CYGPATH_W])
459f29dbc25Smrg
46079d5fcd7Smrg# Define the identity of the package.
46179d5fcd7Smrgdnl Distinguish between old-style and new-style calls.
46279d5fcd7Smrgm4_ifval([$2],
46379d5fcd7Smrg[AC_DIAGNOSE([obsolete],
46479d5fcd7Smrg             [$0: two- and three-arguments forms are deprecated.])
46579d5fcd7Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46679d5fcd7Smrg AC_SUBST([PACKAGE], [$1])dnl
46779d5fcd7Smrg AC_SUBST([VERSION], [$2])],
46879d5fcd7Smrg[_AM_SET_OPTIONS([$1])dnl
46979d5fcd7Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47079d5fcd7Smrgm4_if(
47179d5fcd7Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47279d5fcd7Smrg  [ok:ok],,
47379d5fcd7Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47479d5fcd7Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47579d5fcd7Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
47679d5fcd7Smrg
47779d5fcd7Smrg_AM_IF_OPTION([no-define],,
47879d5fcd7Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47979d5fcd7Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
48079d5fcd7Smrg
48179d5fcd7Smrg# Some tools Automake needs.
48279d5fcd7SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48379d5fcd7SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48479d5fcd7SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48579d5fcd7SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48679d5fcd7SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48779d5fcd7SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48879d5fcd7SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48979d5fcd7SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49079d5fcd7SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49179d5fcd7SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49279d5fcd7Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49379d5fcd7Smrg# dies out for good.  For more background, see:
49479d5fcd7Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49579d5fcd7Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49679d5fcd7SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49779d5fcd7Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
49879d5fcd7Smrg# system "awk" is bad on some platforms.
49979d5fcd7SmrgAC_REQUIRE([AC_PROG_AWK])dnl
50079d5fcd7SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50179d5fcd7SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50279d5fcd7Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50379d5fcd7Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50479d5fcd7Smrg			     [_AM_PROG_TAR([v7])])])
50579d5fcd7Smrg_AM_IF_OPTION([no-dependencies],,
50679d5fcd7Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50779d5fcd7Smrg		  [_AM_DEPENDENCIES([CC])],
50879d5fcd7Smrg		  [m4_define([AC_PROG_CC],
50979d5fcd7Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51079d5fcd7SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51179d5fcd7Smrg		  [_AM_DEPENDENCIES([CXX])],
51279d5fcd7Smrg		  [m4_define([AC_PROG_CXX],
51379d5fcd7Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51479d5fcd7SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51579d5fcd7Smrg		  [_AM_DEPENDENCIES([OBJC])],
51679d5fcd7Smrg		  [m4_define([AC_PROG_OBJC],
51779d5fcd7Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51879d5fcd7SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51979d5fcd7Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52079d5fcd7Smrg		  [m4_define([AC_PROG_OBJCXX],
52179d5fcd7Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52279d5fcd7Smrg])
52379d5fcd7Smrg# Variables for tags utilities; see am/tags.am
52479d5fcd7Smrgif test -z "$CTAGS"; then
52579d5fcd7Smrg  CTAGS=ctags
52679d5fcd7Smrgfi
52779d5fcd7SmrgAC_SUBST([CTAGS])
52879d5fcd7Smrgif test -z "$ETAGS"; then
52979d5fcd7Smrg  ETAGS=etags
530f29dbc25Smrgfi
53179d5fcd7SmrgAC_SUBST([ETAGS])
53279d5fcd7Smrgif test -z "$CSCOPE"; then
53379d5fcd7Smrg  CSCOPE=cscope
53479d5fcd7Smrgfi
53579d5fcd7SmrgAC_SUBST([CSCOPE])
536f29dbc25Smrg
53779d5fcd7SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
53879d5fcd7Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53979d5fcd7Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54079d5fcd7Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
54179d5fcd7SmrgAC_CONFIG_COMMANDS_PRE(dnl
54279d5fcd7Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
54379d5fcd7Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544f29dbc25Smrg
54579d5fcd7Smrg# POSIX will say in a future version that running "rm -f" with no argument
54679d5fcd7Smrg# is OK; and we want to be able to make that assumption in our Makefile
54779d5fcd7Smrg# recipes.  So use an aggressive probe to check that the usage we want is
54879d5fcd7Smrg# actually supported "in the wild" to an acceptable degree.
54979d5fcd7Smrg# See automake bug#10828.
55079d5fcd7Smrg# To make any issue more visible, cause the running configure to be aborted
55179d5fcd7Smrg# by default if the 'rm' program in use doesn't match our expectations; the
55279d5fcd7Smrg# user can still override this though.
55379d5fcd7Smrgif rm -f && rm -fr && rm -rf; then : OK; else
55479d5fcd7Smrg  cat >&2 <<'END'
55579d5fcd7SmrgOops!
556170d5fdcSmrg
55779d5fcd7SmrgYour 'rm' program seems unable to run without file operands specified
55879d5fcd7Smrgon the command line, even when the '-f' option is present.  This is contrary
55979d5fcd7Smrgto the behaviour of most rm programs out there, and not conforming with
56079d5fcd7Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561170d5fdcSmrg
56279d5fcd7SmrgPlease tell bug-automake@gnu.org about your system, including the value
56379d5fcd7Smrgof your $PATH and any error possibly output before this message.  This
56479d5fcd7Smrgcan help us improve future automake versions.
565f29dbc25Smrg
56679d5fcd7SmrgEND
56779d5fcd7Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
56879d5fcd7Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56979d5fcd7Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
57079d5fcd7Smrg    echo >&2
57179d5fcd7Smrg  else
57279d5fcd7Smrg    cat >&2 <<'END'
57379d5fcd7SmrgAborting the configuration process, to ensure you take notice of the issue.
574170d5fdcSmrg
57579d5fcd7SmrgYou can download and install GNU coreutils to get an 'rm' implementation
57679d5fcd7Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
577170d5fdcSmrg
57879d5fcd7SmrgIf you want to complete the configuration process using your problematic
57979d5fcd7Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
58079d5fcd7Smrgto "yes", and re-run configure.
581170d5fdcSmrg
58279d5fcd7SmrgEND
58379d5fcd7Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
58479d5fcd7Smrg  fi
58579d5fcd7Smrgfi
58679d5fcd7Smrgdnl The trailing newline in this macro's definition is deliberate, for
58779d5fcd7Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
58879d5fcd7Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
58979d5fcd7Smrg])
590f29dbc25Smrg
59179d5fcd7Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
59279d5fcd7Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
59379d5fcd7Smrgdnl mangled by Autoconf and run in a shell conditional statement.
59479d5fcd7Smrgm4_define([_AC_COMPILER_EXEEXT],
59579d5fcd7Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596f29dbc25Smrg
59779d5fcd7Smrg# When config.status generates a header, we must update the stamp-h file.
59879d5fcd7Smrg# This file resides in the same directory as the config header
59979d5fcd7Smrg# that is generated.  The stamp files are numbered to have different names.
600f29dbc25Smrg
60179d5fcd7Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
60279d5fcd7Smrg# loop where config.status creates the headers, so we can generate
60379d5fcd7Smrg# our stamp files there.
60479d5fcd7SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
60579d5fcd7Smrg[# Compute $1's index in $config_headers.
60679d5fcd7Smrg_am_arg=$1
60779d5fcd7Smrg_am_stamp_count=1
60879d5fcd7Smrgfor _am_header in $config_headers :; do
60979d5fcd7Smrg  case $_am_header in
61079d5fcd7Smrg    $_am_arg | $_am_arg:* )
61179d5fcd7Smrg      break ;;
61279d5fcd7Smrg    * )
61379d5fcd7Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
61479d5fcd7Smrg  esac
61579d5fcd7Smrgdone
61679d5fcd7Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617f29dbc25Smrg
61879d5fcd7Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
61979d5fcd7Smrg#
62079d5fcd7Smrg# This file is free software; the Free Software Foundation
62179d5fcd7Smrg# gives unlimited permission to copy and/or distribute it,
62279d5fcd7Smrg# with or without modifications, as long as this notice is preserved.
623f29dbc25Smrg
62479d5fcd7Smrg# AM_PROG_INSTALL_SH
62579d5fcd7Smrg# ------------------
62679d5fcd7Smrg# Define $install_sh.
62779d5fcd7SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
62879d5fcd7Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
62979d5fcd7Smrgif test x"${install_sh+set}" != xset; then
63079d5fcd7Smrg  case $am_aux_dir in
63179d5fcd7Smrg  *\ * | *\	*)
63279d5fcd7Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
63379d5fcd7Smrg  *)
63479d5fcd7Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
63579d5fcd7Smrg  esac
63679d5fcd7Smrgfi
63779d5fcd7SmrgAC_SUBST([install_sh])])
638f29dbc25Smrg
63979d5fcd7Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
64079d5fcd7Smrg#
64179d5fcd7Smrg# This file is free software; the Free Software Foundation
64279d5fcd7Smrg# gives unlimited permission to copy and/or distribute it,
64379d5fcd7Smrg# with or without modifications, as long as this notice is preserved.
644f29dbc25Smrg
64579d5fcd7Smrg# Check whether the underlying file-system supports filenames
64679d5fcd7Smrg# with a leading dot.  For instance MS-DOS doesn't.
64779d5fcd7SmrgAC_DEFUN([AM_SET_LEADING_DOT],
64879d5fcd7Smrg[rm -rf .tst 2>/dev/null
64979d5fcd7Smrgmkdir .tst 2>/dev/null
65079d5fcd7Smrgif test -d .tst; then
65179d5fcd7Smrg  am__leading_dot=.
652f29dbc25Smrgelse
65379d5fcd7Smrg  am__leading_dot=_
654f29dbc25Smrgfi
65579d5fcd7Smrgrmdir .tst 2>/dev/null
65679d5fcd7SmrgAC_SUBST([am__leading_dot])])
657f29dbc25Smrg
65879d5fcd7Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
65979d5fcd7Smrg# From Jim Meyering
660f29dbc25Smrg
66179d5fcd7Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
66279d5fcd7Smrg#
66379d5fcd7Smrg# This file is free software; the Free Software Foundation
66479d5fcd7Smrg# gives unlimited permission to copy and/or distribute it,
66579d5fcd7Smrg# with or without modifications, as long as this notice is preserved.
666f29dbc25Smrg
66779d5fcd7Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
66879d5fcd7Smrg# ----------------------------------
66979d5fcd7Smrg# Control maintainer-specific portions of Makefiles.
67079d5fcd7Smrg# Default is to disable them, unless 'enable' is passed literally.
67179d5fcd7Smrg# For symmetry, 'disable' may be passed as well.  Anyway, the user
67279d5fcd7Smrg# can override the default with the --enable/--disable switch.
67379d5fcd7SmrgAC_DEFUN([AM_MAINTAINER_MODE],
67479d5fcd7Smrg[m4_case(m4_default([$1], [disable]),
67579d5fcd7Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
67679d5fcd7Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
67779d5fcd7Smrg       [m4_define([am_maintainer_other], [enable])
67879d5fcd7Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
67979d5fcd7SmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
68079d5fcd7Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
68179d5fcd7Smrg  AC_ARG_ENABLE([maintainer-mode],
68279d5fcd7Smrg    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
68379d5fcd7Smrg      am_maintainer_other[ make rules and dependencies not useful
68479d5fcd7Smrg      (and sometimes confusing) to the casual installer])],
68579d5fcd7Smrg    [USE_MAINTAINER_MODE=$enableval],
68679d5fcd7Smrg    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
68779d5fcd7Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
68879d5fcd7Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
68979d5fcd7Smrg  MAINT=$MAINTAINER_MODE_TRUE
69079d5fcd7Smrg  AC_SUBST([MAINT])dnl
69179d5fcd7Smrg]
69279d5fcd7Smrg)
693f29dbc25Smrg
69479d5fcd7Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
69579d5fcd7Smrg
69679d5fcd7Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
697f29dbc25Smrg#
69879d5fcd7Smrg# This file is free software; the Free Software Foundation
69979d5fcd7Smrg# gives unlimited permission to copy and/or distribute it,
70079d5fcd7Smrg# with or without modifications, as long as this notice is preserved.
701170d5fdcSmrg
70279d5fcd7Smrg# AM_MAKE_INCLUDE()
70379d5fcd7Smrg# -----------------
70479d5fcd7Smrg# Check whether make has an 'include' directive that can support all
70579d5fcd7Smrg# the idioms we need for our automatic dependency tracking code.
70679d5fcd7SmrgAC_DEFUN([AM_MAKE_INCLUDE],
70779d5fcd7Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
70879d5fcd7Smrgcat > confinc.mk << 'END'
70979d5fcd7Smrgam__doit:
71079d5fcd7Smrg	@echo this is the am__doit target >confinc.out
71179d5fcd7Smrg.PHONY: am__doit
71279d5fcd7SmrgEND
71379d5fcd7Smrgam__include="#"
71479d5fcd7Smrgam__quote=
71579d5fcd7Smrg# BSD make does it like this.
71679d5fcd7Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
71779d5fcd7Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
71879d5fcd7Smrgecho 'include confinc.mk # ignored' > confmf.GNU
71979d5fcd7Smrg_am_result=no
72079d5fcd7Smrgfor s in GNU BSD; do
72179d5fcd7Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
72279d5fcd7Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
72379d5fcd7Smrg      ['0:this is the am__doit target'],
72479d5fcd7Smrg      [AS_CASE([$s],
72579d5fcd7Smrg          [BSD], [am__include='.include' am__quote='"'],
72679d5fcd7Smrg          [am__include='include' am__quote=''])])
72779d5fcd7Smrg  if test "$am__include" != "#"; then
72879d5fcd7Smrg    _am_result="yes ($s style)"
72979d5fcd7Smrg    break
73079d5fcd7Smrg  fi
73179d5fcd7Smrgdone
73279d5fcd7Smrgrm -f confinc.* confmf.*
73379d5fcd7SmrgAC_MSG_RESULT([${_am_result}])
73479d5fcd7SmrgAC_SUBST([am__include])])
73579d5fcd7SmrgAC_SUBST([am__quote])])
736f29dbc25Smrg
73779d5fcd7Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
738f29dbc25Smrg
73979d5fcd7Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
74079d5fcd7Smrg#
74179d5fcd7Smrg# This file is free software; the Free Software Foundation
74279d5fcd7Smrg# gives unlimited permission to copy and/or distribute it,
74379d5fcd7Smrg# with or without modifications, as long as this notice is preserved.
744f29dbc25Smrg
74579d5fcd7Smrg# AM_MISSING_PROG(NAME, PROGRAM)
74679d5fcd7Smrg# ------------------------------
74779d5fcd7SmrgAC_DEFUN([AM_MISSING_PROG],
74879d5fcd7Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
74979d5fcd7Smrg$1=${$1-"${am_missing_run}$2"}
75079d5fcd7SmrgAC_SUBST($1)])
751f29dbc25Smrg
75279d5fcd7Smrg# AM_MISSING_HAS_RUN
75379d5fcd7Smrg# ------------------
75479d5fcd7Smrg# Define MISSING if not defined so far and test if it is modern enough.
75579d5fcd7Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
75679d5fcd7SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
75779d5fcd7Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
75879d5fcd7SmrgAC_REQUIRE_AUX_FILE([missing])dnl
75979d5fcd7Smrgif test x"${MISSING+set}" != xset; then
76079d5fcd7Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
761f29dbc25Smrgfi
76279d5fcd7Smrg# Use eval to expand $SHELL
76379d5fcd7Smrgif eval "$MISSING --is-lightweight"; then
76479d5fcd7Smrg  am_missing_run="$MISSING "
76579d5fcd7Smrgelse
76679d5fcd7Smrg  am_missing_run=
76779d5fcd7Smrg  AC_MSG_WARN(['missing' script is too old or missing])
768f29dbc25Smrgfi
76979d5fcd7Smrg])
770f29dbc25Smrg
77179d5fcd7Smrg# Helper functions for option handling.                     -*- Autoconf -*-
772f29dbc25Smrg
77379d5fcd7Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
774f29dbc25Smrg#
77579d5fcd7Smrg# This file is free software; the Free Software Foundation
77679d5fcd7Smrg# gives unlimited permission to copy and/or distribute it,
77779d5fcd7Smrg# with or without modifications, as long as this notice is preserved.
778f29dbc25Smrg
77979d5fcd7Smrg# _AM_MANGLE_OPTION(NAME)
78079d5fcd7Smrg# -----------------------
78179d5fcd7SmrgAC_DEFUN([_AM_MANGLE_OPTION],
78279d5fcd7Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
783170d5fdcSmrg
78479d5fcd7Smrg# _AM_SET_OPTION(NAME)
78579d5fcd7Smrg# --------------------
78679d5fcd7Smrg# Set option NAME.  Presently that only means defining a flag for this option.
78779d5fcd7SmrgAC_DEFUN([_AM_SET_OPTION],
78879d5fcd7Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
789170d5fdcSmrg
79079d5fcd7Smrg# _AM_SET_OPTIONS(OPTIONS)
79179d5fcd7Smrg# ------------------------
79279d5fcd7Smrg# OPTIONS is a space-separated list of Automake options.
79379d5fcd7SmrgAC_DEFUN([_AM_SET_OPTIONS],
79479d5fcd7Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
79579d5fcd7Smrg
79679d5fcd7Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
79779d5fcd7Smrg# -------------------------------------------
79879d5fcd7Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
79979d5fcd7SmrgAC_DEFUN([_AM_IF_OPTION],
80079d5fcd7Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
80179d5fcd7Smrg
80279d5fcd7Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
80305cf1079Smrg#
80479d5fcd7Smrg# This file is free software; the Free Software Foundation
80579d5fcd7Smrg# gives unlimited permission to copy and/or distribute it,
80679d5fcd7Smrg# with or without modifications, as long as this notice is preserved.
80704007ebaSmrg
80879d5fcd7Smrg# _AM_PROG_CC_C_O
80979d5fcd7Smrg# ---------------
81079d5fcd7Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
81179d5fcd7Smrg# to automatically call this.
81279d5fcd7SmrgAC_DEFUN([_AM_PROG_CC_C_O],
81379d5fcd7Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
81479d5fcd7SmrgAC_REQUIRE_AUX_FILE([compile])dnl
81579d5fcd7SmrgAC_LANG_PUSH([C])dnl
81679d5fcd7SmrgAC_CACHE_CHECK(
81779d5fcd7Smrg  [whether $CC understands -c and -o together],
81879d5fcd7Smrg  [am_cv_prog_cc_c_o],
81979d5fcd7Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
82079d5fcd7Smrg  # Make sure it works both with $CC and with simple cc.
82179d5fcd7Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
82279d5fcd7Smrg  # compilers refuse to overwrite an existing .o file with -o,
82379d5fcd7Smrg  # though they will create one.
82479d5fcd7Smrg  am_cv_prog_cc_c_o=yes
82579d5fcd7Smrg  for am_i in 1 2; do
82679d5fcd7Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
82779d5fcd7Smrg         && test -f conftest2.$ac_objext; then
82879d5fcd7Smrg      : OK
82979d5fcd7Smrg    else
83079d5fcd7Smrg      am_cv_prog_cc_c_o=no
83179d5fcd7Smrg      break
83279d5fcd7Smrg    fi
83379d5fcd7Smrg  done
83479d5fcd7Smrg  rm -f core conftest*
83579d5fcd7Smrg  unset am_i])
83679d5fcd7Smrgif test "$am_cv_prog_cc_c_o" != yes; then
83779d5fcd7Smrg   # Losing compiler, so override with the script.
83879d5fcd7Smrg   # FIXME: It is wrong to rewrite CC.
83979d5fcd7Smrg   # But if we don't then we get into trouble of one sort or another.
84079d5fcd7Smrg   # A longer-term fix would be to have automake use am__CC in this case,
84179d5fcd7Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
84279d5fcd7Smrg   CC="$am_aux_dir/compile $CC"
84304007ebaSmrgfi
84479d5fcd7SmrgAC_LANG_POP([C])])
84504007ebaSmrg
84679d5fcd7Smrg# For backward compatibility.
84779d5fcd7SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
84804007ebaSmrg
84979d5fcd7Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
85004007ebaSmrg#
85179d5fcd7Smrg# This file is free software; the Free Software Foundation
85279d5fcd7Smrg# gives unlimited permission to copy and/or distribute it,
85379d5fcd7Smrg# with or without modifications, as long as this notice is preserved.
85404007ebaSmrg
85579d5fcd7Smrg# AM_RUN_LOG(COMMAND)
85679d5fcd7Smrg# -------------------
85779d5fcd7Smrg# Run COMMAND, save the exit status in ac_status, and log it.
85879d5fcd7Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
85979d5fcd7SmrgAC_DEFUN([AM_RUN_LOG],
86079d5fcd7Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
86179d5fcd7Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
86279d5fcd7Smrg   ac_status=$?
86379d5fcd7Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
86479d5fcd7Smrg   (exit $ac_status); }])
86504007ebaSmrg
86679d5fcd7Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
867f29dbc25Smrg
86879d5fcd7Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
869f29dbc25Smrg#
87079d5fcd7Smrg# This file is free software; the Free Software Foundation
87179d5fcd7Smrg# gives unlimited permission to copy and/or distribute it,
87279d5fcd7Smrg# with or without modifications, as long as this notice is preserved.
873f29dbc25Smrg
87479d5fcd7Smrg# AM_SANITY_CHECK
87579d5fcd7Smrg# ---------------
87679d5fcd7SmrgAC_DEFUN([AM_SANITY_CHECK],
87779d5fcd7Smrg[AC_MSG_CHECKING([whether build environment is sane])
87879d5fcd7Smrg# Reject unsafe characters in $srcdir or the absolute working directory
87979d5fcd7Smrg# name.  Accept space and tab only in the latter.
88079d5fcd7Smrgam_lf='
88179d5fcd7Smrg'
88279d5fcd7Smrgcase `pwd` in
88379d5fcd7Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
88479d5fcd7Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
88579d5fcd7Smrgesac
88679d5fcd7Smrgcase $srcdir in
88779d5fcd7Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
88879d5fcd7Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
88979d5fcd7Smrgesac
890f29dbc25Smrg
89179d5fcd7Smrg# Do 'set' in a subshell so we don't clobber the current shell's
89279d5fcd7Smrg# arguments.  Must try -L first in case configure is actually a
89379d5fcd7Smrg# symlink; some systems play weird games with the mod time of symlinks
89479d5fcd7Smrg# (eg FreeBSD returns the mod time of the symlink's containing
89579d5fcd7Smrg# directory).
89679d5fcd7Smrgif (
89779d5fcd7Smrg   am_has_slept=no
89879d5fcd7Smrg   for am_try in 1 2; do
89979d5fcd7Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
90079d5fcd7Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
90179d5fcd7Smrg     if test "$[*]" = "X"; then
90279d5fcd7Smrg	# -L didn't work.
90379d5fcd7Smrg	set X `ls -t "$srcdir/configure" conftest.file`
90479d5fcd7Smrg     fi
90579d5fcd7Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
90679d5fcd7Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
90779d5fcd7Smrg
90879d5fcd7Smrg	# If neither matched, then we have a broken ls.  This can happen
90979d5fcd7Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
91079d5fcd7Smrg	# broken ls alias from the environment.  This has actually
91179d5fcd7Smrg	# happened.  Such a system could not be considered "sane".
91279d5fcd7Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
91379d5fcd7Smrg  alias in your environment])
91479d5fcd7Smrg     fi
91579d5fcd7Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
91679d5fcd7Smrg       break
91779d5fcd7Smrg     fi
91879d5fcd7Smrg     # Just in case.
91979d5fcd7Smrg     sleep 1
92079d5fcd7Smrg     am_has_slept=yes
92179d5fcd7Smrg   done
92279d5fcd7Smrg   test "$[2]" = conftest.file
92379d5fcd7Smrg   )
92479d5fcd7Smrgthen
92579d5fcd7Smrg   # Ok.
92679d5fcd7Smrg   :
927f29dbc25Smrgelse
92879d5fcd7Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
92979d5fcd7SmrgCheck your system clock])
930f29dbc25Smrgfi
93179d5fcd7SmrgAC_MSG_RESULT([yes])
93279d5fcd7Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
93379d5fcd7Smrg# generated files are strictly newer.
93479d5fcd7Smrgam_sleep_pid=
93579d5fcd7Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
93679d5fcd7Smrg  ( sleep 1 ) &
93779d5fcd7Smrg  am_sleep_pid=$!
9387f419768Smrgfi
93979d5fcd7SmrgAC_CONFIG_COMMANDS_PRE(
94079d5fcd7Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
94179d5fcd7Smrg   if test -n "$am_sleep_pid"; then
94279d5fcd7Smrg     # Hide warnings about reused PIDs.
94379d5fcd7Smrg     wait $am_sleep_pid 2>/dev/null
94479d5fcd7Smrg   fi
94579d5fcd7Smrg   AC_MSG_RESULT([done])])
94679d5fcd7Smrgrm -f conftest.file
94779d5fcd7Smrg])
9487f419768Smrg
94979d5fcd7Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
950170d5fdcSmrg#
95179d5fcd7Smrg# This file is free software; the Free Software Foundation
95279d5fcd7Smrg# gives unlimited permission to copy and/or distribute it,
95379d5fcd7Smrg# with or without modifications, as long as this notice is preserved.
954170d5fdcSmrg
95579d5fcd7Smrg# AM_SILENT_RULES([DEFAULT])
95679d5fcd7Smrg# --------------------------
95779d5fcd7Smrg# Enable less verbose build rules; with the default set to DEFAULT
95879d5fcd7Smrg# ("yes" being less verbose, "no" or empty being verbose).
95979d5fcd7SmrgAC_DEFUN([AM_SILENT_RULES],
96079d5fcd7Smrg[AC_ARG_ENABLE([silent-rules], [dnl
96179d5fcd7SmrgAS_HELP_STRING(
96279d5fcd7Smrg  [--enable-silent-rules],
96379d5fcd7Smrg  [less verbose build output (undo: "make V=1")])
96479d5fcd7SmrgAS_HELP_STRING(
96579d5fcd7Smrg  [--disable-silent-rules],
96679d5fcd7Smrg  [verbose build output (undo: "make V=0")])dnl
96779d5fcd7Smrg])
96879d5fcd7Smrgcase $enable_silent_rules in @%:@ (((
96979d5fcd7Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
97079d5fcd7Smrg   no) AM_DEFAULT_VERBOSITY=1;;
97179d5fcd7Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
97279d5fcd7Smrgesac
97379d5fcd7Smrgdnl
97479d5fcd7Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
97579d5fcd7Smrgdnl do not support nested variable expansions.
97679d5fcd7Smrgdnl See automake bug#9928 and bug#10237.
97779d5fcd7Smrgam_make=${MAKE-make}
97879d5fcd7SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
97979d5fcd7Smrg   [am_cv_make_support_nested_variables],
98079d5fcd7Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
98179d5fcd7SmrgBAR0=false
98279d5fcd7SmrgBAR1=true
98379d5fcd7SmrgV=1
98479d5fcd7Smrgam__doit:
98579d5fcd7Smrg	@$(TRUE)
98679d5fcd7Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
98779d5fcd7Smrg  am_cv_make_support_nested_variables=yes
988170d5fdcSmrgelse
98979d5fcd7Smrg  am_cv_make_support_nested_variables=no
99079d5fcd7Smrgfi])
99179d5fcd7Smrgif test $am_cv_make_support_nested_variables = yes; then
99279d5fcd7Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
99379d5fcd7Smrg  AM_V='$(V)'
99479d5fcd7Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
99579d5fcd7Smrgelse
99679d5fcd7Smrg  AM_V=$AM_DEFAULT_VERBOSITY
99779d5fcd7Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
998170d5fdcSmrgfi
99979d5fcd7SmrgAC_SUBST([AM_V])dnl
100079d5fcd7SmrgAM_SUBST_NOTMAKE([AM_V])dnl
100179d5fcd7SmrgAC_SUBST([AM_DEFAULT_V])dnl
100279d5fcd7SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
100379d5fcd7SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
100479d5fcd7SmrgAM_BACKSLASH='\'
100579d5fcd7SmrgAC_SUBST([AM_BACKSLASH])dnl
100679d5fcd7Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
100779d5fcd7Smrg])
1008170d5fdcSmrg
100979d5fcd7Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
1010170d5fdcSmrg#
101179d5fcd7Smrg# This file is free software; the Free Software Foundation
101279d5fcd7Smrg# gives unlimited permission to copy and/or distribute it,
101379d5fcd7Smrg# with or without modifications, as long as this notice is preserved.
1014170d5fdcSmrg
101579d5fcd7Smrg# AM_PROG_INSTALL_STRIP
101679d5fcd7Smrg# ---------------------
101779d5fcd7Smrg# One issue with vendor 'install' (even GNU) is that you can't
101879d5fcd7Smrg# specify the program used to strip binaries.  This is especially
101979d5fcd7Smrg# annoying in cross-compiling environments, where the build's strip
102079d5fcd7Smrg# is unlikely to handle the host's binaries.
102179d5fcd7Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
102279d5fcd7Smrg# always use install-sh in "make install-strip", and initialize
102379d5fcd7Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
102479d5fcd7SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
102579d5fcd7Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
102679d5fcd7Smrg# Installed binaries are usually stripped using 'strip' when the user
102779d5fcd7Smrg# run "make install-strip".  However 'strip' might not be the right
102879d5fcd7Smrg# tool to use in cross-compilation environments, therefore Automake
102979d5fcd7Smrg# will honor the 'STRIP' environment variable to overrule this program.
103079d5fcd7Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
103179d5fcd7Smrgif test "$cross_compiling" != no; then
103279d5fcd7Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
1033170d5fdcSmrgfi
103479d5fcd7SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
103579d5fcd7SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
103604007ebaSmrg
103779d5fcd7Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
103879d5fcd7Smrg#
103979d5fcd7Smrg# This file is free software; the Free Software Foundation
104079d5fcd7Smrg# gives unlimited permission to copy and/or distribute it,
104179d5fcd7Smrg# with or without modifications, as long as this notice is preserved.
1042170d5fdcSmrg
104379d5fcd7Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
10447f419768Smrg# ---------------------------
104579d5fcd7Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
104679d5fcd7Smrg# This macro is traced by Automake.
104779d5fcd7SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10487f419768Smrg
104979d5fcd7Smrg# AM_SUBST_NOTMAKE(VARIABLE)
105079d5fcd7Smrg# --------------------------
105179d5fcd7Smrg# Public sister of _AM_SUBST_NOTMAKE.
105279d5fcd7SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
10537f419768Smrg
105479d5fcd7Smrg# Check how to create a tarball.                            -*- Autoconf -*-
105579d5fcd7Smrg
105679d5fcd7Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
1057170d5fdcSmrg#
105879d5fcd7Smrg# This file is free software; the Free Software Foundation
105979d5fcd7Smrg# gives unlimited permission to copy and/or distribute it,
106079d5fcd7Smrg# with or without modifications, as long as this notice is preserved.
106179d5fcd7Smrg
106279d5fcd7Smrg# _AM_PROG_TAR(FORMAT)
106379d5fcd7Smrg# --------------------
106479d5fcd7Smrg# Check how to create a tarball in format FORMAT.
106579d5fcd7Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1066170d5fdcSmrg#
106779d5fcd7Smrg# Substitute a variable $(am__tar) that is a command
106879d5fcd7Smrg# writing to stdout a FORMAT-tarball containing the directory
106979d5fcd7Smrg# $tardir.
107079d5fcd7Smrg#     tardir=directory && $(am__tar) > result.tar
1071170d5fdcSmrg#
107279d5fcd7Smrg# Substitute a variable $(am__untar) that extract such
107379d5fcd7Smrg# a tarball read from stdin.
107479d5fcd7Smrg#     $(am__untar) < result.tar
1075170d5fdcSmrg#
107679d5fcd7SmrgAC_DEFUN([_AM_PROG_TAR],
107779d5fcd7Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
107879d5fcd7Smrg# in the wild :-(  We should find a proper way to deprecate it ...
107979d5fcd7SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1080170d5fdcSmrg
108179d5fcd7Smrg# We'll loop over all known methods to create a tar archive until one works.
108279d5fcd7Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1083170d5fdcSmrg
108479d5fcd7Smrgm4_if([$1], [v7],
108579d5fcd7Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1086170d5fdcSmrg
108779d5fcd7Smrg  [m4_case([$1],
108879d5fcd7Smrg    [ustar],
108979d5fcd7Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
109079d5fcd7Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
109179d5fcd7Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
109279d5fcd7Smrg      # and bug#13588).
109379d5fcd7Smrg      am_max_uid=2097151 # 2^21 - 1
109479d5fcd7Smrg      am_max_gid=$am_max_uid
109579d5fcd7Smrg      # The $UID and $GID variables are not portable, so we need to resort
109679d5fcd7Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
109779d5fcd7Smrg      # below are definitely unexpected, so allow the users to see them
109879d5fcd7Smrg      # (that is, avoid stderr redirection).
109979d5fcd7Smrg      am_uid=`id -u || echo unknown`
110079d5fcd7Smrg      am_gid=`id -g || echo unknown`
110179d5fcd7Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
110279d5fcd7Smrg      if test $am_uid -le $am_max_uid; then
110379d5fcd7Smrg         AC_MSG_RESULT([yes])
110479d5fcd7Smrg      else
110579d5fcd7Smrg         AC_MSG_RESULT([no])
110679d5fcd7Smrg         _am_tools=none
110779d5fcd7Smrg      fi
110879d5fcd7Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
110979d5fcd7Smrg      if test $am_gid -le $am_max_gid; then
111079d5fcd7Smrg         AC_MSG_RESULT([yes])
111179d5fcd7Smrg      else
111279d5fcd7Smrg        AC_MSG_RESULT([no])
111379d5fcd7Smrg        _am_tools=none
111479d5fcd7Smrg      fi],
1115170d5fdcSmrg
111679d5fcd7Smrg  [pax],
111779d5fcd7Smrg    [],
1118f29dbc25Smrg
111979d5fcd7Smrg  [m4_fatal([Unknown tar format])])
112079d5fcd7Smrg
112179d5fcd7Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
112279d5fcd7Smrg
112379d5fcd7Smrg  # Go ahead even if we have the value already cached.  We do so because we
112479d5fcd7Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
112579d5fcd7Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
112679d5fcd7Smrg
112779d5fcd7Smrg  for _am_tool in $_am_tools; do
112879d5fcd7Smrg    case $_am_tool in
112979d5fcd7Smrg    gnutar)
113079d5fcd7Smrg      for _am_tar in tar gnutar gtar; do
113179d5fcd7Smrg        AM_RUN_LOG([$_am_tar --version]) && break
113279d5fcd7Smrg      done
113379d5fcd7Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
113479d5fcd7Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
113579d5fcd7Smrg      am__untar="$_am_tar -xf -"
113679d5fcd7Smrg      ;;
113779d5fcd7Smrg    plaintar)
113879d5fcd7Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
113979d5fcd7Smrg      # ustar tarball either.
114079d5fcd7Smrg      (tar --version) >/dev/null 2>&1 && continue
114179d5fcd7Smrg      am__tar='tar chf - "$$tardir"'
114279d5fcd7Smrg      am__tar_='tar chf - "$tardir"'
114379d5fcd7Smrg      am__untar='tar xf -'
114479d5fcd7Smrg      ;;
114579d5fcd7Smrg    pax)
114679d5fcd7Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
114779d5fcd7Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
114879d5fcd7Smrg      am__untar='pax -r'
114979d5fcd7Smrg      ;;
115079d5fcd7Smrg    cpio)
115179d5fcd7Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
115279d5fcd7Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
115379d5fcd7Smrg      am__untar='cpio -i -H $1 -d'
115479d5fcd7Smrg      ;;
115579d5fcd7Smrg    none)
115679d5fcd7Smrg      am__tar=false
115779d5fcd7Smrg      am__tar_=false
115879d5fcd7Smrg      am__untar=false
115979d5fcd7Smrg      ;;
116079d5fcd7Smrg    esac
116179d5fcd7Smrg
116279d5fcd7Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
116379d5fcd7Smrg    # and am__untar set.
116479d5fcd7Smrg    test -n "${am_cv_prog_tar_$1}" && break
116579d5fcd7Smrg
116679d5fcd7Smrg    # tar/untar a dummy directory, and stop if the command works.
116779d5fcd7Smrg    rm -rf conftest.dir
116879d5fcd7Smrg    mkdir conftest.dir
116979d5fcd7Smrg    echo GrepMe > conftest.dir/file
117079d5fcd7Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
117179d5fcd7Smrg    rm -rf conftest.dir
117279d5fcd7Smrg    if test -s conftest.tar; then
117379d5fcd7Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
117479d5fcd7Smrg      AM_RUN_LOG([cat conftest.dir/file])
117579d5fcd7Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
117679d5fcd7Smrg    fi
117779d5fcd7Smrg  done
117879d5fcd7Smrg  rm -rf conftest.dir
117979d5fcd7Smrg
118079d5fcd7Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
118179d5fcd7Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
118279d5fcd7Smrg
118379d5fcd7SmrgAC_SUBST([am__tar])
118479d5fcd7SmrgAC_SUBST([am__untar])
118579d5fcd7Smrg]) # _AM_PROG_TAR
118679d5fcd7Smrg
118779d5fcd7Smrgdnl Copyright 2005 Red Hat, Inc
118879d5fcd7Smrgdnl 
118979d5fcd7Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
119079d5fcd7Smrgdnl documentation for any purpose is hereby granted without fee, provided that
119179d5fcd7Smrgdnl the above copyright notice appear in all copies and that both that
119279d5fcd7Smrgdnl copyright notice and this permission notice appear in supporting
119379d5fcd7Smrgdnl documentation.
119479d5fcd7Smrgdnl 
119579d5fcd7Smrgdnl The above copyright notice and this permission notice shall be included
119679d5fcd7Smrgdnl in all copies or substantial portions of the Software.
119779d5fcd7Smrgdnl 
119879d5fcd7Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
119979d5fcd7Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
120079d5fcd7Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
120179d5fcd7Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
120279d5fcd7Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
120379d5fcd7Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
120479d5fcd7Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
120579d5fcd7Smrgdnl 
120679d5fcd7Smrgdnl Except as contained in this notice, the name of the copyright holders shall
120779d5fcd7Smrgdnl not be used in advertising or otherwise to promote the sale, use or
120879d5fcd7Smrgdnl other dealings in this Software without prior written authorization
120979d5fcd7Smrgdnl from the copyright holders.
121079d5fcd7Smrgdnl 
121179d5fcd7Smrg
121279d5fcd7Smrg# XORG_DRIVER_CHECK_EXT(MACRO, PROTO)
121379d5fcd7Smrg# --------------------------
121479d5fcd7Smrg# Checks for the MACRO define in xorg-server.h (from the sdk).  If it
121579d5fcd7Smrg# is defined, then add the given PROTO to $REQUIRED_MODULES.
121679d5fcd7Smrg
121779d5fcd7SmrgAC_DEFUN([XORG_DRIVER_CHECK_EXT],[
121879d5fcd7Smrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
121979d5fcd7Smrg	SAVE_CFLAGS="$CFLAGS"
122079d5fcd7Smrg	CFLAGS="$CFLAGS -I`$PKG_CONFIG --variable=sdkdir xorg-server`"
122179d5fcd7Smrg	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
122279d5fcd7Smrg#include "xorg-server.h"
122379d5fcd7Smrg#if !defined $1
122479d5fcd7Smrg#error $1 not defined
122579d5fcd7Smrg#endif
122679d5fcd7Smrg		]])],
122779d5fcd7Smrg		[_EXT_CHECK=yes],
122879d5fcd7Smrg		[_EXT_CHECK=no])
122979d5fcd7Smrg	CFLAGS="$SAVE_CFLAGS"
123079d5fcd7Smrg	AC_MSG_CHECKING([if $1 is defined])
123179d5fcd7Smrg	AC_MSG_RESULT([$_EXT_CHECK])
123279d5fcd7Smrg	if test "$_EXT_CHECK" != no; then
123379d5fcd7Smrg		REQUIRED_MODULES="$REQUIRED_MODULES $2"
123479d5fcd7Smrg	fi
123579d5fcd7Smrg])
123679d5fcd7Smrg
123779d5fcd7Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
123879d5fcd7Smrgdnl serial 11 (pkg-config-0.29)
123979d5fcd7Smrgdnl
124079d5fcd7Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
124179d5fcd7Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
124279d5fcd7Smrgdnl
124379d5fcd7Smrgdnl This program is free software; you can redistribute it and/or modify
124479d5fcd7Smrgdnl it under the terms of the GNU General Public License as published by
124579d5fcd7Smrgdnl the Free Software Foundation; either version 2 of the License, or
124679d5fcd7Smrgdnl (at your option) any later version.
124779d5fcd7Smrgdnl
124879d5fcd7Smrgdnl This program is distributed in the hope that it will be useful, but
124979d5fcd7Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
125079d5fcd7Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
125179d5fcd7Smrgdnl General Public License for more details.
125279d5fcd7Smrgdnl
125379d5fcd7Smrgdnl You should have received a copy of the GNU General Public License
125479d5fcd7Smrgdnl along with this program; if not, write to the Free Software
125579d5fcd7Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
125679d5fcd7Smrgdnl 02111-1307, USA.
125779d5fcd7Smrgdnl
125879d5fcd7Smrgdnl As a special exception to the GNU General Public License, if you
125979d5fcd7Smrgdnl distribute this file as part of a program that contains a
126079d5fcd7Smrgdnl configuration script generated by Autoconf, you may include it under
126179d5fcd7Smrgdnl the same distribution terms that you use for the rest of that
126279d5fcd7Smrgdnl program.
126379d5fcd7Smrg
126479d5fcd7Smrgdnl PKG_PREREQ(MIN-VERSION)
126579d5fcd7Smrgdnl -----------------------
126679d5fcd7Smrgdnl Since: 0.29
126779d5fcd7Smrgdnl
126879d5fcd7Smrgdnl Verify that the version of the pkg-config macros are at least
126979d5fcd7Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
127079d5fcd7Smrgdnl installed version of pkg-config, this checks the developer's version
127179d5fcd7Smrgdnl of pkg.m4 when generating configure.
127279d5fcd7Smrgdnl
127379d5fcd7Smrgdnl To ensure that this macro is defined, also add:
127479d5fcd7Smrgdnl m4_ifndef([PKG_PREREQ],
127579d5fcd7Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
127679d5fcd7Smrgdnl
127779d5fcd7Smrgdnl See the "Since" comment for each macro you use to see what version
127879d5fcd7Smrgdnl of the macros you require.
127979d5fcd7Smrgm4_defun([PKG_PREREQ],
128079d5fcd7Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
128179d5fcd7Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
128279d5fcd7Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
128379d5fcd7Smrg])dnl PKG_PREREQ
128479d5fcd7Smrg
128579d5fcd7Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
128679d5fcd7Smrgdnl ----------------------------------
128779d5fcd7Smrgdnl Since: 0.16
128879d5fcd7Smrgdnl
128979d5fcd7Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
129079d5fcd7Smrgdnl first found in the path. Checks that the version of pkg-config found
129179d5fcd7Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
129279d5fcd7Smrgdnl used since that's the first version where most current features of
129379d5fcd7Smrgdnl pkg-config existed.
129479d5fcd7SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
129579d5fcd7Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
129679d5fcd7Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
129779d5fcd7Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
129879d5fcd7SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
129979d5fcd7SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
130079d5fcd7SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
130179d5fcd7Smrg
130279d5fcd7Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
130379d5fcd7Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
130479d5fcd7Smrgfi
130579d5fcd7Smrgif test -n "$PKG_CONFIG"; then
130679d5fcd7Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
130779d5fcd7Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
130879d5fcd7Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
130979d5fcd7Smrg		AC_MSG_RESULT([yes])
131079d5fcd7Smrg	else
131179d5fcd7Smrg		AC_MSG_RESULT([no])
131279d5fcd7Smrg		PKG_CONFIG=""
131379d5fcd7Smrg	fi
131479d5fcd7Smrgfi[]dnl
131579d5fcd7Smrg])dnl PKG_PROG_PKG_CONFIG
131679d5fcd7Smrg
131779d5fcd7Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
131879d5fcd7Smrgdnl -------------------------------------------------------------------
131979d5fcd7Smrgdnl Since: 0.18
132079d5fcd7Smrgdnl
132179d5fcd7Smrgdnl Check to see whether a particular set of modules exists. Similar to
132279d5fcd7Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
132379d5fcd7Smrgdnl
132479d5fcd7Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
132579d5fcd7Smrgdnl only at the first occurence in configure.ac, so if the first place
132679d5fcd7Smrgdnl it's called might be skipped (such as if it is within an "if", you
132779d5fcd7Smrgdnl have to call PKG_CHECK_EXISTS manually
132879d5fcd7SmrgAC_DEFUN([PKG_CHECK_EXISTS],
132979d5fcd7Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
133079d5fcd7Smrgif test -n "$PKG_CONFIG" && \
133179d5fcd7Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
133279d5fcd7Smrg  m4_default([$2], [:])
133379d5fcd7Smrgm4_ifvaln([$3], [else
133479d5fcd7Smrg  $3])dnl
133579d5fcd7Smrgfi])
133679d5fcd7Smrg
133779d5fcd7Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
133879d5fcd7Smrgdnl ---------------------------------------------
133979d5fcd7Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
134079d5fcd7Smrgdnl pkg_failed based on the result.
134179d5fcd7Smrgm4_define([_PKG_CONFIG],
134279d5fcd7Smrg[if test -n "$$1"; then
134379d5fcd7Smrg    pkg_cv_[]$1="$$1"
134479d5fcd7Smrg elif test -n "$PKG_CONFIG"; then
134579d5fcd7Smrg    PKG_CHECK_EXISTS([$3],
134679d5fcd7Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
134779d5fcd7Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
134879d5fcd7Smrg		     [pkg_failed=yes])
134979d5fcd7Smrg else
135079d5fcd7Smrg    pkg_failed=untried
135179d5fcd7Smrgfi[]dnl
135279d5fcd7Smrg])dnl _PKG_CONFIG
135379d5fcd7Smrg
135479d5fcd7Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
135579d5fcd7Smrgdnl ---------------------------
135679d5fcd7Smrgdnl Internal check to see if pkg-config supports short errors.
135779d5fcd7SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
135879d5fcd7Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
135979d5fcd7Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
136079d5fcd7Smrg        _pkg_short_errors_supported=yes
136179d5fcd7Smrgelse
136279d5fcd7Smrg        _pkg_short_errors_supported=no
136379d5fcd7Smrgfi[]dnl
136479d5fcd7Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
136579d5fcd7Smrg
136679d5fcd7Smrg
136779d5fcd7Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
136879d5fcd7Smrgdnl   [ACTION-IF-NOT-FOUND])
136979d5fcd7Smrgdnl --------------------------------------------------------------
137079d5fcd7Smrgdnl Since: 0.4.0
137179d5fcd7Smrgdnl
137279d5fcd7Smrgdnl Note that if there is a possibility the first call to
137379d5fcd7Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
137479d5fcd7Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
137579d5fcd7SmrgAC_DEFUN([PKG_CHECK_MODULES],
137679d5fcd7Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
137779d5fcd7SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
137879d5fcd7SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
137904007ebaSmrg
138079d5fcd7Smrgpkg_failed=no
138179d5fcd7SmrgAC_MSG_CHECKING([for $1])
138204007ebaSmrg
138379d5fcd7Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
138479d5fcd7Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
138504007ebaSmrg
138679d5fcd7Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
138779d5fcd7Smrgand $1[]_LIBS to avoid the need to call pkg-config.
138879d5fcd7SmrgSee the pkg-config man page for more details.])
138904007ebaSmrg
139079d5fcd7Smrgif test $pkg_failed = yes; then
139179d5fcd7Smrg   	AC_MSG_RESULT([no])
139279d5fcd7Smrg        _PKG_SHORT_ERRORS_SUPPORTED
139379d5fcd7Smrg        if test $_pkg_short_errors_supported = yes; then
139479d5fcd7Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
139579d5fcd7Smrg        else 
139679d5fcd7Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
139779d5fcd7Smrg        fi
139879d5fcd7Smrg	# Put the nasty error message in config.log where it belongs
139979d5fcd7Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
140004007ebaSmrg
140179d5fcd7Smrg	m4_default([$4], [AC_MSG_ERROR(
140279d5fcd7Smrg[Package requirements ($2) were not met:
140304007ebaSmrg
140479d5fcd7Smrg$$1_PKG_ERRORS
140504007ebaSmrg
140679d5fcd7SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
140779d5fcd7Smrginstalled software in a non-standard prefix.
140804007ebaSmrg
140979d5fcd7Smrg_PKG_TEXT])[]dnl
141079d5fcd7Smrg        ])
141179d5fcd7Smrgelif test $pkg_failed = untried; then
141279d5fcd7Smrg     	AC_MSG_RESULT([no])
141379d5fcd7Smrg	m4_default([$4], [AC_MSG_FAILURE(
141479d5fcd7Smrg[The pkg-config script could not be found or is too old.  Make sure it
141579d5fcd7Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
141679d5fcd7Smrgpath to pkg-config.
141704007ebaSmrg
141879d5fcd7Smrg_PKG_TEXT
141979d5fcd7Smrg
142079d5fcd7SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
142179d5fcd7Smrg        ])
142204007ebaSmrgelse
142379d5fcd7Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
142479d5fcd7Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
142579d5fcd7Smrg        AC_MSG_RESULT([yes])
142679d5fcd7Smrg	$3
142779d5fcd7Smrgfi[]dnl
142879d5fcd7Smrg])dnl PKG_CHECK_MODULES
142979d5fcd7Smrg
143079d5fcd7Smrg
143179d5fcd7Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
143279d5fcd7Smrgdnl   [ACTION-IF-NOT-FOUND])
143379d5fcd7Smrgdnl ---------------------------------------------------------------------
143479d5fcd7Smrgdnl Since: 0.29
143579d5fcd7Smrgdnl
143679d5fcd7Smrgdnl Checks for existence of MODULES and gathers its build flags with
143779d5fcd7Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
143879d5fcd7Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
143979d5fcd7Smrgdnl
144079d5fcd7Smrgdnl Note that if there is a possibility the first call to
144179d5fcd7Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
144279d5fcd7Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
144379d5fcd7Smrgdnl configure.ac.
144479d5fcd7SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
144579d5fcd7Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
144679d5fcd7Smrg_save_PKG_CONFIG=$PKG_CONFIG
144779d5fcd7SmrgPKG_CONFIG="$PKG_CONFIG --static"
144879d5fcd7SmrgPKG_CHECK_MODULES($@)
144979d5fcd7SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
145079d5fcd7Smrg])dnl PKG_CHECK_MODULES_STATIC
145104007ebaSmrg
145204007ebaSmrg
145379d5fcd7Smrgdnl PKG_INSTALLDIR([DIRECTORY])
145479d5fcd7Smrgdnl -------------------------
145579d5fcd7Smrgdnl Since: 0.27
145679d5fcd7Smrgdnl
145779d5fcd7Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
145879d5fcd7Smrgdnl should install pkg-config .pc files. By default the directory is
145979d5fcd7Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
146079d5fcd7Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
146179d5fcd7Smrgdnl parameter.
146279d5fcd7SmrgAC_DEFUN([PKG_INSTALLDIR],
146379d5fcd7Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
146479d5fcd7Smrgm4_pushdef([pkg_description],
146579d5fcd7Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
146679d5fcd7SmrgAC_ARG_WITH([pkgconfigdir],
146779d5fcd7Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
146879d5fcd7Smrg    [with_pkgconfigdir=]pkg_default)
146979d5fcd7SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
147079d5fcd7Smrgm4_popdef([pkg_default])
147179d5fcd7Smrgm4_popdef([pkg_description])
147279d5fcd7Smrg])dnl PKG_INSTALLDIR
147304007ebaSmrg
147404007ebaSmrg
147579d5fcd7Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
147679d5fcd7Smrgdnl --------------------------------
147779d5fcd7Smrgdnl Since: 0.27
147879d5fcd7Smrgdnl
147979d5fcd7Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
148079d5fcd7Smrgdnl module should install arch-independent pkg-config .pc files. By
148179d5fcd7Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
148279d5fcd7Smrgdnl changed by passing DIRECTORY. The user can override through the
148379d5fcd7Smrgdnl --with-noarch-pkgconfigdir parameter.
148479d5fcd7SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
148579d5fcd7Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
148679d5fcd7Smrgm4_pushdef([pkg_description],
148779d5fcd7Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
148879d5fcd7SmrgAC_ARG_WITH([noarch-pkgconfigdir],
148979d5fcd7Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
149079d5fcd7Smrg    [with_noarch_pkgconfigdir=]pkg_default)
149179d5fcd7SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
149279d5fcd7Smrgm4_popdef([pkg_default])
149379d5fcd7Smrgm4_popdef([pkg_description])
149479d5fcd7Smrg])dnl PKG_NOARCH_INSTALLDIR
149504007ebaSmrg
149604007ebaSmrg
149779d5fcd7Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
149879d5fcd7Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
149979d5fcd7Smrgdnl -------------------------------------------
150079d5fcd7Smrgdnl Since: 0.28
150179d5fcd7Smrgdnl
150279d5fcd7Smrgdnl Retrieves the value of the pkg-config variable for the given module.
150379d5fcd7SmrgAC_DEFUN([PKG_CHECK_VAR],
150479d5fcd7Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
150579d5fcd7SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1506f29dbc25Smrg
150779d5fcd7Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
150879d5fcd7SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1509f29dbc25Smrg
151079d5fcd7SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
151179d5fcd7Smrg])dnl PKG_CHECK_VAR
1512f29dbc25Smrg
151379d5fcd7Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
151479d5fcd7Smrgdnl
151579d5fcd7Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
151679d5fcd7Smrgdnl
151779d5fcd7Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
151879d5fcd7Smrgdnl copy of this software and associated documentation files (the "Software"),
151979d5fcd7Smrgdnl to deal in the Software without restriction, including without limitation
152079d5fcd7Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
152179d5fcd7Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
152279d5fcd7Smrgdnl Software is furnished to do so, subject to the following conditions:
152379d5fcd7Smrgdnl
152479d5fcd7Smrgdnl The above copyright notice and this permission notice (including the next
152579d5fcd7Smrgdnl paragraph) shall be included in all copies or substantial portions of the
152679d5fcd7Smrgdnl Software.
152779d5fcd7Smrgdnl
152879d5fcd7Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
152979d5fcd7Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
153079d5fcd7Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
153179d5fcd7Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
153279d5fcd7Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
153379d5fcd7Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
153479d5fcd7Smrgdnl DEALINGS IN THE SOFTWARE.
1535f29dbc25Smrg
153679d5fcd7Smrg# XORG_MACROS_VERSION(required-version)
153779d5fcd7Smrg# -------------------------------------
1538f29dbc25Smrg# Minimum version: 1.1.0
1539f29dbc25Smrg#
154079d5fcd7Smrg# If you're using a macro added in Version 1.1 or newer, include this in
154179d5fcd7Smrg# your configure.ac with the minimum required version, such as:
154279d5fcd7Smrg# XORG_MACROS_VERSION(1.1)
1543170d5fdcSmrg#
154479d5fcd7Smrg# To ensure that this macro is defined, also add:
154579d5fcd7Smrg# m4_ifndef([XORG_MACROS_VERSION],
154679d5fcd7Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1547170d5fdcSmrg#
1548170d5fdcSmrg#
154979d5fcd7Smrg# See the "minimum version" comment for each macro you use to see what
155079d5fcd7Smrg# version you require.
155179d5fcd7Smrgm4_defun([XORG_MACROS_VERSION],[
155279d5fcd7Smrgm4_define([vers_have], [1.20.0])
155379d5fcd7Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
155479d5fcd7Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
155579d5fcd7Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
155679d5fcd7Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
155779d5fcd7Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
155879d5fcd7Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
155979d5fcd7Smrgm4_undefine([vers_have])
156079d5fcd7Smrgm4_undefine([maj_have])
156179d5fcd7Smrgm4_undefine([maj_needed])
156279d5fcd7Smrg]) # XORG_MACROS_VERSION
156379d5fcd7Smrg
156479d5fcd7Smrg# XORG_PROG_RAWCPP()
156579d5fcd7Smrg# ------------------
156679d5fcd7Smrg# Minimum version: 1.0.0
1567f29dbc25Smrg#
156879d5fcd7Smrg# Find cpp program and necessary flags for use in pre-processing text files
156979d5fcd7Smrg# such as man pages and config files
157079d5fcd7SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
157179d5fcd7SmrgAC_REQUIRE([AC_PROG_CPP])
157279d5fcd7SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
157379d5fcd7Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
157479d5fcd7Smrg
157579d5fcd7Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
157679d5fcd7Smrg# which is not the best choice for supporting other OS'es, but covers most
157779d5fcd7Smrg# of the ones we need for now.
157879d5fcd7SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
157979d5fcd7SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
158079d5fcd7Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
158179d5fcd7Smrg	AC_MSG_RESULT([no])
158279d5fcd7Smrgelse
158379d5fcd7Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
158479d5fcd7Smrg		RAWCPPFLAGS=-undef
158579d5fcd7Smrg		AC_MSG_RESULT([yes])
158679d5fcd7Smrg	# under Cygwin unix is still defined even with -undef
158779d5fcd7Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
158879d5fcd7Smrg		RAWCPPFLAGS="-undef -ansi"
158979d5fcd7Smrg		AC_MSG_RESULT([yes, with -ansi])
159079d5fcd7Smrg	else
159179d5fcd7Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
159279d5fcd7Smrg	fi
159379d5fcd7Smrgfi
159479d5fcd7Smrgrm -f conftest.$ac_ext
159579d5fcd7Smrg
159679d5fcd7SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
159779d5fcd7SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
159879d5fcd7Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
159979d5fcd7Smrg	AC_MSG_RESULT([no])
160079d5fcd7Smrgelse
160179d5fcd7Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
160279d5fcd7Smrg		TRADITIONALCPPFLAGS="-traditional"
160379d5fcd7Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
160479d5fcd7Smrg		AC_MSG_RESULT([yes])
160579d5fcd7Smrg	else
160679d5fcd7Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
160779d5fcd7Smrg	fi
160879d5fcd7Smrgfi
160979d5fcd7Smrgrm -f conftest.$ac_ext
161079d5fcd7SmrgAC_SUBST(RAWCPPFLAGS)
161179d5fcd7SmrgAC_SUBST(TRADITIONALCPPFLAGS)
161279d5fcd7Smrg]) # XORG_PROG_RAWCPP
161379d5fcd7Smrg
161479d5fcd7Smrg# XORG_MANPAGE_SECTIONS()
161579d5fcd7Smrg# -----------------------
161679d5fcd7Smrg# Minimum version: 1.0.0
161779d5fcd7Smrg#
161879d5fcd7Smrg# Determine which sections man pages go in for the different man page types
161979d5fcd7Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
162079d5fcd7Smrg# Not sure if there's any better way than just hardcoding by OS name.
162179d5fcd7Smrg# Override default settings by setting environment variables
162279d5fcd7Smrg# Added MAN_SUBSTS in version 1.8
162379d5fcd7Smrg# Added AC_PROG_SED in version 1.8
1624f29dbc25Smrg
162579d5fcd7SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
162679d5fcd7SmrgAC_REQUIRE([AC_CANONICAL_HOST])
162779d5fcd7SmrgAC_REQUIRE([AC_PROG_SED])
1628170d5fdcSmrg
1629170d5fdcSmrgcase $host_os in
163079d5fcd7Smrg    solaris*)
163179d5fcd7Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
163279d5fcd7Smrg        # check for a man page file found in later versions that use
163379d5fcd7Smrg        # traditional section numbers instead
163479d5fcd7Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
163579d5fcd7Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
163679d5fcd7Smrg        ;;
163779d5fcd7Smrg    *) SYSV_MAN_SECTIONS=false ;;
1638170d5fdcSmrgesac
1639170d5fdcSmrg
164079d5fcd7Smrgif test x$APP_MAN_SUFFIX = x    ; then
164179d5fcd7Smrg    APP_MAN_SUFFIX=1
1642f29dbc25Smrgfi
164379d5fcd7Smrgif test x$APP_MAN_DIR = x    ; then
164479d5fcd7Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1645f29dbc25Smrgfi
1646f29dbc25Smrg
164779d5fcd7Smrgif test x$LIB_MAN_SUFFIX = x    ; then
164879d5fcd7Smrg    LIB_MAN_SUFFIX=3
164979d5fcd7Smrgfi
165079d5fcd7Smrgif test x$LIB_MAN_DIR = x    ; then
165179d5fcd7Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
165279d5fcd7Smrgfi
1653f29dbc25Smrg
165479d5fcd7Smrgif test x$FILE_MAN_SUFFIX = x    ; then
165579d5fcd7Smrg    case $SYSV_MAN_SECTIONS in
165679d5fcd7Smrg	true)				FILE_MAN_SUFFIX=4  ;;
165779d5fcd7Smrg	*)				FILE_MAN_SUFFIX=5  ;;
165879d5fcd7Smrg    esac
165979d5fcd7Smrgfi
166079d5fcd7Smrgif test x$FILE_MAN_DIR = x    ; then
166179d5fcd7Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
166279d5fcd7Smrgfi
1663170d5fdcSmrg
166479d5fcd7Smrgif test x$MISC_MAN_SUFFIX = x    ; then
166579d5fcd7Smrg    case $SYSV_MAN_SECTIONS in
166679d5fcd7Smrg	true)				MISC_MAN_SUFFIX=5  ;;
166779d5fcd7Smrg	*)				MISC_MAN_SUFFIX=7  ;;
166879d5fcd7Smrg    esac
166979d5fcd7Smrgfi
167079d5fcd7Smrgif test x$MISC_MAN_DIR = x    ; then
167179d5fcd7Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1672f29dbc25Smrgfi
1673170d5fdcSmrg
167479d5fcd7Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
167579d5fcd7Smrg    case $SYSV_MAN_SECTIONS in
167679d5fcd7Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
167779d5fcd7Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
167879d5fcd7Smrg    esac
167979d5fcd7Smrgfi
168079d5fcd7Smrgif test x$DRIVER_MAN_DIR = x    ; then
168179d5fcd7Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
168279d5fcd7Smrgfi
1683f29dbc25Smrg
168479d5fcd7Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
168579d5fcd7Smrg    case $SYSV_MAN_SECTIONS in
168679d5fcd7Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
168779d5fcd7Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
168879d5fcd7Smrg    esac
168979d5fcd7Smrgfi
169079d5fcd7Smrgif test x$ADMIN_MAN_DIR = x    ; then
169179d5fcd7Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
169279d5fcd7Smrgfi
1693f29dbc25Smrg
169404007ebaSmrg
169579d5fcd7SmrgAC_SUBST([APP_MAN_SUFFIX])
169679d5fcd7SmrgAC_SUBST([LIB_MAN_SUFFIX])
169779d5fcd7SmrgAC_SUBST([FILE_MAN_SUFFIX])
169879d5fcd7SmrgAC_SUBST([MISC_MAN_SUFFIX])
169979d5fcd7SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
170079d5fcd7SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
170179d5fcd7SmrgAC_SUBST([APP_MAN_DIR])
170279d5fcd7SmrgAC_SUBST([LIB_MAN_DIR])
170379d5fcd7SmrgAC_SUBST([FILE_MAN_DIR])
170479d5fcd7SmrgAC_SUBST([MISC_MAN_DIR])
170579d5fcd7SmrgAC_SUBST([DRIVER_MAN_DIR])
170679d5fcd7SmrgAC_SUBST([ADMIN_MAN_DIR])
170704007ebaSmrg
170879d5fcd7SmrgXORG_MAN_PAGE="X Version 11"
170979d5fcd7SmrgAC_SUBST([XORG_MAN_PAGE])
171079d5fcd7SmrgMAN_SUBSTS="\
171179d5fcd7Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
171279d5fcd7Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
171379d5fcd7Smrg	-e 's|__xservername__|Xorg|g' \
171479d5fcd7Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
171579d5fcd7Smrg	-e 's|__projectroot__|\$(prefix)|g' \
171679d5fcd7Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
171779d5fcd7Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
171879d5fcd7Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
171979d5fcd7Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
172079d5fcd7Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
172179d5fcd7Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
172279d5fcd7Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
172379d5fcd7SmrgAC_SUBST([MAN_SUBSTS])
172404007ebaSmrg
172579d5fcd7Smrg]) # XORG_MANPAGE_SECTIONS
172604007ebaSmrg
172779d5fcd7Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
172879d5fcd7Smrg# ------------------------
172979d5fcd7Smrg# Minimum version: 1.7.0
173079d5fcd7Smrg#
173179d5fcd7Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
173279d5fcd7Smrg# provided by xorg-sgml-doctools, if installed.
173379d5fcd7SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
173479d5fcd7SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
173579d5fcd7SmrgXORG_SGML_PATH=
173679d5fcd7SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
173779d5fcd7Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
173879d5fcd7Smrg    [m4_ifval([$1],[:],
173979d5fcd7Smrg        [if test x"$cross_compiling" != x"yes" ; then
174079d5fcd7Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
174179d5fcd7Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
174279d5fcd7Smrg         fi])
174379d5fcd7Smrg    ])
174404007ebaSmrg
174579d5fcd7Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
174679d5fcd7Smrg# the path and the name of the doc stylesheet
174779d5fcd7Smrgif test "x$XORG_SGML_PATH" != "x" ; then
174879d5fcd7Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
174979d5fcd7Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
175079d5fcd7Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
175179d5fcd7Smrgelse
175279d5fcd7Smrg   AC_MSG_RESULT([no])
175304007ebaSmrgfi
175404007ebaSmrg
175579d5fcd7SmrgAC_SUBST(XORG_SGML_PATH)
175679d5fcd7SmrgAC_SUBST(STYLESHEET_SRCDIR)
175779d5fcd7SmrgAC_SUBST(XSL_STYLESHEET)
175879d5fcd7SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
175979d5fcd7Smrg]) # XORG_CHECK_SGML_DOCTOOLS
176079d5fcd7Smrg
176179d5fcd7Smrg# XORG_CHECK_LINUXDOC
176279d5fcd7Smrg# -------------------
176379d5fcd7Smrg# Minimum version: 1.0.0
176479d5fcd7Smrg#
176579d5fcd7Smrg# Defines the variable MAKE_TEXT if the necessary tools and
176679d5fcd7Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
176779d5fcd7Smrg# Whether or not the necessary tools and files are found can be checked
176879d5fcd7Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
176979d5fcd7SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
177079d5fcd7SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
177179d5fcd7SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
177279d5fcd7Smrg
177379d5fcd7SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
177479d5fcd7Smrg
177579d5fcd7SmrgAC_MSG_CHECKING([whether to build documentation])
177679d5fcd7Smrg
177779d5fcd7Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
177879d5fcd7Smrg   BUILDDOC=yes
177979d5fcd7Smrgelse
178079d5fcd7Smrg   BUILDDOC=no
178104007ebaSmrgfi
178204007ebaSmrg
178379d5fcd7SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
178404007ebaSmrg
178579d5fcd7SmrgAC_MSG_RESULT([$BUILDDOC])
178604007ebaSmrg
178779d5fcd7SmrgAC_MSG_CHECKING([whether to build pdf documentation])
178804007ebaSmrg
178979d5fcd7Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
179079d5fcd7Smrg   BUILDPDFDOC=yes
179179d5fcd7Smrgelse
179279d5fcd7Smrg   BUILDPDFDOC=no
179379d5fcd7Smrgfi
179404007ebaSmrg
179579d5fcd7SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
179604007ebaSmrg
179779d5fcd7SmrgAC_MSG_RESULT([$BUILDPDFDOC])
179804007ebaSmrg
179979d5fcd7SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
180079d5fcd7SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
180179d5fcd7SmrgMAKE_PDF="$PS2PDF"
180279d5fcd7SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
180379d5fcd7Smrg
180479d5fcd7SmrgAC_SUBST(MAKE_TEXT)
180579d5fcd7SmrgAC_SUBST(MAKE_PS)
180679d5fcd7SmrgAC_SUBST(MAKE_PDF)
180779d5fcd7SmrgAC_SUBST(MAKE_HTML)
180879d5fcd7Smrg]) # XORG_CHECK_LINUXDOC
180979d5fcd7Smrg
181079d5fcd7Smrg# XORG_CHECK_DOCBOOK
181179d5fcd7Smrg# -------------------
181279d5fcd7Smrg# Minimum version: 1.0.0
181304007ebaSmrg#
181479d5fcd7Smrg# Checks for the ability to build output formats from SGML DocBook source.
181579d5fcd7Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
181679d5fcd7Smrg# indicates whether the necessary tools and files are found and, if set,
181779d5fcd7Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
181879d5fcd7SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
181979d5fcd7SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
182004007ebaSmrg
182179d5fcd7SmrgBUILDTXTDOC=no
182279d5fcd7SmrgBUILDPDFDOC=no
182379d5fcd7SmrgBUILDPSDOC=no
182479d5fcd7SmrgBUILDHTMLDOC=no
182504007ebaSmrg
182679d5fcd7SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
182779d5fcd7SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
182879d5fcd7SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
182979d5fcd7SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
183079d5fcd7Smrg
183179d5fcd7SmrgAC_MSG_CHECKING([whether to build text documentation])
183279d5fcd7Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
183379d5fcd7Smrg   test x$BUILD_TXTDOC != xno; then
183479d5fcd7Smrg	BUILDTXTDOC=yes
183504007ebaSmrgfi
183679d5fcd7SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
183779d5fcd7SmrgAC_MSG_RESULT([$BUILDTXTDOC])
183804007ebaSmrg
183979d5fcd7SmrgAC_MSG_CHECKING([whether to build PDF documentation])
184079d5fcd7Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
184179d5fcd7Smrg   test x$BUILD_PDFDOC != xno; then
184279d5fcd7Smrg	BUILDPDFDOC=yes
184379d5fcd7Smrgfi
184479d5fcd7SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
184579d5fcd7SmrgAC_MSG_RESULT([$BUILDPDFDOC])
184604007ebaSmrg
184779d5fcd7SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
184879d5fcd7Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
184979d5fcd7Smrg   test x$BUILD_PSDOC != xno; then
185079d5fcd7Smrg	BUILDPSDOC=yes
185179d5fcd7Smrgfi
185279d5fcd7SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
185379d5fcd7SmrgAC_MSG_RESULT([$BUILDPSDOC])
185404007ebaSmrg
185579d5fcd7SmrgAC_MSG_CHECKING([whether to build HTML documentation])
185679d5fcd7Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
185779d5fcd7Smrg   test x$BUILD_HTMLDOC != xno; then
185879d5fcd7Smrg	BUILDHTMLDOC=yes
185979d5fcd7Smrgfi
186079d5fcd7SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
186179d5fcd7SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
186204007ebaSmrg
186379d5fcd7SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
186479d5fcd7SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
186579d5fcd7SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
186679d5fcd7SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
186704007ebaSmrg
186879d5fcd7SmrgAC_SUBST(MAKE_TEXT)
186979d5fcd7SmrgAC_SUBST(MAKE_PS)
187079d5fcd7SmrgAC_SUBST(MAKE_PDF)
187179d5fcd7SmrgAC_SUBST(MAKE_HTML)
187279d5fcd7Smrg]) # XORG_CHECK_DOCBOOK
187304007ebaSmrg
187479d5fcd7Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
187579d5fcd7Smrg# ----------------
187679d5fcd7Smrg# Minimum version: 1.5.0
187779d5fcd7Smrg# Minimum version for optional DEFAULT argument: 1.11.0
187879d5fcd7Smrg#
187979d5fcd7Smrg# Documentation tools are not always available on all platforms and sometimes
188079d5fcd7Smrg# not at the appropriate level. This macro enables a module to test for the
188179d5fcd7Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
188279d5fcd7Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
188379d5fcd7Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
188479d5fcd7Smrg# --with-xmlto assumes 'auto'.
188579d5fcd7Smrg#
188679d5fcd7Smrg# Interface to module:
188779d5fcd7Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
188879d5fcd7Smrg# XMLTO:	returns the path of the xmlto program found
188979d5fcd7Smrg#		returns the path set by the user in the environment
189079d5fcd7Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
189179d5fcd7Smrg#		'no' user instructs the module not to use xmlto
189279d5fcd7Smrg#
189379d5fcd7Smrg# Added in version 1.10.0
189479d5fcd7Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
189579d5fcd7Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
189679d5fcd7Smrg#
189779d5fcd7Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
189879d5fcd7Smrg#
189979d5fcd7SmrgAC_DEFUN([XORG_WITH_XMLTO],[
190079d5fcd7SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
190179d5fcd7Smrgm4_define([_defopt], m4_default([$2], [auto]))
190279d5fcd7SmrgAC_ARG_WITH(xmlto,
190379d5fcd7Smrg	AS_HELP_STRING([--with-xmlto],
190479d5fcd7Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
190579d5fcd7Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
190679d5fcd7Smrgm4_undefine([_defopt])
190779d5fcd7Smrg
190879d5fcd7Smrgif test "x$use_xmlto" = x"auto"; then
190979d5fcd7Smrg   AC_PATH_PROG([XMLTO], [xmlto])
191079d5fcd7Smrg   if test "x$XMLTO" = "x"; then
191179d5fcd7Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
191279d5fcd7Smrg	have_xmlto=no
191379d5fcd7Smrg   else
191479d5fcd7Smrg        have_xmlto=yes
191579d5fcd7Smrg   fi
191679d5fcd7Smrgelif test "x$use_xmlto" = x"yes" ; then
191779d5fcd7Smrg   AC_PATH_PROG([XMLTO], [xmlto])
191879d5fcd7Smrg   if test "x$XMLTO" = "x"; then
191979d5fcd7Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
192079d5fcd7Smrg   fi
192179d5fcd7Smrg   have_xmlto=yes
192279d5fcd7Smrgelif test "x$use_xmlto" = x"no" ; then
192379d5fcd7Smrg   if test "x$XMLTO" != "x"; then
192479d5fcd7Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
192579d5fcd7Smrg   fi
192679d5fcd7Smrg   have_xmlto=no
192704007ebaSmrgelse
192879d5fcd7Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
192904007ebaSmrgfi
193004007ebaSmrg
193179d5fcd7Smrg# Test for a minimum version of xmlto, if provided.
193279d5fcd7Smrgm4_ifval([$1],
193379d5fcd7Smrg[if test "$have_xmlto" = yes; then
193479d5fcd7Smrg    # scrape the xmlto version
193579d5fcd7Smrg    AC_MSG_CHECKING([the xmlto version])
193679d5fcd7Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
193779d5fcd7Smrg    AC_MSG_RESULT([$xmlto_version])
193879d5fcd7Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
193979d5fcd7Smrg        [if test "x$use_xmlto" = xauto; then
194079d5fcd7Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
194179d5fcd7Smrg            have_xmlto=no
194279d5fcd7Smrg        else
194379d5fcd7Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
194479d5fcd7Smrg        fi])
194579d5fcd7Smrgfi])
194679d5fcd7Smrg
194779d5fcd7Smrg# Test for the ability of xmlto to generate a text target
1948f29dbc25Smrg#
194979d5fcd7Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
195079d5fcd7Smrg# following test for empty XML docbook files.
195179d5fcd7Smrg# For compatibility reasons use the following empty XML docbook file and if
195279d5fcd7Smrg# it fails try it again with a non-empty XML file.
195379d5fcd7Smrghave_xmlto_text=no
195479d5fcd7Smrgcat > conftest.xml << "EOF"
195579d5fcd7SmrgEOF
195679d5fcd7SmrgAS_IF([test "$have_xmlto" = yes],
195779d5fcd7Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
195879d5fcd7Smrg             [have_xmlto_text=yes],
195979d5fcd7Smrg             [# Try it again with a non-empty XML file.
196079d5fcd7Smrg              cat > conftest.xml << "EOF"
196179d5fcd7Smrg<x></x>
196279d5fcd7SmrgEOF
196379d5fcd7Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
196479d5fcd7Smrg                    [have_xmlto_text=yes],
196579d5fcd7Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
196679d5fcd7Smrgrm -f conftest.xml
196779d5fcd7SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
196879d5fcd7SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
196979d5fcd7Smrg]) # XORG_WITH_XMLTO
197079d5fcd7Smrg
197179d5fcd7Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
197279d5fcd7Smrg# --------------------------------------------
197379d5fcd7Smrg# Minimum version: 1.12.0
197479d5fcd7Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1975f29dbc25Smrg#
197679d5fcd7Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
197779d5fcd7Smrg# XML-based language used for the transformation of XML documents.
197879d5fcd7Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
197979d5fcd7Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
198079d5fcd7Smrg# The XSLT processor is often used as a standalone tool for transformations.
198179d5fcd7Smrg# It should not be assumed that this tool is used only to work with documnetation.
198279d5fcd7Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
198304007ebaSmrg#
198479d5fcd7Smrg# Interface to module:
198579d5fcd7Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
198679d5fcd7Smrg# XSLTPROC:	 returns the path of the xsltproc program found
198779d5fcd7Smrg#		 returns the path set by the user in the environment
198879d5fcd7Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
198979d5fcd7Smrg#		  'no' user instructs the module not to use xsltproc
199079d5fcd7Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1991f29dbc25Smrg#
199279d5fcd7Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
199304007ebaSmrg#
199479d5fcd7SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
199579d5fcd7SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
199679d5fcd7Smrg# Preserves the interface, should it be implemented later
199779d5fcd7Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
199879d5fcd7Smrgm4_define([_defopt], m4_default([$2], [auto]))
199979d5fcd7SmrgAC_ARG_WITH(xsltproc,
200079d5fcd7Smrg	AS_HELP_STRING([--with-xsltproc],
200179d5fcd7Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
200279d5fcd7Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
200379d5fcd7Smrgm4_undefine([_defopt])
200404007ebaSmrg
200579d5fcd7Smrgif test "x$use_xsltproc" = x"auto"; then
200679d5fcd7Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
200779d5fcd7Smrg   if test "x$XSLTPROC" = "x"; then
200879d5fcd7Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
200979d5fcd7Smrg	have_xsltproc=no
201079d5fcd7Smrg   else
201179d5fcd7Smrg        have_xsltproc=yes
201279d5fcd7Smrg   fi
201379d5fcd7Smrgelif test "x$use_xsltproc" = x"yes" ; then
201479d5fcd7Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
201579d5fcd7Smrg   if test "x$XSLTPROC" = "x"; then
201679d5fcd7Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
201779d5fcd7Smrg   fi
201879d5fcd7Smrg   have_xsltproc=yes
201979d5fcd7Smrgelif test "x$use_xsltproc" = x"no" ; then
202079d5fcd7Smrg   if test "x$XSLTPROC" != "x"; then
202179d5fcd7Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
202279d5fcd7Smrg   fi
202379d5fcd7Smrg   have_xsltproc=no
202479d5fcd7Smrgelse
202579d5fcd7Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
2026f29dbc25Smrgfi
2027f29dbc25Smrg
202879d5fcd7SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
202979d5fcd7Smrg]) # XORG_WITH_XSLTPROC
203079d5fcd7Smrg
203179d5fcd7Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
203279d5fcd7Smrg# ----------------------------------------
203379d5fcd7Smrg# Minimum version: 1.15.0
2034f29dbc25Smrg#
203579d5fcd7Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
203679d5fcd7Smrg# scanning arbitrary text files, extracting information from those text files,
203779d5fcd7Smrg# and printing reports based on that information.
2038f29dbc25Smrg#
203979d5fcd7Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
2040f29dbc25Smrg#
204179d5fcd7Smrg# Interface to module:
204279d5fcd7Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
204379d5fcd7Smrg# PERL:	     returns the path of the perl program found
204479d5fcd7Smrg#	     returns the path set by the user in the environment
204579d5fcd7Smrg# --with-perl: 'yes' user instructs the module to use perl
204679d5fcd7Smrg#	       'no' user instructs the module not to use perl
204779d5fcd7Smrg# have_perl: returns yes if perl found in PATH or no
2048f29dbc25Smrg#
204979d5fcd7Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
205079d5fcd7Smrg#
205179d5fcd7SmrgAC_DEFUN([XORG_WITH_PERL],[
205279d5fcd7SmrgAC_ARG_VAR([PERL], [Path to perl command])
205379d5fcd7Smrg# Preserves the interface, should it be implemented later
205479d5fcd7Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
205579d5fcd7Smrgm4_define([_defopt], m4_default([$2], [auto]))
205679d5fcd7SmrgAC_ARG_WITH(perl,
205779d5fcd7Smrg	AS_HELP_STRING([--with-perl],
205879d5fcd7Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
205979d5fcd7Smrg	   [use_perl=$withval], [use_perl=]_defopt)
206079d5fcd7Smrgm4_undefine([_defopt])
2061f29dbc25Smrg
206279d5fcd7Smrgif test "x$use_perl" = x"auto"; then
206379d5fcd7Smrg   AC_PATH_PROG([PERL], [perl])
206479d5fcd7Smrg   if test "x$PERL" = "x"; then
206579d5fcd7Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
206679d5fcd7Smrg	have_perl=no
206779d5fcd7Smrg   else
206879d5fcd7Smrg        have_perl=yes
206979d5fcd7Smrg   fi
207079d5fcd7Smrgelif test "x$use_perl" = x"yes" ; then
207179d5fcd7Smrg   AC_PATH_PROG([PERL], [perl])
207279d5fcd7Smrg   if test "x$PERL" = "x"; then
207379d5fcd7Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
207479d5fcd7Smrg   fi
207579d5fcd7Smrg   have_perl=yes
207679d5fcd7Smrgelif test "x$use_perl" = x"no" ; then
207779d5fcd7Smrg   if test "x$PERL" != "x"; then
207879d5fcd7Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
207979d5fcd7Smrg   fi
208079d5fcd7Smrg   have_perl=no
208179d5fcd7Smrgelse
208279d5fcd7Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
208379d5fcd7Smrgfi
208404007ebaSmrg
208579d5fcd7SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
208679d5fcd7Smrg]) # XORG_WITH_PERL
2087f29dbc25Smrg
208879d5fcd7Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2089f29dbc25Smrg# ----------------
209079d5fcd7Smrg# Minimum version: 1.5.0
209179d5fcd7Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2092f29dbc25Smrg#
209379d5fcd7Smrg# Documentation tools are not always available on all platforms and sometimes
209479d5fcd7Smrg# not at the appropriate level. This macro enables a module to test for the
209579d5fcd7Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
209679d5fcd7Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
209779d5fcd7Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
209879d5fcd7Smrg# --with-asciidoc assumes 'auto'.
2099f29dbc25Smrg#
210079d5fcd7Smrg# Interface to module:
210179d5fcd7Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
210279d5fcd7Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
210379d5fcd7Smrg#		 returns the path set by the user in the environment
210479d5fcd7Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
210579d5fcd7Smrg#		  'no' user instructs the module not to use asciidoc
2106f29dbc25Smrg#
210779d5fcd7Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2108f29dbc25Smrg#
210979d5fcd7SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
211079d5fcd7SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
211179d5fcd7Smrgm4_define([_defopt], m4_default([$2], [auto]))
211279d5fcd7SmrgAC_ARG_WITH(asciidoc,
211379d5fcd7Smrg	AS_HELP_STRING([--with-asciidoc],
211479d5fcd7Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
211579d5fcd7Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
211679d5fcd7Smrgm4_undefine([_defopt])
2117f29dbc25Smrg
211879d5fcd7Smrgif test "x$use_asciidoc" = x"auto"; then
211979d5fcd7Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
212079d5fcd7Smrg   if test "x$ASCIIDOC" = "x"; then
212179d5fcd7Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
212279d5fcd7Smrg	have_asciidoc=no
212379d5fcd7Smrg   else
212479d5fcd7Smrg        have_asciidoc=yes
212579d5fcd7Smrg   fi
212679d5fcd7Smrgelif test "x$use_asciidoc" = x"yes" ; then
212779d5fcd7Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
212879d5fcd7Smrg   if test "x$ASCIIDOC" = "x"; then
212979d5fcd7Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
213079d5fcd7Smrg   fi
213179d5fcd7Smrg   have_asciidoc=yes
213279d5fcd7Smrgelif test "x$use_asciidoc" = x"no" ; then
213379d5fcd7Smrg   if test "x$ASCIIDOC" != "x"; then
213479d5fcd7Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
213579d5fcd7Smrg   fi
213679d5fcd7Smrg   have_asciidoc=no
213779d5fcd7Smrgelse
213879d5fcd7Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
213979d5fcd7Smrgfi
214079d5fcd7Smrgm4_ifval([$1],
214179d5fcd7Smrg[if test "$have_asciidoc" = yes; then
214279d5fcd7Smrg    # scrape the asciidoc version
214379d5fcd7Smrg    AC_MSG_CHECKING([the asciidoc version])
214479d5fcd7Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
214579d5fcd7Smrg    AC_MSG_RESULT([$asciidoc_version])
214679d5fcd7Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
214779d5fcd7Smrg        [if test "x$use_asciidoc" = xauto; then
214879d5fcd7Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
214979d5fcd7Smrg            have_asciidoc=no
215079d5fcd7Smrg        else
215179d5fcd7Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
215279d5fcd7Smrg        fi])
215379d5fcd7Smrgfi])
215479d5fcd7SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
215579d5fcd7Smrg]) # XORG_WITH_ASCIIDOC
2156f29dbc25Smrg
215779d5fcd7Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
215879d5fcd7Smrg# -------------------------------------------
215979d5fcd7Smrg# Minimum version: 1.5.0
216079d5fcd7Smrg# Minimum version for optional DEFAULT argument: 1.11.0
216179d5fcd7Smrg# Minimum version for optional DOT checking: 1.18.0
216279d5fcd7Smrg#
216379d5fcd7Smrg# Documentation tools are not always available on all platforms and sometimes
216479d5fcd7Smrg# not at the appropriate level. This macro enables a module to test for the
216579d5fcd7Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
216679d5fcd7Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
216779d5fcd7Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
216879d5fcd7Smrg# --with-doxygen assumes 'auto'.
216979d5fcd7Smrg#
217079d5fcd7Smrg# Interface to module:
217179d5fcd7Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
217279d5fcd7Smrg# DOXYGEN:	 returns the path of the doxygen program found
217379d5fcd7Smrg#		 returns the path set by the user in the environment
217479d5fcd7Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
217579d5fcd7Smrg#		  'no' user instructs the module not to use doxygen
217679d5fcd7Smrg#
217779d5fcd7Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
217879d5fcd7Smrg#
217979d5fcd7SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
218079d5fcd7SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
218179d5fcd7SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
218279d5fcd7Smrgm4_define([_defopt], m4_default([$2], [auto]))
218379d5fcd7SmrgAC_ARG_WITH(doxygen,
218479d5fcd7Smrg	AS_HELP_STRING([--with-doxygen],
218579d5fcd7Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
218679d5fcd7Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
218779d5fcd7Smrgm4_undefine([_defopt])
2188f29dbc25Smrg
218979d5fcd7Smrgif test "x$use_doxygen" = x"auto"; then
219079d5fcd7Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
219179d5fcd7Smrg   if test "x$DOXYGEN" = "x"; then
219279d5fcd7Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
219379d5fcd7Smrg	have_doxygen=no
219479d5fcd7Smrg   else
219579d5fcd7Smrg        have_doxygen=yes
219679d5fcd7Smrg   fi
219779d5fcd7Smrgelif test "x$use_doxygen" = x"yes" ; then
219879d5fcd7Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
219979d5fcd7Smrg   if test "x$DOXYGEN" = "x"; then
220079d5fcd7Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
220179d5fcd7Smrg   fi
220279d5fcd7Smrg   have_doxygen=yes
220379d5fcd7Smrgelif test "x$use_doxygen" = x"no" ; then
220479d5fcd7Smrg   if test "x$DOXYGEN" != "x"; then
220579d5fcd7Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
220679d5fcd7Smrg   fi
220779d5fcd7Smrg   have_doxygen=no
220879d5fcd7Smrgelse
220979d5fcd7Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
221079d5fcd7Smrgfi
221179d5fcd7Smrgm4_ifval([$1],
221279d5fcd7Smrg[if test "$have_doxygen" = yes; then
221379d5fcd7Smrg    # scrape the doxygen version
221479d5fcd7Smrg    AC_MSG_CHECKING([the doxygen version])
221579d5fcd7Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
221679d5fcd7Smrg    AC_MSG_RESULT([$doxygen_version])
221779d5fcd7Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
221879d5fcd7Smrg        [if test "x$use_doxygen" = xauto; then
221979d5fcd7Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
222079d5fcd7Smrg            have_doxygen=no
222179d5fcd7Smrg        else
222279d5fcd7Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
222379d5fcd7Smrg        fi])
222479d5fcd7Smrgfi])
2225f29dbc25Smrg
222679d5fcd7Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
222779d5fcd7Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
222879d5fcd7Smrgdnl 	HAVE_DOT = @HAVE_DOT@
222979d5fcd7SmrgHAVE_DOT=no
223079d5fcd7Smrgif test "x$have_doxygen" = "xyes"; then
223179d5fcd7Smrg  AC_PATH_PROG([DOT], [dot])
223279d5fcd7Smrg    if test "x$DOT" != "x"; then
223379d5fcd7Smrg      HAVE_DOT=yes
223479d5fcd7Smrg    fi
223579d5fcd7Smrgfi
2236f29dbc25Smrg
223779d5fcd7SmrgAC_SUBST([HAVE_DOT])
223879d5fcd7SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
223979d5fcd7SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
224079d5fcd7Smrg]) # XORG_WITH_DOXYGEN
2241f29dbc25Smrg
224279d5fcd7Smrg# XORG_WITH_GROFF([DEFAULT])
224379d5fcd7Smrg# ----------------
224479d5fcd7Smrg# Minimum version: 1.6.0
224579d5fcd7Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2246f29dbc25Smrg#
224779d5fcd7Smrg# Documentation tools are not always available on all platforms and sometimes
224879d5fcd7Smrg# not at the appropriate level. This macro enables a module to test for the
224979d5fcd7Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
225079d5fcd7Smrg# the --with-groff option, it allows maximum flexibility in making decisions
225179d5fcd7Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
225279d5fcd7Smrg# --with-groff assumes 'auto'.
2253f29dbc25Smrg#
225479d5fcd7Smrg# Interface to module:
225579d5fcd7Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
225679d5fcd7Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
225779d5fcd7Smrg# HAVE_GROFF_MS: the -ms macros package
225879d5fcd7Smrg# GROFF:	 returns the path of the groff program found
225979d5fcd7Smrg#		 returns the path set by the user in the environment
226079d5fcd7Smrg# --with-groff:	 'yes' user instructs the module to use groff
226179d5fcd7Smrg#		 'no' user instructs the module not to use groff
2262f29dbc25Smrg#
226379d5fcd7Smrg# Added in version 1.9.0:
226479d5fcd7Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
226579d5fcd7Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
226679d5fcd7Smrg#		   psselect from the psutils package.
226779d5fcd7Smrg#		   the ghostcript package. Refer to the grohtml man pages
2268f29dbc25Smrg#
226979d5fcd7Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2270f29dbc25Smrg#
227179d5fcd7Smrg# OS and distros often splits groff in a basic and full package, the former
227279d5fcd7Smrg# having the groff program and the later having devices, fonts and macros
227379d5fcd7Smrg# Checking for the groff executable is not enough.
2274f29dbc25Smrg#
227579d5fcd7Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
227679d5fcd7Smrg# unset HAVE_GROFF or GROFF env variables.
227779d5fcd7Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2278f29dbc25Smrg#
227979d5fcd7SmrgAC_DEFUN([XORG_WITH_GROFF],[
228079d5fcd7SmrgAC_ARG_VAR([GROFF], [Path to groff command])
228179d5fcd7Smrgm4_define([_defopt], m4_default([$1], [auto]))
228279d5fcd7SmrgAC_ARG_WITH(groff,
228379d5fcd7Smrg	AS_HELP_STRING([--with-groff],
228479d5fcd7Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
228579d5fcd7Smrg	   [use_groff=$withval], [use_groff=]_defopt)
228679d5fcd7Smrgm4_undefine([_defopt])
2287f29dbc25Smrg
228879d5fcd7Smrgif test "x$use_groff" = x"auto"; then
228979d5fcd7Smrg   AC_PATH_PROG([GROFF], [groff])
229079d5fcd7Smrg   if test "x$GROFF" = "x"; then
229179d5fcd7Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
229279d5fcd7Smrg	have_groff=no
229379d5fcd7Smrg   else
229479d5fcd7Smrg        have_groff=yes
229579d5fcd7Smrg   fi
229679d5fcd7Smrgelif test "x$use_groff" = x"yes" ; then
229779d5fcd7Smrg   AC_PATH_PROG([GROFF], [groff])
229879d5fcd7Smrg   if test "x$GROFF" = "x"; then
229979d5fcd7Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
230079d5fcd7Smrg   fi
230179d5fcd7Smrg   have_groff=yes
230279d5fcd7Smrgelif test "x$use_groff" = x"no" ; then
230379d5fcd7Smrg   if test "x$GROFF" != "x"; then
230479d5fcd7Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
230579d5fcd7Smrg   fi
230679d5fcd7Smrg   have_groff=no
2307f29dbc25Smrgelse
230879d5fcd7Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
230979d5fcd7Smrgfi
231079d5fcd7Smrg
231179d5fcd7Smrg# We have groff, test for the presence of the macro packages
231279d5fcd7Smrgif test "x$have_groff" = x"yes"; then
231379d5fcd7Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
231479d5fcd7Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
231579d5fcd7Smrg        groff_ms_works=yes
231679d5fcd7Smrg    else
231779d5fcd7Smrg        groff_ms_works=no
231879d5fcd7Smrg    fi
231979d5fcd7Smrg    AC_MSG_RESULT([$groff_ms_works])
232079d5fcd7Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
232179d5fcd7Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
232279d5fcd7Smrg        groff_mm_works=yes
232379d5fcd7Smrg    else
232479d5fcd7Smrg        groff_mm_works=no
232579d5fcd7Smrg    fi
232679d5fcd7Smrg    AC_MSG_RESULT([$groff_mm_works])
2327f29dbc25Smrgfi
2328f29dbc25Smrg
232979d5fcd7Smrg# We have groff, test for HTML dependencies, one command per package
233079d5fcd7Smrgif test "x$have_groff" = x"yes"; then
233179d5fcd7Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
233279d5fcd7Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
233379d5fcd7Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
233479d5fcd7Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
233579d5fcd7Smrg      have_groff_html=yes
233679d5fcd7Smrg   else
233779d5fcd7Smrg      have_groff_html=no
233879d5fcd7Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
233979d5fcd7Smrg   fi
234079d5fcd7Smrgfi
2341f29dbc25Smrg
234279d5fcd7Smrg# Set Automake conditionals for Makefiles
234379d5fcd7SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
234479d5fcd7SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
234579d5fcd7SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
234679d5fcd7SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
234779d5fcd7Smrg]) # XORG_WITH_GROFF
2348f29dbc25Smrg
234979d5fcd7Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
235079d5fcd7Smrg# ---------------------------------------
235179d5fcd7Smrg# Minimum version: 1.6.0
235279d5fcd7Smrg# Minimum version for optional DEFAULT argument: 1.11.0
235379d5fcd7Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
235479d5fcd7Smrg#
235579d5fcd7Smrg# Documentation tools are not always available on all platforms and sometimes
235679d5fcd7Smrg# not at the appropriate level. This macro enables a module to test for the
235779d5fcd7Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
235879d5fcd7Smrg# the --with-fop option, it allows maximum flexibility in making decisions
235979d5fcd7Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
236079d5fcd7Smrg# --with-fop assumes 'auto'.
236179d5fcd7Smrg#
236279d5fcd7Smrg# Interface to module:
236379d5fcd7Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
236479d5fcd7Smrg# FOP:	 	returns the path of the fop program found
236579d5fcd7Smrg#		returns the path set by the user in the environment
236679d5fcd7Smrg# --with-fop: 	'yes' user instructs the module to use fop
236779d5fcd7Smrg#		'no' user instructs the module not to use fop
236879d5fcd7Smrg#
236979d5fcd7Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
237079d5fcd7Smrg#
237179d5fcd7SmrgAC_DEFUN([XORG_WITH_FOP],[
237279d5fcd7SmrgAC_ARG_VAR([FOP], [Path to fop command])
237379d5fcd7Smrgm4_define([_defopt], m4_default([$2], [auto]))
237479d5fcd7SmrgAC_ARG_WITH(fop,
237579d5fcd7Smrg	AS_HELP_STRING([--with-fop],
237679d5fcd7Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
237779d5fcd7Smrg	   [use_fop=$withval], [use_fop=]_defopt)
237879d5fcd7Smrgm4_undefine([_defopt])
2379f29dbc25Smrg
238079d5fcd7Smrgif test "x$use_fop" = x"auto"; then
238179d5fcd7Smrg   AC_PATH_PROG([FOP], [fop])
238279d5fcd7Smrg   if test "x$FOP" = "x"; then
238379d5fcd7Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
238479d5fcd7Smrg	have_fop=no
238579d5fcd7Smrg   else
238679d5fcd7Smrg        have_fop=yes
238779d5fcd7Smrg   fi
238879d5fcd7Smrgelif test "x$use_fop" = x"yes" ; then
238979d5fcd7Smrg   AC_PATH_PROG([FOP], [fop])
239079d5fcd7Smrg   if test "x$FOP" = "x"; then
239179d5fcd7Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
239279d5fcd7Smrg   fi
239379d5fcd7Smrg   have_fop=yes
239479d5fcd7Smrgelif test "x$use_fop" = x"no" ; then
239579d5fcd7Smrg   if test "x$FOP" != "x"; then
239679d5fcd7Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
239779d5fcd7Smrg   fi
239879d5fcd7Smrg   have_fop=no
239979d5fcd7Smrgelse
240079d5fcd7Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2401f29dbc25Smrgfi
2402f29dbc25Smrg
240379d5fcd7Smrg# Test for a minimum version of fop, if provided.
240479d5fcd7Smrgm4_ifval([$1],
240579d5fcd7Smrg[if test "$have_fop" = yes; then
240679d5fcd7Smrg    # scrape the fop version
240779d5fcd7Smrg    AC_MSG_CHECKING([for fop minimum version])
240879d5fcd7Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
240979d5fcd7Smrg    AC_MSG_RESULT([$fop_version])
241079d5fcd7Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
241179d5fcd7Smrg        [if test "x$use_fop" = xauto; then
241279d5fcd7Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
241379d5fcd7Smrg            have_fop=no
241479d5fcd7Smrg        else
241579d5fcd7Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
241679d5fcd7Smrg        fi])
241779d5fcd7Smrgfi])
241879d5fcd7SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
241979d5fcd7Smrg]) # XORG_WITH_FOP
2420f29dbc25Smrg
242179d5fcd7Smrg# XORG_WITH_M4([MIN-VERSION])
242279d5fcd7Smrg# ---------------------------
242379d5fcd7Smrg# Minimum version: 1.19.0
2424f29dbc25Smrg#
242579d5fcd7Smrg# This macro attempts to locate an m4 macro processor which supports
242679d5fcd7Smrg# -I option and is only useful for modules relying on M4 in order to
242779d5fcd7Smrg# expand macros in source code files.
242879d5fcd7Smrg#
242979d5fcd7Smrg# Interface to module:
243079d5fcd7Smrg# M4:	 	returns the path of the m4 program found
243179d5fcd7Smrg#		returns the path set by the user in the environment
243279d5fcd7Smrg#
243379d5fcd7SmrgAC_DEFUN([XORG_WITH_M4], [
243479d5fcd7SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
243579d5fcd7Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
243679d5fcd7Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
243779d5fcd7Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
243879d5fcd7Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
243979d5fcd7Smrg   [$PATH:/usr/gnu/bin])])
2440f29dbc25Smrg
244179d5fcd7SmrgAC_SUBST([M4], [$ac_cv_path_M4])
244279d5fcd7Smrg]) # XORG_WITH_M4
244379d5fcd7Smrg
244479d5fcd7Smrg# XORG_WITH_PS2PDF([DEFAULT])
244579d5fcd7Smrg# ----------------
244679d5fcd7Smrg# Minimum version: 1.6.0
244779d5fcd7Smrg# Minimum version for optional DEFAULT argument: 1.11.0
244879d5fcd7Smrg#
244979d5fcd7Smrg# Documentation tools are not always available on all platforms and sometimes
245079d5fcd7Smrg# not at the appropriate level. This macro enables a module to test for the
245179d5fcd7Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
245279d5fcd7Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
245379d5fcd7Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
245479d5fcd7Smrg# --with-ps2pdf assumes 'auto'.
245579d5fcd7Smrg#
245679d5fcd7Smrg# Interface to module:
245779d5fcd7Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
245879d5fcd7Smrg# PS2PDF:	returns the path of the ps2pdf program found
245979d5fcd7Smrg#		returns the path set by the user in the environment
246079d5fcd7Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
246179d5fcd7Smrg#		 'no' user instructs the module not to use ps2pdf
246279d5fcd7Smrg#
246379d5fcd7Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
246479d5fcd7Smrg#
246579d5fcd7SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
246679d5fcd7SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
246779d5fcd7Smrgm4_define([_defopt], m4_default([$1], [auto]))
246879d5fcd7SmrgAC_ARG_WITH(ps2pdf,
246979d5fcd7Smrg	AS_HELP_STRING([--with-ps2pdf],
247079d5fcd7Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
247179d5fcd7Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
247279d5fcd7Smrgm4_undefine([_defopt])
247379d5fcd7Smrg
247479d5fcd7Smrgif test "x$use_ps2pdf" = x"auto"; then
247579d5fcd7Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
247679d5fcd7Smrg   if test "x$PS2PDF" = "x"; then
247779d5fcd7Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
247879d5fcd7Smrg	have_ps2pdf=no
247979d5fcd7Smrg   else
248079d5fcd7Smrg        have_ps2pdf=yes
248179d5fcd7Smrg   fi
248279d5fcd7Smrgelif test "x$use_ps2pdf" = x"yes" ; then
248379d5fcd7Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
248479d5fcd7Smrg   if test "x$PS2PDF" = "x"; then
248579d5fcd7Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
248679d5fcd7Smrg   fi
248779d5fcd7Smrg   have_ps2pdf=yes
248879d5fcd7Smrgelif test "x$use_ps2pdf" = x"no" ; then
248979d5fcd7Smrg   if test "x$PS2PDF" != "x"; then
249079d5fcd7Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
249179d5fcd7Smrg   fi
249279d5fcd7Smrg   have_ps2pdf=no
249379d5fcd7Smrgelse
249479d5fcd7Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
249579d5fcd7Smrgfi
249679d5fcd7SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
249779d5fcd7Smrg]) # XORG_WITH_PS2PDF
2498f29dbc25Smrg
249979d5fcd7Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
250079d5fcd7Smrg# ----------------
250179d5fcd7Smrg# Minimum version: 1.6.0
250279d5fcd7Smrg#
250379d5fcd7Smrg# Documentation tools are not always available on all platforms and sometimes
250479d5fcd7Smrg# not at the appropriate level. This macro enables a builder to skip all
250579d5fcd7Smrg# documentation targets except traditional man pages.
250679d5fcd7Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
250779d5fcd7Smrg# maximum flexibility in controlling documentation building.
250879d5fcd7Smrg# Refer to:
250979d5fcd7Smrg# XORG_WITH_XMLTO         --with-xmlto
251079d5fcd7Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
251179d5fcd7Smrg# XORG_WITH_DOXYGEN       --with-doxygen
251279d5fcd7Smrg# XORG_WITH_FOP           --with-fop
251379d5fcd7Smrg# XORG_WITH_GROFF         --with-groff
251479d5fcd7Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
251579d5fcd7Smrg#
251679d5fcd7Smrg# Interface to module:
251779d5fcd7Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
251879d5fcd7Smrg# --enable-docs: 'yes' user instructs the module to generate docs
251979d5fcd7Smrg#		 'no' user instructs the module not to generate docs
252079d5fcd7Smrg# parm1:	specify the default value, yes or no.
252179d5fcd7Smrg#
252279d5fcd7SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
252379d5fcd7Smrgm4_define([docs_default], m4_default([$1], [yes]))
252479d5fcd7SmrgAC_ARG_ENABLE(docs,
252579d5fcd7Smrg	AS_HELP_STRING([--enable-docs],
252679d5fcd7Smrg	   [Enable building the documentation (default: ]docs_default[)]),
252779d5fcd7Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
252879d5fcd7Smrgm4_undefine([docs_default])
252979d5fcd7SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
253079d5fcd7SmrgAC_MSG_CHECKING([whether to build documentation])
253179d5fcd7SmrgAC_MSG_RESULT([$build_docs])
253279d5fcd7Smrg]) # XORG_ENABLE_DOCS
2533f29dbc25Smrg
253479d5fcd7Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
253579d5fcd7Smrg# ----------------
253679d5fcd7Smrg# Minimum version: 1.6.0
2537f29dbc25Smrg#
253879d5fcd7Smrg# This macro enables a builder to skip all developer documentation.
253979d5fcd7Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
254079d5fcd7Smrg# maximum flexibility in controlling documentation building.
254179d5fcd7Smrg# Refer to:
254279d5fcd7Smrg# XORG_WITH_XMLTO         --with-xmlto
254379d5fcd7Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
254479d5fcd7Smrg# XORG_WITH_DOXYGEN       --with-doxygen
254579d5fcd7Smrg# XORG_WITH_FOP           --with-fop
254679d5fcd7Smrg# XORG_WITH_GROFF         --with-groff
254779d5fcd7Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
254879d5fcd7Smrg#
254979d5fcd7Smrg# Interface to module:
255079d5fcd7Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
255179d5fcd7Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
255279d5fcd7Smrg#			'no' user instructs the module not to generate developer docs
255379d5fcd7Smrg# parm1:		specify the default value, yes or no.
255479d5fcd7Smrg#
255579d5fcd7SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
255679d5fcd7Smrgm4_define([devel_default], m4_default([$1], [yes]))
255779d5fcd7SmrgAC_ARG_ENABLE(devel-docs,
255879d5fcd7Smrg	AS_HELP_STRING([--enable-devel-docs],
255979d5fcd7Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
256079d5fcd7Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
256179d5fcd7Smrgm4_undefine([devel_default])
256279d5fcd7SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
256379d5fcd7SmrgAC_MSG_CHECKING([whether to build developer documentation])
256479d5fcd7SmrgAC_MSG_RESULT([$build_devel_docs])
256579d5fcd7Smrg]) # XORG_ENABLE_DEVEL_DOCS
2566f29dbc25Smrg
256779d5fcd7Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
256879d5fcd7Smrg# ----------------
256979d5fcd7Smrg# Minimum version: 1.6.0
257079d5fcd7Smrg#
257179d5fcd7Smrg# This macro enables a builder to skip all functional specification targets.
257279d5fcd7Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
257379d5fcd7Smrg# maximum flexibility in controlling documentation building.
257479d5fcd7Smrg# Refer to:
257579d5fcd7Smrg# XORG_WITH_XMLTO         --with-xmlto
257679d5fcd7Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
257779d5fcd7Smrg# XORG_WITH_DOXYGEN       --with-doxygen
257879d5fcd7Smrg# XORG_WITH_FOP           --with-fop
257979d5fcd7Smrg# XORG_WITH_GROFF         --with-groff
258079d5fcd7Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
258179d5fcd7Smrg#
258279d5fcd7Smrg# Interface to module:
258379d5fcd7Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
258479d5fcd7Smrg# --enable-specs:	'yes' user instructs the module to generate specs
258579d5fcd7Smrg#			'no' user instructs the module not to generate specs
258679d5fcd7Smrg# parm1:		specify the default value, yes or no.
258779d5fcd7Smrg#
258879d5fcd7SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
258979d5fcd7Smrgm4_define([spec_default], m4_default([$1], [yes]))
259079d5fcd7SmrgAC_ARG_ENABLE(specs,
259179d5fcd7Smrg	AS_HELP_STRING([--enable-specs],
259279d5fcd7Smrg	   [Enable building the specs (default: ]spec_default[)]),
259379d5fcd7Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
259479d5fcd7Smrgm4_undefine([spec_default])
259579d5fcd7SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
259679d5fcd7SmrgAC_MSG_CHECKING([whether to build functional specifications])
259779d5fcd7SmrgAC_MSG_RESULT([$build_specs])
259879d5fcd7Smrg]) # XORG_ENABLE_SPECS
2599f29dbc25Smrg
260079d5fcd7Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
260179d5fcd7Smrg# ----------------------------------------------
260279d5fcd7Smrg# Minimum version: 1.13.0
2603f29dbc25Smrg#
260479d5fcd7Smrg# This macro enables a builder to enable/disable unit testing
260579d5fcd7Smrg# It makes no assumption about the test cases implementation
260679d5fcd7Smrg# Test cases may or may not use Automake "Support for test suites"
260779d5fcd7Smrg# They may or may not use the software utility library GLib
260879d5fcd7Smrg#
260979d5fcd7Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
261079d5fcd7Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
261179d5fcd7Smrg# The variable enable_unit_tests is used by other macros in this file.
261279d5fcd7Smrg#
261379d5fcd7Smrg# Interface to module:
261479d5fcd7Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
261579d5fcd7Smrg# enable_unit_tests:    used in configure.ac for additional configuration
261679d5fcd7Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
261779d5fcd7Smrg#			'no' user instructs the module not to build tests
261879d5fcd7Smrg# parm1:		specify the default value, yes or no.
261979d5fcd7Smrg#
262079d5fcd7SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
262179d5fcd7SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
262279d5fcd7SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
262379d5fcd7SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
262479d5fcd7Smrgm4_define([_defopt], m4_default([$1], [auto]))
262579d5fcd7SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
262679d5fcd7Smrg	[Enable building unit test cases (default: ]_defopt[)]),
262779d5fcd7Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
262879d5fcd7Smrgm4_undefine([_defopt])
262979d5fcd7SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
263079d5fcd7SmrgAC_MSG_CHECKING([whether to build unit test cases])
263179d5fcd7SmrgAC_MSG_RESULT([$enable_unit_tests])
263279d5fcd7Smrg]) # XORG_ENABLE_UNIT_TESTS
2633f29dbc25Smrg
263479d5fcd7Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
263579d5fcd7Smrg# ------------------------------------------------------
263679d5fcd7Smrg# Minimum version: 1.17.0
263779d5fcd7Smrg#
263879d5fcd7Smrg# This macro enables a builder to enable/disable integration testing
263979d5fcd7Smrg# It makes no assumption about the test cases' implementation
264079d5fcd7Smrg# Test cases may or may not use Automake "Support for test suites"
264179d5fcd7Smrg#
264279d5fcd7Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
264379d5fcd7Smrg# usually requires less dependencies and may be built and run under less
264479d5fcd7Smrg# stringent environments than integration tests.
264579d5fcd7Smrg#
264679d5fcd7Smrg# Interface to module:
264779d5fcd7Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
264879d5fcd7Smrg# enable_integration_tests:   used in configure.ac for additional configuration
264979d5fcd7Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
265079d5fcd7Smrg#                             'no' user instructs the module not to build tests
265179d5fcd7Smrg# parm1:                      specify the default value, yes or no.
265279d5fcd7Smrg#
265379d5fcd7SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
265479d5fcd7SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
265579d5fcd7Smrgm4_define([_defopt], m4_default([$1], [auto]))
265679d5fcd7SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
265779d5fcd7Smrg	[Enable building integration test cases (default: ]_defopt[)]),
265879d5fcd7Smrg	[enable_integration_tests=$enableval],
265979d5fcd7Smrg	[enable_integration_tests=]_defopt)
266079d5fcd7Smrgm4_undefine([_defopt])
266179d5fcd7SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
266279d5fcd7Smrg	[test "x$enable_integration_tests" != xno])
266379d5fcd7SmrgAC_MSG_CHECKING([whether to build unit test cases])
266479d5fcd7SmrgAC_MSG_RESULT([$enable_integration_tests])
266579d5fcd7Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2666f29dbc25Smrg
266779d5fcd7Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
266879d5fcd7Smrg# ----------------------------------------
266979d5fcd7Smrg# Minimum version: 1.13.0
267079d5fcd7Smrg#
267179d5fcd7Smrg# GLib is a library which provides advanced data structures and functions.
267279d5fcd7Smrg# This macro enables a module to test for the presence of Glib.
267379d5fcd7Smrg#
267479d5fcd7Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
267579d5fcd7Smrg# Otherwise the value of $enable_unit_tests is blank.
267679d5fcd7Smrg#
267779d5fcd7Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
267879d5fcd7Smrg# test support usually requires less dependencies and may be built and run under
267979d5fcd7Smrg# less stringent environments than integration tests.
268079d5fcd7Smrg#
268179d5fcd7Smrg# Interface to module:
268279d5fcd7Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
268379d5fcd7Smrg# with_glib: used in configure.ac to know if GLib has been found
268479d5fcd7Smrg# --with-glib:	'yes' user instructs the module to use glib
268579d5fcd7Smrg#		'no' user instructs the module not to use glib
268679d5fcd7Smrg#
268779d5fcd7SmrgAC_DEFUN([XORG_WITH_GLIB],[
268879d5fcd7SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
268979d5fcd7Smrgm4_define([_defopt], m4_default([$2], [auto]))
269079d5fcd7SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
269179d5fcd7Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
269279d5fcd7Smrg	[with_glib=$withval], [with_glib=]_defopt)
269379d5fcd7Smrgm4_undefine([_defopt])
269404007ebaSmrg
269579d5fcd7Smrghave_glib=no
269679d5fcd7Smrg# Do not probe GLib if user explicitly disabled unit testing
269779d5fcd7Smrgif test "x$enable_unit_tests" != x"no"; then
269879d5fcd7Smrg  # Do not probe GLib if user explicitly disabled it
269979d5fcd7Smrg  if test "x$with_glib" != x"no"; then
270079d5fcd7Smrg    m4_ifval(
270179d5fcd7Smrg      [$1],
270279d5fcd7Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
270379d5fcd7Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
270479d5fcd7Smrg    )
2705f29dbc25Smrg  fi
2706f29dbc25Smrgfi
2707f29dbc25Smrg
270879d5fcd7Smrg# Not having GLib when unit testing has been explicitly requested is an error
270979d5fcd7Smrgif test "x$enable_unit_tests" = x"yes"; then
271079d5fcd7Smrg  if test "x$have_glib" = x"no"; then
271179d5fcd7Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2712f29dbc25Smrg  fi
2713f29dbc25Smrgfi
2714f29dbc25Smrg
271579d5fcd7Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
271679d5fcd7Smrgif test "x$enable_unit_tests" = x"no"; then
271779d5fcd7Smrg  if test "x$with_glib" = x"yes"; then
271879d5fcd7Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
271979d5fcd7Smrg  fi
272079d5fcd7Smrgfi
2721f29dbc25Smrg
272279d5fcd7Smrg# Not having GLib when it has been explicitly requested is an error
272379d5fcd7Smrgif test "x$with_glib" = x"yes"; then
272479d5fcd7Smrg  if test "x$have_glib" = x"no"; then
272579d5fcd7Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
272679d5fcd7Smrg  fi
272779d5fcd7Smrgfi
2728f29dbc25Smrg
272979d5fcd7SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
273079d5fcd7Smrg]) # XORG_WITH_GLIB
273104007ebaSmrg
273279d5fcd7Smrg# XORG_LD_WRAP([required|optional])
273379d5fcd7Smrg# ---------------------------------
273479d5fcd7Smrg# Minimum version: 1.13.0
273579d5fcd7Smrg#
273679d5fcd7Smrg# Check if linker supports -wrap, passed via compiler flags
273779d5fcd7Smrg#
273879d5fcd7Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
273979d5fcd7Smrg# Otherwise the value of $enable_unit_tests is blank.
274079d5fcd7Smrg#
274179d5fcd7Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
274279d5fcd7Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
274379d5fcd7Smrg# available, an argument of "optional" allows use when some unit tests require
274479d5fcd7Smrg# ld -wrap and others do not.
274579d5fcd7Smrg#
274679d5fcd7SmrgAC_DEFUN([XORG_LD_WRAP],[
274779d5fcd7SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
274879d5fcd7Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
274979d5fcd7Smrg                      void __wrap_exit(int status) { return; }],
275079d5fcd7Smrg                     [exit(0);])])
275179d5fcd7Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
275279d5fcd7Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
275379d5fcd7Smrg  if test "x$have_ld_wrap" = x"no"; then
275479d5fcd7Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
275579d5fcd7Smrg  fi
275679d5fcd7Smrgfi
275779d5fcd7SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
275879d5fcd7Smrg#
275979d5fcd7Smrg]) # XORG_LD_WRAP
276004007ebaSmrg
276179d5fcd7Smrg# XORG_CHECK_LINKER_FLAGS
276279d5fcd7Smrg# -----------------------
276379d5fcd7Smrg# SYNOPSIS
276479d5fcd7Smrg#
276579d5fcd7Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
276679d5fcd7Smrg#
276779d5fcd7Smrg# DESCRIPTION
276879d5fcd7Smrg#
276979d5fcd7Smrg#   Check whether the given linker FLAGS work with the current language's
277079d5fcd7Smrg#   linker, or whether they give an error.
277179d5fcd7Smrg#
277279d5fcd7Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
277379d5fcd7Smrg#   success/failure.
277479d5fcd7Smrg#
277579d5fcd7Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
277679d5fcd7Smrg#
277779d5fcd7Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
277879d5fcd7Smrg#
277979d5fcd7Smrg# LICENSE
278079d5fcd7Smrg#
278179d5fcd7Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
278279d5fcd7Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
278379d5fcd7Smrg#   Copyright (c) 2009 Matteo Frigo
278479d5fcd7Smrg#
278579d5fcd7Smrg#   This program is free software: you can redistribute it and/or modify it
278679d5fcd7Smrg#   under the terms of the GNU General Public License as published by the
278779d5fcd7Smrg#   Free Software Foundation, either version 3 of the License, or (at your
278879d5fcd7Smrg#   option) any later version.
278979d5fcd7Smrg#
279079d5fcd7Smrg#   This program is distributed in the hope that it will be useful, but
279179d5fcd7Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
279279d5fcd7Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
279379d5fcd7Smrg#   Public License for more details.
279479d5fcd7Smrg#
279579d5fcd7Smrg#   You should have received a copy of the GNU General Public License along
279679d5fcd7Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
279779d5fcd7Smrg#
279879d5fcd7Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
279979d5fcd7Smrg#   gives unlimited permission to copy, distribute and modify the configure
280079d5fcd7Smrg#   scripts that are the output of Autoconf when processing the Macro. You
280179d5fcd7Smrg#   need not follow the terms of the GNU General Public License when using
280279d5fcd7Smrg#   or distributing such scripts, even though portions of the text of the
280379d5fcd7Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
280479d5fcd7Smrg#   all other use of the material that constitutes the Autoconf Macro.
280579d5fcd7Smrg#
280679d5fcd7Smrg#   This special exception to the GPL applies to versions of the Autoconf
280779d5fcd7Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
280879d5fcd7Smrg#   modified version of the Autoconf Macro, you may extend this special
280979d5fcd7Smrg#   exception to the GPL to apply to your modified version as well.#
281079d5fcd7SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
281179d5fcd7Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
281279d5fcd7Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
281379d5fcd7SmrgAS_LITERAL_IF([$1],
281479d5fcd7Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
281579d5fcd7Smrg      ax_save_FLAGS=$LDFLAGS
281679d5fcd7Smrg      LDFLAGS="$1"
281779d5fcd7Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
281879d5fcd7Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
281979d5fcd7Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
282079d5fcd7Smrg      LDFLAGS=$ax_save_FLAGS])],
282179d5fcd7Smrg  [ax_save_FLAGS=$LDFLAGS
282279d5fcd7Smrg   LDFLAGS="$1"
282379d5fcd7Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
282479d5fcd7Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
282579d5fcd7Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
282679d5fcd7Smrg   LDFLAGS=$ax_save_FLAGS])
282779d5fcd7Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
282879d5fcd7SmrgAC_MSG_RESULT($xorg_check_linker_flags)
282979d5fcd7Smrgif test "x$xorg_check_linker_flags" = xyes; then
283079d5fcd7Smrg	m4_default([$2], :)
283179d5fcd7Smrgelse
283279d5fcd7Smrg	m4_default([$3], :)
283379d5fcd7Smrgfi
283479d5fcd7Smrg]) # XORG_CHECK_LINKER_FLAGS
283504007ebaSmrg
283679d5fcd7Smrg# XORG_MEMORY_CHECK_FLAGS
283779d5fcd7Smrg# -----------------------
283879d5fcd7Smrg# Minimum version: 1.16.0
283979d5fcd7Smrg#
284079d5fcd7Smrg# This macro attempts to find appropriate memory checking functionality
284179d5fcd7Smrg# for various platforms which unit testing code may use to catch various
284279d5fcd7Smrg# forms of memory allocation and access errors in testing.
284379d5fcd7Smrg#
284479d5fcd7Smrg# Interface to module:
284579d5fcd7Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
284679d5fcd7Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
284779d5fcd7Smrg#
284879d5fcd7Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
284979d5fcd7Smrg#
285079d5fcd7SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
285104007ebaSmrg
285279d5fcd7SmrgAC_REQUIRE([AC_CANONICAL_HOST])
285379d5fcd7SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
285479d5fcd7Smrg           [Environment variables to enable memory checking in tests])
285504007ebaSmrg
285679d5fcd7Smrg# Check for different types of support on different platforms
285779d5fcd7Smrgcase $host_os in
285879d5fcd7Smrg    solaris*)
285979d5fcd7Smrg        AC_CHECK_LIB([umem], [umem_alloc],
286079d5fcd7Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
286179d5fcd7Smrg        ;;
286279d5fcd7Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
286379d5fcd7Smrg        # both directly and inverted, so should not be 0 or 255.
286479d5fcd7Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
286579d5fcd7Smrg        ;;
286679d5fcd7Smrg    darwin*)
286779d5fcd7Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
286879d5fcd7Smrg        ;;
286979d5fcd7Smrg    *bsd*)
287079d5fcd7Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
287179d5fcd7Smrg        ;;
287279d5fcd7Smrgesac
287304007ebaSmrg
287479d5fcd7Smrg# User supplied flags override default flags
287579d5fcd7Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
287679d5fcd7Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
28777f419768Smrgfi
2878f29dbc25Smrg
287979d5fcd7SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
288079d5fcd7Smrg]) # XORG_WITH_LINT
2881f29dbc25Smrg
288279d5fcd7Smrg# XORG_CHECK_MALLOC_ZERO
288379d5fcd7Smrg# ----------------------
288479d5fcd7Smrg# Minimum version: 1.0.0
2885f29dbc25Smrg#
288679d5fcd7Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
288779d5fcd7Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
288879d5fcd7Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
288979d5fcd7SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
289079d5fcd7SmrgAC_ARG_ENABLE(malloc0returnsnull,
289179d5fcd7Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
289279d5fcd7Smrg		       [malloc(0) returns NULL (default: auto)]),
289379d5fcd7Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
289479d5fcd7Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2895f29dbc25Smrg
289679d5fcd7SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
289779d5fcd7Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
289879d5fcd7SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
289979d5fcd7Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
290079d5fcd7Smrg#include <stdlib.h>
290179d5fcd7Smrg],[
290279d5fcd7Smrg    char *m0, *r0, *c0, *p;
290379d5fcd7Smrg    m0 = malloc(0);
290479d5fcd7Smrg    p = malloc(10);
290579d5fcd7Smrg    r0 = realloc(p,0);
290679d5fcd7Smrg    c0 = calloc(0,10);
290779d5fcd7Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
290879d5fcd7Smrg])],
290979d5fcd7Smrg		[xorg_cv_malloc0_returns_null=yes],
291079d5fcd7Smrg		[xorg_cv_malloc0_returns_null=no])])
291179d5fcd7SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2912f29dbc25Smrgfi
291379d5fcd7SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2914f29dbc25Smrg
291579d5fcd7Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
291679d5fcd7Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
291779d5fcd7Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
291879d5fcd7Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2919f29dbc25Smrgelse
292079d5fcd7Smrg	MALLOC_ZERO_CFLAGS=""
292179d5fcd7Smrg	XMALLOC_ZERO_CFLAGS=""
292279d5fcd7Smrg	XTMALLOC_ZERO_CFLAGS=""
2923f29dbc25Smrgfi
2924f29dbc25Smrg
292579d5fcd7SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
292679d5fcd7SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
292779d5fcd7SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
292879d5fcd7Smrg]) # XORG_CHECK_MALLOC_ZERO
2929f29dbc25Smrg
293079d5fcd7Smrg# XORG_WITH_LINT()
293179d5fcd7Smrg# ----------------
293279d5fcd7Smrg# Minimum version: 1.1.0
2933f29dbc25Smrg#
293479d5fcd7Smrg# This macro enables the use of a tool that flags some suspicious and
293579d5fcd7Smrg# non-portable constructs (likely to be bugs) in C language source code.
293679d5fcd7Smrg# It will attempt to locate the tool and use appropriate options.
293779d5fcd7Smrg# There are various lint type tools on different platforms.
2938f29dbc25Smrg#
293979d5fcd7Smrg# Interface to module:
294079d5fcd7Smrg# LINT:		returns the path to the tool found on the platform
294179d5fcd7Smrg#		or the value set to LINT on the configure cmd line
294279d5fcd7Smrg#		also an Automake conditional
294379d5fcd7Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2944f29dbc25Smrg#
294579d5fcd7Smrg# --with-lint:	'yes' user instructs the module to use lint
294679d5fcd7Smrg#		'no' user instructs the module not to use lint (default)
294779d5fcd7Smrg#
294879d5fcd7Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
294979d5fcd7Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
295079d5fcd7Smrg#
295179d5fcd7SmrgAC_DEFUN([XORG_WITH_LINT],[
2952f29dbc25Smrg
295379d5fcd7SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
295479d5fcd7SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
295579d5fcd7SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
295679d5fcd7Smrg		[Use a lint-style source code checker (default: disabled)])],
295779d5fcd7Smrg		[use_lint=$withval], [use_lint=no])
2958f29dbc25Smrg
295979d5fcd7Smrg# Obtain platform specific info like program name and options
296079d5fcd7Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
296179d5fcd7Smrgcase $host_os in
296279d5fcd7Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
296379d5fcd7Smrg	lint_name=splint
296479d5fcd7Smrg	lint_options="-badflag"
296579d5fcd7Smrg	;;
296679d5fcd7Smrg  *freebsd* | *netbsd*)
296779d5fcd7Smrg	lint_name=lint
296879d5fcd7Smrg	lint_options="-u -b"
296979d5fcd7Smrg	;;
297079d5fcd7Smrg  *solaris*)
297179d5fcd7Smrg	lint_name=lint
297279d5fcd7Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
297379d5fcd7Smrg	;;
297479d5fcd7Smrgesac
297579d5fcd7Smrg
297679d5fcd7Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
297779d5fcd7Smrgif test "x$use_lint" = x"yes" ; then
297879d5fcd7Smrg   AC_PATH_PROG([LINT], [$lint_name])
297979d5fcd7Smrg   if test "x$LINT" = "x"; then
298079d5fcd7Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
298179d5fcd7Smrg   fi
298279d5fcd7Smrgelif test "x$use_lint" = x"no" ; then
298379d5fcd7Smrg   if test "x$LINT" != "x"; then
298479d5fcd7Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
298579d5fcd7Smrg   fi
2986f29dbc25Smrgelse
298779d5fcd7Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2988f29dbc25Smrgfi
2989f29dbc25Smrg
299079d5fcd7Smrg# User supplied flags override default flags
299179d5fcd7Smrgif test "x$LINT_FLAGS" != "x"; then
299279d5fcd7Smrg   lint_options=$LINT_FLAGS
299379d5fcd7Smrgfi
2994f29dbc25Smrg
299579d5fcd7SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
299679d5fcd7SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2997f29dbc25Smrg
299879d5fcd7Smrg]) # XORG_WITH_LINT
2999f29dbc25Smrg
300079d5fcd7Smrg# XORG_LINT_LIBRARY(LIBNAME)
300179d5fcd7Smrg# --------------------------
300279d5fcd7Smrg# Minimum version: 1.1.0
300304007ebaSmrg#
300479d5fcd7Smrg# Sets up flags for building lint libraries for checking programs that call
300579d5fcd7Smrg# functions in the library.
300679d5fcd7Smrg#
300779d5fcd7Smrg# Interface to module:
300879d5fcd7Smrg# LINTLIB		- Automake variable with the name of lint library file to make
300979d5fcd7Smrg# MAKE_LINT_LIB		- Automake conditional
301079d5fcd7Smrg#
301179d5fcd7Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
301279d5fcd7Smrg#			  - 'no' user instructs the module not to create a lint library (default)
3013f29dbc25Smrg
301479d5fcd7SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
301579d5fcd7SmrgAC_REQUIRE([XORG_WITH_LINT])
301679d5fcd7SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
301779d5fcd7Smrg	[Create lint library (default: disabled)])],
301879d5fcd7Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
301979d5fcd7Smrg
302079d5fcd7Smrgif test "x$make_lint_lib" = x"yes" ; then
302179d5fcd7Smrg   LINTLIB=llib-l$1.ln
302279d5fcd7Smrg   if test "x$LINT" = "x"; then
302379d5fcd7Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
302479d5fcd7Smrg   fi
302579d5fcd7Smrgelif test "x$make_lint_lib" != x"no" ; then
302679d5fcd7Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
302704007ebaSmrgfi
302804007ebaSmrg
302979d5fcd7SmrgAC_SUBST(LINTLIB)
303079d5fcd7SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
303104007ebaSmrg
303279d5fcd7Smrg]) # XORG_LINT_LIBRARY
3033f29dbc25Smrg
303479d5fcd7Smrg# XORG_COMPILER_BRAND
303504007ebaSmrg# -------------------
303679d5fcd7Smrg# Minimum version: 1.14.0
303704007ebaSmrg#
303879d5fcd7Smrg# Checks for various brands of compilers and sets flags as appropriate:
303979d5fcd7Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
304079d5fcd7Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
304179d5fcd7Smrg#   clang compiler - sets CLANGCC to "yes"
304279d5fcd7Smrg#   Intel compiler - sets INTELCC to "yes"
304379d5fcd7Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
304479d5fcd7Smrg#
304579d5fcd7SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
304679d5fcd7SmrgAC_LANG_CASE(
304779d5fcd7Smrg	[C], [
304879d5fcd7Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
304979d5fcd7Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
305079d5fcd7Smrg		m4_version_prereq([2.70],
305179d5fcd7Smrg			[AC_REQUIRE([AC_PROG_CC])],
305279d5fcd7Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
305379d5fcd7Smrg	],
305479d5fcd7Smrg	[C++], [
305579d5fcd7Smrg		AC_REQUIRE([AC_PROG_CXX])
305679d5fcd7Smrg	]
305779d5fcd7Smrg)
305879d5fcd7SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
305979d5fcd7SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
306079d5fcd7SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
306179d5fcd7Smrg]) # XORG_COMPILER_BRAND
3062f29dbc25Smrg
306379d5fcd7Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
3064f29dbc25Smrg# ---------------
306579d5fcd7Smrg# Minimum version: 1.16.0
306679d5fcd7Smrg#
306779d5fcd7Smrg# Test if the compiler works when passed the given flag as a command line argument.
306879d5fcd7Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
306979d5fcd7Smrg# next flag in the list until there are no more options.
307079d5fcd7Smrg#
307179d5fcd7Smrg# Note that this does not guarantee that the compiler supports the flag as some
307279d5fcd7Smrg# compilers will simply ignore arguments that they do not understand, but we do
307379d5fcd7Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
307479d5fcd7Smrg# -Werror=unused-command-line-argument
307579d5fcd7Smrg#
307679d5fcd7SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
307779d5fcd7Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
307879d5fcd7Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3079f29dbc25Smrg
308079d5fcd7SmrgAC_LANG_COMPILER_REQUIRE
308104007ebaSmrg
308279d5fcd7SmrgAC_LANG_CASE(
308379d5fcd7Smrg	[C], [
308479d5fcd7Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
308579d5fcd7Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
308679d5fcd7Smrg		m4_version_prereq([2.70],
308779d5fcd7Smrg			[AC_REQUIRE([AC_PROG_CC])],
308879d5fcd7Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
308979d5fcd7Smrg		define([PREFIX], [C])
309079d5fcd7Smrg		define([CACHE_PREFIX], [cc])
309179d5fcd7Smrg		define([COMPILER], [$CC])
309279d5fcd7Smrg	],
309379d5fcd7Smrg	[C++], [
309479d5fcd7Smrg		define([PREFIX], [CXX])
309579d5fcd7Smrg		define([CACHE_PREFIX], [cxx])
309679d5fcd7Smrg		define([COMPILER], [$CXX])
309779d5fcd7Smrg	]
309879d5fcd7Smrg)
309979d5fcd7Smrg
310079d5fcd7Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
310179d5fcd7Smrg
310279d5fcd7Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
310379d5fcd7Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
310479d5fcd7Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
310579d5fcd7Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
310679d5fcd7Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
310779d5fcd7Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
310879d5fcd7Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
310979d5fcd7Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
311079d5fcd7Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
311104007ebaSmrgfi
311279d5fcd7Smrg
311379d5fcd7Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
311479d5fcd7Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
311579d5fcd7Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
311679d5fcd7Smrg	fi
311779d5fcd7Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
311879d5fcd7Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
311979d5fcd7Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
312079d5fcd7Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
312179d5fcd7Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
312279d5fcd7Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
312379d5fcd7Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
312479d5fcd7Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
312579d5fcd7Smrgfi
312679d5fcd7Smrg
312779d5fcd7Smrgfound="no"
312879d5fcd7Smrgm4_foreach([flag], m4_cdr($@), [
312979d5fcd7Smrg	if test $found = "no" ; then
313079d5fcd7Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
313179d5fcd7Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
313279d5fcd7Smrg		fi
313379d5fcd7Smrg
313479d5fcd7Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
313579d5fcd7Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
313679d5fcd7Smrg		fi
313779d5fcd7Smrg
313879d5fcd7Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
313979d5fcd7Smrg
314079d5fcd7Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
314179d5fcd7Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
314279d5fcd7Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
314379d5fcd7Smrg		AC_CACHE_VAL($cacheid,
314479d5fcd7Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
314579d5fcd7Smrg					     [eval $cacheid=yes],
314679d5fcd7Smrg					     [eval $cacheid=no])])
314779d5fcd7Smrg
314879d5fcd7Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
314979d5fcd7Smrg
315079d5fcd7Smrg		eval supported=\$$cacheid
315179d5fcd7Smrg		AC_MSG_RESULT([$supported])
315279d5fcd7Smrg		if test "$supported" = "yes" ; then
315379d5fcd7Smrg			$1="$$1 ]flag["
315479d5fcd7Smrg			found="yes"
315579d5fcd7Smrg		fi
315679d5fcd7Smrg	fi
315704007ebaSmrg])
315879d5fcd7Smrg]) # XORG_TESTSET_CFLAG
3159f29dbc25Smrg
316079d5fcd7Smrg# XORG_COMPILER_FLAGS
316179d5fcd7Smrg# ---------------
316279d5fcd7Smrg# Minimum version: 1.16.0
3163f29dbc25Smrg#
316479d5fcd7Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
316579d5fcd7Smrg# arguments supported by the selected compiler which do NOT alter the generated
316679d5fcd7Smrg# code.  These arguments will cause the compiler to print various warnings
316779d5fcd7Smrg# during compilation AND turn a conservative set of warnings into errors.
316879d5fcd7Smrg#
316979d5fcd7Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
317079d5fcd7Smrg# future versions of util-macros as options are added to new compilers.
317179d5fcd7Smrg#
317279d5fcd7SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
317379d5fcd7SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3174f29dbc25Smrg
317579d5fcd7SmrgAC_ARG_ENABLE(selective-werror,
317679d5fcd7Smrg              AS_HELP_STRING([--disable-selective-werror],
317779d5fcd7Smrg                             [Turn off selective compiler errors. (default: enabled)]),
317879d5fcd7Smrg              [SELECTIVE_WERROR=$enableval],
317979d5fcd7Smrg              [SELECTIVE_WERROR=yes])
318079d5fcd7Smrg
318179d5fcd7SmrgAC_LANG_CASE(
318279d5fcd7Smrg        [C], [
318379d5fcd7Smrg                define([PREFIX], [C])
318479d5fcd7Smrg        ],
318579d5fcd7Smrg        [C++], [
318679d5fcd7Smrg                define([PREFIX], [CXX])
318779d5fcd7Smrg        ]
318879d5fcd7Smrg)
318979d5fcd7Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
319079d5fcd7Smrgif test "x$SUNCC" = "xyes"; then
319179d5fcd7Smrg    [BASE_]PREFIX[FLAGS]="-v"
319204007ebaSmrgelse
319379d5fcd7Smrg    [BASE_]PREFIX[FLAGS]=""
319404007ebaSmrgfi
3195f29dbc25Smrg
319679d5fcd7Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
319779d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
319879d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
319979d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
320079d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3201f29dbc25Smrg
320279d5fcd7SmrgAC_LANG_CASE(
320379d5fcd7Smrg	[C], [
320479d5fcd7Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
320579d5fcd7Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
320679d5fcd7Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
320779d5fcd7Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
320879d5fcd7Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
320979d5fcd7Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
321079d5fcd7Smrg	]
321179d5fcd7Smrg)
3212f29dbc25Smrg
321379d5fcd7Smrg# This chunk adds additional warnings that could catch undesired effects.
321479d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
321579d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
321679d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
321779d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
321879d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
321979d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
322079d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3221f29dbc25Smrg
322279d5fcd7Smrg# These are currently disabled because they are noisy.  They will be enabled
322379d5fcd7Smrg# in the future once the codebase is sufficiently modernized to silence
322479d5fcd7Smrg# them.  For now, I don't want them to drown out the other warnings.
322579d5fcd7Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
322679d5fcd7Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
322779d5fcd7Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3228f29dbc25Smrg
322979d5fcd7Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
323079d5fcd7Smrg# when there are problems that should be fixed.
3231f29dbc25Smrg
323279d5fcd7Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
323379d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
323479d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
323579d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
323679d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
323779d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
323879d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
323979d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
324079d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
324179d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
324279d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
324379d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
324479d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
324579d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
324679d5fcd7Smrgelse
324779d5fcd7SmrgAC_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])
324879d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
324979d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
325079d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
325179d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
325279d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
325379d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
325479d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
325579d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
325679d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
325779d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
325879d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
325979d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
326079d5fcd7SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
326179d5fcd7Smrgfi
3262f29dbc25Smrg
326379d5fcd7SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
326479d5fcd7Smrg]) # XORG_COMPILER_FLAGS
3265f29dbc25Smrg
326679d5fcd7Smrg# XORG_CWARNFLAGS
326779d5fcd7Smrg# ---------------
326879d5fcd7Smrg# Minimum version: 1.2.0
326979d5fcd7Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3270f29dbc25Smrg#
327179d5fcd7Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3272f29dbc25Smrg#
327379d5fcd7Smrg# This function is deprecated because it defines -fno-strict-aliasing
327479d5fcd7Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
327579d5fcd7Smrg# is needed, then it should be added explicitly in the module when
327679d5fcd7Smrg# it is updated to use BASE_CFLAGS.
327704007ebaSmrg#
327879d5fcd7SmrgAC_DEFUN([XORG_CWARNFLAGS], [
327979d5fcd7SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
328079d5fcd7SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
328179d5fcd7SmrgAC_LANG_CASE(
328279d5fcd7Smrg	[C], [
328379d5fcd7Smrg		CWARNFLAGS="$BASE_CFLAGS"
328479d5fcd7Smrg		if  test "x$GCC" = xyes ; then
328579d5fcd7Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
328679d5fcd7Smrg		fi
328779d5fcd7Smrg		AC_SUBST(CWARNFLAGS)
328879d5fcd7Smrg	]
328979d5fcd7Smrg)
329079d5fcd7Smrg]) # XORG_CWARNFLAGS
329104007ebaSmrg
329279d5fcd7Smrg# XORG_STRICT_OPTION
329379d5fcd7Smrg# -----------------------
329479d5fcd7Smrg# Minimum version: 1.3.0
329579d5fcd7Smrg#
329679d5fcd7Smrg# Add configure option to enable strict compilation flags, such as treating
329779d5fcd7Smrg# warnings as fatal errors.
329879d5fcd7Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
329979d5fcd7Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
330079d5fcd7Smrg#
330179d5fcd7Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
330279d5fcd7Smrg# when strict compilation is unconditionally desired.
330379d5fcd7SmrgAC_DEFUN([XORG_STRICT_OPTION], [
330479d5fcd7SmrgAC_REQUIRE([XORG_CWARNFLAGS])
330579d5fcd7SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3306f29dbc25Smrg
330779d5fcd7SmrgAC_ARG_ENABLE(strict-compilation,
330879d5fcd7Smrg			  AS_HELP_STRING([--enable-strict-compilation],
330979d5fcd7Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
331079d5fcd7Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
331104007ebaSmrg
331279d5fcd7SmrgAC_LANG_CASE(
331379d5fcd7Smrg        [C], [
331479d5fcd7Smrg                define([PREFIX], [C])
331579d5fcd7Smrg        ],
331679d5fcd7Smrg        [C++], [
331779d5fcd7Smrg                define([PREFIX], [CXX])
331879d5fcd7Smrg        ]
331979d5fcd7Smrg)
332004007ebaSmrg
332179d5fcd7Smrg[STRICT_]PREFIX[FLAGS]=""
332279d5fcd7SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
332379d5fcd7SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3324f29dbc25Smrg
332579d5fcd7Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
332679d5fcd7Smrg# activate it with -Werror, so we add it here explicitly.
332779d5fcd7SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
332804007ebaSmrg
332979d5fcd7Smrgif test "x$STRICT_COMPILE" = "xyes"; then
333079d5fcd7Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
333179d5fcd7Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
333279d5fcd7Smrgfi
333379d5fcd7SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
333479d5fcd7SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
333579d5fcd7SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
333679d5fcd7Smrg]) # XORG_STRICT_OPTION
333704007ebaSmrg
333879d5fcd7Smrg# XORG_DEFAULT_NOCODE_OPTIONS
333979d5fcd7Smrg# ---------------------------
334079d5fcd7Smrg# Minimum version: 1.20.0
334179d5fcd7Smrg#
334279d5fcd7Smrg# Defines default options for X.Org modules which don't compile code,
334379d5fcd7Smrg# such as fonts, bitmaps, cursors, and docs.
334479d5fcd7Smrg#
334579d5fcd7SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
334679d5fcd7SmrgAC_REQUIRE([AC_PROG_INSTALL])
334779d5fcd7SmrgXORG_RELEASE_VERSION
334879d5fcd7SmrgXORG_CHANGELOG
334979d5fcd7SmrgXORG_INSTALL
335079d5fcd7SmrgXORG_MANPAGE_SECTIONS
335179d5fcd7Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
335279d5fcd7Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
335379d5fcd7Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
335404007ebaSmrg
335579d5fcd7Smrg# XORG_DEFAULT_OPTIONS
335679d5fcd7Smrg# --------------------
335779d5fcd7Smrg# Minimum version: 1.3.0
335879d5fcd7Smrg#
335979d5fcd7Smrg# Defines default options for X.Org modules which compile code.
336079d5fcd7Smrg#
336179d5fcd7SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
336279d5fcd7SmrgAC_REQUIRE([AC_PROG_INSTALL])
336379d5fcd7SmrgXORG_COMPILER_FLAGS
336479d5fcd7SmrgXORG_CWARNFLAGS
336579d5fcd7SmrgXORG_STRICT_OPTION
336679d5fcd7SmrgXORG_DEFAULT_NOCODE_OPTIONS
336779d5fcd7Smrg]) # XORG_DEFAULT_OPTIONS
336804007ebaSmrg
336979d5fcd7Smrg# XORG_INSTALL()
337079d5fcd7Smrg# ----------------
337179d5fcd7Smrg# Minimum version: 1.4.0
337279d5fcd7Smrg#
337379d5fcd7Smrg# Defines the variable INSTALL_CMD as the command to copy
337479d5fcd7Smrg# INSTALL from $prefix/share/util-macros.
337579d5fcd7Smrg#
337679d5fcd7SmrgAC_DEFUN([XORG_INSTALL], [
337779d5fcd7SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
337879d5fcd7Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
337979d5fcd7SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
338079d5fcd7Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
338179d5fcd7Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
338279d5fcd7Smrgtouch \$(top_srcdir)/INSTALL; \
338379d5fcd7Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
338479d5fcd7SmrgAC_SUBST([INSTALL_CMD])
338579d5fcd7Smrg]) # XORG_INSTALL
338679d5fcd7Smrgdnl Copyright 2005 Red Hat, Inc
338779d5fcd7Smrgdnl
338879d5fcd7Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
338979d5fcd7Smrgdnl documentation for any purpose is hereby granted without fee, provided that
339079d5fcd7Smrgdnl the above copyright notice appear in all copies and that both that
339179d5fcd7Smrgdnl copyright notice and this permission notice appear in supporting
339279d5fcd7Smrgdnl documentation.
339379d5fcd7Smrgdnl
339479d5fcd7Smrgdnl The above copyright notice and this permission notice shall be included
339579d5fcd7Smrgdnl in all copies or substantial portions of the Software.
339679d5fcd7Smrgdnl
339779d5fcd7Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
339879d5fcd7Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
339979d5fcd7Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
340079d5fcd7Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
340179d5fcd7Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
340279d5fcd7Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
340379d5fcd7Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
340479d5fcd7Smrgdnl
340579d5fcd7Smrgdnl Except as contained in this notice, the name of the copyright holders shall
340679d5fcd7Smrgdnl not be used in advertising or otherwise to promote the sale, use or
340779d5fcd7Smrgdnl other dealings in this Software without prior written authorization
340879d5fcd7Smrgdnl from the copyright holders.
340979d5fcd7Smrgdnl
341004007ebaSmrg
341179d5fcd7Smrg# XORG_RELEASE_VERSION
341279d5fcd7Smrg# --------------------
341379d5fcd7Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3414f29dbc25Smrg
341579d5fcd7SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
341679d5fcd7Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
341779d5fcd7Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
341879d5fcd7Smrg		[Major version of this package])
341979d5fcd7Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
342079d5fcd7Smrg	if test "x$PVM" = "x"; then
342179d5fcd7Smrg		PVM="0"
342279d5fcd7Smrg	fi
342379d5fcd7Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
342479d5fcd7Smrg		[$PVM],
342579d5fcd7Smrg		[Minor version of this package])
342679d5fcd7Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
342779d5fcd7Smrg	if test "x$PVP" = "x"; then
342879d5fcd7Smrg		PVP="0"
342979d5fcd7Smrg	fi
343079d5fcd7Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
343179d5fcd7Smrg		[$PVP],
343279d5fcd7Smrg		[Patch version of this package])
343379d5fcd7Smrg])
343404007ebaSmrg
343579d5fcd7Smrg# XORG_CHANGELOG()
343679d5fcd7Smrg# ----------------
343779d5fcd7Smrg# Minimum version: 1.2.0
343879d5fcd7Smrg#
343979d5fcd7Smrg# Defines the variable CHANGELOG_CMD as the command to generate
344079d5fcd7Smrg# ChangeLog from git.
344179d5fcd7Smrg#
344279d5fcd7Smrg#
344379d5fcd7SmrgAC_DEFUN([XORG_CHANGELOG], [
344479d5fcd7SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
344579d5fcd7Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
344679d5fcd7Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
344779d5fcd7Smrgtouch \$(top_srcdir)/ChangeLog; \
344879d5fcd7Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
344979d5fcd7SmrgAC_SUBST([CHANGELOG_CMD])
345079d5fcd7Smrg]) # XORG_CHANGELOG
3451f29dbc25Smrg
345204007ebaSmrgm4_include([m4/libtool.m4])
345304007ebaSmrgm4_include([m4/ltoptions.m4])
345404007ebaSmrgm4_include([m4/ltsugar.m4])
345504007ebaSmrgm4_include([m4/ltversion.m4])
345604007ebaSmrgm4_include([m4/lt~obsolete.m4])
3457