1a33c354dSmrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
288cd5fc2Smrg
3a33c354dSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
488cd5fc2Smrg
588cd5fc2Smrg# This file is free software; the Free Software Foundation
688cd5fc2Smrg# gives unlimited permission to copy and/or distribute it,
788cd5fc2Smrg# with or without modifications, as long as this notice is preserved.
888cd5fc2Smrg
988cd5fc2Smrg# This program is distributed in the hope that it will be useful,
1088cd5fc2Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1188cd5fc2Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1288cd5fc2Smrg# PARTICULAR PURPOSE.
1388cd5fc2Smrg
1488cd5fc2Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
1588cd5fc2Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1688cd5fc2Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17a33c354dSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
18a33c354dSmrg[m4_warning([this file was generated for autoconf 2.71.
1988cd5fc2SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2088cd5fc2SmrgIf you have problems, you may need to regenerate the build system entirely.
2188cd5fc2SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2288cd5fc2Smrg
23a33c354dSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2488cd5fc2Smrg#
2588cd5fc2Smrg# This file is free software; the Free Software Foundation
2688cd5fc2Smrg# gives unlimited permission to copy and/or distribute it,
2788cd5fc2Smrg# with or without modifications, as long as this notice is preserved.
2888cd5fc2Smrg
2988cd5fc2Smrg# AM_AUTOMAKE_VERSION(VERSION)
3088cd5fc2Smrg# ----------------------------
3188cd5fc2Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3288cd5fc2Smrg# generated from the m4 files accompanying Automake X.Y.
3388cd5fc2Smrg# (This private macro should not be called outside this file.)
3488cd5fc2SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35a33c354dSmrg[am__api_version='1.16'
3688cd5fc2Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3788cd5fc2Smrgdnl require some minimum version.  Point them to the right macro.
38a33c354dSmrgm4_if([$1], [1.16.5], [],
3988cd5fc2Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4088cd5fc2Smrg])
4188cd5fc2Smrg
4288cd5fc2Smrg# _AM_AUTOCONF_VERSION(VERSION)
4388cd5fc2Smrg# -----------------------------
4488cd5fc2Smrg# aclocal traces this macro to find the Autoconf version.
4588cd5fc2Smrg# This is a private macro too.  Using m4_define simplifies
4688cd5fc2Smrg# the logic in aclocal, which can simply ignore this definition.
4788cd5fc2Smrgm4_define([_AM_AUTOCONF_VERSION], [])
4888cd5fc2Smrg
4988cd5fc2Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5088cd5fc2Smrg# -------------------------------
5188cd5fc2Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5288cd5fc2Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5388cd5fc2SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54a33c354dSmrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
5588cd5fc2Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5688cd5fc2Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5788cd5fc2Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5888cd5fc2Smrg
5988cd5fc2Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6088cd5fc2Smrg
61a33c354dSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6288cd5fc2Smrg#
6388cd5fc2Smrg# This file is free software; the Free Software Foundation
6488cd5fc2Smrg# gives unlimited permission to copy and/or distribute it,
6588cd5fc2Smrg# with or without modifications, as long as this notice is preserved.
6688cd5fc2Smrg
6788cd5fc2Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6888cd5fc2Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6988cd5fc2Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7088cd5fc2Smrg#
7188cd5fc2Smrg# Of course, Automake must honor this variable whenever it calls a
7288cd5fc2Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7388cd5fc2Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7488cd5fc2Smrg# depending on how configure is run.  This is pretty annoying, since
7588cd5fc2Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7688cd5fc2Smrg# source directory, any form will work fine, but in subdirectories a
7788cd5fc2Smrg# relative path needs to be adjusted first.
7888cd5fc2Smrg#
7988cd5fc2Smrg# $ac_aux_dir/missing
8088cd5fc2Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8188cd5fc2Smrg# $top_srcdir/$ac_aux_dir/missing
8288cd5fc2Smrg#    fails if $ac_aux_dir is absolute,
8388cd5fc2Smrg#    fails when called from a subdirectory in a VPATH build with
8488cd5fc2Smrg#          a relative $ac_aux_dir
8588cd5fc2Smrg#
8688cd5fc2Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8788cd5fc2Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8888cd5fc2Smrg# harmless because $srcdir is '.', but things will broke when you
8988cd5fc2Smrg# start a VPATH build or use an absolute $srcdir.
9088cd5fc2Smrg#
9188cd5fc2Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9288cd5fc2Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9388cd5fc2Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9488cd5fc2Smrg# and then we would define $MISSING as
9588cd5fc2Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9688cd5fc2Smrg# This will work as long as MISSING is not called from configure, because
9788cd5fc2Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9888cd5fc2Smrg# However there are other variables, like CC, which are often used in
9988cd5fc2Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10088cd5fc2Smrg#
10188cd5fc2Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10288cd5fc2Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10388cd5fc2Smrg# configured tree to be moved without reconfiguration.
10488cd5fc2Smrg
10588cd5fc2SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10688cd5fc2Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10788cd5fc2Smrg# Expand $ac_aux_dir to an absolute path.
10888cd5fc2Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10988cd5fc2Smrg])
11088cd5fc2Smrg
11188cd5fc2Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11288cd5fc2Smrg
113a33c354dSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11488cd5fc2Smrg#
11588cd5fc2Smrg# This file is free software; the Free Software Foundation
11688cd5fc2Smrg# gives unlimited permission to copy and/or distribute it,
11788cd5fc2Smrg# with or without modifications, as long as this notice is preserved.
11888cd5fc2Smrg
11988cd5fc2Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12088cd5fc2Smrg# -------------------------------------
12188cd5fc2Smrg# Define a conditional.
12288cd5fc2SmrgAC_DEFUN([AM_CONDITIONAL],
12388cd5fc2Smrg[AC_PREREQ([2.52])dnl
12488cd5fc2Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12588cd5fc2Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12688cd5fc2SmrgAC_SUBST([$1_TRUE])dnl
12788cd5fc2SmrgAC_SUBST([$1_FALSE])dnl
12888cd5fc2Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12988cd5fc2Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13088cd5fc2Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13188cd5fc2Smrgif $2; then
13288cd5fc2Smrg  $1_TRUE=
13388cd5fc2Smrg  $1_FALSE='#'
13488cd5fc2Smrgelse
13588cd5fc2Smrg  $1_TRUE='#'
13688cd5fc2Smrg  $1_FALSE=
13788cd5fc2Smrgfi
13888cd5fc2SmrgAC_CONFIG_COMMANDS_PRE(
13988cd5fc2Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14088cd5fc2Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14188cd5fc2SmrgUsually this means the macro was only invoked conditionally.]])
14288cd5fc2Smrgfi])])
14388cd5fc2Smrg
144a33c354dSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
14588cd5fc2Smrg#
14688cd5fc2Smrg# This file is free software; the Free Software Foundation
14788cd5fc2Smrg# gives unlimited permission to copy and/or distribute it,
14888cd5fc2Smrg# with or without modifications, as long as this notice is preserved.
14988cd5fc2Smrg
15088cd5fc2Smrg
15188cd5fc2Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15288cd5fc2Smrg# written in clear, in which case automake, when reading aclocal.m4,
15388cd5fc2Smrg# will think it sees a *use*, and therefore will trigger all it's
15488cd5fc2Smrg# C support machinery.  Also note that it means that autoscan, seeing
15588cd5fc2Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
15688cd5fc2Smrg
15788cd5fc2Smrg
15888cd5fc2Smrg# _AM_DEPENDENCIES(NAME)
15988cd5fc2Smrg# ----------------------
16088cd5fc2Smrg# See how the compiler implements dependency checking.
16188cd5fc2Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16288cd5fc2Smrg# We try a few techniques and use that to set a single cache variable.
16388cd5fc2Smrg#
16488cd5fc2Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16588cd5fc2Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16688cd5fc2Smrg# dependency, and given that the user is not expected to run this macro,
16788cd5fc2Smrg# just rely on AC_PROG_CC.
16888cd5fc2SmrgAC_DEFUN([_AM_DEPENDENCIES],
16988cd5fc2Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17088cd5fc2SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17188cd5fc2SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17288cd5fc2SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17388cd5fc2Smrg
17488cd5fc2Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17588cd5fc2Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17688cd5fc2Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17788cd5fc2Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17888cd5fc2Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17988cd5fc2Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18088cd5fc2Smrg                    [depcc="$$1"   am_compiler_list=])
18188cd5fc2Smrg
18288cd5fc2SmrgAC_CACHE_CHECK([dependency style of $depcc],
18388cd5fc2Smrg               [am_cv_$1_dependencies_compiler_type],
18488cd5fc2Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18588cd5fc2Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
18688cd5fc2Smrg  # making bogus files that we don't know about and never remove.  For
18788cd5fc2Smrg  # instance it was reported that on HP-UX the gcc test will end up
18888cd5fc2Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18988cd5fc2Smrg  # in D".
19088cd5fc2Smrg  rm -rf conftest.dir
19188cd5fc2Smrg  mkdir conftest.dir
19288cd5fc2Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19388cd5fc2Smrg  # using a relative directory.
19488cd5fc2Smrg  cp "$am_depcomp" conftest.dir
19588cd5fc2Smrg  cd conftest.dir
19688cd5fc2Smrg  # We will build objects and dependencies in a subdirectory because
19788cd5fc2Smrg  # it helps to detect inapplicable dependency modes.  For instance
19888cd5fc2Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19988cd5fc2Smrg  # side effect of compilation, but ICC will put the dependencies in
20088cd5fc2Smrg  # the current directory while Tru64 will put them in the object
20188cd5fc2Smrg  # directory.
20288cd5fc2Smrg  mkdir sub
20388cd5fc2Smrg
20488cd5fc2Smrg  am_cv_$1_dependencies_compiler_type=none
20588cd5fc2Smrg  if test "$am_compiler_list" = ""; then
20688cd5fc2Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20788cd5fc2Smrg  fi
20888cd5fc2Smrg  am__universal=false
20988cd5fc2Smrg  m4_case([$1], [CC],
21088cd5fc2Smrg    [case " $depcc " in #(
21188cd5fc2Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21288cd5fc2Smrg     esac],
21388cd5fc2Smrg    [CXX],
21488cd5fc2Smrg    [case " $depcc " in #(
21588cd5fc2Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21688cd5fc2Smrg     esac])
21788cd5fc2Smrg
21888cd5fc2Smrg  for depmode in $am_compiler_list; do
21988cd5fc2Smrg    # Setup a source with many dependencies, because some compilers
22088cd5fc2Smrg    # like to wrap large dependency lists on column 80 (with \), and
22188cd5fc2Smrg    # we should not choose a depcomp mode which is confused by this.
22288cd5fc2Smrg    #
22388cd5fc2Smrg    # We need to recreate these files for each test, as the compiler may
22488cd5fc2Smrg    # overwrite some of them when testing with obscure command lines.
22588cd5fc2Smrg    # This happens at least with the AIX C compiler.
22688cd5fc2Smrg    : > sub/conftest.c
22788cd5fc2Smrg    for i in 1 2 3 4 5 6; do
22888cd5fc2Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22988cd5fc2Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23088cd5fc2Smrg      # Solaris 10 /bin/sh.
23188cd5fc2Smrg      echo '/* dummy */' > sub/conftst$i.h
23288cd5fc2Smrg    done
23388cd5fc2Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23488cd5fc2Smrg
23588cd5fc2Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23688cd5fc2Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23788cd5fc2Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23888cd5fc2Smrg    # versions had trouble with output in subdirs.
23988cd5fc2Smrg    am__obj=sub/conftest.${OBJEXT-o}
24088cd5fc2Smrg    am__minus_obj="-o $am__obj"
24188cd5fc2Smrg    case $depmode in
24288cd5fc2Smrg    gcc)
24388cd5fc2Smrg      # This depmode causes a compiler race in universal mode.
24488cd5fc2Smrg      test "$am__universal" = false || continue
24588cd5fc2Smrg      ;;
24688cd5fc2Smrg    nosideeffect)
24788cd5fc2Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24888cd5fc2Smrg      # only be used when explicitly requested.
24988cd5fc2Smrg      if test "x$enable_dependency_tracking" = xyes; then
25088cd5fc2Smrg	continue
25188cd5fc2Smrg      else
25288cd5fc2Smrg	break
25388cd5fc2Smrg      fi
25488cd5fc2Smrg      ;;
25588cd5fc2Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25688cd5fc2Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25788cd5fc2Smrg      # not run yet.  These depmodes are late enough in the game, and
25888cd5fc2Smrg      # so weak that their functioning should not be impacted.
25988cd5fc2Smrg      am__obj=conftest.${OBJEXT-o}
26088cd5fc2Smrg      am__minus_obj=
26188cd5fc2Smrg      ;;
26288cd5fc2Smrg    none) break ;;
26388cd5fc2Smrg    esac
26488cd5fc2Smrg    if depmode=$depmode \
26588cd5fc2Smrg       source=sub/conftest.c object=$am__obj \
26688cd5fc2Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26788cd5fc2Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26888cd5fc2Smrg         >/dev/null 2>conftest.err &&
26988cd5fc2Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27088cd5fc2Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27188cd5fc2Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27288cd5fc2Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27388cd5fc2Smrg      # icc doesn't choke on unknown options, it will just issue warnings
27488cd5fc2Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
27588cd5fc2Smrg      # that says an option was ignored or not supported.
27688cd5fc2Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27788cd5fc2Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27888cd5fc2Smrg      # The diagnosis changed in icc 8.0:
27988cd5fc2Smrg      #   icc: Command line remark: option '-MP' not supported
28088cd5fc2Smrg      if (grep 'ignoring option' conftest.err ||
28188cd5fc2Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28288cd5fc2Smrg        am_cv_$1_dependencies_compiler_type=$depmode
28388cd5fc2Smrg        break
28488cd5fc2Smrg      fi
28588cd5fc2Smrg    fi
28688cd5fc2Smrg  done
28788cd5fc2Smrg
28888cd5fc2Smrg  cd ..
28988cd5fc2Smrg  rm -rf conftest.dir
29088cd5fc2Smrgelse
29188cd5fc2Smrg  am_cv_$1_dependencies_compiler_type=none
29288cd5fc2Smrgfi
29388cd5fc2Smrg])
29488cd5fc2SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29588cd5fc2SmrgAM_CONDITIONAL([am__fastdep$1], [
29688cd5fc2Smrg  test "x$enable_dependency_tracking" != xno \
29788cd5fc2Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29888cd5fc2Smrg])
29988cd5fc2Smrg
30088cd5fc2Smrg
30188cd5fc2Smrg# AM_SET_DEPDIR
30288cd5fc2Smrg# -------------
30388cd5fc2Smrg# Choose a directory name for dependency files.
30488cd5fc2Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30588cd5fc2SmrgAC_DEFUN([AM_SET_DEPDIR],
30688cd5fc2Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30788cd5fc2SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30888cd5fc2Smrg])
30988cd5fc2Smrg
31088cd5fc2Smrg
31188cd5fc2Smrg# AM_DEP_TRACK
31288cd5fc2Smrg# ------------
31388cd5fc2SmrgAC_DEFUN([AM_DEP_TRACK],
31488cd5fc2Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31588cd5fc2SmrgAS_HELP_STRING(
31688cd5fc2Smrg  [--enable-dependency-tracking],
31788cd5fc2Smrg  [do not reject slow dependency extractors])
31888cd5fc2SmrgAS_HELP_STRING(
31988cd5fc2Smrg  [--disable-dependency-tracking],
32088cd5fc2Smrg  [speeds up one-time build])])
32188cd5fc2Smrgif test "x$enable_dependency_tracking" != xno; then
32288cd5fc2Smrg  am_depcomp="$ac_aux_dir/depcomp"
32388cd5fc2Smrg  AMDEPBACKSLASH='\'
32488cd5fc2Smrg  am__nodep='_no'
32588cd5fc2Smrgfi
32688cd5fc2SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32788cd5fc2SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32888cd5fc2Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32988cd5fc2SmrgAC_SUBST([am__nodep])dnl
33088cd5fc2Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33188cd5fc2Smrg])
33288cd5fc2Smrg
33388cd5fc2Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33488cd5fc2Smrg
335a33c354dSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
33688cd5fc2Smrg#
33788cd5fc2Smrg# This file is free software; the Free Software Foundation
33888cd5fc2Smrg# gives unlimited permission to copy and/or distribute it,
33988cd5fc2Smrg# with or without modifications, as long as this notice is preserved.
34088cd5fc2Smrg
34188cd5fc2Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34288cd5fc2Smrg# ------------------------------
34388cd5fc2SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34488cd5fc2Smrg[{
34588cd5fc2Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
34688cd5fc2Smrg  # are listed without --file.  Let's play safe and only enable the eval
34788cd5fc2Smrg  # if we detect the quoting.
348a33c354dSmrg  # TODO: see whether this extra hack can be removed once we start
349a33c354dSmrg  # requiring Autoconf 2.70 or later.
350a33c354dSmrg  AS_CASE([$CONFIG_FILES],
351a33c354dSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
352a33c354dSmrg          [*], [set x $CONFIG_FILES])
35388cd5fc2Smrg  shift
354a33c354dSmrg  # Used to flag and report bootstrapping failures.
355a33c354dSmrg  am_rc=0
356a33c354dSmrg  for am_mf
35788cd5fc2Smrg  do
35888cd5fc2Smrg    # Strip MF so we end up with the name of the file.
359a33c354dSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360a33c354dSmrg    # Check whether this is an Automake generated Makefile which includes
361a33c354dSmrg    # dependency-tracking related rules and includes.
362a33c354dSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
36388cd5fc2Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
364a33c354dSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365a33c354dSmrg      || continue
366a33c354dSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367a33c354dSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368a33c354dSmrg    AM_RUN_LOG([cd "$am_dirpart" \
369a33c354dSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370a33c354dSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
37188cd5fc2Smrg  done
372a33c354dSmrg  if test $am_rc -ne 0; then
373a33c354dSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374a33c354dSmrg    for automatic dependency tracking.  If GNU make was not used, consider
375a33c354dSmrg    re-running the configure script with MAKE="gmake" (or whatever is
376a33c354dSmrg    necessary).  You can also try re-running configure with the
377a33c354dSmrg    '--disable-dependency-tracking' option to at least be able to build
378a33c354dSmrg    the package (albeit without support for automatic dependency tracking).])
379a33c354dSmrg  fi
380a33c354dSmrg  AS_UNSET([am_dirpart])
381a33c354dSmrg  AS_UNSET([am_filepart])
382a33c354dSmrg  AS_UNSET([am_mf])
383a33c354dSmrg  AS_UNSET([am_rc])
384a33c354dSmrg  rm -f conftest-deps.mk
38588cd5fc2Smrg}
38688cd5fc2Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
38788cd5fc2Smrg
38888cd5fc2Smrg
38988cd5fc2Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39088cd5fc2Smrg# -----------------------------
39188cd5fc2Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
39288cd5fc2Smrg#
393a33c354dSmrg# This code is only required when automatic dependency tracking is enabled.
394a33c354dSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395a33c354dSmrg# order to bootstrap the dependency handling code.
39688cd5fc2SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
39788cd5fc2Smrg[AC_CONFIG_COMMANDS([depfiles],
39888cd5fc2Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399a33c354dSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
40088cd5fc2Smrg
40188cd5fc2Smrg# Do all the work for Automake.                             -*- Autoconf -*-
40288cd5fc2Smrg
403a33c354dSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
40488cd5fc2Smrg#
40588cd5fc2Smrg# This file is free software; the Free Software Foundation
40688cd5fc2Smrg# gives unlimited permission to copy and/or distribute it,
40788cd5fc2Smrg# with or without modifications, as long as this notice is preserved.
40888cd5fc2Smrg
40988cd5fc2Smrg# This macro actually does too much.  Some checks are only needed if
41088cd5fc2Smrg# your package does certain things.  But this isn't really a big deal.
41188cd5fc2Smrg
41288cd5fc2Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41388cd5fc2Smrgm4_define([AC_PROG_CC],
41488cd5fc2Smrgm4_defn([AC_PROG_CC])
41588cd5fc2Smrg[_AM_PROG_CC_C_O
41688cd5fc2Smrg])
41788cd5fc2Smrg
41888cd5fc2Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41988cd5fc2Smrg# AM_INIT_AUTOMAKE([OPTIONS])
42088cd5fc2Smrg# -----------------------------------------------
42188cd5fc2Smrg# The call with PACKAGE and VERSION arguments is the old style
42288cd5fc2Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42388cd5fc2Smrg# and VERSION should now be passed to AC_INIT and removed from
42488cd5fc2Smrg# the call to AM_INIT_AUTOMAKE.
42588cd5fc2Smrg# We support both call styles for the transition.  After
42688cd5fc2Smrg# the next Automake release, Autoconf can make the AC_INIT
42788cd5fc2Smrg# arguments mandatory, and then we can depend on a new Autoconf
42888cd5fc2Smrg# release and drop the old call support.
42988cd5fc2SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43088cd5fc2Smrg[AC_PREREQ([2.65])dnl
431a33c354dSmrgm4_ifdef([_$0_ALREADY_INIT],
432a33c354dSmrg  [m4_fatal([$0 expanded multiple times
433a33c354dSmrg]m4_defn([_$0_ALREADY_INIT]))],
434a33c354dSmrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
43588cd5fc2Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43688cd5fc2Smrgdnl the ones we care about.
43788cd5fc2Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43888cd5fc2SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43988cd5fc2SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44088cd5fc2Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44188cd5fc2Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44288cd5fc2Smrg  # is not polluted with repeated "-I."
44388cd5fc2Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44488cd5fc2Smrg  # test to see if srcdir already configured
44588cd5fc2Smrg  if test -f $srcdir/config.status; then
44688cd5fc2Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44788cd5fc2Smrg  fi
44888cd5fc2Smrgfi
44988cd5fc2Smrg
45088cd5fc2Smrg# test whether we have cygpath
45188cd5fc2Smrgif test -z "$CYGPATH_W"; then
45288cd5fc2Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45388cd5fc2Smrg    CYGPATH_W='cygpath -w'
45488cd5fc2Smrg  else
45588cd5fc2Smrg    CYGPATH_W=echo
45688cd5fc2Smrg  fi
45788cd5fc2Smrgfi
45888cd5fc2SmrgAC_SUBST([CYGPATH_W])
45988cd5fc2Smrg
46088cd5fc2Smrg# Define the identity of the package.
46188cd5fc2Smrgdnl Distinguish between old-style and new-style calls.
46288cd5fc2Smrgm4_ifval([$2],
46388cd5fc2Smrg[AC_DIAGNOSE([obsolete],
46488cd5fc2Smrg             [$0: two- and three-arguments forms are deprecated.])
46588cd5fc2Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46688cd5fc2Smrg AC_SUBST([PACKAGE], [$1])dnl
46788cd5fc2Smrg AC_SUBST([VERSION], [$2])],
46888cd5fc2Smrg[_AM_SET_OPTIONS([$1])dnl
46988cd5fc2Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47088cd5fc2Smrgm4_if(
471a33c354dSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47288cd5fc2Smrg  [ok:ok],,
47388cd5fc2Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47488cd5fc2Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47588cd5fc2Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
47688cd5fc2Smrg
47788cd5fc2Smrg_AM_IF_OPTION([no-define],,
47888cd5fc2Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47988cd5fc2Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
48088cd5fc2Smrg
48188cd5fc2Smrg# Some tools Automake needs.
48288cd5fc2SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48388cd5fc2SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48488cd5fc2SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48588cd5fc2SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48688cd5fc2SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48788cd5fc2SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48888cd5fc2SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48988cd5fc2SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49088cd5fc2SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49188cd5fc2SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49288cd5fc2Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49388cd5fc2Smrg# dies out for good.  For more background, see:
494a33c354dSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
495a33c354dSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49688cd5fc2SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
497a33c354dSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
498a33c354dSmrg# system "awk" is bad on some platforms.
49988cd5fc2SmrgAC_REQUIRE([AC_PROG_AWK])dnl
50088cd5fc2SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50188cd5fc2SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50288cd5fc2Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50388cd5fc2Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50488cd5fc2Smrg			     [_AM_PROG_TAR([v7])])])
50588cd5fc2Smrg_AM_IF_OPTION([no-dependencies],,
50688cd5fc2Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50788cd5fc2Smrg		  [_AM_DEPENDENCIES([CC])],
50888cd5fc2Smrg		  [m4_define([AC_PROG_CC],
50988cd5fc2Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51088cd5fc2SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51188cd5fc2Smrg		  [_AM_DEPENDENCIES([CXX])],
51288cd5fc2Smrg		  [m4_define([AC_PROG_CXX],
51388cd5fc2Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51488cd5fc2SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51588cd5fc2Smrg		  [_AM_DEPENDENCIES([OBJC])],
51688cd5fc2Smrg		  [m4_define([AC_PROG_OBJC],
51788cd5fc2Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51888cd5fc2SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51988cd5fc2Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52088cd5fc2Smrg		  [m4_define([AC_PROG_OBJCXX],
52188cd5fc2Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52288cd5fc2Smrg])
523a33c354dSmrg# Variables for tags utilities; see am/tags.am
524a33c354dSmrgif test -z "$CTAGS"; then
525a33c354dSmrg  CTAGS=ctags
526a33c354dSmrgfi
527a33c354dSmrgAC_SUBST([CTAGS])
528a33c354dSmrgif test -z "$ETAGS"; then
529a33c354dSmrg  ETAGS=etags
530a33c354dSmrgfi
531a33c354dSmrgAC_SUBST([ETAGS])
532a33c354dSmrgif test -z "$CSCOPE"; then
533a33c354dSmrg  CSCOPE=cscope
534a33c354dSmrgfi
535a33c354dSmrgAC_SUBST([CSCOPE])
536a33c354dSmrg
53788cd5fc2SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
53888cd5fc2Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53988cd5fc2Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54088cd5fc2Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
54188cd5fc2SmrgAC_CONFIG_COMMANDS_PRE(dnl
54288cd5fc2Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
54388cd5fc2Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
54488cd5fc2Smrg
54588cd5fc2Smrg# POSIX will say in a future version that running "rm -f" with no argument
54688cd5fc2Smrg# is OK; and we want to be able to make that assumption in our Makefile
54788cd5fc2Smrg# recipes.  So use an aggressive probe to check that the usage we want is
54888cd5fc2Smrg# actually supported "in the wild" to an acceptable degree.
54988cd5fc2Smrg# See automake bug#10828.
55088cd5fc2Smrg# To make any issue more visible, cause the running configure to be aborted
55188cd5fc2Smrg# by default if the 'rm' program in use doesn't match our expectations; the
55288cd5fc2Smrg# user can still override this though.
55388cd5fc2Smrgif rm -f && rm -fr && rm -rf; then : OK; else
55488cd5fc2Smrg  cat >&2 <<'END'
55588cd5fc2SmrgOops!
55688cd5fc2Smrg
55788cd5fc2SmrgYour 'rm' program seems unable to run without file operands specified
55888cd5fc2Smrgon the command line, even when the '-f' option is present.  This is contrary
55988cd5fc2Smrgto the behaviour of most rm programs out there, and not conforming with
56088cd5fc2Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
56188cd5fc2Smrg
56288cd5fc2SmrgPlease tell bug-automake@gnu.org about your system, including the value
56388cd5fc2Smrgof your $PATH and any error possibly output before this message.  This
56488cd5fc2Smrgcan help us improve future automake versions.
56588cd5fc2Smrg
56688cd5fc2SmrgEND
56788cd5fc2Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
56888cd5fc2Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56988cd5fc2Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
57088cd5fc2Smrg    echo >&2
57188cd5fc2Smrg  else
57288cd5fc2Smrg    cat >&2 <<'END'
57388cd5fc2SmrgAborting the configuration process, to ensure you take notice of the issue.
57488cd5fc2Smrg
57588cd5fc2SmrgYou can download and install GNU coreutils to get an 'rm' implementation
576a33c354dSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
57788cd5fc2Smrg
57888cd5fc2SmrgIf you want to complete the configuration process using your problematic
57988cd5fc2Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
58088cd5fc2Smrgto "yes", and re-run configure.
58188cd5fc2Smrg
58288cd5fc2SmrgEND
58388cd5fc2Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
58488cd5fc2Smrg  fi
58588cd5fc2Smrgfi
586a33c354dSmrgdnl The trailing newline in this macro's definition is deliberate, for
587a33c354dSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
588a33c354dSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
58988cd5fc2Smrg])
59088cd5fc2Smrg
59188cd5fc2Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
59288cd5fc2Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
59388cd5fc2Smrgdnl mangled by Autoconf and run in a shell conditional statement.
59488cd5fc2Smrgm4_define([_AC_COMPILER_EXEEXT],
59588cd5fc2Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
59688cd5fc2Smrg
59788cd5fc2Smrg# When config.status generates a header, we must update the stamp-h file.
59888cd5fc2Smrg# This file resides in the same directory as the config header
59988cd5fc2Smrg# that is generated.  The stamp files are numbered to have different names.
60088cd5fc2Smrg
60188cd5fc2Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
60288cd5fc2Smrg# loop where config.status creates the headers, so we can generate
60388cd5fc2Smrg# our stamp files there.
60488cd5fc2SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
60588cd5fc2Smrg[# Compute $1's index in $config_headers.
60688cd5fc2Smrg_am_arg=$1
60788cd5fc2Smrg_am_stamp_count=1
60888cd5fc2Smrgfor _am_header in $config_headers :; do
60988cd5fc2Smrg  case $_am_header in
61088cd5fc2Smrg    $_am_arg | $_am_arg:* )
61188cd5fc2Smrg      break ;;
61288cd5fc2Smrg    * )
61388cd5fc2Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
61488cd5fc2Smrg  esac
61588cd5fc2Smrgdone
61688cd5fc2Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
61788cd5fc2Smrg
618a33c354dSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
61988cd5fc2Smrg#
62088cd5fc2Smrg# This file is free software; the Free Software Foundation
62188cd5fc2Smrg# gives unlimited permission to copy and/or distribute it,
62288cd5fc2Smrg# with or without modifications, as long as this notice is preserved.
62388cd5fc2Smrg
62488cd5fc2Smrg# AM_PROG_INSTALL_SH
62588cd5fc2Smrg# ------------------
62688cd5fc2Smrg# Define $install_sh.
62788cd5fc2SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
62888cd5fc2Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
629a33c354dSmrgif test x"${install_sh+set}" != xset; then
63088cd5fc2Smrg  case $am_aux_dir in
63188cd5fc2Smrg  *\ * | *\	*)
63288cd5fc2Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
63388cd5fc2Smrg  *)
63488cd5fc2Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
63588cd5fc2Smrg  esac
63688cd5fc2Smrgfi
63788cd5fc2SmrgAC_SUBST([install_sh])])
63888cd5fc2Smrg
639a33c354dSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
64088cd5fc2Smrg#
64188cd5fc2Smrg# This file is free software; the Free Software Foundation
64288cd5fc2Smrg# gives unlimited permission to copy and/or distribute it,
64388cd5fc2Smrg# with or without modifications, as long as this notice is preserved.
64488cd5fc2Smrg
64588cd5fc2Smrg# Check whether the underlying file-system supports filenames
64688cd5fc2Smrg# with a leading dot.  For instance MS-DOS doesn't.
64788cd5fc2SmrgAC_DEFUN([AM_SET_LEADING_DOT],
64888cd5fc2Smrg[rm -rf .tst 2>/dev/null
64988cd5fc2Smrgmkdir .tst 2>/dev/null
65088cd5fc2Smrgif test -d .tst; then
65188cd5fc2Smrg  am__leading_dot=.
65288cd5fc2Smrgelse
65388cd5fc2Smrg  am__leading_dot=_
65488cd5fc2Smrgfi
65588cd5fc2Smrgrmdir .tst 2>/dev/null
65688cd5fc2SmrgAC_SUBST([am__leading_dot])])
65788cd5fc2Smrg
65888cd5fc2Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
65988cd5fc2Smrg
660a33c354dSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
66188cd5fc2Smrg#
66288cd5fc2Smrg# This file is free software; the Free Software Foundation
66388cd5fc2Smrg# gives unlimited permission to copy and/or distribute it,
66488cd5fc2Smrg# with or without modifications, as long as this notice is preserved.
66588cd5fc2Smrg
66688cd5fc2Smrg# AM_MAKE_INCLUDE()
66788cd5fc2Smrg# -----------------
668a33c354dSmrg# Check whether make has an 'include' directive that can support all
669a33c354dSmrg# the idioms we need for our automatic dependency tracking code.
67088cd5fc2SmrgAC_DEFUN([AM_MAKE_INCLUDE],
671a33c354dSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
672a33c354dSmrgcat > confinc.mk << 'END'
67388cd5fc2Smrgam__doit:
674a33c354dSmrg	@echo this is the am__doit target >confinc.out
67588cd5fc2Smrg.PHONY: am__doit
67688cd5fc2SmrgEND
67788cd5fc2Smrgam__include="#"
67888cd5fc2Smrgam__quote=
679a33c354dSmrg# BSD make does it like this.
680a33c354dSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
681a33c354dSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
682a33c354dSmrgecho 'include confinc.mk # ignored' > confmf.GNU
683a33c354dSmrg_am_result=no
684a33c354dSmrgfor s in GNU BSD; do
685a33c354dSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
686a33c354dSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
687a33c354dSmrg      ['0:this is the am__doit target'],
688a33c354dSmrg      [AS_CASE([$s],
689a33c354dSmrg          [BSD], [am__include='.include' am__quote='"'],
690a33c354dSmrg          [am__include='include' am__quote=''])])
691a33c354dSmrg  if test "$am__include" != "#"; then
692a33c354dSmrg    _am_result="yes ($s style)"
693a33c354dSmrg    break
694a33c354dSmrg  fi
695a33c354dSmrgdone
696a33c354dSmrgrm -f confinc.* confmf.*
697a33c354dSmrgAC_MSG_RESULT([${_am_result}])
698a33c354dSmrgAC_SUBST([am__include])])
699a33c354dSmrgAC_SUBST([am__quote])])
70088cd5fc2Smrg
70188cd5fc2Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
70288cd5fc2Smrg
703a33c354dSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
70488cd5fc2Smrg#
70588cd5fc2Smrg# This file is free software; the Free Software Foundation
70688cd5fc2Smrg# gives unlimited permission to copy and/or distribute it,
70788cd5fc2Smrg# with or without modifications, as long as this notice is preserved.
70888cd5fc2Smrg
70988cd5fc2Smrg# AM_MISSING_PROG(NAME, PROGRAM)
71088cd5fc2Smrg# ------------------------------
71188cd5fc2SmrgAC_DEFUN([AM_MISSING_PROG],
71288cd5fc2Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71388cd5fc2Smrg$1=${$1-"${am_missing_run}$2"}
71488cd5fc2SmrgAC_SUBST($1)])
71588cd5fc2Smrg
71688cd5fc2Smrg# AM_MISSING_HAS_RUN
71788cd5fc2Smrg# ------------------
71888cd5fc2Smrg# Define MISSING if not defined so far and test if it is modern enough.
71988cd5fc2Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
72088cd5fc2SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
72188cd5fc2Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
72288cd5fc2SmrgAC_REQUIRE_AUX_FILE([missing])dnl
72388cd5fc2Smrgif test x"${MISSING+set}" != xset; then
724a33c354dSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
72588cd5fc2Smrgfi
72688cd5fc2Smrg# Use eval to expand $SHELL
72788cd5fc2Smrgif eval "$MISSING --is-lightweight"; then
72888cd5fc2Smrg  am_missing_run="$MISSING "
72988cd5fc2Smrgelse
73088cd5fc2Smrg  am_missing_run=
73188cd5fc2Smrg  AC_MSG_WARN(['missing' script is too old or missing])
73288cd5fc2Smrgfi
73388cd5fc2Smrg])
73488cd5fc2Smrg
73588cd5fc2Smrg# Helper functions for option handling.                     -*- Autoconf -*-
73688cd5fc2Smrg
737a33c354dSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
73888cd5fc2Smrg#
73988cd5fc2Smrg# This file is free software; the Free Software Foundation
74088cd5fc2Smrg# gives unlimited permission to copy and/or distribute it,
74188cd5fc2Smrg# with or without modifications, as long as this notice is preserved.
74288cd5fc2Smrg
74388cd5fc2Smrg# _AM_MANGLE_OPTION(NAME)
74488cd5fc2Smrg# -----------------------
74588cd5fc2SmrgAC_DEFUN([_AM_MANGLE_OPTION],
74688cd5fc2Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
74788cd5fc2Smrg
74888cd5fc2Smrg# _AM_SET_OPTION(NAME)
74988cd5fc2Smrg# --------------------
75088cd5fc2Smrg# Set option NAME.  Presently that only means defining a flag for this option.
75188cd5fc2SmrgAC_DEFUN([_AM_SET_OPTION],
75288cd5fc2Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
75388cd5fc2Smrg
75488cd5fc2Smrg# _AM_SET_OPTIONS(OPTIONS)
75588cd5fc2Smrg# ------------------------
75688cd5fc2Smrg# OPTIONS is a space-separated list of Automake options.
75788cd5fc2SmrgAC_DEFUN([_AM_SET_OPTIONS],
75888cd5fc2Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
75988cd5fc2Smrg
76088cd5fc2Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76188cd5fc2Smrg# -------------------------------------------
76288cd5fc2Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76388cd5fc2SmrgAC_DEFUN([_AM_IF_OPTION],
76488cd5fc2Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76588cd5fc2Smrg
766a33c354dSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
76788cd5fc2Smrg#
76888cd5fc2Smrg# This file is free software; the Free Software Foundation
76988cd5fc2Smrg# gives unlimited permission to copy and/or distribute it,
77088cd5fc2Smrg# with or without modifications, as long as this notice is preserved.
77188cd5fc2Smrg
77288cd5fc2Smrg# _AM_PROG_CC_C_O
77388cd5fc2Smrg# ---------------
77488cd5fc2Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77588cd5fc2Smrg# to automatically call this.
77688cd5fc2SmrgAC_DEFUN([_AM_PROG_CC_C_O],
77788cd5fc2Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
77888cd5fc2SmrgAC_REQUIRE_AUX_FILE([compile])dnl
77988cd5fc2SmrgAC_LANG_PUSH([C])dnl
78088cd5fc2SmrgAC_CACHE_CHECK(
78188cd5fc2Smrg  [whether $CC understands -c and -o together],
78288cd5fc2Smrg  [am_cv_prog_cc_c_o],
78388cd5fc2Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78488cd5fc2Smrg  # Make sure it works both with $CC and with simple cc.
78588cd5fc2Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78688cd5fc2Smrg  # compilers refuse to overwrite an existing .o file with -o,
78788cd5fc2Smrg  # though they will create one.
78888cd5fc2Smrg  am_cv_prog_cc_c_o=yes
78988cd5fc2Smrg  for am_i in 1 2; do
79088cd5fc2Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79188cd5fc2Smrg         && test -f conftest2.$ac_objext; then
79288cd5fc2Smrg      : OK
79388cd5fc2Smrg    else
79488cd5fc2Smrg      am_cv_prog_cc_c_o=no
79588cd5fc2Smrg      break
79688cd5fc2Smrg    fi
79788cd5fc2Smrg  done
79888cd5fc2Smrg  rm -f core conftest*
79988cd5fc2Smrg  unset am_i])
80088cd5fc2Smrgif test "$am_cv_prog_cc_c_o" != yes; then
80188cd5fc2Smrg   # Losing compiler, so override with the script.
80288cd5fc2Smrg   # FIXME: It is wrong to rewrite CC.
80388cd5fc2Smrg   # But if we don't then we get into trouble of one sort or another.
80488cd5fc2Smrg   # A longer-term fix would be to have automake use am__CC in this case,
80588cd5fc2Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80688cd5fc2Smrg   CC="$am_aux_dir/compile $CC"
80788cd5fc2Smrgfi
80888cd5fc2SmrgAC_LANG_POP([C])])
80988cd5fc2Smrg
81088cd5fc2Smrg# For backward compatibility.
81188cd5fc2SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
81288cd5fc2Smrg
813a33c354dSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
81488cd5fc2Smrg#
81588cd5fc2Smrg# This file is free software; the Free Software Foundation
81688cd5fc2Smrg# gives unlimited permission to copy and/or distribute it,
81788cd5fc2Smrg# with or without modifications, as long as this notice is preserved.
81888cd5fc2Smrg
81988cd5fc2Smrg# AM_RUN_LOG(COMMAND)
82088cd5fc2Smrg# -------------------
82188cd5fc2Smrg# Run COMMAND, save the exit status in ac_status, and log it.
82288cd5fc2Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82388cd5fc2SmrgAC_DEFUN([AM_RUN_LOG],
82488cd5fc2Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82588cd5fc2Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82688cd5fc2Smrg   ac_status=$?
82788cd5fc2Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
82888cd5fc2Smrg   (exit $ac_status); }])
82988cd5fc2Smrg
83088cd5fc2Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
83188cd5fc2Smrg
832a33c354dSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
83388cd5fc2Smrg#
83488cd5fc2Smrg# This file is free software; the Free Software Foundation
83588cd5fc2Smrg# gives unlimited permission to copy and/or distribute it,
83688cd5fc2Smrg# with or without modifications, as long as this notice is preserved.
83788cd5fc2Smrg
83888cd5fc2Smrg# AM_SANITY_CHECK
83988cd5fc2Smrg# ---------------
84088cd5fc2SmrgAC_DEFUN([AM_SANITY_CHECK],
84188cd5fc2Smrg[AC_MSG_CHECKING([whether build environment is sane])
84288cd5fc2Smrg# Reject unsafe characters in $srcdir or the absolute working directory
84388cd5fc2Smrg# name.  Accept space and tab only in the latter.
84488cd5fc2Smrgam_lf='
84588cd5fc2Smrg'
84688cd5fc2Smrgcase `pwd` in
84788cd5fc2Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
84888cd5fc2Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
84988cd5fc2Smrgesac
85088cd5fc2Smrgcase $srcdir in
85188cd5fc2Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85288cd5fc2Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
85388cd5fc2Smrgesac
85488cd5fc2Smrg
85588cd5fc2Smrg# Do 'set' in a subshell so we don't clobber the current shell's
85688cd5fc2Smrg# arguments.  Must try -L first in case configure is actually a
85788cd5fc2Smrg# symlink; some systems play weird games with the mod time of symlinks
85888cd5fc2Smrg# (eg FreeBSD returns the mod time of the symlink's containing
85988cd5fc2Smrg# directory).
86088cd5fc2Smrgif (
86188cd5fc2Smrg   am_has_slept=no
86288cd5fc2Smrg   for am_try in 1 2; do
86388cd5fc2Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86488cd5fc2Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86588cd5fc2Smrg     if test "$[*]" = "X"; then
86688cd5fc2Smrg	# -L didn't work.
86788cd5fc2Smrg	set X `ls -t "$srcdir/configure" conftest.file`
86888cd5fc2Smrg     fi
86988cd5fc2Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
87088cd5fc2Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
87188cd5fc2Smrg
87288cd5fc2Smrg	# If neither matched, then we have a broken ls.  This can happen
87388cd5fc2Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87488cd5fc2Smrg	# broken ls alias from the environment.  This has actually
87588cd5fc2Smrg	# happened.  Such a system could not be considered "sane".
87688cd5fc2Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87788cd5fc2Smrg  alias in your environment])
87888cd5fc2Smrg     fi
87988cd5fc2Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
88088cd5fc2Smrg       break
88188cd5fc2Smrg     fi
88288cd5fc2Smrg     # Just in case.
88388cd5fc2Smrg     sleep 1
88488cd5fc2Smrg     am_has_slept=yes
88588cd5fc2Smrg   done
88688cd5fc2Smrg   test "$[2]" = conftest.file
88788cd5fc2Smrg   )
88888cd5fc2Smrgthen
88988cd5fc2Smrg   # Ok.
89088cd5fc2Smrg   :
89188cd5fc2Smrgelse
89288cd5fc2Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
89388cd5fc2SmrgCheck your system clock])
89488cd5fc2Smrgfi
89588cd5fc2SmrgAC_MSG_RESULT([yes])
89688cd5fc2Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89788cd5fc2Smrg# generated files are strictly newer.
89888cd5fc2Smrgam_sleep_pid=
89988cd5fc2Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
90088cd5fc2Smrg  ( sleep 1 ) &
90188cd5fc2Smrg  am_sleep_pid=$!
90288cd5fc2Smrgfi
90388cd5fc2SmrgAC_CONFIG_COMMANDS_PRE(
90488cd5fc2Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90588cd5fc2Smrg   if test -n "$am_sleep_pid"; then
90688cd5fc2Smrg     # Hide warnings about reused PIDs.
90788cd5fc2Smrg     wait $am_sleep_pid 2>/dev/null
90888cd5fc2Smrg   fi
90988cd5fc2Smrg   AC_MSG_RESULT([done])])
91088cd5fc2Smrgrm -f conftest.file
91188cd5fc2Smrg])
91288cd5fc2Smrg
913a33c354dSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
91488cd5fc2Smrg#
91588cd5fc2Smrg# This file is free software; the Free Software Foundation
91688cd5fc2Smrg# gives unlimited permission to copy and/or distribute it,
91788cd5fc2Smrg# with or without modifications, as long as this notice is preserved.
91888cd5fc2Smrg
91988cd5fc2Smrg# AM_SILENT_RULES([DEFAULT])
92088cd5fc2Smrg# --------------------------
92188cd5fc2Smrg# Enable less verbose build rules; with the default set to DEFAULT
92288cd5fc2Smrg# ("yes" being less verbose, "no" or empty being verbose).
92388cd5fc2SmrgAC_DEFUN([AM_SILENT_RULES],
92488cd5fc2Smrg[AC_ARG_ENABLE([silent-rules], [dnl
92588cd5fc2SmrgAS_HELP_STRING(
92688cd5fc2Smrg  [--enable-silent-rules],
92788cd5fc2Smrg  [less verbose build output (undo: "make V=1")])
92888cd5fc2SmrgAS_HELP_STRING(
92988cd5fc2Smrg  [--disable-silent-rules],
93088cd5fc2Smrg  [verbose build output (undo: "make V=0")])dnl
93188cd5fc2Smrg])
93288cd5fc2Smrgcase $enable_silent_rules in @%:@ (((
93388cd5fc2Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
93488cd5fc2Smrg   no) AM_DEFAULT_VERBOSITY=1;;
93588cd5fc2Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
93688cd5fc2Smrgesac
93788cd5fc2Smrgdnl
93888cd5fc2Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
93988cd5fc2Smrgdnl do not support nested variable expansions.
94088cd5fc2Smrgdnl See automake bug#9928 and bug#10237.
94188cd5fc2Smrgam_make=${MAKE-make}
94288cd5fc2SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94388cd5fc2Smrg   [am_cv_make_support_nested_variables],
94488cd5fc2Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94588cd5fc2SmrgBAR0=false
94688cd5fc2SmrgBAR1=true
94788cd5fc2SmrgV=1
94888cd5fc2Smrgam__doit:
94988cd5fc2Smrg	@$(TRUE)
95088cd5fc2Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95188cd5fc2Smrg  am_cv_make_support_nested_variables=yes
95288cd5fc2Smrgelse
95388cd5fc2Smrg  am_cv_make_support_nested_variables=no
95488cd5fc2Smrgfi])
95588cd5fc2Smrgif test $am_cv_make_support_nested_variables = yes; then
95688cd5fc2Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95788cd5fc2Smrg  AM_V='$(V)'
95888cd5fc2Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
95988cd5fc2Smrgelse
96088cd5fc2Smrg  AM_V=$AM_DEFAULT_VERBOSITY
96188cd5fc2Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
96288cd5fc2Smrgfi
96388cd5fc2SmrgAC_SUBST([AM_V])dnl
96488cd5fc2SmrgAM_SUBST_NOTMAKE([AM_V])dnl
96588cd5fc2SmrgAC_SUBST([AM_DEFAULT_V])dnl
96688cd5fc2SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
96788cd5fc2SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
96888cd5fc2SmrgAM_BACKSLASH='\'
96988cd5fc2SmrgAC_SUBST([AM_BACKSLASH])dnl
97088cd5fc2Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
97188cd5fc2Smrg])
97288cd5fc2Smrg
973a33c354dSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
97488cd5fc2Smrg#
97588cd5fc2Smrg# This file is free software; the Free Software Foundation
97688cd5fc2Smrg# gives unlimited permission to copy and/or distribute it,
97788cd5fc2Smrg# with or without modifications, as long as this notice is preserved.
97888cd5fc2Smrg
97988cd5fc2Smrg# AM_PROG_INSTALL_STRIP
98088cd5fc2Smrg# ---------------------
98188cd5fc2Smrg# One issue with vendor 'install' (even GNU) is that you can't
98288cd5fc2Smrg# specify the program used to strip binaries.  This is especially
98388cd5fc2Smrg# annoying in cross-compiling environments, where the build's strip
98488cd5fc2Smrg# is unlikely to handle the host's binaries.
98588cd5fc2Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98688cd5fc2Smrg# always use install-sh in "make install-strip", and initialize
98788cd5fc2Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
98888cd5fc2SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
98988cd5fc2Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
99088cd5fc2Smrg# Installed binaries are usually stripped using 'strip' when the user
99188cd5fc2Smrg# run "make install-strip".  However 'strip' might not be the right
99288cd5fc2Smrg# tool to use in cross-compilation environments, therefore Automake
99388cd5fc2Smrg# will honor the 'STRIP' environment variable to overrule this program.
99488cd5fc2Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99588cd5fc2Smrgif test "$cross_compiling" != no; then
99688cd5fc2Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
99788cd5fc2Smrgfi
99888cd5fc2SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
99988cd5fc2SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
100088cd5fc2Smrg
1001a33c354dSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
100288cd5fc2Smrg#
100388cd5fc2Smrg# This file is free software; the Free Software Foundation
100488cd5fc2Smrg# gives unlimited permission to copy and/or distribute it,
100588cd5fc2Smrg# with or without modifications, as long as this notice is preserved.
100688cd5fc2Smrg
100788cd5fc2Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
100888cd5fc2Smrg# ---------------------------
100988cd5fc2Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101088cd5fc2Smrg# This macro is traced by Automake.
101188cd5fc2SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101288cd5fc2Smrg
101388cd5fc2Smrg# AM_SUBST_NOTMAKE(VARIABLE)
101488cd5fc2Smrg# --------------------------
101588cd5fc2Smrg# Public sister of _AM_SUBST_NOTMAKE.
101688cd5fc2SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
101788cd5fc2Smrg
101888cd5fc2Smrg# Check how to create a tarball.                            -*- Autoconf -*-
101988cd5fc2Smrg
1020a33c354dSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
102188cd5fc2Smrg#
102288cd5fc2Smrg# This file is free software; the Free Software Foundation
102388cd5fc2Smrg# gives unlimited permission to copy and/or distribute it,
102488cd5fc2Smrg# with or without modifications, as long as this notice is preserved.
102588cd5fc2Smrg
102688cd5fc2Smrg# _AM_PROG_TAR(FORMAT)
102788cd5fc2Smrg# --------------------
102888cd5fc2Smrg# Check how to create a tarball in format FORMAT.
102988cd5fc2Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
103088cd5fc2Smrg#
103188cd5fc2Smrg# Substitute a variable $(am__tar) that is a command
103288cd5fc2Smrg# writing to stdout a FORMAT-tarball containing the directory
103388cd5fc2Smrg# $tardir.
103488cd5fc2Smrg#     tardir=directory && $(am__tar) > result.tar
103588cd5fc2Smrg#
103688cd5fc2Smrg# Substitute a variable $(am__untar) that extract such
103788cd5fc2Smrg# a tarball read from stdin.
103888cd5fc2Smrg#     $(am__untar) < result.tar
103988cd5fc2Smrg#
104088cd5fc2SmrgAC_DEFUN([_AM_PROG_TAR],
104188cd5fc2Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104288cd5fc2Smrg# in the wild :-(  We should find a proper way to deprecate it ...
104388cd5fc2SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
104488cd5fc2Smrg
104588cd5fc2Smrg# We'll loop over all known methods to create a tar archive until one works.
104688cd5fc2Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
104788cd5fc2Smrg
104888cd5fc2Smrgm4_if([$1], [v7],
104988cd5fc2Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
105088cd5fc2Smrg
105188cd5fc2Smrg  [m4_case([$1],
105288cd5fc2Smrg    [ustar],
105388cd5fc2Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105488cd5fc2Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105588cd5fc2Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105688cd5fc2Smrg      # and bug#13588).
105788cd5fc2Smrg      am_max_uid=2097151 # 2^21 - 1
105888cd5fc2Smrg      am_max_gid=$am_max_uid
105988cd5fc2Smrg      # The $UID and $GID variables are not portable, so we need to resort
106088cd5fc2Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106188cd5fc2Smrg      # below are definitely unexpected, so allow the users to see them
106288cd5fc2Smrg      # (that is, avoid stderr redirection).
106388cd5fc2Smrg      am_uid=`id -u || echo unknown`
106488cd5fc2Smrg      am_gid=`id -g || echo unknown`
106588cd5fc2Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106688cd5fc2Smrg      if test $am_uid -le $am_max_uid; then
106788cd5fc2Smrg         AC_MSG_RESULT([yes])
106888cd5fc2Smrg      else
106988cd5fc2Smrg         AC_MSG_RESULT([no])
107088cd5fc2Smrg         _am_tools=none
107188cd5fc2Smrg      fi
107288cd5fc2Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107388cd5fc2Smrg      if test $am_gid -le $am_max_gid; then
107488cd5fc2Smrg         AC_MSG_RESULT([yes])
107588cd5fc2Smrg      else
107688cd5fc2Smrg        AC_MSG_RESULT([no])
107788cd5fc2Smrg        _am_tools=none
107888cd5fc2Smrg      fi],
107988cd5fc2Smrg
108088cd5fc2Smrg  [pax],
108188cd5fc2Smrg    [],
108288cd5fc2Smrg
108388cd5fc2Smrg  [m4_fatal([Unknown tar format])])
108488cd5fc2Smrg
108588cd5fc2Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
108688cd5fc2Smrg
108788cd5fc2Smrg  # Go ahead even if we have the value already cached.  We do so because we
108888cd5fc2Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
108988cd5fc2Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
109088cd5fc2Smrg
109188cd5fc2Smrg  for _am_tool in $_am_tools; do
109288cd5fc2Smrg    case $_am_tool in
109388cd5fc2Smrg    gnutar)
109488cd5fc2Smrg      for _am_tar in tar gnutar gtar; do
109588cd5fc2Smrg        AM_RUN_LOG([$_am_tar --version]) && break
109688cd5fc2Smrg      done
109788cd5fc2Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
109888cd5fc2Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
109988cd5fc2Smrg      am__untar="$_am_tar -xf -"
110088cd5fc2Smrg      ;;
110188cd5fc2Smrg    plaintar)
110288cd5fc2Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110388cd5fc2Smrg      # ustar tarball either.
110488cd5fc2Smrg      (tar --version) >/dev/null 2>&1 && continue
110588cd5fc2Smrg      am__tar='tar chf - "$$tardir"'
110688cd5fc2Smrg      am__tar_='tar chf - "$tardir"'
110788cd5fc2Smrg      am__untar='tar xf -'
110888cd5fc2Smrg      ;;
110988cd5fc2Smrg    pax)
111088cd5fc2Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
111188cd5fc2Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
111288cd5fc2Smrg      am__untar='pax -r'
111388cd5fc2Smrg      ;;
111488cd5fc2Smrg    cpio)
111588cd5fc2Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111688cd5fc2Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111788cd5fc2Smrg      am__untar='cpio -i -H $1 -d'
111888cd5fc2Smrg      ;;
111988cd5fc2Smrg    none)
112088cd5fc2Smrg      am__tar=false
112188cd5fc2Smrg      am__tar_=false
112288cd5fc2Smrg      am__untar=false
112388cd5fc2Smrg      ;;
112488cd5fc2Smrg    esac
112588cd5fc2Smrg
112688cd5fc2Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
112788cd5fc2Smrg    # and am__untar set.
112888cd5fc2Smrg    test -n "${am_cv_prog_tar_$1}" && break
112988cd5fc2Smrg
113088cd5fc2Smrg    # tar/untar a dummy directory, and stop if the command works.
113188cd5fc2Smrg    rm -rf conftest.dir
113288cd5fc2Smrg    mkdir conftest.dir
113388cd5fc2Smrg    echo GrepMe > conftest.dir/file
113488cd5fc2Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113588cd5fc2Smrg    rm -rf conftest.dir
113688cd5fc2Smrg    if test -s conftest.tar; then
113788cd5fc2Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
113888cd5fc2Smrg      AM_RUN_LOG([cat conftest.dir/file])
113988cd5fc2Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
114088cd5fc2Smrg    fi
114188cd5fc2Smrg  done
114288cd5fc2Smrg  rm -rf conftest.dir
114388cd5fc2Smrg
114488cd5fc2Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114588cd5fc2Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
114688cd5fc2Smrg
114788cd5fc2SmrgAC_SUBST([am__tar])
114888cd5fc2SmrgAC_SUBST([am__untar])
114988cd5fc2Smrg]) # _AM_PROG_TAR
115088cd5fc2Smrg
1151a33c354dSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1152a33c354dSmrgdnl serial 11 (pkg-config-0.29)
115388cd5fc2Smrgdnl
1154a33c354dSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1155a33c354dSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
115688cd5fc2Smrgdnl
1157a33c354dSmrgdnl This program is free software; you can redistribute it and/or modify
1158a33c354dSmrgdnl it under the terms of the GNU General Public License as published by
1159a33c354dSmrgdnl the Free Software Foundation; either version 2 of the License, or
1160a33c354dSmrgdnl (at your option) any later version.
116188cd5fc2Smrgdnl
1162a33c354dSmrgdnl This program is distributed in the hope that it will be useful, but
1163a33c354dSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1164a33c354dSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1165a33c354dSmrgdnl General Public License for more details.
116688cd5fc2Smrgdnl
1167a33c354dSmrgdnl You should have received a copy of the GNU General Public License
1168a33c354dSmrgdnl along with this program; if not, write to the Free Software
1169a33c354dSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1170a33c354dSmrgdnl 02111-1307, USA.
117188cd5fc2Smrgdnl
1172a33c354dSmrgdnl As a special exception to the GNU General Public License, if you
1173a33c354dSmrgdnl distribute this file as part of a program that contains a
1174a33c354dSmrgdnl configuration script generated by Autoconf, you may include it under
1175a33c354dSmrgdnl the same distribution terms that you use for the rest of that
1176a33c354dSmrgdnl program.
1177a33c354dSmrg
1178a33c354dSmrgdnl PKG_PREREQ(MIN-VERSION)
1179a33c354dSmrgdnl -----------------------
1180a33c354dSmrgdnl Since: 0.29
118188cd5fc2Smrgdnl
1182a33c354dSmrgdnl Verify that the version of the pkg-config macros are at least
1183a33c354dSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1184a33c354dSmrgdnl installed version of pkg-config, this checks the developer's version
1185a33c354dSmrgdnl of pkg.m4 when generating configure.
1186a33c354dSmrgdnl
1187a33c354dSmrgdnl To ensure that this macro is defined, also add:
1188a33c354dSmrgdnl m4_ifndef([PKG_PREREQ],
1189a33c354dSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1190a33c354dSmrgdnl
1191a33c354dSmrgdnl See the "Since" comment for each macro you use to see what version
1192a33c354dSmrgdnl of the macros you require.
1193a33c354dSmrgm4_defun([PKG_PREREQ],
1194a33c354dSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
1195a33c354dSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1196a33c354dSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1197a33c354dSmrg])dnl PKG_PREREQ
1198a33c354dSmrg
1199a33c354dSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1200a33c354dSmrgdnl ----------------------------------
1201a33c354dSmrgdnl Since: 0.16
1202a33c354dSmrgdnl
1203a33c354dSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1204a33c354dSmrgdnl first found in the path. Checks that the version of pkg-config found
1205a33c354dSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1206a33c354dSmrgdnl used since that's the first version where most current features of
1207a33c354dSmrgdnl pkg-config existed.
1208a33c354dSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1209a33c354dSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1210a33c354dSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1211a33c354dSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1212a33c354dSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1213a33c354dSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1214a33c354dSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
121588cd5fc2Smrg
1216a33c354dSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1217a33c354dSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218a33c354dSmrgfi
1219a33c354dSmrgif test -n "$PKG_CONFIG"; then
1220a33c354dSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
1221a33c354dSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1222a33c354dSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1223a33c354dSmrg		AC_MSG_RESULT([yes])
1224a33c354dSmrg	else
1225a33c354dSmrg		AC_MSG_RESULT([no])
1226a33c354dSmrg		PKG_CONFIG=""
1227a33c354dSmrg	fi
1228a33c354dSmrgfi[]dnl
1229a33c354dSmrg])dnl PKG_PROG_PKG_CONFIG
123088cd5fc2Smrg
1231a33c354dSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1232a33c354dSmrgdnl -------------------------------------------------------------------
1233a33c354dSmrgdnl Since: 0.18
1234a33c354dSmrgdnl
1235a33c354dSmrgdnl Check to see whether a particular set of modules exists. Similar to
1236a33c354dSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1237a33c354dSmrgdnl
1238a33c354dSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1239a33c354dSmrgdnl only at the first occurence in configure.ac, so if the first place
1240a33c354dSmrgdnl it's called might be skipped (such as if it is within an "if", you
1241a33c354dSmrgdnl have to call PKG_CHECK_EXISTS manually
1242a33c354dSmrgAC_DEFUN([PKG_CHECK_EXISTS],
1243a33c354dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1244a33c354dSmrgif test -n "$PKG_CONFIG" && \
1245a33c354dSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1246a33c354dSmrg  m4_default([$2], [:])
1247a33c354dSmrgm4_ifvaln([$3], [else
1248a33c354dSmrg  $3])dnl
1249a33c354dSmrgfi])
125088cd5fc2Smrg
1251a33c354dSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1252a33c354dSmrgdnl ---------------------------------------------
1253a33c354dSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1254a33c354dSmrgdnl pkg_failed based on the result.
1255a33c354dSmrgm4_define([_PKG_CONFIG],
1256a33c354dSmrg[if test -n "$$1"; then
1257a33c354dSmrg    pkg_cv_[]$1="$$1"
1258a33c354dSmrg elif test -n "$PKG_CONFIG"; then
1259a33c354dSmrg    PKG_CHECK_EXISTS([$3],
1260a33c354dSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1261a33c354dSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
1262a33c354dSmrg		     [pkg_failed=yes])
1263a33c354dSmrg else
1264a33c354dSmrg    pkg_failed=untried
1265a33c354dSmrgfi[]dnl
1266a33c354dSmrg])dnl _PKG_CONFIG
126788cd5fc2Smrg
1268a33c354dSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1269a33c354dSmrgdnl ---------------------------
1270a33c354dSmrgdnl Internal check to see if pkg-config supports short errors.
1271a33c354dSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1272a33c354dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1273a33c354dSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1274a33c354dSmrg        _pkg_short_errors_supported=yes
1275a33c354dSmrgelse
1276a33c354dSmrg        _pkg_short_errors_supported=no
1277a33c354dSmrgfi[]dnl
1278a33c354dSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
127988cd5fc2Smrg
128088cd5fc2Smrg
1281a33c354dSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1282a33c354dSmrgdnl   [ACTION-IF-NOT-FOUND])
1283a33c354dSmrgdnl --------------------------------------------------------------
1284a33c354dSmrgdnl Since: 0.4.0
1285a33c354dSmrgdnl
1286a33c354dSmrgdnl Note that if there is a possibility the first call to
1287a33c354dSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1288a33c354dSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1289a33c354dSmrgAC_DEFUN([PKG_CHECK_MODULES],
1290a33c354dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1291a33c354dSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1292a33c354dSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
129388cd5fc2Smrg
1294a33c354dSmrgpkg_failed=no
1295a33c354dSmrgAC_MSG_CHECKING([for $1])
129688cd5fc2Smrg
1297a33c354dSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1298a33c354dSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
129988cd5fc2Smrg
1300a33c354dSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1301a33c354dSmrgand $1[]_LIBS to avoid the need to call pkg-config.
1302a33c354dSmrgSee the pkg-config man page for more details.])
130388cd5fc2Smrg
1304a33c354dSmrgif test $pkg_failed = yes; then
1305a33c354dSmrg   	AC_MSG_RESULT([no])
1306a33c354dSmrg        _PKG_SHORT_ERRORS_SUPPORTED
1307a33c354dSmrg        if test $_pkg_short_errors_supported = yes; then
1308a33c354dSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1309a33c354dSmrg        else 
1310a33c354dSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1311a33c354dSmrg        fi
1312a33c354dSmrg	# Put the nasty error message in config.log where it belongs
1313a33c354dSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
131488cd5fc2Smrg
1315a33c354dSmrg	m4_default([$4], [AC_MSG_ERROR(
1316a33c354dSmrg[Package requirements ($2) were not met:
131788cd5fc2Smrg
1318a33c354dSmrg$$1_PKG_ERRORS
131988cd5fc2Smrg
1320a33c354dSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1321a33c354dSmrginstalled software in a non-standard prefix.
132288cd5fc2Smrg
1323a33c354dSmrg_PKG_TEXT])[]dnl
1324a33c354dSmrg        ])
1325a33c354dSmrgelif test $pkg_failed = untried; then
1326a33c354dSmrg     	AC_MSG_RESULT([no])
1327a33c354dSmrg	m4_default([$4], [AC_MSG_FAILURE(
1328a33c354dSmrg[The pkg-config script could not be found or is too old.  Make sure it
1329a33c354dSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
1330a33c354dSmrgpath to pkg-config.
133188cd5fc2Smrg
1332a33c354dSmrg_PKG_TEXT
133388cd5fc2Smrg
1334a33c354dSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1335a33c354dSmrg        ])
1336a33c354dSmrgelse
1337a33c354dSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1338a33c354dSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1339a33c354dSmrg        AC_MSG_RESULT([yes])
1340a33c354dSmrg	$3
1341a33c354dSmrgfi[]dnl
1342a33c354dSmrg])dnl PKG_CHECK_MODULES
134388cd5fc2Smrg
134488cd5fc2Smrg
1345a33c354dSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1346a33c354dSmrgdnl   [ACTION-IF-NOT-FOUND])
1347a33c354dSmrgdnl ---------------------------------------------------------------------
1348a33c354dSmrgdnl Since: 0.29
1349a33c354dSmrgdnl
1350a33c354dSmrgdnl Checks for existence of MODULES and gathers its build flags with
1351a33c354dSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1352a33c354dSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1353a33c354dSmrgdnl
1354a33c354dSmrgdnl Note that if there is a possibility the first call to
1355a33c354dSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1356a33c354dSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1357a33c354dSmrgdnl configure.ac.
1358a33c354dSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1359a33c354dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1360a33c354dSmrg_save_PKG_CONFIG=$PKG_CONFIG
1361a33c354dSmrgPKG_CONFIG="$PKG_CONFIG --static"
1362a33c354dSmrgPKG_CHECK_MODULES($@)
1363a33c354dSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1364a33c354dSmrg])dnl PKG_CHECK_MODULES_STATIC
136588cd5fc2Smrg
136688cd5fc2Smrg
1367a33c354dSmrgdnl PKG_INSTALLDIR([DIRECTORY])
1368a33c354dSmrgdnl -------------------------
1369a33c354dSmrgdnl Since: 0.27
1370a33c354dSmrgdnl
1371a33c354dSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
1372a33c354dSmrgdnl should install pkg-config .pc files. By default the directory is
1373a33c354dSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
1374a33c354dSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1375a33c354dSmrgdnl parameter.
1376a33c354dSmrgAC_DEFUN([PKG_INSTALLDIR],
1377a33c354dSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1378a33c354dSmrgm4_pushdef([pkg_description],
1379a33c354dSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1380a33c354dSmrgAC_ARG_WITH([pkgconfigdir],
1381a33c354dSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1382a33c354dSmrg    [with_pkgconfigdir=]pkg_default)
1383a33c354dSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1384a33c354dSmrgm4_popdef([pkg_default])
1385a33c354dSmrgm4_popdef([pkg_description])
1386a33c354dSmrg])dnl PKG_INSTALLDIR
1387a33c354dSmrg
1388a33c354dSmrg
1389a33c354dSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1390a33c354dSmrgdnl --------------------------------
1391a33c354dSmrgdnl Since: 0.27
1392a33c354dSmrgdnl
1393a33c354dSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1394a33c354dSmrgdnl module should install arch-independent pkg-config .pc files. By
1395a33c354dSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
1396a33c354dSmrgdnl changed by passing DIRECTORY. The user can override through the
1397a33c354dSmrgdnl --with-noarch-pkgconfigdir parameter.
1398a33c354dSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1399a33c354dSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1400a33c354dSmrgm4_pushdef([pkg_description],
1401a33c354dSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1402a33c354dSmrgAC_ARG_WITH([noarch-pkgconfigdir],
1403a33c354dSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1404a33c354dSmrg    [with_noarch_pkgconfigdir=]pkg_default)
1405a33c354dSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1406a33c354dSmrgm4_popdef([pkg_default])
1407a33c354dSmrgm4_popdef([pkg_description])
1408a33c354dSmrg])dnl PKG_NOARCH_INSTALLDIR
1409a33c354dSmrg
1410a33c354dSmrg
1411a33c354dSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1412a33c354dSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1413a33c354dSmrgdnl -------------------------------------------
1414a33c354dSmrgdnl Since: 0.28
1415a33c354dSmrgdnl
1416a33c354dSmrgdnl Retrieves the value of the pkg-config variable for the given module.
1417a33c354dSmrgAC_DEFUN([PKG_CHECK_VAR],
1418a33c354dSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1419a33c354dSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
142088cd5fc2Smrg
1421a33c354dSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1422a33c354dSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
142388cd5fc2Smrg
1424a33c354dSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1425a33c354dSmrg])dnl PKG_CHECK_VAR
142688cd5fc2Smrg
1427a33c354dSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1428a33c354dSmrgdnl
1429a33c354dSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
1430a33c354dSmrgdnl
1431a33c354dSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1432a33c354dSmrgdnl copy of this software and associated documentation files (the "Software"),
1433a33c354dSmrgdnl to deal in the Software without restriction, including without limitation
1434a33c354dSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1435a33c354dSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1436a33c354dSmrgdnl Software is furnished to do so, subject to the following conditions:
1437a33c354dSmrgdnl
1438a33c354dSmrgdnl The above copyright notice and this permission notice (including the next
1439a33c354dSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1440a33c354dSmrgdnl Software.
1441a33c354dSmrgdnl
1442a33c354dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1443a33c354dSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1444a33c354dSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1445a33c354dSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1446a33c354dSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1447a33c354dSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1448a33c354dSmrgdnl DEALINGS IN THE SOFTWARE.
144988cd5fc2Smrg
1450a33c354dSmrg# XORG_MACROS_VERSION(required-version)
1451a33c354dSmrg# -------------------------------------
1452a33c354dSmrg# Minimum version: 1.1.0
145388cd5fc2Smrg#
1454a33c354dSmrg# If you're using a macro added in Version 1.1 or newer, include this in
1455a33c354dSmrg# your configure.ac with the minimum required version, such as:
1456a33c354dSmrg# XORG_MACROS_VERSION(1.1)
1457a33c354dSmrg#
1458a33c354dSmrg# To ensure that this macro is defined, also add:
1459a33c354dSmrg# m4_ifndef([XORG_MACROS_VERSION],
1460a33c354dSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1461a33c354dSmrg#
1462a33c354dSmrg#
1463a33c354dSmrg# See the "minimum version" comment for each macro you use to see what
1464a33c354dSmrg# version you require.
1465a33c354dSmrgm4_defun([XORG_MACROS_VERSION],[
1466a33c354dSmrgm4_define([vers_have], [1.19.3])
1467a33c354dSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1468a33c354dSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1469a33c354dSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1470a33c354dSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1471a33c354dSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1472a33c354dSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1473a33c354dSmrgm4_undefine([vers_have])
1474a33c354dSmrgm4_undefine([maj_have])
1475a33c354dSmrgm4_undefine([maj_needed])
1476a33c354dSmrg]) # XORG_MACROS_VERSION
147788cd5fc2Smrg
1478a33c354dSmrg# XORG_PROG_RAWCPP()
1479a33c354dSmrg# ------------------
1480a33c354dSmrg# Minimum version: 1.0.0
1481a33c354dSmrg#
1482a33c354dSmrg# Find cpp program and necessary flags for use in pre-processing text files
1483a33c354dSmrg# such as man pages and config files
1484a33c354dSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1485a33c354dSmrgAC_REQUIRE([AC_PROG_CPP])
1486a33c354dSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1487a33c354dSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
148888cd5fc2Smrg
148988cd5fc2Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
149088cd5fc2Smrg# which is not the best choice for supporting other OS'es, but covers most
149188cd5fc2Smrg# of the ones we need for now.
149288cd5fc2SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
149388cd5fc2SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
149488cd5fc2Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149588cd5fc2Smrg	AC_MSG_RESULT([no])
149688cd5fc2Smrgelse
149788cd5fc2Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
149888cd5fc2Smrg		RAWCPPFLAGS=-undef
149988cd5fc2Smrg		AC_MSG_RESULT([yes])
150088cd5fc2Smrg	# under Cygwin unix is still defined even with -undef
150188cd5fc2Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
150288cd5fc2Smrg		RAWCPPFLAGS="-undef -ansi"
150388cd5fc2Smrg		AC_MSG_RESULT([yes, with -ansi])
150488cd5fc2Smrg	else
150588cd5fc2Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
150688cd5fc2Smrg	fi
150788cd5fc2Smrgfi
150888cd5fc2Smrgrm -f conftest.$ac_ext
150988cd5fc2Smrg
151088cd5fc2SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
151188cd5fc2SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
151288cd5fc2Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151388cd5fc2Smrg	AC_MSG_RESULT([no])
151488cd5fc2Smrgelse
151588cd5fc2Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
151688cd5fc2Smrg		TRADITIONALCPPFLAGS="-traditional"
151788cd5fc2Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
151888cd5fc2Smrg		AC_MSG_RESULT([yes])
151988cd5fc2Smrg	else
152088cd5fc2Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
152188cd5fc2Smrg	fi
152288cd5fc2Smrgfi
152388cd5fc2Smrgrm -f conftest.$ac_ext
152488cd5fc2SmrgAC_SUBST(RAWCPPFLAGS)
152588cd5fc2SmrgAC_SUBST(TRADITIONALCPPFLAGS)
152688cd5fc2Smrg]) # XORG_PROG_RAWCPP
152788cd5fc2Smrg
152888cd5fc2Smrg# XORG_MANPAGE_SECTIONS()
152988cd5fc2Smrg# -----------------------
153088cd5fc2Smrg# Minimum version: 1.0.0
153188cd5fc2Smrg#
153288cd5fc2Smrg# Determine which sections man pages go in for the different man page types
153388cd5fc2Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
153488cd5fc2Smrg# Not sure if there's any better way than just hardcoding by OS name.
153588cd5fc2Smrg# Override default settings by setting environment variables
153688cd5fc2Smrg# Added MAN_SUBSTS in version 1.8
153788cd5fc2Smrg# Added AC_PROG_SED in version 1.8
153888cd5fc2Smrg
153988cd5fc2SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
154088cd5fc2SmrgAC_REQUIRE([AC_CANONICAL_HOST])
154188cd5fc2SmrgAC_REQUIRE([AC_PROG_SED])
154288cd5fc2Smrg
1543a33c354dSmrgcase $host_os in
1544a33c354dSmrg    solaris*)
1545a33c354dSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1546a33c354dSmrg        # check for a man page file found in later versions that use
1547a33c354dSmrg        # traditional section numbers instead
1548a33c354dSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1549a33c354dSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1550a33c354dSmrg        ;;
1551a33c354dSmrg    *) SYSV_MAN_SECTIONS=false ;;
1552a33c354dSmrgesac
1553a33c354dSmrg
155488cd5fc2Smrgif test x$APP_MAN_SUFFIX = x    ; then
155588cd5fc2Smrg    APP_MAN_SUFFIX=1
155688cd5fc2Smrgfi
155788cd5fc2Smrgif test x$APP_MAN_DIR = x    ; then
155888cd5fc2Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
155988cd5fc2Smrgfi
156088cd5fc2Smrg
156188cd5fc2Smrgif test x$LIB_MAN_SUFFIX = x    ; then
156288cd5fc2Smrg    LIB_MAN_SUFFIX=3
156388cd5fc2Smrgfi
156488cd5fc2Smrgif test x$LIB_MAN_DIR = x    ; then
156588cd5fc2Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
156688cd5fc2Smrgfi
156788cd5fc2Smrg
156888cd5fc2Smrgif test x$FILE_MAN_SUFFIX = x    ; then
1569a33c354dSmrg    case $SYSV_MAN_SECTIONS in
1570a33c354dSmrg	true)				FILE_MAN_SUFFIX=4  ;;
1571a33c354dSmrg	*)				FILE_MAN_SUFFIX=5  ;;
157288cd5fc2Smrg    esac
157388cd5fc2Smrgfi
157488cd5fc2Smrgif test x$FILE_MAN_DIR = x    ; then
157588cd5fc2Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
157688cd5fc2Smrgfi
157788cd5fc2Smrg
157888cd5fc2Smrgif test x$MISC_MAN_SUFFIX = x    ; then
1579a33c354dSmrg    case $SYSV_MAN_SECTIONS in
1580a33c354dSmrg	true)				MISC_MAN_SUFFIX=5  ;;
1581a33c354dSmrg	*)				MISC_MAN_SUFFIX=7  ;;
158288cd5fc2Smrg    esac
158388cd5fc2Smrgfi
158488cd5fc2Smrgif test x$MISC_MAN_DIR = x    ; then
158588cd5fc2Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
158688cd5fc2Smrgfi
158788cd5fc2Smrg
158888cd5fc2Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1589a33c354dSmrg    case $SYSV_MAN_SECTIONS in
1590a33c354dSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
1591a33c354dSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
159288cd5fc2Smrg    esac
159388cd5fc2Smrgfi
159488cd5fc2Smrgif test x$DRIVER_MAN_DIR = x    ; then
159588cd5fc2Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
159688cd5fc2Smrgfi
159788cd5fc2Smrg
159888cd5fc2Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1599a33c354dSmrg    case $SYSV_MAN_SECTIONS in
1600a33c354dSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
1601a33c354dSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
160288cd5fc2Smrg    esac
160388cd5fc2Smrgfi
160488cd5fc2Smrgif test x$ADMIN_MAN_DIR = x    ; then
160588cd5fc2Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
160688cd5fc2Smrgfi
160788cd5fc2Smrg
160888cd5fc2Smrg
160988cd5fc2SmrgAC_SUBST([APP_MAN_SUFFIX])
161088cd5fc2SmrgAC_SUBST([LIB_MAN_SUFFIX])
161188cd5fc2SmrgAC_SUBST([FILE_MAN_SUFFIX])
161288cd5fc2SmrgAC_SUBST([MISC_MAN_SUFFIX])
161388cd5fc2SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
161488cd5fc2SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
161588cd5fc2SmrgAC_SUBST([APP_MAN_DIR])
161688cd5fc2SmrgAC_SUBST([LIB_MAN_DIR])
161788cd5fc2SmrgAC_SUBST([FILE_MAN_DIR])
161888cd5fc2SmrgAC_SUBST([MISC_MAN_DIR])
161988cd5fc2SmrgAC_SUBST([DRIVER_MAN_DIR])
162088cd5fc2SmrgAC_SUBST([ADMIN_MAN_DIR])
162188cd5fc2Smrg
162288cd5fc2SmrgXORG_MAN_PAGE="X Version 11"
162388cd5fc2SmrgAC_SUBST([XORG_MAN_PAGE])
162488cd5fc2SmrgMAN_SUBSTS="\
162588cd5fc2Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162688cd5fc2Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
162788cd5fc2Smrg	-e 's|__xservername__|Xorg|g' \
162888cd5fc2Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
162988cd5fc2Smrg	-e 's|__projectroot__|\$(prefix)|g' \
163088cd5fc2Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
163188cd5fc2Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
163288cd5fc2Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
163388cd5fc2Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
163488cd5fc2Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
163588cd5fc2Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
163688cd5fc2Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
163788cd5fc2SmrgAC_SUBST([MAN_SUBSTS])
163888cd5fc2Smrg
163988cd5fc2Smrg]) # XORG_MANPAGE_SECTIONS
164088cd5fc2Smrg
164188cd5fc2Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
164288cd5fc2Smrg# ------------------------
164388cd5fc2Smrg# Minimum version: 1.7.0
164488cd5fc2Smrg#
164588cd5fc2Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
164688cd5fc2Smrg# provided by xorg-sgml-doctools, if installed.
164788cd5fc2SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
164888cd5fc2SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
164988cd5fc2SmrgXORG_SGML_PATH=
165088cd5fc2SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
165188cd5fc2Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
165288cd5fc2Smrg    [m4_ifval([$1],[:],
165388cd5fc2Smrg        [if test x"$cross_compiling" != x"yes" ; then
165488cd5fc2Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
165588cd5fc2Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
165688cd5fc2Smrg         fi])
165788cd5fc2Smrg    ])
165888cd5fc2Smrg
165988cd5fc2Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
166088cd5fc2Smrg# the path and the name of the doc stylesheet
166188cd5fc2Smrgif test "x$XORG_SGML_PATH" != "x" ; then
166288cd5fc2Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
166388cd5fc2Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
166488cd5fc2Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
166588cd5fc2Smrgelse
166688cd5fc2Smrg   AC_MSG_RESULT([no])
166788cd5fc2Smrgfi
166888cd5fc2Smrg
166988cd5fc2SmrgAC_SUBST(XORG_SGML_PATH)
167088cd5fc2SmrgAC_SUBST(STYLESHEET_SRCDIR)
167188cd5fc2SmrgAC_SUBST(XSL_STYLESHEET)
167288cd5fc2SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
167388cd5fc2Smrg]) # XORG_CHECK_SGML_DOCTOOLS
167488cd5fc2Smrg
167588cd5fc2Smrg# XORG_CHECK_LINUXDOC
167688cd5fc2Smrg# -------------------
167788cd5fc2Smrg# Minimum version: 1.0.0
167888cd5fc2Smrg#
167988cd5fc2Smrg# Defines the variable MAKE_TEXT if the necessary tools and
168088cd5fc2Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
168188cd5fc2Smrg# Whether or not the necessary tools and files are found can be checked
168288cd5fc2Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
168388cd5fc2SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
168488cd5fc2SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
168588cd5fc2SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
168688cd5fc2Smrg
168788cd5fc2SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
168888cd5fc2Smrg
168988cd5fc2SmrgAC_MSG_CHECKING([whether to build documentation])
169088cd5fc2Smrg
169188cd5fc2Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
169288cd5fc2Smrg   BUILDDOC=yes
169388cd5fc2Smrgelse
169488cd5fc2Smrg   BUILDDOC=no
169588cd5fc2Smrgfi
169688cd5fc2Smrg
169788cd5fc2SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
169888cd5fc2Smrg
169988cd5fc2SmrgAC_MSG_RESULT([$BUILDDOC])
170088cd5fc2Smrg
170188cd5fc2SmrgAC_MSG_CHECKING([whether to build pdf documentation])
170288cd5fc2Smrg
170388cd5fc2Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
170488cd5fc2Smrg   BUILDPDFDOC=yes
170588cd5fc2Smrgelse
170688cd5fc2Smrg   BUILDPDFDOC=no
170788cd5fc2Smrgfi
170888cd5fc2Smrg
170988cd5fc2SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
171088cd5fc2Smrg
171188cd5fc2SmrgAC_MSG_RESULT([$BUILDPDFDOC])
171288cd5fc2Smrg
171388cd5fc2SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
171488cd5fc2SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
171588cd5fc2SmrgMAKE_PDF="$PS2PDF"
171688cd5fc2SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
171788cd5fc2Smrg
171888cd5fc2SmrgAC_SUBST(MAKE_TEXT)
171988cd5fc2SmrgAC_SUBST(MAKE_PS)
172088cd5fc2SmrgAC_SUBST(MAKE_PDF)
172188cd5fc2SmrgAC_SUBST(MAKE_HTML)
172288cd5fc2Smrg]) # XORG_CHECK_LINUXDOC
172388cd5fc2Smrg
172488cd5fc2Smrg# XORG_CHECK_DOCBOOK
172588cd5fc2Smrg# -------------------
172688cd5fc2Smrg# Minimum version: 1.0.0
172788cd5fc2Smrg#
172888cd5fc2Smrg# Checks for the ability to build output formats from SGML DocBook source.
172988cd5fc2Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
173088cd5fc2Smrg# indicates whether the necessary tools and files are found and, if set,
173188cd5fc2Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
173288cd5fc2SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
173388cd5fc2SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
173488cd5fc2Smrg
173588cd5fc2SmrgBUILDTXTDOC=no
173688cd5fc2SmrgBUILDPDFDOC=no
173788cd5fc2SmrgBUILDPSDOC=no
173888cd5fc2SmrgBUILDHTMLDOC=no
173988cd5fc2Smrg
174088cd5fc2SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
174188cd5fc2SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
174288cd5fc2SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
174388cd5fc2SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
174488cd5fc2Smrg
174588cd5fc2SmrgAC_MSG_CHECKING([whether to build text documentation])
174688cd5fc2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
174788cd5fc2Smrg   test x$BUILD_TXTDOC != xno; then
174888cd5fc2Smrg	BUILDTXTDOC=yes
174988cd5fc2Smrgfi
175088cd5fc2SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
175188cd5fc2SmrgAC_MSG_RESULT([$BUILDTXTDOC])
175288cd5fc2Smrg
175388cd5fc2SmrgAC_MSG_CHECKING([whether to build PDF documentation])
175488cd5fc2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
175588cd5fc2Smrg   test x$BUILD_PDFDOC != xno; then
175688cd5fc2Smrg	BUILDPDFDOC=yes
175788cd5fc2Smrgfi
175888cd5fc2SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
175988cd5fc2SmrgAC_MSG_RESULT([$BUILDPDFDOC])
176088cd5fc2Smrg
176188cd5fc2SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
176288cd5fc2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
176388cd5fc2Smrg   test x$BUILD_PSDOC != xno; then
176488cd5fc2Smrg	BUILDPSDOC=yes
176588cd5fc2Smrgfi
176688cd5fc2SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
176788cd5fc2SmrgAC_MSG_RESULT([$BUILDPSDOC])
176888cd5fc2Smrg
176988cd5fc2SmrgAC_MSG_CHECKING([whether to build HTML documentation])
177088cd5fc2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
177188cd5fc2Smrg   test x$BUILD_HTMLDOC != xno; then
177288cd5fc2Smrg	BUILDHTMLDOC=yes
177388cd5fc2Smrgfi
177488cd5fc2SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
177588cd5fc2SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
177688cd5fc2Smrg
177788cd5fc2SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
177888cd5fc2SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
177988cd5fc2SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
178088cd5fc2SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
178188cd5fc2Smrg
178288cd5fc2SmrgAC_SUBST(MAKE_TEXT)
178388cd5fc2SmrgAC_SUBST(MAKE_PS)
178488cd5fc2SmrgAC_SUBST(MAKE_PDF)
178588cd5fc2SmrgAC_SUBST(MAKE_HTML)
178688cd5fc2Smrg]) # XORG_CHECK_DOCBOOK
178788cd5fc2Smrg
178888cd5fc2Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
178988cd5fc2Smrg# ----------------
179088cd5fc2Smrg# Minimum version: 1.5.0
179188cd5fc2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
179288cd5fc2Smrg#
179388cd5fc2Smrg# Documentation tools are not always available on all platforms and sometimes
179488cd5fc2Smrg# not at the appropriate level. This macro enables a module to test for the
179588cd5fc2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
179688cd5fc2Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
179788cd5fc2Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
179888cd5fc2Smrg# --with-xmlto assumes 'auto'.
179988cd5fc2Smrg#
180088cd5fc2Smrg# Interface to module:
180188cd5fc2Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
180288cd5fc2Smrg# XMLTO:	returns the path of the xmlto program found
180388cd5fc2Smrg#		returns the path set by the user in the environment
180488cd5fc2Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
180588cd5fc2Smrg#		'no' user instructs the module not to use xmlto
180688cd5fc2Smrg#
180788cd5fc2Smrg# Added in version 1.10.0
180888cd5fc2Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
180988cd5fc2Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
181088cd5fc2Smrg#
181188cd5fc2Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
181288cd5fc2Smrg#
181388cd5fc2SmrgAC_DEFUN([XORG_WITH_XMLTO],[
181488cd5fc2SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
181588cd5fc2Smrgm4_define([_defopt], m4_default([$2], [auto]))
181688cd5fc2SmrgAC_ARG_WITH(xmlto,
181788cd5fc2Smrg	AS_HELP_STRING([--with-xmlto],
181888cd5fc2Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
181988cd5fc2Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
182088cd5fc2Smrgm4_undefine([_defopt])
182188cd5fc2Smrg
182288cd5fc2Smrgif test "x$use_xmlto" = x"auto"; then
182388cd5fc2Smrg   AC_PATH_PROG([XMLTO], [xmlto])
182488cd5fc2Smrg   if test "x$XMLTO" = "x"; then
182588cd5fc2Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
182688cd5fc2Smrg	have_xmlto=no
182788cd5fc2Smrg   else
182888cd5fc2Smrg        have_xmlto=yes
182988cd5fc2Smrg   fi
183088cd5fc2Smrgelif test "x$use_xmlto" = x"yes" ; then
183188cd5fc2Smrg   AC_PATH_PROG([XMLTO], [xmlto])
183288cd5fc2Smrg   if test "x$XMLTO" = "x"; then
183388cd5fc2Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
183488cd5fc2Smrg   fi
183588cd5fc2Smrg   have_xmlto=yes
183688cd5fc2Smrgelif test "x$use_xmlto" = x"no" ; then
183788cd5fc2Smrg   if test "x$XMLTO" != "x"; then
183888cd5fc2Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
183988cd5fc2Smrg   fi
184088cd5fc2Smrg   have_xmlto=no
184188cd5fc2Smrgelse
184288cd5fc2Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
184388cd5fc2Smrgfi
184488cd5fc2Smrg
184588cd5fc2Smrg# Test for a minimum version of xmlto, if provided.
184688cd5fc2Smrgm4_ifval([$1],
184788cd5fc2Smrg[if test "$have_xmlto" = yes; then
184888cd5fc2Smrg    # scrape the xmlto version
184988cd5fc2Smrg    AC_MSG_CHECKING([the xmlto version])
185088cd5fc2Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
185188cd5fc2Smrg    AC_MSG_RESULT([$xmlto_version])
185288cd5fc2Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
185388cd5fc2Smrg        [if test "x$use_xmlto" = xauto; then
185488cd5fc2Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
185588cd5fc2Smrg            have_xmlto=no
185688cd5fc2Smrg        else
185788cd5fc2Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
185888cd5fc2Smrg        fi])
185988cd5fc2Smrgfi])
186088cd5fc2Smrg
186188cd5fc2Smrg# Test for the ability of xmlto to generate a text target
1862a33c354dSmrg#
1863a33c354dSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1864a33c354dSmrg# following test for empty XML docbook files.
1865a33c354dSmrg# For compatibility reasons use the following empty XML docbook file and if
1866a33c354dSmrg# it fails try it again with a non-empty XML file.
186788cd5fc2Smrghave_xmlto_text=no
186888cd5fc2Smrgcat > conftest.xml << "EOF"
186988cd5fc2SmrgEOF
187088cd5fc2SmrgAS_IF([test "$have_xmlto" = yes],
187188cd5fc2Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
187288cd5fc2Smrg             [have_xmlto_text=yes],
1873a33c354dSmrg             [# Try it again with a non-empty XML file.
1874a33c354dSmrg              cat > conftest.xml << "EOF"
1875a33c354dSmrg<x></x>
1876a33c354dSmrgEOF
1877a33c354dSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1878a33c354dSmrg                    [have_xmlto_text=yes],
1879a33c354dSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
188088cd5fc2Smrgrm -f conftest.xml
188188cd5fc2SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
188288cd5fc2SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
188388cd5fc2Smrg]) # XORG_WITH_XMLTO
188488cd5fc2Smrg
188588cd5fc2Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
188688cd5fc2Smrg# --------------------------------------------
188788cd5fc2Smrg# Minimum version: 1.12.0
188888cd5fc2Smrg# Minimum version for optional DEFAULT argument: 1.12.0
188988cd5fc2Smrg#
189088cd5fc2Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
189188cd5fc2Smrg# XML-based language used for the transformation of XML documents.
189288cd5fc2Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
189388cd5fc2Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
189488cd5fc2Smrg# The XSLT processor is often used as a standalone tool for transformations.
189588cd5fc2Smrg# It should not be assumed that this tool is used only to work with documnetation.
189688cd5fc2Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
189788cd5fc2Smrg#
189888cd5fc2Smrg# Interface to module:
189988cd5fc2Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
190088cd5fc2Smrg# XSLTPROC:	 returns the path of the xsltproc program found
190188cd5fc2Smrg#		 returns the path set by the user in the environment
190288cd5fc2Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
190388cd5fc2Smrg#		  'no' user instructs the module not to use xsltproc
190488cd5fc2Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
190588cd5fc2Smrg#
190688cd5fc2Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
190788cd5fc2Smrg#
190888cd5fc2SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
190988cd5fc2SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
191088cd5fc2Smrg# Preserves the interface, should it be implemented later
191188cd5fc2Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
191288cd5fc2Smrgm4_define([_defopt], m4_default([$2], [auto]))
191388cd5fc2SmrgAC_ARG_WITH(xsltproc,
191488cd5fc2Smrg	AS_HELP_STRING([--with-xsltproc],
191588cd5fc2Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
191688cd5fc2Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
191788cd5fc2Smrgm4_undefine([_defopt])
191888cd5fc2Smrg
191988cd5fc2Smrgif test "x$use_xsltproc" = x"auto"; then
192088cd5fc2Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192188cd5fc2Smrg   if test "x$XSLTPROC" = "x"; then
192288cd5fc2Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
192388cd5fc2Smrg	have_xsltproc=no
192488cd5fc2Smrg   else
192588cd5fc2Smrg        have_xsltproc=yes
192688cd5fc2Smrg   fi
192788cd5fc2Smrgelif test "x$use_xsltproc" = x"yes" ; then
192888cd5fc2Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
192988cd5fc2Smrg   if test "x$XSLTPROC" = "x"; then
193088cd5fc2Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
193188cd5fc2Smrg   fi
193288cd5fc2Smrg   have_xsltproc=yes
193388cd5fc2Smrgelif test "x$use_xsltproc" = x"no" ; then
193488cd5fc2Smrg   if test "x$XSLTPROC" != "x"; then
193588cd5fc2Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
193688cd5fc2Smrg   fi
193788cd5fc2Smrg   have_xsltproc=no
193888cd5fc2Smrgelse
193988cd5fc2Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
194088cd5fc2Smrgfi
194188cd5fc2Smrg
194288cd5fc2SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
194388cd5fc2Smrg]) # XORG_WITH_XSLTPROC
194488cd5fc2Smrg
194588cd5fc2Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
194688cd5fc2Smrg# ----------------------------------------
194788cd5fc2Smrg# Minimum version: 1.15.0
194888cd5fc2Smrg#
194988cd5fc2Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
195088cd5fc2Smrg# scanning arbitrary text files, extracting information from those text files,
195188cd5fc2Smrg# and printing reports based on that information.
195288cd5fc2Smrg#
195388cd5fc2Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
195488cd5fc2Smrg#
195588cd5fc2Smrg# Interface to module:
195688cd5fc2Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
195788cd5fc2Smrg# PERL:	     returns the path of the perl program found
195888cd5fc2Smrg#	     returns the path set by the user in the environment
195988cd5fc2Smrg# --with-perl: 'yes' user instructs the module to use perl
196088cd5fc2Smrg#	       'no' user instructs the module not to use perl
196188cd5fc2Smrg# have_perl: returns yes if perl found in PATH or no
196288cd5fc2Smrg#
196388cd5fc2Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
196488cd5fc2Smrg#
196588cd5fc2SmrgAC_DEFUN([XORG_WITH_PERL],[
196688cd5fc2SmrgAC_ARG_VAR([PERL], [Path to perl command])
196788cd5fc2Smrg# Preserves the interface, should it be implemented later
196888cd5fc2Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
196988cd5fc2Smrgm4_define([_defopt], m4_default([$2], [auto]))
197088cd5fc2SmrgAC_ARG_WITH(perl,
197188cd5fc2Smrg	AS_HELP_STRING([--with-perl],
197288cd5fc2Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
197388cd5fc2Smrg	   [use_perl=$withval], [use_perl=]_defopt)
197488cd5fc2Smrgm4_undefine([_defopt])
197588cd5fc2Smrg
197688cd5fc2Smrgif test "x$use_perl" = x"auto"; then
197788cd5fc2Smrg   AC_PATH_PROG([PERL], [perl])
197888cd5fc2Smrg   if test "x$PERL" = "x"; then
197988cd5fc2Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
198088cd5fc2Smrg	have_perl=no
198188cd5fc2Smrg   else
198288cd5fc2Smrg        have_perl=yes
198388cd5fc2Smrg   fi
198488cd5fc2Smrgelif test "x$use_perl" = x"yes" ; then
198588cd5fc2Smrg   AC_PATH_PROG([PERL], [perl])
198688cd5fc2Smrg   if test "x$PERL" = "x"; then
198788cd5fc2Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
198888cd5fc2Smrg   fi
198988cd5fc2Smrg   have_perl=yes
199088cd5fc2Smrgelif test "x$use_perl" = x"no" ; then
199188cd5fc2Smrg   if test "x$PERL" != "x"; then
199288cd5fc2Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
199388cd5fc2Smrg   fi
199488cd5fc2Smrg   have_perl=no
199588cd5fc2Smrgelse
199688cd5fc2Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
199788cd5fc2Smrgfi
199888cd5fc2Smrg
199988cd5fc2SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
200088cd5fc2Smrg]) # XORG_WITH_PERL
200188cd5fc2Smrg
200288cd5fc2Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
200388cd5fc2Smrg# ----------------
200488cd5fc2Smrg# Minimum version: 1.5.0
200588cd5fc2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
200688cd5fc2Smrg#
200788cd5fc2Smrg# Documentation tools are not always available on all platforms and sometimes
200888cd5fc2Smrg# not at the appropriate level. This macro enables a module to test for the
200988cd5fc2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
201088cd5fc2Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
201188cd5fc2Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
201288cd5fc2Smrg# --with-asciidoc assumes 'auto'.
201388cd5fc2Smrg#
201488cd5fc2Smrg# Interface to module:
201588cd5fc2Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
201688cd5fc2Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
201788cd5fc2Smrg#		 returns the path set by the user in the environment
201888cd5fc2Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
201988cd5fc2Smrg#		  'no' user instructs the module not to use asciidoc
202088cd5fc2Smrg#
202188cd5fc2Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
202288cd5fc2Smrg#
202388cd5fc2SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
202488cd5fc2SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
202588cd5fc2Smrgm4_define([_defopt], m4_default([$2], [auto]))
202688cd5fc2SmrgAC_ARG_WITH(asciidoc,
202788cd5fc2Smrg	AS_HELP_STRING([--with-asciidoc],
202888cd5fc2Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
202988cd5fc2Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
203088cd5fc2Smrgm4_undefine([_defopt])
203188cd5fc2Smrg
203288cd5fc2Smrgif test "x$use_asciidoc" = x"auto"; then
203388cd5fc2Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
203488cd5fc2Smrg   if test "x$ASCIIDOC" = "x"; then
203588cd5fc2Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
203688cd5fc2Smrg	have_asciidoc=no
203788cd5fc2Smrg   else
203888cd5fc2Smrg        have_asciidoc=yes
203988cd5fc2Smrg   fi
204088cd5fc2Smrgelif test "x$use_asciidoc" = x"yes" ; then
204188cd5fc2Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
204288cd5fc2Smrg   if test "x$ASCIIDOC" = "x"; then
204388cd5fc2Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
204488cd5fc2Smrg   fi
204588cd5fc2Smrg   have_asciidoc=yes
204688cd5fc2Smrgelif test "x$use_asciidoc" = x"no" ; then
204788cd5fc2Smrg   if test "x$ASCIIDOC" != "x"; then
204888cd5fc2Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
204988cd5fc2Smrg   fi
205088cd5fc2Smrg   have_asciidoc=no
205188cd5fc2Smrgelse
205288cd5fc2Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
205388cd5fc2Smrgfi
205488cd5fc2Smrgm4_ifval([$1],
205588cd5fc2Smrg[if test "$have_asciidoc" = yes; then
205688cd5fc2Smrg    # scrape the asciidoc version
205788cd5fc2Smrg    AC_MSG_CHECKING([the asciidoc version])
205888cd5fc2Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
205988cd5fc2Smrg    AC_MSG_RESULT([$asciidoc_version])
206088cd5fc2Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
206188cd5fc2Smrg        [if test "x$use_asciidoc" = xauto; then
206288cd5fc2Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
206388cd5fc2Smrg            have_asciidoc=no
206488cd5fc2Smrg        else
206588cd5fc2Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
206688cd5fc2Smrg        fi])
206788cd5fc2Smrgfi])
206888cd5fc2SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
206988cd5fc2Smrg]) # XORG_WITH_ASCIIDOC
207088cd5fc2Smrg
207188cd5fc2Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
207288cd5fc2Smrg# -------------------------------------------
207388cd5fc2Smrg# Minimum version: 1.5.0
207488cd5fc2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
207588cd5fc2Smrg# Minimum version for optional DOT checking: 1.18.0
207688cd5fc2Smrg#
207788cd5fc2Smrg# Documentation tools are not always available on all platforms and sometimes
207888cd5fc2Smrg# not at the appropriate level. This macro enables a module to test for the
207988cd5fc2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
208088cd5fc2Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
208188cd5fc2Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
208288cd5fc2Smrg# --with-doxygen assumes 'auto'.
208388cd5fc2Smrg#
208488cd5fc2Smrg# Interface to module:
208588cd5fc2Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
208688cd5fc2Smrg# DOXYGEN:	 returns the path of the doxygen program found
208788cd5fc2Smrg#		 returns the path set by the user in the environment
208888cd5fc2Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
208988cd5fc2Smrg#		  'no' user instructs the module not to use doxygen
209088cd5fc2Smrg#
209188cd5fc2Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
209288cd5fc2Smrg#
209388cd5fc2SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
209488cd5fc2SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
209588cd5fc2SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
209688cd5fc2Smrgm4_define([_defopt], m4_default([$2], [auto]))
209788cd5fc2SmrgAC_ARG_WITH(doxygen,
209888cd5fc2Smrg	AS_HELP_STRING([--with-doxygen],
209988cd5fc2Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
210088cd5fc2Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
210188cd5fc2Smrgm4_undefine([_defopt])
210288cd5fc2Smrg
210388cd5fc2Smrgif test "x$use_doxygen" = x"auto"; then
210488cd5fc2Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
210588cd5fc2Smrg   if test "x$DOXYGEN" = "x"; then
210688cd5fc2Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
210788cd5fc2Smrg	have_doxygen=no
210888cd5fc2Smrg   else
210988cd5fc2Smrg        have_doxygen=yes
211088cd5fc2Smrg   fi
211188cd5fc2Smrgelif test "x$use_doxygen" = x"yes" ; then
211288cd5fc2Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
211388cd5fc2Smrg   if test "x$DOXYGEN" = "x"; then
211488cd5fc2Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
211588cd5fc2Smrg   fi
211688cd5fc2Smrg   have_doxygen=yes
211788cd5fc2Smrgelif test "x$use_doxygen" = x"no" ; then
211888cd5fc2Smrg   if test "x$DOXYGEN" != "x"; then
211988cd5fc2Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
212088cd5fc2Smrg   fi
212188cd5fc2Smrg   have_doxygen=no
212288cd5fc2Smrgelse
212388cd5fc2Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
212488cd5fc2Smrgfi
212588cd5fc2Smrgm4_ifval([$1],
212688cd5fc2Smrg[if test "$have_doxygen" = yes; then
212788cd5fc2Smrg    # scrape the doxygen version
212888cd5fc2Smrg    AC_MSG_CHECKING([the doxygen version])
212988cd5fc2Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
213088cd5fc2Smrg    AC_MSG_RESULT([$doxygen_version])
213188cd5fc2Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
213288cd5fc2Smrg        [if test "x$use_doxygen" = xauto; then
213388cd5fc2Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
213488cd5fc2Smrg            have_doxygen=no
213588cd5fc2Smrg        else
213688cd5fc2Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
213788cd5fc2Smrg        fi])
213888cd5fc2Smrgfi])
213988cd5fc2Smrg
214088cd5fc2Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
214188cd5fc2Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
214288cd5fc2Smrgdnl 	HAVE_DOT = @HAVE_DOT@
214388cd5fc2SmrgHAVE_DOT=no
214488cd5fc2Smrgif test "x$have_doxygen" = "xyes"; then
214588cd5fc2Smrg  AC_PATH_PROG([DOT], [dot])
214688cd5fc2Smrg    if test "x$DOT" != "x"; then
214788cd5fc2Smrg      HAVE_DOT=yes
214888cd5fc2Smrg    fi
214988cd5fc2Smrgfi
215088cd5fc2Smrg
215188cd5fc2SmrgAC_SUBST([HAVE_DOT])
215288cd5fc2SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
215388cd5fc2SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
215488cd5fc2Smrg]) # XORG_WITH_DOXYGEN
215588cd5fc2Smrg
215688cd5fc2Smrg# XORG_WITH_GROFF([DEFAULT])
215788cd5fc2Smrg# ----------------
215888cd5fc2Smrg# Minimum version: 1.6.0
215988cd5fc2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
216088cd5fc2Smrg#
216188cd5fc2Smrg# Documentation tools are not always available on all platforms and sometimes
216288cd5fc2Smrg# not at the appropriate level. This macro enables a module to test for the
216388cd5fc2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
216488cd5fc2Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
216588cd5fc2Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
216688cd5fc2Smrg# --with-groff assumes 'auto'.
216788cd5fc2Smrg#
216888cd5fc2Smrg# Interface to module:
216988cd5fc2Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
217088cd5fc2Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
217188cd5fc2Smrg# HAVE_GROFF_MS: the -ms macros package
217288cd5fc2Smrg# GROFF:	 returns the path of the groff program found
217388cd5fc2Smrg#		 returns the path set by the user in the environment
217488cd5fc2Smrg# --with-groff:	 'yes' user instructs the module to use groff
217588cd5fc2Smrg#		 'no' user instructs the module not to use groff
217688cd5fc2Smrg#
217788cd5fc2Smrg# Added in version 1.9.0:
217888cd5fc2Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
217988cd5fc2Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
218088cd5fc2Smrg#		   psselect from the psutils package.
218188cd5fc2Smrg#		   the ghostcript package. Refer to the grohtml man pages
218288cd5fc2Smrg#
218388cd5fc2Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
218488cd5fc2Smrg#
218588cd5fc2Smrg# OS and distros often splits groff in a basic and full package, the former
218688cd5fc2Smrg# having the groff program and the later having devices, fonts and macros
218788cd5fc2Smrg# Checking for the groff executable is not enough.
218888cd5fc2Smrg#
218988cd5fc2Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
219088cd5fc2Smrg# unset HAVE_GROFF or GROFF env variables.
219188cd5fc2Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
219288cd5fc2Smrg#
219388cd5fc2SmrgAC_DEFUN([XORG_WITH_GROFF],[
219488cd5fc2SmrgAC_ARG_VAR([GROFF], [Path to groff command])
219588cd5fc2Smrgm4_define([_defopt], m4_default([$1], [auto]))
219688cd5fc2SmrgAC_ARG_WITH(groff,
219788cd5fc2Smrg	AS_HELP_STRING([--with-groff],
219888cd5fc2Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
219988cd5fc2Smrg	   [use_groff=$withval], [use_groff=]_defopt)
220088cd5fc2Smrgm4_undefine([_defopt])
220188cd5fc2Smrg
220288cd5fc2Smrgif test "x$use_groff" = x"auto"; then
220388cd5fc2Smrg   AC_PATH_PROG([GROFF], [groff])
220488cd5fc2Smrg   if test "x$GROFF" = "x"; then
220588cd5fc2Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
220688cd5fc2Smrg	have_groff=no
220788cd5fc2Smrg   else
220888cd5fc2Smrg        have_groff=yes
220988cd5fc2Smrg   fi
221088cd5fc2Smrgelif test "x$use_groff" = x"yes" ; then
221188cd5fc2Smrg   AC_PATH_PROG([GROFF], [groff])
221288cd5fc2Smrg   if test "x$GROFF" = "x"; then
221388cd5fc2Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
221488cd5fc2Smrg   fi
221588cd5fc2Smrg   have_groff=yes
221688cd5fc2Smrgelif test "x$use_groff" = x"no" ; then
221788cd5fc2Smrg   if test "x$GROFF" != "x"; then
221888cd5fc2Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
221988cd5fc2Smrg   fi
222088cd5fc2Smrg   have_groff=no
222188cd5fc2Smrgelse
222288cd5fc2Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
222388cd5fc2Smrgfi
222488cd5fc2Smrg
222588cd5fc2Smrg# We have groff, test for the presence of the macro packages
222688cd5fc2Smrgif test "x$have_groff" = x"yes"; then
222788cd5fc2Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
222888cd5fc2Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
222988cd5fc2Smrg        groff_ms_works=yes
223088cd5fc2Smrg    else
223188cd5fc2Smrg        groff_ms_works=no
223288cd5fc2Smrg    fi
223388cd5fc2Smrg    AC_MSG_RESULT([$groff_ms_works])
223488cd5fc2Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
223588cd5fc2Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
223688cd5fc2Smrg        groff_mm_works=yes
223788cd5fc2Smrg    else
223888cd5fc2Smrg        groff_mm_works=no
223988cd5fc2Smrg    fi
224088cd5fc2Smrg    AC_MSG_RESULT([$groff_mm_works])
224188cd5fc2Smrgfi
224288cd5fc2Smrg
224388cd5fc2Smrg# We have groff, test for HTML dependencies, one command per package
224488cd5fc2Smrgif test "x$have_groff" = x"yes"; then
224588cd5fc2Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
224688cd5fc2Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
224788cd5fc2Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
224888cd5fc2Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
224988cd5fc2Smrg      have_groff_html=yes
225088cd5fc2Smrg   else
225188cd5fc2Smrg      have_groff_html=no
225288cd5fc2Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
225388cd5fc2Smrg   fi
225488cd5fc2Smrgfi
225588cd5fc2Smrg
225688cd5fc2Smrg# Set Automake conditionals for Makefiles
225788cd5fc2SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
225888cd5fc2SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
225988cd5fc2SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
226088cd5fc2SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
226188cd5fc2Smrg]) # XORG_WITH_GROFF
226288cd5fc2Smrg
226388cd5fc2Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
226488cd5fc2Smrg# ---------------------------------------
226588cd5fc2Smrg# Minimum version: 1.6.0
226688cd5fc2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
226788cd5fc2Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
226888cd5fc2Smrg#
226988cd5fc2Smrg# Documentation tools are not always available on all platforms and sometimes
227088cd5fc2Smrg# not at the appropriate level. This macro enables a module to test for the
227188cd5fc2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
227288cd5fc2Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
227388cd5fc2Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
227488cd5fc2Smrg# --with-fop assumes 'auto'.
227588cd5fc2Smrg#
227688cd5fc2Smrg# Interface to module:
227788cd5fc2Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
227888cd5fc2Smrg# FOP:	 	returns the path of the fop program found
227988cd5fc2Smrg#		returns the path set by the user in the environment
228088cd5fc2Smrg# --with-fop: 	'yes' user instructs the module to use fop
228188cd5fc2Smrg#		'no' user instructs the module not to use fop
228288cd5fc2Smrg#
228388cd5fc2Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
228488cd5fc2Smrg#
228588cd5fc2SmrgAC_DEFUN([XORG_WITH_FOP],[
228688cd5fc2SmrgAC_ARG_VAR([FOP], [Path to fop command])
228788cd5fc2Smrgm4_define([_defopt], m4_default([$2], [auto]))
228888cd5fc2SmrgAC_ARG_WITH(fop,
228988cd5fc2Smrg	AS_HELP_STRING([--with-fop],
229088cd5fc2Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
229188cd5fc2Smrg	   [use_fop=$withval], [use_fop=]_defopt)
229288cd5fc2Smrgm4_undefine([_defopt])
229388cd5fc2Smrg
229488cd5fc2Smrgif test "x$use_fop" = x"auto"; then
229588cd5fc2Smrg   AC_PATH_PROG([FOP], [fop])
229688cd5fc2Smrg   if test "x$FOP" = "x"; then
229788cd5fc2Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
229888cd5fc2Smrg	have_fop=no
229988cd5fc2Smrg   else
230088cd5fc2Smrg        have_fop=yes
230188cd5fc2Smrg   fi
230288cd5fc2Smrgelif test "x$use_fop" = x"yes" ; then
230388cd5fc2Smrg   AC_PATH_PROG([FOP], [fop])
230488cd5fc2Smrg   if test "x$FOP" = "x"; then
230588cd5fc2Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
230688cd5fc2Smrg   fi
230788cd5fc2Smrg   have_fop=yes
230888cd5fc2Smrgelif test "x$use_fop" = x"no" ; then
230988cd5fc2Smrg   if test "x$FOP" != "x"; then
231088cd5fc2Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
231188cd5fc2Smrg   fi
231288cd5fc2Smrg   have_fop=no
231388cd5fc2Smrgelse
231488cd5fc2Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
231588cd5fc2Smrgfi
231688cd5fc2Smrg
231788cd5fc2Smrg# Test for a minimum version of fop, if provided.
231888cd5fc2Smrgm4_ifval([$1],
231988cd5fc2Smrg[if test "$have_fop" = yes; then
232088cd5fc2Smrg    # scrape the fop version
232188cd5fc2Smrg    AC_MSG_CHECKING([for fop minimum version])
232288cd5fc2Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
232388cd5fc2Smrg    AC_MSG_RESULT([$fop_version])
232488cd5fc2Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
232588cd5fc2Smrg        [if test "x$use_fop" = xauto; then
232688cd5fc2Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
232788cd5fc2Smrg            have_fop=no
232888cd5fc2Smrg        else
232988cd5fc2Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
233088cd5fc2Smrg        fi])
233188cd5fc2Smrgfi])
233288cd5fc2SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
233388cd5fc2Smrg]) # XORG_WITH_FOP
233488cd5fc2Smrg
233588cd5fc2Smrg# XORG_WITH_M4([MIN-VERSION])
233688cd5fc2Smrg# ---------------------------
233788cd5fc2Smrg# Minimum version: 1.19.0
233888cd5fc2Smrg#
233988cd5fc2Smrg# This macro attempts to locate an m4 macro processor which supports
234088cd5fc2Smrg# -I option and is only useful for modules relying on M4 in order to
234188cd5fc2Smrg# expand macros in source code files.
234288cd5fc2Smrg#
234388cd5fc2Smrg# Interface to module:
234488cd5fc2Smrg# M4:	 	returns the path of the m4 program found
234588cd5fc2Smrg#		returns the path set by the user in the environment
234688cd5fc2Smrg#
234788cd5fc2SmrgAC_DEFUN([XORG_WITH_M4], [
234888cd5fc2SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
234988cd5fc2Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
235088cd5fc2Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
235188cd5fc2Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
235288cd5fc2Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
235388cd5fc2Smrg   [$PATH:/usr/gnu/bin])])
235488cd5fc2Smrg
235588cd5fc2SmrgAC_SUBST([M4], [$ac_cv_path_M4])
235688cd5fc2Smrg]) # XORG_WITH_M4
235788cd5fc2Smrg
235888cd5fc2Smrg# XORG_WITH_PS2PDF([DEFAULT])
235988cd5fc2Smrg# ----------------
236088cd5fc2Smrg# Minimum version: 1.6.0
236188cd5fc2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
236288cd5fc2Smrg#
236388cd5fc2Smrg# Documentation tools are not always available on all platforms and sometimes
236488cd5fc2Smrg# not at the appropriate level. This macro enables a module to test for the
236588cd5fc2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
236688cd5fc2Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
236788cd5fc2Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
236888cd5fc2Smrg# --with-ps2pdf assumes 'auto'.
236988cd5fc2Smrg#
237088cd5fc2Smrg# Interface to module:
237188cd5fc2Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
237288cd5fc2Smrg# PS2PDF:	returns the path of the ps2pdf program found
237388cd5fc2Smrg#		returns the path set by the user in the environment
237488cd5fc2Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
237588cd5fc2Smrg#		 'no' user instructs the module not to use ps2pdf
237688cd5fc2Smrg#
237788cd5fc2Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
237888cd5fc2Smrg#
237988cd5fc2SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
238088cd5fc2SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
238188cd5fc2Smrgm4_define([_defopt], m4_default([$1], [auto]))
238288cd5fc2SmrgAC_ARG_WITH(ps2pdf,
238388cd5fc2Smrg	AS_HELP_STRING([--with-ps2pdf],
238488cd5fc2Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
238588cd5fc2Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
238688cd5fc2Smrgm4_undefine([_defopt])
238788cd5fc2Smrg
238888cd5fc2Smrgif test "x$use_ps2pdf" = x"auto"; then
238988cd5fc2Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239088cd5fc2Smrg   if test "x$PS2PDF" = "x"; then
239188cd5fc2Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
239288cd5fc2Smrg	have_ps2pdf=no
239388cd5fc2Smrg   else
239488cd5fc2Smrg        have_ps2pdf=yes
239588cd5fc2Smrg   fi
239688cd5fc2Smrgelif test "x$use_ps2pdf" = x"yes" ; then
239788cd5fc2Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
239888cd5fc2Smrg   if test "x$PS2PDF" = "x"; then
239988cd5fc2Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
240088cd5fc2Smrg   fi
240188cd5fc2Smrg   have_ps2pdf=yes
240288cd5fc2Smrgelif test "x$use_ps2pdf" = x"no" ; then
240388cd5fc2Smrg   if test "x$PS2PDF" != "x"; then
240488cd5fc2Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
240588cd5fc2Smrg   fi
240688cd5fc2Smrg   have_ps2pdf=no
240788cd5fc2Smrgelse
240888cd5fc2Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
240988cd5fc2Smrgfi
241088cd5fc2SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
241188cd5fc2Smrg]) # XORG_WITH_PS2PDF
241288cd5fc2Smrg
241388cd5fc2Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
241488cd5fc2Smrg# ----------------
241588cd5fc2Smrg# Minimum version: 1.6.0
241688cd5fc2Smrg#
241788cd5fc2Smrg# Documentation tools are not always available on all platforms and sometimes
241888cd5fc2Smrg# not at the appropriate level. This macro enables a builder to skip all
241988cd5fc2Smrg# documentation targets except traditional man pages.
242088cd5fc2Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
242188cd5fc2Smrg# maximum flexibilty in controlling documentation building.
242288cd5fc2Smrg# Refer to:
242388cd5fc2Smrg# XORG_WITH_XMLTO         --with-xmlto
242488cd5fc2Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
242588cd5fc2Smrg# XORG_WITH_DOXYGEN       --with-doxygen
242688cd5fc2Smrg# XORG_WITH_FOP           --with-fop
242788cd5fc2Smrg# XORG_WITH_GROFF         --with-groff
242888cd5fc2Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
242988cd5fc2Smrg#
243088cd5fc2Smrg# Interface to module:
243188cd5fc2Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
243288cd5fc2Smrg# --enable-docs: 'yes' user instructs the module to generate docs
243388cd5fc2Smrg#		 'no' user instructs the module not to generate docs
243488cd5fc2Smrg# parm1:	specify the default value, yes or no.
243588cd5fc2Smrg#
243688cd5fc2SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
243788cd5fc2Smrgm4_define([docs_default], m4_default([$1], [yes]))
243888cd5fc2SmrgAC_ARG_ENABLE(docs,
243988cd5fc2Smrg	AS_HELP_STRING([--enable-docs],
244088cd5fc2Smrg	   [Enable building the documentation (default: ]docs_default[)]),
244188cd5fc2Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
244288cd5fc2Smrgm4_undefine([docs_default])
244388cd5fc2SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
244488cd5fc2SmrgAC_MSG_CHECKING([whether to build documentation])
244588cd5fc2SmrgAC_MSG_RESULT([$build_docs])
244688cd5fc2Smrg]) # XORG_ENABLE_DOCS
244788cd5fc2Smrg
244888cd5fc2Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
244988cd5fc2Smrg# ----------------
245088cd5fc2Smrg# Minimum version: 1.6.0
245188cd5fc2Smrg#
245288cd5fc2Smrg# This macro enables a builder to skip all developer documentation.
245388cd5fc2Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
245488cd5fc2Smrg# maximum flexibilty in controlling documentation building.
245588cd5fc2Smrg# Refer to:
245688cd5fc2Smrg# XORG_WITH_XMLTO         --with-xmlto
245788cd5fc2Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
245888cd5fc2Smrg# XORG_WITH_DOXYGEN       --with-doxygen
245988cd5fc2Smrg# XORG_WITH_FOP           --with-fop
246088cd5fc2Smrg# XORG_WITH_GROFF         --with-groff
246188cd5fc2Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
246288cd5fc2Smrg#
246388cd5fc2Smrg# Interface to module:
246488cd5fc2Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
246588cd5fc2Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
246688cd5fc2Smrg#			'no' user instructs the module not to generate developer docs
246788cd5fc2Smrg# parm1:		specify the default value, yes or no.
246888cd5fc2Smrg#
246988cd5fc2SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
247088cd5fc2Smrgm4_define([devel_default], m4_default([$1], [yes]))
247188cd5fc2SmrgAC_ARG_ENABLE(devel-docs,
247288cd5fc2Smrg	AS_HELP_STRING([--enable-devel-docs],
247388cd5fc2Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
247488cd5fc2Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
247588cd5fc2Smrgm4_undefine([devel_default])
247688cd5fc2SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
247788cd5fc2SmrgAC_MSG_CHECKING([whether to build developer documentation])
247888cd5fc2SmrgAC_MSG_RESULT([$build_devel_docs])
247988cd5fc2Smrg]) # XORG_ENABLE_DEVEL_DOCS
248088cd5fc2Smrg
248188cd5fc2Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
248288cd5fc2Smrg# ----------------
248388cd5fc2Smrg# Minimum version: 1.6.0
248488cd5fc2Smrg#
248588cd5fc2Smrg# This macro enables a builder to skip all functional specification targets.
248688cd5fc2Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
248788cd5fc2Smrg# maximum flexibilty in controlling documentation building.
248888cd5fc2Smrg# Refer to:
248988cd5fc2Smrg# XORG_WITH_XMLTO         --with-xmlto
249088cd5fc2Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
249188cd5fc2Smrg# XORG_WITH_DOXYGEN       --with-doxygen
249288cd5fc2Smrg# XORG_WITH_FOP           --with-fop
249388cd5fc2Smrg# XORG_WITH_GROFF         --with-groff
249488cd5fc2Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
249588cd5fc2Smrg#
249688cd5fc2Smrg# Interface to module:
249788cd5fc2Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
249888cd5fc2Smrg# --enable-specs:	'yes' user instructs the module to generate specs
249988cd5fc2Smrg#			'no' user instructs the module not to generate specs
250088cd5fc2Smrg# parm1:		specify the default value, yes or no.
250188cd5fc2Smrg#
250288cd5fc2SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
250388cd5fc2Smrgm4_define([spec_default], m4_default([$1], [yes]))
250488cd5fc2SmrgAC_ARG_ENABLE(specs,
250588cd5fc2Smrg	AS_HELP_STRING([--enable-specs],
250688cd5fc2Smrg	   [Enable building the specs (default: ]spec_default[)]),
250788cd5fc2Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
250888cd5fc2Smrgm4_undefine([spec_default])
250988cd5fc2SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
251088cd5fc2SmrgAC_MSG_CHECKING([whether to build functional specifications])
251188cd5fc2SmrgAC_MSG_RESULT([$build_specs])
251288cd5fc2Smrg]) # XORG_ENABLE_SPECS
251388cd5fc2Smrg
251488cd5fc2Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
251588cd5fc2Smrg# ----------------------------------------------
251688cd5fc2Smrg# Minimum version: 1.13.0
251788cd5fc2Smrg#
251888cd5fc2Smrg# This macro enables a builder to enable/disable unit testing
251988cd5fc2Smrg# It makes no assumption about the test cases implementation
252088cd5fc2Smrg# Test cases may or may not use Automake "Support for test suites"
252188cd5fc2Smrg# They may or may not use the software utility library GLib
252288cd5fc2Smrg#
252388cd5fc2Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
252488cd5fc2Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
252588cd5fc2Smrg# The variable enable_unit_tests is used by other macros in this file.
252688cd5fc2Smrg#
252788cd5fc2Smrg# Interface to module:
252888cd5fc2Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
252988cd5fc2Smrg# enable_unit_tests:    used in configure.ac for additional configuration
253088cd5fc2Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
253188cd5fc2Smrg#			'no' user instructs the module not to build tests
253288cd5fc2Smrg# parm1:		specify the default value, yes or no.
253388cd5fc2Smrg#
253488cd5fc2SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
253588cd5fc2SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
253688cd5fc2SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
253788cd5fc2SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
253888cd5fc2Smrgm4_define([_defopt], m4_default([$1], [auto]))
253988cd5fc2SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
254088cd5fc2Smrg	[Enable building unit test cases (default: ]_defopt[)]),
254188cd5fc2Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
254288cd5fc2Smrgm4_undefine([_defopt])
254388cd5fc2SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
254488cd5fc2SmrgAC_MSG_CHECKING([whether to build unit test cases])
254588cd5fc2SmrgAC_MSG_RESULT([$enable_unit_tests])
254688cd5fc2Smrg]) # XORG_ENABLE_UNIT_TESTS
254788cd5fc2Smrg
254888cd5fc2Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
254988cd5fc2Smrg# ------------------------------------------------------
255088cd5fc2Smrg# Minimum version: 1.17.0
255188cd5fc2Smrg#
255288cd5fc2Smrg# This macro enables a builder to enable/disable integration testing
255388cd5fc2Smrg# It makes no assumption about the test cases' implementation
255488cd5fc2Smrg# Test cases may or may not use Automake "Support for test suites"
255588cd5fc2Smrg#
255688cd5fc2Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
255788cd5fc2Smrg# usually requires less dependencies and may be built and run under less
255888cd5fc2Smrg# stringent environments than integration tests.
255988cd5fc2Smrg#
256088cd5fc2Smrg# Interface to module:
256188cd5fc2Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
256288cd5fc2Smrg# enable_integration_tests:   used in configure.ac for additional configuration
256388cd5fc2Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
256488cd5fc2Smrg#                             'no' user instructs the module not to build tests
256588cd5fc2Smrg# parm1:                      specify the default value, yes or no.
256688cd5fc2Smrg#
256788cd5fc2SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
256888cd5fc2SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
256988cd5fc2Smrgm4_define([_defopt], m4_default([$1], [auto]))
257088cd5fc2SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
257188cd5fc2Smrg	[Enable building integration test cases (default: ]_defopt[)]),
257288cd5fc2Smrg	[enable_integration_tests=$enableval],
257388cd5fc2Smrg	[enable_integration_tests=]_defopt)
257488cd5fc2Smrgm4_undefine([_defopt])
257588cd5fc2SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
257688cd5fc2Smrg	[test "x$enable_integration_tests" != xno])
257788cd5fc2SmrgAC_MSG_CHECKING([whether to build unit test cases])
257888cd5fc2SmrgAC_MSG_RESULT([$enable_integration_tests])
257988cd5fc2Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
258088cd5fc2Smrg
258188cd5fc2Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
258288cd5fc2Smrg# ----------------------------------------
258388cd5fc2Smrg# Minimum version: 1.13.0
258488cd5fc2Smrg#
258588cd5fc2Smrg# GLib is a library which provides advanced data structures and functions.
258688cd5fc2Smrg# This macro enables a module to test for the presence of Glib.
258788cd5fc2Smrg#
258888cd5fc2Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
258988cd5fc2Smrg# Otherwise the value of $enable_unit_tests is blank.
259088cd5fc2Smrg#
259188cd5fc2Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
259288cd5fc2Smrg# test support usually requires less dependencies and may be built and run under
259388cd5fc2Smrg# less stringent environments than integration tests.
259488cd5fc2Smrg#
259588cd5fc2Smrg# Interface to module:
259688cd5fc2Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
259788cd5fc2Smrg# with_glib: used in configure.ac to know if GLib has been found
259888cd5fc2Smrg# --with-glib:	'yes' user instructs the module to use glib
259988cd5fc2Smrg#		'no' user instructs the module not to use glib
260088cd5fc2Smrg#
260188cd5fc2SmrgAC_DEFUN([XORG_WITH_GLIB],[
260288cd5fc2SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
260388cd5fc2Smrgm4_define([_defopt], m4_default([$2], [auto]))
260488cd5fc2SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
260588cd5fc2Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
260688cd5fc2Smrg	[with_glib=$withval], [with_glib=]_defopt)
260788cd5fc2Smrgm4_undefine([_defopt])
260888cd5fc2Smrg
260988cd5fc2Smrghave_glib=no
261088cd5fc2Smrg# Do not probe GLib if user explicitly disabled unit testing
261188cd5fc2Smrgif test "x$enable_unit_tests" != x"no"; then
261288cd5fc2Smrg  # Do not probe GLib if user explicitly disabled it
261388cd5fc2Smrg  if test "x$with_glib" != x"no"; then
261488cd5fc2Smrg    m4_ifval(
261588cd5fc2Smrg      [$1],
261688cd5fc2Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
261788cd5fc2Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
261888cd5fc2Smrg    )
261988cd5fc2Smrg  fi
262088cd5fc2Smrgfi
262188cd5fc2Smrg
262288cd5fc2Smrg# Not having GLib when unit testing has been explicitly requested is an error
262388cd5fc2Smrgif test "x$enable_unit_tests" = x"yes"; then
262488cd5fc2Smrg  if test "x$have_glib" = x"no"; then
262588cd5fc2Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
262688cd5fc2Smrg  fi
262788cd5fc2Smrgfi
262888cd5fc2Smrg
262988cd5fc2Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
263088cd5fc2Smrgif test "x$enable_unit_tests" = x"no"; then
263188cd5fc2Smrg  if test "x$with_glib" = x"yes"; then
263288cd5fc2Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
263388cd5fc2Smrg  fi
263488cd5fc2Smrgfi
263588cd5fc2Smrg
263688cd5fc2Smrg# Not having GLib when it has been explicitly requested is an error
263788cd5fc2Smrgif test "x$with_glib" = x"yes"; then
263888cd5fc2Smrg  if test "x$have_glib" = x"no"; then
263988cd5fc2Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
264088cd5fc2Smrg  fi
264188cd5fc2Smrgfi
264288cd5fc2Smrg
264388cd5fc2SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
264488cd5fc2Smrg]) # XORG_WITH_GLIB
264588cd5fc2Smrg
264688cd5fc2Smrg# XORG_LD_WRAP([required|optional])
264788cd5fc2Smrg# ---------------------------------
264888cd5fc2Smrg# Minimum version: 1.13.0
264988cd5fc2Smrg#
265088cd5fc2Smrg# Check if linker supports -wrap, passed via compiler flags
265188cd5fc2Smrg#
265288cd5fc2Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
265388cd5fc2Smrg# Otherwise the value of $enable_unit_tests is blank.
265488cd5fc2Smrg#
265588cd5fc2Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
265688cd5fc2Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
265788cd5fc2Smrg# available, an argument of "optional" allows use when some unit tests require
265888cd5fc2Smrg# ld -wrap and others do not.
265988cd5fc2Smrg#
266088cd5fc2SmrgAC_DEFUN([XORG_LD_WRAP],[
266188cd5fc2SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
266288cd5fc2Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
266388cd5fc2Smrg                      void __wrap_exit(int status) { return; }],
266488cd5fc2Smrg                     [exit(0);])])
266588cd5fc2Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
266688cd5fc2Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
266788cd5fc2Smrg  if test "x$have_ld_wrap" = x"no"; then
266888cd5fc2Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
266988cd5fc2Smrg  fi
267088cd5fc2Smrgfi
267188cd5fc2SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
267288cd5fc2Smrg#
267388cd5fc2Smrg]) # XORG_LD_WRAP
267488cd5fc2Smrg
267588cd5fc2Smrg# XORG_CHECK_LINKER_FLAGS
267688cd5fc2Smrg# -----------------------
267788cd5fc2Smrg# SYNOPSIS
267888cd5fc2Smrg#
267988cd5fc2Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
268088cd5fc2Smrg#
268188cd5fc2Smrg# DESCRIPTION
268288cd5fc2Smrg#
268388cd5fc2Smrg#   Check whether the given linker FLAGS work with the current language's
268488cd5fc2Smrg#   linker, or whether they give an error.
268588cd5fc2Smrg#
268688cd5fc2Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
268788cd5fc2Smrg#   success/failure.
268888cd5fc2Smrg#
268988cd5fc2Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
269088cd5fc2Smrg#
269188cd5fc2Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
269288cd5fc2Smrg#
269388cd5fc2Smrg# LICENSE
269488cd5fc2Smrg#
269588cd5fc2Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
269688cd5fc2Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
269788cd5fc2Smrg#   Copyright (c) 2009 Matteo Frigo
269888cd5fc2Smrg#
269988cd5fc2Smrg#   This program is free software: you can redistribute it and/or modify it
270088cd5fc2Smrg#   under the terms of the GNU General Public License as published by the
270188cd5fc2Smrg#   Free Software Foundation, either version 3 of the License, or (at your
270288cd5fc2Smrg#   option) any later version.
270388cd5fc2Smrg#
270488cd5fc2Smrg#   This program is distributed in the hope that it will be useful, but
270588cd5fc2Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
270688cd5fc2Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
270788cd5fc2Smrg#   Public License for more details.
270888cd5fc2Smrg#
270988cd5fc2Smrg#   You should have received a copy of the GNU General Public License along
271088cd5fc2Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
271188cd5fc2Smrg#
271288cd5fc2Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
271388cd5fc2Smrg#   gives unlimited permission to copy, distribute and modify the configure
271488cd5fc2Smrg#   scripts that are the output of Autoconf when processing the Macro. You
271588cd5fc2Smrg#   need not follow the terms of the GNU General Public License when using
271688cd5fc2Smrg#   or distributing such scripts, even though portions of the text of the
271788cd5fc2Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
271888cd5fc2Smrg#   all other use of the material that constitutes the Autoconf Macro.
271988cd5fc2Smrg#
272088cd5fc2Smrg#   This special exception to the GPL applies to versions of the Autoconf
272188cd5fc2Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
272288cd5fc2Smrg#   modified version of the Autoconf Macro, you may extend this special
272388cd5fc2Smrg#   exception to the GPL to apply to your modified version as well.#
272488cd5fc2SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
272588cd5fc2Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
272688cd5fc2Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
272788cd5fc2SmrgAS_LITERAL_IF([$1],
272888cd5fc2Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
272988cd5fc2Smrg      ax_save_FLAGS=$LDFLAGS
273088cd5fc2Smrg      LDFLAGS="$1"
273188cd5fc2Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
273288cd5fc2Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273388cd5fc2Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
273488cd5fc2Smrg      LDFLAGS=$ax_save_FLAGS])],
273588cd5fc2Smrg  [ax_save_FLAGS=$LDFLAGS
273688cd5fc2Smrg   LDFLAGS="$1"
273788cd5fc2Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
273888cd5fc2Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
273988cd5fc2Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
274088cd5fc2Smrg   LDFLAGS=$ax_save_FLAGS])
274188cd5fc2Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
274288cd5fc2SmrgAC_MSG_RESULT($xorg_check_linker_flags)
274388cd5fc2Smrgif test "x$xorg_check_linker_flags" = xyes; then
274488cd5fc2Smrg	m4_default([$2], :)
274588cd5fc2Smrgelse
274688cd5fc2Smrg	m4_default([$3], :)
274788cd5fc2Smrgfi
274888cd5fc2Smrg]) # XORG_CHECK_LINKER_FLAGS
274988cd5fc2Smrg
275088cd5fc2Smrg# XORG_MEMORY_CHECK_FLAGS
275188cd5fc2Smrg# -----------------------
275288cd5fc2Smrg# Minimum version: 1.16.0
275388cd5fc2Smrg#
275488cd5fc2Smrg# This macro attempts to find appropriate memory checking functionality
275588cd5fc2Smrg# for various platforms which unit testing code may use to catch various
275688cd5fc2Smrg# forms of memory allocation and access errors in testing.
275788cd5fc2Smrg#
275888cd5fc2Smrg# Interface to module:
275988cd5fc2Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
276088cd5fc2Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
276188cd5fc2Smrg#
276288cd5fc2Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
276388cd5fc2Smrg#
276488cd5fc2SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
276588cd5fc2Smrg
276688cd5fc2SmrgAC_REQUIRE([AC_CANONICAL_HOST])
276788cd5fc2SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
276888cd5fc2Smrg           [Environment variables to enable memory checking in tests])
276988cd5fc2Smrg
277088cd5fc2Smrg# Check for different types of support on different platforms
277188cd5fc2Smrgcase $host_os in
277288cd5fc2Smrg    solaris*)
277388cd5fc2Smrg        AC_CHECK_LIB([umem], [umem_alloc],
277488cd5fc2Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
277588cd5fc2Smrg        ;;
277688cd5fc2Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
277788cd5fc2Smrg        # both directly and inverted, so should not be 0 or 255.
277888cd5fc2Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
277988cd5fc2Smrg        ;;
278088cd5fc2Smrg    darwin*)
278188cd5fc2Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
278288cd5fc2Smrg        ;;
278388cd5fc2Smrg    *bsd*)
278488cd5fc2Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
278588cd5fc2Smrg        ;;
278688cd5fc2Smrgesac
278788cd5fc2Smrg
278888cd5fc2Smrg# User supplied flags override default flags
278988cd5fc2Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
279088cd5fc2Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
279188cd5fc2Smrgfi
279288cd5fc2Smrg
279388cd5fc2SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
279488cd5fc2Smrg]) # XORG_WITH_LINT
279588cd5fc2Smrg
279688cd5fc2Smrg# XORG_CHECK_MALLOC_ZERO
279788cd5fc2Smrg# ----------------------
279888cd5fc2Smrg# Minimum version: 1.0.0
279988cd5fc2Smrg#
280088cd5fc2Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
280188cd5fc2Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
280288cd5fc2Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
280388cd5fc2SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
280488cd5fc2SmrgAC_ARG_ENABLE(malloc0returnsnull,
280588cd5fc2Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
280688cd5fc2Smrg		       [malloc(0) returns NULL (default: auto)]),
280788cd5fc2Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
280888cd5fc2Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
280988cd5fc2Smrg
281088cd5fc2SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
281188cd5fc2Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
281288cd5fc2SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
281388cd5fc2Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
281488cd5fc2Smrg#include <stdlib.h>
281588cd5fc2Smrg],[
281688cd5fc2Smrg    char *m0, *r0, *c0, *p;
281788cd5fc2Smrg    m0 = malloc(0);
281888cd5fc2Smrg    p = malloc(10);
281988cd5fc2Smrg    r0 = realloc(p,0);
282088cd5fc2Smrg    c0 = calloc(0,10);
282188cd5fc2Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
282288cd5fc2Smrg])],
282388cd5fc2Smrg		[xorg_cv_malloc0_returns_null=yes],
282488cd5fc2Smrg		[xorg_cv_malloc0_returns_null=no])])
282588cd5fc2SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
282688cd5fc2Smrgfi
282788cd5fc2SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
282888cd5fc2Smrg
282988cd5fc2Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
283088cd5fc2Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
283188cd5fc2Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
283288cd5fc2Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
283388cd5fc2Smrgelse
283488cd5fc2Smrg	MALLOC_ZERO_CFLAGS=""
283588cd5fc2Smrg	XMALLOC_ZERO_CFLAGS=""
283688cd5fc2Smrg	XTMALLOC_ZERO_CFLAGS=""
283788cd5fc2Smrgfi
283888cd5fc2Smrg
283988cd5fc2SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
284088cd5fc2SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
284188cd5fc2SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
284288cd5fc2Smrg]) # XORG_CHECK_MALLOC_ZERO
284388cd5fc2Smrg
284488cd5fc2Smrg# XORG_WITH_LINT()
284588cd5fc2Smrg# ----------------
284688cd5fc2Smrg# Minimum version: 1.1.0
284788cd5fc2Smrg#
284888cd5fc2Smrg# This macro enables the use of a tool that flags some suspicious and
284988cd5fc2Smrg# non-portable constructs (likely to be bugs) in C language source code.
285088cd5fc2Smrg# It will attempt to locate the tool and use appropriate options.
285188cd5fc2Smrg# There are various lint type tools on different platforms.
285288cd5fc2Smrg#
285388cd5fc2Smrg# Interface to module:
285488cd5fc2Smrg# LINT:		returns the path to the tool found on the platform
285588cd5fc2Smrg#		or the value set to LINT on the configure cmd line
285688cd5fc2Smrg#		also an Automake conditional
285788cd5fc2Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
285888cd5fc2Smrg#
285988cd5fc2Smrg# --with-lint:	'yes' user instructs the module to use lint
286088cd5fc2Smrg#		'no' user instructs the module not to use lint (default)
286188cd5fc2Smrg#
286288cd5fc2Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
286388cd5fc2Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
286488cd5fc2Smrg#
286588cd5fc2SmrgAC_DEFUN([XORG_WITH_LINT],[
286688cd5fc2Smrg
286788cd5fc2SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
286888cd5fc2SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
286988cd5fc2SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
287088cd5fc2Smrg		[Use a lint-style source code checker (default: disabled)])],
287188cd5fc2Smrg		[use_lint=$withval], [use_lint=no])
287288cd5fc2Smrg
287388cd5fc2Smrg# Obtain platform specific info like program name and options
287488cd5fc2Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
287588cd5fc2Smrgcase $host_os in
287688cd5fc2Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
287788cd5fc2Smrg	lint_name=splint
287888cd5fc2Smrg	lint_options="-badflag"
287988cd5fc2Smrg	;;
288088cd5fc2Smrg  *freebsd* | *netbsd*)
288188cd5fc2Smrg	lint_name=lint
288288cd5fc2Smrg	lint_options="-u -b"
288388cd5fc2Smrg	;;
288488cd5fc2Smrg  *solaris*)
288588cd5fc2Smrg	lint_name=lint
288688cd5fc2Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
288788cd5fc2Smrg	;;
288888cd5fc2Smrgesac
288988cd5fc2Smrg
289088cd5fc2Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
289188cd5fc2Smrgif test "x$use_lint" = x"yes" ; then
289288cd5fc2Smrg   AC_PATH_PROG([LINT], [$lint_name])
289388cd5fc2Smrg   if test "x$LINT" = "x"; then
289488cd5fc2Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
289588cd5fc2Smrg   fi
289688cd5fc2Smrgelif test "x$use_lint" = x"no" ; then
289788cd5fc2Smrg   if test "x$LINT" != "x"; then
289888cd5fc2Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
289988cd5fc2Smrg   fi
290088cd5fc2Smrgelse
290188cd5fc2Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
290288cd5fc2Smrgfi
290388cd5fc2Smrg
290488cd5fc2Smrg# User supplied flags override default flags
290588cd5fc2Smrgif test "x$LINT_FLAGS" != "x"; then
290688cd5fc2Smrg   lint_options=$LINT_FLAGS
290788cd5fc2Smrgfi
290888cd5fc2Smrg
290988cd5fc2SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
291088cd5fc2SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
291188cd5fc2Smrg
291288cd5fc2Smrg]) # XORG_WITH_LINT
291388cd5fc2Smrg
291488cd5fc2Smrg# XORG_LINT_LIBRARY(LIBNAME)
291588cd5fc2Smrg# --------------------------
291688cd5fc2Smrg# Minimum version: 1.1.0
291788cd5fc2Smrg#
291888cd5fc2Smrg# Sets up flags for building lint libraries for checking programs that call
291988cd5fc2Smrg# functions in the library.
292088cd5fc2Smrg#
292188cd5fc2Smrg# Interface to module:
292288cd5fc2Smrg# LINTLIB		- Automake variable with the name of lint library file to make
292388cd5fc2Smrg# MAKE_LINT_LIB		- Automake conditional
292488cd5fc2Smrg#
292588cd5fc2Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
292688cd5fc2Smrg#			  - 'no' user instructs the module not to create a lint library (default)
292788cd5fc2Smrg
292888cd5fc2SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
292988cd5fc2SmrgAC_REQUIRE([XORG_WITH_LINT])
293088cd5fc2SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
293188cd5fc2Smrg	[Create lint library (default: disabled)])],
293288cd5fc2Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
293388cd5fc2Smrg
293488cd5fc2Smrgif test "x$make_lint_lib" = x"yes" ; then
293588cd5fc2Smrg   LINTLIB=llib-l$1.ln
293688cd5fc2Smrg   if test "x$LINT" = "x"; then
293788cd5fc2Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
293888cd5fc2Smrg   fi
293988cd5fc2Smrgelif test "x$make_lint_lib" != x"no" ; then
294088cd5fc2Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
294188cd5fc2Smrgfi
294288cd5fc2Smrg
294388cd5fc2SmrgAC_SUBST(LINTLIB)
294488cd5fc2SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
294588cd5fc2Smrg
294688cd5fc2Smrg]) # XORG_LINT_LIBRARY
294788cd5fc2Smrg
294888cd5fc2Smrg# XORG_COMPILER_BRAND
294988cd5fc2Smrg# -------------------
295088cd5fc2Smrg# Minimum version: 1.14.0
295188cd5fc2Smrg#
295288cd5fc2Smrg# Checks for various brands of compilers and sets flags as appropriate:
295388cd5fc2Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
295488cd5fc2Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
295588cd5fc2Smrg#   clang compiler - sets CLANGCC to "yes"
295688cd5fc2Smrg#   Intel compiler - sets INTELCC to "yes"
295788cd5fc2Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
295888cd5fc2Smrg#
295988cd5fc2SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
296088cd5fc2SmrgAC_LANG_CASE(
296188cd5fc2Smrg	[C], [
296288cd5fc2Smrg		AC_REQUIRE([AC_PROG_CC_C99])
296388cd5fc2Smrg	],
296488cd5fc2Smrg	[C++], [
296588cd5fc2Smrg		AC_REQUIRE([AC_PROG_CXX])
296688cd5fc2Smrg	]
296788cd5fc2Smrg)
296888cd5fc2SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
296988cd5fc2SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
297088cd5fc2SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
297188cd5fc2Smrg]) # XORG_COMPILER_BRAND
297288cd5fc2Smrg
297388cd5fc2Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
297488cd5fc2Smrg# ---------------
297588cd5fc2Smrg# Minimum version: 1.16.0
297688cd5fc2Smrg#
297788cd5fc2Smrg# Test if the compiler works when passed the given flag as a command line argument.
297888cd5fc2Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
297988cd5fc2Smrg# next flag in the list until there are no more options.
298088cd5fc2Smrg#
298188cd5fc2Smrg# Note that this does not guarantee that the compiler supports the flag as some
298288cd5fc2Smrg# compilers will simply ignore arguments that they do not understand, but we do
298388cd5fc2Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
298488cd5fc2Smrg# -Werror=unused-command-line-argument
298588cd5fc2Smrg#
298688cd5fc2SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
298788cd5fc2Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
298888cd5fc2Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
298988cd5fc2Smrg
299088cd5fc2SmrgAC_LANG_COMPILER_REQUIRE
299188cd5fc2Smrg
299288cd5fc2SmrgAC_LANG_CASE(
299388cd5fc2Smrg	[C], [
299488cd5fc2Smrg		AC_REQUIRE([AC_PROG_CC_C99])
299588cd5fc2Smrg		define([PREFIX], [C])
299688cd5fc2Smrg		define([CACHE_PREFIX], [cc])
299788cd5fc2Smrg		define([COMPILER], [$CC])
299888cd5fc2Smrg	],
299988cd5fc2Smrg	[C++], [
300088cd5fc2Smrg		define([PREFIX], [CXX])
300188cd5fc2Smrg		define([CACHE_PREFIX], [cxx])
300288cd5fc2Smrg		define([COMPILER], [$CXX])
300388cd5fc2Smrg	]
300488cd5fc2Smrg)
300588cd5fc2Smrg
300688cd5fc2Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
300788cd5fc2Smrg
300888cd5fc2Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
300988cd5fc2Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
301088cd5fc2Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
301188cd5fc2Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
301288cd5fc2Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
301388cd5fc2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
301488cd5fc2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
301588cd5fc2Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
301688cd5fc2Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
301788cd5fc2Smrgfi
301888cd5fc2Smrg
301988cd5fc2Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
302088cd5fc2Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
302188cd5fc2Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
302288cd5fc2Smrg	fi
302388cd5fc2Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
302488cd5fc2Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
302588cd5fc2Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
302688cd5fc2Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
302788cd5fc2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
302888cd5fc2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
302988cd5fc2Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
303088cd5fc2Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
303188cd5fc2Smrgfi
303288cd5fc2Smrg
303388cd5fc2Smrgfound="no"
303488cd5fc2Smrgm4_foreach([flag], m4_cdr($@), [
303588cd5fc2Smrg	if test $found = "no" ; then
303688cd5fc2Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
303788cd5fc2Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
303888cd5fc2Smrg		fi
303988cd5fc2Smrg
304088cd5fc2Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
304188cd5fc2Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
304288cd5fc2Smrg		fi
304388cd5fc2Smrg
304488cd5fc2Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
304588cd5fc2Smrg
304688cd5fc2Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
304788cd5fc2Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
304888cd5fc2Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
304988cd5fc2Smrg		AC_CACHE_VAL($cacheid,
305088cd5fc2Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
305188cd5fc2Smrg					     [eval $cacheid=yes],
305288cd5fc2Smrg					     [eval $cacheid=no])])
305388cd5fc2Smrg
305488cd5fc2Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
305588cd5fc2Smrg
305688cd5fc2Smrg		eval supported=\$$cacheid
305788cd5fc2Smrg		AC_MSG_RESULT([$supported])
305888cd5fc2Smrg		if test "$supported" = "yes" ; then
305988cd5fc2Smrg			$1="$$1 ]flag["
306088cd5fc2Smrg			found="yes"
306188cd5fc2Smrg		fi
306288cd5fc2Smrg	fi
306388cd5fc2Smrg])
306488cd5fc2Smrg]) # XORG_TESTSET_CFLAG
306588cd5fc2Smrg
306688cd5fc2Smrg# XORG_COMPILER_FLAGS
306788cd5fc2Smrg# ---------------
306888cd5fc2Smrg# Minimum version: 1.16.0
306988cd5fc2Smrg#
307088cd5fc2Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
307188cd5fc2Smrg# arguments supported by the selected compiler which do NOT alter the generated
307288cd5fc2Smrg# code.  These arguments will cause the compiler to print various warnings
307388cd5fc2Smrg# during compilation AND turn a conservative set of warnings into errors.
307488cd5fc2Smrg#
307588cd5fc2Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
307688cd5fc2Smrg# future versions of util-macros as options are added to new compilers.
307788cd5fc2Smrg#
307888cd5fc2SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
307988cd5fc2SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
308088cd5fc2Smrg
308188cd5fc2SmrgAC_ARG_ENABLE(selective-werror,
308288cd5fc2Smrg              AS_HELP_STRING([--disable-selective-werror],
308388cd5fc2Smrg                             [Turn off selective compiler errors. (default: enabled)]),
308488cd5fc2Smrg              [SELECTIVE_WERROR=$enableval],
308588cd5fc2Smrg              [SELECTIVE_WERROR=yes])
308688cd5fc2Smrg
308788cd5fc2SmrgAC_LANG_CASE(
308888cd5fc2Smrg        [C], [
308988cd5fc2Smrg                define([PREFIX], [C])
309088cd5fc2Smrg        ],
309188cd5fc2Smrg        [C++], [
309288cd5fc2Smrg                define([PREFIX], [CXX])
309388cd5fc2Smrg        ]
309488cd5fc2Smrg)
309588cd5fc2Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
309688cd5fc2Smrgif test "x$SUNCC" = "xyes"; then
309788cd5fc2Smrg    [BASE_]PREFIX[FLAGS]="-v"
309888cd5fc2Smrgelse
309988cd5fc2Smrg    [BASE_]PREFIX[FLAGS]=""
310088cd5fc2Smrgfi
310188cd5fc2Smrg
310288cd5fc2Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
310388cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
310488cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
310588cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
310688cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
310788cd5fc2Smrg
310888cd5fc2SmrgAC_LANG_CASE(
310988cd5fc2Smrg	[C], [
311088cd5fc2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
311188cd5fc2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
311288cd5fc2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
311388cd5fc2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
311488cd5fc2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
311588cd5fc2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
311688cd5fc2Smrg	]
311788cd5fc2Smrg)
311888cd5fc2Smrg
311988cd5fc2Smrg# This chunk adds additional warnings that could catch undesired effects.
312088cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
312188cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
312288cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
312388cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
312488cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
312588cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
312688cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
312788cd5fc2Smrg
312888cd5fc2Smrg# These are currently disabled because they are noisy.  They will be enabled
312988cd5fc2Smrg# in the future once the codebase is sufficiently modernized to silence
313088cd5fc2Smrg# them.  For now, I don't want them to drown out the other warnings.
313188cd5fc2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
313288cd5fc2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
313388cd5fc2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
313488cd5fc2Smrg
313588cd5fc2Smrg# Turn some warnings into errors, so we don't accidently get successful builds
313688cd5fc2Smrg# when there are problems that should be fixed.
313788cd5fc2Smrg
313888cd5fc2Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
313988cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
314088cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
314188cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
314288cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
314388cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
314488cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
314588cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
314688cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
314788cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
314888cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
314988cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
315088cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
315188cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
315288cd5fc2Smrgelse
315388cd5fc2SmrgAC_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])
315488cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
315588cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
315688cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
315788cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
315888cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
315988cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
316088cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
316188cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
316288cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
316388cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
316488cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
316588cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
316688cd5fc2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
316788cd5fc2Smrgfi
316888cd5fc2Smrg
316988cd5fc2SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
317088cd5fc2Smrg]) # XORG_COMPILER_FLAGS
317188cd5fc2Smrg
317288cd5fc2Smrg# XORG_CWARNFLAGS
317388cd5fc2Smrg# ---------------
317488cd5fc2Smrg# Minimum version: 1.2.0
317588cd5fc2Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
317688cd5fc2Smrg#
317788cd5fc2Smrg# Defines CWARNFLAGS to enable C compiler warnings.
317888cd5fc2Smrg#
317988cd5fc2Smrg# This function is deprecated because it defines -fno-strict-aliasing
318088cd5fc2Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
318188cd5fc2Smrg# is needed, then it should be added explicitly in the module when
318288cd5fc2Smrg# it is updated to use BASE_CFLAGS.
318388cd5fc2Smrg#
318488cd5fc2SmrgAC_DEFUN([XORG_CWARNFLAGS], [
318588cd5fc2SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
318688cd5fc2SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
318788cd5fc2SmrgAC_LANG_CASE(
318888cd5fc2Smrg	[C], [
318988cd5fc2Smrg		CWARNFLAGS="$BASE_CFLAGS"
319088cd5fc2Smrg		if  test "x$GCC" = xyes ; then
319188cd5fc2Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
319288cd5fc2Smrg		fi
319388cd5fc2Smrg		AC_SUBST(CWARNFLAGS)
319488cd5fc2Smrg	]
319588cd5fc2Smrg)
319688cd5fc2Smrg]) # XORG_CWARNFLAGS
319788cd5fc2Smrg
319888cd5fc2Smrg# XORG_STRICT_OPTION
319988cd5fc2Smrg# -----------------------
320088cd5fc2Smrg# Minimum version: 1.3.0
320188cd5fc2Smrg#
320288cd5fc2Smrg# Add configure option to enable strict compilation flags, such as treating
320388cd5fc2Smrg# warnings as fatal errors.
320488cd5fc2Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
320588cd5fc2Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
320688cd5fc2Smrg#
320788cd5fc2Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
320888cd5fc2Smrg# when strict compilation is unconditionally desired.
320988cd5fc2SmrgAC_DEFUN([XORG_STRICT_OPTION], [
321088cd5fc2SmrgAC_REQUIRE([XORG_CWARNFLAGS])
321188cd5fc2SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
321288cd5fc2Smrg
321388cd5fc2SmrgAC_ARG_ENABLE(strict-compilation,
321488cd5fc2Smrg			  AS_HELP_STRING([--enable-strict-compilation],
321588cd5fc2Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
321688cd5fc2Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
321788cd5fc2Smrg
321888cd5fc2SmrgAC_LANG_CASE(
321988cd5fc2Smrg        [C], [
322088cd5fc2Smrg                define([PREFIX], [C])
322188cd5fc2Smrg        ],
322288cd5fc2Smrg        [C++], [
322388cd5fc2Smrg                define([PREFIX], [CXX])
322488cd5fc2Smrg        ]
322588cd5fc2Smrg)
322688cd5fc2Smrg
322788cd5fc2Smrg[STRICT_]PREFIX[FLAGS]=""
322888cd5fc2SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
322988cd5fc2SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
323088cd5fc2Smrg
323188cd5fc2Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
323288cd5fc2Smrg# activate it with -Werror, so we add it here explicitly.
323388cd5fc2SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
323488cd5fc2Smrg
323588cd5fc2Smrgif test "x$STRICT_COMPILE" = "xyes"; then
323688cd5fc2Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
323788cd5fc2Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
323888cd5fc2Smrgfi
323988cd5fc2SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
324088cd5fc2SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
324188cd5fc2SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
324288cd5fc2Smrg]) # XORG_STRICT_OPTION
324388cd5fc2Smrg
324488cd5fc2Smrg# XORG_DEFAULT_OPTIONS
324588cd5fc2Smrg# --------------------
324688cd5fc2Smrg# Minimum version: 1.3.0
324788cd5fc2Smrg#
324888cd5fc2Smrg# Defines default options for X.Org modules.
324988cd5fc2Smrg#
325088cd5fc2SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
325188cd5fc2SmrgAC_REQUIRE([AC_PROG_INSTALL])
325288cd5fc2SmrgXORG_COMPILER_FLAGS
325388cd5fc2SmrgXORG_CWARNFLAGS
325488cd5fc2SmrgXORG_STRICT_OPTION
325588cd5fc2SmrgXORG_RELEASE_VERSION
325688cd5fc2SmrgXORG_CHANGELOG
325788cd5fc2SmrgXORG_INSTALL
325888cd5fc2SmrgXORG_MANPAGE_SECTIONS
325988cd5fc2Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
326088cd5fc2Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
326188cd5fc2Smrg]) # XORG_DEFAULT_OPTIONS
326288cd5fc2Smrg
326388cd5fc2Smrg# XORG_INSTALL()
326488cd5fc2Smrg# ----------------
326588cd5fc2Smrg# Minimum version: 1.4.0
326688cd5fc2Smrg#
326788cd5fc2Smrg# Defines the variable INSTALL_CMD as the command to copy
326888cd5fc2Smrg# INSTALL from $prefix/share/util-macros.
326988cd5fc2Smrg#
327088cd5fc2SmrgAC_DEFUN([XORG_INSTALL], [
327188cd5fc2SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
327288cd5fc2Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
327388cd5fc2SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
327488cd5fc2Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3275a33c354dSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3276a33c354dSmrgtouch \$(top_srcdir)/INSTALL; \
3277a33c354dSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
327888cd5fc2SmrgAC_SUBST([INSTALL_CMD])
327988cd5fc2Smrg]) # XORG_INSTALL
328088cd5fc2Smrgdnl Copyright 2005 Red Hat, Inc
328188cd5fc2Smrgdnl
328288cd5fc2Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
328388cd5fc2Smrgdnl documentation for any purpose is hereby granted without fee, provided that
328488cd5fc2Smrgdnl the above copyright notice appear in all copies and that both that
328588cd5fc2Smrgdnl copyright notice and this permission notice appear in supporting
328688cd5fc2Smrgdnl documentation.
328788cd5fc2Smrgdnl
328888cd5fc2Smrgdnl The above copyright notice and this permission notice shall be included
328988cd5fc2Smrgdnl in all copies or substantial portions of the Software.
329088cd5fc2Smrgdnl
329188cd5fc2Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
329288cd5fc2Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
329388cd5fc2Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
329488cd5fc2Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
329588cd5fc2Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
329688cd5fc2Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
329788cd5fc2Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
329888cd5fc2Smrgdnl
329988cd5fc2Smrgdnl Except as contained in this notice, the name of the copyright holders shall
330088cd5fc2Smrgdnl not be used in advertising or otherwise to promote the sale, use or
330188cd5fc2Smrgdnl other dealings in this Software without prior written authorization
330288cd5fc2Smrgdnl from the copyright holders.
330388cd5fc2Smrgdnl
330488cd5fc2Smrg
330588cd5fc2Smrg# XORG_RELEASE_VERSION
330688cd5fc2Smrg# --------------------
330788cd5fc2Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
330888cd5fc2Smrg
330988cd5fc2SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
331088cd5fc2Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
331188cd5fc2Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
331288cd5fc2Smrg		[Major version of this package])
331388cd5fc2Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
331488cd5fc2Smrg	if test "x$PVM" = "x"; then
331588cd5fc2Smrg		PVM="0"
331688cd5fc2Smrg	fi
331788cd5fc2Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
331888cd5fc2Smrg		[$PVM],
331988cd5fc2Smrg		[Minor version of this package])
332088cd5fc2Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
332188cd5fc2Smrg	if test "x$PVP" = "x"; then
332288cd5fc2Smrg		PVP="0"
332388cd5fc2Smrg	fi
332488cd5fc2Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
332588cd5fc2Smrg		[$PVP],
332688cd5fc2Smrg		[Patch version of this package])
332788cd5fc2Smrg])
332888cd5fc2Smrg
332988cd5fc2Smrg# XORG_CHANGELOG()
333088cd5fc2Smrg# ----------------
333188cd5fc2Smrg# Minimum version: 1.2.0
333288cd5fc2Smrg#
333388cd5fc2Smrg# Defines the variable CHANGELOG_CMD as the command to generate
333488cd5fc2Smrg# ChangeLog from git.
333588cd5fc2Smrg#
333688cd5fc2Smrg#
333788cd5fc2SmrgAC_DEFUN([XORG_CHANGELOG], [
3338a33c354dSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
333988cd5fc2Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3340a33c354dSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3341a33c354dSmrgtouch \$(top_srcdir)/ChangeLog; \
3342a33c354dSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
334388cd5fc2SmrgAC_SUBST([CHANGELOG_CMD])
334488cd5fc2Smrg]) # XORG_CHANGELOG
334588cd5fc2Smrg
3346a33c354dSmrgm4_include([m4/libtool.m4])
3347a33c354dSmrgm4_include([m4/ltoptions.m4])
3348a33c354dSmrgm4_include([m4/ltsugar.m4])
3349a33c354dSmrgm4_include([m4/ltversion.m4])
3350a33c354dSmrgm4_include([m4/lt~obsolete.m4])
3351