18d0bc965Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
28bd17e5fSmrg
38d0bc965Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4b042e37fSmrg
5b042e37fSmrg# This file is free software; the Free Software Foundation
6b042e37fSmrg# gives unlimited permission to copy and/or distribute it,
7b042e37fSmrg# with or without modifications, as long as this notice is preserved.
8b042e37fSmrg
9b042e37fSmrg# This program is distributed in the hope that it will be useful,
10b042e37fSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11b042e37fSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12b042e37fSmrg# PARTICULAR PURPOSE.
13b042e37fSmrg
148bd17e5fSmrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
158c4a8e55Smrgm4_ifndef([AC_AUTOCONF_VERSION],
168c4a8e55Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
178d0bc965Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
188d0bc965Smrg[m4_warning([this file was generated for autoconf 2.71.
198c4a8e55SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
208c4a8e55SmrgIf you have problems, you may need to regenerate the build system entirely.
218bd17e5fSmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22b042e37fSmrg
238d0bc965Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
24b042e37fSmrg#
258d0bc965Smrg# This file is free software; the Free Software Foundation
268d0bc965Smrg# gives unlimited permission to copy and/or distribute it,
278d0bc965Smrg# with or without modifications, as long as this notice is preserved.
283169be4bSmrg
298d0bc965Smrg# AM_AUTOMAKE_VERSION(VERSION)
308d0bc965Smrg# ----------------------------
318d0bc965Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
328d0bc965Smrg# generated from the m4 files accompanying Automake X.Y.
338d0bc965Smrg# (This private macro should not be called outside this file.)
348d0bc965SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
358d0bc965Smrg[am__api_version='1.16'
368d0bc965Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
378d0bc965Smrgdnl require some minimum version.  Point them to the right macro.
388d0bc965Smrgm4_if([$1], [1.16.5], [],
398d0bc965Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
400597fb56Smrg])
41b042e37fSmrg
428d0bc965Smrg# _AM_AUTOCONF_VERSION(VERSION)
438d0bc965Smrg# -----------------------------
448d0bc965Smrg# aclocal traces this macro to find the Autoconf version.
458d0bc965Smrg# This is a private macro too.  Using m4_define simplifies
468d0bc965Smrg# the logic in aclocal, which can simply ignore this definition.
478d0bc965Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48b042e37fSmrg
498d0bc965Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
508d0bc965Smrg# -------------------------------
518d0bc965Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
528d0bc965Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
538d0bc965SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
548d0bc965Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
558d0bc965Smrgm4_ifndef([AC_AUTOCONF_VERSION],
568d0bc965Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
578d0bc965Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58b042e37fSmrg
598d0bc965Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60b042e37fSmrg
618d0bc965Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
628d0bc965Smrg#
638d0bc965Smrg# This file is free software; the Free Software Foundation
648d0bc965Smrg# gives unlimited permission to copy and/or distribute it,
658d0bc965Smrg# with or without modifications, as long as this notice is preserved.
66b042e37fSmrg
678d0bc965Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
688d0bc965Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
698d0bc965Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
708d0bc965Smrg#
718d0bc965Smrg# Of course, Automake must honor this variable whenever it calls a
728d0bc965Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
738d0bc965Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
748d0bc965Smrg# depending on how configure is run.  This is pretty annoying, since
758d0bc965Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
768d0bc965Smrg# source directory, any form will work fine, but in subdirectories a
778d0bc965Smrg# relative path needs to be adjusted first.
788d0bc965Smrg#
798d0bc965Smrg# $ac_aux_dir/missing
808d0bc965Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
818d0bc965Smrg# $top_srcdir/$ac_aux_dir/missing
828d0bc965Smrg#    fails if $ac_aux_dir is absolute,
838d0bc965Smrg#    fails when called from a subdirectory in a VPATH build with
848d0bc965Smrg#          a relative $ac_aux_dir
858d0bc965Smrg#
868d0bc965Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
878d0bc965Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
888d0bc965Smrg# harmless because $srcdir is '.', but things will broke when you
898d0bc965Smrg# start a VPATH build or use an absolute $srcdir.
908d0bc965Smrg#
918d0bc965Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
928d0bc965Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
938d0bc965Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
948d0bc965Smrg# and then we would define $MISSING as
958d0bc965Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
968d0bc965Smrg# This will work as long as MISSING is not called from configure, because
978d0bc965Smrg# unfortunately $(top_srcdir) has no meaning in configure.
988d0bc965Smrg# However there are other variables, like CC, which are often used in
998d0bc965Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1008d0bc965Smrg#
1018d0bc965Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1028d0bc965Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1038d0bc965Smrg# configured tree to be moved without reconfiguration.
1048d0bc965Smrg
1058d0bc965SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1068d0bc965Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1078d0bc965Smrg# Expand $ac_aux_dir to an absolute path.
1088d0bc965Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10967594505Smrg])
110b042e37fSmrg
1118d0bc965Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112b042e37fSmrg
1138d0bc965Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
1148d0bc965Smrg#
1158d0bc965Smrg# This file is free software; the Free Software Foundation
1168d0bc965Smrg# gives unlimited permission to copy and/or distribute it,
1178d0bc965Smrg# with or without modifications, as long as this notice is preserved.
118b042e37fSmrg
1198d0bc965Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1208d0bc965Smrg# -------------------------------------
1218d0bc965Smrg# Define a conditional.
1228d0bc965SmrgAC_DEFUN([AM_CONDITIONAL],
1238d0bc965Smrg[AC_PREREQ([2.52])dnl
1248d0bc965Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1258d0bc965Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1268d0bc965SmrgAC_SUBST([$1_TRUE])dnl
1278d0bc965SmrgAC_SUBST([$1_FALSE])dnl
1288d0bc965Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1298d0bc965Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1308d0bc965Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1318d0bc965Smrgif $2; then
1328d0bc965Smrg  $1_TRUE=
1338d0bc965Smrg  $1_FALSE='#'
1348d0bc965Smrgelse
1358d0bc965Smrg  $1_TRUE='#'
1368d0bc965Smrg  $1_FALSE=
1378d0bc965Smrgfi
1388d0bc965SmrgAC_CONFIG_COMMANDS_PRE(
1398d0bc965Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1408d0bc965Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1418d0bc965SmrgUsually this means the macro was only invoked conditionally.]])
1428d0bc965Smrgfi])])
143b042e37fSmrg
1448d0bc965Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
1458d0bc965Smrg#
1468d0bc965Smrg# This file is free software; the Free Software Foundation
1478d0bc965Smrg# gives unlimited permission to copy and/or distribute it,
1488d0bc965Smrg# with or without modifications, as long as this notice is preserved.
149b042e37fSmrg
150b042e37fSmrg
1518d0bc965Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1528d0bc965Smrg# written in clear, in which case automake, when reading aclocal.m4,
1538d0bc965Smrg# will think it sees a *use*, and therefore will trigger all it's
1548d0bc965Smrg# C support machinery.  Also note that it means that autoscan, seeing
1558d0bc965Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156b042e37fSmrg
157b042e37fSmrg
1588d0bc965Smrg# _AM_DEPENDENCIES(NAME)
1598d0bc965Smrg# ----------------------
1608d0bc965Smrg# See how the compiler implements dependency checking.
1618d0bc965Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1628d0bc965Smrg# We try a few techniques and use that to set a single cache variable.
1638d0bc965Smrg#
1648d0bc965Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1658d0bc965Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1668d0bc965Smrg# dependency, and given that the user is not expected to run this macro,
1678d0bc965Smrg# just rely on AC_PROG_CC.
1688d0bc965SmrgAC_DEFUN([_AM_DEPENDENCIES],
1698d0bc965Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1708d0bc965SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1718d0bc965SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1728d0bc965SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173b042e37fSmrg
1748d0bc965Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1758d0bc965Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1768d0bc965Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1778d0bc965Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1788d0bc965Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1798d0bc965Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1808d0bc965Smrg                    [depcc="$$1"   am_compiler_list=])
181b042e37fSmrg
1828d0bc965SmrgAC_CACHE_CHECK([dependency style of $depcc],
1838d0bc965Smrg               [am_cv_$1_dependencies_compiler_type],
1848d0bc965Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1858d0bc965Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
1868d0bc965Smrg  # making bogus files that we don't know about and never remove.  For
1878d0bc965Smrg  # instance it was reported that on HP-UX the gcc test will end up
1888d0bc965Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1898d0bc965Smrg  # in D".
1908d0bc965Smrg  rm -rf conftest.dir
1918d0bc965Smrg  mkdir conftest.dir
1928d0bc965Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1938d0bc965Smrg  # using a relative directory.
1948d0bc965Smrg  cp "$am_depcomp" conftest.dir
1958d0bc965Smrg  cd conftest.dir
1968d0bc965Smrg  # We will build objects and dependencies in a subdirectory because
1978d0bc965Smrg  # it helps to detect inapplicable dependency modes.  For instance
1988d0bc965Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1998d0bc965Smrg  # side effect of compilation, but ICC will put the dependencies in
2008d0bc965Smrg  # the current directory while Tru64 will put them in the object
2018d0bc965Smrg  # directory.
2028d0bc965Smrg  mkdir sub
203b042e37fSmrg
2048d0bc965Smrg  am_cv_$1_dependencies_compiler_type=none
2058d0bc965Smrg  if test "$am_compiler_list" = ""; then
2068d0bc965Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2078d0bc965Smrg  fi
2088d0bc965Smrg  am__universal=false
2098d0bc965Smrg  m4_case([$1], [CC],
2108d0bc965Smrg    [case " $depcc " in #(
2118d0bc965Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2128d0bc965Smrg     esac],
2138d0bc965Smrg    [CXX],
2148d0bc965Smrg    [case " $depcc " in #(
2158d0bc965Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2168d0bc965Smrg     esac])
217b042e37fSmrg
2188d0bc965Smrg  for depmode in $am_compiler_list; do
2198d0bc965Smrg    # Setup a source with many dependencies, because some compilers
2208d0bc965Smrg    # like to wrap large dependency lists on column 80 (with \), and
2218d0bc965Smrg    # we should not choose a depcomp mode which is confused by this.
2228d0bc965Smrg    #
2238d0bc965Smrg    # We need to recreate these files for each test, as the compiler may
2248d0bc965Smrg    # overwrite some of them when testing with obscure command lines.
2258d0bc965Smrg    # This happens at least with the AIX C compiler.
2268d0bc965Smrg    : > sub/conftest.c
2278d0bc965Smrg    for i in 1 2 3 4 5 6; do
2288d0bc965Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2298d0bc965Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2308d0bc965Smrg      # Solaris 10 /bin/sh.
2318d0bc965Smrg      echo '/* dummy */' > sub/conftst$i.h
2323169be4bSmrg    done
2338d0bc965Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2343169be4bSmrg
2358d0bc965Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2368d0bc965Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2378d0bc965Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2388d0bc965Smrg    # versions had trouble with output in subdirs.
2398d0bc965Smrg    am__obj=sub/conftest.${OBJEXT-o}
2408d0bc965Smrg    am__minus_obj="-o $am__obj"
2418d0bc965Smrg    case $depmode in
2428d0bc965Smrg    gcc)
2438d0bc965Smrg      # This depmode causes a compiler race in universal mode.
2448d0bc965Smrg      test "$am__universal" = false || continue
2458d0bc965Smrg      ;;
2468d0bc965Smrg    nosideeffect)
2478d0bc965Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2488d0bc965Smrg      # only be used when explicitly requested.
2498d0bc965Smrg      if test "x$enable_dependency_tracking" = xyes; then
2508d0bc965Smrg	continue
2518d0bc965Smrg      else
2528d0bc965Smrg	break
2538d0bc965Smrg      fi
2548d0bc965Smrg      ;;
2558d0bc965Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2568d0bc965Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2578d0bc965Smrg      # not run yet.  These depmodes are late enough in the game, and
2588d0bc965Smrg      # so weak that their functioning should not be impacted.
2598d0bc965Smrg      am__obj=conftest.${OBJEXT-o}
2608d0bc965Smrg      am__minus_obj=
2618d0bc965Smrg      ;;
2628d0bc965Smrg    none) break ;;
2638d0bc965Smrg    esac
2648d0bc965Smrg    if depmode=$depmode \
2658d0bc965Smrg       source=sub/conftest.c object=$am__obj \
2668d0bc965Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2678d0bc965Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2688d0bc965Smrg         >/dev/null 2>conftest.err &&
2698d0bc965Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2708d0bc965Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2718d0bc965Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2728d0bc965Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2738d0bc965Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2748d0bc965Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2758d0bc965Smrg      # that says an option was ignored or not supported.
2768d0bc965Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2778d0bc965Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2788d0bc965Smrg      # The diagnosis changed in icc 8.0:
2798d0bc965Smrg      #   icc: Command line remark: option '-MP' not supported
2808d0bc965Smrg      if (grep 'ignoring option' conftest.err ||
2818d0bc965Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2828d0bc965Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2838d0bc965Smrg        break
2848d0bc965Smrg      fi
2858d0bc965Smrg    fi
2868d0bc965Smrg  done
2873169be4bSmrg
2888d0bc965Smrg  cd ..
2898d0bc965Smrg  rm -rf conftest.dir
2908d0bc965Smrgelse
2918d0bc965Smrg  am_cv_$1_dependencies_compiler_type=none
2928d0bc965Smrgfi
2938d0bc965Smrg])
2948d0bc965SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2958d0bc965SmrgAM_CONDITIONAL([am__fastdep$1], [
2968d0bc965Smrg  test "x$enable_dependency_tracking" != xno \
2978d0bc965Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298706b6b52Smrg])
299b042e37fSmrg
300b042e37fSmrg
3018d0bc965Smrg# AM_SET_DEPDIR
3028d0bc965Smrg# -------------
3038d0bc965Smrg# Choose a directory name for dependency files.
3048d0bc965Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3058d0bc965SmrgAC_DEFUN([AM_SET_DEPDIR],
3068d0bc965Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3078d0bc965SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3088d0bc965Smrg])
309b042e37fSmrg
3108c4a8e55Smrg
3118d0bc965Smrg# AM_DEP_TRACK
3128d0bc965Smrg# ------------
3138d0bc965SmrgAC_DEFUN([AM_DEP_TRACK],
3148d0bc965Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3158d0bc965SmrgAS_HELP_STRING(
3168d0bc965Smrg  [--enable-dependency-tracking],
3178d0bc965Smrg  [do not reject slow dependency extractors])
3188d0bc965SmrgAS_HELP_STRING(
3198d0bc965Smrg  [--disable-dependency-tracking],
3208d0bc965Smrg  [speeds up one-time build])])
3218d0bc965Smrgif test "x$enable_dependency_tracking" != xno; then
3228d0bc965Smrg  am_depcomp="$ac_aux_dir/depcomp"
3238d0bc965Smrg  AMDEPBACKSLASH='\'
3248d0bc965Smrg  am__nodep='_no'
32567594505Smrgfi
3268d0bc965SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3278d0bc965SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3288d0bc965Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3298d0bc965SmrgAC_SUBST([am__nodep])dnl
3308d0bc965Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3318bd17e5fSmrg])
3328c4a8e55Smrg
3338d0bc965Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3348c4a8e55Smrg
3358d0bc965Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
3368d0bc965Smrg#
3378d0bc965Smrg# This file is free software; the Free Software Foundation
3388d0bc965Smrg# gives unlimited permission to copy and/or distribute it,
3398d0bc965Smrg# with or without modifications, as long as this notice is preserved.
340fc98c8e2Smrg
3418d0bc965Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3428d0bc965Smrg# ------------------------------
3438d0bc965SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3448d0bc965Smrg[{
3458d0bc965Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3468d0bc965Smrg  # are listed without --file.  Let's play safe and only enable the eval
3478d0bc965Smrg  # if we detect the quoting.
3488d0bc965Smrg  # TODO: see whether this extra hack can be removed once we start
3498d0bc965Smrg  # requiring Autoconf 2.70 or later.
3508d0bc965Smrg  AS_CASE([$CONFIG_FILES],
3518d0bc965Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
3528d0bc965Smrg          [*], [set x $CONFIG_FILES])
3538d0bc965Smrg  shift
3548d0bc965Smrg  # Used to flag and report bootstrapping failures.
3558d0bc965Smrg  am_rc=0
3568d0bc965Smrg  for am_mf
3578d0bc965Smrg  do
3588d0bc965Smrg    # Strip MF so we end up with the name of the file.
3598d0bc965Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
3608d0bc965Smrg    # Check whether this is an Automake generated Makefile which includes
3618d0bc965Smrg    # dependency-tracking related rules and includes.
3628d0bc965Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
3638d0bc965Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3648d0bc965Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
3658d0bc965Smrg      || continue
3668d0bc965Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
3678d0bc965Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
3688d0bc965Smrg    AM_RUN_LOG([cd "$am_dirpart" \
3698d0bc965Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
3708d0bc965Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
3718d0bc965Smrg  done
3728d0bc965Smrg  if test $am_rc -ne 0; then
3738d0bc965Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
3748d0bc965Smrg    for automatic dependency tracking.  If GNU make was not used, consider
3758d0bc965Smrg    re-running the configure script with MAKE="gmake" (or whatever is
3768d0bc965Smrg    necessary).  You can also try re-running configure with the
3778d0bc965Smrg    '--disable-dependency-tracking' option to at least be able to build
3788d0bc965Smrg    the package (albeit without support for automatic dependency tracking).])
3798bd17e5fSmrg  fi
3808d0bc965Smrg  AS_UNSET([am_dirpart])
3818d0bc965Smrg  AS_UNSET([am_filepart])
3828d0bc965Smrg  AS_UNSET([am_mf])
3838d0bc965Smrg  AS_UNSET([am_rc])
3848d0bc965Smrg  rm -f conftest-deps.mk
3858d0bc965Smrg}
3868d0bc965Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3878c4a8e55Smrg
3888c4a8e55Smrg
3898d0bc965Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3908d0bc965Smrg# -----------------------------
3918d0bc965Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
3928d0bc965Smrg#
3938d0bc965Smrg# This code is only required when automatic dependency tracking is enabled.
3948d0bc965Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
3958d0bc965Smrg# order to bootstrap the dependency handling code.
3968d0bc965SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3978d0bc965Smrg[AC_CONFIG_COMMANDS([depfiles],
3988d0bc965Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3998d0bc965Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
4008c4a8e55Smrg
4018d0bc965Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402fc98c8e2Smrg
4038d0bc965Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4048d0bc965Smrg#
4058d0bc965Smrg# This file is free software; the Free Software Foundation
4068d0bc965Smrg# gives unlimited permission to copy and/or distribute it,
4078d0bc965Smrg# with or without modifications, as long as this notice is preserved.
408fc98c8e2Smrg
4098d0bc965Smrg# This macro actually does too much.  Some checks are only needed if
4108d0bc965Smrg# your package does certain things.  But this isn't really a big deal.
411fc98c8e2Smrg
4128d0bc965Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4138d0bc965Smrgm4_define([AC_PROG_CC],
4148d0bc965Smrgm4_defn([AC_PROG_CC])
4158d0bc965Smrg[_AM_PROG_CC_C_O
4168d0bc965Smrg])
417fc98c8e2Smrg
4188d0bc965Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4198d0bc965Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4208d0bc965Smrg# -----------------------------------------------
4218d0bc965Smrg# The call with PACKAGE and VERSION arguments is the old style
4228d0bc965Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4238d0bc965Smrg# and VERSION should now be passed to AC_INIT and removed from
4248d0bc965Smrg# the call to AM_INIT_AUTOMAKE.
4258d0bc965Smrg# We support both call styles for the transition.  After
4268d0bc965Smrg# the next Automake release, Autoconf can make the AC_INIT
4278d0bc965Smrg# arguments mandatory, and then we can depend on a new Autoconf
4288d0bc965Smrg# release and drop the old call support.
4298d0bc965SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4308d0bc965Smrg[AC_PREREQ([2.65])dnl
4318d0bc965Smrgm4_ifdef([_$0_ALREADY_INIT],
4328d0bc965Smrg  [m4_fatal([$0 expanded multiple times
4338d0bc965Smrg]m4_defn([_$0_ALREADY_INIT]))],
4348d0bc965Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
4358d0bc965Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4368d0bc965Smrgdnl the ones we care about.
4378d0bc965Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4388d0bc965SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4398d0bc965SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4408d0bc965Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4418d0bc965Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4428d0bc965Smrg  # is not polluted with repeated "-I."
4438d0bc965Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4448d0bc965Smrg  # test to see if srcdir already configured
4458d0bc965Smrg  if test -f $srcdir/config.status; then
4468d0bc965Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4478d0bc965Smrg  fi
4488d0bc965Smrgfi
449b042e37fSmrg
4508d0bc965Smrg# test whether we have cygpath
4518d0bc965Smrgif test -z "$CYGPATH_W"; then
4528d0bc965Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4538d0bc965Smrg    CYGPATH_W='cygpath -w'
4548d0bc965Smrg  else
4558d0bc965Smrg    CYGPATH_W=echo
4568d0bc965Smrg  fi
4578d0bc965Smrgfi
4588d0bc965SmrgAC_SUBST([CYGPATH_W])
459b042e37fSmrg
4608d0bc965Smrg# Define the identity of the package.
4618d0bc965Smrgdnl Distinguish between old-style and new-style calls.
4628d0bc965Smrgm4_ifval([$2],
4638d0bc965Smrg[AC_DIAGNOSE([obsolete],
4648d0bc965Smrg             [$0: two- and three-arguments forms are deprecated.])
4658d0bc965Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4668d0bc965Smrg AC_SUBST([PACKAGE], [$1])dnl
4678d0bc965Smrg AC_SUBST([VERSION], [$2])],
4688d0bc965Smrg[_AM_SET_OPTIONS([$1])dnl
4698d0bc965Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4708d0bc965Smrgm4_if(
4718d0bc965Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4728d0bc965Smrg  [ok:ok],,
4738d0bc965Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4748d0bc965Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4758d0bc965Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476b042e37fSmrg
4778d0bc965Smrg_AM_IF_OPTION([no-define],,
4788d0bc965Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4798d0bc965Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480b042e37fSmrg
4818d0bc965Smrg# Some tools Automake needs.
4828d0bc965SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4838d0bc965SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4848d0bc965SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4858d0bc965SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4868d0bc965SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4878d0bc965SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4888d0bc965SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4898d0bc965SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4908d0bc965SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4918d0bc965SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4928d0bc965Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4938d0bc965Smrg# dies out for good.  For more background, see:
4948d0bc965Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4958d0bc965Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4968d0bc965SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
4978d0bc965Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
4988d0bc965Smrg# system "awk" is bad on some platforms.
4998d0bc965SmrgAC_REQUIRE([AC_PROG_AWK])dnl
5008d0bc965SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5018d0bc965SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5028d0bc965Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5038d0bc965Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5048d0bc965Smrg			     [_AM_PROG_TAR([v7])])])
5058d0bc965Smrg_AM_IF_OPTION([no-dependencies],,
5068d0bc965Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5078d0bc965Smrg		  [_AM_DEPENDENCIES([CC])],
5088d0bc965Smrg		  [m4_define([AC_PROG_CC],
5098d0bc965Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5108d0bc965SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5118d0bc965Smrg		  [_AM_DEPENDENCIES([CXX])],
5128d0bc965Smrg		  [m4_define([AC_PROG_CXX],
5138d0bc965Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5148d0bc965SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5158d0bc965Smrg		  [_AM_DEPENDENCIES([OBJC])],
5168d0bc965Smrg		  [m4_define([AC_PROG_OBJC],
5178d0bc965Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5188d0bc965SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5198d0bc965Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5208d0bc965Smrg		  [m4_define([AC_PROG_OBJCXX],
5218d0bc965Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52267594505Smrg])
5238d0bc965Smrg# Variables for tags utilities; see am/tags.am
5248d0bc965Smrgif test -z "$CTAGS"; then
5258d0bc965Smrg  CTAGS=ctags
5268d0bc965Smrgfi
5278d0bc965SmrgAC_SUBST([CTAGS])
5288d0bc965Smrgif test -z "$ETAGS"; then
5298d0bc965Smrg  ETAGS=etags
5308d0bc965Smrgfi
5318d0bc965SmrgAC_SUBST([ETAGS])
5328d0bc965Smrgif test -z "$CSCOPE"; then
5338d0bc965Smrg  CSCOPE=cscope
5348d0bc965Smrgfi
5358d0bc965SmrgAC_SUBST([CSCOPE])
536706b6b52Smrg
5378d0bc965SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5388d0bc965Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5398d0bc965Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5408d0bc965Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5418d0bc965SmrgAC_CONFIG_COMMANDS_PRE(dnl
5428d0bc965Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5438d0bc965Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544b042e37fSmrg
5458d0bc965Smrg# POSIX will say in a future version that running "rm -f" with no argument
5468d0bc965Smrg# is OK; and we want to be able to make that assumption in our Makefile
5478d0bc965Smrg# recipes.  So use an aggressive probe to check that the usage we want is
5488d0bc965Smrg# actually supported "in the wild" to an acceptable degree.
5498d0bc965Smrg# See automake bug#10828.
5508d0bc965Smrg# To make any issue more visible, cause the running configure to be aborted
5518d0bc965Smrg# by default if the 'rm' program in use doesn't match our expectations; the
5528d0bc965Smrg# user can still override this though.
5538d0bc965Smrgif rm -f && rm -fr && rm -rf; then : OK; else
5548d0bc965Smrg  cat >&2 <<'END'
5558d0bc965SmrgOops!
556b042e37fSmrg
5578d0bc965SmrgYour 'rm' program seems unable to run without file operands specified
5588d0bc965Smrgon the command line, even when the '-f' option is present.  This is contrary
5598d0bc965Smrgto the behaviour of most rm programs out there, and not conforming with
5608d0bc965Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561b042e37fSmrg
5628d0bc965SmrgPlease tell bug-automake@gnu.org about your system, including the value
5638d0bc965Smrgof your $PATH and any error possibly output before this message.  This
5648d0bc965Smrgcan help us improve future automake versions.
56567594505Smrg
5668d0bc965SmrgEND
5678d0bc965Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5688d0bc965Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5698d0bc965Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5708d0bc965Smrg    echo >&2
5718d0bc965Smrg  else
5728d0bc965Smrg    cat >&2 <<'END'
5738d0bc965SmrgAborting the configuration process, to ensure you take notice of the issue.
574b042e37fSmrg
5758d0bc965SmrgYou can download and install GNU coreutils to get an 'rm' implementation
5768d0bc965Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
57767594505Smrg
5788d0bc965SmrgIf you want to complete the configuration process using your problematic
5798d0bc965Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5808d0bc965Smrgto "yes", and re-run configure.
58167594505Smrg
5828d0bc965SmrgEND
5838d0bc965Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5848d0bc965Smrg  fi
5858d0bc965Smrgfi
5868d0bc965Smrgdnl The trailing newline in this macro's definition is deliberate, for
5878d0bc965Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5888d0bc965Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5890597fb56Smrg])
590b042e37fSmrg
5918d0bc965Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5928d0bc965Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5938d0bc965Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5948d0bc965Smrgm4_define([_AC_COMPILER_EXEEXT],
5958d0bc965Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596b042e37fSmrg
5978d0bc965Smrg# When config.status generates a header, we must update the stamp-h file.
5988d0bc965Smrg# This file resides in the same directory as the config header
5998d0bc965Smrg# that is generated.  The stamp files are numbered to have different names.
600b042e37fSmrg
6018d0bc965Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
6028d0bc965Smrg# loop where config.status creates the headers, so we can generate
6038d0bc965Smrg# our stamp files there.
6048d0bc965SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
6058d0bc965Smrg[# Compute $1's index in $config_headers.
6068d0bc965Smrg_am_arg=$1
6078d0bc965Smrg_am_stamp_count=1
6088d0bc965Smrgfor _am_header in $config_headers :; do
6098d0bc965Smrg  case $_am_header in
6108d0bc965Smrg    $_am_arg | $_am_arg:* )
6118d0bc965Smrg      break ;;
6128d0bc965Smrg    * )
6138d0bc965Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6148d0bc965Smrg  esac
6158d0bc965Smrgdone
6168d0bc965Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6178c4a8e55Smrg
6188d0bc965Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6198d0bc965Smrg#
6208d0bc965Smrg# This file is free software; the Free Software Foundation
6218d0bc965Smrg# gives unlimited permission to copy and/or distribute it,
6228d0bc965Smrg# with or without modifications, as long as this notice is preserved.
6238c4a8e55Smrg
6248d0bc965Smrg# AM_PROG_INSTALL_SH
6258d0bc965Smrg# ------------------
6268d0bc965Smrg# Define $install_sh.
6278d0bc965SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6288d0bc965Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6298d0bc965Smrgif test x"${install_sh+set}" != xset; then
6308d0bc965Smrg  case $am_aux_dir in
6318d0bc965Smrg  *\ * | *\	*)
6328d0bc965Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6338d0bc965Smrg  *)
6348d0bc965Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6358d0bc965Smrg  esac
6368d0bc965Smrgfi
6378d0bc965SmrgAC_SUBST([install_sh])])
638fc98c8e2Smrg
6398d0bc965Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
6408d0bc965Smrg#
6418d0bc965Smrg# This file is free software; the Free Software Foundation
6428d0bc965Smrg# gives unlimited permission to copy and/or distribute it,
6438d0bc965Smrg# with or without modifications, as long as this notice is preserved.
644fc98c8e2Smrg
6458d0bc965Smrg# Check whether the underlying file-system supports filenames
6468d0bc965Smrg# with a leading dot.  For instance MS-DOS doesn't.
6478d0bc965SmrgAC_DEFUN([AM_SET_LEADING_DOT],
6488d0bc965Smrg[rm -rf .tst 2>/dev/null
6498d0bc965Smrgmkdir .tst 2>/dev/null
6508d0bc965Smrgif test -d .tst; then
6518d0bc965Smrg  am__leading_dot=.
6528d0bc965Smrgelse
6538d0bc965Smrg  am__leading_dot=_
6548d0bc965Smrgfi
6558d0bc965Smrgrmdir .tst 2>/dev/null
6568d0bc965SmrgAC_SUBST([am__leading_dot])])
657fc98c8e2Smrg
6588d0bc965Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659fc98c8e2Smrg
6608d0bc965Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6618d0bc965Smrg#
6628d0bc965Smrg# This file is free software; the Free Software Foundation
6638d0bc965Smrg# gives unlimited permission to copy and/or distribute it,
6648d0bc965Smrg# with or without modifications, as long as this notice is preserved.
665fc98c8e2Smrg
6668d0bc965Smrg# AM_MAKE_INCLUDE()
6678d0bc965Smrg# -----------------
6688d0bc965Smrg# Check whether make has an 'include' directive that can support all
6698d0bc965Smrg# the idioms we need for our automatic dependency tracking code.
6708d0bc965SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6718d0bc965Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
6728d0bc965Smrgcat > confinc.mk << 'END'
6738d0bc965Smrgam__doit:
6748d0bc965Smrg	@echo this is the am__doit target >confinc.out
6758d0bc965Smrg.PHONY: am__doit
6768d0bc965SmrgEND
6778d0bc965Smrgam__include="#"
6788d0bc965Smrgam__quote=
6798d0bc965Smrg# BSD make does it like this.
6808d0bc965Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
6818d0bc965Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
6828d0bc965Smrgecho 'include confinc.mk # ignored' > confmf.GNU
6838d0bc965Smrg_am_result=no
6848d0bc965Smrgfor s in GNU BSD; do
6858d0bc965Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
6868d0bc965Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
6878d0bc965Smrg      ['0:this is the am__doit target'],
6888d0bc965Smrg      [AS_CASE([$s],
6898d0bc965Smrg          [BSD], [am__include='.include' am__quote='"'],
6908d0bc965Smrg          [am__include='include' am__quote=''])])
6918d0bc965Smrg  if test "$am__include" != "#"; then
6928d0bc965Smrg    _am_result="yes ($s style)"
6938d0bc965Smrg    break
6948d0bc965Smrg  fi
6958d0bc965Smrgdone
6968d0bc965Smrgrm -f confinc.* confmf.*
6978d0bc965SmrgAC_MSG_RESULT([${_am_result}])
6988d0bc965SmrgAC_SUBST([am__include])])
6998d0bc965SmrgAC_SUBST([am__quote])])
700b042e37fSmrg
7018d0bc965Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702b042e37fSmrg
7038d0bc965Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
7048d0bc965Smrg#
7058d0bc965Smrg# This file is free software; the Free Software Foundation
7068d0bc965Smrg# gives unlimited permission to copy and/or distribute it,
7078d0bc965Smrg# with or without modifications, as long as this notice is preserved.
7088c4a8e55Smrg
7098d0bc965Smrg# AM_MISSING_PROG(NAME, PROGRAM)
7108d0bc965Smrg# ------------------------------
7118d0bc965SmrgAC_DEFUN([AM_MISSING_PROG],
7128d0bc965Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7138d0bc965Smrg$1=${$1-"${am_missing_run}$2"}
7148d0bc965SmrgAC_SUBST($1)])
7158d0bc965Smrg
7168d0bc965Smrg# AM_MISSING_HAS_RUN
7178d0bc965Smrg# ------------------
7188d0bc965Smrg# Define MISSING if not defined so far and test if it is modern enough.
7198d0bc965Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7208d0bc965SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7218d0bc965Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7228d0bc965SmrgAC_REQUIRE_AUX_FILE([missing])dnl
7238d0bc965Smrgif test x"${MISSING+set}" != xset; then
7248d0bc965Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
7258d0bc965Smrgfi
7268d0bc965Smrg# Use eval to expand $SHELL
7278d0bc965Smrgif eval "$MISSING --is-lightweight"; then
7288d0bc965Smrg  am_missing_run="$MISSING "
7298d0bc965Smrgelse
7308d0bc965Smrg  am_missing_run=
7318d0bc965Smrg  AC_MSG_WARN(['missing' script is too old or missing])
7328d0bc965Smrgfi
7338d0bc965Smrg])
7348bd17e5fSmrg
7358d0bc965Smrg# Helper functions for option handling.                     -*- Autoconf -*-
736b042e37fSmrg
7378d0bc965Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
7388d0bc965Smrg#
7398d0bc965Smrg# This file is free software; the Free Software Foundation
7408d0bc965Smrg# gives unlimited permission to copy and/or distribute it,
7418d0bc965Smrg# with or without modifications, as long as this notice is preserved.
742b042e37fSmrg
7438d0bc965Smrg# _AM_MANGLE_OPTION(NAME)
7448d0bc965Smrg# -----------------------
7458d0bc965SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7468d0bc965Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
74767594505Smrg
7488d0bc965Smrg# _AM_SET_OPTION(NAME)
7498d0bc965Smrg# --------------------
7508d0bc965Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7518d0bc965SmrgAC_DEFUN([_AM_SET_OPTION],
7528d0bc965Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
75367594505Smrg
7548d0bc965Smrg# _AM_SET_OPTIONS(OPTIONS)
7558d0bc965Smrg# ------------------------
7568d0bc965Smrg# OPTIONS is a space-separated list of Automake options.
7578d0bc965SmrgAC_DEFUN([_AM_SET_OPTIONS],
7588d0bc965Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
75967594505Smrg
7608d0bc965Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7618d0bc965Smrg# -------------------------------------------
7628d0bc965Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7638d0bc965SmrgAC_DEFUN([_AM_IF_OPTION],
7648d0bc965Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
765b042e37fSmrg
7668d0bc965Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
7678d0bc965Smrg#
7688d0bc965Smrg# This file is free software; the Free Software Foundation
7698d0bc965Smrg# gives unlimited permission to copy and/or distribute it,
7708d0bc965Smrg# with or without modifications, as long as this notice is preserved.
771b042e37fSmrg
7728d0bc965Smrg# _AM_PROG_CC_C_O
7738d0bc965Smrg# ---------------
7748d0bc965Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7758d0bc965Smrg# to automatically call this.
7768d0bc965SmrgAC_DEFUN([_AM_PROG_CC_C_O],
7778d0bc965Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7788d0bc965SmrgAC_REQUIRE_AUX_FILE([compile])dnl
7798d0bc965SmrgAC_LANG_PUSH([C])dnl
7808d0bc965SmrgAC_CACHE_CHECK(
7818d0bc965Smrg  [whether $CC understands -c and -o together],
7828d0bc965Smrg  [am_cv_prog_cc_c_o],
7838d0bc965Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7848d0bc965Smrg  # Make sure it works both with $CC and with simple cc.
7858d0bc965Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7868d0bc965Smrg  # compilers refuse to overwrite an existing .o file with -o,
7878d0bc965Smrg  # though they will create one.
7888d0bc965Smrg  am_cv_prog_cc_c_o=yes
7898d0bc965Smrg  for am_i in 1 2; do
7908d0bc965Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7918d0bc965Smrg         && test -f conftest2.$ac_objext; then
7928d0bc965Smrg      : OK
7938d0bc965Smrg    else
7948d0bc965Smrg      am_cv_prog_cc_c_o=no
7958d0bc965Smrg      break
7968d0bc965Smrg    fi
7978d0bc965Smrg  done
7988d0bc965Smrg  rm -f core conftest*
7998d0bc965Smrg  unset am_i])
8008d0bc965Smrgif test "$am_cv_prog_cc_c_o" != yes; then
8018d0bc965Smrg   # Losing compiler, so override with the script.
8028d0bc965Smrg   # FIXME: It is wrong to rewrite CC.
8038d0bc965Smrg   # But if we don't then we get into trouble of one sort or another.
8048d0bc965Smrg   # A longer-term fix would be to have automake use am__CC in this case,
8058d0bc965Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8068d0bc965Smrg   CC="$am_aux_dir/compile $CC"
8078d0bc965Smrgfi
8088d0bc965SmrgAC_LANG_POP([C])])
809b042e37fSmrg
8108d0bc965Smrg# For backward compatibility.
8118d0bc965SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
812b042e37fSmrg
8138d0bc965Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
81467594505Smrg#
8158d0bc965Smrg# This file is free software; the Free Software Foundation
8168d0bc965Smrg# gives unlimited permission to copy and/or distribute it,
8178d0bc965Smrg# with or without modifications, as long as this notice is preserved.
818b042e37fSmrg
8198d0bc965Smrg# AM_RUN_LOG(COMMAND)
8208d0bc965Smrg# -------------------
8218d0bc965Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8228d0bc965Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8238d0bc965SmrgAC_DEFUN([AM_RUN_LOG],
8248d0bc965Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8258d0bc965Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8268d0bc965Smrg   ac_status=$?
8278d0bc965Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8288d0bc965Smrg   (exit $ac_status); }])
829b042e37fSmrg
8308d0bc965Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
831b042e37fSmrg
8328d0bc965Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
8338bd17e5fSmrg#
8348d0bc965Smrg# This file is free software; the Free Software Foundation
8358d0bc965Smrg# gives unlimited permission to copy and/or distribute it,
8368d0bc965Smrg# with or without modifications, as long as this notice is preserved.
8378bd17e5fSmrg
8388d0bc965Smrg# AM_SANITY_CHECK
8398d0bc965Smrg# ---------------
8408d0bc965SmrgAC_DEFUN([AM_SANITY_CHECK],
8418d0bc965Smrg[AC_MSG_CHECKING([whether build environment is sane])
8428d0bc965Smrg# Reject unsafe characters in $srcdir or the absolute working directory
8438d0bc965Smrg# name.  Accept space and tab only in the latter.
8448d0bc965Smrgam_lf='
8458d0bc965Smrg'
8468d0bc965Smrgcase `pwd` in
8478d0bc965Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8488d0bc965Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8498d0bc965Smrgesac
8508d0bc965Smrgcase $srcdir in
8518d0bc965Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8528d0bc965Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8538d0bc965Smrgesac
854b042e37fSmrg
8558d0bc965Smrg# Do 'set' in a subshell so we don't clobber the current shell's
8568d0bc965Smrg# arguments.  Must try -L first in case configure is actually a
8578d0bc965Smrg# symlink; some systems play weird games with the mod time of symlinks
8588d0bc965Smrg# (eg FreeBSD returns the mod time of the symlink's containing
8598d0bc965Smrg# directory).
8608d0bc965Smrgif (
8618d0bc965Smrg   am_has_slept=no
8628d0bc965Smrg   for am_try in 1 2; do
8638d0bc965Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8648d0bc965Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8658d0bc965Smrg     if test "$[*]" = "X"; then
8668d0bc965Smrg	# -L didn't work.
8678d0bc965Smrg	set X `ls -t "$srcdir/configure" conftest.file`
8688d0bc965Smrg     fi
8698d0bc965Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
8708d0bc965Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
871706b6b52Smrg
8728d0bc965Smrg	# If neither matched, then we have a broken ls.  This can happen
8738d0bc965Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
8748d0bc965Smrg	# broken ls alias from the environment.  This has actually
8758d0bc965Smrg	# happened.  Such a system could not be considered "sane".
8768d0bc965Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8778d0bc965Smrg  alias in your environment])
8788d0bc965Smrg     fi
8798d0bc965Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8808d0bc965Smrg       break
8818d0bc965Smrg     fi
8828d0bc965Smrg     # Just in case.
8838d0bc965Smrg     sleep 1
8848d0bc965Smrg     am_has_slept=yes
8858d0bc965Smrg   done
8868d0bc965Smrg   test "$[2]" = conftest.file
8878d0bc965Smrg   )
8888d0bc965Smrgthen
8898d0bc965Smrg   # Ok.
8908d0bc965Smrg   :
8918d0bc965Smrgelse
8928d0bc965Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
8938d0bc965SmrgCheck your system clock])
8948d0bc965Smrgfi
8958d0bc965SmrgAC_MSG_RESULT([yes])
8968d0bc965Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
8978d0bc965Smrg# generated files are strictly newer.
8988d0bc965Smrgam_sleep_pid=
8998d0bc965Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9008d0bc965Smrg  ( sleep 1 ) &
9018d0bc965Smrg  am_sleep_pid=$!
9028d0bc965Smrgfi
9038d0bc965SmrgAC_CONFIG_COMMANDS_PRE(
9048d0bc965Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9058d0bc965Smrg   if test -n "$am_sleep_pid"; then
9068d0bc965Smrg     # Hide warnings about reused PIDs.
9078d0bc965Smrg     wait $am_sleep_pid 2>/dev/null
9088d0bc965Smrg   fi
9098d0bc965Smrg   AC_MSG_RESULT([done])])
9108d0bc965Smrgrm -f conftest.file
9118d0bc965Smrg])
912706b6b52Smrg
9138d0bc965Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
9148d0bc965Smrg#
9158d0bc965Smrg# This file is free software; the Free Software Foundation
9168d0bc965Smrg# gives unlimited permission to copy and/or distribute it,
9178d0bc965Smrg# with or without modifications, as long as this notice is preserved.
918b042e37fSmrg
9198d0bc965Smrg# AM_SILENT_RULES([DEFAULT])
9208d0bc965Smrg# --------------------------
9218d0bc965Smrg# Enable less verbose build rules; with the default set to DEFAULT
9228d0bc965Smrg# ("yes" being less verbose, "no" or empty being verbose).
9238d0bc965SmrgAC_DEFUN([AM_SILENT_RULES],
9248d0bc965Smrg[AC_ARG_ENABLE([silent-rules], [dnl
9258d0bc965SmrgAS_HELP_STRING(
9268d0bc965Smrg  [--enable-silent-rules],
9278d0bc965Smrg  [less verbose build output (undo: "make V=1")])
9288d0bc965SmrgAS_HELP_STRING(
9298d0bc965Smrg  [--disable-silent-rules],
9308d0bc965Smrg  [verbose build output (undo: "make V=0")])dnl
9318d0bc965Smrg])
9328d0bc965Smrgcase $enable_silent_rules in @%:@ (((
9338d0bc965Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
9348d0bc965Smrg   no) AM_DEFAULT_VERBOSITY=1;;
9358d0bc965Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9368d0bc965Smrgesac
9378d0bc965Smrgdnl
9388d0bc965Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9398d0bc965Smrgdnl do not support nested variable expansions.
9408d0bc965Smrgdnl See automake bug#9928 and bug#10237.
9418d0bc965Smrgam_make=${MAKE-make}
9428d0bc965SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9438d0bc965Smrg   [am_cv_make_support_nested_variables],
9448d0bc965Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9458d0bc965SmrgBAR0=false
9468d0bc965SmrgBAR1=true
9478d0bc965SmrgV=1
9488d0bc965Smrgam__doit:
9498d0bc965Smrg	@$(TRUE)
9508d0bc965Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9518d0bc965Smrg  am_cv_make_support_nested_variables=yes
9528d0bc965Smrgelse
9538d0bc965Smrg  am_cv_make_support_nested_variables=no
9548d0bc965Smrgfi])
9558d0bc965Smrgif test $am_cv_make_support_nested_variables = yes; then
9568d0bc965Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9578d0bc965Smrg  AM_V='$(V)'
9588d0bc965Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9598d0bc965Smrgelse
9608d0bc965Smrg  AM_V=$AM_DEFAULT_VERBOSITY
9618d0bc965Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9628d0bc965Smrgfi
9638d0bc965SmrgAC_SUBST([AM_V])dnl
9648d0bc965SmrgAM_SUBST_NOTMAKE([AM_V])dnl
9658d0bc965SmrgAC_SUBST([AM_DEFAULT_V])dnl
9668d0bc965SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
9678d0bc965SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
9688d0bc965SmrgAM_BACKSLASH='\'
9698d0bc965SmrgAC_SUBST([AM_BACKSLASH])dnl
9708d0bc965Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
9718d0bc965Smrg])
972b042e37fSmrg
9738d0bc965Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
9748d0bc965Smrg#
9758d0bc965Smrg# This file is free software; the Free Software Foundation
9768d0bc965Smrg# gives unlimited permission to copy and/or distribute it,
9778d0bc965Smrg# with or without modifications, as long as this notice is preserved.
97867594505Smrg
9798d0bc965Smrg# AM_PROG_INSTALL_STRIP
9808d0bc965Smrg# ---------------------
9818d0bc965Smrg# One issue with vendor 'install' (even GNU) is that you can't
9828d0bc965Smrg# specify the program used to strip binaries.  This is especially
9838d0bc965Smrg# annoying in cross-compiling environments, where the build's strip
9848d0bc965Smrg# is unlikely to handle the host's binaries.
9858d0bc965Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9868d0bc965Smrg# always use install-sh in "make install-strip", and initialize
9878d0bc965Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
9888d0bc965SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9898d0bc965Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9908d0bc965Smrg# Installed binaries are usually stripped using 'strip' when the user
9918d0bc965Smrg# run "make install-strip".  However 'strip' might not be the right
9928d0bc965Smrg# tool to use in cross-compilation environments, therefore Automake
9938d0bc965Smrg# will honor the 'STRIP' environment variable to overrule this program.
9948d0bc965Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
9958d0bc965Smrgif test "$cross_compiling" != no; then
9968d0bc965Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
9978d0bc965Smrgfi
9988d0bc965SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9998d0bc965SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
100067594505Smrg
10018d0bc965Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
10028d0bc965Smrg#
10038d0bc965Smrg# This file is free software; the Free Software Foundation
10048d0bc965Smrg# gives unlimited permission to copy and/or distribute it,
10058d0bc965Smrg# with or without modifications, as long as this notice is preserved.
100667594505Smrg
10078d0bc965Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
10088d0bc965Smrg# ---------------------------
10098d0bc965Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10108d0bc965Smrg# This macro is traced by Automake.
10118d0bc965SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101267594505Smrg
10138d0bc965Smrg# AM_SUBST_NOTMAKE(VARIABLE)
10148d0bc965Smrg# --------------------------
10158d0bc965Smrg# Public sister of _AM_SUBST_NOTMAKE.
10168d0bc965SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
101767594505Smrg
10188d0bc965Smrg# Check how to create a tarball.                            -*- Autoconf -*-
101967594505Smrg
10208d0bc965Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
10218d0bc965Smrg#
10228d0bc965Smrg# This file is free software; the Free Software Foundation
10238d0bc965Smrg# gives unlimited permission to copy and/or distribute it,
10248d0bc965Smrg# with or without modifications, as long as this notice is preserved.
102567594505Smrg
10268d0bc965Smrg# _AM_PROG_TAR(FORMAT)
10278d0bc965Smrg# --------------------
10288d0bc965Smrg# Check how to create a tarball in format FORMAT.
10298d0bc965Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10308d0bc965Smrg#
10318d0bc965Smrg# Substitute a variable $(am__tar) that is a command
10328d0bc965Smrg# writing to stdout a FORMAT-tarball containing the directory
10338d0bc965Smrg# $tardir.
10348d0bc965Smrg#     tardir=directory && $(am__tar) > result.tar
10358d0bc965Smrg#
10368d0bc965Smrg# Substitute a variable $(am__untar) that extract such
10378d0bc965Smrg# a tarball read from stdin.
10388d0bc965Smrg#     $(am__untar) < result.tar
10398d0bc965Smrg#
10408d0bc965SmrgAC_DEFUN([_AM_PROG_TAR],
10418d0bc965Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10428d0bc965Smrg# in the wild :-(  We should find a proper way to deprecate it ...
10438d0bc965SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1044b042e37fSmrg
10458d0bc965Smrg# We'll loop over all known methods to create a tar archive until one works.
10468d0bc965Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047b042e37fSmrg
10488d0bc965Smrgm4_if([$1], [v7],
10498d0bc965Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050b042e37fSmrg
10518d0bc965Smrg  [m4_case([$1],
10528d0bc965Smrg    [ustar],
10538d0bc965Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10548d0bc965Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10558d0bc965Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10568d0bc965Smrg      # and bug#13588).
10578d0bc965Smrg      am_max_uid=2097151 # 2^21 - 1
10588d0bc965Smrg      am_max_gid=$am_max_uid
10598d0bc965Smrg      # The $UID and $GID variables are not portable, so we need to resort
10608d0bc965Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10618d0bc965Smrg      # below are definitely unexpected, so allow the users to see them
10628d0bc965Smrg      # (that is, avoid stderr redirection).
10638d0bc965Smrg      am_uid=`id -u || echo unknown`
10648d0bc965Smrg      am_gid=`id -g || echo unknown`
10658d0bc965Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10668d0bc965Smrg      if test $am_uid -le $am_max_uid; then
10678d0bc965Smrg         AC_MSG_RESULT([yes])
10688d0bc965Smrg      else
10698d0bc965Smrg         AC_MSG_RESULT([no])
10708d0bc965Smrg         _am_tools=none
10718d0bc965Smrg      fi
10728d0bc965Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10738d0bc965Smrg      if test $am_gid -le $am_max_gid; then
10748d0bc965Smrg         AC_MSG_RESULT([yes])
10758d0bc965Smrg      else
10768d0bc965Smrg        AC_MSG_RESULT([no])
10778d0bc965Smrg        _am_tools=none
10788d0bc965Smrg      fi],
1079b042e37fSmrg
10808d0bc965Smrg  [pax],
10818d0bc965Smrg    [],
1082b042e37fSmrg
10838d0bc965Smrg  [m4_fatal([Unknown tar format])])
1084b042e37fSmrg
10858d0bc965Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086b042e37fSmrg
10878d0bc965Smrg  # Go ahead even if we have the value already cached.  We do so because we
10888d0bc965Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
10898d0bc965Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
10908c4a8e55Smrg
10918d0bc965Smrg  for _am_tool in $_am_tools; do
10928d0bc965Smrg    case $_am_tool in
10938d0bc965Smrg    gnutar)
10948d0bc965Smrg      for _am_tar in tar gnutar gtar; do
10958d0bc965Smrg        AM_RUN_LOG([$_am_tar --version]) && break
10968d0bc965Smrg      done
10978d0bc965Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
10988d0bc965Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
10998d0bc965Smrg      am__untar="$_am_tar -xf -"
11008d0bc965Smrg      ;;
11018d0bc965Smrg    plaintar)
11028d0bc965Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11038d0bc965Smrg      # ustar tarball either.
11048d0bc965Smrg      (tar --version) >/dev/null 2>&1 && continue
11058d0bc965Smrg      am__tar='tar chf - "$$tardir"'
11068d0bc965Smrg      am__tar_='tar chf - "$tardir"'
11078d0bc965Smrg      am__untar='tar xf -'
11088d0bc965Smrg      ;;
11098d0bc965Smrg    pax)
11108d0bc965Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
11118d0bc965Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
11128d0bc965Smrg      am__untar='pax -r'
11138d0bc965Smrg      ;;
11148d0bc965Smrg    cpio)
11158d0bc965Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11168d0bc965Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11178d0bc965Smrg      am__untar='cpio -i -H $1 -d'
11188d0bc965Smrg      ;;
11198d0bc965Smrg    none)
11208d0bc965Smrg      am__tar=false
11218d0bc965Smrg      am__tar_=false
11228d0bc965Smrg      am__untar=false
11238d0bc965Smrg      ;;
11248d0bc965Smrg    esac
11258c4a8e55Smrg
11268d0bc965Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
11278d0bc965Smrg    # and am__untar set.
11288d0bc965Smrg    test -n "${am_cv_prog_tar_$1}" && break
1129b042e37fSmrg
11308d0bc965Smrg    # tar/untar a dummy directory, and stop if the command works.
11318d0bc965Smrg    rm -rf conftest.dir
11328d0bc965Smrg    mkdir conftest.dir
11338d0bc965Smrg    echo GrepMe > conftest.dir/file
11348d0bc965Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11358d0bc965Smrg    rm -rf conftest.dir
11368d0bc965Smrg    if test -s conftest.tar; then
11378d0bc965Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
11388d0bc965Smrg      AM_RUN_LOG([cat conftest.dir/file])
11398d0bc965Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11408d0bc965Smrg    fi
11418d0bc965Smrg  done
11428d0bc965Smrg  rm -rf conftest.dir
1143b042e37fSmrg
11448d0bc965Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11458d0bc965Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11468c4a8e55Smrg
11478d0bc965SmrgAC_SUBST([am__tar])
11488d0bc965SmrgAC_SUBST([am__untar])
11498d0bc965Smrg]) # _AM_PROG_TAR
11508c4a8e55Smrg
11518d0bc965Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
11528d0bc965Smrgdnl serial 11 (pkg-config-0.29)
11538d0bc965Smrgdnl
11548d0bc965Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11558d0bc965Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
11568d0bc965Smrgdnl
11578d0bc965Smrgdnl This program is free software; you can redistribute it and/or modify
11588d0bc965Smrgdnl it under the terms of the GNU General Public License as published by
11598d0bc965Smrgdnl the Free Software Foundation; either version 2 of the License, or
11608d0bc965Smrgdnl (at your option) any later version.
11618d0bc965Smrgdnl
11628d0bc965Smrgdnl This program is distributed in the hope that it will be useful, but
11638d0bc965Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
11648d0bc965Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11658d0bc965Smrgdnl General Public License for more details.
11668d0bc965Smrgdnl
11678d0bc965Smrgdnl You should have received a copy of the GNU General Public License
11688d0bc965Smrgdnl along with this program; if not, write to the Free Software
11698d0bc965Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
11708d0bc965Smrgdnl 02111-1307, USA.
11718d0bc965Smrgdnl
11728d0bc965Smrgdnl As a special exception to the GNU General Public License, if you
11738d0bc965Smrgdnl distribute this file as part of a program that contains a
11748d0bc965Smrgdnl configuration script generated by Autoconf, you may include it under
11758d0bc965Smrgdnl the same distribution terms that you use for the rest of that
11768d0bc965Smrgdnl program.
11778c4a8e55Smrg
11788d0bc965Smrgdnl PKG_PREREQ(MIN-VERSION)
11798d0bc965Smrgdnl -----------------------
11808d0bc965Smrgdnl Since: 0.29
11818d0bc965Smrgdnl
11828d0bc965Smrgdnl Verify that the version of the pkg-config macros are at least
11838d0bc965Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
11848d0bc965Smrgdnl installed version of pkg-config, this checks the developer's version
11858d0bc965Smrgdnl of pkg.m4 when generating configure.
11868d0bc965Smrgdnl
11878d0bc965Smrgdnl To ensure that this macro is defined, also add:
11888d0bc965Smrgdnl m4_ifndef([PKG_PREREQ],
11898d0bc965Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
11908d0bc965Smrgdnl
11918d0bc965Smrgdnl See the "Since" comment for each macro you use to see what version
11928d0bc965Smrgdnl of the macros you require.
11938d0bc965Smrgm4_defun([PKG_PREREQ],
11948d0bc965Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
11958d0bc965Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
11968d0bc965Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
11978d0bc965Smrg])dnl PKG_PREREQ
11988c4a8e55Smrg
11998d0bc965Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
12008d0bc965Smrgdnl ----------------------------------
12018d0bc965Smrgdnl Since: 0.16
12028d0bc965Smrgdnl
12038d0bc965Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
12048d0bc965Smrgdnl first found in the path. Checks that the version of pkg-config found
12058d0bc965Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
12068d0bc965Smrgdnl used since that's the first version where most current features of
12078d0bc965Smrgdnl pkg-config existed.
12088d0bc965SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
12098d0bc965Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
12108d0bc965Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
12118d0bc965Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
12128d0bc965SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
12138d0bc965SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
12148d0bc965SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
12153169be4bSmrg
12168d0bc965Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
12178d0bc965Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
12188d0bc965Smrgfi
12198d0bc965Smrgif test -n "$PKG_CONFIG"; then
12208d0bc965Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
12218d0bc965Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
12228d0bc965Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
12238d0bc965Smrg		AC_MSG_RESULT([yes])
12248d0bc965Smrg	else
12258d0bc965Smrg		AC_MSG_RESULT([no])
12268d0bc965Smrg		PKG_CONFIG=""
12278d0bc965Smrg	fi
12288d0bc965Smrgfi[]dnl
12298d0bc965Smrg])dnl PKG_PROG_PKG_CONFIG
1230b042e37fSmrg
12318d0bc965Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
12328d0bc965Smrgdnl -------------------------------------------------------------------
12338d0bc965Smrgdnl Since: 0.18
12348d0bc965Smrgdnl
12358d0bc965Smrgdnl Check to see whether a particular set of modules exists. Similar to
12368d0bc965Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
12378d0bc965Smrgdnl
12388d0bc965Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12398d0bc965Smrgdnl only at the first occurence in configure.ac, so if the first place
12408d0bc965Smrgdnl it's called might be skipped (such as if it is within an "if", you
12418d0bc965Smrgdnl have to call PKG_CHECK_EXISTS manually
12428d0bc965SmrgAC_DEFUN([PKG_CHECK_EXISTS],
12438d0bc965Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12448d0bc965Smrgif test -n "$PKG_CONFIG" && \
12458d0bc965Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12468d0bc965Smrg  m4_default([$2], [:])
12478d0bc965Smrgm4_ifvaln([$3], [else
12488d0bc965Smrg  $3])dnl
12498d0bc965Smrgfi])
12503169be4bSmrg
12518d0bc965Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12528d0bc965Smrgdnl ---------------------------------------------
12538d0bc965Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12548d0bc965Smrgdnl pkg_failed based on the result.
12558d0bc965Smrgm4_define([_PKG_CONFIG],
12568d0bc965Smrg[if test -n "$$1"; then
12578d0bc965Smrg    pkg_cv_[]$1="$$1"
12588d0bc965Smrg elif test -n "$PKG_CONFIG"; then
12598d0bc965Smrg    PKG_CHECK_EXISTS([$3],
12608d0bc965Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
12618d0bc965Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
12628d0bc965Smrg		     [pkg_failed=yes])
12638d0bc965Smrg else
12648d0bc965Smrg    pkg_failed=untried
12658d0bc965Smrgfi[]dnl
12668d0bc965Smrg])dnl _PKG_CONFIG
126767594505Smrg
12688d0bc965Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
12698d0bc965Smrgdnl ---------------------------
12708d0bc965Smrgdnl Internal check to see if pkg-config supports short errors.
12718d0bc965SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
12728d0bc965Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12738d0bc965Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
12748d0bc965Smrg        _pkg_short_errors_supported=yes
12758d0bc965Smrgelse
12768d0bc965Smrg        _pkg_short_errors_supported=no
12778d0bc965Smrgfi[]dnl
12788d0bc965Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
12793169be4bSmrg
12803169be4bSmrg
12818d0bc965Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12828d0bc965Smrgdnl   [ACTION-IF-NOT-FOUND])
12838d0bc965Smrgdnl --------------------------------------------------------------
12848d0bc965Smrgdnl Since: 0.4.0
12858d0bc965Smrgdnl
12868d0bc965Smrgdnl Note that if there is a possibility the first call to
12878d0bc965Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
12888d0bc965Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
12898d0bc965SmrgAC_DEFUN([PKG_CHECK_MODULES],
12908d0bc965Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12918d0bc965SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
12928d0bc965SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12933169be4bSmrg
12948d0bc965Smrgpkg_failed=no
12958d0bc965SmrgAC_MSG_CHECKING([for $1])
12963169be4bSmrg
12978d0bc965Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
12988d0bc965Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
12993169be4bSmrg
13008d0bc965Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
13018d0bc965Smrgand $1[]_LIBS to avoid the need to call pkg-config.
13028d0bc965SmrgSee the pkg-config man page for more details.])
130367594505Smrg
13048d0bc965Smrgif test $pkg_failed = yes; then
13058d0bc965Smrg   	AC_MSG_RESULT([no])
13068d0bc965Smrg        _PKG_SHORT_ERRORS_SUPPORTED
13078d0bc965Smrg        if test $_pkg_short_errors_supported = yes; then
13088d0bc965Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
13098d0bc965Smrg        else 
13108d0bc965Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
13118d0bc965Smrg        fi
13128d0bc965Smrg	# Put the nasty error message in config.log where it belongs
13138d0bc965Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1314b042e37fSmrg
13158d0bc965Smrg	m4_default([$4], [AC_MSG_ERROR(
13168d0bc965Smrg[Package requirements ($2) were not met:
1317b042e37fSmrg
13188d0bc965Smrg$$1_PKG_ERRORS
1319b042e37fSmrg
13208d0bc965SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
13218d0bc965Smrginstalled software in a non-standard prefix.
1322706b6b52Smrg
13238d0bc965Smrg_PKG_TEXT])[]dnl
13248d0bc965Smrg        ])
13258d0bc965Smrgelif test $pkg_failed = untried; then
13268d0bc965Smrg     	AC_MSG_RESULT([no])
13278d0bc965Smrg	m4_default([$4], [AC_MSG_FAILURE(
13288d0bc965Smrg[The pkg-config script could not be found or is too old.  Make sure it
13298d0bc965Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
13308d0bc965Smrgpath to pkg-config.
1331706b6b52Smrg
13328d0bc965Smrg_PKG_TEXT
1333706b6b52Smrg
13348d0bc965SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
13358d0bc965Smrg        ])
13368d0bc965Smrgelse
13378d0bc965Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
13388d0bc965Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
13398d0bc965Smrg        AC_MSG_RESULT([yes])
13408d0bc965Smrg	$3
13418d0bc965Smrgfi[]dnl
13428d0bc965Smrg])dnl PKG_CHECK_MODULES
1343706b6b52Smrg
1344706b6b52Smrg
13458d0bc965Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
13468d0bc965Smrgdnl   [ACTION-IF-NOT-FOUND])
13478d0bc965Smrgdnl ---------------------------------------------------------------------
13488d0bc965Smrgdnl Since: 0.29
13498d0bc965Smrgdnl
13508d0bc965Smrgdnl Checks for existence of MODULES and gathers its build flags with
13518d0bc965Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
13528d0bc965Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
13538d0bc965Smrgdnl
13548d0bc965Smrgdnl Note that if there is a possibility the first call to
13558d0bc965Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
13568d0bc965Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
13578d0bc965Smrgdnl configure.ac.
13588d0bc965SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
13598d0bc965Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
13608d0bc965Smrg_save_PKG_CONFIG=$PKG_CONFIG
13618d0bc965SmrgPKG_CONFIG="$PKG_CONFIG --static"
13628d0bc965SmrgPKG_CHECK_MODULES($@)
13638d0bc965SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
13648d0bc965Smrg])dnl PKG_CHECK_MODULES_STATIC
1365bd23fbfaSmrg
1366bd23fbfaSmrg
13678d0bc965Smrgdnl PKG_INSTALLDIR([DIRECTORY])
13688d0bc965Smrgdnl -------------------------
13698d0bc965Smrgdnl Since: 0.27
13708d0bc965Smrgdnl
13718d0bc965Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
13728d0bc965Smrgdnl should install pkg-config .pc files. By default the directory is
13738d0bc965Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
13748d0bc965Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
13758d0bc965Smrgdnl parameter.
13768d0bc965SmrgAC_DEFUN([PKG_INSTALLDIR],
13778d0bc965Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
13788d0bc965Smrgm4_pushdef([pkg_description],
13798d0bc965Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
13808d0bc965SmrgAC_ARG_WITH([pkgconfigdir],
13818d0bc965Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
13828d0bc965Smrg    [with_pkgconfigdir=]pkg_default)
13838d0bc965SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
13848d0bc965Smrgm4_popdef([pkg_default])
13858d0bc965Smrgm4_popdef([pkg_description])
13868d0bc965Smrg])dnl PKG_INSTALLDIR
1387bd23fbfaSmrg
13880597fb56Smrg
13898d0bc965Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
13908d0bc965Smrgdnl --------------------------------
13918d0bc965Smrgdnl Since: 0.27
13928d0bc965Smrgdnl
13938d0bc965Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
13948d0bc965Smrgdnl module should install arch-independent pkg-config .pc files. By
13958d0bc965Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
13968d0bc965Smrgdnl changed by passing DIRECTORY. The user can override through the
13978d0bc965Smrgdnl --with-noarch-pkgconfigdir parameter.
13988d0bc965SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
13998d0bc965Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
14008d0bc965Smrgm4_pushdef([pkg_description],
14018d0bc965Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
14028d0bc965SmrgAC_ARG_WITH([noarch-pkgconfigdir],
14038d0bc965Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
14048d0bc965Smrg    [with_noarch_pkgconfigdir=]pkg_default)
14058d0bc965SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
14068d0bc965Smrgm4_popdef([pkg_default])
14078d0bc965Smrgm4_popdef([pkg_description])
14088d0bc965Smrg])dnl PKG_NOARCH_INSTALLDIR
1409bd23fbfaSmrg
1410706b6b52Smrg
14118d0bc965Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
14128d0bc965Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
14138d0bc965Smrgdnl -------------------------------------------
14148d0bc965Smrgdnl Since: 0.28
14158d0bc965Smrgdnl
14168d0bc965Smrgdnl Retrieves the value of the pkg-config variable for the given module.
14178d0bc965SmrgAC_DEFUN([PKG_CHECK_VAR],
14188d0bc965Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14198d0bc965SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420706b6b52Smrg
14218d0bc965Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
14228d0bc965SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423706b6b52Smrg
14248d0bc965SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
14258d0bc965Smrg])dnl PKG_CHECK_VAR
1426b042e37fSmrg
14278d0bc965Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
14288d0bc965Smrgdnl
14290c674dbdSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
14308d0bc965Smrgdnl
14318d0bc965Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14328d0bc965Smrgdnl copy of this software and associated documentation files (the "Software"),
14338d0bc965Smrgdnl to deal in the Software without restriction, including without limitation
14348d0bc965Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14358d0bc965Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
14368d0bc965Smrgdnl Software is furnished to do so, subject to the following conditions:
14378d0bc965Smrgdnl
14388d0bc965Smrgdnl The above copyright notice and this permission notice (including the next
14398d0bc965Smrgdnl paragraph) shall be included in all copies or substantial portions of the
14408d0bc965Smrgdnl Software.
14418d0bc965Smrgdnl
14428d0bc965Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14438d0bc965Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14448d0bc965Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14458d0bc965Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14468d0bc965Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14478d0bc965Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14488d0bc965Smrgdnl DEALINGS IN THE SOFTWARE.
1449b042e37fSmrg
14508d0bc965Smrg# XORG_MACROS_VERSION(required-version)
14518d0bc965Smrg# -------------------------------------
14528d0bc965Smrg# Minimum version: 1.1.0
14538d0bc965Smrg#
14548d0bc965Smrg# If you're using a macro added in Version 1.1 or newer, include this in
14558d0bc965Smrg# your configure.ac with the minimum required version, such as:
14568d0bc965Smrg# XORG_MACROS_VERSION(1.1)
14578d0bc965Smrg#
14588d0bc965Smrg# To ensure that this macro is defined, also add:
14598d0bc965Smrg# m4_ifndef([XORG_MACROS_VERSION],
14608d0bc965Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
14618d0bc965Smrg#
14628d0bc965Smrg#
14638d0bc965Smrg# See the "minimum version" comment for each macro you use to see what
14648d0bc965Smrg# version you require.
14658d0bc965Smrgm4_defun([XORG_MACROS_VERSION],[
14660c674dbdSmrgm4_define([vers_have], [1.20.0])
14678d0bc965Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14688d0bc965Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14698d0bc965Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14708d0bc965Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
14718d0bc965Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
14728d0bc965Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
14738d0bc965Smrgm4_undefine([vers_have])
14748d0bc965Smrgm4_undefine([maj_have])
14758d0bc965Smrgm4_undefine([maj_needed])
14768d0bc965Smrg]) # XORG_MACROS_VERSION
1477b042e37fSmrg
14788d0bc965Smrg# XORG_PROG_RAWCPP()
14798d0bc965Smrg# ------------------
14808d0bc965Smrg# Minimum version: 1.0.0
14818d0bc965Smrg#
14828d0bc965Smrg# Find cpp program and necessary flags for use in pre-processing text files
14838d0bc965Smrg# such as man pages and config files
14848d0bc965SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14858d0bc965SmrgAC_REQUIRE([AC_PROG_CPP])
14868d0bc965SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
14878d0bc965Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1488706b6b52Smrg
14898d0bc965Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14908d0bc965Smrg# which is not the best choice for supporting other OS'es, but covers most
14918d0bc965Smrg# of the ones we need for now.
14928d0bc965SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14938d0bc965SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14948d0bc965Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14958d0bc965Smrg	AC_MSG_RESULT([no])
14968d0bc965Smrgelse
14978d0bc965Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14988d0bc965Smrg		RAWCPPFLAGS=-undef
14998d0bc965Smrg		AC_MSG_RESULT([yes])
15008d0bc965Smrg	# under Cygwin unix is still defined even with -undef
15018d0bc965Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15028d0bc965Smrg		RAWCPPFLAGS="-undef -ansi"
15038d0bc965Smrg		AC_MSG_RESULT([yes, with -ansi])
15048d0bc965Smrg	else
15058d0bc965Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
15068d0bc965Smrg	fi
15078d0bc965Smrgfi
15088d0bc965Smrgrm -f conftest.$ac_ext
1509bd23fbfaSmrg
15108d0bc965SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
15118d0bc965SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
15128d0bc965Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15138d0bc965Smrg	AC_MSG_RESULT([no])
15148d0bc965Smrgelse
15158d0bc965Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
15168d0bc965Smrg		TRADITIONALCPPFLAGS="-traditional"
15178d0bc965Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
15188d0bc965Smrg		AC_MSG_RESULT([yes])
15198d0bc965Smrg	else
15208d0bc965Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15218d0bc965Smrg	fi
15228d0bc965Smrgfi
15238d0bc965Smrgrm -f conftest.$ac_ext
15248d0bc965SmrgAC_SUBST(RAWCPPFLAGS)
15258d0bc965SmrgAC_SUBST(TRADITIONALCPPFLAGS)
15268d0bc965Smrg]) # XORG_PROG_RAWCPP
1527b042e37fSmrg
15288d0bc965Smrg# XORG_MANPAGE_SECTIONS()
15298d0bc965Smrg# -----------------------
15308d0bc965Smrg# Minimum version: 1.0.0
15318d0bc965Smrg#
15328d0bc965Smrg# Determine which sections man pages go in for the different man page types
15338d0bc965Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
15348d0bc965Smrg# Not sure if there's any better way than just hardcoding by OS name.
15358d0bc965Smrg# Override default settings by setting environment variables
15368d0bc965Smrg# Added MAN_SUBSTS in version 1.8
15378d0bc965Smrg# Added AC_PROG_SED in version 1.8
1538706b6b52Smrg
15398d0bc965SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
15408d0bc965SmrgAC_REQUIRE([AC_CANONICAL_HOST])
15418d0bc965SmrgAC_REQUIRE([AC_PROG_SED])
1542b042e37fSmrg
15438d0bc965Smrgcase $host_os in
15448d0bc965Smrg    solaris*)
15458d0bc965Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
15468d0bc965Smrg        # check for a man page file found in later versions that use
15478d0bc965Smrg        # traditional section numbers instead
15488d0bc965Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
15498d0bc965Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
15508d0bc965Smrg        ;;
15518d0bc965Smrg    *) SYSV_MAN_SECTIONS=false ;;
15528d0bc965Smrgesac
1553706b6b52Smrg
15548d0bc965Smrgif test x$APP_MAN_SUFFIX = x    ; then
15558d0bc965Smrg    APP_MAN_SUFFIX=1
15568d0bc965Smrgfi
15578d0bc965Smrgif test x$APP_MAN_DIR = x    ; then
15588d0bc965Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
15598d0bc965Smrgfi
1560706b6b52Smrg
15618d0bc965Smrgif test x$LIB_MAN_SUFFIX = x    ; then
15628d0bc965Smrg    LIB_MAN_SUFFIX=3
15638d0bc965Smrgfi
15648d0bc965Smrgif test x$LIB_MAN_DIR = x    ; then
15658d0bc965Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15668d0bc965Smrgfi
1567b042e37fSmrg
15688d0bc965Smrgif test x$FILE_MAN_SUFFIX = x    ; then
15698d0bc965Smrg    case $SYSV_MAN_SECTIONS in
15708d0bc965Smrg	true)				FILE_MAN_SUFFIX=4  ;;
15718d0bc965Smrg	*)				FILE_MAN_SUFFIX=5  ;;
15728d0bc965Smrg    esac
15738d0bc965Smrgfi
15748d0bc965Smrgif test x$FILE_MAN_DIR = x    ; then
15758d0bc965Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
15768d0bc965Smrgfi
1577bd23fbfaSmrg
15788d0bc965Smrgif test x$MISC_MAN_SUFFIX = x    ; then
15798d0bc965Smrg    case $SYSV_MAN_SECTIONS in
15808d0bc965Smrg	true)				MISC_MAN_SUFFIX=5  ;;
15818d0bc965Smrg	*)				MISC_MAN_SUFFIX=7  ;;
15828d0bc965Smrg    esac
15838d0bc965Smrgfi
15848d0bc965Smrgif test x$MISC_MAN_DIR = x    ; then
15858d0bc965Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
15868d0bc965Smrgfi
1587bd23fbfaSmrg
15888d0bc965Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
15898d0bc965Smrg    case $SYSV_MAN_SECTIONS in
15908d0bc965Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
15918d0bc965Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
15928d0bc965Smrg    esac
15938d0bc965Smrgfi
15948d0bc965Smrgif test x$DRIVER_MAN_DIR = x    ; then
15958d0bc965Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15968d0bc965Smrgfi
1597bd23fbfaSmrg
15988d0bc965Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15998d0bc965Smrg    case $SYSV_MAN_SECTIONS in
16008d0bc965Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
16018d0bc965Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
16028d0bc965Smrg    esac
16038d0bc965Smrgfi
16048d0bc965Smrgif test x$ADMIN_MAN_DIR = x    ; then
16058d0bc965Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16068d0bc965Smrgfi
1607bd23fbfaSmrg
1608bd23fbfaSmrg
16098d0bc965SmrgAC_SUBST([APP_MAN_SUFFIX])
16108d0bc965SmrgAC_SUBST([LIB_MAN_SUFFIX])
16118d0bc965SmrgAC_SUBST([FILE_MAN_SUFFIX])
16128d0bc965SmrgAC_SUBST([MISC_MAN_SUFFIX])
16138d0bc965SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
16148d0bc965SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
16158d0bc965SmrgAC_SUBST([APP_MAN_DIR])
16168d0bc965SmrgAC_SUBST([LIB_MAN_DIR])
16178d0bc965SmrgAC_SUBST([FILE_MAN_DIR])
16188d0bc965SmrgAC_SUBST([MISC_MAN_DIR])
16198d0bc965SmrgAC_SUBST([DRIVER_MAN_DIR])
16208d0bc965SmrgAC_SUBST([ADMIN_MAN_DIR])
1621bd23fbfaSmrg
16228d0bc965SmrgXORG_MAN_PAGE="X Version 11"
16238d0bc965SmrgAC_SUBST([XORG_MAN_PAGE])
16248d0bc965SmrgMAN_SUBSTS="\
16258d0bc965Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16268d0bc965Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16278d0bc965Smrg	-e 's|__xservername__|Xorg|g' \
16288d0bc965Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
16298d0bc965Smrg	-e 's|__projectroot__|\$(prefix)|g' \
16308d0bc965Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
16318d0bc965Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
16328d0bc965Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
16338d0bc965Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
16348d0bc965Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
16358d0bc965Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
16368d0bc965Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
16378d0bc965SmrgAC_SUBST([MAN_SUBSTS])
1638bd23fbfaSmrg
16398d0bc965Smrg]) # XORG_MANPAGE_SECTIONS
16400597fb56Smrg
16418d0bc965Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
16428d0bc965Smrg# ------------------------
16438d0bc965Smrg# Minimum version: 1.7.0
16448d0bc965Smrg#
16458d0bc965Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
16468d0bc965Smrg# provided by xorg-sgml-doctools, if installed.
16478d0bc965SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
16488d0bc965SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
16498d0bc965SmrgXORG_SGML_PATH=
16508d0bc965SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
16518d0bc965Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
16528d0bc965Smrg    [m4_ifval([$1],[:],
16538d0bc965Smrg        [if test x"$cross_compiling" != x"yes" ; then
16548d0bc965Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
16558d0bc965Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
16568d0bc965Smrg         fi])
165767594505Smrg    ])
16580597fb56Smrg
16598d0bc965Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
16608d0bc965Smrg# the path and the name of the doc stylesheet
16618d0bc965Smrgif test "x$XORG_SGML_PATH" != "x" ; then
16628d0bc965Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
16638d0bc965Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
16648d0bc965Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
16658d0bc965Smrgelse
16668d0bc965Smrg   AC_MSG_RESULT([no])
16678d0bc965Smrgfi
16680597fb56Smrg
16698d0bc965SmrgAC_SUBST(XORG_SGML_PATH)
16708d0bc965SmrgAC_SUBST(STYLESHEET_SRCDIR)
16718d0bc965SmrgAC_SUBST(XSL_STYLESHEET)
16728d0bc965SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
16738d0bc965Smrg]) # XORG_CHECK_SGML_DOCTOOLS
16740597fb56Smrg
16758d0bc965Smrg# XORG_CHECK_LINUXDOC
16768d0bc965Smrg# -------------------
16778d0bc965Smrg# Minimum version: 1.0.0
16788d0bc965Smrg#
16798d0bc965Smrg# Defines the variable MAKE_TEXT if the necessary tools and
16808d0bc965Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
16818d0bc965Smrg# Whether or not the necessary tools and files are found can be checked
16828d0bc965Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
16838d0bc965SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
16848d0bc965SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16858d0bc965SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
16860597fb56Smrg
16878d0bc965SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1688bd23fbfaSmrg
16898d0bc965SmrgAC_MSG_CHECKING([whether to build documentation])
1690b042e37fSmrg
16918d0bc965Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
16928d0bc965Smrg   BUILDDOC=yes
16938d0bc965Smrgelse
16948d0bc965Smrg   BUILDDOC=no
16958d0bc965Smrgfi
1696b042e37fSmrg
16978d0bc965SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1698b042e37fSmrg
16998d0bc965SmrgAC_MSG_RESULT([$BUILDDOC])
1700b042e37fSmrg
17018d0bc965SmrgAC_MSG_CHECKING([whether to build pdf documentation])
17028d0bc965Smrg
17038d0bc965Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
17048d0bc965Smrg   BUILDPDFDOC=yes
170567594505Smrgelse
17068d0bc965Smrg   BUILDPDFDOC=no
170767594505Smrgfi
1708b042e37fSmrg
17098d0bc965SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1710b042e37fSmrg
17118d0bc965SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17120597fb56Smrg
17138d0bc965SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
17148d0bc965SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
17158d0bc965SmrgMAKE_PDF="$PS2PDF"
17168d0bc965SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1717b042e37fSmrg
17188d0bc965SmrgAC_SUBST(MAKE_TEXT)
17198d0bc965SmrgAC_SUBST(MAKE_PS)
17208d0bc965SmrgAC_SUBST(MAKE_PDF)
17218d0bc965SmrgAC_SUBST(MAKE_HTML)
17228d0bc965Smrg]) # XORG_CHECK_LINUXDOC
1723b042e37fSmrg
17248d0bc965Smrg# XORG_CHECK_DOCBOOK
17258d0bc965Smrg# -------------------
17268d0bc965Smrg# Minimum version: 1.0.0
17278d0bc965Smrg#
17288d0bc965Smrg# Checks for the ability to build output formats from SGML DocBook source.
17298d0bc965Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
17308d0bc965Smrg# indicates whether the necessary tools and files are found and, if set,
17318d0bc965Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
17328d0bc965SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
17338d0bc965SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1734b042e37fSmrg
17358d0bc965SmrgBUILDTXTDOC=no
17368d0bc965SmrgBUILDPDFDOC=no
17378d0bc965SmrgBUILDPSDOC=no
17388d0bc965SmrgBUILDHTMLDOC=no
1739b042e37fSmrg
17408d0bc965SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
17418d0bc965SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
17428d0bc965SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
17438d0bc965SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
17448bd17e5fSmrg
17458d0bc965SmrgAC_MSG_CHECKING([whether to build text documentation])
17468d0bc965Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
17478d0bc965Smrg   test x$BUILD_TXTDOC != xno; then
17488d0bc965Smrg	BUILDTXTDOC=yes
17498d0bc965Smrgfi
17508d0bc965SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
17518d0bc965SmrgAC_MSG_RESULT([$BUILDTXTDOC])
17528bd17e5fSmrg
17538d0bc965SmrgAC_MSG_CHECKING([whether to build PDF documentation])
17548d0bc965Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
17558d0bc965Smrg   test x$BUILD_PDFDOC != xno; then
17568d0bc965Smrg	BUILDPDFDOC=yes
17578d0bc965Smrgfi
17588d0bc965SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17598d0bc965SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17608bd17e5fSmrg
17618d0bc965SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
17628d0bc965Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17638d0bc965Smrg   test x$BUILD_PSDOC != xno; then
17648d0bc965Smrg	BUILDPSDOC=yes
17658d0bc965Smrgfi
17668d0bc965SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
17678d0bc965SmrgAC_MSG_RESULT([$BUILDPSDOC])
17688c4a8e55Smrg
17698d0bc965SmrgAC_MSG_CHECKING([whether to build HTML documentation])
17708d0bc965Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
17718d0bc965Smrg   test x$BUILD_HTMLDOC != xno; then
17728d0bc965Smrg	BUILDHTMLDOC=yes
17738d0bc965Smrgfi
17748d0bc965SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
17758d0bc965SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1776b042e37fSmrg
17778d0bc965SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
17788d0bc965SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
17798d0bc965SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
17808d0bc965SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
17818c4a8e55Smrg
17828d0bc965SmrgAC_SUBST(MAKE_TEXT)
17838d0bc965SmrgAC_SUBST(MAKE_PS)
17848d0bc965SmrgAC_SUBST(MAKE_PDF)
17858d0bc965SmrgAC_SUBST(MAKE_HTML)
17868d0bc965Smrg]) # XORG_CHECK_DOCBOOK
17878c4a8e55Smrg
17888d0bc965Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
17898d0bc965Smrg# ----------------
17908d0bc965Smrg# Minimum version: 1.5.0
17918d0bc965Smrg# Minimum version for optional DEFAULT argument: 1.11.0
17928d0bc965Smrg#
17938d0bc965Smrg# Documentation tools are not always available on all platforms and sometimes
17948d0bc965Smrg# not at the appropriate level. This macro enables a module to test for the
17958d0bc965Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
17960c674dbdSmrg# the --with-xmlto option, it allows maximum flexibility in making decisions
17978d0bc965Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17988d0bc965Smrg# --with-xmlto assumes 'auto'.
17998d0bc965Smrg#
18008d0bc965Smrg# Interface to module:
18018d0bc965Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
18028d0bc965Smrg# XMLTO:	returns the path of the xmlto program found
18038d0bc965Smrg#		returns the path set by the user in the environment
18048d0bc965Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
18058d0bc965Smrg#		'no' user instructs the module not to use xmlto
18068d0bc965Smrg#
18078d0bc965Smrg# Added in version 1.10.0
18088d0bc965Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
18098d0bc965Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
18108d0bc965Smrg#
18118d0bc965Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
18128d0bc965Smrg#
18138d0bc965SmrgAC_DEFUN([XORG_WITH_XMLTO],[
18148d0bc965SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
18158d0bc965Smrgm4_define([_defopt], m4_default([$2], [auto]))
18168d0bc965SmrgAC_ARG_WITH(xmlto,
18178d0bc965Smrg	AS_HELP_STRING([--with-xmlto],
18188d0bc965Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
18198d0bc965Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
18208d0bc965Smrgm4_undefine([_defopt])
1821b042e37fSmrg
18228d0bc965Smrgif test "x$use_xmlto" = x"auto"; then
18238d0bc965Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18248d0bc965Smrg   if test "x$XMLTO" = "x"; then
18258d0bc965Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
18268d0bc965Smrg	have_xmlto=no
18278d0bc965Smrg   else
18288d0bc965Smrg        have_xmlto=yes
18298d0bc965Smrg   fi
18308d0bc965Smrgelif test "x$use_xmlto" = x"yes" ; then
18318d0bc965Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18328d0bc965Smrg   if test "x$XMLTO" = "x"; then
18338d0bc965Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
18348d0bc965Smrg   fi
18358d0bc965Smrg   have_xmlto=yes
18368d0bc965Smrgelif test "x$use_xmlto" = x"no" ; then
18378d0bc965Smrg   if test "x$XMLTO" != "x"; then
18388d0bc965Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
18398d0bc965Smrg   fi
18408d0bc965Smrg   have_xmlto=no
18418bd17e5fSmrgelse
18428d0bc965Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
18438bd17e5fSmrgfi
1844b042e37fSmrg
18458d0bc965Smrg# Test for a minimum version of xmlto, if provided.
18468d0bc965Smrgm4_ifval([$1],
18478d0bc965Smrg[if test "$have_xmlto" = yes; then
18488d0bc965Smrg    # scrape the xmlto version
18498d0bc965Smrg    AC_MSG_CHECKING([the xmlto version])
18508d0bc965Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
18518d0bc965Smrg    AC_MSG_RESULT([$xmlto_version])
18528d0bc965Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
18538d0bc965Smrg        [if test "x$use_xmlto" = xauto; then
18548d0bc965Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
18558d0bc965Smrg            have_xmlto=no
18568d0bc965Smrg        else
18578d0bc965Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
18588d0bc965Smrg        fi])
18598d0bc965Smrgfi])
1860b042e37fSmrg
18618d0bc965Smrg# Test for the ability of xmlto to generate a text target
18628d0bc965Smrg#
18638d0bc965Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
18648d0bc965Smrg# following test for empty XML docbook files.
18658d0bc965Smrg# For compatibility reasons use the following empty XML docbook file and if
18668d0bc965Smrg# it fails try it again with a non-empty XML file.
18678d0bc965Smrghave_xmlto_text=no
18688d0bc965Smrgcat > conftest.xml << "EOF"
18698d0bc965SmrgEOF
18708d0bc965SmrgAS_IF([test "$have_xmlto" = yes],
18718d0bc965Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18728d0bc965Smrg             [have_xmlto_text=yes],
18738d0bc965Smrg             [# Try it again with a non-empty XML file.
18748d0bc965Smrg              cat > conftest.xml << "EOF"
18758d0bc965Smrg<x></x>
18768d0bc965SmrgEOF
18778d0bc965Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18788d0bc965Smrg                    [have_xmlto_text=yes],
18798d0bc965Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
18808d0bc965Smrgrm -f conftest.xml
18818d0bc965SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
18828d0bc965SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
18838d0bc965Smrg]) # XORG_WITH_XMLTO
1884b042e37fSmrg
18858d0bc965Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
18868d0bc965Smrg# --------------------------------------------
18878d0bc965Smrg# Minimum version: 1.12.0
18888d0bc965Smrg# Minimum version for optional DEFAULT argument: 1.12.0
18898d0bc965Smrg#
18908d0bc965Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
18918d0bc965Smrg# XML-based language used for the transformation of XML documents.
18928d0bc965Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
18938d0bc965Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
18948d0bc965Smrg# The XSLT processor is often used as a standalone tool for transformations.
18958d0bc965Smrg# It should not be assumed that this tool is used only to work with documnetation.
18968d0bc965Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
18978d0bc965Smrg#
18988d0bc965Smrg# Interface to module:
18998d0bc965Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
19008d0bc965Smrg# XSLTPROC:	 returns the path of the xsltproc program found
19018d0bc965Smrg#		 returns the path set by the user in the environment
19028d0bc965Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
19038d0bc965Smrg#		  'no' user instructs the module not to use xsltproc
19048d0bc965Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
19058d0bc965Smrg#
19068d0bc965Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
19078d0bc965Smrg#
19088d0bc965SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
19098d0bc965SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
19108d0bc965Smrg# Preserves the interface, should it be implemented later
19118d0bc965Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
19128d0bc965Smrgm4_define([_defopt], m4_default([$2], [auto]))
19138d0bc965SmrgAC_ARG_WITH(xsltproc,
19148d0bc965Smrg	AS_HELP_STRING([--with-xsltproc],
19158d0bc965Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
19168d0bc965Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
19178d0bc965Smrgm4_undefine([_defopt])
19188c4a8e55Smrg
19198d0bc965Smrgif test "x$use_xsltproc" = x"auto"; then
19208d0bc965Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19218d0bc965Smrg   if test "x$XSLTPROC" = "x"; then
19228d0bc965Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
19238d0bc965Smrg	have_xsltproc=no
19248d0bc965Smrg   else
19258d0bc965Smrg        have_xsltproc=yes
19268d0bc965Smrg   fi
19278d0bc965Smrgelif test "x$use_xsltproc" = x"yes" ; then
19288d0bc965Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19298d0bc965Smrg   if test "x$XSLTPROC" = "x"; then
19308d0bc965Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
19318d0bc965Smrg   fi
19328d0bc965Smrg   have_xsltproc=yes
19338d0bc965Smrgelif test "x$use_xsltproc" = x"no" ; then
19348d0bc965Smrg   if test "x$XSLTPROC" != "x"; then
19358d0bc965Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
19368d0bc965Smrg   fi
19378d0bc965Smrg   have_xsltproc=no
19388d0bc965Smrgelse
19398d0bc965Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
19408bd17e5fSmrgfi
1941b042e37fSmrg
19428d0bc965SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
19438d0bc965Smrg]) # XORG_WITH_XSLTPROC
1944b042e37fSmrg
19458d0bc965Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
19468d0bc965Smrg# ----------------------------------------
19478d0bc965Smrg# Minimum version: 1.15.0
19488d0bc965Smrg#
19498d0bc965Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
19508d0bc965Smrg# scanning arbitrary text files, extracting information from those text files,
19518d0bc965Smrg# and printing reports based on that information.
19528d0bc965Smrg#
19538d0bc965Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
19548d0bc965Smrg#
19558d0bc965Smrg# Interface to module:
19568d0bc965Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
19578d0bc965Smrg# PERL:	     returns the path of the perl program found
19588d0bc965Smrg#	     returns the path set by the user in the environment
19598d0bc965Smrg# --with-perl: 'yes' user instructs the module to use perl
19608d0bc965Smrg#	       'no' user instructs the module not to use perl
19618d0bc965Smrg# have_perl: returns yes if perl found in PATH or no
19628d0bc965Smrg#
19638d0bc965Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
19648d0bc965Smrg#
19658d0bc965SmrgAC_DEFUN([XORG_WITH_PERL],[
19668d0bc965SmrgAC_ARG_VAR([PERL], [Path to perl command])
19678d0bc965Smrg# Preserves the interface, should it be implemented later
19688d0bc965Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
19698d0bc965Smrgm4_define([_defopt], m4_default([$2], [auto]))
19708d0bc965SmrgAC_ARG_WITH(perl,
19718d0bc965Smrg	AS_HELP_STRING([--with-perl],
19728d0bc965Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
19738d0bc965Smrg	   [use_perl=$withval], [use_perl=]_defopt)
19748d0bc965Smrgm4_undefine([_defopt])
1975b042e37fSmrg
19768d0bc965Smrgif test "x$use_perl" = x"auto"; then
19778d0bc965Smrg   AC_PATH_PROG([PERL], [perl])
19788d0bc965Smrg   if test "x$PERL" = "x"; then
19798d0bc965Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
19808d0bc965Smrg	have_perl=no
19818d0bc965Smrg   else
19828d0bc965Smrg        have_perl=yes
19838bd17e5fSmrg   fi
19848d0bc965Smrgelif test "x$use_perl" = x"yes" ; then
19858d0bc965Smrg   AC_PATH_PROG([PERL], [perl])
19868d0bc965Smrg   if test "x$PERL" = "x"; then
19878d0bc965Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
19888d0bc965Smrg   fi
19898d0bc965Smrg   have_perl=yes
19908d0bc965Smrgelif test "x$use_perl" = x"no" ; then
19918d0bc965Smrg   if test "x$PERL" != "x"; then
19928d0bc965Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
19938d0bc965Smrg   fi
19948d0bc965Smrg   have_perl=no
19950597fb56Smrgelse
19968d0bc965Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
19970597fb56Smrgfi
1998706b6b52Smrg
19998d0bc965SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
20008d0bc965Smrg]) # XORG_WITH_PERL
2001706b6b52Smrg
20028d0bc965Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
20038d0bc965Smrg# ----------------
20048d0bc965Smrg# Minimum version: 1.5.0
20058d0bc965Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20068d0bc965Smrg#
20078d0bc965Smrg# Documentation tools are not always available on all platforms and sometimes
20088d0bc965Smrg# not at the appropriate level. This macro enables a module to test for the
20098d0bc965Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20100c674dbdSmrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
20118d0bc965Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20128d0bc965Smrg# --with-asciidoc assumes 'auto'.
20138d0bc965Smrg#
20148d0bc965Smrg# Interface to module:
20158d0bc965Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
20168d0bc965Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
20178d0bc965Smrg#		 returns the path set by the user in the environment
20188d0bc965Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
20198d0bc965Smrg#		  'no' user instructs the module not to use asciidoc
20208d0bc965Smrg#
20218d0bc965Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
20228d0bc965Smrg#
20238d0bc965SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
20248d0bc965SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
20258d0bc965Smrgm4_define([_defopt], m4_default([$2], [auto]))
20268d0bc965SmrgAC_ARG_WITH(asciidoc,
20278d0bc965Smrg	AS_HELP_STRING([--with-asciidoc],
20288d0bc965Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
20298d0bc965Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
20308d0bc965Smrgm4_undefine([_defopt])
20318bd17e5fSmrg
20328d0bc965Smrgif test "x$use_asciidoc" = x"auto"; then
20338d0bc965Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20348d0bc965Smrg   if test "x$ASCIIDOC" = "x"; then
20358d0bc965Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
20368d0bc965Smrg	have_asciidoc=no
20378d0bc965Smrg   else
20388d0bc965Smrg        have_asciidoc=yes
20398d0bc965Smrg   fi
20408d0bc965Smrgelif test "x$use_asciidoc" = x"yes" ; then
20418d0bc965Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20428d0bc965Smrg   if test "x$ASCIIDOC" = "x"; then
20438d0bc965Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
20448d0bc965Smrg   fi
20458d0bc965Smrg   have_asciidoc=yes
20468d0bc965Smrgelif test "x$use_asciidoc" = x"no" ; then
20478d0bc965Smrg   if test "x$ASCIIDOC" != "x"; then
20488d0bc965Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
20498d0bc965Smrg   fi
20508d0bc965Smrg   have_asciidoc=no
20518bd17e5fSmrgelse
20528d0bc965Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
20530597fb56Smrgfi
20548d0bc965Smrgm4_ifval([$1],
20558d0bc965Smrg[if test "$have_asciidoc" = yes; then
20568d0bc965Smrg    # scrape the asciidoc version
20578d0bc965Smrg    AC_MSG_CHECKING([the asciidoc version])
20588d0bc965Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
20598d0bc965Smrg    AC_MSG_RESULT([$asciidoc_version])
20608d0bc965Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
20618d0bc965Smrg        [if test "x$use_asciidoc" = xauto; then
20628d0bc965Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
20638d0bc965Smrg            have_asciidoc=no
20648d0bc965Smrg        else
20658d0bc965Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
20668d0bc965Smrg        fi])
20678d0bc965Smrgfi])
20688d0bc965SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
20698d0bc965Smrg]) # XORG_WITH_ASCIIDOC
2070b042e37fSmrg
20718d0bc965Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
20728d0bc965Smrg# -------------------------------------------
20738d0bc965Smrg# Minimum version: 1.5.0
20748d0bc965Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20758d0bc965Smrg# Minimum version for optional DOT checking: 1.18.0
20768d0bc965Smrg#
20778d0bc965Smrg# Documentation tools are not always available on all platforms and sometimes
20788d0bc965Smrg# not at the appropriate level. This macro enables a module to test for the
20798d0bc965Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20800c674dbdSmrg# the --with-doxygen option, it allows maximum flexibility in making decisions
20818d0bc965Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
20828d0bc965Smrg# --with-doxygen assumes 'auto'.
20838d0bc965Smrg#
20848d0bc965Smrg# Interface to module:
20858d0bc965Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
20868d0bc965Smrg# DOXYGEN:	 returns the path of the doxygen program found
20878d0bc965Smrg#		 returns the path set by the user in the environment
20888d0bc965Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
20898d0bc965Smrg#		  'no' user instructs the module not to use doxygen
20908d0bc965Smrg#
20918d0bc965Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
20928d0bc965Smrg#
20938d0bc965SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
20948d0bc965SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
20958d0bc965SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
20968d0bc965Smrgm4_define([_defopt], m4_default([$2], [auto]))
20978d0bc965SmrgAC_ARG_WITH(doxygen,
20988d0bc965Smrg	AS_HELP_STRING([--with-doxygen],
20998d0bc965Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
21008d0bc965Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
21018d0bc965Smrgm4_undefine([_defopt])
2102b042e37fSmrg
21038d0bc965Smrgif test "x$use_doxygen" = x"auto"; then
21048d0bc965Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21058d0bc965Smrg   if test "x$DOXYGEN" = "x"; then
21068d0bc965Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
21078d0bc965Smrg	have_doxygen=no
21088d0bc965Smrg   else
21098d0bc965Smrg        have_doxygen=yes
21108d0bc965Smrg   fi
21118d0bc965Smrgelif test "x$use_doxygen" = x"yes" ; then
21128d0bc965Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21138d0bc965Smrg   if test "x$DOXYGEN" = "x"; then
21148d0bc965Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
21158d0bc965Smrg   fi
21168d0bc965Smrg   have_doxygen=yes
21178d0bc965Smrgelif test "x$use_doxygen" = x"no" ; then
21188d0bc965Smrg   if test "x$DOXYGEN" != "x"; then
21198d0bc965Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
21208d0bc965Smrg   fi
21218d0bc965Smrg   have_doxygen=no
21228d0bc965Smrgelse
21238d0bc965Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
21248d0bc965Smrgfi
21258d0bc965Smrgm4_ifval([$1],
21268d0bc965Smrg[if test "$have_doxygen" = yes; then
21278d0bc965Smrg    # scrape the doxygen version
21288d0bc965Smrg    AC_MSG_CHECKING([the doxygen version])
21298d0bc965Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
21308d0bc965Smrg    AC_MSG_RESULT([$doxygen_version])
21318d0bc965Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
21328d0bc965Smrg        [if test "x$use_doxygen" = xauto; then
21338d0bc965Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
21348d0bc965Smrg            have_doxygen=no
21358d0bc965Smrg        else
21368d0bc965Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
21378d0bc965Smrg        fi])
21388d0bc965Smrgfi])
2139b042e37fSmrg
21408d0bc965Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
21418d0bc965Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
21428d0bc965Smrgdnl 	HAVE_DOT = @HAVE_DOT@
21438d0bc965SmrgHAVE_DOT=no
21448d0bc965Smrgif test "x$have_doxygen" = "xyes"; then
21458d0bc965Smrg  AC_PATH_PROG([DOT], [dot])
21468d0bc965Smrg    if test "x$DOT" != "x"; then
21478d0bc965Smrg      HAVE_DOT=yes
21488bd17e5fSmrg    fi
21498d0bc965Smrgfi
2150b042e37fSmrg
21518d0bc965SmrgAC_SUBST([HAVE_DOT])
21528d0bc965SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
21538d0bc965SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
21548d0bc965Smrg]) # XORG_WITH_DOXYGEN
21558bd17e5fSmrg
21568d0bc965Smrg# XORG_WITH_GROFF([DEFAULT])
21578d0bc965Smrg# ----------------
21588d0bc965Smrg# Minimum version: 1.6.0
21598d0bc965Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21608d0bc965Smrg#
21618d0bc965Smrg# Documentation tools are not always available on all platforms and sometimes
21628d0bc965Smrg# not at the appropriate level. This macro enables a module to test for the
21638d0bc965Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21640c674dbdSmrg# the --with-groff option, it allows maximum flexibility in making decisions
21658d0bc965Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
21668d0bc965Smrg# --with-groff assumes 'auto'.
21678d0bc965Smrg#
21688d0bc965Smrg# Interface to module:
21698d0bc965Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
21708d0bc965Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
21718d0bc965Smrg# HAVE_GROFF_MS: the -ms macros package
21728d0bc965Smrg# GROFF:	 returns the path of the groff program found
21738d0bc965Smrg#		 returns the path set by the user in the environment
21748d0bc965Smrg# --with-groff:	 'yes' user instructs the module to use groff
21758d0bc965Smrg#		 'no' user instructs the module not to use groff
21768d0bc965Smrg#
21778d0bc965Smrg# Added in version 1.9.0:
21788d0bc965Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
21798d0bc965Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
21808d0bc965Smrg#		   psselect from the psutils package.
21818d0bc965Smrg#		   the ghostcript package. Refer to the grohtml man pages
21828d0bc965Smrg#
21838d0bc965Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
21848d0bc965Smrg#
21858d0bc965Smrg# OS and distros often splits groff in a basic and full package, the former
21868d0bc965Smrg# having the groff program and the later having devices, fonts and macros
21878d0bc965Smrg# Checking for the groff executable is not enough.
21888d0bc965Smrg#
21898d0bc965Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
21908d0bc965Smrg# unset HAVE_GROFF or GROFF env variables.
21918d0bc965Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
21928d0bc965Smrg#
21938d0bc965SmrgAC_DEFUN([XORG_WITH_GROFF],[
21948d0bc965SmrgAC_ARG_VAR([GROFF], [Path to groff command])
21958d0bc965Smrgm4_define([_defopt], m4_default([$1], [auto]))
21968d0bc965SmrgAC_ARG_WITH(groff,
21978d0bc965Smrg	AS_HELP_STRING([--with-groff],
21988d0bc965Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
21998d0bc965Smrg	   [use_groff=$withval], [use_groff=]_defopt)
22008d0bc965Smrgm4_undefine([_defopt])
22018d0bc965Smrg
22028d0bc965Smrgif test "x$use_groff" = x"auto"; then
22038d0bc965Smrg   AC_PATH_PROG([GROFF], [groff])
22048d0bc965Smrg   if test "x$GROFF" = "x"; then
22058d0bc965Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
22068d0bc965Smrg	have_groff=no
22078d0bc965Smrg   else
22088d0bc965Smrg        have_groff=yes
22098d0bc965Smrg   fi
22108d0bc965Smrgelif test "x$use_groff" = x"yes" ; then
22118d0bc965Smrg   AC_PATH_PROG([GROFF], [groff])
22128d0bc965Smrg   if test "x$GROFF" = "x"; then
22138d0bc965Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
22148d0bc965Smrg   fi
22158d0bc965Smrg   have_groff=yes
22168d0bc965Smrgelif test "x$use_groff" = x"no" ; then
22178d0bc965Smrg   if test "x$GROFF" != "x"; then
22188d0bc965Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
22198d0bc965Smrg   fi
22208d0bc965Smrg   have_groff=no
22218bd17e5fSmrgelse
22228d0bc965Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
22238bd17e5fSmrgfi
2224b042e37fSmrg
22258d0bc965Smrg# We have groff, test for the presence of the macro packages
22268d0bc965Smrgif test "x$have_groff" = x"yes"; then
22278d0bc965Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
22288d0bc965Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
22298d0bc965Smrg        groff_ms_works=yes
22308d0bc965Smrg    else
22318d0bc965Smrg        groff_ms_works=no
22328d0bc965Smrg    fi
22338d0bc965Smrg    AC_MSG_RESULT([$groff_ms_works])
22348d0bc965Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
22358d0bc965Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
22368d0bc965Smrg        groff_mm_works=yes
22378d0bc965Smrg    else
22388d0bc965Smrg        groff_mm_works=no
22398d0bc965Smrg    fi
22408d0bc965Smrg    AC_MSG_RESULT([$groff_mm_works])
22418d0bc965Smrgfi
22428c4a8e55Smrg
22438d0bc965Smrg# We have groff, test for HTML dependencies, one command per package
22448d0bc965Smrgif test "x$have_groff" = x"yes"; then
22458d0bc965Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
22468d0bc965Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
22478d0bc965Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
22488d0bc965Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
22498d0bc965Smrg      have_groff_html=yes
22508d0bc965Smrg   else
22518d0bc965Smrg      have_groff_html=no
22528d0bc965Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
22538d0bc965Smrg   fi
22548d0bc965Smrgfi
2255b042e37fSmrg
22568d0bc965Smrg# Set Automake conditionals for Makefiles
22578d0bc965SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
22588d0bc965SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
22598d0bc965SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
22608d0bc965SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
22618d0bc965Smrg]) # XORG_WITH_GROFF
2262b042e37fSmrg
22638d0bc965Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
22648d0bc965Smrg# ---------------------------------------
22658d0bc965Smrg# Minimum version: 1.6.0
22668d0bc965Smrg# Minimum version for optional DEFAULT argument: 1.11.0
22678d0bc965Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
22688d0bc965Smrg#
22698d0bc965Smrg# Documentation tools are not always available on all platforms and sometimes
22708d0bc965Smrg# not at the appropriate level. This macro enables a module to test for the
22718d0bc965Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22720c674dbdSmrg# the --with-fop option, it allows maximum flexibility in making decisions
22738d0bc965Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
22748d0bc965Smrg# --with-fop assumes 'auto'.
22758d0bc965Smrg#
22768d0bc965Smrg# Interface to module:
22778d0bc965Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
22788d0bc965Smrg# FOP:	 	returns the path of the fop program found
22798d0bc965Smrg#		returns the path set by the user in the environment
22808d0bc965Smrg# --with-fop: 	'yes' user instructs the module to use fop
22818d0bc965Smrg#		'no' user instructs the module not to use fop
22828d0bc965Smrg#
22838d0bc965Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
22848d0bc965Smrg#
22858d0bc965SmrgAC_DEFUN([XORG_WITH_FOP],[
22868d0bc965SmrgAC_ARG_VAR([FOP], [Path to fop command])
22878d0bc965Smrgm4_define([_defopt], m4_default([$2], [auto]))
22888d0bc965SmrgAC_ARG_WITH(fop,
22898d0bc965Smrg	AS_HELP_STRING([--with-fop],
22908d0bc965Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
22918d0bc965Smrg	   [use_fop=$withval], [use_fop=]_defopt)
22928d0bc965Smrgm4_undefine([_defopt])
2293b042e37fSmrg
22948d0bc965Smrgif test "x$use_fop" = x"auto"; then
22958d0bc965Smrg   AC_PATH_PROG([FOP], [fop])
22968d0bc965Smrg   if test "x$FOP" = "x"; then
22978d0bc965Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
22988d0bc965Smrg	have_fop=no
22998d0bc965Smrg   else
23008d0bc965Smrg        have_fop=yes
23018d0bc965Smrg   fi
23028d0bc965Smrgelif test "x$use_fop" = x"yes" ; then
23038d0bc965Smrg   AC_PATH_PROG([FOP], [fop])
23048d0bc965Smrg   if test "x$FOP" = "x"; then
23058d0bc965Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
23068d0bc965Smrg   fi
23078d0bc965Smrg   have_fop=yes
23088d0bc965Smrgelif test "x$use_fop" = x"no" ; then
23098d0bc965Smrg   if test "x$FOP" != "x"; then
23108d0bc965Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
23118d0bc965Smrg   fi
23128d0bc965Smrg   have_fop=no
23138bd17e5fSmrgelse
23148d0bc965Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
23158d0bc965Smrgfi
23168c4a8e55Smrg
23178d0bc965Smrg# Test for a minimum version of fop, if provided.
23188d0bc965Smrgm4_ifval([$1],
23198d0bc965Smrg[if test "$have_fop" = yes; then
23208d0bc965Smrg    # scrape the fop version
23218d0bc965Smrg    AC_MSG_CHECKING([for fop minimum version])
23228d0bc965Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
23238d0bc965Smrg    AC_MSG_RESULT([$fop_version])
23248d0bc965Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
23258d0bc965Smrg        [if test "x$use_fop" = xauto; then
23268d0bc965Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
23278d0bc965Smrg            have_fop=no
23288d0bc965Smrg        else
23298d0bc965Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
23308d0bc965Smrg        fi])
23318d0bc965Smrgfi])
23328d0bc965SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
23338d0bc965Smrg]) # XORG_WITH_FOP
23348c4a8e55Smrg
23358d0bc965Smrg# XORG_WITH_M4([MIN-VERSION])
23368d0bc965Smrg# ---------------------------
23378d0bc965Smrg# Minimum version: 1.19.0
23388d0bc965Smrg#
23398d0bc965Smrg# This macro attempts to locate an m4 macro processor which supports
23408d0bc965Smrg# -I option and is only useful for modules relying on M4 in order to
23418d0bc965Smrg# expand macros in source code files.
23428d0bc965Smrg#
23438d0bc965Smrg# Interface to module:
23448d0bc965Smrg# M4:	 	returns the path of the m4 program found
23458d0bc965Smrg#		returns the path set by the user in the environment
23468d0bc965Smrg#
23478d0bc965SmrgAC_DEFUN([XORG_WITH_M4], [
23488d0bc965SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
23498d0bc965Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
23508d0bc965Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
23518d0bc965Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
23528d0bc965Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
23538d0bc965Smrg   [$PATH:/usr/gnu/bin])])
2354b042e37fSmrg
23558d0bc965SmrgAC_SUBST([M4], [$ac_cv_path_M4])
23568d0bc965Smrg]) # XORG_WITH_M4
23578bd17e5fSmrg
23588d0bc965Smrg# XORG_WITH_PS2PDF([DEFAULT])
23598d0bc965Smrg# ----------------
23608d0bc965Smrg# Minimum version: 1.6.0
23618d0bc965Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23628d0bc965Smrg#
23638d0bc965Smrg# Documentation tools are not always available on all platforms and sometimes
23648d0bc965Smrg# not at the appropriate level. This macro enables a module to test for the
23658d0bc965Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
23660c674dbdSmrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
23678d0bc965Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
23688d0bc965Smrg# --with-ps2pdf assumes 'auto'.
23698d0bc965Smrg#
23708d0bc965Smrg# Interface to module:
23718d0bc965Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
23728d0bc965Smrg# PS2PDF:	returns the path of the ps2pdf program found
23738d0bc965Smrg#		returns the path set by the user in the environment
23748d0bc965Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
23758d0bc965Smrg#		 'no' user instructs the module not to use ps2pdf
23768d0bc965Smrg#
23778d0bc965Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
23788d0bc965Smrg#
23798d0bc965SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
23808d0bc965SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
23818d0bc965Smrgm4_define([_defopt], m4_default([$1], [auto]))
23828d0bc965SmrgAC_ARG_WITH(ps2pdf,
23838d0bc965Smrg	AS_HELP_STRING([--with-ps2pdf],
23848d0bc965Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
23858d0bc965Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
23868d0bc965Smrgm4_undefine([_defopt])
23878bd17e5fSmrg
23888d0bc965Smrgif test "x$use_ps2pdf" = x"auto"; then
23898d0bc965Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23908d0bc965Smrg   if test "x$PS2PDF" = "x"; then
23918d0bc965Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
23928d0bc965Smrg	have_ps2pdf=no
23938d0bc965Smrg   else
23948d0bc965Smrg        have_ps2pdf=yes
23958d0bc965Smrg   fi
23968d0bc965Smrgelif test "x$use_ps2pdf" = x"yes" ; then
23978d0bc965Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23988d0bc965Smrg   if test "x$PS2PDF" = "x"; then
23998d0bc965Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
24008d0bc965Smrg   fi
24018d0bc965Smrg   have_ps2pdf=yes
24028d0bc965Smrgelif test "x$use_ps2pdf" = x"no" ; then
24038d0bc965Smrg   if test "x$PS2PDF" != "x"; then
24048d0bc965Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
24058d0bc965Smrg   fi
24068d0bc965Smrg   have_ps2pdf=no
24078bd17e5fSmrgelse
24088d0bc965Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
24098d0bc965Smrgfi
24108d0bc965SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
24118d0bc965Smrg]) # XORG_WITH_PS2PDF
24128bd17e5fSmrg
24138d0bc965Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
24148d0bc965Smrg# ----------------
24158d0bc965Smrg# Minimum version: 1.6.0
24168d0bc965Smrg#
24178d0bc965Smrg# Documentation tools are not always available on all platforms and sometimes
24188d0bc965Smrg# not at the appropriate level. This macro enables a builder to skip all
24198d0bc965Smrg# documentation targets except traditional man pages.
24208d0bc965Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24210c674dbdSmrg# maximum flexibility in controlling documentation building.
24228d0bc965Smrg# Refer to:
24238d0bc965Smrg# XORG_WITH_XMLTO         --with-xmlto
24248d0bc965Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24258d0bc965Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24268d0bc965Smrg# XORG_WITH_FOP           --with-fop
24278d0bc965Smrg# XORG_WITH_GROFF         --with-groff
24288d0bc965Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24298d0bc965Smrg#
24308d0bc965Smrg# Interface to module:
24318d0bc965Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
24328d0bc965Smrg# --enable-docs: 'yes' user instructs the module to generate docs
24338d0bc965Smrg#		 'no' user instructs the module not to generate docs
24348d0bc965Smrg# parm1:	specify the default value, yes or no.
24358d0bc965Smrg#
24368d0bc965SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
24378d0bc965Smrgm4_define([docs_default], m4_default([$1], [yes]))
24388d0bc965SmrgAC_ARG_ENABLE(docs,
24398d0bc965Smrg	AS_HELP_STRING([--enable-docs],
24408d0bc965Smrg	   [Enable building the documentation (default: ]docs_default[)]),
24418d0bc965Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
24428d0bc965Smrgm4_undefine([docs_default])
24438d0bc965SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
24448d0bc965SmrgAC_MSG_CHECKING([whether to build documentation])
24458d0bc965SmrgAC_MSG_RESULT([$build_docs])
24468d0bc965Smrg]) # XORG_ENABLE_DOCS
24478bd17e5fSmrg
24488d0bc965Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
24498d0bc965Smrg# ----------------
24508d0bc965Smrg# Minimum version: 1.6.0
24518d0bc965Smrg#
24528d0bc965Smrg# This macro enables a builder to skip all developer documentation.
24538d0bc965Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24540c674dbdSmrg# maximum flexibility in controlling documentation building.
24558d0bc965Smrg# Refer to:
24568d0bc965Smrg# XORG_WITH_XMLTO         --with-xmlto
24578d0bc965Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24588d0bc965Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24598d0bc965Smrg# XORG_WITH_FOP           --with-fop
24608d0bc965Smrg# XORG_WITH_GROFF         --with-groff
24618d0bc965Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24628d0bc965Smrg#
24638d0bc965Smrg# Interface to module:
24648d0bc965Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
24658d0bc965Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
24668d0bc965Smrg#			'no' user instructs the module not to generate developer docs
24678d0bc965Smrg# parm1:		specify the default value, yes or no.
24688d0bc965Smrg#
24698d0bc965SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
24708d0bc965Smrgm4_define([devel_default], m4_default([$1], [yes]))
24718d0bc965SmrgAC_ARG_ENABLE(devel-docs,
24728d0bc965Smrg	AS_HELP_STRING([--enable-devel-docs],
24738d0bc965Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
24748d0bc965Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
24758d0bc965Smrgm4_undefine([devel_default])
24768d0bc965SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
24778d0bc965SmrgAC_MSG_CHECKING([whether to build developer documentation])
24788d0bc965SmrgAC_MSG_RESULT([$build_devel_docs])
24798d0bc965Smrg]) # XORG_ENABLE_DEVEL_DOCS
2480b042e37fSmrg
24818d0bc965Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
24828d0bc965Smrg# ----------------
24838d0bc965Smrg# Minimum version: 1.6.0
24848d0bc965Smrg#
24858d0bc965Smrg# This macro enables a builder to skip all functional specification targets.
24868d0bc965Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24870c674dbdSmrg# maximum flexibility in controlling documentation building.
24888d0bc965Smrg# Refer to:
24898d0bc965Smrg# XORG_WITH_XMLTO         --with-xmlto
24908d0bc965Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24918d0bc965Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24928d0bc965Smrg# XORG_WITH_FOP           --with-fop
24938d0bc965Smrg# XORG_WITH_GROFF         --with-groff
24948d0bc965Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24958d0bc965Smrg#
24968d0bc965Smrg# Interface to module:
24978d0bc965Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
24988d0bc965Smrg# --enable-specs:	'yes' user instructs the module to generate specs
24998d0bc965Smrg#			'no' user instructs the module not to generate specs
25008d0bc965Smrg# parm1:		specify the default value, yes or no.
25018d0bc965Smrg#
25028d0bc965SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
25038d0bc965Smrgm4_define([spec_default], m4_default([$1], [yes]))
25048d0bc965SmrgAC_ARG_ENABLE(specs,
25058d0bc965Smrg	AS_HELP_STRING([--enable-specs],
25068d0bc965Smrg	   [Enable building the specs (default: ]spec_default[)]),
25078d0bc965Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
25088d0bc965Smrgm4_undefine([spec_default])
25098d0bc965SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
25108d0bc965SmrgAC_MSG_CHECKING([whether to build functional specifications])
25118d0bc965SmrgAC_MSG_RESULT([$build_specs])
25128d0bc965Smrg]) # XORG_ENABLE_SPECS
2513b042e37fSmrg
25148d0bc965Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
25158d0bc965Smrg# ----------------------------------------------
25168d0bc965Smrg# Minimum version: 1.13.0
25178d0bc965Smrg#
25188d0bc965Smrg# This macro enables a builder to enable/disable unit testing
25198d0bc965Smrg# It makes no assumption about the test cases implementation
25208d0bc965Smrg# Test cases may or may not use Automake "Support for test suites"
25218d0bc965Smrg# They may or may not use the software utility library GLib
25228d0bc965Smrg#
25238d0bc965Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
25248d0bc965Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
25258d0bc965Smrg# The variable enable_unit_tests is used by other macros in this file.
25268d0bc965Smrg#
25278d0bc965Smrg# Interface to module:
25288d0bc965Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
25298d0bc965Smrg# enable_unit_tests:    used in configure.ac for additional configuration
25308d0bc965Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
25318d0bc965Smrg#			'no' user instructs the module not to build tests
25328d0bc965Smrg# parm1:		specify the default value, yes or no.
25338d0bc965Smrg#
25348d0bc965SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
25358d0bc965SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
25368d0bc965SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
25378d0bc965SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25388d0bc965Smrgm4_define([_defopt], m4_default([$1], [auto]))
25398d0bc965SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
25408d0bc965Smrg	[Enable building unit test cases (default: ]_defopt[)]),
25418d0bc965Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
25428d0bc965Smrgm4_undefine([_defopt])
25438d0bc965SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
25448d0bc965SmrgAC_MSG_CHECKING([whether to build unit test cases])
25458d0bc965SmrgAC_MSG_RESULT([$enable_unit_tests])
25468d0bc965Smrg]) # XORG_ENABLE_UNIT_TESTS
2547b042e37fSmrg
25488d0bc965Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
25498d0bc965Smrg# ------------------------------------------------------
25508d0bc965Smrg# Minimum version: 1.17.0
25518d0bc965Smrg#
25528d0bc965Smrg# This macro enables a builder to enable/disable integration testing
25538d0bc965Smrg# It makes no assumption about the test cases' implementation
25548d0bc965Smrg# Test cases may or may not use Automake "Support for test suites"
25558d0bc965Smrg#
25568d0bc965Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
25578d0bc965Smrg# usually requires less dependencies and may be built and run under less
25588d0bc965Smrg# stringent environments than integration tests.
25598d0bc965Smrg#
25608d0bc965Smrg# Interface to module:
25618d0bc965Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
25628d0bc965Smrg# enable_integration_tests:   used in configure.ac for additional configuration
25638d0bc965Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
25648d0bc965Smrg#                             'no' user instructs the module not to build tests
25658d0bc965Smrg# parm1:                      specify the default value, yes or no.
25668d0bc965Smrg#
25678d0bc965SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
25688d0bc965SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25698d0bc965Smrgm4_define([_defopt], m4_default([$1], [auto]))
25708d0bc965SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
25718d0bc965Smrg	[Enable building integration test cases (default: ]_defopt[)]),
25728d0bc965Smrg	[enable_integration_tests=$enableval],
25738d0bc965Smrg	[enable_integration_tests=]_defopt)
25748d0bc965Smrgm4_undefine([_defopt])
25758d0bc965SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
25768d0bc965Smrg	[test "x$enable_integration_tests" != xno])
25778d0bc965SmrgAC_MSG_CHECKING([whether to build unit test cases])
25788d0bc965SmrgAC_MSG_RESULT([$enable_integration_tests])
25798d0bc965Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
25800597fb56Smrg
25818d0bc965Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
25828d0bc965Smrg# ----------------------------------------
25838d0bc965Smrg# Minimum version: 1.13.0
25848d0bc965Smrg#
25858d0bc965Smrg# GLib is a library which provides advanced data structures and functions.
25868d0bc965Smrg# This macro enables a module to test for the presence of Glib.
25878d0bc965Smrg#
25888d0bc965Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
25898d0bc965Smrg# Otherwise the value of $enable_unit_tests is blank.
25908d0bc965Smrg#
25918d0bc965Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
25928d0bc965Smrg# test support usually requires less dependencies and may be built and run under
25938d0bc965Smrg# less stringent environments than integration tests.
25948d0bc965Smrg#
25958d0bc965Smrg# Interface to module:
25968d0bc965Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
25978d0bc965Smrg# with_glib: used in configure.ac to know if GLib has been found
25988d0bc965Smrg# --with-glib:	'yes' user instructs the module to use glib
25998d0bc965Smrg#		'no' user instructs the module not to use glib
26008d0bc965Smrg#
26018d0bc965SmrgAC_DEFUN([XORG_WITH_GLIB],[
26028d0bc965SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
26038d0bc965Smrgm4_define([_defopt], m4_default([$2], [auto]))
26048d0bc965SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
26058d0bc965Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
26068d0bc965Smrg	[with_glib=$withval], [with_glib=]_defopt)
26078d0bc965Smrgm4_undefine([_defopt])
26080597fb56Smrg
26098d0bc965Smrghave_glib=no
26108d0bc965Smrg# Do not probe GLib if user explicitly disabled unit testing
26118d0bc965Smrgif test "x$enable_unit_tests" != x"no"; then
26128d0bc965Smrg  # Do not probe GLib if user explicitly disabled it
26138d0bc965Smrg  if test "x$with_glib" != x"no"; then
26148d0bc965Smrg    m4_ifval(
26158d0bc965Smrg      [$1],
26168d0bc965Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
26178d0bc965Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
26188d0bc965Smrg    )
26198d0bc965Smrg  fi
26208d0bc965Smrgfi
26210597fb56Smrg
26228d0bc965Smrg# Not having GLib when unit testing has been explicitly requested is an error
26238d0bc965Smrgif test "x$enable_unit_tests" = x"yes"; then
26248d0bc965Smrg  if test "x$have_glib" = x"no"; then
26258d0bc965Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26268d0bc965Smrg  fi
26278d0bc965Smrgfi
26280597fb56Smrg
26298d0bc965Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
26308d0bc965Smrgif test "x$enable_unit_tests" = x"no"; then
26318d0bc965Smrg  if test "x$with_glib" = x"yes"; then
26328d0bc965Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26338d0bc965Smrg  fi
26340597fb56Smrgfi
2635b042e37fSmrg
26368d0bc965Smrg# Not having GLib when it has been explicitly requested is an error
26378d0bc965Smrgif test "x$with_glib" = x"yes"; then
26388d0bc965Smrg  if test "x$have_glib" = x"no"; then
26398d0bc965Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
26408d0bc965Smrg  fi
26418d0bc965Smrgfi
2642b042e37fSmrg
26438d0bc965SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
26448d0bc965Smrg]) # XORG_WITH_GLIB
2645b042e37fSmrg
26468d0bc965Smrg# XORG_LD_WRAP([required|optional])
26478d0bc965Smrg# ---------------------------------
26488d0bc965Smrg# Minimum version: 1.13.0
26498d0bc965Smrg#
26508d0bc965Smrg# Check if linker supports -wrap, passed via compiler flags
26518d0bc965Smrg#
26528d0bc965Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
26538d0bc965Smrg# Otherwise the value of $enable_unit_tests is blank.
26548d0bc965Smrg#
26558d0bc965Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
26568d0bc965Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
26578d0bc965Smrg# available, an argument of "optional" allows use when some unit tests require
26588d0bc965Smrg# ld -wrap and others do not.
26598d0bc965Smrg#
26608d0bc965SmrgAC_DEFUN([XORG_LD_WRAP],[
26618d0bc965SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
26628d0bc965Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
26638d0bc965Smrg                      void __wrap_exit(int status) { return; }],
26648d0bc965Smrg                     [exit(0);])])
26658d0bc965Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
26668d0bc965Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
26678d0bc965Smrg  if test "x$have_ld_wrap" = x"no"; then
26688d0bc965Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
26698d0bc965Smrg  fi
26708d0bc965Smrgfi
26718d0bc965SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
26728d0bc965Smrg#
26738d0bc965Smrg]) # XORG_LD_WRAP
26740597fb56Smrg
26758d0bc965Smrg# XORG_CHECK_LINKER_FLAGS
26768d0bc965Smrg# -----------------------
26778d0bc965Smrg# SYNOPSIS
26788d0bc965Smrg#
26798d0bc965Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
26808d0bc965Smrg#
26818d0bc965Smrg# DESCRIPTION
26828d0bc965Smrg#
26838d0bc965Smrg#   Check whether the given linker FLAGS work with the current language's
26848d0bc965Smrg#   linker, or whether they give an error.
26858d0bc965Smrg#
26868d0bc965Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
26878d0bc965Smrg#   success/failure.
26888d0bc965Smrg#
26898d0bc965Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
26908d0bc965Smrg#
26918d0bc965Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
26928d0bc965Smrg#
26938d0bc965Smrg# LICENSE
26948d0bc965Smrg#
26958d0bc965Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
26968d0bc965Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
26978d0bc965Smrg#   Copyright (c) 2009 Matteo Frigo
26988d0bc965Smrg#
26998d0bc965Smrg#   This program is free software: you can redistribute it and/or modify it
27008d0bc965Smrg#   under the terms of the GNU General Public License as published by the
27018d0bc965Smrg#   Free Software Foundation, either version 3 of the License, or (at your
27028d0bc965Smrg#   option) any later version.
27038d0bc965Smrg#
27048d0bc965Smrg#   This program is distributed in the hope that it will be useful, but
27058d0bc965Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
27068d0bc965Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27078d0bc965Smrg#   Public License for more details.
27088d0bc965Smrg#
27098d0bc965Smrg#   You should have received a copy of the GNU General Public License along
27108d0bc965Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
27118d0bc965Smrg#
27128d0bc965Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
27138d0bc965Smrg#   gives unlimited permission to copy, distribute and modify the configure
27148d0bc965Smrg#   scripts that are the output of Autoconf when processing the Macro. You
27158d0bc965Smrg#   need not follow the terms of the GNU General Public License when using
27168d0bc965Smrg#   or distributing such scripts, even though portions of the text of the
27178d0bc965Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
27188d0bc965Smrg#   all other use of the material that constitutes the Autoconf Macro.
27198d0bc965Smrg#
27208d0bc965Smrg#   This special exception to the GPL applies to versions of the Autoconf
27218d0bc965Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
27228d0bc965Smrg#   modified version of the Autoconf Macro, you may extend this special
27238d0bc965Smrg#   exception to the GPL to apply to your modified version as well.#
27248d0bc965SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
27258d0bc965Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
27268d0bc965Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
27278d0bc965SmrgAS_LITERAL_IF([$1],
27288d0bc965Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
27298d0bc965Smrg      ax_save_FLAGS=$LDFLAGS
27308d0bc965Smrg      LDFLAGS="$1"
27318d0bc965Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
27328d0bc965Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27338d0bc965Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27348d0bc965Smrg      LDFLAGS=$ax_save_FLAGS])],
27358d0bc965Smrg  [ax_save_FLAGS=$LDFLAGS
27368d0bc965Smrg   LDFLAGS="$1"
27378d0bc965Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
27388d0bc965Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27398d0bc965Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27408d0bc965Smrg   LDFLAGS=$ax_save_FLAGS])
27418d0bc965Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
27428d0bc965SmrgAC_MSG_RESULT($xorg_check_linker_flags)
27438d0bc965Smrgif test "x$xorg_check_linker_flags" = xyes; then
27448d0bc965Smrg	m4_default([$2], :)
27450597fb56Smrgelse
27468d0bc965Smrg	m4_default([$3], :)
27478bd17e5fSmrgfi
27488d0bc965Smrg]) # XORG_CHECK_LINKER_FLAGS
27498d0bc965Smrg
27508d0bc965Smrg# XORG_MEMORY_CHECK_FLAGS
27518d0bc965Smrg# -----------------------
27528d0bc965Smrg# Minimum version: 1.16.0
27538d0bc965Smrg#
27548d0bc965Smrg# This macro attempts to find appropriate memory checking functionality
27558d0bc965Smrg# for various platforms which unit testing code may use to catch various
27568d0bc965Smrg# forms of memory allocation and access errors in testing.
27578d0bc965Smrg#
27588d0bc965Smrg# Interface to module:
27598d0bc965Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
27608d0bc965Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
27618d0bc965Smrg#
27628d0bc965Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
27638d0bc965Smrg#
27648d0bc965SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
27658bd17e5fSmrg
27668d0bc965SmrgAC_REQUIRE([AC_CANONICAL_HOST])
27678d0bc965SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
27688d0bc965Smrg           [Environment variables to enable memory checking in tests])
27698bd17e5fSmrg
27708d0bc965Smrg# Check for different types of support on different platforms
27718d0bc965Smrgcase $host_os in
27728d0bc965Smrg    solaris*)
27738d0bc965Smrg        AC_CHECK_LIB([umem], [umem_alloc],
27748d0bc965Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
27758d0bc965Smrg        ;;
27768d0bc965Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
27778d0bc965Smrg        # both directly and inverted, so should not be 0 or 255.
27788d0bc965Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
27798d0bc965Smrg        ;;
27808d0bc965Smrg    darwin*)
27818d0bc965Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
27828d0bc965Smrg        ;;
27838d0bc965Smrg    *bsd*)
27848d0bc965Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
27858d0bc965Smrg        ;;
27868d0bc965Smrgesac
27878d0bc965Smrg
27888d0bc965Smrg# User supplied flags override default flags
27898d0bc965Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
27908d0bc965Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
27918bd17e5fSmrgfi
27928bd17e5fSmrg
27938d0bc965SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
27948d0bc965Smrg]) # XORG_WITH_LINT
27958bd17e5fSmrg
27968d0bc965Smrg# XORG_CHECK_MALLOC_ZERO
27978d0bc965Smrg# ----------------------
27988d0bc965Smrg# Minimum version: 1.0.0
27998d0bc965Smrg#
28008d0bc965Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
28018d0bc965Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
28028d0bc965Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
28038d0bc965SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
28048d0bc965SmrgAC_ARG_ENABLE(malloc0returnsnull,
28058d0bc965Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
28068d0bc965Smrg		       [malloc(0) returns NULL (default: auto)]),
28078d0bc965Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
28088d0bc965Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
28098bd17e5fSmrg
28108d0bc965SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
28118d0bc965Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
28128d0bc965SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
28138d0bc965Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
28148d0bc965Smrg#include <stdlib.h>
28158d0bc965Smrg],[
28168d0bc965Smrg    char *m0, *r0, *c0, *p;
28178d0bc965Smrg    m0 = malloc(0);
28188d0bc965Smrg    p = malloc(10);
28198d0bc965Smrg    r0 = realloc(p,0);
28208d0bc965Smrg    c0 = calloc(0,10);
28218d0bc965Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
28228d0bc965Smrg])],
28238d0bc965Smrg		[xorg_cv_malloc0_returns_null=yes],
28248d0bc965Smrg		[xorg_cv_malloc0_returns_null=no])])
28258d0bc965SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
28268d0bc965Smrgfi
28278d0bc965SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
28288d0bc965Smrg
28298d0bc965Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
28308d0bc965Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
28318d0bc965Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
28328d0bc965Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
28338bd17e5fSmrgelse
28348d0bc965Smrg	MALLOC_ZERO_CFLAGS=""
28358d0bc965Smrg	XMALLOC_ZERO_CFLAGS=""
28368d0bc965Smrg	XTMALLOC_ZERO_CFLAGS=""
2837bd23fbfaSmrgfi
2838b042e37fSmrg
28398d0bc965SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
28408d0bc965SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
28418d0bc965SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
28428d0bc965Smrg]) # XORG_CHECK_MALLOC_ZERO
2843b042e37fSmrg
28448d0bc965Smrg# XORG_WITH_LINT()
28458bd17e5fSmrg# ----------------
28468d0bc965Smrg# Minimum version: 1.1.0
28478d0bc965Smrg#
28488d0bc965Smrg# This macro enables the use of a tool that flags some suspicious and
28498d0bc965Smrg# non-portable constructs (likely to be bugs) in C language source code.
28508d0bc965Smrg# It will attempt to locate the tool and use appropriate options.
28518d0bc965Smrg# There are various lint type tools on different platforms.
28528d0bc965Smrg#
28538d0bc965Smrg# Interface to module:
28548d0bc965Smrg# LINT:		returns the path to the tool found on the platform
28558d0bc965Smrg#		or the value set to LINT on the configure cmd line
28568d0bc965Smrg#		also an Automake conditional
28578d0bc965Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
28588d0bc965Smrg#
28598d0bc965Smrg# --with-lint:	'yes' user instructs the module to use lint
28608d0bc965Smrg#		'no' user instructs the module not to use lint (default)
28618d0bc965Smrg#
28628d0bc965Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
28638d0bc965Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
28648d0bc965Smrg#
28658d0bc965SmrgAC_DEFUN([XORG_WITH_LINT],[
2866b042e37fSmrg
28678d0bc965SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
28688d0bc965SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
28698d0bc965SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
28708d0bc965Smrg		[Use a lint-style source code checker (default: disabled)])],
28718d0bc965Smrg		[use_lint=$withval], [use_lint=no])
28723169be4bSmrg
28738d0bc965Smrg# Obtain platform specific info like program name and options
28748d0bc965Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
28758d0bc965Smrgcase $host_os in
28768d0bc965Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
28778d0bc965Smrg	lint_name=splint
28788d0bc965Smrg	lint_options="-badflag"
28798d0bc965Smrg	;;
28808d0bc965Smrg  *freebsd* | *netbsd*)
28818d0bc965Smrg	lint_name=lint
28828d0bc965Smrg	lint_options="-u -b"
28838d0bc965Smrg	;;
28848d0bc965Smrg  *solaris*)
28858d0bc965Smrg	lint_name=lint
28868d0bc965Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
28878d0bc965Smrg	;;
28888d0bc965Smrgesac
28893169be4bSmrg
28908d0bc965Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
28918d0bc965Smrgif test "x$use_lint" = x"yes" ; then
28928d0bc965Smrg   AC_PATH_PROG([LINT], [$lint_name])
28938d0bc965Smrg   if test "x$LINT" = "x"; then
28948d0bc965Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
28958d0bc965Smrg   fi
28968d0bc965Smrgelif test "x$use_lint" = x"no" ; then
28978d0bc965Smrg   if test "x$LINT" != "x"; then
28988d0bc965Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
28998d0bc965Smrg   fi
29008bd17e5fSmrgelse
29018d0bc965Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
29028d0bc965Smrgfi
29030597fb56Smrg
29048d0bc965Smrg# User supplied flags override default flags
29058d0bc965Smrgif test "x$LINT_FLAGS" != "x"; then
29068d0bc965Smrg   lint_options=$LINT_FLAGS
29078d0bc965Smrgfi
29083169be4bSmrg
29098d0bc965SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
29108d0bc965SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
29118bd17e5fSmrg
29128d0bc965Smrg]) # XORG_WITH_LINT
29138bd17e5fSmrg
29148d0bc965Smrg# XORG_LINT_LIBRARY(LIBNAME)
29158d0bc965Smrg# --------------------------
29168d0bc965Smrg# Minimum version: 1.1.0
29178d0bc965Smrg#
29188d0bc965Smrg# Sets up flags for building lint libraries for checking programs that call
29198d0bc965Smrg# functions in the library.
29208d0bc965Smrg#
29218d0bc965Smrg# Interface to module:
29228d0bc965Smrg# LINTLIB		- Automake variable with the name of lint library file to make
29238d0bc965Smrg# MAKE_LINT_LIB		- Automake conditional
29248d0bc965Smrg#
29258d0bc965Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
29268d0bc965Smrg#			  - 'no' user instructs the module not to create a lint library (default)
29273169be4bSmrg
29288d0bc965SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
29298d0bc965SmrgAC_REQUIRE([XORG_WITH_LINT])
29308d0bc965SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
29318d0bc965Smrg	[Create lint library (default: disabled)])],
29328d0bc965Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
29338c4a8e55Smrg
29348d0bc965Smrgif test "x$make_lint_lib" = x"yes" ; then
29358d0bc965Smrg   LINTLIB=llib-l$1.ln
29368d0bc965Smrg   if test "x$LINT" = "x"; then
29378d0bc965Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
29388d0bc965Smrg   fi
29398d0bc965Smrgelif test "x$make_lint_lib" != x"no" ; then
29408d0bc965Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
29418d0bc965Smrgfi
2942bd23fbfaSmrg
29438d0bc965SmrgAC_SUBST(LINTLIB)
29448d0bc965SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2945bd23fbfaSmrg
29468d0bc965Smrg]) # XORG_LINT_LIBRARY
2947bd23fbfaSmrg
29488d0bc965Smrg# XORG_COMPILER_BRAND
29498d0bc965Smrg# -------------------
29508d0bc965Smrg# Minimum version: 1.14.0
29518d0bc965Smrg#
29528d0bc965Smrg# Checks for various brands of compilers and sets flags as appropriate:
29538d0bc965Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
29548d0bc965Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
29558d0bc965Smrg#   clang compiler - sets CLANGCC to "yes"
29568d0bc965Smrg#   Intel compiler - sets INTELCC to "yes"
29578d0bc965Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
29588d0bc965Smrg#
29598d0bc965SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
29608d0bc965SmrgAC_LANG_CASE(
29618d0bc965Smrg	[C], [
29620c674dbdSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
29630c674dbdSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
29640c674dbdSmrg		m4_version_prereq([2.70],
29650c674dbdSmrg			[AC_REQUIRE([AC_PROG_CC])],
29660c674dbdSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
29678d0bc965Smrg	],
29688d0bc965Smrg	[C++], [
29698d0bc965Smrg		AC_REQUIRE([AC_PROG_CXX])
29708d0bc965Smrg	]
29718d0bc965Smrg)
29728d0bc965SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
29738d0bc965SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
29748d0bc965SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
29758d0bc965Smrg]) # XORG_COMPILER_BRAND
2976bd23fbfaSmrg
29778d0bc965Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
29788d0bc965Smrg# ---------------
29798d0bc965Smrg# Minimum version: 1.16.0
29808d0bc965Smrg#
29818d0bc965Smrg# Test if the compiler works when passed the given flag as a command line argument.
29820c674dbdSmrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
29838d0bc965Smrg# next flag in the list until there are no more options.
29848d0bc965Smrg#
29858d0bc965Smrg# Note that this does not guarantee that the compiler supports the flag as some
29868d0bc965Smrg# compilers will simply ignore arguments that they do not understand, but we do
29878d0bc965Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
29888d0bc965Smrg# -Werror=unused-command-line-argument
29898d0bc965Smrg#
29908d0bc965SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
29918d0bc965Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29928d0bc965Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29938c4a8e55Smrg
29948d0bc965SmrgAC_LANG_COMPILER_REQUIRE
2995706b6b52Smrg
29968d0bc965SmrgAC_LANG_CASE(
29978d0bc965Smrg	[C], [
29980c674dbdSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
29990c674dbdSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
30000c674dbdSmrg		m4_version_prereq([2.70],
30010c674dbdSmrg			[AC_REQUIRE([AC_PROG_CC])],
30020c674dbdSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
30038d0bc965Smrg		define([PREFIX], [C])
30048d0bc965Smrg		define([CACHE_PREFIX], [cc])
30058d0bc965Smrg		define([COMPILER], [$CC])
30068d0bc965Smrg	],
30078d0bc965Smrg	[C++], [
30088d0bc965Smrg		define([PREFIX], [CXX])
30098d0bc965Smrg		define([CACHE_PREFIX], [cxx])
30108d0bc965Smrg		define([COMPILER], [$CXX])
30118d0bc965Smrg	]
30128d0bc965Smrg)
3013706b6b52Smrg
30148d0bc965Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3015706b6b52Smrg
30168d0bc965Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
30178d0bc965Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30188d0bc965Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
30198d0bc965Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
30208d0bc965Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30218d0bc965Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
30228d0bc965Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
30238d0bc965Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
30248d0bc965Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30258d0bc965Smrgfi
3026706b6b52Smrg
30278d0bc965Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
30288d0bc965Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
30298d0bc965Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30308d0bc965Smrg	fi
30318d0bc965Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30328d0bc965Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
30338d0bc965Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
30348d0bc965Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30358d0bc965Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
30368d0bc965Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
30378d0bc965Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
30388d0bc965Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30398d0bc965Smrgfi
3040706b6b52Smrg
30418d0bc965Smrgfound="no"
30428d0bc965Smrgm4_foreach([flag], m4_cdr($@), [
30438d0bc965Smrg	if test $found = "no" ; then
30448d0bc965Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
30458d0bc965Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30468d0bc965Smrg		fi
3047706b6b52Smrg
30488d0bc965Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
30498d0bc965Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30508d0bc965Smrg		fi
3051706b6b52Smrg
30528d0bc965Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3053706b6b52Smrg
30548d0bc965Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
30558d0bc965Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
30568d0bc965Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
30578d0bc965Smrg		AC_CACHE_VAL($cacheid,
30588d0bc965Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
30598d0bc965Smrg					     [eval $cacheid=yes],
30608d0bc965Smrg					     [eval $cacheid=no])])
3061706b6b52Smrg
30628d0bc965Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3063706b6b52Smrg
30648d0bc965Smrg		eval supported=\$$cacheid
30658d0bc965Smrg		AC_MSG_RESULT([$supported])
30668d0bc965Smrg		if test "$supported" = "yes" ; then
30678d0bc965Smrg			$1="$$1 ]flag["
30688d0bc965Smrg			found="yes"
30698d0bc965Smrg		fi
30708d0bc965Smrg	fi
30718d0bc965Smrg])
30728d0bc965Smrg]) # XORG_TESTSET_CFLAG
3073706b6b52Smrg
30748d0bc965Smrg# XORG_COMPILER_FLAGS
30758d0bc965Smrg# ---------------
30768d0bc965Smrg# Minimum version: 1.16.0
30778d0bc965Smrg#
30788d0bc965Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
30798d0bc965Smrg# arguments supported by the selected compiler which do NOT alter the generated
30808d0bc965Smrg# code.  These arguments will cause the compiler to print various warnings
30818d0bc965Smrg# during compilation AND turn a conservative set of warnings into errors.
30828d0bc965Smrg#
30838d0bc965Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
30848d0bc965Smrg# future versions of util-macros as options are added to new compilers.
30858d0bc965Smrg#
30868d0bc965SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
30878d0bc965SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3088706b6b52Smrg
30898d0bc965SmrgAC_ARG_ENABLE(selective-werror,
30908d0bc965Smrg              AS_HELP_STRING([--disable-selective-werror],
30918d0bc965Smrg                             [Turn off selective compiler errors. (default: enabled)]),
30928d0bc965Smrg              [SELECTIVE_WERROR=$enableval],
30938d0bc965Smrg              [SELECTIVE_WERROR=yes])
3094706b6b52Smrg
30958d0bc965SmrgAC_LANG_CASE(
30968d0bc965Smrg        [C], [
30978d0bc965Smrg                define([PREFIX], [C])
30988d0bc965Smrg        ],
30998d0bc965Smrg        [C++], [
31008d0bc965Smrg                define([PREFIX], [CXX])
31018d0bc965Smrg        ]
31028d0bc965Smrg)
31038d0bc965Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
31048d0bc965Smrgif test "x$SUNCC" = "xyes"; then
31058d0bc965Smrg    [BASE_]PREFIX[FLAGS]="-v"
31068d0bc965Smrgelse
31078d0bc965Smrg    [BASE_]PREFIX[FLAGS]=""
31088d0bc965Smrgfi
31093169be4bSmrg
31108d0bc965Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
31118d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
31128d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
31138d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
31148d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
31153169be4bSmrg
31168d0bc965SmrgAC_LANG_CASE(
31178d0bc965Smrg	[C], [
31188d0bc965Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
31198d0bc965Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
31208d0bc965Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
31218d0bc965Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
31228d0bc965Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
31238d0bc965Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
31248d0bc965Smrg	]
31258d0bc965Smrg)
31263169be4bSmrg
31278d0bc965Smrg# This chunk adds additional warnings that could catch undesired effects.
31288d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
31298d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
31308d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
31318d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
31328d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
31338d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
31348d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
31358bd17e5fSmrg
31368d0bc965Smrg# These are currently disabled because they are noisy.  They will be enabled
31378d0bc965Smrg# in the future once the codebase is sufficiently modernized to silence
31388d0bc965Smrg# them.  For now, I don't want them to drown out the other warnings.
31398d0bc965Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
31408d0bc965Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
31418d0bc965Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
31428bd17e5fSmrg
31430c674dbdSmrg# Turn some warnings into errors, so we don't accidentally get successful builds
31448d0bc965Smrg# when there are problems that should be fixed.
31458bd17e5fSmrg
31468d0bc965Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
31478d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
31488d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
31498d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
31508d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
31518d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
31528d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
31538d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
31548d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
31558d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
31568d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
31578d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
31588d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
31598d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
31608d0bc965Smrgelse
31618d0bc965SmrgAC_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])
31628d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
31638d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
31648d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
31658d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
31668d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
31678d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
31688d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
31698d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
31708d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
31718d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
31728d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
31738d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
31748d0bc965SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
31758d0bc965Smrgfi
31768bd17e5fSmrg
31778d0bc965SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31788d0bc965Smrg]) # XORG_COMPILER_FLAGS
31798bd17e5fSmrg
31808d0bc965Smrg# XORG_CWARNFLAGS
31818d0bc965Smrg# ---------------
31828d0bc965Smrg# Minimum version: 1.2.0
31838d0bc965Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
31848d0bc965Smrg#
31858d0bc965Smrg# Defines CWARNFLAGS to enable C compiler warnings.
31868d0bc965Smrg#
31878d0bc965Smrg# This function is deprecated because it defines -fno-strict-aliasing
31888d0bc965Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
31898d0bc965Smrg# is needed, then it should be added explicitly in the module when
31908d0bc965Smrg# it is updated to use BASE_CFLAGS.
31918d0bc965Smrg#
31928d0bc965SmrgAC_DEFUN([XORG_CWARNFLAGS], [
31938d0bc965SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
31948d0bc965SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
31958d0bc965SmrgAC_LANG_CASE(
31968d0bc965Smrg	[C], [
31978d0bc965Smrg		CWARNFLAGS="$BASE_CFLAGS"
31988d0bc965Smrg		if  test "x$GCC" = xyes ; then
31998d0bc965Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
32008d0bc965Smrg		fi
32018d0bc965Smrg		AC_SUBST(CWARNFLAGS)
32028d0bc965Smrg	]
32038d0bc965Smrg)
32048d0bc965Smrg]) # XORG_CWARNFLAGS
32058bd17e5fSmrg
32068d0bc965Smrg# XORG_STRICT_OPTION
32078d0bc965Smrg# -----------------------
32088d0bc965Smrg# Minimum version: 1.3.0
32098d0bc965Smrg#
32108d0bc965Smrg# Add configure option to enable strict compilation flags, such as treating
32118d0bc965Smrg# warnings as fatal errors.
32128d0bc965Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
32138d0bc965Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
32148d0bc965Smrg#
32158d0bc965Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
32168d0bc965Smrg# when strict compilation is unconditionally desired.
32178d0bc965SmrgAC_DEFUN([XORG_STRICT_OPTION], [
32188d0bc965SmrgAC_REQUIRE([XORG_CWARNFLAGS])
32198d0bc965SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
32208bd17e5fSmrg
32218d0bc965SmrgAC_ARG_ENABLE(strict-compilation,
32228d0bc965Smrg			  AS_HELP_STRING([--enable-strict-compilation],
32238d0bc965Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
32248d0bc965Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
32258bd17e5fSmrg
32268d0bc965SmrgAC_LANG_CASE(
32278d0bc965Smrg        [C], [
32288d0bc965Smrg                define([PREFIX], [C])
32298d0bc965Smrg        ],
32308d0bc965Smrg        [C++], [
32318d0bc965Smrg                define([PREFIX], [CXX])
32328d0bc965Smrg        ]
32338d0bc965Smrg)
3234706b6b52Smrg
32358d0bc965Smrg[STRICT_]PREFIX[FLAGS]=""
32368d0bc965SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
32378d0bc965SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
32388c4a8e55Smrg
32398d0bc965Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
32408d0bc965Smrg# activate it with -Werror, so we add it here explicitly.
32418d0bc965SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
32428bd17e5fSmrg
32438d0bc965Smrgif test "x$STRICT_COMPILE" = "xyes"; then
32448d0bc965Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
32458d0bc965Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
32468d0bc965Smrgfi
32478d0bc965SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
32488d0bc965SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32498d0bc965SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
32508d0bc965Smrg]) # XORG_STRICT_OPTION
32518bd17e5fSmrg
32520c674dbdSmrg# XORG_DEFAULT_NOCODE_OPTIONS
32530c674dbdSmrg# ---------------------------
32540c674dbdSmrg# Minimum version: 1.20.0
32550c674dbdSmrg#
32560c674dbdSmrg# Defines default options for X.Org modules which don't compile code,
32570c674dbdSmrg# such as fonts, bitmaps, cursors, and docs.
32580c674dbdSmrg#
32590c674dbdSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
32600c674dbdSmrgAC_REQUIRE([AC_PROG_INSTALL])
32610c674dbdSmrgXORG_RELEASE_VERSION
32620c674dbdSmrgXORG_CHANGELOG
32630c674dbdSmrgXORG_INSTALL
32640c674dbdSmrgXORG_MANPAGE_SECTIONS
32650c674dbdSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
32660c674dbdSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
32670c674dbdSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
32680c674dbdSmrg
32698d0bc965Smrg# XORG_DEFAULT_OPTIONS
32708d0bc965Smrg# --------------------
32718d0bc965Smrg# Minimum version: 1.3.0
32728d0bc965Smrg#
32730c674dbdSmrg# Defines default options for X.Org modules which compile code.
32748d0bc965Smrg#
32758d0bc965SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
32768d0bc965SmrgAC_REQUIRE([AC_PROG_INSTALL])
32778d0bc965SmrgXORG_COMPILER_FLAGS
32788d0bc965SmrgXORG_CWARNFLAGS
32798d0bc965SmrgXORG_STRICT_OPTION
32800c674dbdSmrgXORG_DEFAULT_NOCODE_OPTIONS
32818d0bc965Smrg]) # XORG_DEFAULT_OPTIONS
32828c4a8e55Smrg
32838d0bc965Smrg# XORG_INSTALL()
32848d0bc965Smrg# ----------------
32858d0bc965Smrg# Minimum version: 1.4.0
32868d0bc965Smrg#
32878d0bc965Smrg# Defines the variable INSTALL_CMD as the command to copy
32888d0bc965Smrg# INSTALL from $prefix/share/util-macros.
32898d0bc965Smrg#
32908d0bc965SmrgAC_DEFUN([XORG_INSTALL], [
32918d0bc965SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
32928d0bc965Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
32938d0bc965SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
32948d0bc965Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
32958d0bc965Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
32968d0bc965Smrgtouch \$(top_srcdir)/INSTALL; \
32978d0bc965Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
32988d0bc965SmrgAC_SUBST([INSTALL_CMD])
32998d0bc965Smrg]) # XORG_INSTALL
33008d0bc965Smrgdnl Copyright 2005 Red Hat, Inc
33018d0bc965Smrgdnl
33028d0bc965Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
33038d0bc965Smrgdnl documentation for any purpose is hereby granted without fee, provided that
33048d0bc965Smrgdnl the above copyright notice appear in all copies and that both that
33058d0bc965Smrgdnl copyright notice and this permission notice appear in supporting
33068d0bc965Smrgdnl documentation.
33078d0bc965Smrgdnl
33088d0bc965Smrgdnl The above copyright notice and this permission notice shall be included
33098d0bc965Smrgdnl in all copies or substantial portions of the Software.
33108d0bc965Smrgdnl
33118d0bc965Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
33128d0bc965Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33138d0bc965Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
33148d0bc965Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
33158d0bc965Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
33168d0bc965Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
33178d0bc965Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
33188d0bc965Smrgdnl
33198d0bc965Smrgdnl Except as contained in this notice, the name of the copyright holders shall
33208d0bc965Smrgdnl not be used in advertising or otherwise to promote the sale, use or
33218d0bc965Smrgdnl other dealings in this Software without prior written authorization
33228d0bc965Smrgdnl from the copyright holders.
33238d0bc965Smrgdnl
33248c4a8e55Smrg
33258d0bc965Smrg# XORG_RELEASE_VERSION
33268d0bc965Smrg# --------------------
33278d0bc965Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
33288bd17e5fSmrg
33298d0bc965SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
33308d0bc965Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
33318d0bc965Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
33328d0bc965Smrg		[Major version of this package])
33338d0bc965Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
33348d0bc965Smrg	if test "x$PVM" = "x"; then
33358d0bc965Smrg		PVM="0"
33368d0bc965Smrg	fi
33378d0bc965Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
33388d0bc965Smrg		[$PVM],
33398d0bc965Smrg		[Minor version of this package])
33408d0bc965Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
33418d0bc965Smrg	if test "x$PVP" = "x"; then
33428d0bc965Smrg		PVP="0"
33438d0bc965Smrg	fi
33448d0bc965Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
33458d0bc965Smrg		[$PVP],
33468d0bc965Smrg		[Patch version of this package])
33478d0bc965Smrg])
3348b042e37fSmrg
33498d0bc965Smrg# XORG_CHANGELOG()
33508d0bc965Smrg# ----------------
33518d0bc965Smrg# Minimum version: 1.2.0
33528d0bc965Smrg#
33538d0bc965Smrg# Defines the variable CHANGELOG_CMD as the command to generate
33548d0bc965Smrg# ChangeLog from git.
33558d0bc965Smrg#
33568d0bc965Smrg#
33578d0bc965SmrgAC_DEFUN([XORG_CHANGELOG], [
33588d0bc965SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
33598d0bc965Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
33608d0bc965Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
33618d0bc965Smrgtouch \$(top_srcdir)/ChangeLog; \
33628d0bc965Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
33638d0bc965SmrgAC_SUBST([CHANGELOG_CMD])
33648d0bc965Smrg]) # XORG_CHANGELOG
3365b042e37fSmrg
33660c674dbdSmrgm4_include([m4/libtool.m4])
33670c674dbdSmrgm4_include([m4/ltoptions.m4])
33680c674dbdSmrgm4_include([m4/ltsugar.m4])
33690c674dbdSmrgm4_include([m4/ltversion.m4])
33700c674dbdSmrgm4_include([m4/lt~obsolete.m4])
3371