aclocal.m4 revision 0ea508b1
10ea508b1Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2e6d5e4e0Smrg
30ea508b1Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
47914d74bSmrg
57914d74bSmrg# This file is free software; the Free Software Foundation
67914d74bSmrg# gives unlimited permission to copy and/or distribute it,
77914d74bSmrg# with or without modifications, as long as this notice is preserved.
87914d74bSmrg
97914d74bSmrg# This program is distributed in the hope that it will be useful,
107914d74bSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
117914d74bSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
127914d74bSmrg# PARTICULAR PURPOSE.
137914d74bSmrg
14e6d5e4e0Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15e169010aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16e169010aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
170ea508b1Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
180ea508b1Smrg[m4_warning([this file was generated for autoconf 2.72.
19e169010aSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20e169010aSmrgIf you have problems, you may need to regenerate the build system entirely.
21e6d5e4e0SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
227914d74bSmrg
230ea508b1Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
247914d74bSmrg#
250ea508b1Smrg# This file is free software; the Free Software Foundation
260ea508b1Smrg# gives unlimited permission to copy and/or distribute it,
270ea508b1Smrg# with or without modifications, as long as this notice is preserved.
287914d74bSmrg
290ea508b1Smrg# AM_AUTOMAKE_VERSION(VERSION)
300ea508b1Smrg# ----------------------------
310ea508b1Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
320ea508b1Smrg# generated from the m4 files accompanying Automake X.Y.
330ea508b1Smrg# (This private macro should not be called outside this file.)
340ea508b1SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
350ea508b1Smrg[am__api_version='1.16'
360ea508b1Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
370ea508b1Smrgdnl require some minimum version.  Point them to the right macro.
380ea508b1Smrgm4_if([$1], [1.16.5], [],
390ea508b1Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
409d0ccd10Smrg])
41e8ead290Smrg
420ea508b1Smrg# _AM_AUTOCONF_VERSION(VERSION)
439d0ccd10Smrg# -----------------------------
440ea508b1Smrg# aclocal traces this macro to find the Autoconf version.
450ea508b1Smrg# This is a private macro too.  Using m4_define simplifies
460ea508b1Smrg# the logic in aclocal, which can simply ignore this definition.
470ea508b1Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48e169010aSmrg
490ea508b1Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
500ea508b1Smrg# -------------------------------
510ea508b1Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
520ea508b1Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
530ea508b1SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
540ea508b1Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
550ea508b1Smrgm4_ifndef([AC_AUTOCONF_VERSION],
560ea508b1Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
570ea508b1Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58e6d5e4e0Smrg
590ea508b1Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
609d0ccd10Smrg
610ea508b1Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
620ea508b1Smrg#
630ea508b1Smrg# This file is free software; the Free Software Foundation
640ea508b1Smrg# gives unlimited permission to copy and/or distribute it,
650ea508b1Smrg# with or without modifications, as long as this notice is preserved.
669d0ccd10Smrg
670ea508b1Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
680ea508b1Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
690ea508b1Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
700ea508b1Smrg#
710ea508b1Smrg# Of course, Automake must honor this variable whenever it calls a
720ea508b1Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
730ea508b1Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
740ea508b1Smrg# depending on how configure is run.  This is pretty annoying, since
750ea508b1Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
760ea508b1Smrg# source directory, any form will work fine, but in subdirectories a
770ea508b1Smrg# relative path needs to be adjusted first.
780ea508b1Smrg#
790ea508b1Smrg# $ac_aux_dir/missing
800ea508b1Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
810ea508b1Smrg# $top_srcdir/$ac_aux_dir/missing
820ea508b1Smrg#    fails if $ac_aux_dir is absolute,
830ea508b1Smrg#    fails when called from a subdirectory in a VPATH build with
840ea508b1Smrg#          a relative $ac_aux_dir
850ea508b1Smrg#
860ea508b1Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
870ea508b1Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
880ea508b1Smrg# harmless because $srcdir is '.', but things will broke when you
890ea508b1Smrg# start a VPATH build or use an absolute $srcdir.
900ea508b1Smrg#
910ea508b1Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
920ea508b1Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
930ea508b1Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
940ea508b1Smrg# and then we would define $MISSING as
950ea508b1Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
960ea508b1Smrg# This will work as long as MISSING is not called from configure, because
970ea508b1Smrg# unfortunately $(top_srcdir) has no meaning in configure.
980ea508b1Smrg# However there are other variables, like CC, which are often used in
990ea508b1Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1000ea508b1Smrg#
1010ea508b1Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1020ea508b1Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1030ea508b1Smrg# configured tree to be moved without reconfiguration.
1049d0ccd10Smrg
1050ea508b1SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1060ea508b1Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1070ea508b1Smrg# Expand $ac_aux_dir to an absolute path.
1080ea508b1Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109e6d5e4e0Smrg])
110e169010aSmrg
1110ea508b1Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
1129d0ccd10Smrg
1130ea508b1Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
1140ea508b1Smrg#
1150ea508b1Smrg# This file is free software; the Free Software Foundation
1160ea508b1Smrg# gives unlimited permission to copy and/or distribute it,
1170ea508b1Smrg# with or without modifications, as long as this notice is preserved.
1189d0ccd10Smrg
1190ea508b1Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1200ea508b1Smrg# -------------------------------------
1210ea508b1Smrg# Define a conditional.
1220ea508b1SmrgAC_DEFUN([AM_CONDITIONAL],
1230ea508b1Smrg[AC_PREREQ([2.52])dnl
1240ea508b1Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1250ea508b1Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1260ea508b1SmrgAC_SUBST([$1_TRUE])dnl
1270ea508b1SmrgAC_SUBST([$1_FALSE])dnl
1280ea508b1Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1290ea508b1Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1300ea508b1Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1310ea508b1Smrgif $2; then
1320ea508b1Smrg  $1_TRUE=
1330ea508b1Smrg  $1_FALSE='#'
1340ea508b1Smrgelse
1350ea508b1Smrg  $1_TRUE='#'
1360ea508b1Smrg  $1_FALSE=
1370ea508b1Smrgfi
1380ea508b1SmrgAC_CONFIG_COMMANDS_PRE(
1390ea508b1Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1400ea508b1Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1410ea508b1SmrgUsually this means the macro was only invoked conditionally.]])
1420ea508b1Smrgfi])])
1439d0ccd10Smrg
1440ea508b1Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
145e8ead290Smrg#
1460ea508b1Smrg# This file is free software; the Free Software Foundation
1470ea508b1Smrg# gives unlimited permission to copy and/or distribute it,
1480ea508b1Smrg# with or without modifications, as long as this notice is preserved.
1497914d74bSmrg
1507914d74bSmrg
1510ea508b1Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1520ea508b1Smrg# written in clear, in which case automake, when reading aclocal.m4,
1530ea508b1Smrg# will think it sees a *use*, and therefore will trigger all it's
1540ea508b1Smrg# C support machinery.  Also note that it means that autoscan, seeing
1550ea508b1Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156e169010aSmrg
1577914d74bSmrg
1580ea508b1Smrg# _AM_DEPENDENCIES(NAME)
1590ea508b1Smrg# ----------------------
1600ea508b1Smrg# See how the compiler implements dependency checking.
1610ea508b1Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1620ea508b1Smrg# We try a few techniques and use that to set a single cache variable.
1630ea508b1Smrg#
1640ea508b1Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1650ea508b1Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1660ea508b1Smrg# dependency, and given that the user is not expected to run this macro,
1670ea508b1Smrg# just rely on AC_PROG_CC.
1680ea508b1SmrgAC_DEFUN([_AM_DEPENDENCIES],
1690ea508b1Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1700ea508b1SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1710ea508b1SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1720ea508b1SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1737914d74bSmrg
1740ea508b1Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1750ea508b1Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1760ea508b1Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1770ea508b1Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1780ea508b1Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1790ea508b1Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1800ea508b1Smrg                    [depcc="$$1"   am_compiler_list=])
1817914d74bSmrg
1820ea508b1SmrgAC_CACHE_CHECK([dependency style of $depcc],
1830ea508b1Smrg               [am_cv_$1_dependencies_compiler_type],
1840ea508b1Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1850ea508b1Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
1860ea508b1Smrg  # making bogus files that we don't know about and never remove.  For
1870ea508b1Smrg  # instance it was reported that on HP-UX the gcc test will end up
1880ea508b1Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1890ea508b1Smrg  # in D".
1900ea508b1Smrg  rm -rf conftest.dir
1910ea508b1Smrg  mkdir conftest.dir
1920ea508b1Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1930ea508b1Smrg  # using a relative directory.
1940ea508b1Smrg  cp "$am_depcomp" conftest.dir
1950ea508b1Smrg  cd conftest.dir
1960ea508b1Smrg  # We will build objects and dependencies in a subdirectory because
1970ea508b1Smrg  # it helps to detect inapplicable dependency modes.  For instance
1980ea508b1Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1990ea508b1Smrg  # side effect of compilation, but ICC will put the dependencies in
2000ea508b1Smrg  # the current directory while Tru64 will put them in the object
2010ea508b1Smrg  # directory.
2020ea508b1Smrg  mkdir sub
2037914d74bSmrg
2040ea508b1Smrg  am_cv_$1_dependencies_compiler_type=none
2050ea508b1Smrg  if test "$am_compiler_list" = ""; then
2060ea508b1Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2070ea508b1Smrg  fi
2080ea508b1Smrg  am__universal=false
2090ea508b1Smrg  m4_case([$1], [CC],
2100ea508b1Smrg    [case " $depcc " in #(
2110ea508b1Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2120ea508b1Smrg     esac],
2130ea508b1Smrg    [CXX],
2140ea508b1Smrg    [case " $depcc " in #(
2150ea508b1Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2160ea508b1Smrg     esac])
2177914d74bSmrg
2180ea508b1Smrg  for depmode in $am_compiler_list; do
2190ea508b1Smrg    # Setup a source with many dependencies, because some compilers
2200ea508b1Smrg    # like to wrap large dependency lists on column 80 (with \), and
2210ea508b1Smrg    # we should not choose a depcomp mode which is confused by this.
2220ea508b1Smrg    #
2230ea508b1Smrg    # We need to recreate these files for each test, as the compiler may
2240ea508b1Smrg    # overwrite some of them when testing with obscure command lines.
2250ea508b1Smrg    # This happens at least with the AIX C compiler.
2260ea508b1Smrg    : > sub/conftest.c
2270ea508b1Smrg    for i in 1 2 3 4 5 6; do
2280ea508b1Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2290ea508b1Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2300ea508b1Smrg      # Solaris 10 /bin/sh.
2310ea508b1Smrg      echo '/* dummy */' > sub/conftst$i.h
2320ea508b1Smrg    done
2330ea508b1Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2349d0ccd10Smrg
2350ea508b1Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2360ea508b1Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2370ea508b1Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2380ea508b1Smrg    # versions had trouble with output in subdirs.
2390ea508b1Smrg    am__obj=sub/conftest.${OBJEXT-o}
2400ea508b1Smrg    am__minus_obj="-o $am__obj"
2410ea508b1Smrg    case $depmode in
2420ea508b1Smrg    gcc)
2430ea508b1Smrg      # This depmode causes a compiler race in universal mode.
2440ea508b1Smrg      test "$am__universal" = false || continue
245e6d5e4e0Smrg      ;;
2460ea508b1Smrg    nosideeffect)
2470ea508b1Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2480ea508b1Smrg      # only be used when explicitly requested.
2490ea508b1Smrg      if test "x$enable_dependency_tracking" = xyes; then
2500ea508b1Smrg	continue
2510ea508b1Smrg      else
2520ea508b1Smrg	break
2530ea508b1Smrg      fi
2549d0ccd10Smrg      ;;
2550ea508b1Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2560ea508b1Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2570ea508b1Smrg      # not run yet.  These depmodes are late enough in the game, and
2580ea508b1Smrg      # so weak that their functioning should not be impacted.
2590ea508b1Smrg      am__obj=conftest.${OBJEXT-o}
2600ea508b1Smrg      am__minus_obj=
2619d0ccd10Smrg      ;;
2620ea508b1Smrg    none) break ;;
2639d0ccd10Smrg    esac
2640ea508b1Smrg    if depmode=$depmode \
2650ea508b1Smrg       source=sub/conftest.c object=$am__obj \
2660ea508b1Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2670ea508b1Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2680ea508b1Smrg         >/dev/null 2>conftest.err &&
2690ea508b1Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2700ea508b1Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2710ea508b1Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2720ea508b1Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2730ea508b1Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2740ea508b1Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2750ea508b1Smrg      # that says an option was ignored or not supported.
2760ea508b1Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2770ea508b1Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2780ea508b1Smrg      # The diagnosis changed in icc 8.0:
2790ea508b1Smrg      #   icc: Command line remark: option '-MP' not supported
2800ea508b1Smrg      if (grep 'ignoring option' conftest.err ||
2810ea508b1Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2820ea508b1Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2830ea508b1Smrg        break
2840ea508b1Smrg      fi
2859d0ccd10Smrg    fi
2860ea508b1Smrg  done
2877914d74bSmrg
2880ea508b1Smrg  cd ..
2890ea508b1Smrg  rm -rf conftest.dir
2900ea508b1Smrgelse
2910ea508b1Smrg  am_cv_$1_dependencies_compiler_type=none
2929d0ccd10Smrgfi
2930ea508b1Smrg])
2940ea508b1SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2950ea508b1SmrgAM_CONDITIONAL([am__fastdep$1], [
2960ea508b1Smrg  test "x$enable_dependency_tracking" != xno \
2970ea508b1Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2980ea508b1Smrg])
299e8ead290Smrg
3007914d74bSmrg
3010ea508b1Smrg# AM_SET_DEPDIR
3020ea508b1Smrg# -------------
3030ea508b1Smrg# Choose a directory name for dependency files.
3040ea508b1Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3050ea508b1SmrgAC_DEFUN([AM_SET_DEPDIR],
3060ea508b1Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3070ea508b1SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3080ea508b1Smrg])
3097914d74bSmrg
310e8ead290Smrg
3110ea508b1Smrg# AM_DEP_TRACK
3120ea508b1Smrg# ------------
3130ea508b1SmrgAC_DEFUN([AM_DEP_TRACK],
3140ea508b1Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3150ea508b1SmrgAS_HELP_STRING(
3160ea508b1Smrg  [--enable-dependency-tracking],
3170ea508b1Smrg  [do not reject slow dependency extractors])
3180ea508b1SmrgAS_HELP_STRING(
3190ea508b1Smrg  [--disable-dependency-tracking],
3200ea508b1Smrg  [speeds up one-time build])])
3210ea508b1Smrgif test "x$enable_dependency_tracking" != xno; then
3220ea508b1Smrg  am_depcomp="$ac_aux_dir/depcomp"
3230ea508b1Smrg  AMDEPBACKSLASH='\'
3240ea508b1Smrg  am__nodep='_no'
3259d0ccd10Smrgfi
3260ea508b1SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3270ea508b1SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3280ea508b1Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3290ea508b1SmrgAC_SUBST([am__nodep])dnl
3300ea508b1Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3310ea508b1Smrg])
332e6d5e4e0Smrg
3330ea508b1Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334e6d5e4e0Smrg
3350ea508b1Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
3360ea508b1Smrg#
3370ea508b1Smrg# This file is free software; the Free Software Foundation
3380ea508b1Smrg# gives unlimited permission to copy and/or distribute it,
3390ea508b1Smrg# with or without modifications, as long as this notice is preserved.
340e8ead290Smrg
3410ea508b1Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3420ea508b1Smrg# ------------------------------
3430ea508b1SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3440ea508b1Smrg[{
3450ea508b1Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3460ea508b1Smrg  # are listed without --file.  Let's play safe and only enable the eval
3470ea508b1Smrg  # if we detect the quoting.
3480ea508b1Smrg  # TODO: see whether this extra hack can be removed once we start
3490ea508b1Smrg  # requiring Autoconf 2.70 or later.
3500ea508b1Smrg  AS_CASE([$CONFIG_FILES],
3510ea508b1Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
3520ea508b1Smrg          [*], [set x $CONFIG_FILES])
3530ea508b1Smrg  shift
3540ea508b1Smrg  # Used to flag and report bootstrapping failures.
3550ea508b1Smrg  am_rc=0
3560ea508b1Smrg  for am_mf
3570ea508b1Smrg  do
3580ea508b1Smrg    # Strip MF so we end up with the name of the file.
3590ea508b1Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
3600ea508b1Smrg    # Check whether this is an Automake generated Makefile which includes
3610ea508b1Smrg    # dependency-tracking related rules and includes.
3620ea508b1Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
3630ea508b1Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3640ea508b1Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
3650ea508b1Smrg      || continue
3660ea508b1Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
3670ea508b1Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
3680ea508b1Smrg    AM_RUN_LOG([cd "$am_dirpart" \
3690ea508b1Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
3700ea508b1Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
3710ea508b1Smrg  done
3720ea508b1Smrg  if test $am_rc -ne 0; then
3730ea508b1Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
3740ea508b1Smrg    for automatic dependency tracking.  If GNU make was not used, consider
3750ea508b1Smrg    re-running the configure script with MAKE="gmake" (or whatever is
3760ea508b1Smrg    necessary).  You can also try re-running configure with the
3770ea508b1Smrg    '--disable-dependency-tracking' option to at least be able to build
3780ea508b1Smrg    the package (albeit without support for automatic dependency tracking).])
3790ea508b1Smrg  fi
3800ea508b1Smrg  AS_UNSET([am_dirpart])
3810ea508b1Smrg  AS_UNSET([am_filepart])
3820ea508b1Smrg  AS_UNSET([am_mf])
3830ea508b1Smrg  AS_UNSET([am_rc])
3840ea508b1Smrg  rm -f conftest-deps.mk
3850ea508b1Smrg}
3860ea508b1Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3877914d74bSmrg
388e8ead290Smrg
3890ea508b1Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3900ea508b1Smrg# -----------------------------
3910ea508b1Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
3920ea508b1Smrg#
3930ea508b1Smrg# This code is only required when automatic dependency tracking is enabled.
3940ea508b1Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
3950ea508b1Smrg# order to bootstrap the dependency handling code.
3960ea508b1SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3970ea508b1Smrg[AC_CONFIG_COMMANDS([depfiles],
3980ea508b1Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3990ea508b1Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400e8ead290Smrg
4010ea508b1Smrg# Do all the work for Automake.                             -*- Autoconf -*-
4027914d74bSmrg
4030ea508b1Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4040ea508b1Smrg#
4050ea508b1Smrg# This file is free software; the Free Software Foundation
4060ea508b1Smrg# gives unlimited permission to copy and/or distribute it,
4070ea508b1Smrg# with or without modifications, as long as this notice is preserved.
408c63293b5Smrg
4090ea508b1Smrg# This macro actually does too much.  Some checks are only needed if
4100ea508b1Smrg# your package does certain things.  But this isn't really a big deal.
411c63293b5Smrg
4120ea508b1Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4130ea508b1Smrgm4_define([AC_PROG_CC],
4140ea508b1Smrgm4_defn([AC_PROG_CC])
4150ea508b1Smrg[_AM_PROG_CC_C_O
416e6d5e4e0Smrg])
417e6d5e4e0Smrg
4180ea508b1Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4190ea508b1Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4200ea508b1Smrg# -----------------------------------------------
4210ea508b1Smrg# The call with PACKAGE and VERSION arguments is the old style
4220ea508b1Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4230ea508b1Smrg# and VERSION should now be passed to AC_INIT and removed from
4240ea508b1Smrg# the call to AM_INIT_AUTOMAKE.
4250ea508b1Smrg# We support both call styles for the transition.  After
4260ea508b1Smrg# the next Automake release, Autoconf can make the AC_INIT
4270ea508b1Smrg# arguments mandatory, and then we can depend on a new Autoconf
4280ea508b1Smrg# release and drop the old call support.
4290ea508b1SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4300ea508b1Smrg[AC_PREREQ([2.65])dnl
4310ea508b1Smrgm4_ifdef([_$0_ALREADY_INIT],
4320ea508b1Smrg  [m4_fatal([$0 expanded multiple times
4330ea508b1Smrg]m4_defn([_$0_ALREADY_INIT]))],
4340ea508b1Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
4350ea508b1Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4360ea508b1Smrgdnl the ones we care about.
4370ea508b1Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4380ea508b1SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4390ea508b1SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4400ea508b1Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4410ea508b1Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4420ea508b1Smrg  # is not polluted with repeated "-I."
4430ea508b1Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4440ea508b1Smrg  # test to see if srcdir already configured
4450ea508b1Smrg  if test -f $srcdir/config.status; then
4460ea508b1Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4479d0ccd10Smrg  fi
4480ea508b1Smrgfi
449e6d5e4e0Smrg
4500ea508b1Smrg# test whether we have cygpath
4510ea508b1Smrgif test -z "$CYGPATH_W"; then
4520ea508b1Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4530ea508b1Smrg    CYGPATH_W='cygpath -w'
4540ea508b1Smrg  else
4550ea508b1Smrg    CYGPATH_W=echo
4569d0ccd10Smrg  fi
4579d0ccd10Smrgfi
4580ea508b1SmrgAC_SUBST([CYGPATH_W])
459e6d5e4e0Smrg
4600ea508b1Smrg# Define the identity of the package.
4610ea508b1Smrgdnl Distinguish between old-style and new-style calls.
4620ea508b1Smrgm4_ifval([$2],
4630ea508b1Smrg[AC_DIAGNOSE([obsolete],
4640ea508b1Smrg             [$0: two- and three-arguments forms are deprecated.])
4650ea508b1Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4660ea508b1Smrg AC_SUBST([PACKAGE], [$1])dnl
4670ea508b1Smrg AC_SUBST([VERSION], [$2])],
4680ea508b1Smrg[_AM_SET_OPTIONS([$1])dnl
4690ea508b1Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4700ea508b1Smrgm4_if(
4710ea508b1Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4720ea508b1Smrg  [ok:ok],,
4730ea508b1Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4740ea508b1Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4750ea508b1Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476c63293b5Smrg
4770ea508b1Smrg_AM_IF_OPTION([no-define],,
4780ea508b1Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4790ea508b1Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4807914d74bSmrg
4810ea508b1Smrg# Some tools Automake needs.
4820ea508b1SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4830ea508b1SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4840ea508b1SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4850ea508b1SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4860ea508b1SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4870ea508b1SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4880ea508b1SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4890ea508b1SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4900ea508b1SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4910ea508b1SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4920ea508b1Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4930ea508b1Smrg# dies out for good.  For more background, see:
4940ea508b1Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4950ea508b1Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4960ea508b1SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
4970ea508b1Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
4980ea508b1Smrg# system "awk" is bad on some platforms.
4990ea508b1SmrgAC_REQUIRE([AC_PROG_AWK])dnl
5000ea508b1SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5010ea508b1SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5020ea508b1Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5030ea508b1Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5040ea508b1Smrg			     [_AM_PROG_TAR([v7])])])
5050ea508b1Smrg_AM_IF_OPTION([no-dependencies],,
5060ea508b1Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5070ea508b1Smrg		  [_AM_DEPENDENCIES([CC])],
5080ea508b1Smrg		  [m4_define([AC_PROG_CC],
5090ea508b1Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5100ea508b1SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5110ea508b1Smrg		  [_AM_DEPENDENCIES([CXX])],
5120ea508b1Smrg		  [m4_define([AC_PROG_CXX],
5130ea508b1Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5140ea508b1SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5150ea508b1Smrg		  [_AM_DEPENDENCIES([OBJC])],
5160ea508b1Smrg		  [m4_define([AC_PROG_OBJC],
5170ea508b1Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5180ea508b1SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5190ea508b1Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5200ea508b1Smrg		  [m4_define([AC_PROG_OBJCXX],
5210ea508b1Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5220ea508b1Smrg])
5230ea508b1Smrg# Variables for tags utilities; see am/tags.am
5240ea508b1Smrgif test -z "$CTAGS"; then
5250ea508b1Smrg  CTAGS=ctags
5260ea508b1Smrgfi
5270ea508b1SmrgAC_SUBST([CTAGS])
5280ea508b1Smrgif test -z "$ETAGS"; then
5290ea508b1Smrg  ETAGS=etags
5309d0ccd10Smrgfi
5310ea508b1SmrgAC_SUBST([ETAGS])
5320ea508b1Smrgif test -z "$CSCOPE"; then
5330ea508b1Smrg  CSCOPE=cscope
5340ea508b1Smrgfi
5350ea508b1SmrgAC_SUBST([CSCOPE])
5367914d74bSmrg
5370ea508b1SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5380ea508b1Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5390ea508b1Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5400ea508b1Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5410ea508b1SmrgAC_CONFIG_COMMANDS_PRE(dnl
5420ea508b1Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5430ea508b1Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5447914d74bSmrg
5450ea508b1Smrg# POSIX will say in a future version that running "rm -f" with no argument
5460ea508b1Smrg# is OK; and we want to be able to make that assumption in our Makefile
5470ea508b1Smrg# recipes.  So use an aggressive probe to check that the usage we want is
5480ea508b1Smrg# actually supported "in the wild" to an acceptable degree.
5490ea508b1Smrg# See automake bug#10828.
5500ea508b1Smrg# To make any issue more visible, cause the running configure to be aborted
5510ea508b1Smrg# by default if the 'rm' program in use doesn't match our expectations; the
5520ea508b1Smrg# user can still override this though.
5530ea508b1Smrgif rm -f && rm -fr && rm -rf; then : OK; else
5540ea508b1Smrg  cat >&2 <<'END'
5550ea508b1SmrgOops!
5567914d74bSmrg
5570ea508b1SmrgYour 'rm' program seems unable to run without file operands specified
5580ea508b1Smrgon the command line, even when the '-f' option is present.  This is contrary
5590ea508b1Smrgto the behaviour of most rm programs out there, and not conforming with
5600ea508b1Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5617914d74bSmrg
5620ea508b1SmrgPlease tell bug-automake@gnu.org about your system, including the value
5630ea508b1Smrgof your $PATH and any error possibly output before this message.  This
5640ea508b1Smrgcan help us improve future automake versions.
5657914d74bSmrg
5660ea508b1SmrgEND
5670ea508b1Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5680ea508b1Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5690ea508b1Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5700ea508b1Smrg    echo >&2
5710ea508b1Smrg  else
5720ea508b1Smrg    cat >&2 <<'END'
5730ea508b1SmrgAborting the configuration process, to ensure you take notice of the issue.
5747914d74bSmrg
5750ea508b1SmrgYou can download and install GNU coreutils to get an 'rm' implementation
5760ea508b1Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
5777914d74bSmrg
5780ea508b1SmrgIf you want to complete the configuration process using your problematic
5790ea508b1Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5800ea508b1Smrgto "yes", and re-run configure.
5817914d74bSmrg
5820ea508b1SmrgEND
5830ea508b1Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5849d0ccd10Smrg  fi
5859d0ccd10Smrgfi
5860ea508b1Smrgdnl The trailing newline in this macro's definition is deliberate, for
5870ea508b1Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5880ea508b1Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5890ea508b1Smrg])
590e6d5e4e0Smrg
5910ea508b1Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5920ea508b1Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5930ea508b1Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5940ea508b1Smrgm4_define([_AC_COMPILER_EXEEXT],
5950ea508b1Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596e6d5e4e0Smrg
5970ea508b1Smrg# When config.status generates a header, we must update the stamp-h file.
5980ea508b1Smrg# This file resides in the same directory as the config header
5990ea508b1Smrg# that is generated.  The stamp files are numbered to have different names.
6007914d74bSmrg
6010ea508b1Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
6020ea508b1Smrg# loop where config.status creates the headers, so we can generate
6030ea508b1Smrg# our stamp files there.
6040ea508b1SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
6050ea508b1Smrg[# Compute $1's index in $config_headers.
6060ea508b1Smrg_am_arg=$1
6070ea508b1Smrg_am_stamp_count=1
6080ea508b1Smrgfor _am_header in $config_headers :; do
6090ea508b1Smrg  case $_am_header in
6100ea508b1Smrg    $_am_arg | $_am_arg:* )
6110ea508b1Smrg      break ;;
6120ea508b1Smrg    * )
6130ea508b1Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6140ea508b1Smrg  esac
6150ea508b1Smrgdone
6160ea508b1Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617e6d5e4e0Smrg
6180ea508b1Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6190ea508b1Smrg#
6200ea508b1Smrg# This file is free software; the Free Software Foundation
6210ea508b1Smrg# gives unlimited permission to copy and/or distribute it,
6220ea508b1Smrg# with or without modifications, as long as this notice is preserved.
623e6d5e4e0Smrg
6240ea508b1Smrg# AM_PROG_INSTALL_SH
6250ea508b1Smrg# ------------------
6260ea508b1Smrg# Define $install_sh.
6270ea508b1SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6280ea508b1Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6290ea508b1Smrgif test x"${install_sh+set}" != xset; then
6300ea508b1Smrg  case $am_aux_dir in
6310ea508b1Smrg  *\ * | *\	*)
6320ea508b1Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6339d0ccd10Smrg  *)
6340ea508b1Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6359d0ccd10Smrg  esac
636e6d5e4e0Smrgfi
6370ea508b1SmrgAC_SUBST([install_sh])])
638e169010aSmrg
6390ea508b1Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
6400ea508b1Smrg#
6410ea508b1Smrg# This file is free software; the Free Software Foundation
6420ea508b1Smrg# gives unlimited permission to copy and/or distribute it,
6430ea508b1Smrg# with or without modifications, as long as this notice is preserved.
644e169010aSmrg
6450ea508b1Smrg# Check whether the underlying file-system supports filenames
6460ea508b1Smrg# with a leading dot.  For instance MS-DOS doesn't.
6470ea508b1SmrgAC_DEFUN([AM_SET_LEADING_DOT],
6480ea508b1Smrg[rm -rf .tst 2>/dev/null
6490ea508b1Smrgmkdir .tst 2>/dev/null
6500ea508b1Smrgif test -d .tst; then
6510ea508b1Smrg  am__leading_dot=.
6529d0ccd10Smrgelse
6530ea508b1Smrg  am__leading_dot=_
6549d0ccd10Smrgfi
6550ea508b1Smrgrmdir .tst 2>/dev/null
6560ea508b1SmrgAC_SUBST([am__leading_dot])])
6577914d74bSmrg
6580ea508b1Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6597914d74bSmrg
6600ea508b1Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6610ea508b1Smrg#
6620ea508b1Smrg# This file is free software; the Free Software Foundation
6630ea508b1Smrg# gives unlimited permission to copy and/or distribute it,
6640ea508b1Smrg# with or without modifications, as long as this notice is preserved.
665e8ead290Smrg
6660ea508b1Smrg# AM_MAKE_INCLUDE()
6670ea508b1Smrg# -----------------
6680ea508b1Smrg# Check whether make has an 'include' directive that can support all
6690ea508b1Smrg# the idioms we need for our automatic dependency tracking code.
6700ea508b1SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6710ea508b1Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
6720ea508b1Smrgcat > confinc.mk << 'END'
6730ea508b1Smrgam__doit:
6740ea508b1Smrg	@echo this is the am__doit target >confinc.out
6750ea508b1Smrg.PHONY: am__doit
6760ea508b1SmrgEND
6770ea508b1Smrgam__include="#"
6780ea508b1Smrgam__quote=
6790ea508b1Smrg# BSD make does it like this.
6800ea508b1Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
6810ea508b1Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
6820ea508b1Smrgecho 'include confinc.mk # ignored' > confmf.GNU
6830ea508b1Smrg_am_result=no
6840ea508b1Smrgfor s in GNU BSD; do
6850ea508b1Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
6860ea508b1Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
6870ea508b1Smrg      ['0:this is the am__doit target'],
6880ea508b1Smrg      [AS_CASE([$s],
6890ea508b1Smrg          [BSD], [am__include='.include' am__quote='"'],
6900ea508b1Smrg          [am__include='include' am__quote=''])])
6910ea508b1Smrg  if test "$am__include" != "#"; then
6920ea508b1Smrg    _am_result="yes ($s style)"
6930ea508b1Smrg    break
694e169010aSmrg  fi
6950ea508b1Smrgdone
6960ea508b1Smrgrm -f confinc.* confmf.*
6970ea508b1SmrgAC_MSG_RESULT([${_am_result}])
6980ea508b1SmrgAC_SUBST([am__include])])
6990ea508b1SmrgAC_SUBST([am__quote])])
7007914d74bSmrg
7010ea508b1Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
7027914d74bSmrg
7030ea508b1Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
7040ea508b1Smrg#
7050ea508b1Smrg# This file is free software; the Free Software Foundation
7060ea508b1Smrg# gives unlimited permission to copy and/or distribute it,
7070ea508b1Smrg# with or without modifications, as long as this notice is preserved.
7087914d74bSmrg
7090ea508b1Smrg# AM_MISSING_PROG(NAME, PROGRAM)
7100ea508b1Smrg# ------------------------------
7110ea508b1SmrgAC_DEFUN([AM_MISSING_PROG],
7120ea508b1Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7130ea508b1Smrg$1=${$1-"${am_missing_run}$2"}
7140ea508b1SmrgAC_SUBST($1)])
7157914d74bSmrg
7160ea508b1Smrg# AM_MISSING_HAS_RUN
7170ea508b1Smrg# ------------------
7180ea508b1Smrg# Define MISSING if not defined so far and test if it is modern enough.
7190ea508b1Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7200ea508b1SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7210ea508b1Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7220ea508b1SmrgAC_REQUIRE_AUX_FILE([missing])dnl
7230ea508b1Smrgif test x"${MISSING+set}" != xset; then
7240ea508b1Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
725e6d5e4e0Smrgfi
7260ea508b1Smrg# Use eval to expand $SHELL
7270ea508b1Smrgif eval "$MISSING --is-lightweight"; then
7280ea508b1Smrg  am_missing_run="$MISSING "
7299d0ccd10Smrgelse
7300ea508b1Smrg  am_missing_run=
7310ea508b1Smrg  AC_MSG_WARN(['missing' script is too old or missing])
7329d0ccd10Smrgfi
7330ea508b1Smrg])
7347914d74bSmrg
7350ea508b1Smrg# Helper functions for option handling.                     -*- Autoconf -*-
7367914d74bSmrg
7370ea508b1Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
7380ea508b1Smrg#
7390ea508b1Smrg# This file is free software; the Free Software Foundation
7400ea508b1Smrg# gives unlimited permission to copy and/or distribute it,
7410ea508b1Smrg# with or without modifications, as long as this notice is preserved.
7427914d74bSmrg
7430ea508b1Smrg# _AM_MANGLE_OPTION(NAME)
7440ea508b1Smrg# -----------------------
7450ea508b1SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7460ea508b1Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7477914d74bSmrg
7480ea508b1Smrg# _AM_SET_OPTION(NAME)
7490ea508b1Smrg# --------------------
7500ea508b1Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7510ea508b1SmrgAC_DEFUN([_AM_SET_OPTION],
7520ea508b1Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7537914d74bSmrg
7540ea508b1Smrg# _AM_SET_OPTIONS(OPTIONS)
7550ea508b1Smrg# ------------------------
7560ea508b1Smrg# OPTIONS is a space-separated list of Automake options.
7570ea508b1SmrgAC_DEFUN([_AM_SET_OPTIONS],
7580ea508b1Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
759e169010aSmrg
7600ea508b1Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7610ea508b1Smrg# -------------------------------------------
7620ea508b1Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7630ea508b1SmrgAC_DEFUN([_AM_IF_OPTION],
7640ea508b1Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
765e8ead290Smrg
7660ea508b1Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
7670ea508b1Smrg#
7680ea508b1Smrg# This file is free software; the Free Software Foundation
7690ea508b1Smrg# gives unlimited permission to copy and/or distribute it,
7700ea508b1Smrg# with or without modifications, as long as this notice is preserved.
771e8ead290Smrg
7720ea508b1Smrg# _AM_PROG_CC_C_O
7730ea508b1Smrg# ---------------
7740ea508b1Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7750ea508b1Smrg# to automatically call this.
7760ea508b1SmrgAC_DEFUN([_AM_PROG_CC_C_O],
7770ea508b1Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7780ea508b1SmrgAC_REQUIRE_AUX_FILE([compile])dnl
7790ea508b1SmrgAC_LANG_PUSH([C])dnl
7800ea508b1SmrgAC_CACHE_CHECK(
7810ea508b1Smrg  [whether $CC understands -c and -o together],
7820ea508b1Smrg  [am_cv_prog_cc_c_o],
7830ea508b1Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7840ea508b1Smrg  # Make sure it works both with $CC and with simple cc.
7850ea508b1Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7860ea508b1Smrg  # compilers refuse to overwrite an existing .o file with -o,
7870ea508b1Smrg  # though they will create one.
7880ea508b1Smrg  am_cv_prog_cc_c_o=yes
7890ea508b1Smrg  for am_i in 1 2; do
7900ea508b1Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7910ea508b1Smrg         && test -f conftest2.$ac_objext; then
7920ea508b1Smrg      : OK
793e8ead290Smrg    else
7940ea508b1Smrg      am_cv_prog_cc_c_o=no
795e6d5e4e0Smrg      break
796e6d5e4e0Smrg    fi
797e6d5e4e0Smrg  done
7980ea508b1Smrg  rm -f core conftest*
7990ea508b1Smrg  unset am_i])
8000ea508b1Smrgif test "$am_cv_prog_cc_c_o" != yes; then
8010ea508b1Smrg   # Losing compiler, so override with the script.
8020ea508b1Smrg   # FIXME: It is wrong to rewrite CC.
8030ea508b1Smrg   # But if we don't then we get into trouble of one sort or another.
8040ea508b1Smrg   # A longer-term fix would be to have automake use am__CC in this case,
8050ea508b1Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8060ea508b1Smrg   CC="$am_aux_dir/compile $CC"
807e6d5e4e0Smrgfi
8080ea508b1SmrgAC_LANG_POP([C])])
8099d0ccd10Smrg
8100ea508b1Smrg# For backward compatibility.
8110ea508b1SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8129d0ccd10Smrg
8130ea508b1Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
8140ea508b1Smrg#
8150ea508b1Smrg# This file is free software; the Free Software Foundation
8160ea508b1Smrg# gives unlimited permission to copy and/or distribute it,
8170ea508b1Smrg# with or without modifications, as long as this notice is preserved.
8189d0ccd10Smrg
8190ea508b1Smrg# AM_RUN_LOG(COMMAND)
8200ea508b1Smrg# -------------------
8210ea508b1Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8220ea508b1Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8230ea508b1SmrgAC_DEFUN([AM_RUN_LOG],
8240ea508b1Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8250ea508b1Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8260ea508b1Smrg   ac_status=$?
8270ea508b1Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8280ea508b1Smrg   (exit $ac_status); }])
8297914d74bSmrg
8300ea508b1Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
831e8ead290Smrg
8320ea508b1Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
8330ea508b1Smrg#
8340ea508b1Smrg# This file is free software; the Free Software Foundation
8350ea508b1Smrg# gives unlimited permission to copy and/or distribute it,
8360ea508b1Smrg# with or without modifications, as long as this notice is preserved.
837e8ead290Smrg
8380ea508b1Smrg# AM_SANITY_CHECK
8390ea508b1Smrg# ---------------
8400ea508b1SmrgAC_DEFUN([AM_SANITY_CHECK],
8410ea508b1Smrg[AC_MSG_CHECKING([whether build environment is sane])
8420ea508b1Smrg# Reject unsafe characters in $srcdir or the absolute working directory
8430ea508b1Smrg# name.  Accept space and tab only in the latter.
8440ea508b1Smrgam_lf='
8450ea508b1Smrg'
8460ea508b1Smrgcase `pwd` in
8470ea508b1Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8480ea508b1Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8490ea508b1Smrgesac
8500ea508b1Smrgcase $srcdir in
8510ea508b1Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8520ea508b1Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8530ea508b1Smrgesac
854e8ead290Smrg
8550ea508b1Smrg# Do 'set' in a subshell so we don't clobber the current shell's
8560ea508b1Smrg# arguments.  Must try -L first in case configure is actually a
8570ea508b1Smrg# symlink; some systems play weird games with the mod time of symlinks
8580ea508b1Smrg# (eg FreeBSD returns the mod time of the symlink's containing
8590ea508b1Smrg# directory).
8600ea508b1Smrgif (
8610ea508b1Smrg   am_has_slept=no
8620ea508b1Smrg   for am_try in 1 2; do
8630ea508b1Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8640ea508b1Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8650ea508b1Smrg     if test "$[*]" = "X"; then
8660ea508b1Smrg	# -L didn't work.
8670ea508b1Smrg	set X `ls -t "$srcdir/configure" conftest.file`
8680ea508b1Smrg     fi
8690ea508b1Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
8700ea508b1Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8717914d74bSmrg
8720ea508b1Smrg	# If neither matched, then we have a broken ls.  This can happen
8730ea508b1Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
8740ea508b1Smrg	# broken ls alias from the environment.  This has actually
8750ea508b1Smrg	# happened.  Such a system could not be considered "sane".
8760ea508b1Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8770ea508b1Smrg  alias in your environment])
8780ea508b1Smrg     fi
8790ea508b1Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8800ea508b1Smrg       break
8810ea508b1Smrg     fi
8820ea508b1Smrg     # Just in case.
8830ea508b1Smrg     sleep 1
8840ea508b1Smrg     am_has_slept=yes
8850ea508b1Smrg   done
8860ea508b1Smrg   test "$[2]" = conftest.file
8870ea508b1Smrg   )
8880ea508b1Smrgthen
8890ea508b1Smrg   # Ok.
8900ea508b1Smrg   :
8910ea508b1Smrgelse
8920ea508b1Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
8930ea508b1SmrgCheck your system clock])
8940ea508b1Smrgfi
8950ea508b1SmrgAC_MSG_RESULT([yes])
8960ea508b1Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
8970ea508b1Smrg# generated files are strictly newer.
8980ea508b1Smrgam_sleep_pid=
8990ea508b1Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9000ea508b1Smrg  ( sleep 1 ) &
9010ea508b1Smrg  am_sleep_pid=$!
9020ea508b1Smrgfi
9030ea508b1SmrgAC_CONFIG_COMMANDS_PRE(
9040ea508b1Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9050ea508b1Smrg   if test -n "$am_sleep_pid"; then
9060ea508b1Smrg     # Hide warnings about reused PIDs.
9070ea508b1Smrg     wait $am_sleep_pid 2>/dev/null
9080ea508b1Smrg   fi
9090ea508b1Smrg   AC_MSG_RESULT([done])])
9100ea508b1Smrgrm -f conftest.file
911e8ead290Smrg])
912e8ead290Smrg
9130ea508b1Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
9140ea508b1Smrg#
9150ea508b1Smrg# This file is free software; the Free Software Foundation
9160ea508b1Smrg# gives unlimited permission to copy and/or distribute it,
9170ea508b1Smrg# with or without modifications, as long as this notice is preserved.
9187914d74bSmrg
9190ea508b1Smrg# AM_SILENT_RULES([DEFAULT])
9200ea508b1Smrg# --------------------------
9210ea508b1Smrg# Enable less verbose build rules; with the default set to DEFAULT
9220ea508b1Smrg# ("yes" being less verbose, "no" or empty being verbose).
9230ea508b1SmrgAC_DEFUN([AM_SILENT_RULES],
9240ea508b1Smrg[AC_ARG_ENABLE([silent-rules], [dnl
9250ea508b1SmrgAS_HELP_STRING(
9260ea508b1Smrg  [--enable-silent-rules],
9270ea508b1Smrg  [less verbose build output (undo: "make V=1")])
9280ea508b1SmrgAS_HELP_STRING(
9290ea508b1Smrg  [--disable-silent-rules],
9300ea508b1Smrg  [verbose build output (undo: "make V=0")])dnl
9310ea508b1Smrg])
9320ea508b1Smrgcase $enable_silent_rules in @%:@ (((
9330ea508b1Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
9340ea508b1Smrg   no) AM_DEFAULT_VERBOSITY=1;;
9350ea508b1Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9360ea508b1Smrgesac
9370ea508b1Smrgdnl
9380ea508b1Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9390ea508b1Smrgdnl do not support nested variable expansions.
9400ea508b1Smrgdnl See automake bug#9928 and bug#10237.
9410ea508b1Smrgam_make=${MAKE-make}
9420ea508b1SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9430ea508b1Smrg   [am_cv_make_support_nested_variables],
9440ea508b1Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9450ea508b1SmrgBAR0=false
9460ea508b1SmrgBAR1=true
9470ea508b1SmrgV=1
9480ea508b1Smrgam__doit:
9490ea508b1Smrg	@$(TRUE)
9500ea508b1Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9510ea508b1Smrg  am_cv_make_support_nested_variables=yes
952e6d5e4e0Smrgelse
9530ea508b1Smrg  am_cv_make_support_nested_variables=no
954e6d5e4e0Smrgfi])
9550ea508b1Smrgif test $am_cv_make_support_nested_variables = yes; then
9560ea508b1Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9570ea508b1Smrg  AM_V='$(V)'
9580ea508b1Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
959e8ead290Smrgelse
9600ea508b1Smrg  AM_V=$AM_DEFAULT_VERBOSITY
9610ea508b1Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962e8ead290Smrgfi
9630ea508b1SmrgAC_SUBST([AM_V])dnl
9640ea508b1SmrgAM_SUBST_NOTMAKE([AM_V])dnl
9650ea508b1SmrgAC_SUBST([AM_DEFAULT_V])dnl
9660ea508b1SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
9670ea508b1SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
9680ea508b1SmrgAM_BACKSLASH='\'
9690ea508b1SmrgAC_SUBST([AM_BACKSLASH])dnl
9700ea508b1Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
971e6d5e4e0Smrg])
972e6d5e4e0Smrg
9730ea508b1Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
9740ea508b1Smrg#
9750ea508b1Smrg# This file is free software; the Free Software Foundation
9760ea508b1Smrg# gives unlimited permission to copy and/or distribute it,
9770ea508b1Smrg# with or without modifications, as long as this notice is preserved.
978e6d5e4e0Smrg
9790ea508b1Smrg# AM_PROG_INSTALL_STRIP
9800ea508b1Smrg# ---------------------
9810ea508b1Smrg# One issue with vendor 'install' (even GNU) is that you can't
9820ea508b1Smrg# specify the program used to strip binaries.  This is especially
9830ea508b1Smrg# annoying in cross-compiling environments, where the build's strip
9840ea508b1Smrg# is unlikely to handle the host's binaries.
9850ea508b1Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9860ea508b1Smrg# always use install-sh in "make install-strip", and initialize
9870ea508b1Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
9880ea508b1SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9890ea508b1Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9900ea508b1Smrg# Installed binaries are usually stripped using 'strip' when the user
9910ea508b1Smrg# run "make install-strip".  However 'strip' might not be the right
9920ea508b1Smrg# tool to use in cross-compilation environments, therefore Automake
9930ea508b1Smrg# will honor the 'STRIP' environment variable to overrule this program.
9940ea508b1Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
9950ea508b1Smrgif test "$cross_compiling" != no; then
9960ea508b1Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
997e8ead290Smrgfi
9980ea508b1SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9990ea508b1SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10007914d74bSmrg
10010ea508b1Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
10020ea508b1Smrg#
10030ea508b1Smrg# This file is free software; the Free Software Foundation
10040ea508b1Smrg# gives unlimited permission to copy and/or distribute it,
10050ea508b1Smrg# with or without modifications, as long as this notice is preserved.
1006e169010aSmrg
10070ea508b1Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
10080ea508b1Smrg# ---------------------------
10090ea508b1Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10100ea508b1Smrg# This macro is traced by Automake.
10110ea508b1SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1012e6d5e4e0Smrg
10130ea508b1Smrg# AM_SUBST_NOTMAKE(VARIABLE)
10140ea508b1Smrg# --------------------------
10150ea508b1Smrg# Public sister of _AM_SUBST_NOTMAKE.
10160ea508b1SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1017e6d5e4e0Smrg
10180ea508b1Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1019e6d5e4e0Smrg
10200ea508b1Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
10210ea508b1Smrg#
10220ea508b1Smrg# This file is free software; the Free Software Foundation
10230ea508b1Smrg# gives unlimited permission to copy and/or distribute it,
10240ea508b1Smrg# with or without modifications, as long as this notice is preserved.
1025e6d5e4e0Smrg
10260ea508b1Smrg# _AM_PROG_TAR(FORMAT)
10270ea508b1Smrg# --------------------
10280ea508b1Smrg# Check how to create a tarball in format FORMAT.
10290ea508b1Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10300ea508b1Smrg#
10310ea508b1Smrg# Substitute a variable $(am__tar) that is a command
10320ea508b1Smrg# writing to stdout a FORMAT-tarball containing the directory
10330ea508b1Smrg# $tardir.
10340ea508b1Smrg#     tardir=directory && $(am__tar) > result.tar
10350ea508b1Smrg#
10360ea508b1Smrg# Substitute a variable $(am__untar) that extract such
10370ea508b1Smrg# a tarball read from stdin.
10380ea508b1Smrg#     $(am__untar) < result.tar
10390ea508b1Smrg#
10400ea508b1SmrgAC_DEFUN([_AM_PROG_TAR],
10410ea508b1Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10420ea508b1Smrg# in the wild :-(  We should find a proper way to deprecate it ...
10430ea508b1SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1044e6d5e4e0Smrg
10450ea508b1Smrg# We'll loop over all known methods to create a tar archive until one works.
10460ea508b1Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047e169010aSmrg
10480ea508b1Smrgm4_if([$1], [v7],
10490ea508b1Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050e169010aSmrg
10510ea508b1Smrg  [m4_case([$1],
10520ea508b1Smrg    [ustar],
10530ea508b1Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10540ea508b1Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10550ea508b1Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10560ea508b1Smrg      # and bug#13588).
10570ea508b1Smrg      am_max_uid=2097151 # 2^21 - 1
10580ea508b1Smrg      am_max_gid=$am_max_uid
10590ea508b1Smrg      # The $UID and $GID variables are not portable, so we need to resort
10600ea508b1Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10610ea508b1Smrg      # below are definitely unexpected, so allow the users to see them
10620ea508b1Smrg      # (that is, avoid stderr redirection).
10630ea508b1Smrg      am_uid=`id -u || echo unknown`
10640ea508b1Smrg      am_gid=`id -g || echo unknown`
10650ea508b1Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10660ea508b1Smrg      if test $am_uid -le $am_max_uid; then
10670ea508b1Smrg         AC_MSG_RESULT([yes])
10680ea508b1Smrg      else
10690ea508b1Smrg         AC_MSG_RESULT([no])
10700ea508b1Smrg         _am_tools=none
10710ea508b1Smrg      fi
10720ea508b1Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10730ea508b1Smrg      if test $am_gid -le $am_max_gid; then
10740ea508b1Smrg         AC_MSG_RESULT([yes])
10750ea508b1Smrg      else
10760ea508b1Smrg        AC_MSG_RESULT([no])
10770ea508b1Smrg        _am_tools=none
10780ea508b1Smrg      fi],
1079e169010aSmrg
10800ea508b1Smrg  [pax],
10810ea508b1Smrg    [],
10827914d74bSmrg
10830ea508b1Smrg  [m4_fatal([Unknown tar format])])
10847914d74bSmrg
10850ea508b1Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086e6d5e4e0Smrg
10870ea508b1Smrg  # Go ahead even if we have the value already cached.  We do so because we
10880ea508b1Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
10890ea508b1Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
10907914d74bSmrg
10910ea508b1Smrg  for _am_tool in $_am_tools; do
10920ea508b1Smrg    case $_am_tool in
10930ea508b1Smrg    gnutar)
10940ea508b1Smrg      for _am_tar in tar gnutar gtar; do
10950ea508b1Smrg        AM_RUN_LOG([$_am_tar --version]) && break
10960ea508b1Smrg      done
10970ea508b1Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
10980ea508b1Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
10990ea508b1Smrg      am__untar="$_am_tar -xf -"
1100e6d5e4e0Smrg      ;;
11010ea508b1Smrg    plaintar)
11020ea508b1Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11030ea508b1Smrg      # ustar tarball either.
11040ea508b1Smrg      (tar --version) >/dev/null 2>&1 && continue
11050ea508b1Smrg      am__tar='tar chf - "$$tardir"'
11060ea508b1Smrg      am__tar_='tar chf - "$tardir"'
11070ea508b1Smrg      am__untar='tar xf -'
1108e6d5e4e0Smrg      ;;
11090ea508b1Smrg    pax)
11100ea508b1Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
11110ea508b1Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
11120ea508b1Smrg      am__untar='pax -r'
1113e6d5e4e0Smrg      ;;
11140ea508b1Smrg    cpio)
11150ea508b1Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11160ea508b1Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11170ea508b1Smrg      am__untar='cpio -i -H $1 -d'
1118e6d5e4e0Smrg      ;;
11190ea508b1Smrg    none)
11200ea508b1Smrg      am__tar=false
11210ea508b1Smrg      am__tar_=false
11220ea508b1Smrg      am__untar=false
1123e6d5e4e0Smrg      ;;
1124e6d5e4e0Smrg    esac
1125c63293b5Smrg
11260ea508b1Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
11270ea508b1Smrg    # and am__untar set.
11280ea508b1Smrg    test -n "${am_cv_prog_tar_$1}" && break
11297914d74bSmrg
11300ea508b1Smrg    # tar/untar a dummy directory, and stop if the command works.
11310ea508b1Smrg    rm -rf conftest.dir
11320ea508b1Smrg    mkdir conftest.dir
11330ea508b1Smrg    echo GrepMe > conftest.dir/file
11340ea508b1Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11350ea508b1Smrg    rm -rf conftest.dir
11360ea508b1Smrg    if test -s conftest.tar; then
11370ea508b1Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
11380ea508b1Smrg      AM_RUN_LOG([cat conftest.dir/file])
11390ea508b1Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11400ea508b1Smrg    fi
11410ea508b1Smrg  done
11420ea508b1Smrg  rm -rf conftest.dir
11437914d74bSmrg
11440ea508b1Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11450ea508b1Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146e169010aSmrg
11470ea508b1SmrgAC_SUBST([am__tar])
11480ea508b1SmrgAC_SUBST([am__untar])
11490ea508b1Smrg]) # _AM_PROG_TAR
1150e6d5e4e0Smrg
11510ea508b1Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
11520ea508b1Smrgdnl serial 11 (pkg-config-0.29)
11530ea508b1Smrgdnl
11540ea508b1Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11550ea508b1Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
11560ea508b1Smrgdnl
11570ea508b1Smrgdnl This program is free software; you can redistribute it and/or modify
11580ea508b1Smrgdnl it under the terms of the GNU General Public License as published by
11590ea508b1Smrgdnl the Free Software Foundation; either version 2 of the License, or
11600ea508b1Smrgdnl (at your option) any later version.
11610ea508b1Smrgdnl
11620ea508b1Smrgdnl This program is distributed in the hope that it will be useful, but
11630ea508b1Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
11640ea508b1Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11650ea508b1Smrgdnl General Public License for more details.
11660ea508b1Smrgdnl
11670ea508b1Smrgdnl You should have received a copy of the GNU General Public License
11680ea508b1Smrgdnl along with this program; if not, write to the Free Software
11690ea508b1Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
11700ea508b1Smrgdnl 02111-1307, USA.
11710ea508b1Smrgdnl
11720ea508b1Smrgdnl As a special exception to the GNU General Public License, if you
11730ea508b1Smrgdnl distribute this file as part of a program that contains a
11740ea508b1Smrgdnl configuration script generated by Autoconf, you may include it under
11750ea508b1Smrgdnl the same distribution terms that you use for the rest of that
11760ea508b1Smrgdnl program.
11777914d74bSmrg
11780ea508b1Smrgdnl PKG_PREREQ(MIN-VERSION)
11790ea508b1Smrgdnl -----------------------
11800ea508b1Smrgdnl Since: 0.29
11810ea508b1Smrgdnl
11820ea508b1Smrgdnl Verify that the version of the pkg-config macros are at least
11830ea508b1Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
11840ea508b1Smrgdnl installed version of pkg-config, this checks the developer's version
11850ea508b1Smrgdnl of pkg.m4 when generating configure.
11860ea508b1Smrgdnl
11870ea508b1Smrgdnl To ensure that this macro is defined, also add:
11880ea508b1Smrgdnl m4_ifndef([PKG_PREREQ],
11890ea508b1Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
11900ea508b1Smrgdnl
11910ea508b1Smrgdnl See the "Since" comment for each macro you use to see what version
11920ea508b1Smrgdnl of the macros you require.
11930ea508b1Smrgm4_defun([PKG_PREREQ],
11940ea508b1Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
11950ea508b1Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
11960ea508b1Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
11970ea508b1Smrg])dnl PKG_PREREQ
1198e169010aSmrg
11990ea508b1Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
12000ea508b1Smrgdnl ----------------------------------
12010ea508b1Smrgdnl Since: 0.16
12020ea508b1Smrgdnl
12030ea508b1Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
12040ea508b1Smrgdnl first found in the path. Checks that the version of pkg-config found
12050ea508b1Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
12060ea508b1Smrgdnl used since that's the first version where most current features of
12070ea508b1Smrgdnl pkg-config existed.
12080ea508b1SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
12090ea508b1Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
12100ea508b1Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
12110ea508b1Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
12120ea508b1SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
12130ea508b1SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
12140ea508b1SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215e169010aSmrg
12160ea508b1Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
12170ea508b1Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
12180ea508b1Smrgfi
12190ea508b1Smrgif test -n "$PKG_CONFIG"; then
12200ea508b1Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
12210ea508b1Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
12220ea508b1Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
12230ea508b1Smrg		AC_MSG_RESULT([yes])
12240ea508b1Smrg	else
12250ea508b1Smrg		AC_MSG_RESULT([no])
12260ea508b1Smrg		PKG_CONFIG=""
12270ea508b1Smrg	fi
12280ea508b1Smrgfi[]dnl
12290ea508b1Smrg])dnl PKG_PROG_PKG_CONFIG
1230c63293b5Smrg
12310ea508b1Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
12320ea508b1Smrgdnl -------------------------------------------------------------------
12330ea508b1Smrgdnl Since: 0.18
12340ea508b1Smrgdnl
12350ea508b1Smrgdnl Check to see whether a particular set of modules exists. Similar to
12360ea508b1Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
12370ea508b1Smrgdnl
12380ea508b1Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12390ea508b1Smrgdnl only at the first occurence in configure.ac, so if the first place
12400ea508b1Smrgdnl it's called might be skipped (such as if it is within an "if", you
12410ea508b1Smrgdnl have to call PKG_CHECK_EXISTS manually
12420ea508b1SmrgAC_DEFUN([PKG_CHECK_EXISTS],
12430ea508b1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12440ea508b1Smrgif test -n "$PKG_CONFIG" && \
12450ea508b1Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12460ea508b1Smrg  m4_default([$2], [:])
12470ea508b1Smrgm4_ifvaln([$3], [else
12480ea508b1Smrg  $3])dnl
12490ea508b1Smrgfi])
1250c63293b5Smrg
12510ea508b1Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12520ea508b1Smrgdnl ---------------------------------------------
12530ea508b1Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12540ea508b1Smrgdnl pkg_failed based on the result.
12550ea508b1Smrgm4_define([_PKG_CONFIG],
12560ea508b1Smrg[if test -n "$$1"; then
12570ea508b1Smrg    pkg_cv_[]$1="$$1"
12580ea508b1Smrg elif test -n "$PKG_CONFIG"; then
12590ea508b1Smrg    PKG_CHECK_EXISTS([$3],
12600ea508b1Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
12610ea508b1Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
12620ea508b1Smrg		     [pkg_failed=yes])
12630ea508b1Smrg else
12640ea508b1Smrg    pkg_failed=untried
12650ea508b1Smrgfi[]dnl
12660ea508b1Smrg])dnl _PKG_CONFIG
12677914d74bSmrg
12680ea508b1Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
12690ea508b1Smrgdnl ---------------------------
12700ea508b1Smrgdnl Internal check to see if pkg-config supports short errors.
12710ea508b1SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
12720ea508b1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12730ea508b1Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
12740ea508b1Smrg        _pkg_short_errors_supported=yes
12750ea508b1Smrgelse
12760ea508b1Smrg        _pkg_short_errors_supported=no
12770ea508b1Smrgfi[]dnl
12780ea508b1Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279e169010aSmrg
12807914d74bSmrg
12810ea508b1Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12820ea508b1Smrgdnl   [ACTION-IF-NOT-FOUND])
12830ea508b1Smrgdnl --------------------------------------------------------------
12840ea508b1Smrgdnl Since: 0.4.0
12850ea508b1Smrgdnl
12860ea508b1Smrgdnl Note that if there is a possibility the first call to
12870ea508b1Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
12880ea508b1Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
12890ea508b1SmrgAC_DEFUN([PKG_CHECK_MODULES],
12900ea508b1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12910ea508b1SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
12920ea508b1SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12937914d74bSmrg
12940ea508b1Smrgpkg_failed=no
12950ea508b1SmrgAC_MSG_CHECKING([for $1])
12967914d74bSmrg
12970ea508b1Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
12980ea508b1Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1299e169010aSmrg
13000ea508b1Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
13010ea508b1Smrgand $1[]_LIBS to avoid the need to call pkg-config.
13020ea508b1SmrgSee the pkg-config man page for more details.])
13037914d74bSmrg
13040ea508b1Smrgif test $pkg_failed = yes; then
13050ea508b1Smrg   	AC_MSG_RESULT([no])
13060ea508b1Smrg        _PKG_SHORT_ERRORS_SUPPORTED
13070ea508b1Smrg        if test $_pkg_short_errors_supported = yes; then
13080ea508b1Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
13090ea508b1Smrg        else 
13100ea508b1Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
13110ea508b1Smrg        fi
13120ea508b1Smrg	# Put the nasty error message in config.log where it belongs
13130ea508b1Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
13147914d74bSmrg
13150ea508b1Smrg	m4_default([$4], [AC_MSG_ERROR(
13160ea508b1Smrg[Package requirements ($2) were not met:
13177914d74bSmrg
13180ea508b1Smrg$$1_PKG_ERRORS
13197914d74bSmrg
13200ea508b1SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
13210ea508b1Smrginstalled software in a non-standard prefix.
13227914d74bSmrg
13230ea508b1Smrg_PKG_TEXT])[]dnl
13240ea508b1Smrg        ])
13250ea508b1Smrgelif test $pkg_failed = untried; then
13260ea508b1Smrg     	AC_MSG_RESULT([no])
13270ea508b1Smrg	m4_default([$4], [AC_MSG_FAILURE(
13280ea508b1Smrg[The pkg-config script could not be found or is too old.  Make sure it
13290ea508b1Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
13300ea508b1Smrgpath to pkg-config.
13317914d74bSmrg
13320ea508b1Smrg_PKG_TEXT
1333e169010aSmrg
13340ea508b1SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
13350ea508b1Smrg        ])
13360ea508b1Smrgelse
13370ea508b1Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
13380ea508b1Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
13390ea508b1Smrg        AC_MSG_RESULT([yes])
13400ea508b1Smrg	$3
13410ea508b1Smrgfi[]dnl
13420ea508b1Smrg])dnl PKG_CHECK_MODULES
1343e169010aSmrg
1344e8ead290Smrg
13450ea508b1Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
13460ea508b1Smrgdnl   [ACTION-IF-NOT-FOUND])
13470ea508b1Smrgdnl ---------------------------------------------------------------------
13480ea508b1Smrgdnl Since: 0.29
13490ea508b1Smrgdnl
13500ea508b1Smrgdnl Checks for existence of MODULES and gathers its build flags with
13510ea508b1Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
13520ea508b1Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
13530ea508b1Smrgdnl
13540ea508b1Smrgdnl Note that if there is a possibility the first call to
13550ea508b1Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
13560ea508b1Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
13570ea508b1Smrgdnl configure.ac.
13580ea508b1SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
13590ea508b1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
13600ea508b1Smrg_save_PKG_CONFIG=$PKG_CONFIG
13610ea508b1SmrgPKG_CONFIG="$PKG_CONFIG --static"
13620ea508b1SmrgPKG_CHECK_MODULES($@)
13630ea508b1SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
13640ea508b1Smrg])dnl PKG_CHECK_MODULES_STATIC
1365e8ead290Smrg
1366e8ead290Smrg
13670ea508b1Smrgdnl PKG_INSTALLDIR([DIRECTORY])
13680ea508b1Smrgdnl -------------------------
13690ea508b1Smrgdnl Since: 0.27
13700ea508b1Smrgdnl
13710ea508b1Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
13720ea508b1Smrgdnl should install pkg-config .pc files. By default the directory is
13730ea508b1Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
13740ea508b1Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
13750ea508b1Smrgdnl parameter.
13760ea508b1SmrgAC_DEFUN([PKG_INSTALLDIR],
13770ea508b1Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
13780ea508b1Smrgm4_pushdef([pkg_description],
13790ea508b1Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
13800ea508b1SmrgAC_ARG_WITH([pkgconfigdir],
13810ea508b1Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
13820ea508b1Smrg    [with_pkgconfigdir=]pkg_default)
13830ea508b1SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
13840ea508b1Smrgm4_popdef([pkg_default])
13850ea508b1Smrgm4_popdef([pkg_description])
13860ea508b1Smrg])dnl PKG_INSTALLDIR
1387e8ead290Smrg
1388e169010aSmrg
13890ea508b1Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
13900ea508b1Smrgdnl --------------------------------
13910ea508b1Smrgdnl Since: 0.27
13920ea508b1Smrgdnl
13930ea508b1Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
13940ea508b1Smrgdnl module should install arch-independent pkg-config .pc files. By
13950ea508b1Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
13960ea508b1Smrgdnl changed by passing DIRECTORY. The user can override through the
13970ea508b1Smrgdnl --with-noarch-pkgconfigdir parameter.
13980ea508b1SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
13990ea508b1Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
14000ea508b1Smrgm4_pushdef([pkg_description],
14010ea508b1Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
14020ea508b1SmrgAC_ARG_WITH([noarch-pkgconfigdir],
14030ea508b1Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
14040ea508b1Smrg    [with_noarch_pkgconfigdir=]pkg_default)
14050ea508b1SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
14060ea508b1Smrgm4_popdef([pkg_default])
14070ea508b1Smrgm4_popdef([pkg_description])
14080ea508b1Smrg])dnl PKG_NOARCH_INSTALLDIR
1409e6d5e4e0Smrg
14107914d74bSmrg
14110ea508b1Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
14120ea508b1Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
14130ea508b1Smrgdnl -------------------------------------------
14140ea508b1Smrgdnl Since: 0.28
14150ea508b1Smrgdnl
14160ea508b1Smrgdnl Retrieves the value of the pkg-config variable for the given module.
14170ea508b1SmrgAC_DEFUN([PKG_CHECK_VAR],
14180ea508b1Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14190ea508b1SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
14207914d74bSmrg
14210ea508b1Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
14220ea508b1SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423e6d5e4e0Smrg
14240ea508b1SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
14250ea508b1Smrg])dnl PKG_CHECK_VAR
1426e6d5e4e0Smrg
14270ea508b1Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
14280ea508b1Smrgdnl
14290ea508b1Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
14300ea508b1Smrgdnl
14310ea508b1Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14320ea508b1Smrgdnl copy of this software and associated documentation files (the "Software"),
14330ea508b1Smrgdnl to deal in the Software without restriction, including without limitation
14340ea508b1Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14350ea508b1Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
14360ea508b1Smrgdnl Software is furnished to do so, subject to the following conditions:
14370ea508b1Smrgdnl
14380ea508b1Smrgdnl The above copyright notice and this permission notice (including the next
14390ea508b1Smrgdnl paragraph) shall be included in all copies or substantial portions of the
14400ea508b1Smrgdnl Software.
14410ea508b1Smrgdnl
14420ea508b1Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14430ea508b1Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14440ea508b1Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14450ea508b1Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14460ea508b1Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14470ea508b1Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14480ea508b1Smrgdnl DEALINGS IN THE SOFTWARE.
1449e6d5e4e0Smrg
14500ea508b1Smrg# XORG_MACROS_VERSION(required-version)
14510ea508b1Smrg# -------------------------------------
14520ea508b1Smrg# Minimum version: 1.1.0
14530ea508b1Smrg#
14540ea508b1Smrg# If you're using a macro added in Version 1.1 or newer, include this in
14550ea508b1Smrg# your configure.ac with the minimum required version, such as:
14560ea508b1Smrg# XORG_MACROS_VERSION(1.1)
14570ea508b1Smrg#
14580ea508b1Smrg# To ensure that this macro is defined, also add:
14590ea508b1Smrg# m4_ifndef([XORG_MACROS_VERSION],
14600ea508b1Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
14610ea508b1Smrg#
14620ea508b1Smrg#
14630ea508b1Smrg# See the "minimum version" comment for each macro you use to see what
14640ea508b1Smrg# version you require.
14650ea508b1Smrgm4_defun([XORG_MACROS_VERSION],[
14660ea508b1Smrgm4_define([vers_have], [1.20.0])
14670ea508b1Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14680ea508b1Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14690ea508b1Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14700ea508b1Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
14710ea508b1Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
14720ea508b1Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
14730ea508b1Smrgm4_undefine([vers_have])
14740ea508b1Smrgm4_undefine([maj_have])
14750ea508b1Smrgm4_undefine([maj_needed])
14760ea508b1Smrg]) # XORG_MACROS_VERSION
1477e6d5e4e0Smrg
14780ea508b1Smrg# XORG_PROG_RAWCPP()
14790ea508b1Smrg# ------------------
14800ea508b1Smrg# Minimum version: 1.0.0
14810ea508b1Smrg#
14820ea508b1Smrg# Find cpp program and necessary flags for use in pre-processing text files
14830ea508b1Smrg# such as man pages and config files
14840ea508b1SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14850ea508b1SmrgAC_REQUIRE([AC_PROG_CPP])
14860ea508b1SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
14870ea508b1Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
14889d0ccd10Smrg
14890ea508b1Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14900ea508b1Smrg# which is not the best choice for supporting other OS'es, but covers most
14910ea508b1Smrg# of the ones we need for now.
14920ea508b1SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14930ea508b1SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14940ea508b1Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14950ea508b1Smrg	AC_MSG_RESULT([no])
14960ea508b1Smrgelse
14970ea508b1Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14980ea508b1Smrg		RAWCPPFLAGS=-undef
14990ea508b1Smrg		AC_MSG_RESULT([yes])
15000ea508b1Smrg	# under Cygwin unix is still defined even with -undef
15010ea508b1Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15020ea508b1Smrg		RAWCPPFLAGS="-undef -ansi"
15030ea508b1Smrg		AC_MSG_RESULT([yes, with -ansi])
15040ea508b1Smrg	else
15050ea508b1Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
15060ea508b1Smrg	fi
15070ea508b1Smrgfi
15080ea508b1Smrgrm -f conftest.$ac_ext
1509e6d5e4e0Smrg
15100ea508b1SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
15110ea508b1SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
15120ea508b1Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
15130ea508b1Smrg	AC_MSG_RESULT([no])
15140ea508b1Smrgelse
15150ea508b1Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
15160ea508b1Smrg		TRADITIONALCPPFLAGS="-traditional"
15170ea508b1Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
15180ea508b1Smrg		AC_MSG_RESULT([yes])
15190ea508b1Smrg	else
15200ea508b1Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15210ea508b1Smrg	fi
15220ea508b1Smrgfi
15230ea508b1Smrgrm -f conftest.$ac_ext
15240ea508b1SmrgAC_SUBST(RAWCPPFLAGS)
15250ea508b1SmrgAC_SUBST(TRADITIONALCPPFLAGS)
15260ea508b1Smrg]) # XORG_PROG_RAWCPP
1527e6d5e4e0Smrg
15280ea508b1Smrg# XORG_MANPAGE_SECTIONS()
15290ea508b1Smrg# -----------------------
15300ea508b1Smrg# Minimum version: 1.0.0
15310ea508b1Smrg#
15320ea508b1Smrg# Determine which sections man pages go in for the different man page types
15330ea508b1Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
15340ea508b1Smrg# Not sure if there's any better way than just hardcoding by OS name.
15350ea508b1Smrg# Override default settings by setting environment variables
15360ea508b1Smrg# Added MAN_SUBSTS in version 1.8
15370ea508b1Smrg# Added AC_PROG_SED in version 1.8
1538e6d5e4e0Smrg
15390ea508b1SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
15400ea508b1SmrgAC_REQUIRE([AC_CANONICAL_HOST])
15410ea508b1SmrgAC_REQUIRE([AC_PROG_SED])
1542e6d5e4e0Smrg
15430ea508b1Smrgcase $host_os in
1544e6d5e4e0Smrg    solaris*)
15450ea508b1Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
15460ea508b1Smrg        # check for a man page file found in later versions that use
15470ea508b1Smrg        # traditional section numbers instead
15480ea508b1Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
15490ea508b1Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
15500ea508b1Smrg        ;;
15510ea508b1Smrg    *) SYSV_MAN_SECTIONS=false ;;
15520ea508b1Smrgesac
1553e6d5e4e0Smrg
15540ea508b1Smrgif test x$APP_MAN_SUFFIX = x    ; then
15550ea508b1Smrg    APP_MAN_SUFFIX=1
15560ea508b1Smrgfi
15570ea508b1Smrgif test x$APP_MAN_DIR = x    ; then
15580ea508b1Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
15590ea508b1Smrgfi
1560e6d5e4e0Smrg
15610ea508b1Smrgif test x$LIB_MAN_SUFFIX = x    ; then
15620ea508b1Smrg    LIB_MAN_SUFFIX=3
15630ea508b1Smrgfi
15640ea508b1Smrgif test x$LIB_MAN_DIR = x    ; then
15650ea508b1Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15660ea508b1Smrgfi
1567e6d5e4e0Smrg
15680ea508b1Smrgif test x$FILE_MAN_SUFFIX = x    ; then
15690ea508b1Smrg    case $SYSV_MAN_SECTIONS in
15700ea508b1Smrg	true)				FILE_MAN_SUFFIX=4  ;;
15710ea508b1Smrg	*)				FILE_MAN_SUFFIX=5  ;;
15720ea508b1Smrg    esac
15730ea508b1Smrgfi
15740ea508b1Smrgif test x$FILE_MAN_DIR = x    ; then
15750ea508b1Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
15760ea508b1Smrgfi
1577e6d5e4e0Smrg
15780ea508b1Smrgif test x$MISC_MAN_SUFFIX = x    ; then
15790ea508b1Smrg    case $SYSV_MAN_SECTIONS in
15800ea508b1Smrg	true)				MISC_MAN_SUFFIX=5  ;;
15810ea508b1Smrg	*)				MISC_MAN_SUFFIX=7  ;;
15820ea508b1Smrg    esac
15830ea508b1Smrgfi
15840ea508b1Smrgif test x$MISC_MAN_DIR = x    ; then
15850ea508b1Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
15860ea508b1Smrgfi
1587e6d5e4e0Smrg
15880ea508b1Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
15890ea508b1Smrg    case $SYSV_MAN_SECTIONS in
15900ea508b1Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
15910ea508b1Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
1592e169010aSmrg    esac
15930ea508b1Smrgfi
15940ea508b1Smrgif test x$DRIVER_MAN_DIR = x    ; then
15950ea508b1Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15960ea508b1Smrgfi
15977914d74bSmrg
15980ea508b1Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15990ea508b1Smrg    case $SYSV_MAN_SECTIONS in
16000ea508b1Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
16010ea508b1Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
16020ea508b1Smrg    esac
16030ea508b1Smrgfi
16040ea508b1Smrgif test x$ADMIN_MAN_DIR = x    ; then
16050ea508b1Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16060ea508b1Smrgfi
1607e6d5e4e0Smrg
1608e6d5e4e0Smrg
16090ea508b1SmrgAC_SUBST([APP_MAN_SUFFIX])
16100ea508b1SmrgAC_SUBST([LIB_MAN_SUFFIX])
16110ea508b1SmrgAC_SUBST([FILE_MAN_SUFFIX])
16120ea508b1SmrgAC_SUBST([MISC_MAN_SUFFIX])
16130ea508b1SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
16140ea508b1SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
16150ea508b1SmrgAC_SUBST([APP_MAN_DIR])
16160ea508b1SmrgAC_SUBST([LIB_MAN_DIR])
16170ea508b1SmrgAC_SUBST([FILE_MAN_DIR])
16180ea508b1SmrgAC_SUBST([MISC_MAN_DIR])
16190ea508b1SmrgAC_SUBST([DRIVER_MAN_DIR])
16200ea508b1SmrgAC_SUBST([ADMIN_MAN_DIR])
1621e6d5e4e0Smrg
16220ea508b1SmrgXORG_MAN_PAGE="X Version 11"
16230ea508b1SmrgAC_SUBST([XORG_MAN_PAGE])
16240ea508b1SmrgMAN_SUBSTS="\
16250ea508b1Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16260ea508b1Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16270ea508b1Smrg	-e 's|__xservername__|Xorg|g' \
16280ea508b1Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
16290ea508b1Smrg	-e 's|__projectroot__|\$(prefix)|g' \
16300ea508b1Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
16310ea508b1Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
16320ea508b1Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
16330ea508b1Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
16340ea508b1Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
16350ea508b1Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
16360ea508b1Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
16370ea508b1SmrgAC_SUBST([MAN_SUBSTS])
16387914d74bSmrg
16390ea508b1Smrg]) # XORG_MANPAGE_SECTIONS
16407914d74bSmrg
16410ea508b1Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
16420ea508b1Smrg# ------------------------
16430ea508b1Smrg# Minimum version: 1.7.0
16440ea508b1Smrg#
16450ea508b1Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
16460ea508b1Smrg# provided by xorg-sgml-doctools, if installed.
16470ea508b1SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
16480ea508b1SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
16490ea508b1SmrgXORG_SGML_PATH=
16500ea508b1SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
16510ea508b1Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
16520ea508b1Smrg    [m4_ifval([$1],[:],
16530ea508b1Smrg        [if test x"$cross_compiling" != x"yes" ; then
16540ea508b1Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
16550ea508b1Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
16560ea508b1Smrg         fi])
16570ea508b1Smrg    ])
16587914d74bSmrg
16590ea508b1Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
16600ea508b1Smrg# the path and the name of the doc stylesheet
16610ea508b1Smrgif test "x$XORG_SGML_PATH" != "x" ; then
16620ea508b1Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
16630ea508b1Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
16640ea508b1Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
16650ea508b1Smrgelse
16660ea508b1Smrg   AC_MSG_RESULT([no])
16670ea508b1Smrgfi
16687914d74bSmrg
16690ea508b1SmrgAC_SUBST(XORG_SGML_PATH)
16700ea508b1SmrgAC_SUBST(STYLESHEET_SRCDIR)
16710ea508b1SmrgAC_SUBST(XSL_STYLESHEET)
16720ea508b1SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
16730ea508b1Smrg]) # XORG_CHECK_SGML_DOCTOOLS
16747914d74bSmrg
16750ea508b1Smrg# XORG_CHECK_LINUXDOC
16760ea508b1Smrg# -------------------
16770ea508b1Smrg# Minimum version: 1.0.0
16780ea508b1Smrg#
16790ea508b1Smrg# Defines the variable MAKE_TEXT if the necessary tools and
16800ea508b1Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
16810ea508b1Smrg# Whether or not the necessary tools and files are found can be checked
16820ea508b1Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
16830ea508b1SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
16840ea508b1SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16850ea508b1SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1686e169010aSmrg
16870ea508b1SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
16887914d74bSmrg
16890ea508b1SmrgAC_MSG_CHECKING([whether to build documentation])
16907914d74bSmrg
16910ea508b1Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
16920ea508b1Smrg   BUILDDOC=yes
16930ea508b1Smrgelse
16940ea508b1Smrg   BUILDDOC=no
16950ea508b1Smrgfi
16967914d74bSmrg
16970ea508b1SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1698e6d5e4e0Smrg
16990ea508b1SmrgAC_MSG_RESULT([$BUILDDOC])
1700e6d5e4e0Smrg
17010ea508b1SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1702e6d5e4e0Smrg
17030ea508b1Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
17040ea508b1Smrg   BUILDPDFDOC=yes
17050ea508b1Smrgelse
17060ea508b1Smrg   BUILDPDFDOC=no
17070ea508b1Smrgfi
17087914d74bSmrg
17090ea508b1SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1710e169010aSmrg
17110ea508b1SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17127914d74bSmrg
17130ea508b1SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
17140ea508b1SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
17150ea508b1SmrgMAKE_PDF="$PS2PDF"
17160ea508b1SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1717e6d5e4e0Smrg
17180ea508b1SmrgAC_SUBST(MAKE_TEXT)
17190ea508b1SmrgAC_SUBST(MAKE_PS)
17200ea508b1SmrgAC_SUBST(MAKE_PDF)
17210ea508b1SmrgAC_SUBST(MAKE_HTML)
17220ea508b1Smrg]) # XORG_CHECK_LINUXDOC
17237914d74bSmrg
17240ea508b1Smrg# XORG_CHECK_DOCBOOK
17250ea508b1Smrg# -------------------
17260ea508b1Smrg# Minimum version: 1.0.0
17270ea508b1Smrg#
17280ea508b1Smrg# Checks for the ability to build output formats from SGML DocBook source.
17290ea508b1Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
17300ea508b1Smrg# indicates whether the necessary tools and files are found and, if set,
17310ea508b1Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
17320ea508b1SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
17330ea508b1SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
17347914d74bSmrg
17350ea508b1SmrgBUILDTXTDOC=no
17360ea508b1SmrgBUILDPDFDOC=no
17370ea508b1SmrgBUILDPSDOC=no
17380ea508b1SmrgBUILDHTMLDOC=no
1739e6d5e4e0Smrg
17400ea508b1SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
17410ea508b1SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
17420ea508b1SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
17430ea508b1SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
17447914d74bSmrg
17450ea508b1SmrgAC_MSG_CHECKING([whether to build text documentation])
17460ea508b1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
17470ea508b1Smrg   test x$BUILD_TXTDOC != xno; then
17480ea508b1Smrg	BUILDTXTDOC=yes
17490ea508b1Smrgfi
17500ea508b1SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
17510ea508b1SmrgAC_MSG_RESULT([$BUILDTXTDOC])
17527914d74bSmrg
17530ea508b1SmrgAC_MSG_CHECKING([whether to build PDF documentation])
17540ea508b1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
17550ea508b1Smrg   test x$BUILD_PDFDOC != xno; then
17560ea508b1Smrg	BUILDPDFDOC=yes
17570ea508b1Smrgfi
17580ea508b1SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17590ea508b1SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17607914d74bSmrg
17610ea508b1SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
17620ea508b1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17630ea508b1Smrg   test x$BUILD_PSDOC != xno; then
17640ea508b1Smrg	BUILDPSDOC=yes
17650ea508b1Smrgfi
17660ea508b1SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
17670ea508b1SmrgAC_MSG_RESULT([$BUILDPSDOC])
1768e6d5e4e0Smrg
17690ea508b1SmrgAC_MSG_CHECKING([whether to build HTML documentation])
17700ea508b1Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
17710ea508b1Smrg   test x$BUILD_HTMLDOC != xno; then
17720ea508b1Smrg	BUILDHTMLDOC=yes
17730ea508b1Smrgfi
17740ea508b1SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
17750ea508b1SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1776c63293b5Smrg
17770ea508b1SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
17780ea508b1SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
17790ea508b1SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
17800ea508b1SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1781e169010aSmrg
17820ea508b1SmrgAC_SUBST(MAKE_TEXT)
17830ea508b1SmrgAC_SUBST(MAKE_PS)
17840ea508b1SmrgAC_SUBST(MAKE_PDF)
17850ea508b1SmrgAC_SUBST(MAKE_HTML)
17860ea508b1Smrg]) # XORG_CHECK_DOCBOOK
1787e169010aSmrg
17880ea508b1Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
17890ea508b1Smrg# ----------------
17900ea508b1Smrg# Minimum version: 1.5.0
17910ea508b1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1792e8ead290Smrg#
17930ea508b1Smrg# Documentation tools are not always available on all platforms and sometimes
17940ea508b1Smrg# not at the appropriate level. This macro enables a module to test for the
17950ea508b1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
17960ea508b1Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
17970ea508b1Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17980ea508b1Smrg# --with-xmlto assumes 'auto'.
1799e8ead290Smrg#
18000ea508b1Smrg# Interface to module:
18010ea508b1Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
18020ea508b1Smrg# XMLTO:	returns the path of the xmlto program found
18030ea508b1Smrg#		returns the path set by the user in the environment
18040ea508b1Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
18050ea508b1Smrg#		'no' user instructs the module not to use xmlto
18060ea508b1Smrg#
18070ea508b1Smrg# Added in version 1.10.0
18080ea508b1Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
18090ea508b1Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
18100ea508b1Smrg#
18110ea508b1Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
18120ea508b1Smrg#
18130ea508b1SmrgAC_DEFUN([XORG_WITH_XMLTO],[
18140ea508b1SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
18150ea508b1Smrgm4_define([_defopt], m4_default([$2], [auto]))
18160ea508b1SmrgAC_ARG_WITH(xmlto,
18170ea508b1Smrg	AS_HELP_STRING([--with-xmlto],
18180ea508b1Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
18190ea508b1Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
18200ea508b1Smrgm4_undefine([_defopt])
18217914d74bSmrg
18220ea508b1Smrgif test "x$use_xmlto" = x"auto"; then
18230ea508b1Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18240ea508b1Smrg   if test "x$XMLTO" = "x"; then
18250ea508b1Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
18260ea508b1Smrg	have_xmlto=no
18270ea508b1Smrg   else
18280ea508b1Smrg        have_xmlto=yes
18290ea508b1Smrg   fi
18300ea508b1Smrgelif test "x$use_xmlto" = x"yes" ; then
18310ea508b1Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18320ea508b1Smrg   if test "x$XMLTO" = "x"; then
18330ea508b1Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
18340ea508b1Smrg   fi
18350ea508b1Smrg   have_xmlto=yes
18360ea508b1Smrgelif test "x$use_xmlto" = x"no" ; then
18370ea508b1Smrg   if test "x$XMLTO" != "x"; then
18380ea508b1Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
18390ea508b1Smrg   fi
18400ea508b1Smrg   have_xmlto=no
1841e6d5e4e0Smrgelse
18420ea508b1Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1843e6d5e4e0Smrgfi
18447914d74bSmrg
18450ea508b1Smrg# Test for a minimum version of xmlto, if provided.
18460ea508b1Smrgm4_ifval([$1],
18470ea508b1Smrg[if test "$have_xmlto" = yes; then
18480ea508b1Smrg    # scrape the xmlto version
18490ea508b1Smrg    AC_MSG_CHECKING([the xmlto version])
18500ea508b1Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
18510ea508b1Smrg    AC_MSG_RESULT([$xmlto_version])
18520ea508b1Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
18530ea508b1Smrg        [if test "x$use_xmlto" = xauto; then
18540ea508b1Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
18550ea508b1Smrg            have_xmlto=no
1856e6d5e4e0Smrg        else
18570ea508b1Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
18580ea508b1Smrg        fi])
18590ea508b1Smrgfi])
1860e169010aSmrg
18610ea508b1Smrg# Test for the ability of xmlto to generate a text target
18620ea508b1Smrg#
18630ea508b1Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
18640ea508b1Smrg# following test for empty XML docbook files.
18650ea508b1Smrg# For compatibility reasons use the following empty XML docbook file and if
18660ea508b1Smrg# it fails try it again with a non-empty XML file.
18670ea508b1Smrghave_xmlto_text=no
18680ea508b1Smrgcat > conftest.xml << "EOF"
18690ea508b1SmrgEOF
18700ea508b1SmrgAS_IF([test "$have_xmlto" = yes],
18710ea508b1Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18720ea508b1Smrg             [have_xmlto_text=yes],
18730ea508b1Smrg             [# Try it again with a non-empty XML file.
18740ea508b1Smrg              cat > conftest.xml << "EOF"
18750ea508b1Smrg<x></x>
18760ea508b1SmrgEOF
18770ea508b1Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18780ea508b1Smrg                    [have_xmlto_text=yes],
18790ea508b1Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
18800ea508b1Smrgrm -f conftest.xml
18810ea508b1SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
18820ea508b1SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
18830ea508b1Smrg]) # XORG_WITH_XMLTO
1884e169010aSmrg
18850ea508b1Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
18860ea508b1Smrg# --------------------------------------------
18870ea508b1Smrg# Minimum version: 1.12.0
18880ea508b1Smrg# Minimum version for optional DEFAULT argument: 1.12.0
18890ea508b1Smrg#
18900ea508b1Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
18910ea508b1Smrg# XML-based language used for the transformation of XML documents.
18920ea508b1Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
18930ea508b1Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
18940ea508b1Smrg# The XSLT processor is often used as a standalone tool for transformations.
18950ea508b1Smrg# It should not be assumed that this tool is used only to work with documnetation.
18960ea508b1Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
18970ea508b1Smrg#
18980ea508b1Smrg# Interface to module:
18990ea508b1Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
19000ea508b1Smrg# XSLTPROC:	 returns the path of the xsltproc program found
19010ea508b1Smrg#		 returns the path set by the user in the environment
19020ea508b1Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
19030ea508b1Smrg#		  'no' user instructs the module not to use xsltproc
19040ea508b1Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
19050ea508b1Smrg#
19060ea508b1Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
19070ea508b1Smrg#
19080ea508b1SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
19090ea508b1SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
19100ea508b1Smrg# Preserves the interface, should it be implemented later
19110ea508b1Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
19120ea508b1Smrgm4_define([_defopt], m4_default([$2], [auto]))
19130ea508b1SmrgAC_ARG_WITH(xsltproc,
19140ea508b1Smrg	AS_HELP_STRING([--with-xsltproc],
19150ea508b1Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
19160ea508b1Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
19170ea508b1Smrgm4_undefine([_defopt])
1918e169010aSmrg
19190ea508b1Smrgif test "x$use_xsltproc" = x"auto"; then
19200ea508b1Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19210ea508b1Smrg   if test "x$XSLTPROC" = "x"; then
19220ea508b1Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
19230ea508b1Smrg	have_xsltproc=no
19240ea508b1Smrg   else
19250ea508b1Smrg        have_xsltproc=yes
19260ea508b1Smrg   fi
19270ea508b1Smrgelif test "x$use_xsltproc" = x"yes" ; then
19280ea508b1Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19290ea508b1Smrg   if test "x$XSLTPROC" = "x"; then
19300ea508b1Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
19310ea508b1Smrg   fi
19320ea508b1Smrg   have_xsltproc=yes
19330ea508b1Smrgelif test "x$use_xsltproc" = x"no" ; then
19340ea508b1Smrg   if test "x$XSLTPROC" != "x"; then
19350ea508b1Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
19360ea508b1Smrg   fi
19370ea508b1Smrg   have_xsltproc=no
1938e6d5e4e0Smrgelse
19390ea508b1Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1940e6d5e4e0Smrgfi
1941e169010aSmrg
19420ea508b1SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
19430ea508b1Smrg]) # XORG_WITH_XSLTPROC
1944e169010aSmrg
19450ea508b1Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
19460ea508b1Smrg# ----------------------------------------
19470ea508b1Smrg# Minimum version: 1.15.0
19480ea508b1Smrg#
19490ea508b1Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
19500ea508b1Smrg# scanning arbitrary text files, extracting information from those text files,
19510ea508b1Smrg# and printing reports based on that information.
19520ea508b1Smrg#
19530ea508b1Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
19540ea508b1Smrg#
19550ea508b1Smrg# Interface to module:
19560ea508b1Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
19570ea508b1Smrg# PERL:	     returns the path of the perl program found
19580ea508b1Smrg#	     returns the path set by the user in the environment
19590ea508b1Smrg# --with-perl: 'yes' user instructs the module to use perl
19600ea508b1Smrg#	       'no' user instructs the module not to use perl
19610ea508b1Smrg# have_perl: returns yes if perl found in PATH or no
19620ea508b1Smrg#
19630ea508b1Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
19640ea508b1Smrg#
19650ea508b1SmrgAC_DEFUN([XORG_WITH_PERL],[
19660ea508b1SmrgAC_ARG_VAR([PERL], [Path to perl command])
19670ea508b1Smrg# Preserves the interface, should it be implemented later
19680ea508b1Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
19690ea508b1Smrgm4_define([_defopt], m4_default([$2], [auto]))
19700ea508b1SmrgAC_ARG_WITH(perl,
19710ea508b1Smrg	AS_HELP_STRING([--with-perl],
19720ea508b1Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
19730ea508b1Smrg	   [use_perl=$withval], [use_perl=]_defopt)
19740ea508b1Smrgm4_undefine([_defopt])
1975e169010aSmrg
19760ea508b1Smrgif test "x$use_perl" = x"auto"; then
19770ea508b1Smrg   AC_PATH_PROG([PERL], [perl])
19780ea508b1Smrg   if test "x$PERL" = "x"; then
19790ea508b1Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
19800ea508b1Smrg	have_perl=no
19810ea508b1Smrg   else
19820ea508b1Smrg        have_perl=yes
19830ea508b1Smrg   fi
19840ea508b1Smrgelif test "x$use_perl" = x"yes" ; then
19850ea508b1Smrg   AC_PATH_PROG([PERL], [perl])
19860ea508b1Smrg   if test "x$PERL" = "x"; then
19870ea508b1Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
19880ea508b1Smrg   fi
19890ea508b1Smrg   have_perl=yes
19900ea508b1Smrgelif test "x$use_perl" = x"no" ; then
19910ea508b1Smrg   if test "x$PERL" != "x"; then
19920ea508b1Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
19930ea508b1Smrg   fi
19940ea508b1Smrg   have_perl=no
19950ea508b1Smrgelse
19960ea508b1Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1997e6d5e4e0Smrgfi
1998e6d5e4e0Smrg
19990ea508b1SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
20000ea508b1Smrg]) # XORG_WITH_PERL
2001e6d5e4e0Smrg
20020ea508b1Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
20030ea508b1Smrg# ----------------
20040ea508b1Smrg# Minimum version: 1.5.0
20050ea508b1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20060ea508b1Smrg#
20070ea508b1Smrg# Documentation tools are not always available on all platforms and sometimes
20080ea508b1Smrg# not at the appropriate level. This macro enables a module to test for the
20090ea508b1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20100ea508b1Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
20110ea508b1Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20120ea508b1Smrg# --with-asciidoc assumes 'auto'.
20130ea508b1Smrg#
20140ea508b1Smrg# Interface to module:
20150ea508b1Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
20160ea508b1Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
20170ea508b1Smrg#		 returns the path set by the user in the environment
20180ea508b1Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
20190ea508b1Smrg#		  'no' user instructs the module not to use asciidoc
20200ea508b1Smrg#
20210ea508b1Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
20220ea508b1Smrg#
20230ea508b1SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
20240ea508b1SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
20250ea508b1Smrgm4_define([_defopt], m4_default([$2], [auto]))
20260ea508b1SmrgAC_ARG_WITH(asciidoc,
20270ea508b1Smrg	AS_HELP_STRING([--with-asciidoc],
20280ea508b1Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
20290ea508b1Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
20300ea508b1Smrgm4_undefine([_defopt])
2031c63293b5Smrg
20320ea508b1Smrgif test "x$use_asciidoc" = x"auto"; then
20330ea508b1Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20340ea508b1Smrg   if test "x$ASCIIDOC" = "x"; then
20350ea508b1Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
20360ea508b1Smrg	have_asciidoc=no
20370ea508b1Smrg   else
20380ea508b1Smrg        have_asciidoc=yes
20390ea508b1Smrg   fi
20400ea508b1Smrgelif test "x$use_asciidoc" = x"yes" ; then
20410ea508b1Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20420ea508b1Smrg   if test "x$ASCIIDOC" = "x"; then
20430ea508b1Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
20440ea508b1Smrg   fi
20450ea508b1Smrg   have_asciidoc=yes
20460ea508b1Smrgelif test "x$use_asciidoc" = x"no" ; then
20470ea508b1Smrg   if test "x$ASCIIDOC" != "x"; then
20480ea508b1Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
20490ea508b1Smrg   fi
20500ea508b1Smrg   have_asciidoc=no
20510ea508b1Smrgelse
20520ea508b1Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2053e6d5e4e0Smrgfi
20540ea508b1Smrgm4_ifval([$1],
20550ea508b1Smrg[if test "$have_asciidoc" = yes; then
20560ea508b1Smrg    # scrape the asciidoc version
20570ea508b1Smrg    AC_MSG_CHECKING([the asciidoc version])
20580ea508b1Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
20590ea508b1Smrg    AC_MSG_RESULT([$asciidoc_version])
20600ea508b1Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
20610ea508b1Smrg        [if test "x$use_asciidoc" = xauto; then
20620ea508b1Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
20630ea508b1Smrg            have_asciidoc=no
20640ea508b1Smrg        else
20650ea508b1Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
20660ea508b1Smrg        fi])
20670ea508b1Smrgfi])
20680ea508b1SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
20690ea508b1Smrg]) # XORG_WITH_ASCIIDOC
2070e6d5e4e0Smrg
20710ea508b1Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
20720ea508b1Smrg# -------------------------------------------
20730ea508b1Smrg# Minimum version: 1.5.0
20740ea508b1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20750ea508b1Smrg# Minimum version for optional DOT checking: 1.18.0
20760ea508b1Smrg#
20770ea508b1Smrg# Documentation tools are not always available on all platforms and sometimes
20780ea508b1Smrg# not at the appropriate level. This macro enables a module to test for the
20790ea508b1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20800ea508b1Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
20810ea508b1Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
20820ea508b1Smrg# --with-doxygen assumes 'auto'.
20830ea508b1Smrg#
20840ea508b1Smrg# Interface to module:
20850ea508b1Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
20860ea508b1Smrg# DOXYGEN:	 returns the path of the doxygen program found
20870ea508b1Smrg#		 returns the path set by the user in the environment
20880ea508b1Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
20890ea508b1Smrg#		  'no' user instructs the module not to use doxygen
20900ea508b1Smrg#
20910ea508b1Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
20920ea508b1Smrg#
20930ea508b1SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
20940ea508b1SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
20950ea508b1SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
20960ea508b1Smrgm4_define([_defopt], m4_default([$2], [auto]))
20970ea508b1SmrgAC_ARG_WITH(doxygen,
20980ea508b1Smrg	AS_HELP_STRING([--with-doxygen],
20990ea508b1Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
21000ea508b1Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
21010ea508b1Smrgm4_undefine([_defopt])
2102e169010aSmrg
21030ea508b1Smrgif test "x$use_doxygen" = x"auto"; then
21040ea508b1Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21050ea508b1Smrg   if test "x$DOXYGEN" = "x"; then
21060ea508b1Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
21070ea508b1Smrg	have_doxygen=no
21080ea508b1Smrg   else
21090ea508b1Smrg        have_doxygen=yes
21100ea508b1Smrg   fi
21110ea508b1Smrgelif test "x$use_doxygen" = x"yes" ; then
21120ea508b1Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21130ea508b1Smrg   if test "x$DOXYGEN" = "x"; then
21140ea508b1Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
21150ea508b1Smrg   fi
21160ea508b1Smrg   have_doxygen=yes
21170ea508b1Smrgelif test "x$use_doxygen" = x"no" ; then
21180ea508b1Smrg   if test "x$DOXYGEN" != "x"; then
21190ea508b1Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
21200ea508b1Smrg   fi
21210ea508b1Smrg   have_doxygen=no
21220ea508b1Smrgelse
21230ea508b1Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2124e6d5e4e0Smrgfi
21250ea508b1Smrgm4_ifval([$1],
21260ea508b1Smrg[if test "$have_doxygen" = yes; then
21270ea508b1Smrg    # scrape the doxygen version
21280ea508b1Smrg    AC_MSG_CHECKING([the doxygen version])
21290ea508b1Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
21300ea508b1Smrg    AC_MSG_RESULT([$doxygen_version])
21310ea508b1Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
21320ea508b1Smrg        [if test "x$use_doxygen" = xauto; then
21330ea508b1Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
21340ea508b1Smrg            have_doxygen=no
21350ea508b1Smrg        else
21360ea508b1Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
21370ea508b1Smrg        fi])
21380ea508b1Smrgfi])
2139e169010aSmrg
21400ea508b1Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
21410ea508b1Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
21420ea508b1Smrgdnl 	HAVE_DOT = @HAVE_DOT@
21430ea508b1SmrgHAVE_DOT=no
21440ea508b1Smrgif test "x$have_doxygen" = "xyes"; then
21450ea508b1Smrg  AC_PATH_PROG([DOT], [dot])
21460ea508b1Smrg    if test "x$DOT" != "x"; then
21470ea508b1Smrg      HAVE_DOT=yes
21480ea508b1Smrg    fi
2149e6d5e4e0Smrgfi
2150e169010aSmrg
21510ea508b1SmrgAC_SUBST([HAVE_DOT])
21520ea508b1SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
21530ea508b1SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
21540ea508b1Smrg]) # XORG_WITH_DOXYGEN
2155e169010aSmrg
21560ea508b1Smrg# XORG_WITH_GROFF([DEFAULT])
2157e6d5e4e0Smrg# ----------------
21580ea508b1Smrg# Minimum version: 1.6.0
21590ea508b1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21600ea508b1Smrg#
21610ea508b1Smrg# Documentation tools are not always available on all platforms and sometimes
21620ea508b1Smrg# not at the appropriate level. This macro enables a module to test for the
21630ea508b1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21640ea508b1Smrg# the --with-groff option, it allows maximum flexibility in making decisions
21650ea508b1Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
21660ea508b1Smrg# --with-groff assumes 'auto'.
21670ea508b1Smrg#
21680ea508b1Smrg# Interface to module:
21690ea508b1Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
21700ea508b1Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
21710ea508b1Smrg# HAVE_GROFF_MS: the -ms macros package
21720ea508b1Smrg# GROFF:	 returns the path of the groff program found
21730ea508b1Smrg#		 returns the path set by the user in the environment
21740ea508b1Smrg# --with-groff:	 'yes' user instructs the module to use groff
21750ea508b1Smrg#		 'no' user instructs the module not to use groff
21760ea508b1Smrg#
21770ea508b1Smrg# Added in version 1.9.0:
21780ea508b1Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
21790ea508b1Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
21800ea508b1Smrg#		   psselect from the psutils package.
21810ea508b1Smrg#		   the ghostcript package. Refer to the grohtml man pages
21820ea508b1Smrg#
21830ea508b1Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
21840ea508b1Smrg#
21850ea508b1Smrg# OS and distros often splits groff in a basic and full package, the former
21860ea508b1Smrg# having the groff program and the later having devices, fonts and macros
21870ea508b1Smrg# Checking for the groff executable is not enough.
21880ea508b1Smrg#
21890ea508b1Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
21900ea508b1Smrg# unset HAVE_GROFF or GROFF env variables.
21910ea508b1Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
21920ea508b1Smrg#
21930ea508b1SmrgAC_DEFUN([XORG_WITH_GROFF],[
21940ea508b1SmrgAC_ARG_VAR([GROFF], [Path to groff command])
21950ea508b1Smrgm4_define([_defopt], m4_default([$1], [auto]))
21960ea508b1SmrgAC_ARG_WITH(groff,
21970ea508b1Smrg	AS_HELP_STRING([--with-groff],
21980ea508b1Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
21990ea508b1Smrg	   [use_groff=$withval], [use_groff=]_defopt)
22000ea508b1Smrgm4_undefine([_defopt])
2201e169010aSmrg
22020ea508b1Smrgif test "x$use_groff" = x"auto"; then
22030ea508b1Smrg   AC_PATH_PROG([GROFF], [groff])
22040ea508b1Smrg   if test "x$GROFF" = "x"; then
22050ea508b1Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
22060ea508b1Smrg	have_groff=no
22070ea508b1Smrg   else
22080ea508b1Smrg        have_groff=yes
22090ea508b1Smrg   fi
22100ea508b1Smrgelif test "x$use_groff" = x"yes" ; then
22110ea508b1Smrg   AC_PATH_PROG([GROFF], [groff])
22120ea508b1Smrg   if test "x$GROFF" = "x"; then
22130ea508b1Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
22140ea508b1Smrg   fi
22150ea508b1Smrg   have_groff=yes
22160ea508b1Smrgelif test "x$use_groff" = x"no" ; then
22170ea508b1Smrg   if test "x$GROFF" != "x"; then
22180ea508b1Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
22190ea508b1Smrg   fi
22200ea508b1Smrg   have_groff=no
22210ea508b1Smrgelse
22220ea508b1Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
22230ea508b1Smrgfi
22249d0ccd10Smrg
22250ea508b1Smrg# We have groff, test for the presence of the macro packages
22260ea508b1Smrgif test "x$have_groff" = x"yes"; then
22270ea508b1Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
22280ea508b1Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
22290ea508b1Smrg        groff_ms_works=yes
22300ea508b1Smrg    else
22310ea508b1Smrg        groff_ms_works=no
22320ea508b1Smrg    fi
22330ea508b1Smrg    AC_MSG_RESULT([$groff_ms_works])
22340ea508b1Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
22350ea508b1Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
22360ea508b1Smrg        groff_mm_works=yes
22370ea508b1Smrg    else
22380ea508b1Smrg        groff_mm_works=no
22390ea508b1Smrg    fi
22400ea508b1Smrg    AC_MSG_RESULT([$groff_mm_works])
22410ea508b1Smrgfi
22429d0ccd10Smrg
22430ea508b1Smrg# We have groff, test for HTML dependencies, one command per package
22440ea508b1Smrgif test "x$have_groff" = x"yes"; then
22450ea508b1Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
22460ea508b1Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
22470ea508b1Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
22480ea508b1Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
22490ea508b1Smrg      have_groff_html=yes
22500ea508b1Smrg   else
22510ea508b1Smrg      have_groff_html=no
22520ea508b1Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
22530ea508b1Smrg   fi
22549d0ccd10Smrgfi
22559d0ccd10Smrg
22560ea508b1Smrg# Set Automake conditionals for Makefiles
22570ea508b1SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
22580ea508b1SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
22590ea508b1SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
22600ea508b1SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
22610ea508b1Smrg]) # XORG_WITH_GROFF
22629d0ccd10Smrg
22630ea508b1Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
22640ea508b1Smrg# ---------------------------------------
22650ea508b1Smrg# Minimum version: 1.6.0
22660ea508b1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
22670ea508b1Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
22689d0ccd10Smrg#
22690ea508b1Smrg# Documentation tools are not always available on all platforms and sometimes
22700ea508b1Smrg# not at the appropriate level. This macro enables a module to test for the
22710ea508b1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22720ea508b1Smrg# the --with-fop option, it allows maximum flexibility in making decisions
22730ea508b1Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
22740ea508b1Smrg# --with-fop assumes 'auto'.
22759d0ccd10Smrg#
22760ea508b1Smrg# Interface to module:
22770ea508b1Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
22780ea508b1Smrg# FOP:	 	returns the path of the fop program found
22790ea508b1Smrg#		returns the path set by the user in the environment
22800ea508b1Smrg# --with-fop: 	'yes' user instructs the module to use fop
22810ea508b1Smrg#		'no' user instructs the module not to use fop
2282e6d5e4e0Smrg#
22830ea508b1Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2284e6d5e4e0Smrg#
22850ea508b1SmrgAC_DEFUN([XORG_WITH_FOP],[
22860ea508b1SmrgAC_ARG_VAR([FOP], [Path to fop command])
22870ea508b1Smrgm4_define([_defopt], m4_default([$2], [auto]))
22880ea508b1SmrgAC_ARG_WITH(fop,
22890ea508b1Smrg	AS_HELP_STRING([--with-fop],
22900ea508b1Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
22910ea508b1Smrg	   [use_fop=$withval], [use_fop=]_defopt)
22920ea508b1Smrgm4_undefine([_defopt])
2293e6d5e4e0Smrg
22940ea508b1Smrgif test "x$use_fop" = x"auto"; then
22950ea508b1Smrg   AC_PATH_PROG([FOP], [fop])
22960ea508b1Smrg   if test "x$FOP" = "x"; then
22970ea508b1Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
22980ea508b1Smrg	have_fop=no
22990ea508b1Smrg   else
23000ea508b1Smrg        have_fop=yes
23010ea508b1Smrg   fi
23020ea508b1Smrgelif test "x$use_fop" = x"yes" ; then
23030ea508b1Smrg   AC_PATH_PROG([FOP], [fop])
23040ea508b1Smrg   if test "x$FOP" = "x"; then
23050ea508b1Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
23060ea508b1Smrg   fi
23070ea508b1Smrg   have_fop=yes
23080ea508b1Smrgelif test "x$use_fop" = x"no" ; then
23090ea508b1Smrg   if test "x$FOP" != "x"; then
23100ea508b1Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
23110ea508b1Smrg   fi
23120ea508b1Smrg   have_fop=no
23130ea508b1Smrgelse
23140ea508b1Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
23150ea508b1Smrgfi
2316e6d5e4e0Smrg
23170ea508b1Smrg# Test for a minimum version of fop, if provided.
23180ea508b1Smrgm4_ifval([$1],
23190ea508b1Smrg[if test "$have_fop" = yes; then
23200ea508b1Smrg    # scrape the fop version
23210ea508b1Smrg    AC_MSG_CHECKING([for fop minimum version])
23220ea508b1Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
23230ea508b1Smrg    AC_MSG_RESULT([$fop_version])
23240ea508b1Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
23250ea508b1Smrg        [if test "x$use_fop" = xauto; then
23260ea508b1Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
23270ea508b1Smrg            have_fop=no
23280ea508b1Smrg        else
23290ea508b1Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
23300ea508b1Smrg        fi])
23310ea508b1Smrgfi])
23320ea508b1SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
23330ea508b1Smrg]) # XORG_WITH_FOP
2334e6d5e4e0Smrg
23350ea508b1Smrg# XORG_WITH_M4([MIN-VERSION])
23360ea508b1Smrg# ---------------------------
23370ea508b1Smrg# Minimum version: 1.19.0
23389d0ccd10Smrg#
23390ea508b1Smrg# This macro attempts to locate an m4 macro processor which supports
23400ea508b1Smrg# -I option and is only useful for modules relying on M4 in order to
23410ea508b1Smrg# expand macros in source code files.
23429d0ccd10Smrg#
23430ea508b1Smrg# Interface to module:
23440ea508b1Smrg# M4:	 	returns the path of the m4 program found
23450ea508b1Smrg#		returns the path set by the user in the environment
23460ea508b1Smrg#
23470ea508b1SmrgAC_DEFUN([XORG_WITH_M4], [
23480ea508b1SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
23490ea508b1Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
23500ea508b1Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
23510ea508b1Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
23520ea508b1Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
23530ea508b1Smrg   [$PATH:/usr/gnu/bin])])
2354e169010aSmrg
23550ea508b1SmrgAC_SUBST([M4], [$ac_cv_path_M4])
23560ea508b1Smrg]) # XORG_WITH_M4
2357e169010aSmrg
23580ea508b1Smrg# XORG_WITH_PS2PDF([DEFAULT])
23590ea508b1Smrg# ----------------
23600ea508b1Smrg# Minimum version: 1.6.0
23610ea508b1Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23620ea508b1Smrg#
23630ea508b1Smrg# Documentation tools are not always available on all platforms and sometimes
23640ea508b1Smrg# not at the appropriate level. This macro enables a module to test for the
23650ea508b1Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
23660ea508b1Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
23670ea508b1Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
23680ea508b1Smrg# --with-ps2pdf assumes 'auto'.
23690ea508b1Smrg#
23700ea508b1Smrg# Interface to module:
23710ea508b1Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
23720ea508b1Smrg# PS2PDF:	returns the path of the ps2pdf program found
23730ea508b1Smrg#		returns the path set by the user in the environment
23740ea508b1Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
23750ea508b1Smrg#		 'no' user instructs the module not to use ps2pdf
23760ea508b1Smrg#
23770ea508b1Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
23780ea508b1Smrg#
23790ea508b1SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
23800ea508b1SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
23810ea508b1Smrgm4_define([_defopt], m4_default([$1], [auto]))
23820ea508b1SmrgAC_ARG_WITH(ps2pdf,
23830ea508b1Smrg	AS_HELP_STRING([--with-ps2pdf],
23840ea508b1Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
23850ea508b1Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
23860ea508b1Smrgm4_undefine([_defopt])
2387e169010aSmrg
23880ea508b1Smrgif test "x$use_ps2pdf" = x"auto"; then
23890ea508b1Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23900ea508b1Smrg   if test "x$PS2PDF" = "x"; then
23910ea508b1Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
23920ea508b1Smrg	have_ps2pdf=no
23930ea508b1Smrg   else
23940ea508b1Smrg        have_ps2pdf=yes
23950ea508b1Smrg   fi
23960ea508b1Smrgelif test "x$use_ps2pdf" = x"yes" ; then
23970ea508b1Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23980ea508b1Smrg   if test "x$PS2PDF" = "x"; then
23990ea508b1Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
24000ea508b1Smrg   fi
24010ea508b1Smrg   have_ps2pdf=yes
24020ea508b1Smrgelif test "x$use_ps2pdf" = x"no" ; then
24030ea508b1Smrg   if test "x$PS2PDF" != "x"; then
24040ea508b1Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
24050ea508b1Smrg   fi
24060ea508b1Smrg   have_ps2pdf=no
24070ea508b1Smrgelse
24080ea508b1Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
24090ea508b1Smrgfi
24100ea508b1SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
24110ea508b1Smrg]) # XORG_WITH_PS2PDF
2412e8ead290Smrg
24130ea508b1Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
24140ea508b1Smrg# ----------------
24150ea508b1Smrg# Minimum version: 1.6.0
2416e6d5e4e0Smrg#
24170ea508b1Smrg# Documentation tools are not always available on all platforms and sometimes
24180ea508b1Smrg# not at the appropriate level. This macro enables a builder to skip all
24190ea508b1Smrg# documentation targets except traditional man pages.
24200ea508b1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24210ea508b1Smrg# maximum flexibility in controlling documentation building.
24220ea508b1Smrg# Refer to:
24230ea508b1Smrg# XORG_WITH_XMLTO         --with-xmlto
24240ea508b1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24250ea508b1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24260ea508b1Smrg# XORG_WITH_FOP           --with-fop
24270ea508b1Smrg# XORG_WITH_GROFF         --with-groff
24280ea508b1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24290ea508b1Smrg#
24300ea508b1Smrg# Interface to module:
24310ea508b1Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
24320ea508b1Smrg# --enable-docs: 'yes' user instructs the module to generate docs
24330ea508b1Smrg#		 'no' user instructs the module not to generate docs
24340ea508b1Smrg# parm1:	specify the default value, yes or no.
24350ea508b1Smrg#
24360ea508b1SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
24370ea508b1Smrgm4_define([docs_default], m4_default([$1], [yes]))
24380ea508b1SmrgAC_ARG_ENABLE(docs,
24390ea508b1Smrg	AS_HELP_STRING([--enable-docs],
24400ea508b1Smrg	   [Enable building the documentation (default: ]docs_default[)]),
24410ea508b1Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
24420ea508b1Smrgm4_undefine([docs_default])
24430ea508b1SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
24440ea508b1SmrgAC_MSG_CHECKING([whether to build documentation])
24450ea508b1SmrgAC_MSG_RESULT([$build_docs])
24460ea508b1Smrg]) # XORG_ENABLE_DOCS
24477914d74bSmrg
24480ea508b1Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
24490ea508b1Smrg# ----------------
24500ea508b1Smrg# Minimum version: 1.6.0
24510ea508b1Smrg#
24520ea508b1Smrg# This macro enables a builder to skip all developer documentation.
24530ea508b1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24540ea508b1Smrg# maximum flexibility in controlling documentation building.
24550ea508b1Smrg# Refer to:
24560ea508b1Smrg# XORG_WITH_XMLTO         --with-xmlto
24570ea508b1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24580ea508b1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24590ea508b1Smrg# XORG_WITH_FOP           --with-fop
24600ea508b1Smrg# XORG_WITH_GROFF         --with-groff
24610ea508b1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24620ea508b1Smrg#
24630ea508b1Smrg# Interface to module:
24640ea508b1Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
24650ea508b1Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
24660ea508b1Smrg#			'no' user instructs the module not to generate developer docs
24670ea508b1Smrg# parm1:		specify the default value, yes or no.
24680ea508b1Smrg#
24690ea508b1SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
24700ea508b1Smrgm4_define([devel_default], m4_default([$1], [yes]))
24710ea508b1SmrgAC_ARG_ENABLE(devel-docs,
24720ea508b1Smrg	AS_HELP_STRING([--enable-devel-docs],
24730ea508b1Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
24740ea508b1Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
24750ea508b1Smrgm4_undefine([devel_default])
24760ea508b1SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
24770ea508b1SmrgAC_MSG_CHECKING([whether to build developer documentation])
24780ea508b1SmrgAC_MSG_RESULT([$build_devel_docs])
24790ea508b1Smrg]) # XORG_ENABLE_DEVEL_DOCS
24809d0ccd10Smrg
24810ea508b1Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
24820ea508b1Smrg# ----------------
24830ea508b1Smrg# Minimum version: 1.6.0
24840ea508b1Smrg#
24850ea508b1Smrg# This macro enables a builder to skip all functional specification targets.
24860ea508b1Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
24870ea508b1Smrg# maximum flexibility in controlling documentation building.
24880ea508b1Smrg# Refer to:
24890ea508b1Smrg# XORG_WITH_XMLTO         --with-xmlto
24900ea508b1Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24910ea508b1Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24920ea508b1Smrg# XORG_WITH_FOP           --with-fop
24930ea508b1Smrg# XORG_WITH_GROFF         --with-groff
24940ea508b1Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24950ea508b1Smrg#
24960ea508b1Smrg# Interface to module:
24970ea508b1Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
24980ea508b1Smrg# --enable-specs:	'yes' user instructs the module to generate specs
24990ea508b1Smrg#			'no' user instructs the module not to generate specs
25000ea508b1Smrg# parm1:		specify the default value, yes or no.
25010ea508b1Smrg#
25020ea508b1SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
25030ea508b1Smrgm4_define([spec_default], m4_default([$1], [yes]))
25040ea508b1SmrgAC_ARG_ENABLE(specs,
25050ea508b1Smrg	AS_HELP_STRING([--enable-specs],
25060ea508b1Smrg	   [Enable building the specs (default: ]spec_default[)]),
25070ea508b1Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
25080ea508b1Smrgm4_undefine([spec_default])
25090ea508b1SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
25100ea508b1SmrgAC_MSG_CHECKING([whether to build functional specifications])
25110ea508b1SmrgAC_MSG_RESULT([$build_specs])
25120ea508b1Smrg]) # XORG_ENABLE_SPECS
25139d0ccd10Smrg
25140ea508b1Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
25150ea508b1Smrg# ----------------------------------------------
25160ea508b1Smrg# Minimum version: 1.13.0
2517e6d5e4e0Smrg#
25180ea508b1Smrg# This macro enables a builder to enable/disable unit testing
25190ea508b1Smrg# It makes no assumption about the test cases implementation
25200ea508b1Smrg# Test cases may or may not use Automake "Support for test suites"
25210ea508b1Smrg# They may or may not use the software utility library GLib
25220ea508b1Smrg#
25230ea508b1Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
25240ea508b1Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
25250ea508b1Smrg# The variable enable_unit_tests is used by other macros in this file.
25260ea508b1Smrg#
25270ea508b1Smrg# Interface to module:
25280ea508b1Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
25290ea508b1Smrg# enable_unit_tests:    used in configure.ac for additional configuration
25300ea508b1Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
25310ea508b1Smrg#			'no' user instructs the module not to build tests
25320ea508b1Smrg# parm1:		specify the default value, yes or no.
25330ea508b1Smrg#
25340ea508b1SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
25350ea508b1SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
25360ea508b1SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
25370ea508b1SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25380ea508b1Smrgm4_define([_defopt], m4_default([$1], [auto]))
25390ea508b1SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
25400ea508b1Smrg	[Enable building unit test cases (default: ]_defopt[)]),
25410ea508b1Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
25420ea508b1Smrgm4_undefine([_defopt])
25430ea508b1SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
25440ea508b1SmrgAC_MSG_CHECKING([whether to build unit test cases])
25450ea508b1SmrgAC_MSG_RESULT([$enable_unit_tests])
25460ea508b1Smrg]) # XORG_ENABLE_UNIT_TESTS
25479d0ccd10Smrg
25480ea508b1Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
25490ea508b1Smrg# ------------------------------------------------------
25500ea508b1Smrg# Minimum version: 1.17.0
25510ea508b1Smrg#
25520ea508b1Smrg# This macro enables a builder to enable/disable integration testing
25530ea508b1Smrg# It makes no assumption about the test cases' implementation
25540ea508b1Smrg# Test cases may or may not use Automake "Support for test suites"
25550ea508b1Smrg#
25560ea508b1Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
25570ea508b1Smrg# usually requires less dependencies and may be built and run under less
25580ea508b1Smrg# stringent environments than integration tests.
25590ea508b1Smrg#
25600ea508b1Smrg# Interface to module:
25610ea508b1Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
25620ea508b1Smrg# enable_integration_tests:   used in configure.ac for additional configuration
25630ea508b1Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
25640ea508b1Smrg#                             'no' user instructs the module not to build tests
25650ea508b1Smrg# parm1:                      specify the default value, yes or no.
25660ea508b1Smrg#
25670ea508b1SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
25680ea508b1SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25690ea508b1Smrgm4_define([_defopt], m4_default([$1], [auto]))
25700ea508b1SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
25710ea508b1Smrg	[Enable building integration test cases (default: ]_defopt[)]),
25720ea508b1Smrg	[enable_integration_tests=$enableval],
25730ea508b1Smrg	[enable_integration_tests=]_defopt)
25740ea508b1Smrgm4_undefine([_defopt])
25750ea508b1SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
25760ea508b1Smrg	[test "x$enable_integration_tests" != xno])
25770ea508b1SmrgAC_MSG_CHECKING([whether to build unit test cases])
25780ea508b1SmrgAC_MSG_RESULT([$enable_integration_tests])
25790ea508b1Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
25809d0ccd10Smrg
25810ea508b1Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
25820ea508b1Smrg# ----------------------------------------
25830ea508b1Smrg# Minimum version: 1.13.0
25840ea508b1Smrg#
25850ea508b1Smrg# GLib is a library which provides advanced data structures and functions.
25860ea508b1Smrg# This macro enables a module to test for the presence of Glib.
25870ea508b1Smrg#
25880ea508b1Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
25890ea508b1Smrg# Otherwise the value of $enable_unit_tests is blank.
25900ea508b1Smrg#
25910ea508b1Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
25920ea508b1Smrg# test support usually requires less dependencies and may be built and run under
25930ea508b1Smrg# less stringent environments than integration tests.
2594e6d5e4e0Smrg#
25950ea508b1Smrg# Interface to module:
25960ea508b1Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
25970ea508b1Smrg# with_glib: used in configure.ac to know if GLib has been found
25980ea508b1Smrg# --with-glib:	'yes' user instructs the module to use glib
25990ea508b1Smrg#		'no' user instructs the module not to use glib
26000ea508b1Smrg#
26010ea508b1SmrgAC_DEFUN([XORG_WITH_GLIB],[
26020ea508b1SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
26030ea508b1Smrgm4_define([_defopt], m4_default([$2], [auto]))
26040ea508b1SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
26050ea508b1Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
26060ea508b1Smrg	[with_glib=$withval], [with_glib=]_defopt)
26070ea508b1Smrgm4_undefine([_defopt])
2608e169010aSmrg
26090ea508b1Smrghave_glib=no
26100ea508b1Smrg# Do not probe GLib if user explicitly disabled unit testing
26110ea508b1Smrgif test "x$enable_unit_tests" != x"no"; then
26120ea508b1Smrg  # Do not probe GLib if user explicitly disabled it
26130ea508b1Smrg  if test "x$with_glib" != x"no"; then
26140ea508b1Smrg    m4_ifval(
26150ea508b1Smrg      [$1],
26160ea508b1Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
26170ea508b1Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
26180ea508b1Smrg    )
26199d0ccd10Smrg  fi
26209d0ccd10Smrgfi
26219d0ccd10Smrg
26220ea508b1Smrg# Not having GLib when unit testing has been explicitly requested is an error
26230ea508b1Smrgif test "x$enable_unit_tests" = x"yes"; then
26240ea508b1Smrg  if test "x$have_glib" = x"no"; then
26250ea508b1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26269d0ccd10Smrg  fi
2627e6d5e4e0Smrgfi
2628e169010aSmrg
26290ea508b1Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
26300ea508b1Smrgif test "x$enable_unit_tests" = x"no"; then
26310ea508b1Smrg  if test "x$with_glib" = x"yes"; then
26320ea508b1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26330ea508b1Smrg  fi
26340ea508b1Smrgfi
2635e6d5e4e0Smrg
26360ea508b1Smrg# Not having GLib when it has been explicitly requested is an error
26370ea508b1Smrgif test "x$with_glib" = x"yes"; then
26380ea508b1Smrg  if test "x$have_glib" = x"no"; then
26390ea508b1Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
26400ea508b1Smrg  fi
26410ea508b1Smrgfi
2642e169010aSmrg
26430ea508b1SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
26440ea508b1Smrg]) # XORG_WITH_GLIB
26459d0ccd10Smrg
26460ea508b1Smrg# XORG_LD_WRAP([required|optional])
26470ea508b1Smrg# ---------------------------------
26480ea508b1Smrg# Minimum version: 1.13.0
26490ea508b1Smrg#
26500ea508b1Smrg# Check if linker supports -wrap, passed via compiler flags
26510ea508b1Smrg#
26520ea508b1Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
26530ea508b1Smrg# Otherwise the value of $enable_unit_tests is blank.
26540ea508b1Smrg#
26550ea508b1Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
26560ea508b1Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
26570ea508b1Smrg# available, an argument of "optional" allows use when some unit tests require
26580ea508b1Smrg# ld -wrap and others do not.
26590ea508b1Smrg#
26600ea508b1SmrgAC_DEFUN([XORG_LD_WRAP],[
26610ea508b1SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
26620ea508b1Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
26630ea508b1Smrg                      void __wrap_exit(int status) { return; }],
26640ea508b1Smrg                     [exit(0);])])
26650ea508b1Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
26660ea508b1Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
26670ea508b1Smrg  if test "x$have_ld_wrap" = x"no"; then
26680ea508b1Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
26690ea508b1Smrg  fi
26700ea508b1Smrgfi
26710ea508b1SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
26720ea508b1Smrg#
26730ea508b1Smrg]) # XORG_LD_WRAP
26749d0ccd10Smrg
26750ea508b1Smrg# XORG_CHECK_LINKER_FLAGS
26760ea508b1Smrg# -----------------------
26770ea508b1Smrg# SYNOPSIS
26780ea508b1Smrg#
26790ea508b1Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
26800ea508b1Smrg#
26810ea508b1Smrg# DESCRIPTION
26820ea508b1Smrg#
26830ea508b1Smrg#   Check whether the given linker FLAGS work with the current language's
26840ea508b1Smrg#   linker, or whether they give an error.
26850ea508b1Smrg#
26860ea508b1Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
26870ea508b1Smrg#   success/failure.
26880ea508b1Smrg#
26890ea508b1Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
26900ea508b1Smrg#
26910ea508b1Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
26920ea508b1Smrg#
26930ea508b1Smrg# LICENSE
26940ea508b1Smrg#
26950ea508b1Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
26960ea508b1Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
26970ea508b1Smrg#   Copyright (c) 2009 Matteo Frigo
26980ea508b1Smrg#
26990ea508b1Smrg#   This program is free software: you can redistribute it and/or modify it
27000ea508b1Smrg#   under the terms of the GNU General Public License as published by the
27010ea508b1Smrg#   Free Software Foundation, either version 3 of the License, or (at your
27020ea508b1Smrg#   option) any later version.
27030ea508b1Smrg#
27040ea508b1Smrg#   This program is distributed in the hope that it will be useful, but
27050ea508b1Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
27060ea508b1Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27070ea508b1Smrg#   Public License for more details.
27080ea508b1Smrg#
27090ea508b1Smrg#   You should have received a copy of the GNU General Public License along
27100ea508b1Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
27110ea508b1Smrg#
27120ea508b1Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
27130ea508b1Smrg#   gives unlimited permission to copy, distribute and modify the configure
27140ea508b1Smrg#   scripts that are the output of Autoconf when processing the Macro. You
27150ea508b1Smrg#   need not follow the terms of the GNU General Public License when using
27160ea508b1Smrg#   or distributing such scripts, even though portions of the text of the
27170ea508b1Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
27180ea508b1Smrg#   all other use of the material that constitutes the Autoconf Macro.
27190ea508b1Smrg#
27200ea508b1Smrg#   This special exception to the GPL applies to versions of the Autoconf
27210ea508b1Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
27220ea508b1Smrg#   modified version of the Autoconf Macro, you may extend this special
27230ea508b1Smrg#   exception to the GPL to apply to your modified version as well.#
27240ea508b1SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
27250ea508b1Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
27260ea508b1Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
27270ea508b1SmrgAS_LITERAL_IF([$1],
27280ea508b1Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
27290ea508b1Smrg      ax_save_FLAGS=$LDFLAGS
27300ea508b1Smrg      LDFLAGS="$1"
27310ea508b1Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
27320ea508b1Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27330ea508b1Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27340ea508b1Smrg      LDFLAGS=$ax_save_FLAGS])],
27350ea508b1Smrg  [ax_save_FLAGS=$LDFLAGS
27360ea508b1Smrg   LDFLAGS="$1"
27370ea508b1Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
27380ea508b1Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27390ea508b1Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27400ea508b1Smrg   LDFLAGS=$ax_save_FLAGS])
27410ea508b1Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
27420ea508b1SmrgAC_MSG_RESULT($xorg_check_linker_flags)
27430ea508b1Smrgif test "x$xorg_check_linker_flags" = xyes; then
27440ea508b1Smrg	m4_default([$2], :)
27450ea508b1Smrgelse
27460ea508b1Smrg	m4_default([$3], :)
27470ea508b1Smrgfi
27480ea508b1Smrg]) # XORG_CHECK_LINKER_FLAGS
2749e169010aSmrg
27500ea508b1Smrg# XORG_MEMORY_CHECK_FLAGS
27510ea508b1Smrg# -----------------------
27520ea508b1Smrg# Minimum version: 1.16.0
27530ea508b1Smrg#
27540ea508b1Smrg# This macro attempts to find appropriate memory checking functionality
27550ea508b1Smrg# for various platforms which unit testing code may use to catch various
27560ea508b1Smrg# forms of memory allocation and access errors in testing.
27570ea508b1Smrg#
27580ea508b1Smrg# Interface to module:
27590ea508b1Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
27600ea508b1Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
27610ea508b1Smrg#
27620ea508b1Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
27630ea508b1Smrg#
27640ea508b1SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
27657914d74bSmrg
27660ea508b1SmrgAC_REQUIRE([AC_CANONICAL_HOST])
27670ea508b1SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
27680ea508b1Smrg           [Environment variables to enable memory checking in tests])
27697914d74bSmrg
27700ea508b1Smrg# Check for different types of support on different platforms
27710ea508b1Smrgcase $host_os in
27720ea508b1Smrg    solaris*)
27730ea508b1Smrg        AC_CHECK_LIB([umem], [umem_alloc],
27740ea508b1Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
27750ea508b1Smrg        ;;
27760ea508b1Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
27770ea508b1Smrg        # both directly and inverted, so should not be 0 or 255.
27780ea508b1Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
27790ea508b1Smrg        ;;
27800ea508b1Smrg    darwin*)
27810ea508b1Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
27820ea508b1Smrg        ;;
27830ea508b1Smrg    *bsd*)
27840ea508b1Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
27850ea508b1Smrg        ;;
27860ea508b1Smrgesac
27877914d74bSmrg
27880ea508b1Smrg# User supplied flags override default flags
27890ea508b1Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
27900ea508b1Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2791e6d5e4e0Smrgfi
2792e8ead290Smrg
27930ea508b1SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
27940ea508b1Smrg]) # XORG_WITH_LINT
2795e8ead290Smrg
27960ea508b1Smrg# XORG_CHECK_MALLOC_ZERO
27970ea508b1Smrg# ----------------------
27980ea508b1Smrg# Minimum version: 1.0.0
2799e6d5e4e0Smrg#
28000ea508b1Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
28010ea508b1Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
28020ea508b1Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
28030ea508b1SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
28040ea508b1SmrgAC_ARG_ENABLE(malloc0returnsnull,
28050ea508b1Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
28060ea508b1Smrg		       [malloc(0) returns NULL (default: auto)]),
28070ea508b1Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
28080ea508b1Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2809e169010aSmrg
28100ea508b1SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
28110ea508b1Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
28120ea508b1SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
28130ea508b1Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
28140ea508b1Smrg#include <stdlib.h>
28150ea508b1Smrg],[
28160ea508b1Smrg    char *m0, *r0, *c0, *p;
28170ea508b1Smrg    m0 = malloc(0);
28180ea508b1Smrg    p = malloc(10);
28190ea508b1Smrg    r0 = realloc(p,0);
28200ea508b1Smrg    c0 = calloc(0,10);
28210ea508b1Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
28220ea508b1Smrg])],
28230ea508b1Smrg		[xorg_cv_malloc0_returns_null=yes],
28240ea508b1Smrg		[xorg_cv_malloc0_returns_null=no])])
28250ea508b1SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
28269d0ccd10Smrgfi
28270ea508b1SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
28289d0ccd10Smrg
28290ea508b1Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
28300ea508b1Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
28310ea508b1Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
28320ea508b1Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
28339d0ccd10Smrgelse
28340ea508b1Smrg	MALLOC_ZERO_CFLAGS=""
28350ea508b1Smrg	XMALLOC_ZERO_CFLAGS=""
28360ea508b1Smrg	XTMALLOC_ZERO_CFLAGS=""
2837e6d5e4e0Smrgfi
28387914d74bSmrg
28390ea508b1SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
28400ea508b1SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
28410ea508b1SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
28420ea508b1Smrg]) # XORG_CHECK_MALLOC_ZERO
2843e6d5e4e0Smrg
28440ea508b1Smrg# XORG_WITH_LINT()
28450ea508b1Smrg# ----------------
28460ea508b1Smrg# Minimum version: 1.1.0
2847e6d5e4e0Smrg#
28480ea508b1Smrg# This macro enables the use of a tool that flags some suspicious and
28490ea508b1Smrg# non-portable constructs (likely to be bugs) in C language source code.
28500ea508b1Smrg# It will attempt to locate the tool and use appropriate options.
28510ea508b1Smrg# There are various lint type tools on different platforms.
28529d0ccd10Smrg#
28530ea508b1Smrg# Interface to module:
28540ea508b1Smrg# LINT:		returns the path to the tool found on the platform
28550ea508b1Smrg#		or the value set to LINT on the configure cmd line
28560ea508b1Smrg#		also an Automake conditional
28570ea508b1Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
28580ea508b1Smrg#
28590ea508b1Smrg# --with-lint:	'yes' user instructs the module to use lint
28600ea508b1Smrg#		'no' user instructs the module not to use lint (default)
28610ea508b1Smrg#
28620ea508b1Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
28630ea508b1Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
28640ea508b1Smrg#
28650ea508b1SmrgAC_DEFUN([XORG_WITH_LINT],[
2866e8ead290Smrg
28670ea508b1SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
28680ea508b1SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
28690ea508b1SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
28700ea508b1Smrg		[Use a lint-style source code checker (default: disabled)])],
28710ea508b1Smrg		[use_lint=$withval], [use_lint=no])
2872e6d5e4e0Smrg
28730ea508b1Smrg# Obtain platform specific info like program name and options
28740ea508b1Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
28750ea508b1Smrgcase $host_os in
28760ea508b1Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
28770ea508b1Smrg	lint_name=splint
28780ea508b1Smrg	lint_options="-badflag"
28790ea508b1Smrg	;;
28800ea508b1Smrg  *freebsd* | *netbsd*)
28810ea508b1Smrg	lint_name=lint
28820ea508b1Smrg	lint_options="-u -b"
28830ea508b1Smrg	;;
28840ea508b1Smrg  *solaris*)
28850ea508b1Smrg	lint_name=lint
28860ea508b1Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
28870ea508b1Smrg	;;
28880ea508b1Smrgesac
28890ea508b1Smrg
28900ea508b1Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
28910ea508b1Smrgif test "x$use_lint" = x"yes" ; then
28920ea508b1Smrg   AC_PATH_PROG([LINT], [$lint_name])
28930ea508b1Smrg   if test "x$LINT" = "x"; then
28940ea508b1Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
28950ea508b1Smrg   fi
28960ea508b1Smrgelif test "x$use_lint" = x"no" ; then
28970ea508b1Smrg   if test "x$LINT" != "x"; then
28980ea508b1Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
28990ea508b1Smrg   fi
29009d0ccd10Smrgelse
29010ea508b1Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902e6d5e4e0Smrgfi
2903e6d5e4e0Smrg
29040ea508b1Smrg# User supplied flags override default flags
29050ea508b1Smrgif test "x$LINT_FLAGS" != "x"; then
29060ea508b1Smrg   lint_options=$LINT_FLAGS
29070ea508b1Smrgfi
2908e6d5e4e0Smrg
29090ea508b1SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
29100ea508b1SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911e6d5e4e0Smrg
29120ea508b1Smrg]) # XORG_WITH_LINT
2913e8ead290Smrg
29140ea508b1Smrg# XORG_LINT_LIBRARY(LIBNAME)
29150ea508b1Smrg# --------------------------
29160ea508b1Smrg# Minimum version: 1.1.0
2917e6d5e4e0Smrg#
29180ea508b1Smrg# Sets up flags for building lint libraries for checking programs that call
29190ea508b1Smrg# functions in the library.
29200ea508b1Smrg#
29210ea508b1Smrg# Interface to module:
29220ea508b1Smrg# LINTLIB		- Automake variable with the name of lint library file to make
29230ea508b1Smrg# MAKE_LINT_LIB		- Automake conditional
29240ea508b1Smrg#
29250ea508b1Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
29260ea508b1Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2927e6d5e4e0Smrg
29280ea508b1SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
29290ea508b1SmrgAC_REQUIRE([XORG_WITH_LINT])
29300ea508b1SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
29310ea508b1Smrg	[Create lint library (default: disabled)])],
29320ea508b1Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
29330ea508b1Smrg
29340ea508b1Smrgif test "x$make_lint_lib" = x"yes" ; then
29350ea508b1Smrg   LINTLIB=llib-l$1.ln
29360ea508b1Smrg   if test "x$LINT" = "x"; then
29370ea508b1Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
29380ea508b1Smrg   fi
29390ea508b1Smrgelif test "x$make_lint_lib" != x"no" ; then
29400ea508b1Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2941e6d5e4e0Smrgfi
29429d0ccd10Smrg
29430ea508b1SmrgAC_SUBST(LINTLIB)
29440ea508b1SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
29459d0ccd10Smrg
29460ea508b1Smrg]) # XORG_LINT_LIBRARY
29477914d74bSmrg
29480ea508b1Smrg# XORG_COMPILER_BRAND
29499d0ccd10Smrg# -------------------
29500ea508b1Smrg# Minimum version: 1.14.0
29519d0ccd10Smrg#
29520ea508b1Smrg# Checks for various brands of compilers and sets flags as appropriate:
29530ea508b1Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
29540ea508b1Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
29550ea508b1Smrg#   clang compiler - sets CLANGCC to "yes"
29560ea508b1Smrg#   Intel compiler - sets INTELCC to "yes"
29570ea508b1Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
29580ea508b1Smrg#
29590ea508b1SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
29600ea508b1SmrgAC_LANG_CASE(
29610ea508b1Smrg	[C], [
29620ea508b1Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
29630ea508b1Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
29640ea508b1Smrg		m4_version_prereq([2.70],
29650ea508b1Smrg			[AC_REQUIRE([AC_PROG_CC])],
29660ea508b1Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
29670ea508b1Smrg	],
29680ea508b1Smrg	[C++], [
29690ea508b1Smrg		AC_REQUIRE([AC_PROG_CXX])
29700ea508b1Smrg	]
29710ea508b1Smrg)
29720ea508b1SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
29730ea508b1SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
29740ea508b1SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
29750ea508b1Smrg]) # XORG_COMPILER_BRAND
2976e6d5e4e0Smrg
29770ea508b1Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
29789d0ccd10Smrg# ---------------
29790ea508b1Smrg# Minimum version: 1.16.0
29800ea508b1Smrg#
29810ea508b1Smrg# Test if the compiler works when passed the given flag as a command line argument.
29820ea508b1Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
29830ea508b1Smrg# next flag in the list until there are no more options.
29840ea508b1Smrg#
29850ea508b1Smrg# Note that this does not guarantee that the compiler supports the flag as some
29860ea508b1Smrg# compilers will simply ignore arguments that they do not understand, but we do
29870ea508b1Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
29880ea508b1Smrg# -Werror=unused-command-line-argument
29890ea508b1Smrg#
29900ea508b1SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
29910ea508b1Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29920ea508b1Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2993e6d5e4e0Smrg
29940ea508b1SmrgAC_LANG_COMPILER_REQUIRE
2995e6d5e4e0Smrg
29960ea508b1SmrgAC_LANG_CASE(
29970ea508b1Smrg	[C], [
29980ea508b1Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
29990ea508b1Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
30000ea508b1Smrg		m4_version_prereq([2.70],
30010ea508b1Smrg			[AC_REQUIRE([AC_PROG_CC])],
30020ea508b1Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
30030ea508b1Smrg		define([PREFIX], [C])
30040ea508b1Smrg		define([CACHE_PREFIX], [cc])
30050ea508b1Smrg		define([COMPILER], [$CC])
30060ea508b1Smrg	],
30070ea508b1Smrg	[C++], [
30080ea508b1Smrg		define([PREFIX], [CXX])
30090ea508b1Smrg		define([CACHE_PREFIX], [cxx])
30100ea508b1Smrg		define([COMPILER], [$CXX])
30110ea508b1Smrg	]
30120ea508b1Smrg)
30130ea508b1Smrg
30140ea508b1Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
30150ea508b1Smrg
30160ea508b1Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
30170ea508b1Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30180ea508b1Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
30190ea508b1Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
30200ea508b1Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30210ea508b1Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
30220ea508b1Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
30230ea508b1Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
30240ea508b1Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30259d0ccd10Smrgfi
30260ea508b1Smrg
30270ea508b1Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
30280ea508b1Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
30290ea508b1Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30300ea508b1Smrg	fi
30310ea508b1Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30320ea508b1Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
30330ea508b1Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
30340ea508b1Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30350ea508b1Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
30360ea508b1Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
30370ea508b1Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
30380ea508b1Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30390ea508b1Smrgfi
30400ea508b1Smrg
30410ea508b1Smrgfound="no"
30420ea508b1Smrgm4_foreach([flag], m4_cdr($@), [
30430ea508b1Smrg	if test $found = "no" ; then
30440ea508b1Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
30450ea508b1Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30460ea508b1Smrg		fi
30470ea508b1Smrg
30480ea508b1Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
30490ea508b1Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30500ea508b1Smrg		fi
30510ea508b1Smrg
30520ea508b1Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
30530ea508b1Smrg
30540ea508b1Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
30550ea508b1Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
30560ea508b1Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
30570ea508b1Smrg		AC_CACHE_VAL($cacheid,
30580ea508b1Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
30590ea508b1Smrg					     [eval $cacheid=yes],
30600ea508b1Smrg					     [eval $cacheid=no])])
30610ea508b1Smrg
30620ea508b1Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30630ea508b1Smrg
30640ea508b1Smrg		eval supported=\$$cacheid
30650ea508b1Smrg		AC_MSG_RESULT([$supported])
30660ea508b1Smrg		if test "$supported" = "yes" ; then
30670ea508b1Smrg			$1="$$1 ]flag["
30680ea508b1Smrg			found="yes"
30690ea508b1Smrg		fi
30700ea508b1Smrg	fi
30719d0ccd10Smrg])
30720ea508b1Smrg]) # XORG_TESTSET_CFLAG
3073e8ead290Smrg
30740ea508b1Smrg# XORG_COMPILER_FLAGS
30750ea508b1Smrg# ---------------
30760ea508b1Smrg# Minimum version: 1.16.0
3077e6d5e4e0Smrg#
30780ea508b1Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
30790ea508b1Smrg# arguments supported by the selected compiler which do NOT alter the generated
30800ea508b1Smrg# code.  These arguments will cause the compiler to print various warnings
30810ea508b1Smrg# during compilation AND turn a conservative set of warnings into errors.
30820ea508b1Smrg#
30830ea508b1Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
30840ea508b1Smrg# future versions of util-macros as options are added to new compilers.
30850ea508b1Smrg#
30860ea508b1SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
30870ea508b1SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3088e169010aSmrg
30890ea508b1SmrgAC_ARG_ENABLE(selective-werror,
30900ea508b1Smrg              AS_HELP_STRING([--disable-selective-werror],
30910ea508b1Smrg                             [Turn off selective compiler errors. (default: enabled)]),
30920ea508b1Smrg              [SELECTIVE_WERROR=$enableval],
30930ea508b1Smrg              [SELECTIVE_WERROR=yes])
30940ea508b1Smrg
30950ea508b1SmrgAC_LANG_CASE(
30960ea508b1Smrg        [C], [
30970ea508b1Smrg                define([PREFIX], [C])
30980ea508b1Smrg        ],
30990ea508b1Smrg        [C++], [
31000ea508b1Smrg                define([PREFIX], [CXX])
31010ea508b1Smrg        ]
31020ea508b1Smrg)
31030ea508b1Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
31040ea508b1Smrgif test "x$SUNCC" = "xyes"; then
31050ea508b1Smrg    [BASE_]PREFIX[FLAGS]="-v"
31069d0ccd10Smrgelse
31070ea508b1Smrg    [BASE_]PREFIX[FLAGS]=""
31089d0ccd10Smrgfi
31099d0ccd10Smrg
31100ea508b1Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
31110ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
31120ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
31130ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
31140ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
31159d0ccd10Smrg
31160ea508b1SmrgAC_LANG_CASE(
31170ea508b1Smrg	[C], [
31180ea508b1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
31190ea508b1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
31200ea508b1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
31210ea508b1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
31220ea508b1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
31230ea508b1Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
31240ea508b1Smrg	]
31250ea508b1Smrg)
3126e169010aSmrg
31270ea508b1Smrg# This chunk adds additional warnings that could catch undesired effects.
31280ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
31290ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
31300ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
31310ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
31320ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
31330ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
31340ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3135e6d5e4e0Smrg
31360ea508b1Smrg# These are currently disabled because they are noisy.  They will be enabled
31370ea508b1Smrg# in the future once the codebase is sufficiently modernized to silence
31380ea508b1Smrg# them.  For now, I don't want them to drown out the other warnings.
31390ea508b1Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
31400ea508b1Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
31410ea508b1Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3142e6d5e4e0Smrg
31430ea508b1Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
31440ea508b1Smrg# when there are problems that should be fixed.
3145e6d5e4e0Smrg
31460ea508b1Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
31470ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
31480ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
31490ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
31500ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
31510ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
31520ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
31530ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
31540ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
31550ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
31560ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
31570ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
31580ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
31590ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
31600ea508b1Smrgelse
31610ea508b1SmrgAC_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])
31620ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
31630ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
31640ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
31650ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
31660ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
31670ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
31680ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
31690ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
31700ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
31710ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
31720ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
31730ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
31740ea508b1SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
31750ea508b1Smrgfi
3176e6d5e4e0Smrg
31770ea508b1SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31780ea508b1Smrg]) # XORG_COMPILER_FLAGS
3179e6d5e4e0Smrg
31800ea508b1Smrg# XORG_CWARNFLAGS
31810ea508b1Smrg# ---------------
31820ea508b1Smrg# Minimum version: 1.2.0
31830ea508b1Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3184e169010aSmrg#
31850ea508b1Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3186e169010aSmrg#
31870ea508b1Smrg# This function is deprecated because it defines -fno-strict-aliasing
31880ea508b1Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
31890ea508b1Smrg# is needed, then it should be added explicitly in the module when
31900ea508b1Smrg# it is updated to use BASE_CFLAGS.
3191e8ead290Smrg#
31920ea508b1SmrgAC_DEFUN([XORG_CWARNFLAGS], [
31930ea508b1SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
31940ea508b1SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
31950ea508b1SmrgAC_LANG_CASE(
31960ea508b1Smrg	[C], [
31970ea508b1Smrg		CWARNFLAGS="$BASE_CFLAGS"
31980ea508b1Smrg		if  test "x$GCC" = xyes ; then
31990ea508b1Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
32000ea508b1Smrg		fi
32010ea508b1Smrg		AC_SUBST(CWARNFLAGS)
32020ea508b1Smrg	]
32030ea508b1Smrg)
32040ea508b1Smrg]) # XORG_CWARNFLAGS
3205e8ead290Smrg
32060ea508b1Smrg# XORG_STRICT_OPTION
32070ea508b1Smrg# -----------------------
32080ea508b1Smrg# Minimum version: 1.3.0
32090ea508b1Smrg#
32100ea508b1Smrg# Add configure option to enable strict compilation flags, such as treating
32110ea508b1Smrg# warnings as fatal errors.
32120ea508b1Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
32130ea508b1Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
32140ea508b1Smrg#
32150ea508b1Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
32160ea508b1Smrg# when strict compilation is unconditionally desired.
32170ea508b1SmrgAC_DEFUN([XORG_STRICT_OPTION], [
32180ea508b1SmrgAC_REQUIRE([XORG_CWARNFLAGS])
32190ea508b1SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3220e8ead290Smrg
32210ea508b1SmrgAC_ARG_ENABLE(strict-compilation,
32220ea508b1Smrg			  AS_HELP_STRING([--enable-strict-compilation],
32230ea508b1Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
32240ea508b1Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
32259d0ccd10Smrg
32260ea508b1SmrgAC_LANG_CASE(
32270ea508b1Smrg        [C], [
32280ea508b1Smrg                define([PREFIX], [C])
32290ea508b1Smrg        ],
32300ea508b1Smrg        [C++], [
32310ea508b1Smrg                define([PREFIX], [CXX])
32320ea508b1Smrg        ]
32330ea508b1Smrg)
32349d0ccd10Smrg
32350ea508b1Smrg[STRICT_]PREFIX[FLAGS]=""
32360ea508b1SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
32370ea508b1SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
32389d0ccd10Smrg
32390ea508b1Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
32400ea508b1Smrg# activate it with -Werror, so we add it here explicitly.
32410ea508b1SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
32429d0ccd10Smrg
32430ea508b1Smrgif test "x$STRICT_COMPILE" = "xyes"; then
32440ea508b1Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
32450ea508b1Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
32460ea508b1Smrgfi
32470ea508b1SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
32480ea508b1SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32490ea508b1SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
32500ea508b1Smrg]) # XORG_STRICT_OPTION
32519d0ccd10Smrg
32520ea508b1Smrg# XORG_DEFAULT_NOCODE_OPTIONS
32530ea508b1Smrg# ---------------------------
32540ea508b1Smrg# Minimum version: 1.20.0
32550ea508b1Smrg#
32560ea508b1Smrg# Defines default options for X.Org modules which don't compile code,
32570ea508b1Smrg# such as fonts, bitmaps, cursors, and docs.
32580ea508b1Smrg#
32590ea508b1SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
32600ea508b1SmrgAC_REQUIRE([AC_PROG_INSTALL])
32610ea508b1SmrgXORG_RELEASE_VERSION
32620ea508b1SmrgXORG_CHANGELOG
32630ea508b1SmrgXORG_INSTALL
32640ea508b1SmrgXORG_MANPAGE_SECTIONS
32650ea508b1Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
32660ea508b1Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
32670ea508b1Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
32689d0ccd10Smrg
32690ea508b1Smrg# XORG_DEFAULT_OPTIONS
32700ea508b1Smrg# --------------------
32710ea508b1Smrg# Minimum version: 1.3.0
32720ea508b1Smrg#
32730ea508b1Smrg# Defines default options for X.Org modules which compile code.
32740ea508b1Smrg#
32750ea508b1SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
32760ea508b1SmrgAC_REQUIRE([AC_PROG_INSTALL])
32770ea508b1SmrgXORG_COMPILER_FLAGS
32780ea508b1SmrgXORG_CWARNFLAGS
32790ea508b1SmrgXORG_STRICT_OPTION
32800ea508b1SmrgXORG_DEFAULT_NOCODE_OPTIONS
32810ea508b1Smrg]) # XORG_DEFAULT_OPTIONS
32829d0ccd10Smrg
32830ea508b1Smrg# XORG_INSTALL()
32840ea508b1Smrg# ----------------
32850ea508b1Smrg# Minimum version: 1.4.0
32860ea508b1Smrg#
32870ea508b1Smrg# Defines the variable INSTALL_CMD as the command to copy
32880ea508b1Smrg# INSTALL from $prefix/share/util-macros.
32890ea508b1Smrg#
32900ea508b1SmrgAC_DEFUN([XORG_INSTALL], [
32910ea508b1SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
32920ea508b1Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
32930ea508b1SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
32940ea508b1Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
32950ea508b1Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
32960ea508b1Smrgtouch \$(top_srcdir)/INSTALL; \
32970ea508b1Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
32980ea508b1SmrgAC_SUBST([INSTALL_CMD])
32990ea508b1Smrg]) # XORG_INSTALL
33000ea508b1Smrgdnl Copyright 2005 Red Hat, Inc
33010ea508b1Smrgdnl
33020ea508b1Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
33030ea508b1Smrgdnl documentation for any purpose is hereby granted without fee, provided that
33040ea508b1Smrgdnl the above copyright notice appear in all copies and that both that
33050ea508b1Smrgdnl copyright notice and this permission notice appear in supporting
33060ea508b1Smrgdnl documentation.
33070ea508b1Smrgdnl
33080ea508b1Smrgdnl The above copyright notice and this permission notice shall be included
33090ea508b1Smrgdnl in all copies or substantial portions of the Software.
33100ea508b1Smrgdnl
33110ea508b1Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
33120ea508b1Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33130ea508b1Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
33140ea508b1Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
33150ea508b1Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
33160ea508b1Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
33170ea508b1Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
33180ea508b1Smrgdnl
33190ea508b1Smrgdnl Except as contained in this notice, the name of the copyright holders shall
33200ea508b1Smrgdnl not be used in advertising or otherwise to promote the sale, use or
33210ea508b1Smrgdnl other dealings in this Software without prior written authorization
33220ea508b1Smrgdnl from the copyright holders.
33230ea508b1Smrgdnl
33249d0ccd10Smrg
33250ea508b1Smrg# XORG_RELEASE_VERSION
33260ea508b1Smrg# --------------------
33270ea508b1Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
33289d0ccd10Smrg
33290ea508b1SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
33300ea508b1Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
33310ea508b1Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
33320ea508b1Smrg		[Major version of this package])
33330ea508b1Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
33340ea508b1Smrg	if test "x$PVM" = "x"; then
33350ea508b1Smrg		PVM="0"
33360ea508b1Smrg	fi
33370ea508b1Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
33380ea508b1Smrg		[$PVM],
33390ea508b1Smrg		[Minor version of this package])
33400ea508b1Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
33410ea508b1Smrg	if test "x$PVP" = "x"; then
33420ea508b1Smrg		PVP="0"
33430ea508b1Smrg	fi
33440ea508b1Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
33450ea508b1Smrg		[$PVP],
33460ea508b1Smrg		[Patch version of this package])
33470ea508b1Smrg])
33489d0ccd10Smrg
33490ea508b1Smrg# XORG_CHANGELOG()
33500ea508b1Smrg# ----------------
33510ea508b1Smrg# Minimum version: 1.2.0
33520ea508b1Smrg#
33530ea508b1Smrg# Defines the variable CHANGELOG_CMD as the command to generate
33540ea508b1Smrg# ChangeLog from git.
33550ea508b1Smrg#
33560ea508b1Smrg#
33570ea508b1SmrgAC_DEFUN([XORG_CHANGELOG], [
33580ea508b1SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
33590ea508b1Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
33600ea508b1Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
33610ea508b1Smrgtouch \$(top_srcdir)/ChangeLog; \
33620ea508b1Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
33630ea508b1SmrgAC_SUBST([CHANGELOG_CMD])
33640ea508b1Smrg]) # XORG_CHANGELOG
33657914d74bSmrg
33660ea508b1Smrgm4_include([m4/libtool.m4])
33670ea508b1Smrgm4_include([m4/ltoptions.m4])
33680ea508b1Smrgm4_include([m4/ltsugar.m4])
33690ea508b1Smrgm4_include([m4/ltversion.m4])
33700ea508b1Smrgm4_include([m4/lt~obsolete.m4])
3371