163323ee5Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2e6ecbdaeSmrg
363323ee5Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4c7484f1fSmrg
5c7484f1fSmrg# This file is free software; the Free Software Foundation
6c7484f1fSmrg# gives unlimited permission to copy and/or distribute it,
7c7484f1fSmrg# with or without modifications, as long as this notice is preserved.
8c7484f1fSmrg
9c7484f1fSmrg# This program is distributed in the hope that it will be useful,
10c7484f1fSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11c7484f1fSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12c7484f1fSmrg# PARTICULAR PURPOSE.
13c7484f1fSmrg
14e6ecbdaeSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15baed689fSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16baed689fSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17d5e55f73Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
18d5e55f73Smrg[m4_warning([this file was generated for autoconf 2.72.
19baed689fSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20baed689fSmrgIf you have problems, you may need to regenerate the build system entirely.
21e6ecbdaeSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22c7484f1fSmrg
2363323ee5Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
24c7484f1fSmrg#
2563323ee5Smrg# This file is free software; the Free Software Foundation
2663323ee5Smrg# gives unlimited permission to copy and/or distribute it,
2763323ee5Smrg# with or without modifications, as long as this notice is preserved.
28c7484f1fSmrg
2963323ee5Smrg# AM_AUTOMAKE_VERSION(VERSION)
3063323ee5Smrg# ----------------------------
3163323ee5Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3263323ee5Smrg# generated from the m4 files accompanying Automake X.Y.
3363323ee5Smrg# (This private macro should not be called outside this file.)
3463323ee5SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3563323ee5Smrg[am__api_version='1.16'
3663323ee5Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3763323ee5Smrgdnl require some minimum version.  Point them to the right macro.
3863323ee5Smrgm4_if([$1], [1.16.5], [],
3963323ee5Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4063323ee5Smrg])
41c7484f1fSmrg
4263323ee5Smrg# _AM_AUTOCONF_VERSION(VERSION)
4363323ee5Smrg# -----------------------------
4463323ee5Smrg# aclocal traces this macro to find the Autoconf version.
4563323ee5Smrg# This is a private macro too.  Using m4_define simplifies
4663323ee5Smrg# the logic in aclocal, which can simply ignore this definition.
4763323ee5Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48c7484f1fSmrg
4963323ee5Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5063323ee5Smrg# -------------------------------
5163323ee5Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5263323ee5Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5363323ee5SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5463323ee5Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
5563323ee5Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5663323ee5Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5763323ee5Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58c7484f1fSmrg
5963323ee5Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60c7484f1fSmrg
6163323ee5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6263323ee5Smrg#
6363323ee5Smrg# This file is free software; the Free Software Foundation
6463323ee5Smrg# gives unlimited permission to copy and/or distribute it,
6563323ee5Smrg# with or without modifications, as long as this notice is preserved.
66ebb1c56dSmrg
6763323ee5Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6863323ee5Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6963323ee5Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70c7484f1fSmrg#
7163323ee5Smrg# Of course, Automake must honor this variable whenever it calls a
7263323ee5Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7363323ee5Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7463323ee5Smrg# depending on how configure is run.  This is pretty annoying, since
7563323ee5Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7663323ee5Smrg# source directory, any form will work fine, but in subdirectories a
7763323ee5Smrg# relative path needs to be adjusted first.
78c7484f1fSmrg#
7963323ee5Smrg# $ac_aux_dir/missing
8063323ee5Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8163323ee5Smrg# $top_srcdir/$ac_aux_dir/missing
8263323ee5Smrg#    fails if $ac_aux_dir is absolute,
8363323ee5Smrg#    fails when called from a subdirectory in a VPATH build with
8463323ee5Smrg#          a relative $ac_aux_dir
85c7484f1fSmrg#
8663323ee5Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8763323ee5Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8863323ee5Smrg# harmless because $srcdir is '.', but things will broke when you
8963323ee5Smrg# start a VPATH build or use an absolute $srcdir.
90c7484f1fSmrg#
9163323ee5Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9263323ee5Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9363323ee5Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9463323ee5Smrg# and then we would define $MISSING as
9563323ee5Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9663323ee5Smrg# This will work as long as MISSING is not called from configure, because
9763323ee5Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9863323ee5Smrg# However there are other variables, like CC, which are often used in
9963323ee5Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10063323ee5Smrg#
10163323ee5Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10263323ee5Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10363323ee5Smrg# configured tree to be moved without reconfiguration.
104c7484f1fSmrg
10563323ee5SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10663323ee5Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10763323ee5Smrg# Expand $ac_aux_dir to an absolute path.
10863323ee5Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10963323ee5Smrg])
110c7484f1fSmrg
11163323ee5Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112c7484f1fSmrg
11363323ee5Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11463323ee5Smrg#
11563323ee5Smrg# This file is free software; the Free Software Foundation
11663323ee5Smrg# gives unlimited permission to copy and/or distribute it,
11763323ee5Smrg# with or without modifications, as long as this notice is preserved.
118c7484f1fSmrg
11963323ee5Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12063323ee5Smrg# -------------------------------------
12163323ee5Smrg# Define a conditional.
12263323ee5SmrgAC_DEFUN([AM_CONDITIONAL],
12363323ee5Smrg[AC_PREREQ([2.52])dnl
12463323ee5Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12563323ee5Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12663323ee5SmrgAC_SUBST([$1_TRUE])dnl
12763323ee5SmrgAC_SUBST([$1_FALSE])dnl
12863323ee5Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12963323ee5Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13063323ee5Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13163323ee5Smrgif $2; then
13263323ee5Smrg  $1_TRUE=
13363323ee5Smrg  $1_FALSE='#'
134ebb1c56dSmrgelse
13563323ee5Smrg  $1_TRUE='#'
13663323ee5Smrg  $1_FALSE=
13763323ee5Smrgfi
13863323ee5SmrgAC_CONFIG_COMMANDS_PRE(
13963323ee5Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14063323ee5Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14163323ee5SmrgUsually this means the macro was only invoked conditionally.]])
14263323ee5Smrgfi])])
143c7484f1fSmrg
14463323ee5Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
14563323ee5Smrg#
14663323ee5Smrg# This file is free software; the Free Software Foundation
14763323ee5Smrg# gives unlimited permission to copy and/or distribute it,
14863323ee5Smrg# with or without modifications, as long as this notice is preserved.
149c7484f1fSmrg
150ebb1c56dSmrg
15163323ee5Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15263323ee5Smrg# written in clear, in which case automake, when reading aclocal.m4,
15363323ee5Smrg# will think it sees a *use*, and therefore will trigger all it's
15463323ee5Smrg# C support machinery.  Also note that it means that autoscan, seeing
15563323ee5Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156ebb1c56dSmrg
157ebb1c56dSmrg
15863323ee5Smrg# _AM_DEPENDENCIES(NAME)
15963323ee5Smrg# ----------------------
16063323ee5Smrg# See how the compiler implements dependency checking.
16163323ee5Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16263323ee5Smrg# We try a few techniques and use that to set a single cache variable.
16363323ee5Smrg#
16463323ee5Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16563323ee5Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16663323ee5Smrg# dependency, and given that the user is not expected to run this macro,
16763323ee5Smrg# just rely on AC_PROG_CC.
16863323ee5SmrgAC_DEFUN([_AM_DEPENDENCIES],
16963323ee5Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17063323ee5SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17163323ee5SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17263323ee5SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173ebb1c56dSmrg
17463323ee5Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17563323ee5Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17663323ee5Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17763323ee5Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17863323ee5Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17963323ee5Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18063323ee5Smrg                    [depcc="$$1"   am_compiler_list=])
181baed689fSmrg
18263323ee5SmrgAC_CACHE_CHECK([dependency style of $depcc],
18363323ee5Smrg               [am_cv_$1_dependencies_compiler_type],
18463323ee5Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18563323ee5Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
18663323ee5Smrg  # making bogus files that we don't know about and never remove.  For
18763323ee5Smrg  # instance it was reported that on HP-UX the gcc test will end up
18863323ee5Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18963323ee5Smrg  # in D".
19063323ee5Smrg  rm -rf conftest.dir
19163323ee5Smrg  mkdir conftest.dir
19263323ee5Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19363323ee5Smrg  # using a relative directory.
19463323ee5Smrg  cp "$am_depcomp" conftest.dir
19563323ee5Smrg  cd conftest.dir
19663323ee5Smrg  # We will build objects and dependencies in a subdirectory because
19763323ee5Smrg  # it helps to detect inapplicable dependency modes.  For instance
19863323ee5Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19963323ee5Smrg  # side effect of compilation, but ICC will put the dependencies in
20063323ee5Smrg  # the current directory while Tru64 will put them in the object
20163323ee5Smrg  # directory.
20263323ee5Smrg  mkdir sub
203c7484f1fSmrg
20463323ee5Smrg  am_cv_$1_dependencies_compiler_type=none
20563323ee5Smrg  if test "$am_compiler_list" = ""; then
20663323ee5Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20763323ee5Smrg  fi
20863323ee5Smrg  am__universal=false
20963323ee5Smrg  m4_case([$1], [CC],
21063323ee5Smrg    [case " $depcc " in #(
21163323ee5Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21263323ee5Smrg     esac],
21363323ee5Smrg    [CXX],
21463323ee5Smrg    [case " $depcc " in #(
21563323ee5Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21663323ee5Smrg     esac])
217ebb1c56dSmrg
21863323ee5Smrg  for depmode in $am_compiler_list; do
21963323ee5Smrg    # Setup a source with many dependencies, because some compilers
22063323ee5Smrg    # like to wrap large dependency lists on column 80 (with \), and
22163323ee5Smrg    # we should not choose a depcomp mode which is confused by this.
22263323ee5Smrg    #
22363323ee5Smrg    # We need to recreate these files for each test, as the compiler may
22463323ee5Smrg    # overwrite some of them when testing with obscure command lines.
22563323ee5Smrg    # This happens at least with the AIX C compiler.
22663323ee5Smrg    : > sub/conftest.c
22763323ee5Smrg    for i in 1 2 3 4 5 6; do
22863323ee5Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22963323ee5Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23063323ee5Smrg      # Solaris 10 /bin/sh.
23163323ee5Smrg      echo '/* dummy */' > sub/conftst$i.h
23263323ee5Smrg    done
23363323ee5Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234ebb1c56dSmrg
23563323ee5Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23663323ee5Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23763323ee5Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23863323ee5Smrg    # versions had trouble with output in subdirs.
23963323ee5Smrg    am__obj=sub/conftest.${OBJEXT-o}
24063323ee5Smrg    am__minus_obj="-o $am__obj"
24163323ee5Smrg    case $depmode in
24263323ee5Smrg    gcc)
24363323ee5Smrg      # This depmode causes a compiler race in universal mode.
24463323ee5Smrg      test "$am__universal" = false || continue
24563323ee5Smrg      ;;
24663323ee5Smrg    nosideeffect)
24763323ee5Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24863323ee5Smrg      # only be used when explicitly requested.
24963323ee5Smrg      if test "x$enable_dependency_tracking" = xyes; then
25063323ee5Smrg	continue
25163323ee5Smrg      else
25263323ee5Smrg	break
25363323ee5Smrg      fi
25463323ee5Smrg      ;;
25563323ee5Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25663323ee5Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25763323ee5Smrg      # not run yet.  These depmodes are late enough in the game, and
25863323ee5Smrg      # so weak that their functioning should not be impacted.
25963323ee5Smrg      am__obj=conftest.${OBJEXT-o}
26063323ee5Smrg      am__minus_obj=
26163323ee5Smrg      ;;
26263323ee5Smrg    none) break ;;
26363323ee5Smrg    esac
26463323ee5Smrg    if depmode=$depmode \
26563323ee5Smrg       source=sub/conftest.c object=$am__obj \
26663323ee5Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26763323ee5Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26863323ee5Smrg         >/dev/null 2>conftest.err &&
26963323ee5Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27063323ee5Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27163323ee5Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27263323ee5Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27363323ee5Smrg      # icc doesn't choke on unknown options, it will just issue warnings
27463323ee5Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
27563323ee5Smrg      # that says an option was ignored or not supported.
27663323ee5Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27763323ee5Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27863323ee5Smrg      # The diagnosis changed in icc 8.0:
27963323ee5Smrg      #   icc: Command line remark: option '-MP' not supported
28063323ee5Smrg      if (grep 'ignoring option' conftest.err ||
28163323ee5Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28263323ee5Smrg        am_cv_$1_dependencies_compiler_type=$depmode
28363323ee5Smrg        break
28463323ee5Smrg      fi
28563323ee5Smrg    fi
28663323ee5Smrg  done
287ebb1c56dSmrg
28863323ee5Smrg  cd ..
28963323ee5Smrg  rm -rf conftest.dir
290c7484f1fSmrgelse
29163323ee5Smrg  am_cv_$1_dependencies_compiler_type=none
292c7484f1fSmrgfi
29363323ee5Smrg])
29463323ee5SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29563323ee5SmrgAM_CONDITIONAL([am__fastdep$1], [
29663323ee5Smrg  test "x$enable_dependency_tracking" != xno \
29763323ee5Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29863323ee5Smrg])
299c7484f1fSmrg
300c7484f1fSmrg
30163323ee5Smrg# AM_SET_DEPDIR
30263323ee5Smrg# -------------
30363323ee5Smrg# Choose a directory name for dependency files.
30463323ee5Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30563323ee5SmrgAC_DEFUN([AM_SET_DEPDIR],
30663323ee5Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30763323ee5SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30863323ee5Smrg])
309c7484f1fSmrg
310c7484f1fSmrg
31163323ee5Smrg# AM_DEP_TRACK
31263323ee5Smrg# ------------
31363323ee5SmrgAC_DEFUN([AM_DEP_TRACK],
31463323ee5Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31563323ee5SmrgAS_HELP_STRING(
31663323ee5Smrg  [--enable-dependency-tracking],
31763323ee5Smrg  [do not reject slow dependency extractors])
31863323ee5SmrgAS_HELP_STRING(
31963323ee5Smrg  [--disable-dependency-tracking],
32063323ee5Smrg  [speeds up one-time build])])
32163323ee5Smrgif test "x$enable_dependency_tracking" != xno; then
32263323ee5Smrg  am_depcomp="$ac_aux_dir/depcomp"
32363323ee5Smrg  AMDEPBACKSLASH='\'
32463323ee5Smrg  am__nodep='_no'
325ebb1c56dSmrgfi
32663323ee5SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32763323ee5SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32863323ee5Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32963323ee5SmrgAC_SUBST([am__nodep])dnl
33063323ee5Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33163323ee5Smrg])
332c7484f1fSmrg
33363323ee5Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334ebb1c56dSmrg
33563323ee5Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
33663323ee5Smrg#
33763323ee5Smrg# This file is free software; the Free Software Foundation
33863323ee5Smrg# gives unlimited permission to copy and/or distribute it,
33963323ee5Smrg# with or without modifications, as long as this notice is preserved.
340ebb1c56dSmrg
34163323ee5Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34263323ee5Smrg# ------------------------------
34363323ee5SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34463323ee5Smrg[{
34563323ee5Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
34663323ee5Smrg  # are listed without --file.  Let's play safe and only enable the eval
34763323ee5Smrg  # if we detect the quoting.
34863323ee5Smrg  # TODO: see whether this extra hack can be removed once we start
34963323ee5Smrg  # requiring Autoconf 2.70 or later.
35063323ee5Smrg  AS_CASE([$CONFIG_FILES],
35163323ee5Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
35263323ee5Smrg          [*], [set x $CONFIG_FILES])
35363323ee5Smrg  shift
35463323ee5Smrg  # Used to flag and report bootstrapping failures.
35563323ee5Smrg  am_rc=0
35663323ee5Smrg  for am_mf
35763323ee5Smrg  do
35863323ee5Smrg    # Strip MF so we end up with the name of the file.
35963323ee5Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
36063323ee5Smrg    # Check whether this is an Automake generated Makefile which includes
36163323ee5Smrg    # dependency-tracking related rules and includes.
36263323ee5Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
36363323ee5Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
36463323ee5Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
36563323ee5Smrg      || continue
36663323ee5Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
36763323ee5Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
36863323ee5Smrg    AM_RUN_LOG([cd "$am_dirpart" \
36963323ee5Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
37063323ee5Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
37163323ee5Smrg  done
37263323ee5Smrg  if test $am_rc -ne 0; then
37363323ee5Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
37463323ee5Smrg    for automatic dependency tracking.  If GNU make was not used, consider
37563323ee5Smrg    re-running the configure script with MAKE="gmake" (or whatever is
37663323ee5Smrg    necessary).  You can also try re-running configure with the
37763323ee5Smrg    '--disable-dependency-tracking' option to at least be able to build
37863323ee5Smrg    the package (albeit without support for automatic dependency tracking).])
37963323ee5Smrg  fi
38063323ee5Smrg  AS_UNSET([am_dirpart])
38163323ee5Smrg  AS_UNSET([am_filepart])
38263323ee5Smrg  AS_UNSET([am_mf])
38363323ee5Smrg  AS_UNSET([am_rc])
38463323ee5Smrg  rm -f conftest-deps.mk
38563323ee5Smrg}
38663323ee5Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387ebb1c56dSmrg
388ebb1c56dSmrg
38963323ee5Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39063323ee5Smrg# -----------------------------
39163323ee5Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392c7484f1fSmrg#
39363323ee5Smrg# This code is only required when automatic dependency tracking is enabled.
39463323ee5Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
39563323ee5Smrg# order to bootstrap the dependency handling code.
39663323ee5SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
39763323ee5Smrg[AC_CONFIG_COMMANDS([depfiles],
39863323ee5Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
39963323ee5Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400ebb1c56dSmrg
40163323ee5Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402c7484f1fSmrg
40363323ee5Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
404c7484f1fSmrg#
40563323ee5Smrg# This file is free software; the Free Software Foundation
40663323ee5Smrg# gives unlimited permission to copy and/or distribute it,
40763323ee5Smrg# with or without modifications, as long as this notice is preserved.
408c7484f1fSmrg
40963323ee5Smrg# This macro actually does too much.  Some checks are only needed if
41063323ee5Smrg# your package does certain things.  But this isn't really a big deal.
411c7484f1fSmrg
41263323ee5Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41363323ee5Smrgm4_define([AC_PROG_CC],
41463323ee5Smrgm4_defn([AC_PROG_CC])
41563323ee5Smrg[_AM_PROG_CC_C_O
41663323ee5Smrg])
417e6ecbdaeSmrg
41863323ee5Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41963323ee5Smrg# AM_INIT_AUTOMAKE([OPTIONS])
42063323ee5Smrg# -----------------------------------------------
42163323ee5Smrg# The call with PACKAGE and VERSION arguments is the old style
42263323ee5Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42363323ee5Smrg# and VERSION should now be passed to AC_INIT and removed from
42463323ee5Smrg# the call to AM_INIT_AUTOMAKE.
42563323ee5Smrg# We support both call styles for the transition.  After
42663323ee5Smrg# the next Automake release, Autoconf can make the AC_INIT
42763323ee5Smrg# arguments mandatory, and then we can depend on a new Autoconf
42863323ee5Smrg# release and drop the old call support.
42963323ee5SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43063323ee5Smrg[AC_PREREQ([2.65])dnl
43163323ee5Smrgm4_ifdef([_$0_ALREADY_INIT],
43263323ee5Smrg  [m4_fatal([$0 expanded multiple times
43363323ee5Smrg]m4_defn([_$0_ALREADY_INIT]))],
43463323ee5Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
43563323ee5Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43663323ee5Smrgdnl the ones we care about.
43763323ee5Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43863323ee5SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43963323ee5SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44063323ee5Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44163323ee5Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44263323ee5Smrg  # is not polluted with repeated "-I."
44363323ee5Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44463323ee5Smrg  # test to see if srcdir already configured
44563323ee5Smrg  if test -f $srcdir/config.status; then
44663323ee5Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44763323ee5Smrg  fi
448c7484f1fSmrgfi
449c7484f1fSmrg
45063323ee5Smrg# test whether we have cygpath
45163323ee5Smrgif test -z "$CYGPATH_W"; then
45263323ee5Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45363323ee5Smrg    CYGPATH_W='cygpath -w'
45463323ee5Smrg  else
45563323ee5Smrg    CYGPATH_W=echo
45663323ee5Smrg  fi
45763323ee5Smrgfi
45863323ee5SmrgAC_SUBST([CYGPATH_W])
459ebb1c56dSmrg
46063323ee5Smrg# Define the identity of the package.
46163323ee5Smrgdnl Distinguish between old-style and new-style calls.
46263323ee5Smrgm4_ifval([$2],
46363323ee5Smrg[AC_DIAGNOSE([obsolete],
46463323ee5Smrg             [$0: two- and three-arguments forms are deprecated.])
46563323ee5Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46663323ee5Smrg AC_SUBST([PACKAGE], [$1])dnl
46763323ee5Smrg AC_SUBST([VERSION], [$2])],
46863323ee5Smrg[_AM_SET_OPTIONS([$1])dnl
46963323ee5Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47063323ee5Smrgm4_if(
47163323ee5Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47263323ee5Smrg  [ok:ok],,
47363323ee5Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47463323ee5Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47563323ee5Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476ebb1c56dSmrg
47763323ee5Smrg_AM_IF_OPTION([no-define],,
47863323ee5Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47963323ee5Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480ebb1c56dSmrg
48163323ee5Smrg# Some tools Automake needs.
48263323ee5SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48363323ee5SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48463323ee5SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48563323ee5SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48663323ee5SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48763323ee5SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48863323ee5SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48963323ee5SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49063323ee5SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49163323ee5SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49263323ee5Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49363323ee5Smrg# dies out for good.  For more background, see:
49463323ee5Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49563323ee5Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49663323ee5SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49763323ee5Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
49863323ee5Smrg# system "awk" is bad on some platforms.
49963323ee5SmrgAC_REQUIRE([AC_PROG_AWK])dnl
50063323ee5SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50163323ee5SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50263323ee5Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50363323ee5Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50463323ee5Smrg			     [_AM_PROG_TAR([v7])])])
50563323ee5Smrg_AM_IF_OPTION([no-dependencies],,
50663323ee5Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50763323ee5Smrg		  [_AM_DEPENDENCIES([CC])],
50863323ee5Smrg		  [m4_define([AC_PROG_CC],
50963323ee5Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51063323ee5SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51163323ee5Smrg		  [_AM_DEPENDENCIES([CXX])],
51263323ee5Smrg		  [m4_define([AC_PROG_CXX],
51363323ee5Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51463323ee5SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51563323ee5Smrg		  [_AM_DEPENDENCIES([OBJC])],
51663323ee5Smrg		  [m4_define([AC_PROG_OBJC],
51763323ee5Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51863323ee5SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51963323ee5Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52063323ee5Smrg		  [m4_define([AC_PROG_OBJCXX],
52163323ee5Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52263323ee5Smrg])
52363323ee5Smrg# Variables for tags utilities; see am/tags.am
52463323ee5Smrgif test -z "$CTAGS"; then
52563323ee5Smrg  CTAGS=ctags
526c7484f1fSmrgfi
52763323ee5SmrgAC_SUBST([CTAGS])
52863323ee5Smrgif test -z "$ETAGS"; then
52963323ee5Smrg  ETAGS=etags
53063323ee5Smrgfi
53163323ee5SmrgAC_SUBST([ETAGS])
53263323ee5Smrgif test -z "$CSCOPE"; then
53363323ee5Smrg  CSCOPE=cscope
53463323ee5Smrgfi
53563323ee5SmrgAC_SUBST([CSCOPE])
536c7484f1fSmrg
53763323ee5SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
53863323ee5Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53963323ee5Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54063323ee5Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
54163323ee5SmrgAC_CONFIG_COMMANDS_PRE(dnl
54263323ee5Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
54363323ee5Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544c7484f1fSmrg
54563323ee5Smrg# POSIX will say in a future version that running "rm -f" with no argument
54663323ee5Smrg# is OK; and we want to be able to make that assumption in our Makefile
54763323ee5Smrg# recipes.  So use an aggressive probe to check that the usage we want is
54863323ee5Smrg# actually supported "in the wild" to an acceptable degree.
54963323ee5Smrg# See automake bug#10828.
55063323ee5Smrg# To make any issue more visible, cause the running configure to be aborted
55163323ee5Smrg# by default if the 'rm' program in use doesn't match our expectations; the
55263323ee5Smrg# user can still override this though.
55363323ee5Smrgif rm -f && rm -fr && rm -rf; then : OK; else
55463323ee5Smrg  cat >&2 <<'END'
55563323ee5SmrgOops!
556e6ecbdaeSmrg
55763323ee5SmrgYour 'rm' program seems unable to run without file operands specified
55863323ee5Smrgon the command line, even when the '-f' option is present.  This is contrary
55963323ee5Smrgto the behaviour of most rm programs out there, and not conforming with
56063323ee5Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561e6ecbdaeSmrg
56263323ee5SmrgPlease tell bug-automake@gnu.org about your system, including the value
56363323ee5Smrgof your $PATH and any error possibly output before this message.  This
56463323ee5Smrgcan help us improve future automake versions.
565e6ecbdaeSmrg
56663323ee5SmrgEND
56763323ee5Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
56863323ee5Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56963323ee5Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
57063323ee5Smrg    echo >&2
57163323ee5Smrg  else
57263323ee5Smrg    cat >&2 <<'END'
57363323ee5SmrgAborting the configuration process, to ensure you take notice of the issue.
574e6ecbdaeSmrg
57563323ee5SmrgYou can download and install GNU coreutils to get an 'rm' implementation
57663323ee5Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
577e6ecbdaeSmrg
57863323ee5SmrgIf you want to complete the configuration process using your problematic
57963323ee5Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
58063323ee5Smrgto "yes", and re-run configure.
581e6ecbdaeSmrg
58263323ee5SmrgEND
58363323ee5Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
58463323ee5Smrg  fi
585ebb1c56dSmrgfi
58663323ee5Smrgdnl The trailing newline in this macro's definition is deliberate, for
58763323ee5Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
58863323ee5Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
58963323ee5Smrg])
590e6ecbdaeSmrg
59163323ee5Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
59263323ee5Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
59363323ee5Smrgdnl mangled by Autoconf and run in a shell conditional statement.
59463323ee5Smrgm4_define([_AC_COMPILER_EXEEXT],
59563323ee5Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596baed689fSmrg
59763323ee5Smrg# When config.status generates a header, we must update the stamp-h file.
59863323ee5Smrg# This file resides in the same directory as the config header
59963323ee5Smrg# that is generated.  The stamp files are numbered to have different names.
600c7484f1fSmrg
60163323ee5Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
60263323ee5Smrg# loop where config.status creates the headers, so we can generate
60363323ee5Smrg# our stamp files there.
60463323ee5SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
60563323ee5Smrg[# Compute $1's index in $config_headers.
60663323ee5Smrg_am_arg=$1
60763323ee5Smrg_am_stamp_count=1
60863323ee5Smrgfor _am_header in $config_headers :; do
60963323ee5Smrg  case $_am_header in
61063323ee5Smrg    $_am_arg | $_am_arg:* )
61163323ee5Smrg      break ;;
61263323ee5Smrg    * )
61363323ee5Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
61463323ee5Smrg  esac
61563323ee5Smrgdone
61663323ee5Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617c7484f1fSmrg
61863323ee5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
619ebb1c56dSmrg#
62063323ee5Smrg# This file is free software; the Free Software Foundation
62163323ee5Smrg# gives unlimited permission to copy and/or distribute it,
62263323ee5Smrg# with or without modifications, as long as this notice is preserved.
62363323ee5Smrg
62463323ee5Smrg# AM_PROG_INSTALL_SH
62563323ee5Smrg# ------------------
62663323ee5Smrg# Define $install_sh.
62763323ee5SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
62863323ee5Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
62963323ee5Smrgif test x"${install_sh+set}" != xset; then
63063323ee5Smrg  case $am_aux_dir in
63163323ee5Smrg  *\ * | *\	*)
63263323ee5Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
63363323ee5Smrg  *)
63463323ee5Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
63563323ee5Smrg  esac
63663323ee5Smrgfi
63763323ee5SmrgAC_SUBST([install_sh])])
63863323ee5Smrg
63963323ee5Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
640ebb1c56dSmrg#
64163323ee5Smrg# This file is free software; the Free Software Foundation
64263323ee5Smrg# gives unlimited permission to copy and/or distribute it,
64363323ee5Smrg# with or without modifications, as long as this notice is preserved.
644c7484f1fSmrg
64563323ee5Smrg# Check whether the underlying file-system supports filenames
64663323ee5Smrg# with a leading dot.  For instance MS-DOS doesn't.
64763323ee5SmrgAC_DEFUN([AM_SET_LEADING_DOT],
64863323ee5Smrg[rm -rf .tst 2>/dev/null
64963323ee5Smrgmkdir .tst 2>/dev/null
65063323ee5Smrgif test -d .tst; then
65163323ee5Smrg  am__leading_dot=.
652c7484f1fSmrgelse
65363323ee5Smrg  am__leading_dot=_
654c7484f1fSmrgfi
65563323ee5Smrgrmdir .tst 2>/dev/null
65663323ee5SmrgAC_SUBST([am__leading_dot])])
657c7484f1fSmrg
65863323ee5Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659c7484f1fSmrg
66063323ee5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
66163323ee5Smrg#
66263323ee5Smrg# This file is free software; the Free Software Foundation
66363323ee5Smrg# gives unlimited permission to copy and/or distribute it,
66463323ee5Smrg# with or without modifications, as long as this notice is preserved.
665c7484f1fSmrg
66663323ee5Smrg# AM_MAKE_INCLUDE()
66763323ee5Smrg# -----------------
66863323ee5Smrg# Check whether make has an 'include' directive that can support all
66963323ee5Smrg# the idioms we need for our automatic dependency tracking code.
67063323ee5SmrgAC_DEFUN([AM_MAKE_INCLUDE],
67163323ee5Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
67263323ee5Smrgcat > confinc.mk << 'END'
67363323ee5Smrgam__doit:
67463323ee5Smrg	@echo this is the am__doit target >confinc.out
67563323ee5Smrg.PHONY: am__doit
67663323ee5SmrgEND
67763323ee5Smrgam__include="#"
67863323ee5Smrgam__quote=
67963323ee5Smrg# BSD make does it like this.
68063323ee5Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
68163323ee5Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
68263323ee5Smrgecho 'include confinc.mk # ignored' > confmf.GNU
68363323ee5Smrg_am_result=no
68463323ee5Smrgfor s in GNU BSD; do
68563323ee5Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
68663323ee5Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
68763323ee5Smrg      ['0:this is the am__doit target'],
68863323ee5Smrg      [AS_CASE([$s],
68963323ee5Smrg          [BSD], [am__include='.include' am__quote='"'],
69063323ee5Smrg          [am__include='include' am__quote=''])])
69163323ee5Smrg  if test "$am__include" != "#"; then
69263323ee5Smrg    _am_result="yes ($s style)"
69363323ee5Smrg    break
69463323ee5Smrg  fi
69563323ee5Smrgdone
69663323ee5Smrgrm -f confinc.* confmf.*
69763323ee5SmrgAC_MSG_RESULT([${_am_result}])
69863323ee5SmrgAC_SUBST([am__include])])
69963323ee5SmrgAC_SUBST([am__quote])])
70063323ee5Smrg
70163323ee5Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
70263323ee5Smrg
70363323ee5Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
704c7484f1fSmrg#
70563323ee5Smrg# This file is free software; the Free Software Foundation
70663323ee5Smrg# gives unlimited permission to copy and/or distribute it,
70763323ee5Smrg# with or without modifications, as long as this notice is preserved.
708c7484f1fSmrg
70963323ee5Smrg# AM_MISSING_PROG(NAME, PROGRAM)
71063323ee5Smrg# ------------------------------
71163323ee5SmrgAC_DEFUN([AM_MISSING_PROG],
71263323ee5Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71363323ee5Smrg$1=${$1-"${am_missing_run}$2"}
71463323ee5SmrgAC_SUBST($1)])
71563323ee5Smrg
71663323ee5Smrg# AM_MISSING_HAS_RUN
71763323ee5Smrg# ------------------
71863323ee5Smrg# Define MISSING if not defined so far and test if it is modern enough.
71963323ee5Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
72063323ee5SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
72163323ee5Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
72263323ee5SmrgAC_REQUIRE_AUX_FILE([missing])dnl
72363323ee5Smrgif test x"${MISSING+set}" != xset; then
72463323ee5Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
72563323ee5Smrgfi
72663323ee5Smrg# Use eval to expand $SHELL
72763323ee5Smrgif eval "$MISSING --is-lightweight"; then
72863323ee5Smrg  am_missing_run="$MISSING "
729c7484f1fSmrgelse
73063323ee5Smrg  am_missing_run=
73163323ee5Smrg  AC_MSG_WARN(['missing' script is too old or missing])
732c7484f1fSmrgfi
73363323ee5Smrg])
734c7484f1fSmrg
73563323ee5Smrg# Helper functions for option handling.                     -*- Autoconf -*-
736c7484f1fSmrg
73763323ee5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
738ebb1c56dSmrg#
73963323ee5Smrg# This file is free software; the Free Software Foundation
74063323ee5Smrg# gives unlimited permission to copy and/or distribute it,
74163323ee5Smrg# with or without modifications, as long as this notice is preserved.
74263323ee5Smrg
74363323ee5Smrg# _AM_MANGLE_OPTION(NAME)
74463323ee5Smrg# -----------------------
74563323ee5SmrgAC_DEFUN([_AM_MANGLE_OPTION],
74663323ee5Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
74763323ee5Smrg
74863323ee5Smrg# _AM_SET_OPTION(NAME)
74963323ee5Smrg# --------------------
75063323ee5Smrg# Set option NAME.  Presently that only means defining a flag for this option.
75163323ee5SmrgAC_DEFUN([_AM_SET_OPTION],
75263323ee5Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
75363323ee5Smrg
75463323ee5Smrg# _AM_SET_OPTIONS(OPTIONS)
75563323ee5Smrg# ------------------------
75663323ee5Smrg# OPTIONS is a space-separated list of Automake options.
75763323ee5SmrgAC_DEFUN([_AM_SET_OPTIONS],
75863323ee5Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
75963323ee5Smrg
76063323ee5Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76163323ee5Smrg# -------------------------------------------
76263323ee5Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76363323ee5SmrgAC_DEFUN([_AM_IF_OPTION],
76463323ee5Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76563323ee5Smrg
76663323ee5Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
767ebb1c56dSmrg#
76863323ee5Smrg# This file is free software; the Free Software Foundation
76963323ee5Smrg# gives unlimited permission to copy and/or distribute it,
77063323ee5Smrg# with or without modifications, as long as this notice is preserved.
771c7484f1fSmrg
77263323ee5Smrg# _AM_PROG_CC_C_O
77363323ee5Smrg# ---------------
77463323ee5Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77563323ee5Smrg# to automatically call this.
77663323ee5SmrgAC_DEFUN([_AM_PROG_CC_C_O],
77763323ee5Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
77863323ee5SmrgAC_REQUIRE_AUX_FILE([compile])dnl
77963323ee5SmrgAC_LANG_PUSH([C])dnl
78063323ee5SmrgAC_CACHE_CHECK(
78163323ee5Smrg  [whether $CC understands -c and -o together],
78263323ee5Smrg  [am_cv_prog_cc_c_o],
78363323ee5Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78463323ee5Smrg  # Make sure it works both with $CC and with simple cc.
78563323ee5Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78663323ee5Smrg  # compilers refuse to overwrite an existing .o file with -o,
78763323ee5Smrg  # though they will create one.
78863323ee5Smrg  am_cv_prog_cc_c_o=yes
78963323ee5Smrg  for am_i in 1 2; do
79063323ee5Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79163323ee5Smrg         && test -f conftest2.$ac_objext; then
79263323ee5Smrg      : OK
79363323ee5Smrg    else
79463323ee5Smrg      am_cv_prog_cc_c_o=no
79563323ee5Smrg      break
79663323ee5Smrg    fi
79763323ee5Smrg  done
79863323ee5Smrg  rm -f core conftest*
79963323ee5Smrg  unset am_i])
80063323ee5Smrgif test "$am_cv_prog_cc_c_o" != yes; then
80163323ee5Smrg   # Losing compiler, so override with the script.
80263323ee5Smrg   # FIXME: It is wrong to rewrite CC.
80363323ee5Smrg   # But if we don't then we get into trouble of one sort or another.
80463323ee5Smrg   # A longer-term fix would be to have automake use am__CC in this case,
80563323ee5Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80663323ee5Smrg   CC="$am_aux_dir/compile $CC"
807ebb1c56dSmrgfi
80863323ee5SmrgAC_LANG_POP([C])])
809c7484f1fSmrg
81063323ee5Smrg# For backward compatibility.
81163323ee5SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
812c7484f1fSmrg
81363323ee5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
814e6ecbdaeSmrg#
81563323ee5Smrg# This file is free software; the Free Software Foundation
81663323ee5Smrg# gives unlimited permission to copy and/or distribute it,
81763323ee5Smrg# with or without modifications, as long as this notice is preserved.
81863323ee5Smrg
81963323ee5Smrg# AM_RUN_LOG(COMMAND)
82063323ee5Smrg# -------------------
82163323ee5Smrg# Run COMMAND, save the exit status in ac_status, and log it.
82263323ee5Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82363323ee5SmrgAC_DEFUN([AM_RUN_LOG],
82463323ee5Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82563323ee5Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82663323ee5Smrg   ac_status=$?
82763323ee5Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
82863323ee5Smrg   (exit $ac_status); }])
82963323ee5Smrg
83063323ee5Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
83163323ee5Smrg
83263323ee5Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
833ebb1c56dSmrg#
83463323ee5Smrg# This file is free software; the Free Software Foundation
83563323ee5Smrg# gives unlimited permission to copy and/or distribute it,
83663323ee5Smrg# with or without modifications, as long as this notice is preserved.
837c7484f1fSmrg
83863323ee5Smrg# AM_SANITY_CHECK
83963323ee5Smrg# ---------------
84063323ee5SmrgAC_DEFUN([AM_SANITY_CHECK],
84163323ee5Smrg[AC_MSG_CHECKING([whether build environment is sane])
84263323ee5Smrg# Reject unsafe characters in $srcdir or the absolute working directory
84363323ee5Smrg# name.  Accept space and tab only in the latter.
84463323ee5Smrgam_lf='
84563323ee5Smrg'
84663323ee5Smrgcase `pwd` in
84763323ee5Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
84863323ee5Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
84963323ee5Smrgesac
85063323ee5Smrgcase $srcdir in
85163323ee5Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85263323ee5Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
85363323ee5Smrgesac
85463323ee5Smrg
85563323ee5Smrg# Do 'set' in a subshell so we don't clobber the current shell's
85663323ee5Smrg# arguments.  Must try -L first in case configure is actually a
85763323ee5Smrg# symlink; some systems play weird games with the mod time of symlinks
85863323ee5Smrg# (eg FreeBSD returns the mod time of the symlink's containing
85963323ee5Smrg# directory).
86063323ee5Smrgif (
86163323ee5Smrg   am_has_slept=no
86263323ee5Smrg   for am_try in 1 2; do
86363323ee5Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86463323ee5Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86563323ee5Smrg     if test "$[*]" = "X"; then
86663323ee5Smrg	# -L didn't work.
86763323ee5Smrg	set X `ls -t "$srcdir/configure" conftest.file`
86863323ee5Smrg     fi
86963323ee5Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
87063323ee5Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
87163323ee5Smrg
87263323ee5Smrg	# If neither matched, then we have a broken ls.  This can happen
87363323ee5Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87463323ee5Smrg	# broken ls alias from the environment.  This has actually
87563323ee5Smrg	# happened.  Such a system could not be considered "sane".
87663323ee5Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87763323ee5Smrg  alias in your environment])
87863323ee5Smrg     fi
87963323ee5Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
88063323ee5Smrg       break
88163323ee5Smrg     fi
88263323ee5Smrg     # Just in case.
88363323ee5Smrg     sleep 1
88463323ee5Smrg     am_has_slept=yes
88563323ee5Smrg   done
88663323ee5Smrg   test "$[2]" = conftest.file
88763323ee5Smrg   )
88863323ee5Smrgthen
88963323ee5Smrg   # Ok.
89063323ee5Smrg   :
891ebb1c56dSmrgelse
89263323ee5Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
89363323ee5SmrgCheck your system clock])
894ebb1c56dSmrgfi
89563323ee5SmrgAC_MSG_RESULT([yes])
89663323ee5Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89763323ee5Smrg# generated files are strictly newer.
89863323ee5Smrgam_sleep_pid=
89963323ee5Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
90063323ee5Smrg  ( sleep 1 ) &
90163323ee5Smrg  am_sleep_pid=$!
90263323ee5Smrgfi
90363323ee5SmrgAC_CONFIG_COMMANDS_PRE(
90463323ee5Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90563323ee5Smrg   if test -n "$am_sleep_pid"; then
90663323ee5Smrg     # Hide warnings about reused PIDs.
90763323ee5Smrg     wait $am_sleep_pid 2>/dev/null
90863323ee5Smrg   fi
90963323ee5Smrg   AC_MSG_RESULT([done])])
91063323ee5Smrgrm -f conftest.file
91163323ee5Smrg])
912baed689fSmrg
91363323ee5Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
914ebb1c56dSmrg#
91563323ee5Smrg# This file is free software; the Free Software Foundation
91663323ee5Smrg# gives unlimited permission to copy and/or distribute it,
91763323ee5Smrg# with or without modifications, as long as this notice is preserved.
918e6ecbdaeSmrg
91963323ee5Smrg# AM_SILENT_RULES([DEFAULT])
92063323ee5Smrg# --------------------------
92163323ee5Smrg# Enable less verbose build rules; with the default set to DEFAULT
92263323ee5Smrg# ("yes" being less verbose, "no" or empty being verbose).
92363323ee5SmrgAC_DEFUN([AM_SILENT_RULES],
92463323ee5Smrg[AC_ARG_ENABLE([silent-rules], [dnl
92563323ee5SmrgAS_HELP_STRING(
92663323ee5Smrg  [--enable-silent-rules],
92763323ee5Smrg  [less verbose build output (undo: "make V=1")])
92863323ee5SmrgAS_HELP_STRING(
92963323ee5Smrg  [--disable-silent-rules],
93063323ee5Smrg  [verbose build output (undo: "make V=0")])dnl
93163323ee5Smrg])
93263323ee5Smrgcase $enable_silent_rules in @%:@ (((
93363323ee5Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
93463323ee5Smrg   no) AM_DEFAULT_VERBOSITY=1;;
93563323ee5Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
93663323ee5Smrgesac
93763323ee5Smrgdnl
93863323ee5Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
93963323ee5Smrgdnl do not support nested variable expansions.
94063323ee5Smrgdnl See automake bug#9928 and bug#10237.
94163323ee5Smrgam_make=${MAKE-make}
94263323ee5SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94363323ee5Smrg   [am_cv_make_support_nested_variables],
94463323ee5Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94563323ee5SmrgBAR0=false
94663323ee5SmrgBAR1=true
94763323ee5SmrgV=1
94863323ee5Smrgam__doit:
94963323ee5Smrg	@$(TRUE)
95063323ee5Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95163323ee5Smrg  am_cv_make_support_nested_variables=yes
952c7484f1fSmrgelse
95363323ee5Smrg  am_cv_make_support_nested_variables=no
954ebb1c56dSmrgfi])
95563323ee5Smrgif test $am_cv_make_support_nested_variables = yes; then
95663323ee5Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95763323ee5Smrg  AM_V='$(V)'
95863323ee5Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
95963323ee5Smrgelse
96063323ee5Smrg  AM_V=$AM_DEFAULT_VERBOSITY
96163323ee5Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962e6ecbdaeSmrgfi
96363323ee5SmrgAC_SUBST([AM_V])dnl
96463323ee5SmrgAM_SUBST_NOTMAKE([AM_V])dnl
96563323ee5SmrgAC_SUBST([AM_DEFAULT_V])dnl
96663323ee5SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
96763323ee5SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
96863323ee5SmrgAM_BACKSLASH='\'
96963323ee5SmrgAC_SUBST([AM_BACKSLASH])dnl
97063323ee5Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
97163323ee5Smrg])
972c7484f1fSmrg
97363323ee5Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
97463323ee5Smrg#
97563323ee5Smrg# This file is free software; the Free Software Foundation
97663323ee5Smrg# gives unlimited permission to copy and/or distribute it,
97763323ee5Smrg# with or without modifications, as long as this notice is preserved.
978baed689fSmrg
97963323ee5Smrg# AM_PROG_INSTALL_STRIP
98063323ee5Smrg# ---------------------
98163323ee5Smrg# One issue with vendor 'install' (even GNU) is that you can't
98263323ee5Smrg# specify the program used to strip binaries.  This is especially
98363323ee5Smrg# annoying in cross-compiling environments, where the build's strip
98463323ee5Smrg# is unlikely to handle the host's binaries.
98563323ee5Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98663323ee5Smrg# always use install-sh in "make install-strip", and initialize
98763323ee5Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
98863323ee5SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
98963323ee5Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
99063323ee5Smrg# Installed binaries are usually stripped using 'strip' when the user
99163323ee5Smrg# run "make install-strip".  However 'strip' might not be the right
99263323ee5Smrg# tool to use in cross-compilation environments, therefore Automake
99363323ee5Smrg# will honor the 'STRIP' environment variable to overrule this program.
99463323ee5Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99563323ee5Smrgif test "$cross_compiling" != no; then
99663323ee5Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
99763323ee5Smrgfi
99863323ee5SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
99963323ee5SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
100063323ee5Smrg
100163323ee5Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
1002c7484f1fSmrg#
100363323ee5Smrg# This file is free software; the Free Software Foundation
100463323ee5Smrg# gives unlimited permission to copy and/or distribute it,
100563323ee5Smrg# with or without modifications, as long as this notice is preserved.
1006c7484f1fSmrg
100763323ee5Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
100863323ee5Smrg# ---------------------------
100963323ee5Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101063323ee5Smrg# This macro is traced by Automake.
101163323ee5SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1012c7484f1fSmrg
101363323ee5Smrg# AM_SUBST_NOTMAKE(VARIABLE)
101463323ee5Smrg# --------------------------
101563323ee5Smrg# Public sister of _AM_SUBST_NOTMAKE.
101663323ee5SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1017baed689fSmrg
101863323ee5Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1019c7484f1fSmrg
102063323ee5Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
1021c7484f1fSmrg#
102263323ee5Smrg# This file is free software; the Free Software Foundation
102363323ee5Smrg# gives unlimited permission to copy and/or distribute it,
102463323ee5Smrg# with or without modifications, as long as this notice is preserved.
102563323ee5Smrg
102663323ee5Smrg# _AM_PROG_TAR(FORMAT)
102763323ee5Smrg# --------------------
102863323ee5Smrg# Check how to create a tarball in format FORMAT.
102963323ee5Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1030c7484f1fSmrg#
103163323ee5Smrg# Substitute a variable $(am__tar) that is a command
103263323ee5Smrg# writing to stdout a FORMAT-tarball containing the directory
103363323ee5Smrg# $tardir.
103463323ee5Smrg#     tardir=directory && $(am__tar) > result.tar
1035c7484f1fSmrg#
103663323ee5Smrg# Substitute a variable $(am__untar) that extract such
103763323ee5Smrg# a tarball read from stdin.
103863323ee5Smrg#     $(am__untar) < result.tar
1039e6ecbdaeSmrg#
104063323ee5SmrgAC_DEFUN([_AM_PROG_TAR],
104163323ee5Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104263323ee5Smrg# in the wild :-(  We should find a proper way to deprecate it ...
104363323ee5SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1044c7484f1fSmrg
104563323ee5Smrg# We'll loop over all known methods to create a tar archive until one works.
104663323ee5Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047e6ecbdaeSmrg
104863323ee5Smrgm4_if([$1], [v7],
104963323ee5Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050c7484f1fSmrg
105163323ee5Smrg  [m4_case([$1],
105263323ee5Smrg    [ustar],
105363323ee5Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105463323ee5Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105563323ee5Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105663323ee5Smrg      # and bug#13588).
105763323ee5Smrg      am_max_uid=2097151 # 2^21 - 1
105863323ee5Smrg      am_max_gid=$am_max_uid
105963323ee5Smrg      # The $UID and $GID variables are not portable, so we need to resort
106063323ee5Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106163323ee5Smrg      # below are definitely unexpected, so allow the users to see them
106263323ee5Smrg      # (that is, avoid stderr redirection).
106363323ee5Smrg      am_uid=`id -u || echo unknown`
106463323ee5Smrg      am_gid=`id -g || echo unknown`
106563323ee5Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106663323ee5Smrg      if test $am_uid -le $am_max_uid; then
106763323ee5Smrg         AC_MSG_RESULT([yes])
106863323ee5Smrg      else
106963323ee5Smrg         AC_MSG_RESULT([no])
107063323ee5Smrg         _am_tools=none
107163323ee5Smrg      fi
107263323ee5Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107363323ee5Smrg      if test $am_gid -le $am_max_gid; then
107463323ee5Smrg         AC_MSG_RESULT([yes])
107563323ee5Smrg      else
107663323ee5Smrg        AC_MSG_RESULT([no])
107763323ee5Smrg        _am_tools=none
107863323ee5Smrg      fi],
1079c7484f1fSmrg
108063323ee5Smrg  [pax],
108163323ee5Smrg    [],
1082c7484f1fSmrg
108363323ee5Smrg  [m4_fatal([Unknown tar format])])
1084e6ecbdaeSmrg
108563323ee5Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
108663323ee5Smrg
108763323ee5Smrg  # Go ahead even if we have the value already cached.  We do so because we
108863323ee5Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
108963323ee5Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
109063323ee5Smrg
109163323ee5Smrg  for _am_tool in $_am_tools; do
109263323ee5Smrg    case $_am_tool in
109363323ee5Smrg    gnutar)
109463323ee5Smrg      for _am_tar in tar gnutar gtar; do
109563323ee5Smrg        AM_RUN_LOG([$_am_tar --version]) && break
109663323ee5Smrg      done
109763323ee5Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
109863323ee5Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
109963323ee5Smrg      am__untar="$_am_tar -xf -"
110063323ee5Smrg      ;;
110163323ee5Smrg    plaintar)
110263323ee5Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110363323ee5Smrg      # ustar tarball either.
110463323ee5Smrg      (tar --version) >/dev/null 2>&1 && continue
110563323ee5Smrg      am__tar='tar chf - "$$tardir"'
110663323ee5Smrg      am__tar_='tar chf - "$tardir"'
110763323ee5Smrg      am__untar='tar xf -'
110863323ee5Smrg      ;;
110963323ee5Smrg    pax)
111063323ee5Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
111163323ee5Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
111263323ee5Smrg      am__untar='pax -r'
111363323ee5Smrg      ;;
111463323ee5Smrg    cpio)
111563323ee5Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111663323ee5Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111763323ee5Smrg      am__untar='cpio -i -H $1 -d'
111863323ee5Smrg      ;;
111963323ee5Smrg    none)
112063323ee5Smrg      am__tar=false
112163323ee5Smrg      am__tar_=false
112263323ee5Smrg      am__untar=false
112363323ee5Smrg      ;;
112463323ee5Smrg    esac
112563323ee5Smrg
112663323ee5Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
112763323ee5Smrg    # and am__untar set.
112863323ee5Smrg    test -n "${am_cv_prog_tar_$1}" && break
112963323ee5Smrg
113063323ee5Smrg    # tar/untar a dummy directory, and stop if the command works.
113163323ee5Smrg    rm -rf conftest.dir
113263323ee5Smrg    mkdir conftest.dir
113363323ee5Smrg    echo GrepMe > conftest.dir/file
113463323ee5Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113563323ee5Smrg    rm -rf conftest.dir
113663323ee5Smrg    if test -s conftest.tar; then
113763323ee5Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
113863323ee5Smrg      AM_RUN_LOG([cat conftest.dir/file])
113963323ee5Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
114063323ee5Smrg    fi
114163323ee5Smrg  done
114263323ee5Smrg  rm -rf conftest.dir
114363323ee5Smrg
114463323ee5Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114563323ee5Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
114663323ee5Smrg
114763323ee5SmrgAC_SUBST([am__tar])
114863323ee5SmrgAC_SUBST([am__untar])
114963323ee5Smrg]) # _AM_PROG_TAR
115063323ee5Smrg
115163323ee5Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
115263323ee5Smrgdnl serial 11 (pkg-config-0.29)
115363323ee5Smrgdnl
115463323ee5Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
115563323ee5Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
115663323ee5Smrgdnl
115763323ee5Smrgdnl This program is free software; you can redistribute it and/or modify
115863323ee5Smrgdnl it under the terms of the GNU General Public License as published by
115963323ee5Smrgdnl the Free Software Foundation; either version 2 of the License, or
116063323ee5Smrgdnl (at your option) any later version.
116163323ee5Smrgdnl
116263323ee5Smrgdnl This program is distributed in the hope that it will be useful, but
116363323ee5Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
116463323ee5Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
116563323ee5Smrgdnl General Public License for more details.
116663323ee5Smrgdnl
116763323ee5Smrgdnl You should have received a copy of the GNU General Public License
116863323ee5Smrgdnl along with this program; if not, write to the Free Software
116963323ee5Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
117063323ee5Smrgdnl 02111-1307, USA.
117163323ee5Smrgdnl
117263323ee5Smrgdnl As a special exception to the GNU General Public License, if you
117363323ee5Smrgdnl distribute this file as part of a program that contains a
117463323ee5Smrgdnl configuration script generated by Autoconf, you may include it under
117563323ee5Smrgdnl the same distribution terms that you use for the rest of that
117663323ee5Smrgdnl program.
117763323ee5Smrg
117863323ee5Smrgdnl PKG_PREREQ(MIN-VERSION)
117963323ee5Smrgdnl -----------------------
118063323ee5Smrgdnl Since: 0.29
118163323ee5Smrgdnl
118263323ee5Smrgdnl Verify that the version of the pkg-config macros are at least
118363323ee5Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
118463323ee5Smrgdnl installed version of pkg-config, this checks the developer's version
118563323ee5Smrgdnl of pkg.m4 when generating configure.
118663323ee5Smrgdnl
118763323ee5Smrgdnl To ensure that this macro is defined, also add:
118863323ee5Smrgdnl m4_ifndef([PKG_PREREQ],
118963323ee5Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
119063323ee5Smrgdnl
119163323ee5Smrgdnl See the "Since" comment for each macro you use to see what version
119263323ee5Smrgdnl of the macros you require.
119363323ee5Smrgm4_defun([PKG_PREREQ],
119463323ee5Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
119563323ee5Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
119663323ee5Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
119763323ee5Smrg])dnl PKG_PREREQ
119863323ee5Smrg
119963323ee5Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
120063323ee5Smrgdnl ----------------------------------
120163323ee5Smrgdnl Since: 0.16
120263323ee5Smrgdnl
120363323ee5Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
120463323ee5Smrgdnl first found in the path. Checks that the version of pkg-config found
120563323ee5Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
120663323ee5Smrgdnl used since that's the first version where most current features of
120763323ee5Smrgdnl pkg-config existed.
120863323ee5SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
120963323ee5Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
121063323ee5Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
121163323ee5Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
121263323ee5SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
121363323ee5SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
121463323ee5SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
121563323ee5Smrg
121663323ee5Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
121763323ee5Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218ebb1c56dSmrgfi
121963323ee5Smrgif test -n "$PKG_CONFIG"; then
122063323ee5Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
122163323ee5Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
122263323ee5Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
122363323ee5Smrg		AC_MSG_RESULT([yes])
122463323ee5Smrg	else
122563323ee5Smrg		AC_MSG_RESULT([no])
122663323ee5Smrg		PKG_CONFIG=""
122763323ee5Smrg	fi
122863323ee5Smrgfi[]dnl
122963323ee5Smrg])dnl PKG_PROG_PKG_CONFIG
1230e6ecbdaeSmrg
123163323ee5Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
123263323ee5Smrgdnl -------------------------------------------------------------------
123363323ee5Smrgdnl Since: 0.18
123463323ee5Smrgdnl
123563323ee5Smrgdnl Check to see whether a particular set of modules exists. Similar to
123663323ee5Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
123763323ee5Smrgdnl
123863323ee5Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
123963323ee5Smrgdnl only at the first occurence in configure.ac, so if the first place
124063323ee5Smrgdnl it's called might be skipped (such as if it is within an "if", you
124163323ee5Smrgdnl have to call PKG_CHECK_EXISTS manually
124263323ee5SmrgAC_DEFUN([PKG_CHECK_EXISTS],
124363323ee5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
124463323ee5Smrgif test -n "$PKG_CONFIG" && \
124563323ee5Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
124663323ee5Smrg  m4_default([$2], [:])
124763323ee5Smrgm4_ifvaln([$3], [else
124863323ee5Smrg  $3])dnl
124963323ee5Smrgfi])
1250e6ecbdaeSmrg
125163323ee5Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
125263323ee5Smrgdnl ---------------------------------------------
125363323ee5Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
125463323ee5Smrgdnl pkg_failed based on the result.
125563323ee5Smrgm4_define([_PKG_CONFIG],
125663323ee5Smrg[if test -n "$$1"; then
125763323ee5Smrg    pkg_cv_[]$1="$$1"
125863323ee5Smrg elif test -n "$PKG_CONFIG"; then
125963323ee5Smrg    PKG_CHECK_EXISTS([$3],
126063323ee5Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
126163323ee5Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
126263323ee5Smrg		     [pkg_failed=yes])
126363323ee5Smrg else
126463323ee5Smrg    pkg_failed=untried
126563323ee5Smrgfi[]dnl
126663323ee5Smrg])dnl _PKG_CONFIG
1267e6ecbdaeSmrg
126863323ee5Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
126963323ee5Smrgdnl ---------------------------
127063323ee5Smrgdnl Internal check to see if pkg-config supports short errors.
127163323ee5SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
127263323ee5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
127363323ee5Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
127463323ee5Smrg        _pkg_short_errors_supported=yes
127563323ee5Smrgelse
127663323ee5Smrg        _pkg_short_errors_supported=no
127763323ee5Smrgfi[]dnl
127863323ee5Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279e6ecbdaeSmrg
1280e6ecbdaeSmrg
128163323ee5Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
128263323ee5Smrgdnl   [ACTION-IF-NOT-FOUND])
128363323ee5Smrgdnl --------------------------------------------------------------
128463323ee5Smrgdnl Since: 0.4.0
128563323ee5Smrgdnl
128663323ee5Smrgdnl Note that if there is a possibility the first call to
128763323ee5Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
128863323ee5Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
128963323ee5SmrgAC_DEFUN([PKG_CHECK_MODULES],
129063323ee5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
129163323ee5SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
129263323ee5SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
129363323ee5Smrg
129463323ee5Smrgpkg_failed=no
129563323ee5SmrgAC_MSG_CHECKING([for $1])
129663323ee5Smrg
129763323ee5Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
129863323ee5Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
129963323ee5Smrg
130063323ee5Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
130163323ee5Smrgand $1[]_LIBS to avoid the need to call pkg-config.
130263323ee5SmrgSee the pkg-config man page for more details.])
130363323ee5Smrg
130463323ee5Smrgif test $pkg_failed = yes; then
130563323ee5Smrg   	AC_MSG_RESULT([no])
130663323ee5Smrg        _PKG_SHORT_ERRORS_SUPPORTED
130763323ee5Smrg        if test $_pkg_short_errors_supported = yes; then
130863323ee5Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
130963323ee5Smrg        else 
131063323ee5Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
131163323ee5Smrg        fi
131263323ee5Smrg	# Put the nasty error message in config.log where it belongs
131363323ee5Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
131463323ee5Smrg
131563323ee5Smrg	m4_default([$4], [AC_MSG_ERROR(
131663323ee5Smrg[Package requirements ($2) were not met:
131763323ee5Smrg
131863323ee5Smrg$$1_PKG_ERRORS
131963323ee5Smrg
132063323ee5SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
132163323ee5Smrginstalled software in a non-standard prefix.
132263323ee5Smrg
132363323ee5Smrg_PKG_TEXT])[]dnl
132463323ee5Smrg        ])
132563323ee5Smrgelif test $pkg_failed = untried; then
132663323ee5Smrg     	AC_MSG_RESULT([no])
132763323ee5Smrg	m4_default([$4], [AC_MSG_FAILURE(
132863323ee5Smrg[The pkg-config script could not be found or is too old.  Make sure it
132963323ee5Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
133063323ee5Smrgpath to pkg-config.
133163323ee5Smrg
133263323ee5Smrg_PKG_TEXT
133363323ee5Smrg
133463323ee5SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
133563323ee5Smrg        ])
133663323ee5Smrgelse
133763323ee5Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
133863323ee5Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
133963323ee5Smrg        AC_MSG_RESULT([yes])
134063323ee5Smrg	$3
134163323ee5Smrgfi[]dnl
134263323ee5Smrg])dnl PKG_CHECK_MODULES
134363323ee5Smrg
134463323ee5Smrg
134563323ee5Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
134663323ee5Smrgdnl   [ACTION-IF-NOT-FOUND])
134763323ee5Smrgdnl ---------------------------------------------------------------------
134863323ee5Smrgdnl Since: 0.29
134963323ee5Smrgdnl
135063323ee5Smrgdnl Checks for existence of MODULES and gathers its build flags with
135163323ee5Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
135263323ee5Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
135363323ee5Smrgdnl
135463323ee5Smrgdnl Note that if there is a possibility the first call to
135563323ee5Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
135663323ee5Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
135763323ee5Smrgdnl configure.ac.
135863323ee5SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
135963323ee5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
136063323ee5Smrg_save_PKG_CONFIG=$PKG_CONFIG
136163323ee5SmrgPKG_CONFIG="$PKG_CONFIG --static"
136263323ee5SmrgPKG_CHECK_MODULES($@)
136363323ee5SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
136463323ee5Smrg])dnl PKG_CHECK_MODULES_STATIC
136563323ee5Smrg
136663323ee5Smrg
136763323ee5Smrgdnl PKG_INSTALLDIR([DIRECTORY])
136863323ee5Smrgdnl -------------------------
136963323ee5Smrgdnl Since: 0.27
137063323ee5Smrgdnl
137163323ee5Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
137263323ee5Smrgdnl should install pkg-config .pc files. By default the directory is
137363323ee5Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
137463323ee5Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
137563323ee5Smrgdnl parameter.
137663323ee5SmrgAC_DEFUN([PKG_INSTALLDIR],
137763323ee5Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
137863323ee5Smrgm4_pushdef([pkg_description],
137963323ee5Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
138063323ee5SmrgAC_ARG_WITH([pkgconfigdir],
138163323ee5Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
138263323ee5Smrg    [with_pkgconfigdir=]pkg_default)
138363323ee5SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
138463323ee5Smrgm4_popdef([pkg_default])
138563323ee5Smrgm4_popdef([pkg_description])
138663323ee5Smrg])dnl PKG_INSTALLDIR
138763323ee5Smrg
1388e6ecbdaeSmrg
138963323ee5Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
139063323ee5Smrgdnl --------------------------------
139163323ee5Smrgdnl Since: 0.27
139263323ee5Smrgdnl
139363323ee5Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
139463323ee5Smrgdnl module should install arch-independent pkg-config .pc files. By
139563323ee5Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
139663323ee5Smrgdnl changed by passing DIRECTORY. The user can override through the
139763323ee5Smrgdnl --with-noarch-pkgconfigdir parameter.
139863323ee5SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
139963323ee5Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
140063323ee5Smrgm4_pushdef([pkg_description],
140163323ee5Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
140263323ee5SmrgAC_ARG_WITH([noarch-pkgconfigdir],
140363323ee5Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
140463323ee5Smrg    [with_noarch_pkgconfigdir=]pkg_default)
140563323ee5SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
140663323ee5Smrgm4_popdef([pkg_default])
140763323ee5Smrgm4_popdef([pkg_description])
140863323ee5Smrg])dnl PKG_NOARCH_INSTALLDIR
1409e6ecbdaeSmrg
1410e6ecbdaeSmrg
141163323ee5Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
141263323ee5Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
141363323ee5Smrgdnl -------------------------------------------
141463323ee5Smrgdnl Since: 0.28
141563323ee5Smrgdnl
141663323ee5Smrgdnl Retrieves the value of the pkg-config variable for the given module.
141763323ee5SmrgAC_DEFUN([PKG_CHECK_VAR],
141863323ee5Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
141963323ee5SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420e6ecbdaeSmrg
142163323ee5Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
142263323ee5SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423e6ecbdaeSmrg
142463323ee5SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
142563323ee5Smrg])dnl PKG_CHECK_VAR
1426e6ecbdaeSmrg
142763323ee5Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
142863323ee5Smrgdnl
1429d5e55f73Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
143063323ee5Smrgdnl
143163323ee5Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
143263323ee5Smrgdnl copy of this software and associated documentation files (the "Software"),
143363323ee5Smrgdnl to deal in the Software without restriction, including without limitation
143463323ee5Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
143563323ee5Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
143663323ee5Smrgdnl Software is furnished to do so, subject to the following conditions:
143763323ee5Smrgdnl
143863323ee5Smrgdnl The above copyright notice and this permission notice (including the next
143963323ee5Smrgdnl paragraph) shall be included in all copies or substantial portions of the
144063323ee5Smrgdnl Software.
144163323ee5Smrgdnl
144263323ee5Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
144363323ee5Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
144463323ee5Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
144563323ee5Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
144663323ee5Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
144763323ee5Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
144863323ee5Smrgdnl DEALINGS IN THE SOFTWARE.
1449e6ecbdaeSmrg
145063323ee5Smrg# XORG_MACROS_VERSION(required-version)
145163323ee5Smrg# -------------------------------------
145263323ee5Smrg# Minimum version: 1.1.0
1453e6ecbdaeSmrg#
145463323ee5Smrg# If you're using a macro added in Version 1.1 or newer, include this in
145563323ee5Smrg# your configure.ac with the minimum required version, such as:
145663323ee5Smrg# XORG_MACROS_VERSION(1.1)
1457e6ecbdaeSmrg#
145863323ee5Smrg# To ensure that this macro is defined, also add:
145963323ee5Smrg# m4_ifndef([XORG_MACROS_VERSION],
146063323ee5Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1461e6ecbdaeSmrg#
1462ebb1c56dSmrg#
146363323ee5Smrg# See the "minimum version" comment for each macro you use to see what
146463323ee5Smrg# version you require.
146563323ee5Smrgm4_defun([XORG_MACROS_VERSION],[
1466d5e55f73Smrgm4_define([vers_have], [1.20.0])
146763323ee5Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
146863323ee5Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
146963323ee5Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
147063323ee5Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
147163323ee5Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
147263323ee5Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
147363323ee5Smrgm4_undefine([vers_have])
147463323ee5Smrgm4_undefine([maj_have])
147563323ee5Smrgm4_undefine([maj_needed])
147663323ee5Smrg]) # XORG_MACROS_VERSION
1477e6ecbdaeSmrg
147863323ee5Smrg# XORG_PROG_RAWCPP()
147963323ee5Smrg# ------------------
148063323ee5Smrg# Minimum version: 1.0.0
1481ebb1c56dSmrg#
148263323ee5Smrg# Find cpp program and necessary flags for use in pre-processing text files
148363323ee5Smrg# such as man pages and config files
148463323ee5SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
148563323ee5SmrgAC_REQUIRE([AC_PROG_CPP])
148663323ee5SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
148763323ee5Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
148863323ee5Smrg
148963323ee5Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
149063323ee5Smrg# which is not the best choice for supporting other OS'es, but covers most
149163323ee5Smrg# of the ones we need for now.
149263323ee5SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
149363323ee5SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
149463323ee5Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149563323ee5Smrg	AC_MSG_RESULT([no])
1496e6ecbdaeSmrgelse
149763323ee5Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149863323ee5Smrg		RAWCPPFLAGS=-undef
149963323ee5Smrg		AC_MSG_RESULT([yes])
150063323ee5Smrg	# under Cygwin unix is still defined even with -undef
150163323ee5Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
150263323ee5Smrg		RAWCPPFLAGS="-undef -ansi"
150363323ee5Smrg		AC_MSG_RESULT([yes, with -ansi])
150463323ee5Smrg	else
150563323ee5Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
150663323ee5Smrg	fi
1507e6ecbdaeSmrgfi
150863323ee5Smrgrm -f conftest.$ac_ext
1509e6ecbdaeSmrg
151063323ee5SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
151163323ee5SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1512d5e55f73Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
151363323ee5Smrg	AC_MSG_RESULT([no])
151463323ee5Smrgelse
1515d5e55f73Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
151663323ee5Smrg		TRADITIONALCPPFLAGS="-traditional"
151763323ee5Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
151863323ee5Smrg		AC_MSG_RESULT([yes])
151963323ee5Smrg	else
152063323ee5Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
152163323ee5Smrg	fi
152263323ee5Smrgfi
152363323ee5Smrgrm -f conftest.$ac_ext
152463323ee5SmrgAC_SUBST(RAWCPPFLAGS)
152563323ee5SmrgAC_SUBST(TRADITIONALCPPFLAGS)
152663323ee5Smrg]) # XORG_PROG_RAWCPP
152763323ee5Smrg
152863323ee5Smrg# XORG_MANPAGE_SECTIONS()
1529e6ecbdaeSmrg# -----------------------
153063323ee5Smrg# Minimum version: 1.0.0
1531ebb1c56dSmrg#
153263323ee5Smrg# Determine which sections man pages go in for the different man page types
153363323ee5Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
153463323ee5Smrg# Not sure if there's any better way than just hardcoding by OS name.
153563323ee5Smrg# Override default settings by setting environment variables
153663323ee5Smrg# Added MAN_SUBSTS in version 1.8
153763323ee5Smrg# Added AC_PROG_SED in version 1.8
1538c7484f1fSmrg
153963323ee5SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1540c7484f1fSmrgAC_REQUIRE([AC_CANONICAL_HOST])
154163323ee5SmrgAC_REQUIRE([AC_PROG_SED])
1542c7484f1fSmrg
1543ebb1c56dSmrgcase $host_os in
1544ebb1c56dSmrg    solaris*)
154563323ee5Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
154663323ee5Smrg        # check for a man page file found in later versions that use
154763323ee5Smrg        # traditional section numbers instead
154863323ee5Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
154963323ee5Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1550ebb1c56dSmrg        ;;
155163323ee5Smrg    *) SYSV_MAN_SECTIONS=false ;;
1552ebb1c56dSmrgesac
1553c7484f1fSmrg
155463323ee5Smrgif test x$APP_MAN_SUFFIX = x    ; then
155563323ee5Smrg    APP_MAN_SUFFIX=1
1556c7484f1fSmrgfi
155763323ee5Smrgif test x$APP_MAN_DIR = x    ; then
155863323ee5Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1559ebb1c56dSmrgfi
1560ebb1c56dSmrg
156163323ee5Smrgif test x$LIB_MAN_SUFFIX = x    ; then
156263323ee5Smrg    LIB_MAN_SUFFIX=3
1563baed689fSmrgfi
156463323ee5Smrgif test x$LIB_MAN_DIR = x    ; then
156563323ee5Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1566c7484f1fSmrgfi
1567c7484f1fSmrg
156863323ee5Smrgif test x$FILE_MAN_SUFFIX = x    ; then
156963323ee5Smrg    case $SYSV_MAN_SECTIONS in
157063323ee5Smrg	true)				FILE_MAN_SUFFIX=4  ;;
157163323ee5Smrg	*)				FILE_MAN_SUFFIX=5  ;;
157263323ee5Smrg    esac
157363323ee5Smrgfi
157463323ee5Smrgif test x$FILE_MAN_DIR = x    ; then
157563323ee5Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1576ebb1c56dSmrgfi
1577c7484f1fSmrg
157863323ee5Smrgif test x$MISC_MAN_SUFFIX = x    ; then
157963323ee5Smrg    case $SYSV_MAN_SECTIONS in
158063323ee5Smrg	true)				MISC_MAN_SUFFIX=5  ;;
158163323ee5Smrg	*)				MISC_MAN_SUFFIX=7  ;;
158263323ee5Smrg    esac
158363323ee5Smrgfi
158463323ee5Smrgif test x$MISC_MAN_DIR = x    ; then
158563323ee5Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
158663323ee5Smrgfi
1587c7484f1fSmrg
158863323ee5Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
158963323ee5Smrg    case $SYSV_MAN_SECTIONS in
159063323ee5Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
159163323ee5Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
159263323ee5Smrg    esac
159363323ee5Smrgfi
159463323ee5Smrgif test x$DRIVER_MAN_DIR = x    ; then
159563323ee5Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
159663323ee5Smrgfi
1597c7484f1fSmrg
159863323ee5Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
159963323ee5Smrg    case $SYSV_MAN_SECTIONS in
160063323ee5Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
160163323ee5Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
160263323ee5Smrg    esac
160363323ee5Smrgfi
160463323ee5Smrgif test x$ADMIN_MAN_DIR = x    ; then
160563323ee5Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
160663323ee5Smrgfi
1607c7484f1fSmrg
1608c7484f1fSmrg
160963323ee5SmrgAC_SUBST([APP_MAN_SUFFIX])
161063323ee5SmrgAC_SUBST([LIB_MAN_SUFFIX])
161163323ee5SmrgAC_SUBST([FILE_MAN_SUFFIX])
161263323ee5SmrgAC_SUBST([MISC_MAN_SUFFIX])
161363323ee5SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
161463323ee5SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
161563323ee5SmrgAC_SUBST([APP_MAN_DIR])
161663323ee5SmrgAC_SUBST([LIB_MAN_DIR])
161763323ee5SmrgAC_SUBST([FILE_MAN_DIR])
161863323ee5SmrgAC_SUBST([MISC_MAN_DIR])
161963323ee5SmrgAC_SUBST([DRIVER_MAN_DIR])
162063323ee5SmrgAC_SUBST([ADMIN_MAN_DIR])
1621c7484f1fSmrg
162263323ee5SmrgXORG_MAN_PAGE="X Version 11"
162363323ee5SmrgAC_SUBST([XORG_MAN_PAGE])
162463323ee5SmrgMAN_SUBSTS="\
162563323ee5Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162663323ee5Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162763323ee5Smrg	-e 's|__xservername__|Xorg|g' \
162863323ee5Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
162963323ee5Smrg	-e 's|__projectroot__|\$(prefix)|g' \
163063323ee5Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
163163323ee5Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
163263323ee5Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
163363323ee5Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
163463323ee5Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
163563323ee5Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
163663323ee5Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
163763323ee5SmrgAC_SUBST([MAN_SUBSTS])
1638c7484f1fSmrg
163963323ee5Smrg]) # XORG_MANPAGE_SECTIONS
1640c7484f1fSmrg
164163323ee5Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
164263323ee5Smrg# ------------------------
164363323ee5Smrg# Minimum version: 1.7.0
1644ebb1c56dSmrg#
164563323ee5Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
164663323ee5Smrg# provided by xorg-sgml-doctools, if installed.
164763323ee5SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
164863323ee5SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
164963323ee5SmrgXORG_SGML_PATH=
165063323ee5SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
165163323ee5Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
165263323ee5Smrg    [m4_ifval([$1],[:],
165363323ee5Smrg        [if test x"$cross_compiling" != x"yes" ; then
165463323ee5Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
165563323ee5Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
165663323ee5Smrg         fi])
165763323ee5Smrg    ])
1658c7484f1fSmrg
165963323ee5Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
166063323ee5Smrg# the path and the name of the doc stylesheet
166163323ee5Smrgif test "x$XORG_SGML_PATH" != "x" ; then
166263323ee5Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
166363323ee5Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
166463323ee5Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
166563323ee5Smrgelse
166663323ee5Smrg   AC_MSG_RESULT([no])
166763323ee5Smrgfi
1668c7484f1fSmrg
166963323ee5SmrgAC_SUBST(XORG_SGML_PATH)
167063323ee5SmrgAC_SUBST(STYLESHEET_SRCDIR)
167163323ee5SmrgAC_SUBST(XSL_STYLESHEET)
167263323ee5SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
167363323ee5Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1674ebb1c56dSmrg
167563323ee5Smrg# XORG_CHECK_LINUXDOC
167663323ee5Smrg# -------------------
167763323ee5Smrg# Minimum version: 1.0.0
167863323ee5Smrg#
167963323ee5Smrg# Defines the variable MAKE_TEXT if the necessary tools and
168063323ee5Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
168163323ee5Smrg# Whether or not the necessary tools and files are found can be checked
168263323ee5Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
168363323ee5SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
168463323ee5SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
168563323ee5SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1686ebb1c56dSmrg
168763323ee5SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1688ebb1c56dSmrg
168963323ee5SmrgAC_MSG_CHECKING([whether to build documentation])
1690c7484f1fSmrg
169163323ee5Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
169263323ee5Smrg   BUILDDOC=yes
169363323ee5Smrgelse
169463323ee5Smrg   BUILDDOC=no
1695c7484f1fSmrgfi
1696c7484f1fSmrg
169763323ee5SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1698c7484f1fSmrg
169963323ee5SmrgAC_MSG_RESULT([$BUILDDOC])
1700c7484f1fSmrg
170163323ee5SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1702ebb1c56dSmrg
170363323ee5Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
170463323ee5Smrg   BUILDPDFDOC=yes
170563323ee5Smrgelse
170663323ee5Smrg   BUILDPDFDOC=no
170763323ee5Smrgfi
1708ebb1c56dSmrg
170963323ee5SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1710ebb1c56dSmrg
171163323ee5SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1712ebb1c56dSmrg
171363323ee5SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
171463323ee5SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
171563323ee5SmrgMAKE_PDF="$PS2PDF"
171663323ee5SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1717baed689fSmrg
171863323ee5SmrgAC_SUBST(MAKE_TEXT)
171963323ee5SmrgAC_SUBST(MAKE_PS)
172063323ee5SmrgAC_SUBST(MAKE_PDF)
172163323ee5SmrgAC_SUBST(MAKE_HTML)
172263323ee5Smrg]) # XORG_CHECK_LINUXDOC
1723ebb1c56dSmrg
172463323ee5Smrg# XORG_CHECK_DOCBOOK
172563323ee5Smrg# -------------------
172663323ee5Smrg# Minimum version: 1.0.0
172763323ee5Smrg#
172863323ee5Smrg# Checks for the ability to build output formats from SGML DocBook source.
172963323ee5Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
173063323ee5Smrg# indicates whether the necessary tools and files are found and, if set,
173163323ee5Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
173263323ee5SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
173363323ee5SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1734baed689fSmrg
173563323ee5SmrgBUILDTXTDOC=no
173663323ee5SmrgBUILDPDFDOC=no
173763323ee5SmrgBUILDPSDOC=no
173863323ee5SmrgBUILDHTMLDOC=no
1739baed689fSmrg
174063323ee5SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
174163323ee5SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
174263323ee5SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
174363323ee5SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1744baed689fSmrg
174563323ee5SmrgAC_MSG_CHECKING([whether to build text documentation])
174663323ee5Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
174763323ee5Smrg   test x$BUILD_TXTDOC != xno; then
174863323ee5Smrg	BUILDTXTDOC=yes
174963323ee5Smrgfi
175063323ee5SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
175163323ee5SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1752e6ecbdaeSmrg
175363323ee5SmrgAC_MSG_CHECKING([whether to build PDF documentation])
175463323ee5Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
175563323ee5Smrg   test x$BUILD_PDFDOC != xno; then
175663323ee5Smrg	BUILDPDFDOC=yes
175763323ee5Smrgfi
175863323ee5SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
175963323ee5SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1760ebb1c56dSmrg
176163323ee5SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
176263323ee5Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
176363323ee5Smrg   test x$BUILD_PSDOC != xno; then
176463323ee5Smrg	BUILDPSDOC=yes
176563323ee5Smrgfi
176663323ee5SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
176763323ee5SmrgAC_MSG_RESULT([$BUILDPSDOC])
1768ebb1c56dSmrg
176963323ee5SmrgAC_MSG_CHECKING([whether to build HTML documentation])
177063323ee5Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
177163323ee5Smrg   test x$BUILD_HTMLDOC != xno; then
177263323ee5Smrg	BUILDHTMLDOC=yes
1773e6ecbdaeSmrgfi
177463323ee5SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
177563323ee5SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1776e6ecbdaeSmrg
177763323ee5SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
177863323ee5SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
177963323ee5SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
178063323ee5SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1781e6ecbdaeSmrg
178263323ee5SmrgAC_SUBST(MAKE_TEXT)
178363323ee5SmrgAC_SUBST(MAKE_PS)
178463323ee5SmrgAC_SUBST(MAKE_PDF)
178563323ee5SmrgAC_SUBST(MAKE_HTML)
178663323ee5Smrg]) # XORG_CHECK_DOCBOOK
178763323ee5Smrg
178863323ee5Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
178963323ee5Smrg# ----------------
179063323ee5Smrg# Minimum version: 1.5.0
179163323ee5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1792e6ecbdaeSmrg#
179363323ee5Smrg# Documentation tools are not always available on all platforms and sometimes
179463323ee5Smrg# not at the appropriate level. This macro enables a module to test for the
179563323ee5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1796d5e55f73Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
179763323ee5Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
179863323ee5Smrg# --with-xmlto assumes 'auto'.
1799e6ecbdaeSmrg#
180063323ee5Smrg# Interface to module:
180163323ee5Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
180263323ee5Smrg# XMLTO:	returns the path of the xmlto program found
180363323ee5Smrg#		returns the path set by the user in the environment
180463323ee5Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
180563323ee5Smrg#		'no' user instructs the module not to use xmlto
1806e6ecbdaeSmrg#
180763323ee5Smrg# Added in version 1.10.0
180863323ee5Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
180963323ee5Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1810e6ecbdaeSmrg#
181163323ee5Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1812e6ecbdaeSmrg#
181363323ee5SmrgAC_DEFUN([XORG_WITH_XMLTO],[
181463323ee5SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
181563323ee5Smrgm4_define([_defopt], m4_default([$2], [auto]))
181663323ee5SmrgAC_ARG_WITH(xmlto,
181763323ee5Smrg	AS_HELP_STRING([--with-xmlto],
181863323ee5Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
181963323ee5Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
182063323ee5Smrgm4_undefine([_defopt])
1821e6ecbdaeSmrg
182263323ee5Smrgif test "x$use_xmlto" = x"auto"; then
182363323ee5Smrg   AC_PATH_PROG([XMLTO], [xmlto])
182463323ee5Smrg   if test "x$XMLTO" = "x"; then
182563323ee5Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
182663323ee5Smrg	have_xmlto=no
182763323ee5Smrg   else
182863323ee5Smrg        have_xmlto=yes
182963323ee5Smrg   fi
183063323ee5Smrgelif test "x$use_xmlto" = x"yes" ; then
183163323ee5Smrg   AC_PATH_PROG([XMLTO], [xmlto])
183263323ee5Smrg   if test "x$XMLTO" = "x"; then
183363323ee5Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
183463323ee5Smrg   fi
183563323ee5Smrg   have_xmlto=yes
183663323ee5Smrgelif test "x$use_xmlto" = x"no" ; then
183763323ee5Smrg   if test "x$XMLTO" != "x"; then
183863323ee5Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
183963323ee5Smrg   fi
184063323ee5Smrg   have_xmlto=no
184163323ee5Smrgelse
184263323ee5Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
184363323ee5Smrgfi
1844e6ecbdaeSmrg
184563323ee5Smrg# Test for a minimum version of xmlto, if provided.
184663323ee5Smrgm4_ifval([$1],
184763323ee5Smrg[if test "$have_xmlto" = yes; then
184863323ee5Smrg    # scrape the xmlto version
184963323ee5Smrg    AC_MSG_CHECKING([the xmlto version])
185063323ee5Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
185163323ee5Smrg    AC_MSG_RESULT([$xmlto_version])
185263323ee5Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
185363323ee5Smrg        [if test "x$use_xmlto" = xauto; then
185463323ee5Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
185563323ee5Smrg            have_xmlto=no
185663323ee5Smrg        else
185763323ee5Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
185863323ee5Smrg        fi])
185963323ee5Smrgfi])
1860e6ecbdaeSmrg
186163323ee5Smrg# Test for the ability of xmlto to generate a text target
186263323ee5Smrg#
186363323ee5Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
186463323ee5Smrg# following test for empty XML docbook files.
186563323ee5Smrg# For compatibility reasons use the following empty XML docbook file and if
186663323ee5Smrg# it fails try it again with a non-empty XML file.
186763323ee5Smrghave_xmlto_text=no
186863323ee5Smrgcat > conftest.xml << "EOF"
186963323ee5SmrgEOF
187063323ee5SmrgAS_IF([test "$have_xmlto" = yes],
187163323ee5Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187263323ee5Smrg             [have_xmlto_text=yes],
187363323ee5Smrg             [# Try it again with a non-empty XML file.
187463323ee5Smrg              cat > conftest.xml << "EOF"
187563323ee5Smrg<x></x>
187663323ee5SmrgEOF
187763323ee5Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187863323ee5Smrg                    [have_xmlto_text=yes],
187963323ee5Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
188063323ee5Smrgrm -f conftest.xml
188163323ee5SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
188263323ee5SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
188363323ee5Smrg]) # XORG_WITH_XMLTO
1884ebb1c56dSmrg
188563323ee5Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
188663323ee5Smrg# --------------------------------------------
188763323ee5Smrg# Minimum version: 1.12.0
188863323ee5Smrg# Minimum version for optional DEFAULT argument: 1.12.0
188963323ee5Smrg#
189063323ee5Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
189163323ee5Smrg# XML-based language used for the transformation of XML documents.
189263323ee5Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
189363323ee5Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
189463323ee5Smrg# The XSLT processor is often used as a standalone tool for transformations.
189563323ee5Smrg# It should not be assumed that this tool is used only to work with documnetation.
189663323ee5Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
189763323ee5Smrg#
189863323ee5Smrg# Interface to module:
189963323ee5Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
190063323ee5Smrg# XSLTPROC:	 returns the path of the xsltproc program found
190163323ee5Smrg#		 returns the path set by the user in the environment
190263323ee5Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
190363323ee5Smrg#		  'no' user instructs the module not to use xsltproc
190463323ee5Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
190563323ee5Smrg#
190663323ee5Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
190763323ee5Smrg#
190863323ee5SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
190963323ee5SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
191063323ee5Smrg# Preserves the interface, should it be implemented later
191163323ee5Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
191263323ee5Smrgm4_define([_defopt], m4_default([$2], [auto]))
191363323ee5SmrgAC_ARG_WITH(xsltproc,
191463323ee5Smrg	AS_HELP_STRING([--with-xsltproc],
191563323ee5Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
191663323ee5Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
191763323ee5Smrgm4_undefine([_defopt])
1918ebb1c56dSmrg
191963323ee5Smrgif test "x$use_xsltproc" = x"auto"; then
192063323ee5Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192163323ee5Smrg   if test "x$XSLTPROC" = "x"; then
192263323ee5Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
192363323ee5Smrg	have_xsltproc=no
192463323ee5Smrg   else
192563323ee5Smrg        have_xsltproc=yes
192663323ee5Smrg   fi
192763323ee5Smrgelif test "x$use_xsltproc" = x"yes" ; then
192863323ee5Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192963323ee5Smrg   if test "x$XSLTPROC" = "x"; then
193063323ee5Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
193163323ee5Smrg   fi
193263323ee5Smrg   have_xsltproc=yes
193363323ee5Smrgelif test "x$use_xsltproc" = x"no" ; then
193463323ee5Smrg   if test "x$XSLTPROC" != "x"; then
193563323ee5Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
193663323ee5Smrg   fi
193763323ee5Smrg   have_xsltproc=no
193863323ee5Smrgelse
193963323ee5Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1940ebb1c56dSmrgfi
1941ebb1c56dSmrg
194263323ee5SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
194363323ee5Smrg]) # XORG_WITH_XSLTPROC
194463323ee5Smrg
194563323ee5Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
194663323ee5Smrg# ----------------------------------------
194763323ee5Smrg# Minimum version: 1.15.0
1948baed689fSmrg#
194963323ee5Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
195063323ee5Smrg# scanning arbitrary text files, extracting information from those text files,
195163323ee5Smrg# and printing reports based on that information.
1952baed689fSmrg#
195363323ee5Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1954baed689fSmrg#
195563323ee5Smrg# Interface to module:
195663323ee5Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
195763323ee5Smrg# PERL:	     returns the path of the perl program found
195863323ee5Smrg#	     returns the path set by the user in the environment
195963323ee5Smrg# --with-perl: 'yes' user instructs the module to use perl
196063323ee5Smrg#	       'no' user instructs the module not to use perl
196163323ee5Smrg# have_perl: returns yes if perl found in PATH or no
1962baed689fSmrg#
196363323ee5Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
196463323ee5Smrg#
196563323ee5SmrgAC_DEFUN([XORG_WITH_PERL],[
196663323ee5SmrgAC_ARG_VAR([PERL], [Path to perl command])
196763323ee5Smrg# Preserves the interface, should it be implemented later
196863323ee5Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
196963323ee5Smrgm4_define([_defopt], m4_default([$2], [auto]))
197063323ee5SmrgAC_ARG_WITH(perl,
197163323ee5Smrg	AS_HELP_STRING([--with-perl],
197263323ee5Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
197363323ee5Smrg	   [use_perl=$withval], [use_perl=]_defopt)
197463323ee5Smrgm4_undefine([_defopt])
1975baed689fSmrg
197663323ee5Smrgif test "x$use_perl" = x"auto"; then
197763323ee5Smrg   AC_PATH_PROG([PERL], [perl])
197863323ee5Smrg   if test "x$PERL" = "x"; then
197963323ee5Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
198063323ee5Smrg	have_perl=no
198163323ee5Smrg   else
198263323ee5Smrg        have_perl=yes
198363323ee5Smrg   fi
198463323ee5Smrgelif test "x$use_perl" = x"yes" ; then
198563323ee5Smrg   AC_PATH_PROG([PERL], [perl])
198663323ee5Smrg   if test "x$PERL" = "x"; then
198763323ee5Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
198863323ee5Smrg   fi
198963323ee5Smrg   have_perl=yes
199063323ee5Smrgelif test "x$use_perl" = x"no" ; then
199163323ee5Smrg   if test "x$PERL" != "x"; then
199263323ee5Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
199363323ee5Smrg   fi
199463323ee5Smrg   have_perl=no
199563323ee5Smrgelse
199663323ee5Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
199763323ee5Smrgfi
1998baed689fSmrg
199963323ee5SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
200063323ee5Smrg]) # XORG_WITH_PERL
2001ebb1c56dSmrg
200263323ee5Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2003ebb1c56dSmrg# ----------------
200463323ee5Smrg# Minimum version: 1.5.0
200563323ee5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2006baed689fSmrg#
200763323ee5Smrg# Documentation tools are not always available on all platforms and sometimes
200863323ee5Smrg# not at the appropriate level. This macro enables a module to test for the
200963323ee5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2010d5e55f73Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
201163323ee5Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
201263323ee5Smrg# --with-asciidoc assumes 'auto'.
2013baed689fSmrg#
201463323ee5Smrg# Interface to module:
201563323ee5Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
201663323ee5Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
201763323ee5Smrg#		 returns the path set by the user in the environment
201863323ee5Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
201963323ee5Smrg#		  'no' user instructs the module not to use asciidoc
2020baed689fSmrg#
202163323ee5Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2022baed689fSmrg#
202363323ee5SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
202463323ee5SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
202563323ee5Smrgm4_define([_defopt], m4_default([$2], [auto]))
202663323ee5SmrgAC_ARG_WITH(asciidoc,
202763323ee5Smrg	AS_HELP_STRING([--with-asciidoc],
202863323ee5Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
202963323ee5Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
203063323ee5Smrgm4_undefine([_defopt])
2031ebb1c56dSmrg
203263323ee5Smrgif test "x$use_asciidoc" = x"auto"; then
203363323ee5Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
203463323ee5Smrg   if test "x$ASCIIDOC" = "x"; then
203563323ee5Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
203663323ee5Smrg	have_asciidoc=no
203763323ee5Smrg   else
203863323ee5Smrg        have_asciidoc=yes
203963323ee5Smrg   fi
204063323ee5Smrgelif test "x$use_asciidoc" = x"yes" ; then
204163323ee5Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
204263323ee5Smrg   if test "x$ASCIIDOC" = "x"; then
204363323ee5Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
204463323ee5Smrg   fi
204563323ee5Smrg   have_asciidoc=yes
204663323ee5Smrgelif test "x$use_asciidoc" = x"no" ; then
204763323ee5Smrg   if test "x$ASCIIDOC" != "x"; then
204863323ee5Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
204963323ee5Smrg   fi
205063323ee5Smrg   have_asciidoc=no
205163323ee5Smrgelse
205263323ee5Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
205363323ee5Smrgfi
205463323ee5Smrgm4_ifval([$1],
205563323ee5Smrg[if test "$have_asciidoc" = yes; then
205663323ee5Smrg    # scrape the asciidoc version
205763323ee5Smrg    AC_MSG_CHECKING([the asciidoc version])
205863323ee5Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
205963323ee5Smrg    AC_MSG_RESULT([$asciidoc_version])
206063323ee5Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
206163323ee5Smrg        [if test "x$use_asciidoc" = xauto; then
206263323ee5Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
206363323ee5Smrg            have_asciidoc=no
206463323ee5Smrg        else
206563323ee5Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
206663323ee5Smrg        fi])
206763323ee5Smrgfi])
206863323ee5SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
206963323ee5Smrg]) # XORG_WITH_ASCIIDOC
2070ebb1c56dSmrg
207163323ee5Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
207263323ee5Smrg# -------------------------------------------
207363323ee5Smrg# Minimum version: 1.5.0
207463323ee5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
207563323ee5Smrg# Minimum version for optional DOT checking: 1.18.0
2076baed689fSmrg#
207763323ee5Smrg# Documentation tools are not always available on all platforms and sometimes
207863323ee5Smrg# not at the appropriate level. This macro enables a module to test for the
207963323ee5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2080d5e55f73Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
208163323ee5Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
208263323ee5Smrg# --with-doxygen assumes 'auto'.
2083baed689fSmrg#
208463323ee5Smrg# Interface to module:
208563323ee5Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
208663323ee5Smrg# DOXYGEN:	 returns the path of the doxygen program found
208763323ee5Smrg#		 returns the path set by the user in the environment
208863323ee5Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
208963323ee5Smrg#		  'no' user instructs the module not to use doxygen
2090baed689fSmrg#
209163323ee5Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2092baed689fSmrg#
209363323ee5SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
209463323ee5SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
209563323ee5SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
209663323ee5Smrgm4_define([_defopt], m4_default([$2], [auto]))
209763323ee5SmrgAC_ARG_WITH(doxygen,
209863323ee5Smrg	AS_HELP_STRING([--with-doxygen],
209963323ee5Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
210063323ee5Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
210163323ee5Smrgm4_undefine([_defopt])
2102baed689fSmrg
210363323ee5Smrgif test "x$use_doxygen" = x"auto"; then
210463323ee5Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
210563323ee5Smrg   if test "x$DOXYGEN" = "x"; then
210663323ee5Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
210763323ee5Smrg	have_doxygen=no
210863323ee5Smrg   else
210963323ee5Smrg        have_doxygen=yes
211063323ee5Smrg   fi
211163323ee5Smrgelif test "x$use_doxygen" = x"yes" ; then
211263323ee5Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
211363323ee5Smrg   if test "x$DOXYGEN" = "x"; then
211463323ee5Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
211563323ee5Smrg   fi
211663323ee5Smrg   have_doxygen=yes
211763323ee5Smrgelif test "x$use_doxygen" = x"no" ; then
211863323ee5Smrg   if test "x$DOXYGEN" != "x"; then
211963323ee5Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
212063323ee5Smrg   fi
212163323ee5Smrg   have_doxygen=no
2122baed689fSmrgelse
212363323ee5Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2124baed689fSmrgfi
212563323ee5Smrgm4_ifval([$1],
212663323ee5Smrg[if test "$have_doxygen" = yes; then
212763323ee5Smrg    # scrape the doxygen version
212863323ee5Smrg    AC_MSG_CHECKING([the doxygen version])
212963323ee5Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
213063323ee5Smrg    AC_MSG_RESULT([$doxygen_version])
213163323ee5Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
213263323ee5Smrg        [if test "x$use_doxygen" = xauto; then
213363323ee5Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
213463323ee5Smrg            have_doxygen=no
213563323ee5Smrg        else
213663323ee5Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
213763323ee5Smrg        fi])
213863323ee5Smrgfi])
2139baed689fSmrg
214063323ee5Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
214163323ee5Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
214263323ee5Smrgdnl 	HAVE_DOT = @HAVE_DOT@
214363323ee5SmrgHAVE_DOT=no
214463323ee5Smrgif test "x$have_doxygen" = "xyes"; then
214563323ee5Smrg  AC_PATH_PROG([DOT], [dot])
214663323ee5Smrg    if test "x$DOT" != "x"; then
214763323ee5Smrg      HAVE_DOT=yes
214863323ee5Smrg    fi
214963323ee5Smrgfi
2150ebb1c56dSmrg
215163323ee5SmrgAC_SUBST([HAVE_DOT])
215263323ee5SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
215363323ee5SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
215463323ee5Smrg]) # XORG_WITH_DOXYGEN
2155ebb1c56dSmrg
215663323ee5Smrg# XORG_WITH_GROFF([DEFAULT])
215763323ee5Smrg# ----------------
215863323ee5Smrg# Minimum version: 1.6.0
215963323ee5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2160baed689fSmrg#
216163323ee5Smrg# Documentation tools are not always available on all platforms and sometimes
216263323ee5Smrg# not at the appropriate level. This macro enables a module to test for the
216363323ee5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2164d5e55f73Smrg# the --with-groff option, it allows maximum flexibility in making decisions
216563323ee5Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
216663323ee5Smrg# --with-groff assumes 'auto'.
216763323ee5Smrg#
216863323ee5Smrg# Interface to module:
216963323ee5Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
217063323ee5Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
217163323ee5Smrg# HAVE_GROFF_MS: the -ms macros package
217263323ee5Smrg# GROFF:	 returns the path of the groff program found
217363323ee5Smrg#		 returns the path set by the user in the environment
217463323ee5Smrg# --with-groff:	 'yes' user instructs the module to use groff
217563323ee5Smrg#		 'no' user instructs the module not to use groff
217663323ee5Smrg#
217763323ee5Smrg# Added in version 1.9.0:
217863323ee5Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
217963323ee5Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
218063323ee5Smrg#		   psselect from the psutils package.
218163323ee5Smrg#		   the ghostcript package. Refer to the grohtml man pages
218263323ee5Smrg#
218363323ee5Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
218463323ee5Smrg#
218563323ee5Smrg# OS and distros often splits groff in a basic and full package, the former
218663323ee5Smrg# having the groff program and the later having devices, fonts and macros
218763323ee5Smrg# Checking for the groff executable is not enough.
218863323ee5Smrg#
218963323ee5Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
219063323ee5Smrg# unset HAVE_GROFF or GROFF env variables.
219163323ee5Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
219263323ee5Smrg#
219363323ee5SmrgAC_DEFUN([XORG_WITH_GROFF],[
219463323ee5SmrgAC_ARG_VAR([GROFF], [Path to groff command])
219563323ee5Smrgm4_define([_defopt], m4_default([$1], [auto]))
219663323ee5SmrgAC_ARG_WITH(groff,
219763323ee5Smrg	AS_HELP_STRING([--with-groff],
219863323ee5Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
219963323ee5Smrg	   [use_groff=$withval], [use_groff=]_defopt)
220063323ee5Smrgm4_undefine([_defopt])
2201e6ecbdaeSmrg
220263323ee5Smrgif test "x$use_groff" = x"auto"; then
220363323ee5Smrg   AC_PATH_PROG([GROFF], [groff])
220463323ee5Smrg   if test "x$GROFF" = "x"; then
220563323ee5Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
220663323ee5Smrg	have_groff=no
220763323ee5Smrg   else
220863323ee5Smrg        have_groff=yes
220963323ee5Smrg   fi
221063323ee5Smrgelif test "x$use_groff" = x"yes" ; then
221163323ee5Smrg   AC_PATH_PROG([GROFF], [groff])
221263323ee5Smrg   if test "x$GROFF" = "x"; then
221363323ee5Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
221463323ee5Smrg   fi
221563323ee5Smrg   have_groff=yes
221663323ee5Smrgelif test "x$use_groff" = x"no" ; then
221763323ee5Smrg   if test "x$GROFF" != "x"; then
221863323ee5Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
221963323ee5Smrg   fi
222063323ee5Smrg   have_groff=no
222163323ee5Smrgelse
222263323ee5Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
222363323ee5Smrgfi
2224e6ecbdaeSmrg
222563323ee5Smrg# We have groff, test for the presence of the macro packages
222663323ee5Smrgif test "x$have_groff" = x"yes"; then
222763323ee5Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
222863323ee5Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
222963323ee5Smrg        groff_ms_works=yes
223063323ee5Smrg    else
223163323ee5Smrg        groff_ms_works=no
2232ebb1c56dSmrg    fi
223363323ee5Smrg    AC_MSG_RESULT([$groff_ms_works])
223463323ee5Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
223563323ee5Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
223663323ee5Smrg        groff_mm_works=yes
223763323ee5Smrg    else
223863323ee5Smrg        groff_mm_works=no
223963323ee5Smrg    fi
224063323ee5Smrg    AC_MSG_RESULT([$groff_mm_works])
224163323ee5Smrgfi
2242e6ecbdaeSmrg
224363323ee5Smrg# We have groff, test for HTML dependencies, one command per package
224463323ee5Smrgif test "x$have_groff" = x"yes"; then
224563323ee5Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
224663323ee5Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
224763323ee5Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
224863323ee5Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
224963323ee5Smrg      have_groff_html=yes
225063323ee5Smrg   else
225163323ee5Smrg      have_groff_html=no
225263323ee5Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
225363323ee5Smrg   fi
225463323ee5Smrgfi
225563323ee5Smrg
225663323ee5Smrg# Set Automake conditionals for Makefiles
225763323ee5SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
225863323ee5SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
225963323ee5SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
226063323ee5SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
226163323ee5Smrg]) # XORG_WITH_GROFF
226263323ee5Smrg
226363323ee5Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
226463323ee5Smrg# ---------------------------------------
226563323ee5Smrg# Minimum version: 1.6.0
226663323ee5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
226763323ee5Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
226863323ee5Smrg#
226963323ee5Smrg# Documentation tools are not always available on all platforms and sometimes
227063323ee5Smrg# not at the appropriate level. This macro enables a module to test for the
227163323ee5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2272d5e55f73Smrg# the --with-fop option, it allows maximum flexibility in making decisions
227363323ee5Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
227463323ee5Smrg# --with-fop assumes 'auto'.
227563323ee5Smrg#
227663323ee5Smrg# Interface to module:
227763323ee5Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
227863323ee5Smrg# FOP:	 	returns the path of the fop program found
227963323ee5Smrg#		returns the path set by the user in the environment
228063323ee5Smrg# --with-fop: 	'yes' user instructs the module to use fop
228163323ee5Smrg#		'no' user instructs the module not to use fop
228263323ee5Smrg#
228363323ee5Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
228463323ee5Smrg#
228563323ee5SmrgAC_DEFUN([XORG_WITH_FOP],[
228663323ee5SmrgAC_ARG_VAR([FOP], [Path to fop command])
228763323ee5Smrgm4_define([_defopt], m4_default([$2], [auto]))
228863323ee5SmrgAC_ARG_WITH(fop,
228963323ee5Smrg	AS_HELP_STRING([--with-fop],
229063323ee5Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
229163323ee5Smrg	   [use_fop=$withval], [use_fop=]_defopt)
229263323ee5Smrgm4_undefine([_defopt])
229363323ee5Smrg
229463323ee5Smrgif test "x$use_fop" = x"auto"; then
229563323ee5Smrg   AC_PATH_PROG([FOP], [fop])
229663323ee5Smrg   if test "x$FOP" = "x"; then
229763323ee5Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
229863323ee5Smrg	have_fop=no
229963323ee5Smrg   else
230063323ee5Smrg        have_fop=yes
230163323ee5Smrg   fi
230263323ee5Smrgelif test "x$use_fop" = x"yes" ; then
230363323ee5Smrg   AC_PATH_PROG([FOP], [fop])
230463323ee5Smrg   if test "x$FOP" = "x"; then
230563323ee5Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
230663323ee5Smrg   fi
230763323ee5Smrg   have_fop=yes
230863323ee5Smrgelif test "x$use_fop" = x"no" ; then
230963323ee5Smrg   if test "x$FOP" != "x"; then
231063323ee5Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
231163323ee5Smrg   fi
231263323ee5Smrg   have_fop=no
2313ebb1c56dSmrgelse
231463323ee5Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2315e6ecbdaeSmrgfi
2316e6ecbdaeSmrg
231763323ee5Smrg# Test for a minimum version of fop, if provided.
231863323ee5Smrgm4_ifval([$1],
231963323ee5Smrg[if test "$have_fop" = yes; then
232063323ee5Smrg    # scrape the fop version
232163323ee5Smrg    AC_MSG_CHECKING([for fop minimum version])
232263323ee5Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
232363323ee5Smrg    AC_MSG_RESULT([$fop_version])
232463323ee5Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
232563323ee5Smrg        [if test "x$use_fop" = xauto; then
232663323ee5Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
232763323ee5Smrg            have_fop=no
232863323ee5Smrg        else
232963323ee5Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
233063323ee5Smrg        fi])
233163323ee5Smrgfi])
233263323ee5SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
233363323ee5Smrg]) # XORG_WITH_FOP
233463323ee5Smrg
233563323ee5Smrg# XORG_WITH_M4([MIN-VERSION])
233663323ee5Smrg# ---------------------------
233763323ee5Smrg# Minimum version: 1.19.0
233863323ee5Smrg#
233963323ee5Smrg# This macro attempts to locate an m4 macro processor which supports
234063323ee5Smrg# -I option and is only useful for modules relying on M4 in order to
234163323ee5Smrg# expand macros in source code files.
234263323ee5Smrg#
234363323ee5Smrg# Interface to module:
234463323ee5Smrg# M4:	 	returns the path of the m4 program found
234563323ee5Smrg#		returns the path set by the user in the environment
234663323ee5Smrg#
234763323ee5SmrgAC_DEFUN([XORG_WITH_M4], [
234863323ee5SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
234963323ee5Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
235063323ee5Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
235163323ee5Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
235263323ee5Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
235363323ee5Smrg   [$PATH:/usr/gnu/bin])])
2354ebb1c56dSmrg
235563323ee5SmrgAC_SUBST([M4], [$ac_cv_path_M4])
235663323ee5Smrg]) # XORG_WITH_M4
2357ebb1c56dSmrg
235863323ee5Smrg# XORG_WITH_PS2PDF([DEFAULT])
235963323ee5Smrg# ----------------
236063323ee5Smrg# Minimum version: 1.6.0
236163323ee5Smrg# Minimum version for optional DEFAULT argument: 1.11.0
236263323ee5Smrg#
236363323ee5Smrg# Documentation tools are not always available on all platforms and sometimes
236463323ee5Smrg# not at the appropriate level. This macro enables a module to test for the
236563323ee5Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2366d5e55f73Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
236763323ee5Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
236863323ee5Smrg# --with-ps2pdf assumes 'auto'.
236963323ee5Smrg#
237063323ee5Smrg# Interface to module:
237163323ee5Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
237263323ee5Smrg# PS2PDF:	returns the path of the ps2pdf program found
237363323ee5Smrg#		returns the path set by the user in the environment
237463323ee5Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
237563323ee5Smrg#		 'no' user instructs the module not to use ps2pdf
237663323ee5Smrg#
237763323ee5Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
237863323ee5Smrg#
237963323ee5SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
238063323ee5SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
238163323ee5Smrgm4_define([_defopt], m4_default([$1], [auto]))
238263323ee5SmrgAC_ARG_WITH(ps2pdf,
238363323ee5Smrg	AS_HELP_STRING([--with-ps2pdf],
238463323ee5Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
238563323ee5Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
238663323ee5Smrgm4_undefine([_defopt])
2387ebb1c56dSmrg
238863323ee5Smrgif test "x$use_ps2pdf" = x"auto"; then
238963323ee5Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239063323ee5Smrg   if test "x$PS2PDF" = "x"; then
239163323ee5Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
239263323ee5Smrg	have_ps2pdf=no
239363323ee5Smrg   else
239463323ee5Smrg        have_ps2pdf=yes
239563323ee5Smrg   fi
239663323ee5Smrgelif test "x$use_ps2pdf" = x"yes" ; then
239763323ee5Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239863323ee5Smrg   if test "x$PS2PDF" = "x"; then
239963323ee5Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
240063323ee5Smrg   fi
240163323ee5Smrg   have_ps2pdf=yes
240263323ee5Smrgelif test "x$use_ps2pdf" = x"no" ; then
240363323ee5Smrg   if test "x$PS2PDF" != "x"; then
240463323ee5Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
240563323ee5Smrg   fi
240663323ee5Smrg   have_ps2pdf=no
240763323ee5Smrgelse
240863323ee5Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2409e6ecbdaeSmrgfi
241063323ee5SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
241163323ee5Smrg]) # XORG_WITH_PS2PDF
2412ebb1c56dSmrg
241363323ee5Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
241463323ee5Smrg# ----------------
241563323ee5Smrg# Minimum version: 1.6.0
2416ebb1c56dSmrg#
241763323ee5Smrg# Documentation tools are not always available on all platforms and sometimes
241863323ee5Smrg# not at the appropriate level. This macro enables a builder to skip all
241963323ee5Smrg# documentation targets except traditional man pages.
242063323ee5Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2421d5e55f73Smrg# maximum flexibility in controlling documentation building.
242263323ee5Smrg# Refer to:
242363323ee5Smrg# XORG_WITH_XMLTO         --with-xmlto
242463323ee5Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
242563323ee5Smrg# XORG_WITH_DOXYGEN       --with-doxygen
242663323ee5Smrg# XORG_WITH_FOP           --with-fop
242763323ee5Smrg# XORG_WITH_GROFF         --with-groff
242863323ee5Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
242963323ee5Smrg#
243063323ee5Smrg# Interface to module:
243163323ee5Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
243263323ee5Smrg# --enable-docs: 'yes' user instructs the module to generate docs
243363323ee5Smrg#		 'no' user instructs the module not to generate docs
243463323ee5Smrg# parm1:	specify the default value, yes or no.
243563323ee5Smrg#
243663323ee5SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
243763323ee5Smrgm4_define([docs_default], m4_default([$1], [yes]))
243863323ee5SmrgAC_ARG_ENABLE(docs,
243963323ee5Smrg	AS_HELP_STRING([--enable-docs],
244063323ee5Smrg	   [Enable building the documentation (default: ]docs_default[)]),
244163323ee5Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
244263323ee5Smrgm4_undefine([docs_default])
244363323ee5SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
244463323ee5SmrgAC_MSG_CHECKING([whether to build documentation])
244563323ee5SmrgAC_MSG_RESULT([$build_docs])
244663323ee5Smrg]) # XORG_ENABLE_DOCS
2447ebb1c56dSmrg
244863323ee5Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
244963323ee5Smrg# ----------------
245063323ee5Smrg# Minimum version: 1.6.0
245163323ee5Smrg#
245263323ee5Smrg# This macro enables a builder to skip all developer documentation.
245363323ee5Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2454d5e55f73Smrg# maximum flexibility in controlling documentation building.
245563323ee5Smrg# Refer to:
245663323ee5Smrg# XORG_WITH_XMLTO         --with-xmlto
245763323ee5Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
245863323ee5Smrg# XORG_WITH_DOXYGEN       --with-doxygen
245963323ee5Smrg# XORG_WITH_FOP           --with-fop
246063323ee5Smrg# XORG_WITH_GROFF         --with-groff
246163323ee5Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
246263323ee5Smrg#
246363323ee5Smrg# Interface to module:
246463323ee5Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
246563323ee5Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
246663323ee5Smrg#			'no' user instructs the module not to generate developer docs
246763323ee5Smrg# parm1:		specify the default value, yes or no.
246863323ee5Smrg#
246963323ee5SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
247063323ee5Smrgm4_define([devel_default], m4_default([$1], [yes]))
247163323ee5SmrgAC_ARG_ENABLE(devel-docs,
247263323ee5Smrg	AS_HELP_STRING([--enable-devel-docs],
247363323ee5Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
247463323ee5Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
247563323ee5Smrgm4_undefine([devel_default])
247663323ee5SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
247763323ee5SmrgAC_MSG_CHECKING([whether to build developer documentation])
247863323ee5SmrgAC_MSG_RESULT([$build_devel_docs])
247963323ee5Smrg]) # XORG_ENABLE_DEVEL_DOCS
2480ebb1c56dSmrg
248163323ee5Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
248263323ee5Smrg# ----------------
248363323ee5Smrg# Minimum version: 1.6.0
248463323ee5Smrg#
248563323ee5Smrg# This macro enables a builder to skip all functional specification targets.
248663323ee5Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2487d5e55f73Smrg# maximum flexibility in controlling documentation building.
248863323ee5Smrg# Refer to:
248963323ee5Smrg# XORG_WITH_XMLTO         --with-xmlto
249063323ee5Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
249163323ee5Smrg# XORG_WITH_DOXYGEN       --with-doxygen
249263323ee5Smrg# XORG_WITH_FOP           --with-fop
249363323ee5Smrg# XORG_WITH_GROFF         --with-groff
249463323ee5Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
249563323ee5Smrg#
249663323ee5Smrg# Interface to module:
249763323ee5Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
249863323ee5Smrg# --enable-specs:	'yes' user instructs the module to generate specs
249963323ee5Smrg#			'no' user instructs the module not to generate specs
250063323ee5Smrg# parm1:		specify the default value, yes or no.
250163323ee5Smrg#
250263323ee5SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
250363323ee5Smrgm4_define([spec_default], m4_default([$1], [yes]))
250463323ee5SmrgAC_ARG_ENABLE(specs,
250563323ee5Smrg	AS_HELP_STRING([--enable-specs],
250663323ee5Smrg	   [Enable building the specs (default: ]spec_default[)]),
250763323ee5Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
250863323ee5Smrgm4_undefine([spec_default])
250963323ee5SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
251063323ee5SmrgAC_MSG_CHECKING([whether to build functional specifications])
251163323ee5SmrgAC_MSG_RESULT([$build_specs])
251263323ee5Smrg]) # XORG_ENABLE_SPECS
2513ebb1c56dSmrg
251463323ee5Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
251563323ee5Smrg# ----------------------------------------------
251663323ee5Smrg# Minimum version: 1.13.0
2517ebb1c56dSmrg#
251863323ee5Smrg# This macro enables a builder to enable/disable unit testing
251963323ee5Smrg# It makes no assumption about the test cases implementation
252063323ee5Smrg# Test cases may or may not use Automake "Support for test suites"
252163323ee5Smrg# They may or may not use the software utility library GLib
252263323ee5Smrg#
252363323ee5Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
252463323ee5Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
252563323ee5Smrg# The variable enable_unit_tests is used by other macros in this file.
252663323ee5Smrg#
252763323ee5Smrg# Interface to module:
252863323ee5Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
252963323ee5Smrg# enable_unit_tests:    used in configure.ac for additional configuration
253063323ee5Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
253163323ee5Smrg#			'no' user instructs the module not to build tests
253263323ee5Smrg# parm1:		specify the default value, yes or no.
253363323ee5Smrg#
253463323ee5SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
253563323ee5SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
253663323ee5SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
253763323ee5SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
253863323ee5Smrgm4_define([_defopt], m4_default([$1], [auto]))
253963323ee5SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
254063323ee5Smrg	[Enable building unit test cases (default: ]_defopt[)]),
254163323ee5Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
254263323ee5Smrgm4_undefine([_defopt])
254363323ee5SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
254463323ee5SmrgAC_MSG_CHECKING([whether to build unit test cases])
254563323ee5SmrgAC_MSG_RESULT([$enable_unit_tests])
254663323ee5Smrg]) # XORG_ENABLE_UNIT_TESTS
2547ebb1c56dSmrg
254863323ee5Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
254963323ee5Smrg# ------------------------------------------------------
255063323ee5Smrg# Minimum version: 1.17.0
255163323ee5Smrg#
255263323ee5Smrg# This macro enables a builder to enable/disable integration testing
255363323ee5Smrg# It makes no assumption about the test cases' implementation
255463323ee5Smrg# Test cases may or may not use Automake "Support for test suites"
255563323ee5Smrg#
255663323ee5Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
255763323ee5Smrg# usually requires less dependencies and may be built and run under less
255863323ee5Smrg# stringent environments than integration tests.
255963323ee5Smrg#
256063323ee5Smrg# Interface to module:
256163323ee5Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
256263323ee5Smrg# enable_integration_tests:   used in configure.ac for additional configuration
256363323ee5Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
256463323ee5Smrg#                             'no' user instructs the module not to build tests
256563323ee5Smrg# parm1:                      specify the default value, yes or no.
256663323ee5Smrg#
256763323ee5SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
256863323ee5SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
256963323ee5Smrgm4_define([_defopt], m4_default([$1], [auto]))
257063323ee5SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
257163323ee5Smrg	[Enable building integration test cases (default: ]_defopt[)]),
257263323ee5Smrg	[enable_integration_tests=$enableval],
257363323ee5Smrg	[enable_integration_tests=]_defopt)
257463323ee5Smrgm4_undefine([_defopt])
257563323ee5SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
257663323ee5Smrg	[test "x$enable_integration_tests" != xno])
257763323ee5SmrgAC_MSG_CHECKING([whether to build unit test cases])
257863323ee5SmrgAC_MSG_RESULT([$enable_integration_tests])
257963323ee5Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2580ebb1c56dSmrg
258163323ee5Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
258263323ee5Smrg# ----------------------------------------
258363323ee5Smrg# Minimum version: 1.13.0
258463323ee5Smrg#
258563323ee5Smrg# GLib is a library which provides advanced data structures and functions.
258663323ee5Smrg# This macro enables a module to test for the presence of Glib.
258763323ee5Smrg#
258863323ee5Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
258963323ee5Smrg# Otherwise the value of $enable_unit_tests is blank.
259063323ee5Smrg#
259163323ee5Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
259263323ee5Smrg# test support usually requires less dependencies and may be built and run under
259363323ee5Smrg# less stringent environments than integration tests.
2594ebb1c56dSmrg#
259563323ee5Smrg# Interface to module:
259663323ee5Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
259763323ee5Smrg# with_glib: used in configure.ac to know if GLib has been found
259863323ee5Smrg# --with-glib:	'yes' user instructs the module to use glib
259963323ee5Smrg#		'no' user instructs the module not to use glib
260063323ee5Smrg#
260163323ee5SmrgAC_DEFUN([XORG_WITH_GLIB],[
260263323ee5SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
260363323ee5Smrgm4_define([_defopt], m4_default([$2], [auto]))
260463323ee5SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
260563323ee5Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
260663323ee5Smrg	[with_glib=$withval], [with_glib=]_defopt)
260763323ee5Smrgm4_undefine([_defopt])
2608ebb1c56dSmrg
260963323ee5Smrghave_glib=no
261063323ee5Smrg# Do not probe GLib if user explicitly disabled unit testing
261163323ee5Smrgif test "x$enable_unit_tests" != x"no"; then
261263323ee5Smrg  # Do not probe GLib if user explicitly disabled it
261363323ee5Smrg  if test "x$with_glib" != x"no"; then
261463323ee5Smrg    m4_ifval(
261563323ee5Smrg      [$1],
261663323ee5Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
261763323ee5Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
261863323ee5Smrg    )
2619e6ecbdaeSmrg  fi
2620e6ecbdaeSmrgfi
2621e6ecbdaeSmrg
262263323ee5Smrg# Not having GLib when unit testing has been explicitly requested is an error
262363323ee5Smrgif test "x$enable_unit_tests" = x"yes"; then
262463323ee5Smrg  if test "x$have_glib" = x"no"; then
262563323ee5Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626e6ecbdaeSmrg  fi
2627e6ecbdaeSmrgfi
2628e6ecbdaeSmrg
262963323ee5Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
263063323ee5Smrgif test "x$enable_unit_tests" = x"no"; then
263163323ee5Smrg  if test "x$with_glib" = x"yes"; then
263263323ee5Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
263363323ee5Smrg  fi
263463323ee5Smrgfi
2635e6ecbdaeSmrg
263663323ee5Smrg# Not having GLib when it has been explicitly requested is an error
263763323ee5Smrgif test "x$with_glib" = x"yes"; then
263863323ee5Smrg  if test "x$have_glib" = x"no"; then
263963323ee5Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
264063323ee5Smrg  fi
264163323ee5Smrgfi
2642e6ecbdaeSmrg
264363323ee5SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
264463323ee5Smrg]) # XORG_WITH_GLIB
2645e6ecbdaeSmrg
264663323ee5Smrg# XORG_LD_WRAP([required|optional])
264763323ee5Smrg# ---------------------------------
264863323ee5Smrg# Minimum version: 1.13.0
264963323ee5Smrg#
265063323ee5Smrg# Check if linker supports -wrap, passed via compiler flags
265163323ee5Smrg#
265263323ee5Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
265363323ee5Smrg# Otherwise the value of $enable_unit_tests is blank.
265463323ee5Smrg#
265563323ee5Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
265663323ee5Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
265763323ee5Smrg# available, an argument of "optional" allows use when some unit tests require
265863323ee5Smrg# ld -wrap and others do not.
265963323ee5Smrg#
266063323ee5SmrgAC_DEFUN([XORG_LD_WRAP],[
266163323ee5SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
266263323ee5Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
266363323ee5Smrg                      void __wrap_exit(int status) { return; }],
266463323ee5Smrg                     [exit(0);])])
266563323ee5Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
266663323ee5Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
266763323ee5Smrg  if test "x$have_ld_wrap" = x"no"; then
266863323ee5Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
266963323ee5Smrg  fi
267063323ee5Smrgfi
267163323ee5SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
267263323ee5Smrg#
267363323ee5Smrg]) # XORG_LD_WRAP
2674e6ecbdaeSmrg
267563323ee5Smrg# XORG_CHECK_LINKER_FLAGS
267663323ee5Smrg# -----------------------
267763323ee5Smrg# SYNOPSIS
267863323ee5Smrg#
267963323ee5Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
268063323ee5Smrg#
268163323ee5Smrg# DESCRIPTION
268263323ee5Smrg#
268363323ee5Smrg#   Check whether the given linker FLAGS work with the current language's
268463323ee5Smrg#   linker, or whether they give an error.
268563323ee5Smrg#
268663323ee5Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
268763323ee5Smrg#   success/failure.
268863323ee5Smrg#
268963323ee5Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
269063323ee5Smrg#
269163323ee5Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
269263323ee5Smrg#
269363323ee5Smrg# LICENSE
269463323ee5Smrg#
269563323ee5Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
269663323ee5Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
269763323ee5Smrg#   Copyright (c) 2009 Matteo Frigo
269863323ee5Smrg#
269963323ee5Smrg#   This program is free software: you can redistribute it and/or modify it
270063323ee5Smrg#   under the terms of the GNU General Public License as published by the
270163323ee5Smrg#   Free Software Foundation, either version 3 of the License, or (at your
270263323ee5Smrg#   option) any later version.
270363323ee5Smrg#
270463323ee5Smrg#   This program is distributed in the hope that it will be useful, but
270563323ee5Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
270663323ee5Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
270763323ee5Smrg#   Public License for more details.
270863323ee5Smrg#
270963323ee5Smrg#   You should have received a copy of the GNU General Public License along
271063323ee5Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
271163323ee5Smrg#
271263323ee5Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
271363323ee5Smrg#   gives unlimited permission to copy, distribute and modify the configure
271463323ee5Smrg#   scripts that are the output of Autoconf when processing the Macro. You
271563323ee5Smrg#   need not follow the terms of the GNU General Public License when using
271663323ee5Smrg#   or distributing such scripts, even though portions of the text of the
271763323ee5Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
271863323ee5Smrg#   all other use of the material that constitutes the Autoconf Macro.
271963323ee5Smrg#
272063323ee5Smrg#   This special exception to the GPL applies to versions of the Autoconf
272163323ee5Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
272263323ee5Smrg#   modified version of the Autoconf Macro, you may extend this special
272363323ee5Smrg#   exception to the GPL to apply to your modified version as well.#
272463323ee5SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
272563323ee5Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
272663323ee5Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
272763323ee5SmrgAS_LITERAL_IF([$1],
272863323ee5Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
272963323ee5Smrg      ax_save_FLAGS=$LDFLAGS
273063323ee5Smrg      LDFLAGS="$1"
273163323ee5Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
273263323ee5Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273363323ee5Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
273463323ee5Smrg      LDFLAGS=$ax_save_FLAGS])],
273563323ee5Smrg  [ax_save_FLAGS=$LDFLAGS
273663323ee5Smrg   LDFLAGS="$1"
273763323ee5Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
273863323ee5Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273963323ee5Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
274063323ee5Smrg   LDFLAGS=$ax_save_FLAGS])
274163323ee5Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
274263323ee5SmrgAC_MSG_RESULT($xorg_check_linker_flags)
274363323ee5Smrgif test "x$xorg_check_linker_flags" = xyes; then
274463323ee5Smrg	m4_default([$2], :)
274563323ee5Smrgelse
274663323ee5Smrg	m4_default([$3], :)
274763323ee5Smrgfi
274863323ee5Smrg]) # XORG_CHECK_LINKER_FLAGS
2749e6ecbdaeSmrg
275063323ee5Smrg# XORG_MEMORY_CHECK_FLAGS
275163323ee5Smrg# -----------------------
275263323ee5Smrg# Minimum version: 1.16.0
275363323ee5Smrg#
275463323ee5Smrg# This macro attempts to find appropriate memory checking functionality
275563323ee5Smrg# for various platforms which unit testing code may use to catch various
275663323ee5Smrg# forms of memory allocation and access errors in testing.
275763323ee5Smrg#
275863323ee5Smrg# Interface to module:
275963323ee5Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
276063323ee5Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
276163323ee5Smrg#
276263323ee5Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
276363323ee5Smrg#
276463323ee5SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765c7484f1fSmrg
276663323ee5SmrgAC_REQUIRE([AC_CANONICAL_HOST])
276763323ee5SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
276863323ee5Smrg           [Environment variables to enable memory checking in tests])
2769c7484f1fSmrg
277063323ee5Smrg# Check for different types of support on different platforms
277163323ee5Smrgcase $host_os in
277263323ee5Smrg    solaris*)
277363323ee5Smrg        AC_CHECK_LIB([umem], [umem_alloc],
277463323ee5Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
277563323ee5Smrg        ;;
277663323ee5Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
277763323ee5Smrg        # both directly and inverted, so should not be 0 or 255.
277863323ee5Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
277963323ee5Smrg        ;;
278063323ee5Smrg    darwin*)
278163323ee5Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
278263323ee5Smrg        ;;
278363323ee5Smrg    *bsd*)
278463323ee5Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
278563323ee5Smrg        ;;
278663323ee5Smrgesac
2787ebb1c56dSmrg
278863323ee5Smrg# User supplied flags override default flags
278963323ee5Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
279063323ee5Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2791c7484f1fSmrgfi
2792c7484f1fSmrg
279363323ee5SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
279463323ee5Smrg]) # XORG_WITH_LINT
2795baed689fSmrg
279663323ee5Smrg# XORG_CHECK_MALLOC_ZERO
279763323ee5Smrg# ----------------------
279863323ee5Smrg# Minimum version: 1.0.0
2799ebb1c56dSmrg#
280063323ee5Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
280163323ee5Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
280263323ee5Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
280363323ee5SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
280463323ee5SmrgAC_ARG_ENABLE(malloc0returnsnull,
280563323ee5Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
280663323ee5Smrg		       [malloc(0) returns NULL (default: auto)]),
280763323ee5Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
280863323ee5Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2809baed689fSmrg
281063323ee5SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
281163323ee5Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
281263323ee5SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
281363323ee5Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
281463323ee5Smrg#include <stdlib.h>
281563323ee5Smrg],[
281663323ee5Smrg    char *m0, *r0, *c0, *p;
281763323ee5Smrg    m0 = malloc(0);
281863323ee5Smrg    p = malloc(10);
281963323ee5Smrg    r0 = realloc(p,0);
282063323ee5Smrg    c0 = calloc(0,10);
282163323ee5Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
282263323ee5Smrg])],
282363323ee5Smrg		[xorg_cv_malloc0_returns_null=yes],
282463323ee5Smrg		[xorg_cv_malloc0_returns_null=no])])
282563323ee5SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2826c7484f1fSmrgfi
282763323ee5SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2828c7484f1fSmrg
282963323ee5Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
283063323ee5Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
283163323ee5Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
283263323ee5Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2833ebb1c56dSmrgelse
283463323ee5Smrg	MALLOC_ZERO_CFLAGS=""
283563323ee5Smrg	XMALLOC_ZERO_CFLAGS=""
283663323ee5Smrg	XTMALLOC_ZERO_CFLAGS=""
2837ebb1c56dSmrgfi
2838c7484f1fSmrg
283963323ee5SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
284063323ee5SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
284163323ee5SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
284263323ee5Smrg]) # XORG_CHECK_MALLOC_ZERO
2843c7484f1fSmrg
284463323ee5Smrg# XORG_WITH_LINT()
284563323ee5Smrg# ----------------
284663323ee5Smrg# Minimum version: 1.1.0
2847c7484f1fSmrg#
284863323ee5Smrg# This macro enables the use of a tool that flags some suspicious and
284963323ee5Smrg# non-portable constructs (likely to be bugs) in C language source code.
285063323ee5Smrg# It will attempt to locate the tool and use appropriate options.
285163323ee5Smrg# There are various lint type tools on different platforms.
2852e6ecbdaeSmrg#
285363323ee5Smrg# Interface to module:
285463323ee5Smrg# LINT:		returns the path to the tool found on the platform
285563323ee5Smrg#		or the value set to LINT on the configure cmd line
285663323ee5Smrg#		also an Automake conditional
285763323ee5Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
285863323ee5Smrg#
285963323ee5Smrg# --with-lint:	'yes' user instructs the module to use lint
286063323ee5Smrg#		'no' user instructs the module not to use lint (default)
286163323ee5Smrg#
286263323ee5Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
286363323ee5Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
286463323ee5Smrg#
286563323ee5SmrgAC_DEFUN([XORG_WITH_LINT],[
2866e6ecbdaeSmrg
286763323ee5SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
286863323ee5SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
286963323ee5SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
287063323ee5Smrg		[Use a lint-style source code checker (default: disabled)])],
287163323ee5Smrg		[use_lint=$withval], [use_lint=no])
2872e6ecbdaeSmrg
287363323ee5Smrg# Obtain platform specific info like program name and options
287463323ee5Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
287563323ee5Smrgcase $host_os in
287663323ee5Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
287763323ee5Smrg	lint_name=splint
287863323ee5Smrg	lint_options="-badflag"
287963323ee5Smrg	;;
288063323ee5Smrg  *freebsd* | *netbsd*)
288163323ee5Smrg	lint_name=lint
288263323ee5Smrg	lint_options="-u -b"
288363323ee5Smrg	;;
288463323ee5Smrg  *solaris*)
288563323ee5Smrg	lint_name=lint
288663323ee5Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
288763323ee5Smrg	;;
288863323ee5Smrgesac
288963323ee5Smrg
289063323ee5Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
289163323ee5Smrgif test "x$use_lint" = x"yes" ; then
289263323ee5Smrg   AC_PATH_PROG([LINT], [$lint_name])
289363323ee5Smrg   if test "x$LINT" = "x"; then
289463323ee5Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
289563323ee5Smrg   fi
289663323ee5Smrgelif test "x$use_lint" = x"no" ; then
289763323ee5Smrg   if test "x$LINT" != "x"; then
289863323ee5Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
289963323ee5Smrg   fi
2900ebb1c56dSmrgelse
290163323ee5Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902e6ecbdaeSmrgfi
2903e6ecbdaeSmrg
290463323ee5Smrg# User supplied flags override default flags
290563323ee5Smrgif test "x$LINT_FLAGS" != "x"; then
290663323ee5Smrg   lint_options=$LINT_FLAGS
290763323ee5Smrgfi
2908e6ecbdaeSmrg
290963323ee5SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
291063323ee5SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911e6ecbdaeSmrg
291263323ee5Smrg]) # XORG_WITH_LINT
2913e6ecbdaeSmrg
291463323ee5Smrg# XORG_LINT_LIBRARY(LIBNAME)
291563323ee5Smrg# --------------------------
291663323ee5Smrg# Minimum version: 1.1.0
2917e6ecbdaeSmrg#
291863323ee5Smrg# Sets up flags for building lint libraries for checking programs that call
291963323ee5Smrg# functions in the library.
292063323ee5Smrg#
292163323ee5Smrg# Interface to module:
292263323ee5Smrg# LINTLIB		- Automake variable with the name of lint library file to make
292363323ee5Smrg# MAKE_LINT_LIB		- Automake conditional
292463323ee5Smrg#
292563323ee5Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
292663323ee5Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2927e6ecbdaeSmrg
292863323ee5SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
292963323ee5SmrgAC_REQUIRE([XORG_WITH_LINT])
293063323ee5SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
293163323ee5Smrg	[Create lint library (default: disabled)])],
293263323ee5Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
293363323ee5Smrg
293463323ee5Smrgif test "x$make_lint_lib" = x"yes" ; then
293563323ee5Smrg   LINTLIB=llib-l$1.ln
293663323ee5Smrg   if test "x$LINT" = "x"; then
293763323ee5Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
293863323ee5Smrg   fi
293963323ee5Smrgelif test "x$make_lint_lib" != x"no" ; then
294063323ee5Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2941e6ecbdaeSmrgfi
2942e6ecbdaeSmrg
294363323ee5SmrgAC_SUBST(LINTLIB)
294463323ee5SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2945ebb1c56dSmrg
294663323ee5Smrg]) # XORG_LINT_LIBRARY
2947ebb1c56dSmrg
294863323ee5Smrg# XORG_COMPILER_BRAND
2949ebb1c56dSmrg# -------------------
295063323ee5Smrg# Minimum version: 1.14.0
2951ebb1c56dSmrg#
295263323ee5Smrg# Checks for various brands of compilers and sets flags as appropriate:
295363323ee5Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
295463323ee5Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
295563323ee5Smrg#   clang compiler - sets CLANGCC to "yes"
295663323ee5Smrg#   Intel compiler - sets INTELCC to "yes"
295763323ee5Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
295863323ee5Smrg#
295963323ee5SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
296063323ee5SmrgAC_LANG_CASE(
296163323ee5Smrg	[C], [
2962d5e55f73Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2963d5e55f73Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
2964d5e55f73Smrg		m4_version_prereq([2.70],
2965d5e55f73Smrg			[AC_REQUIRE([AC_PROG_CC])],
2966d5e55f73Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
296763323ee5Smrg	],
296863323ee5Smrg	[C++], [
296963323ee5Smrg		AC_REQUIRE([AC_PROG_CXX])
297063323ee5Smrg	]
297163323ee5Smrg)
297263323ee5SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
297363323ee5SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
297463323ee5SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
297563323ee5Smrg]) # XORG_COMPILER_BRAND
2976e6ecbdaeSmrg
297763323ee5Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2978ebb1c56dSmrg# ---------------
297963323ee5Smrg# Minimum version: 1.16.0
298063323ee5Smrg#
298163323ee5Smrg# Test if the compiler works when passed the given flag as a command line argument.
2982d5e55f73Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
298363323ee5Smrg# next flag in the list until there are no more options.
298463323ee5Smrg#
298563323ee5Smrg# Note that this does not guarantee that the compiler supports the flag as some
298663323ee5Smrg# compilers will simply ignore arguments that they do not understand, but we do
298763323ee5Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
298863323ee5Smrg# -Werror=unused-command-line-argument
298963323ee5Smrg#
299063323ee5SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
299163323ee5Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
299263323ee5Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2993e6ecbdaeSmrg
299463323ee5SmrgAC_LANG_COMPILER_REQUIRE
2995e6ecbdaeSmrg
299663323ee5SmrgAC_LANG_CASE(
299763323ee5Smrg	[C], [
2998d5e55f73Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
2999d5e55f73Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
3000d5e55f73Smrg		m4_version_prereq([2.70],
3001d5e55f73Smrg			[AC_REQUIRE([AC_PROG_CC])],
3002d5e55f73Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
300363323ee5Smrg		define([PREFIX], [C])
300463323ee5Smrg		define([CACHE_PREFIX], [cc])
300563323ee5Smrg		define([COMPILER], [$CC])
300663323ee5Smrg	],
300763323ee5Smrg	[C++], [
300863323ee5Smrg		define([PREFIX], [CXX])
300963323ee5Smrg		define([CACHE_PREFIX], [cxx])
301063323ee5Smrg		define([COMPILER], [$CXX])
301163323ee5Smrg	]
301263323ee5Smrg)
301363323ee5Smrg
301463323ee5Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
301563323ee5Smrg
301663323ee5Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
301763323ee5Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
301863323ee5Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
301963323ee5Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
302063323ee5Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
302163323ee5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
302263323ee5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
302363323ee5Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
302463323ee5Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3025ebb1c56dSmrgfi
302663323ee5Smrg
302763323ee5Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
302863323ee5Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
302963323ee5Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
303063323ee5Smrg	fi
303163323ee5Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
303263323ee5Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
303363323ee5Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
303463323ee5Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
303563323ee5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
303663323ee5Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
303763323ee5Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
303863323ee5Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
303963323ee5Smrgfi
304063323ee5Smrg
304163323ee5Smrgfound="no"
304263323ee5Smrgm4_foreach([flag], m4_cdr($@), [
304363323ee5Smrg	if test $found = "no" ; then
304463323ee5Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
304563323ee5Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
304663323ee5Smrg		fi
304763323ee5Smrg
304863323ee5Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
304963323ee5Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
305063323ee5Smrg		fi
305163323ee5Smrg
305263323ee5Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
305363323ee5Smrg
305463323ee5Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
305563323ee5Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
305663323ee5Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
305763323ee5Smrg		AC_CACHE_VAL($cacheid,
305863323ee5Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
305963323ee5Smrg					     [eval $cacheid=yes],
306063323ee5Smrg					     [eval $cacheid=no])])
306163323ee5Smrg
306263323ee5Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
306363323ee5Smrg
306463323ee5Smrg		eval supported=\$$cacheid
306563323ee5Smrg		AC_MSG_RESULT([$supported])
306663323ee5Smrg		if test "$supported" = "yes" ; then
306763323ee5Smrg			$1="$$1 ]flag["
306863323ee5Smrg			found="yes"
306963323ee5Smrg		fi
307063323ee5Smrg	fi
3071ebb1c56dSmrg])
307263323ee5Smrg]) # XORG_TESTSET_CFLAG
3073e6ecbdaeSmrg
307463323ee5Smrg# XORG_COMPILER_FLAGS
307563323ee5Smrg# ---------------
307663323ee5Smrg# Minimum version: 1.16.0
3077e6ecbdaeSmrg#
307863323ee5Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
307963323ee5Smrg# arguments supported by the selected compiler which do NOT alter the generated
308063323ee5Smrg# code.  These arguments will cause the compiler to print various warnings
308163323ee5Smrg# during compilation AND turn a conservative set of warnings into errors.
308263323ee5Smrg#
308363323ee5Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
308463323ee5Smrg# future versions of util-macros as options are added to new compilers.
308563323ee5Smrg#
308663323ee5SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
308763323ee5SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3088baed689fSmrg
308963323ee5SmrgAC_ARG_ENABLE(selective-werror,
309063323ee5Smrg              AS_HELP_STRING([--disable-selective-werror],
309163323ee5Smrg                             [Turn off selective compiler errors. (default: enabled)]),
309263323ee5Smrg              [SELECTIVE_WERROR=$enableval],
309363323ee5Smrg              [SELECTIVE_WERROR=yes])
309463323ee5Smrg
309563323ee5SmrgAC_LANG_CASE(
309663323ee5Smrg        [C], [
309763323ee5Smrg                define([PREFIX], [C])
309863323ee5Smrg        ],
309963323ee5Smrg        [C++], [
310063323ee5Smrg                define([PREFIX], [CXX])
310163323ee5Smrg        ]
310263323ee5Smrg)
310363323ee5Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
310463323ee5Smrgif test "x$SUNCC" = "xyes"; then
310563323ee5Smrg    [BASE_]PREFIX[FLAGS]="-v"
3106ebb1c56dSmrgelse
310763323ee5Smrg    [BASE_]PREFIX[FLAGS]=""
3108ebb1c56dSmrgfi
3109ebb1c56dSmrg
311063323ee5Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
311163323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
311263323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
311363323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
311463323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3115ebb1c56dSmrg
311663323ee5SmrgAC_LANG_CASE(
311763323ee5Smrg	[C], [
311863323ee5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
311963323ee5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
312063323ee5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
312163323ee5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
312263323ee5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
312363323ee5Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
312463323ee5Smrg	]
312563323ee5Smrg)
3126baed689fSmrg
312763323ee5Smrg# This chunk adds additional warnings that could catch undesired effects.
312863323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
312963323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
313063323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
313163323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
313263323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
313363323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
313463323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3135e6ecbdaeSmrg
313663323ee5Smrg# These are currently disabled because they are noisy.  They will be enabled
313763323ee5Smrg# in the future once the codebase is sufficiently modernized to silence
313863323ee5Smrg# them.  For now, I don't want them to drown out the other warnings.
313963323ee5Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
314063323ee5Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
314163323ee5Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3142e6ecbdaeSmrg
3143d5e55f73Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
314463323ee5Smrg# when there are problems that should be fixed.
3145e6ecbdaeSmrg
314663323ee5Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
314763323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
314863323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
314963323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
315063323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
315163323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
315263323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
315363323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
315463323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
315563323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
315663323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
315763323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
315863323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
315963323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
316063323ee5Smrgelse
316163323ee5SmrgAC_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])
316263323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
316363323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
316463323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
316563323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
316663323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
316763323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
316863323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
316963323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
317063323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
317163323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
317263323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
317363323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
317463323ee5SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
317563323ee5Smrgfi
3176e6ecbdaeSmrg
317763323ee5SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
317863323ee5Smrg]) # XORG_COMPILER_FLAGS
3179baed689fSmrg
318063323ee5Smrg# XORG_CWARNFLAGS
318163323ee5Smrg# ---------------
318263323ee5Smrg# Minimum version: 1.2.0
318363323ee5Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3184baed689fSmrg#
318563323ee5Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3186baed689fSmrg#
318763323ee5Smrg# This function is deprecated because it defines -fno-strict-aliasing
318863323ee5Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
318963323ee5Smrg# is needed, then it should be added explicitly in the module when
319063323ee5Smrg# it is updated to use BASE_CFLAGS.
3191baed689fSmrg#
319263323ee5SmrgAC_DEFUN([XORG_CWARNFLAGS], [
319363323ee5SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
319463323ee5SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
319563323ee5SmrgAC_LANG_CASE(
319663323ee5Smrg	[C], [
319763323ee5Smrg		CWARNFLAGS="$BASE_CFLAGS"
319863323ee5Smrg		if  test "x$GCC" = xyes ; then
319963323ee5Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
320063323ee5Smrg		fi
320163323ee5Smrg		AC_SUBST(CWARNFLAGS)
320263323ee5Smrg	]
320363323ee5Smrg)
320463323ee5Smrg]) # XORG_CWARNFLAGS
3205c7484f1fSmrg
320663323ee5Smrg# XORG_STRICT_OPTION
320763323ee5Smrg# -----------------------
320863323ee5Smrg# Minimum version: 1.3.0
320963323ee5Smrg#
321063323ee5Smrg# Add configure option to enable strict compilation flags, such as treating
321163323ee5Smrg# warnings as fatal errors.
321263323ee5Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
321363323ee5Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
321463323ee5Smrg#
321563323ee5Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
321663323ee5Smrg# when strict compilation is unconditionally desired.
321763323ee5SmrgAC_DEFUN([XORG_STRICT_OPTION], [
321863323ee5SmrgAC_REQUIRE([XORG_CWARNFLAGS])
321963323ee5SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3220ebb1c56dSmrg
322163323ee5SmrgAC_ARG_ENABLE(strict-compilation,
322263323ee5Smrg			  AS_HELP_STRING([--enable-strict-compilation],
322363323ee5Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
322463323ee5Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3225ebb1c56dSmrg
322663323ee5SmrgAC_LANG_CASE(
322763323ee5Smrg        [C], [
322863323ee5Smrg                define([PREFIX], [C])
322963323ee5Smrg        ],
323063323ee5Smrg        [C++], [
323163323ee5Smrg                define([PREFIX], [CXX])
323263323ee5Smrg        ]
323363323ee5Smrg)
3234ebb1c56dSmrg
323563323ee5Smrg[STRICT_]PREFIX[FLAGS]=""
323663323ee5SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
323763323ee5SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3238ebb1c56dSmrg
323963323ee5Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
324063323ee5Smrg# activate it with -Werror, so we add it here explicitly.
324163323ee5SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3242ebb1c56dSmrg
324363323ee5Smrgif test "x$STRICT_COMPILE" = "xyes"; then
324463323ee5Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
324563323ee5Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
324663323ee5Smrgfi
324763323ee5SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
324863323ee5SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
324963323ee5SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
325063323ee5Smrg]) # XORG_STRICT_OPTION
3251ebb1c56dSmrg
3252d5e55f73Smrg# XORG_DEFAULT_NOCODE_OPTIONS
3253d5e55f73Smrg# ---------------------------
3254d5e55f73Smrg# Minimum version: 1.20.0
3255d5e55f73Smrg#
3256d5e55f73Smrg# Defines default options for X.Org modules which don't compile code,
3257d5e55f73Smrg# such as fonts, bitmaps, cursors, and docs.
3258d5e55f73Smrg#
3259d5e55f73SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
3260d5e55f73SmrgAC_REQUIRE([AC_PROG_INSTALL])
3261d5e55f73SmrgXORG_RELEASE_VERSION
3262d5e55f73SmrgXORG_CHANGELOG
3263d5e55f73SmrgXORG_INSTALL
3264d5e55f73SmrgXORG_MANPAGE_SECTIONS
3265d5e55f73Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3266d5e55f73Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3267d5e55f73Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3268d5e55f73Smrg
326963323ee5Smrg# XORG_DEFAULT_OPTIONS
327063323ee5Smrg# --------------------
327163323ee5Smrg# Minimum version: 1.3.0
327263323ee5Smrg#
3273d5e55f73Smrg# Defines default options for X.Org modules which compile code.
327463323ee5Smrg#
327563323ee5SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
327663323ee5SmrgAC_REQUIRE([AC_PROG_INSTALL])
327763323ee5SmrgXORG_COMPILER_FLAGS
327863323ee5SmrgXORG_CWARNFLAGS
327963323ee5SmrgXORG_STRICT_OPTION
3280d5e55f73SmrgXORG_DEFAULT_NOCODE_OPTIONS
328163323ee5Smrg]) # XORG_DEFAULT_OPTIONS
3282ebb1c56dSmrg
328363323ee5Smrg# XORG_INSTALL()
328463323ee5Smrg# ----------------
328563323ee5Smrg# Minimum version: 1.4.0
328663323ee5Smrg#
328763323ee5Smrg# Defines the variable INSTALL_CMD as the command to copy
328863323ee5Smrg# INSTALL from $prefix/share/util-macros.
328963323ee5Smrg#
329063323ee5SmrgAC_DEFUN([XORG_INSTALL], [
329163323ee5SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
329263323ee5Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
329363323ee5SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
329463323ee5Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
329563323ee5Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
329663323ee5Smrgtouch \$(top_srcdir)/INSTALL; \
329763323ee5Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
329863323ee5SmrgAC_SUBST([INSTALL_CMD])
329963323ee5Smrg]) # XORG_INSTALL
330063323ee5Smrgdnl Copyright 2005 Red Hat, Inc
330163323ee5Smrgdnl
330263323ee5Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
330363323ee5Smrgdnl documentation for any purpose is hereby granted without fee, provided that
330463323ee5Smrgdnl the above copyright notice appear in all copies and that both that
330563323ee5Smrgdnl copyright notice and this permission notice appear in supporting
330663323ee5Smrgdnl documentation.
330763323ee5Smrgdnl
330863323ee5Smrgdnl The above copyright notice and this permission notice shall be included
330963323ee5Smrgdnl in all copies or substantial portions of the Software.
331063323ee5Smrgdnl
331163323ee5Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
331263323ee5Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
331363323ee5Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
331463323ee5Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
331563323ee5Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
331663323ee5Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
331763323ee5Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
331863323ee5Smrgdnl
331963323ee5Smrgdnl Except as contained in this notice, the name of the copyright holders shall
332063323ee5Smrgdnl not be used in advertising or otherwise to promote the sale, use or
332163323ee5Smrgdnl other dealings in this Software without prior written authorization
332263323ee5Smrgdnl from the copyright holders.
332363323ee5Smrgdnl
3324ebb1c56dSmrg
332563323ee5Smrg# XORG_RELEASE_VERSION
332663323ee5Smrg# --------------------
332763323ee5Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3328ebb1c56dSmrg
332963323ee5SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
333063323ee5Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
333163323ee5Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
333263323ee5Smrg		[Major version of this package])
333363323ee5Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
333463323ee5Smrg	if test "x$PVM" = "x"; then
333563323ee5Smrg		PVM="0"
333663323ee5Smrg	fi
333763323ee5Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
333863323ee5Smrg		[$PVM],
333963323ee5Smrg		[Minor version of this package])
334063323ee5Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
334163323ee5Smrg	if test "x$PVP" = "x"; then
334263323ee5Smrg		PVP="0"
334363323ee5Smrg	fi
334463323ee5Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
334563323ee5Smrg		[$PVP],
334663323ee5Smrg		[Patch version of this package])
334763323ee5Smrg])
3348ebb1c56dSmrg
334963323ee5Smrg# XORG_CHANGELOG()
335063323ee5Smrg# ----------------
335163323ee5Smrg# Minimum version: 1.2.0
335263323ee5Smrg#
335363323ee5Smrg# Defines the variable CHANGELOG_CMD as the command to generate
335463323ee5Smrg# ChangeLog from git.
335563323ee5Smrg#
335663323ee5Smrg#
335763323ee5SmrgAC_DEFUN([XORG_CHANGELOG], [
335863323ee5SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
335963323ee5Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
336063323ee5Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
336163323ee5Smrgtouch \$(top_srcdir)/ChangeLog; \
336263323ee5Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
336363323ee5SmrgAC_SUBST([CHANGELOG_CMD])
336463323ee5Smrg]) # XORG_CHANGELOG
3365baed689fSmrg
3366