10760f5d2Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
2af9a7ee5Smrg
30760f5d2Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4caade7ccSmrg
5caade7ccSmrg# This file is free software; the Free Software Foundation
6caade7ccSmrg# gives unlimited permission to copy and/or distribute it,
7caade7ccSmrg# with or without modifications, as long as this notice is preserved.
8caade7ccSmrg
9caade7ccSmrg# This program is distributed in the hope that it will be useful,
10caade7ccSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11caade7ccSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12caade7ccSmrg# PARTICULAR PURPOSE.
13caade7ccSmrg
14af9a7ee5Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15485f0483Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16485f0483Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1705789e77Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
1805789e77Smrg[m4_warning([this file was generated for autoconf 2.72.
19485f0483SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20485f0483SmrgIf you have problems, you may need to regenerate the build system entirely.
21af9a7ee5SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22caade7ccSmrg
230760f5d2Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
240760f5d2Smrg#
250760f5d2Smrg# This file is free software; the Free Software Foundation
260760f5d2Smrg# gives unlimited permission to copy and/or distribute it,
270760f5d2Smrg# with or without modifications, as long as this notice is preserved.
28cc4920e5Smrg
290760f5d2Smrg# AM_AUTOMAKE_VERSION(VERSION)
300760f5d2Smrg# ----------------------------
310760f5d2Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
320760f5d2Smrg# generated from the m4 files accompanying Automake X.Y.
330760f5d2Smrg# (This private macro should not be called outside this file.)
340760f5d2SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
350760f5d2Smrg[am__api_version='1.16'
360760f5d2Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
370760f5d2Smrgdnl require some minimum version.  Point them to the right macro.
380760f5d2Smrgm4_if([$1], [1.16.5], [],
390760f5d2Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
400760f5d2Smrg])
41cc4920e5Smrg
420760f5d2Smrg# _AM_AUTOCONF_VERSION(VERSION)
430760f5d2Smrg# -----------------------------
440760f5d2Smrg# aclocal traces this macro to find the Autoconf version.
450760f5d2Smrg# This is a private macro too.  Using m4_define simplifies
460760f5d2Smrg# the logic in aclocal, which can simply ignore this definition.
470760f5d2Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48caade7ccSmrg
490760f5d2Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
500760f5d2Smrg# -------------------------------
510760f5d2Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
520760f5d2Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
530760f5d2SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
540760f5d2Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
550760f5d2Smrgm4_ifndef([AC_AUTOCONF_VERSION],
560760f5d2Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
570760f5d2Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58caade7ccSmrg
590760f5d2Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60caade7ccSmrg
610760f5d2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
620760f5d2Smrg#
630760f5d2Smrg# This file is free software; the Free Software Foundation
640760f5d2Smrg# gives unlimited permission to copy and/or distribute it,
650760f5d2Smrg# with or without modifications, as long as this notice is preserved.
66e5383a99Smrg
670760f5d2Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
680760f5d2Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
690760f5d2Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
700760f5d2Smrg#
710760f5d2Smrg# Of course, Automake must honor this variable whenever it calls a
720760f5d2Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
730760f5d2Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
740760f5d2Smrg# depending on how configure is run.  This is pretty annoying, since
750760f5d2Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
760760f5d2Smrg# source directory, any form will work fine, but in subdirectories a
770760f5d2Smrg# relative path needs to be adjusted first.
780760f5d2Smrg#
790760f5d2Smrg# $ac_aux_dir/missing
800760f5d2Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
810760f5d2Smrg# $top_srcdir/$ac_aux_dir/missing
820760f5d2Smrg#    fails if $ac_aux_dir is absolute,
830760f5d2Smrg#    fails when called from a subdirectory in a VPATH build with
840760f5d2Smrg#          a relative $ac_aux_dir
850760f5d2Smrg#
860760f5d2Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
870760f5d2Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
880760f5d2Smrg# harmless because $srcdir is '.', but things will broke when you
890760f5d2Smrg# start a VPATH build or use an absolute $srcdir.
900760f5d2Smrg#
910760f5d2Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
920760f5d2Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
930760f5d2Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
940760f5d2Smrg# and then we would define $MISSING as
950760f5d2Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
960760f5d2Smrg# This will work as long as MISSING is not called from configure, because
970760f5d2Smrg# unfortunately $(top_srcdir) has no meaning in configure.
980760f5d2Smrg# However there are other variables, like CC, which are often used in
990760f5d2Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1000760f5d2Smrg#
1010760f5d2Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1020760f5d2Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1030760f5d2Smrg# configured tree to be moved without reconfiguration.
104e5383a99Smrg
1050760f5d2SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1060760f5d2Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1070760f5d2Smrg# Expand $ac_aux_dir to an absolute path.
1080760f5d2Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
1090760f5d2Smrg])
110e5383a99Smrg
1110760f5d2Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112e5383a99Smrg
1130760f5d2Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
1140760f5d2Smrg#
1150760f5d2Smrg# This file is free software; the Free Software Foundation
1160760f5d2Smrg# gives unlimited permission to copy and/or distribute it,
1170760f5d2Smrg# with or without modifications, as long as this notice is preserved.
118e5383a99Smrg
1190760f5d2Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1200760f5d2Smrg# -------------------------------------
1210760f5d2Smrg# Define a conditional.
1220760f5d2SmrgAC_DEFUN([AM_CONDITIONAL],
1230760f5d2Smrg[AC_PREREQ([2.52])dnl
1240760f5d2Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1250760f5d2Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1260760f5d2SmrgAC_SUBST([$1_TRUE])dnl
1270760f5d2SmrgAC_SUBST([$1_FALSE])dnl
1280760f5d2Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1290760f5d2Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1300760f5d2Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1310760f5d2Smrgif $2; then
1320760f5d2Smrg  $1_TRUE=
1330760f5d2Smrg  $1_FALSE='#'
1340760f5d2Smrgelse
1350760f5d2Smrg  $1_TRUE='#'
1360760f5d2Smrg  $1_FALSE=
1370760f5d2Smrgfi
1380760f5d2SmrgAC_CONFIG_COMMANDS_PRE(
1390760f5d2Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1400760f5d2Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1410760f5d2SmrgUsually this means the macro was only invoked conditionally.]])
1420760f5d2Smrgfi])])
143caade7ccSmrg
1440760f5d2Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
1450760f5d2Smrg#
1460760f5d2Smrg# This file is free software; the Free Software Foundation
1470760f5d2Smrg# gives unlimited permission to copy and/or distribute it,
1480760f5d2Smrg# with or without modifications, as long as this notice is preserved.
149caade7ccSmrg
150caade7ccSmrg
1510760f5d2Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1520760f5d2Smrg# written in clear, in which case automake, when reading aclocal.m4,
1530760f5d2Smrg# will think it sees a *use*, and therefore will trigger all it's
1540760f5d2Smrg# C support machinery.  Also note that it means that autoscan, seeing
1550760f5d2Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156caade7ccSmrg
157485f0483Smrg
1580760f5d2Smrg# _AM_DEPENDENCIES(NAME)
1590760f5d2Smrg# ----------------------
1600760f5d2Smrg# See how the compiler implements dependency checking.
1610760f5d2Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1620760f5d2Smrg# We try a few techniques and use that to set a single cache variable.
1630760f5d2Smrg#
1640760f5d2Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1650760f5d2Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1660760f5d2Smrg# dependency, and given that the user is not expected to run this macro,
1670760f5d2Smrg# just rely on AC_PROG_CC.
1680760f5d2SmrgAC_DEFUN([_AM_DEPENDENCIES],
1690760f5d2Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1700760f5d2SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1710760f5d2SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1720760f5d2SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173af9a7ee5Smrg
1740760f5d2Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1750760f5d2Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1760760f5d2Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1770760f5d2Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1780760f5d2Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1790760f5d2Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1800760f5d2Smrg                    [depcc="$$1"   am_compiler_list=])
181e5383a99Smrg
1820760f5d2SmrgAC_CACHE_CHECK([dependency style of $depcc],
1830760f5d2Smrg               [am_cv_$1_dependencies_compiler_type],
1840760f5d2Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1850760f5d2Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
1860760f5d2Smrg  # making bogus files that we don't know about and never remove.  For
1870760f5d2Smrg  # instance it was reported that on HP-UX the gcc test will end up
1880760f5d2Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1890760f5d2Smrg  # in D".
1900760f5d2Smrg  rm -rf conftest.dir
1910760f5d2Smrg  mkdir conftest.dir
1920760f5d2Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1930760f5d2Smrg  # using a relative directory.
1940760f5d2Smrg  cp "$am_depcomp" conftest.dir
1950760f5d2Smrg  cd conftest.dir
1960760f5d2Smrg  # We will build objects and dependencies in a subdirectory because
1970760f5d2Smrg  # it helps to detect inapplicable dependency modes.  For instance
1980760f5d2Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1990760f5d2Smrg  # side effect of compilation, but ICC will put the dependencies in
2000760f5d2Smrg  # the current directory while Tru64 will put them in the object
2010760f5d2Smrg  # directory.
2020760f5d2Smrg  mkdir sub
203e5383a99Smrg
2040760f5d2Smrg  am_cv_$1_dependencies_compiler_type=none
2050760f5d2Smrg  if test "$am_compiler_list" = ""; then
2060760f5d2Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2070760f5d2Smrg  fi
2080760f5d2Smrg  am__universal=false
2090760f5d2Smrg  m4_case([$1], [CC],
2100760f5d2Smrg    [case " $depcc " in #(
2110760f5d2Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2120760f5d2Smrg     esac],
2130760f5d2Smrg    [CXX],
2140760f5d2Smrg    [case " $depcc " in #(
2150760f5d2Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2160760f5d2Smrg     esac])
217caade7ccSmrg
2180760f5d2Smrg  for depmode in $am_compiler_list; do
2190760f5d2Smrg    # Setup a source with many dependencies, because some compilers
2200760f5d2Smrg    # like to wrap large dependency lists on column 80 (with \), and
2210760f5d2Smrg    # we should not choose a depcomp mode which is confused by this.
2220760f5d2Smrg    #
2230760f5d2Smrg    # We need to recreate these files for each test, as the compiler may
2240760f5d2Smrg    # overwrite some of them when testing with obscure command lines.
2250760f5d2Smrg    # This happens at least with the AIX C compiler.
2260760f5d2Smrg    : > sub/conftest.c
2270760f5d2Smrg    for i in 1 2 3 4 5 6; do
2280760f5d2Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2290760f5d2Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2300760f5d2Smrg      # Solaris 10 /bin/sh.
2310760f5d2Smrg      echo '/* dummy */' > sub/conftst$i.h
2320760f5d2Smrg    done
2330760f5d2Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234485f0483Smrg
2350760f5d2Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2360760f5d2Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2370760f5d2Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2380760f5d2Smrg    # versions had trouble with output in subdirs.
2390760f5d2Smrg    am__obj=sub/conftest.${OBJEXT-o}
2400760f5d2Smrg    am__minus_obj="-o $am__obj"
2410760f5d2Smrg    case $depmode in
2420760f5d2Smrg    gcc)
2430760f5d2Smrg      # This depmode causes a compiler race in universal mode.
2440760f5d2Smrg      test "$am__universal" = false || continue
2450760f5d2Smrg      ;;
2460760f5d2Smrg    nosideeffect)
2470760f5d2Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2480760f5d2Smrg      # only be used when explicitly requested.
2490760f5d2Smrg      if test "x$enable_dependency_tracking" = xyes; then
2500760f5d2Smrg	continue
2510760f5d2Smrg      else
2520760f5d2Smrg	break
2530760f5d2Smrg      fi
2540760f5d2Smrg      ;;
2550760f5d2Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2560760f5d2Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2570760f5d2Smrg      # not run yet.  These depmodes are late enough in the game, and
2580760f5d2Smrg      # so weak that their functioning should not be impacted.
2590760f5d2Smrg      am__obj=conftest.${OBJEXT-o}
2600760f5d2Smrg      am__minus_obj=
2610760f5d2Smrg      ;;
2620760f5d2Smrg    none) break ;;
2630760f5d2Smrg    esac
2640760f5d2Smrg    if depmode=$depmode \
2650760f5d2Smrg       source=sub/conftest.c object=$am__obj \
2660760f5d2Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2670760f5d2Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2680760f5d2Smrg         >/dev/null 2>conftest.err &&
2690760f5d2Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2700760f5d2Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2710760f5d2Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2720760f5d2Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2730760f5d2Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2740760f5d2Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2750760f5d2Smrg      # that says an option was ignored or not supported.
2760760f5d2Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2770760f5d2Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2780760f5d2Smrg      # The diagnosis changed in icc 8.0:
2790760f5d2Smrg      #   icc: Command line remark: option '-MP' not supported
2800760f5d2Smrg      if (grep 'ignoring option' conftest.err ||
2810760f5d2Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2820760f5d2Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2830760f5d2Smrg        break
2840760f5d2Smrg      fi
2850760f5d2Smrg    fi
2860760f5d2Smrg  done
287e5383a99Smrg
2880760f5d2Smrg  cd ..
2890760f5d2Smrg  rm -rf conftest.dir
2900760f5d2Smrgelse
2910760f5d2Smrg  am_cv_$1_dependencies_compiler_type=none
2920760f5d2Smrgfi
2930760f5d2Smrg])
2940760f5d2SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2950760f5d2SmrgAM_CONDITIONAL([am__fastdep$1], [
2960760f5d2Smrg  test "x$enable_dependency_tracking" != xno \
2970760f5d2Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2980760f5d2Smrg])
299e5383a99Smrg
300e5383a99Smrg
3010760f5d2Smrg# AM_SET_DEPDIR
3020760f5d2Smrg# -------------
3030760f5d2Smrg# Choose a directory name for dependency files.
3040760f5d2Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3050760f5d2SmrgAC_DEFUN([AM_SET_DEPDIR],
3060760f5d2Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3070760f5d2SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3080760f5d2Smrg])
309e5383a99Smrg
310e5383a99Smrg
3110760f5d2Smrg# AM_DEP_TRACK
3120760f5d2Smrg# ------------
3130760f5d2SmrgAC_DEFUN([AM_DEP_TRACK],
3140760f5d2Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3150760f5d2SmrgAS_HELP_STRING(
3160760f5d2Smrg  [--enable-dependency-tracking],
3170760f5d2Smrg  [do not reject slow dependency extractors])
3180760f5d2SmrgAS_HELP_STRING(
3190760f5d2Smrg  [--disable-dependency-tracking],
3200760f5d2Smrg  [speeds up one-time build])])
3210760f5d2Smrgif test "x$enable_dependency_tracking" != xno; then
3220760f5d2Smrg  am_depcomp="$ac_aux_dir/depcomp"
3230760f5d2Smrg  AMDEPBACKSLASH='\'
3240760f5d2Smrg  am__nodep='_no'
3250760f5d2Smrgfi
3260760f5d2SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3270760f5d2SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3280760f5d2Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3290760f5d2SmrgAC_SUBST([am__nodep])dnl
3300760f5d2Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3310760f5d2Smrg])
332e5383a99Smrg
3330760f5d2Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334af9a7ee5Smrg
3350760f5d2Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
336cc4920e5Smrg#
3370760f5d2Smrg# This file is free software; the Free Software Foundation
3380760f5d2Smrg# gives unlimited permission to copy and/or distribute it,
3390760f5d2Smrg# with or without modifications, as long as this notice is preserved.
340caade7ccSmrg
3410760f5d2Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3420760f5d2Smrg# ------------------------------
3430760f5d2SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3440760f5d2Smrg[{
3450760f5d2Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3460760f5d2Smrg  # are listed without --file.  Let's play safe and only enable the eval
3470760f5d2Smrg  # if we detect the quoting.
3480760f5d2Smrg  # TODO: see whether this extra hack can be removed once we start
3490760f5d2Smrg  # requiring Autoconf 2.70 or later.
3500760f5d2Smrg  AS_CASE([$CONFIG_FILES],
3510760f5d2Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
3520760f5d2Smrg          [*], [set x $CONFIG_FILES])
3530760f5d2Smrg  shift
3540760f5d2Smrg  # Used to flag and report bootstrapping failures.
3550760f5d2Smrg  am_rc=0
3560760f5d2Smrg  for am_mf
3570760f5d2Smrg  do
3580760f5d2Smrg    # Strip MF so we end up with the name of the file.
3590760f5d2Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
3600760f5d2Smrg    # Check whether this is an Automake generated Makefile which includes
3610760f5d2Smrg    # dependency-tracking related rules and includes.
3620760f5d2Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
3630760f5d2Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3640760f5d2Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
3650760f5d2Smrg      || continue
3660760f5d2Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
3670760f5d2Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
3680760f5d2Smrg    AM_RUN_LOG([cd "$am_dirpart" \
3690760f5d2Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
3700760f5d2Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
3710760f5d2Smrg  done
3720760f5d2Smrg  if test $am_rc -ne 0; then
3730760f5d2Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
3740760f5d2Smrg    for automatic dependency tracking.  If GNU make was not used, consider
3750760f5d2Smrg    re-running the configure script with MAKE="gmake" (or whatever is
3760760f5d2Smrg    necessary).  You can also try re-running configure with the
3770760f5d2Smrg    '--disable-dependency-tracking' option to at least be able to build
3780760f5d2Smrg    the package (albeit without support for automatic dependency tracking).])
3790760f5d2Smrg  fi
3800760f5d2Smrg  AS_UNSET([am_dirpart])
3810760f5d2Smrg  AS_UNSET([am_filepart])
3820760f5d2Smrg  AS_UNSET([am_mf])
3830760f5d2Smrg  AS_UNSET([am_rc])
3840760f5d2Smrg  rm -f conftest-deps.mk
3850760f5d2Smrg}
3860760f5d2Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387caade7ccSmrg
388caade7ccSmrg
3890760f5d2Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3900760f5d2Smrg# -----------------------------
3910760f5d2Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
392cc4920e5Smrg#
3930760f5d2Smrg# This code is only required when automatic dependency tracking is enabled.
3940760f5d2Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
3950760f5d2Smrg# order to bootstrap the dependency handling code.
3960760f5d2SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3970760f5d2Smrg[AC_CONFIG_COMMANDS([depfiles],
3980760f5d2Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3990760f5d2Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400caade7ccSmrg
4010760f5d2Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402b9b4fd27Smrg
4030760f5d2Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4040760f5d2Smrg#
4050760f5d2Smrg# This file is free software; the Free Software Foundation
4060760f5d2Smrg# gives unlimited permission to copy and/or distribute it,
4070760f5d2Smrg# with or without modifications, as long as this notice is preserved.
408a5602400Smrg
4090760f5d2Smrg# This macro actually does too much.  Some checks are only needed if
4100760f5d2Smrg# your package does certain things.  But this isn't really a big deal.
411a5602400Smrg
4120760f5d2Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4130760f5d2Smrgm4_define([AC_PROG_CC],
4140760f5d2Smrgm4_defn([AC_PROG_CC])
4150760f5d2Smrg[_AM_PROG_CC_C_O
4160760f5d2Smrg])
417e8a5466aSmrg
4180760f5d2Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4190760f5d2Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4200760f5d2Smrg# -----------------------------------------------
4210760f5d2Smrg# The call with PACKAGE and VERSION arguments is the old style
4220760f5d2Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4230760f5d2Smrg# and VERSION should now be passed to AC_INIT and removed from
4240760f5d2Smrg# the call to AM_INIT_AUTOMAKE.
4250760f5d2Smrg# We support both call styles for the transition.  After
4260760f5d2Smrg# the next Automake release, Autoconf can make the AC_INIT
4270760f5d2Smrg# arguments mandatory, and then we can depend on a new Autoconf
4280760f5d2Smrg# release and drop the old call support.
4290760f5d2SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4300760f5d2Smrg[AC_PREREQ([2.65])dnl
4310760f5d2Smrgm4_ifdef([_$0_ALREADY_INIT],
4320760f5d2Smrg  [m4_fatal([$0 expanded multiple times
4330760f5d2Smrg]m4_defn([_$0_ALREADY_INIT]))],
4340760f5d2Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
4350760f5d2Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4360760f5d2Smrgdnl the ones we care about.
4370760f5d2Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4380760f5d2SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4390760f5d2SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4400760f5d2Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4410760f5d2Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4420760f5d2Smrg  # is not polluted with repeated "-I."
4430760f5d2Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4440760f5d2Smrg  # test to see if srcdir already configured
4450760f5d2Smrg  if test -f $srcdir/config.status; then
4460760f5d2Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4470760f5d2Smrg  fi
448cc4920e5Smrgfi
449e8a5466aSmrg
4500760f5d2Smrg# test whether we have cygpath
4510760f5d2Smrgif test -z "$CYGPATH_W"; then
4520760f5d2Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4530760f5d2Smrg    CYGPATH_W='cygpath -w'
4540760f5d2Smrg  else
4550760f5d2Smrg    CYGPATH_W=echo
4560760f5d2Smrg  fi
457cc4920e5Smrgfi
4580760f5d2SmrgAC_SUBST([CYGPATH_W])
459b9b4fd27Smrg
4600760f5d2Smrg# Define the identity of the package.
4610760f5d2Smrgdnl Distinguish between old-style and new-style calls.
4620760f5d2Smrgm4_ifval([$2],
4630760f5d2Smrg[AC_DIAGNOSE([obsolete],
4640760f5d2Smrg             [$0: two- and three-arguments forms are deprecated.])
4650760f5d2Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4660760f5d2Smrg AC_SUBST([PACKAGE], [$1])dnl
4670760f5d2Smrg AC_SUBST([VERSION], [$2])],
4680760f5d2Smrg[_AM_SET_OPTIONS([$1])dnl
4690760f5d2Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4700760f5d2Smrgm4_if(
4710760f5d2Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4720760f5d2Smrg  [ok:ok],,
4730760f5d2Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4740760f5d2Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4750760f5d2Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476a5602400Smrg
4770760f5d2Smrg_AM_IF_OPTION([no-define],,
4780760f5d2Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4790760f5d2Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480a5602400Smrg
4810760f5d2Smrg# Some tools Automake needs.
4820760f5d2SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4830760f5d2SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4840760f5d2SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4850760f5d2SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4860760f5d2SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4870760f5d2SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4880760f5d2SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4890760f5d2SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4900760f5d2SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4910760f5d2SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4920760f5d2Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4930760f5d2Smrg# dies out for good.  For more background, see:
4940760f5d2Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4950760f5d2Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4960760f5d2SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
4970760f5d2Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
4980760f5d2Smrg# system "awk" is bad on some platforms.
4990760f5d2SmrgAC_REQUIRE([AC_PROG_AWK])dnl
5000760f5d2SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5010760f5d2SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5020760f5d2Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5030760f5d2Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5040760f5d2Smrg			     [_AM_PROG_TAR([v7])])])
5050760f5d2Smrg_AM_IF_OPTION([no-dependencies],,
5060760f5d2Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5070760f5d2Smrg		  [_AM_DEPENDENCIES([CC])],
5080760f5d2Smrg		  [m4_define([AC_PROG_CC],
5090760f5d2Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5100760f5d2SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5110760f5d2Smrg		  [_AM_DEPENDENCIES([CXX])],
5120760f5d2Smrg		  [m4_define([AC_PROG_CXX],
5130760f5d2Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5140760f5d2SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5150760f5d2Smrg		  [_AM_DEPENDENCIES([OBJC])],
5160760f5d2Smrg		  [m4_define([AC_PROG_OBJC],
5170760f5d2Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5180760f5d2SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5190760f5d2Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5200760f5d2Smrg		  [m4_define([AC_PROG_OBJCXX],
5210760f5d2Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5220760f5d2Smrg])
5230760f5d2Smrg# Variables for tags utilities; see am/tags.am
5240760f5d2Smrgif test -z "$CTAGS"; then
5250760f5d2Smrg  CTAGS=ctags
5260760f5d2Smrgfi
5270760f5d2SmrgAC_SUBST([CTAGS])
5280760f5d2Smrgif test -z "$ETAGS"; then
5290760f5d2Smrg  ETAGS=etags
5300760f5d2Smrgfi
5310760f5d2SmrgAC_SUBST([ETAGS])
5320760f5d2Smrgif test -z "$CSCOPE"; then
5330760f5d2Smrg  CSCOPE=cscope
5340760f5d2Smrgfi
5350760f5d2SmrgAC_SUBST([CSCOPE])
536a5602400Smrg
5370760f5d2SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5380760f5d2Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5390760f5d2Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5400760f5d2Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5410760f5d2SmrgAC_CONFIG_COMMANDS_PRE(dnl
5420760f5d2Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5430760f5d2Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544a5602400Smrg
5450760f5d2Smrg# POSIX will say in a future version that running "rm -f" with no argument
5460760f5d2Smrg# is OK; and we want to be able to make that assumption in our Makefile
5470760f5d2Smrg# recipes.  So use an aggressive probe to check that the usage we want is
5480760f5d2Smrg# actually supported "in the wild" to an acceptable degree.
5490760f5d2Smrg# See automake bug#10828.
5500760f5d2Smrg# To make any issue more visible, cause the running configure to be aborted
5510760f5d2Smrg# by default if the 'rm' program in use doesn't match our expectations; the
5520760f5d2Smrg# user can still override this though.
5530760f5d2Smrgif rm -f && rm -fr && rm -rf; then : OK; else
5540760f5d2Smrg  cat >&2 <<'END'
5550760f5d2SmrgOops!
556e8a5466aSmrg
5570760f5d2SmrgYour 'rm' program seems unable to run without file operands specified
5580760f5d2Smrgon the command line, even when the '-f' option is present.  This is contrary
5590760f5d2Smrgto the behaviour of most rm programs out there, and not conforming with
5600760f5d2Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561caade7ccSmrg
5620760f5d2SmrgPlease tell bug-automake@gnu.org about your system, including the value
5630760f5d2Smrgof your $PATH and any error possibly output before this message.  This
5640760f5d2Smrgcan help us improve future automake versions.
565caade7ccSmrg
5660760f5d2SmrgEND
5670760f5d2Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5680760f5d2Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5690760f5d2Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5700760f5d2Smrg    echo >&2
5710760f5d2Smrg  else
5720760f5d2Smrg    cat >&2 <<'END'
5730760f5d2SmrgAborting the configuration process, to ensure you take notice of the issue.
574caade7ccSmrg
5750760f5d2SmrgYou can download and install GNU coreutils to get an 'rm' implementation
5760760f5d2Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
577caade7ccSmrg
5780760f5d2SmrgIf you want to complete the configuration process using your problematic
5790760f5d2Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5800760f5d2Smrgto "yes", and re-run configure.
581e8a5466aSmrg
5820760f5d2SmrgEND
5830760f5d2Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5840760f5d2Smrg  fi
585e5383a99Smrgfi
5860760f5d2Smrgdnl The trailing newline in this macro's definition is deliberate, for
5870760f5d2Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5880760f5d2Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5890760f5d2Smrg])
590caade7ccSmrg
5910760f5d2Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5920760f5d2Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5930760f5d2Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5940760f5d2Smrgm4_define([_AC_COMPILER_EXEEXT],
5950760f5d2Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596af9a7ee5Smrg
5970760f5d2Smrg# When config.status generates a header, we must update the stamp-h file.
5980760f5d2Smrg# This file resides in the same directory as the config header
5990760f5d2Smrg# that is generated.  The stamp files are numbered to have different names.
600af9a7ee5Smrg
6010760f5d2Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
6020760f5d2Smrg# loop where config.status creates the headers, so we can generate
6030760f5d2Smrg# our stamp files there.
6040760f5d2SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
6050760f5d2Smrg[# Compute $1's index in $config_headers.
6060760f5d2Smrg_am_arg=$1
6070760f5d2Smrg_am_stamp_count=1
6080760f5d2Smrgfor _am_header in $config_headers :; do
6090760f5d2Smrg  case $_am_header in
6100760f5d2Smrg    $_am_arg | $_am_arg:* )
6110760f5d2Smrg      break ;;
6120760f5d2Smrg    * )
6130760f5d2Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6140760f5d2Smrg  esac
6150760f5d2Smrgdone
6160760f5d2Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617af9a7ee5Smrg
6180760f5d2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6190760f5d2Smrg#
6200760f5d2Smrg# This file is free software; the Free Software Foundation
6210760f5d2Smrg# gives unlimited permission to copy and/or distribute it,
6220760f5d2Smrg# with or without modifications, as long as this notice is preserved.
6230760f5d2Smrg
6240760f5d2Smrg# AM_PROG_INSTALL_SH
6250760f5d2Smrg# ------------------
6260760f5d2Smrg# Define $install_sh.
6270760f5d2SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6280760f5d2Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6290760f5d2Smrgif test x"${install_sh+set}" != xset; then
6300760f5d2Smrg  case $am_aux_dir in
6310760f5d2Smrg  *\ * | *\	*)
6320760f5d2Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6330760f5d2Smrg  *)
6340760f5d2Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6350760f5d2Smrg  esac
6360760f5d2Smrgfi
6370760f5d2SmrgAC_SUBST([install_sh])])
6380760f5d2Smrg
6390760f5d2Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
6400760f5d2Smrg#
6410760f5d2Smrg# This file is free software; the Free Software Foundation
6420760f5d2Smrg# gives unlimited permission to copy and/or distribute it,
6430760f5d2Smrg# with or without modifications, as long as this notice is preserved.
6440760f5d2Smrg
6450760f5d2Smrg# Check whether the underlying file-system supports filenames
6460760f5d2Smrg# with a leading dot.  For instance MS-DOS doesn't.
6470760f5d2SmrgAC_DEFUN([AM_SET_LEADING_DOT],
6480760f5d2Smrg[rm -rf .tst 2>/dev/null
6490760f5d2Smrgmkdir .tst 2>/dev/null
6500760f5d2Smrgif test -d .tst; then
6510760f5d2Smrg  am__leading_dot=.
652cc4920e5Smrgelse
6530760f5d2Smrg  am__leading_dot=_
654cc4920e5Smrgfi
6550760f5d2Smrgrmdir .tst 2>/dev/null
6560760f5d2SmrgAC_SUBST([am__leading_dot])])
657a5602400Smrg
6580760f5d2Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659485f0483Smrg
6600760f5d2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6610760f5d2Smrg#
6620760f5d2Smrg# This file is free software; the Free Software Foundation
6630760f5d2Smrg# gives unlimited permission to copy and/or distribute it,
6640760f5d2Smrg# with or without modifications, as long as this notice is preserved.
665485f0483Smrg
6660760f5d2Smrg# AM_MAKE_INCLUDE()
6670760f5d2Smrg# -----------------
6680760f5d2Smrg# Check whether make has an 'include' directive that can support all
6690760f5d2Smrg# the idioms we need for our automatic dependency tracking code.
6700760f5d2SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6710760f5d2Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
6720760f5d2Smrgcat > confinc.mk << 'END'
6730760f5d2Smrgam__doit:
6740760f5d2Smrg	@echo this is the am__doit target >confinc.out
6750760f5d2Smrg.PHONY: am__doit
6760760f5d2SmrgEND
6770760f5d2Smrgam__include="#"
6780760f5d2Smrgam__quote=
6790760f5d2Smrg# BSD make does it like this.
6800760f5d2Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
6810760f5d2Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
6820760f5d2Smrgecho 'include confinc.mk # ignored' > confmf.GNU
6830760f5d2Smrg_am_result=no
6840760f5d2Smrgfor s in GNU BSD; do
6850760f5d2Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
6860760f5d2Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
6870760f5d2Smrg      ['0:this is the am__doit target'],
6880760f5d2Smrg      [AS_CASE([$s],
6890760f5d2Smrg          [BSD], [am__include='.include' am__quote='"'],
6900760f5d2Smrg          [am__include='include' am__quote=''])])
6910760f5d2Smrg  if test "$am__include" != "#"; then
6920760f5d2Smrg    _am_result="yes ($s style)"
6930760f5d2Smrg    break
6940760f5d2Smrg  fi
6950760f5d2Smrgdone
6960760f5d2Smrgrm -f confinc.* confmf.*
6970760f5d2SmrgAC_MSG_RESULT([${_am_result}])
6980760f5d2SmrgAC_SUBST([am__include])])
6990760f5d2SmrgAC_SUBST([am__quote])])
700b9b4fd27Smrg
7010760f5d2Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702485f0483Smrg
7030760f5d2Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
704cc4920e5Smrg#
7050760f5d2Smrg# This file is free software; the Free Software Foundation
7060760f5d2Smrg# gives unlimited permission to copy and/or distribute it,
7070760f5d2Smrg# with or without modifications, as long as this notice is preserved.
708caade7ccSmrg
7090760f5d2Smrg# AM_MISSING_PROG(NAME, PROGRAM)
7100760f5d2Smrg# ------------------------------
7110760f5d2SmrgAC_DEFUN([AM_MISSING_PROG],
7120760f5d2Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7130760f5d2Smrg$1=${$1-"${am_missing_run}$2"}
7140760f5d2SmrgAC_SUBST($1)])
715caade7ccSmrg
7160760f5d2Smrg# AM_MISSING_HAS_RUN
7170760f5d2Smrg# ------------------
7180760f5d2Smrg# Define MISSING if not defined so far and test if it is modern enough.
7190760f5d2Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7200760f5d2SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7210760f5d2Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7220760f5d2SmrgAC_REQUIRE_AUX_FILE([missing])dnl
7230760f5d2Smrgif test x"${MISSING+set}" != xset; then
7240760f5d2Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
725e5383a99Smrgfi
7260760f5d2Smrg# Use eval to expand $SHELL
7270760f5d2Smrgif eval "$MISSING --is-lightweight"; then
7280760f5d2Smrg  am_missing_run="$MISSING "
7290760f5d2Smrgelse
7300760f5d2Smrg  am_missing_run=
7310760f5d2Smrg  AC_MSG_WARN(['missing' script is too old or missing])
732af9a7ee5Smrgfi
7330760f5d2Smrg])
734b9b4fd27Smrg
7350760f5d2Smrg# Helper functions for option handling.                     -*- Autoconf -*-
736b9b4fd27Smrg
7370760f5d2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
7380760f5d2Smrg#
7390760f5d2Smrg# This file is free software; the Free Software Foundation
7400760f5d2Smrg# gives unlimited permission to copy and/or distribute it,
7410760f5d2Smrg# with or without modifications, as long as this notice is preserved.
742caade7ccSmrg
7430760f5d2Smrg# _AM_MANGLE_OPTION(NAME)
7440760f5d2Smrg# -----------------------
7450760f5d2SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7460760f5d2Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
747caade7ccSmrg
7480760f5d2Smrg# _AM_SET_OPTION(NAME)
7490760f5d2Smrg# --------------------
7500760f5d2Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7510760f5d2SmrgAC_DEFUN([_AM_SET_OPTION],
7520760f5d2Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
753caade7ccSmrg
7540760f5d2Smrg# _AM_SET_OPTIONS(OPTIONS)
7550760f5d2Smrg# ------------------------
7560760f5d2Smrg# OPTIONS is a space-separated list of Automake options.
7570760f5d2SmrgAC_DEFUN([_AM_SET_OPTIONS],
7580760f5d2Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7590760f5d2Smrg
7600760f5d2Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7610760f5d2Smrg# -------------------------------------------
7620760f5d2Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7630760f5d2SmrgAC_DEFUN([_AM_IF_OPTION],
7640760f5d2Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7650760f5d2Smrg
7660760f5d2Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
767cc4920e5Smrg#
7680760f5d2Smrg# This file is free software; the Free Software Foundation
7690760f5d2Smrg# gives unlimited permission to copy and/or distribute it,
7700760f5d2Smrg# with or without modifications, as long as this notice is preserved.
771caade7ccSmrg
7720760f5d2Smrg# _AM_PROG_CC_C_O
7730760f5d2Smrg# ---------------
7740760f5d2Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7750760f5d2Smrg# to automatically call this.
7760760f5d2SmrgAC_DEFUN([_AM_PROG_CC_C_O],
7770760f5d2Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7780760f5d2SmrgAC_REQUIRE_AUX_FILE([compile])dnl
7790760f5d2SmrgAC_LANG_PUSH([C])dnl
7800760f5d2SmrgAC_CACHE_CHECK(
7810760f5d2Smrg  [whether $CC understands -c and -o together],
7820760f5d2Smrg  [am_cv_prog_cc_c_o],
7830760f5d2Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7840760f5d2Smrg  # Make sure it works both with $CC and with simple cc.
7850760f5d2Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7860760f5d2Smrg  # compilers refuse to overwrite an existing .o file with -o,
7870760f5d2Smrg  # though they will create one.
7880760f5d2Smrg  am_cv_prog_cc_c_o=yes
7890760f5d2Smrg  for am_i in 1 2; do
7900760f5d2Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7910760f5d2Smrg         && test -f conftest2.$ac_objext; then
7920760f5d2Smrg      : OK
7930760f5d2Smrg    else
7940760f5d2Smrg      am_cv_prog_cc_c_o=no
7950760f5d2Smrg      break
7960760f5d2Smrg    fi
7970760f5d2Smrg  done
7980760f5d2Smrg  rm -f core conftest*
7990760f5d2Smrg  unset am_i])
8000760f5d2Smrgif test "$am_cv_prog_cc_c_o" != yes; then
8010760f5d2Smrg   # Losing compiler, so override with the script.
8020760f5d2Smrg   # FIXME: It is wrong to rewrite CC.
8030760f5d2Smrg   # But if we don't then we get into trouble of one sort or another.
8040760f5d2Smrg   # A longer-term fix would be to have automake use am__CC in this case,
8050760f5d2Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8060760f5d2Smrg   CC="$am_aux_dir/compile $CC"
807b9b4fd27Smrgfi
8080760f5d2SmrgAC_LANG_POP([C])])
809b9b4fd27Smrg
8100760f5d2Smrg# For backward compatibility.
8110760f5d2SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
812caade7ccSmrg
8130760f5d2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
814cc4920e5Smrg#
8150760f5d2Smrg# This file is free software; the Free Software Foundation
8160760f5d2Smrg# gives unlimited permission to copy and/or distribute it,
8170760f5d2Smrg# with or without modifications, as long as this notice is preserved.
818caade7ccSmrg
8190760f5d2Smrg# AM_RUN_LOG(COMMAND)
8200760f5d2Smrg# -------------------
8210760f5d2Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8220760f5d2Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8230760f5d2SmrgAC_DEFUN([AM_RUN_LOG],
8240760f5d2Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8250760f5d2Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8260760f5d2Smrg   ac_status=$?
8270760f5d2Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8280760f5d2Smrg   (exit $ac_status); }])
8290760f5d2Smrg
8300760f5d2Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8310760f5d2Smrg
8320760f5d2Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
833af9a7ee5Smrg#
8340760f5d2Smrg# This file is free software; the Free Software Foundation
8350760f5d2Smrg# gives unlimited permission to copy and/or distribute it,
8360760f5d2Smrg# with or without modifications, as long as this notice is preserved.
837caade7ccSmrg
8380760f5d2Smrg# AM_SANITY_CHECK
8390760f5d2Smrg# ---------------
8400760f5d2SmrgAC_DEFUN([AM_SANITY_CHECK],
8410760f5d2Smrg[AC_MSG_CHECKING([whether build environment is sane])
8420760f5d2Smrg# Reject unsafe characters in $srcdir or the absolute working directory
8430760f5d2Smrg# name.  Accept space and tab only in the latter.
8440760f5d2Smrgam_lf='
8450760f5d2Smrg'
8460760f5d2Smrgcase `pwd` in
8470760f5d2Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8480760f5d2Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8490760f5d2Smrgesac
8500760f5d2Smrgcase $srcdir in
8510760f5d2Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8520760f5d2Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8530760f5d2Smrgesac
8540760f5d2Smrg
8550760f5d2Smrg# Do 'set' in a subshell so we don't clobber the current shell's
8560760f5d2Smrg# arguments.  Must try -L first in case configure is actually a
8570760f5d2Smrg# symlink; some systems play weird games with the mod time of symlinks
8580760f5d2Smrg# (eg FreeBSD returns the mod time of the symlink's containing
8590760f5d2Smrg# directory).
8600760f5d2Smrgif (
8610760f5d2Smrg   am_has_slept=no
8620760f5d2Smrg   for am_try in 1 2; do
8630760f5d2Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8640760f5d2Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8650760f5d2Smrg     if test "$[*]" = "X"; then
8660760f5d2Smrg	# -L didn't work.
8670760f5d2Smrg	set X `ls -t "$srcdir/configure" conftest.file`
8680760f5d2Smrg     fi
8690760f5d2Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
8700760f5d2Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8710760f5d2Smrg
8720760f5d2Smrg	# If neither matched, then we have a broken ls.  This can happen
8730760f5d2Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
8740760f5d2Smrg	# broken ls alias from the environment.  This has actually
8750760f5d2Smrg	# happened.  Such a system could not be considered "sane".
8760760f5d2Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8770760f5d2Smrg  alias in your environment])
8780760f5d2Smrg     fi
8790760f5d2Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8800760f5d2Smrg       break
8810760f5d2Smrg     fi
8820760f5d2Smrg     # Just in case.
8830760f5d2Smrg     sleep 1
8840760f5d2Smrg     am_has_slept=yes
8850760f5d2Smrg   done
8860760f5d2Smrg   test "$[2]" = conftest.file
8870760f5d2Smrg   )
8880760f5d2Smrgthen
8890760f5d2Smrg   # Ok.
8900760f5d2Smrg   :
891cc4920e5Smrgelse
8920760f5d2Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
8930760f5d2SmrgCheck your system clock])
894cc4920e5Smrgfi
8950760f5d2SmrgAC_MSG_RESULT([yes])
8960760f5d2Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
8970760f5d2Smrg# generated files are strictly newer.
8980760f5d2Smrgam_sleep_pid=
8990760f5d2Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9000760f5d2Smrg  ( sleep 1 ) &
9010760f5d2Smrg  am_sleep_pid=$!
9020760f5d2Smrgfi
9030760f5d2SmrgAC_CONFIG_COMMANDS_PRE(
9040760f5d2Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9050760f5d2Smrg   if test -n "$am_sleep_pid"; then
9060760f5d2Smrg     # Hide warnings about reused PIDs.
9070760f5d2Smrg     wait $am_sleep_pid 2>/dev/null
9080760f5d2Smrg   fi
9090760f5d2Smrg   AC_MSG_RESULT([done])])
9100760f5d2Smrgrm -f conftest.file
9110760f5d2Smrg])
912caade7ccSmrg
9130760f5d2Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
914af9a7ee5Smrg#
9150760f5d2Smrg# This file is free software; the Free Software Foundation
9160760f5d2Smrg# gives unlimited permission to copy and/or distribute it,
9170760f5d2Smrg# with or without modifications, as long as this notice is preserved.
918caade7ccSmrg
9190760f5d2Smrg# AM_SILENT_RULES([DEFAULT])
9200760f5d2Smrg# --------------------------
9210760f5d2Smrg# Enable less verbose build rules; with the default set to DEFAULT
9220760f5d2Smrg# ("yes" being less verbose, "no" or empty being verbose).
9230760f5d2SmrgAC_DEFUN([AM_SILENT_RULES],
9240760f5d2Smrg[AC_ARG_ENABLE([silent-rules], [dnl
9250760f5d2SmrgAS_HELP_STRING(
9260760f5d2Smrg  [--enable-silent-rules],
9270760f5d2Smrg  [less verbose build output (undo: "make V=1")])
9280760f5d2SmrgAS_HELP_STRING(
9290760f5d2Smrg  [--disable-silent-rules],
9300760f5d2Smrg  [verbose build output (undo: "make V=0")])dnl
9310760f5d2Smrg])
9320760f5d2Smrgcase $enable_silent_rules in @%:@ (((
9330760f5d2Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
9340760f5d2Smrg   no) AM_DEFAULT_VERBOSITY=1;;
9350760f5d2Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9360760f5d2Smrgesac
9370760f5d2Smrgdnl
9380760f5d2Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9390760f5d2Smrgdnl do not support nested variable expansions.
9400760f5d2Smrgdnl See automake bug#9928 and bug#10237.
9410760f5d2Smrgam_make=${MAKE-make}
9420760f5d2SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9430760f5d2Smrg   [am_cv_make_support_nested_variables],
9440760f5d2Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9450760f5d2SmrgBAR0=false
9460760f5d2SmrgBAR1=true
9470760f5d2SmrgV=1
9480760f5d2Smrgam__doit:
9490760f5d2Smrg	@$(TRUE)
9500760f5d2Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9510760f5d2Smrg  am_cv_make_support_nested_variables=yes
952a5602400Smrgelse
9530760f5d2Smrg  am_cv_make_support_nested_variables=no
9540760f5d2Smrgfi])
9550760f5d2Smrgif test $am_cv_make_support_nested_variables = yes; then
9560760f5d2Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9570760f5d2Smrg  AM_V='$(V)'
9580760f5d2Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9590760f5d2Smrgelse
9600760f5d2Smrg  AM_V=$AM_DEFAULT_VERBOSITY
9610760f5d2Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962a5602400Smrgfi
9630760f5d2SmrgAC_SUBST([AM_V])dnl
9640760f5d2SmrgAM_SUBST_NOTMAKE([AM_V])dnl
9650760f5d2SmrgAC_SUBST([AM_DEFAULT_V])dnl
9660760f5d2SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
9670760f5d2SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
9680760f5d2SmrgAM_BACKSLASH='\'
9690760f5d2SmrgAC_SUBST([AM_BACKSLASH])dnl
9700760f5d2Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
9710760f5d2Smrg])
972caade7ccSmrg
9730760f5d2Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
974cc4920e5Smrg#
9750760f5d2Smrg# This file is free software; the Free Software Foundation
9760760f5d2Smrg# gives unlimited permission to copy and/or distribute it,
9770760f5d2Smrg# with or without modifications, as long as this notice is preserved.
978cc4920e5Smrg
9790760f5d2Smrg# AM_PROG_INSTALL_STRIP
9800760f5d2Smrg# ---------------------
9810760f5d2Smrg# One issue with vendor 'install' (even GNU) is that you can't
9820760f5d2Smrg# specify the program used to strip binaries.  This is especially
9830760f5d2Smrg# annoying in cross-compiling environments, where the build's strip
9840760f5d2Smrg# is unlikely to handle the host's binaries.
9850760f5d2Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9860760f5d2Smrg# always use install-sh in "make install-strip", and initialize
9870760f5d2Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
9880760f5d2SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
9890760f5d2Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9900760f5d2Smrg# Installed binaries are usually stripped using 'strip' when the user
9910760f5d2Smrg# run "make install-strip".  However 'strip' might not be the right
9920760f5d2Smrg# tool to use in cross-compilation environments, therefore Automake
9930760f5d2Smrg# will honor the 'STRIP' environment variable to overrule this program.
9940760f5d2Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
9950760f5d2Smrgif test "$cross_compiling" != no; then
9960760f5d2Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
997a5602400Smrgfi
9980760f5d2SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
9990760f5d2SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1000caade7ccSmrg
10010760f5d2Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
1002cc4920e5Smrg#
10030760f5d2Smrg# This file is free software; the Free Software Foundation
10040760f5d2Smrg# gives unlimited permission to copy and/or distribute it,
10050760f5d2Smrg# with or without modifications, as long as this notice is preserved.
1006af9a7ee5Smrg
10070760f5d2Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
10080760f5d2Smrg# ---------------------------
10090760f5d2Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10100760f5d2Smrg# This macro is traced by Automake.
10110760f5d2SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1012af9a7ee5Smrg
10130760f5d2Smrg# AM_SUBST_NOTMAKE(VARIABLE)
10140760f5d2Smrg# --------------------------
10150760f5d2Smrg# Public sister of _AM_SUBST_NOTMAKE.
10160760f5d2SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1017af9a7ee5Smrg
10180760f5d2Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1019a5602400Smrg
10200760f5d2Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
1021cc4920e5Smrg#
10220760f5d2Smrg# This file is free software; the Free Software Foundation
10230760f5d2Smrg# gives unlimited permission to copy and/or distribute it,
10240760f5d2Smrg# with or without modifications, as long as this notice is preserved.
10250760f5d2Smrg
10260760f5d2Smrg# _AM_PROG_TAR(FORMAT)
10270760f5d2Smrg# --------------------
10280760f5d2Smrg# Check how to create a tarball in format FORMAT.
10290760f5d2Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1030cc4920e5Smrg#
10310760f5d2Smrg# Substitute a variable $(am__tar) that is a command
10320760f5d2Smrg# writing to stdout a FORMAT-tarball containing the directory
10330760f5d2Smrg# $tardir.
10340760f5d2Smrg#     tardir=directory && $(am__tar) > result.tar
1035cc4920e5Smrg#
10360760f5d2Smrg# Substitute a variable $(am__untar) that extract such
10370760f5d2Smrg# a tarball read from stdin.
10380760f5d2Smrg#     $(am__untar) < result.tar
1039cc4920e5Smrg#
10400760f5d2SmrgAC_DEFUN([_AM_PROG_TAR],
10410760f5d2Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10420760f5d2Smrg# in the wild :-(  We should find a proper way to deprecate it ...
10430760f5d2SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1044caade7ccSmrg
10450760f5d2Smrg# We'll loop over all known methods to create a tar archive until one works.
10460760f5d2Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047caade7ccSmrg
10480760f5d2Smrgm4_if([$1], [v7],
10490760f5d2Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050caade7ccSmrg
10510760f5d2Smrg  [m4_case([$1],
10520760f5d2Smrg    [ustar],
10530760f5d2Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10540760f5d2Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10550760f5d2Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10560760f5d2Smrg      # and bug#13588).
10570760f5d2Smrg      am_max_uid=2097151 # 2^21 - 1
10580760f5d2Smrg      am_max_gid=$am_max_uid
10590760f5d2Smrg      # The $UID and $GID variables are not portable, so we need to resort
10600760f5d2Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10610760f5d2Smrg      # below are definitely unexpected, so allow the users to see them
10620760f5d2Smrg      # (that is, avoid stderr redirection).
10630760f5d2Smrg      am_uid=`id -u || echo unknown`
10640760f5d2Smrg      am_gid=`id -g || echo unknown`
10650760f5d2Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10660760f5d2Smrg      if test $am_uid -le $am_max_uid; then
10670760f5d2Smrg         AC_MSG_RESULT([yes])
10680760f5d2Smrg      else
10690760f5d2Smrg         AC_MSG_RESULT([no])
10700760f5d2Smrg         _am_tools=none
10710760f5d2Smrg      fi
10720760f5d2Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10730760f5d2Smrg      if test $am_gid -le $am_max_gid; then
10740760f5d2Smrg         AC_MSG_RESULT([yes])
10750760f5d2Smrg      else
10760760f5d2Smrg        AC_MSG_RESULT([no])
10770760f5d2Smrg        _am_tools=none
10780760f5d2Smrg      fi],
1079caade7ccSmrg
10800760f5d2Smrg  [pax],
10810760f5d2Smrg    [],
1082caade7ccSmrg
10830760f5d2Smrg  [m4_fatal([Unknown tar format])])
1084caade7ccSmrg
10850760f5d2Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086caade7ccSmrg
10870760f5d2Smrg  # Go ahead even if we have the value already cached.  We do so because we
10880760f5d2Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
10890760f5d2Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1090cc4920e5Smrg
10910760f5d2Smrg  for _am_tool in $_am_tools; do
10920760f5d2Smrg    case $_am_tool in
10930760f5d2Smrg    gnutar)
10940760f5d2Smrg      for _am_tar in tar gnutar gtar; do
10950760f5d2Smrg        AM_RUN_LOG([$_am_tar --version]) && break
10960760f5d2Smrg      done
10970760f5d2Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
10980760f5d2Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
10990760f5d2Smrg      am__untar="$_am_tar -xf -"
11000760f5d2Smrg      ;;
11010760f5d2Smrg    plaintar)
11020760f5d2Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11030760f5d2Smrg      # ustar tarball either.
11040760f5d2Smrg      (tar --version) >/dev/null 2>&1 && continue
11050760f5d2Smrg      am__tar='tar chf - "$$tardir"'
11060760f5d2Smrg      am__tar_='tar chf - "$tardir"'
11070760f5d2Smrg      am__untar='tar xf -'
11080760f5d2Smrg      ;;
11090760f5d2Smrg    pax)
11100760f5d2Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
11110760f5d2Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
11120760f5d2Smrg      am__untar='pax -r'
11130760f5d2Smrg      ;;
11140760f5d2Smrg    cpio)
11150760f5d2Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11160760f5d2Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11170760f5d2Smrg      am__untar='cpio -i -H $1 -d'
11180760f5d2Smrg      ;;
11190760f5d2Smrg    none)
11200760f5d2Smrg      am__tar=false
11210760f5d2Smrg      am__tar_=false
11220760f5d2Smrg      am__untar=false
11230760f5d2Smrg      ;;
11240760f5d2Smrg    esac
1125af9a7ee5Smrg
11260760f5d2Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
11270760f5d2Smrg    # and am__untar set.
11280760f5d2Smrg    test -n "${am_cv_prog_tar_$1}" && break
1129cc4920e5Smrg
11300760f5d2Smrg    # tar/untar a dummy directory, and stop if the command works.
11310760f5d2Smrg    rm -rf conftest.dir
11320760f5d2Smrg    mkdir conftest.dir
11330760f5d2Smrg    echo GrepMe > conftest.dir/file
11340760f5d2Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11350760f5d2Smrg    rm -rf conftest.dir
11360760f5d2Smrg    if test -s conftest.tar; then
11370760f5d2Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
11380760f5d2Smrg      AM_RUN_LOG([cat conftest.dir/file])
11390760f5d2Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11400760f5d2Smrg    fi
11410760f5d2Smrg  done
11420760f5d2Smrg  rm -rf conftest.dir
1143caade7ccSmrg
11440760f5d2Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11450760f5d2Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146cc4920e5Smrg
11470760f5d2SmrgAC_SUBST([am__tar])
11480760f5d2SmrgAC_SUBST([am__untar])
11490760f5d2Smrg]) # _AM_PROG_TAR
1150cc4920e5Smrg
11510760f5d2Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
11520760f5d2Smrgdnl serial 11 (pkg-config-0.29)
11530760f5d2Smrgdnl
11540760f5d2Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11550760f5d2Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
11560760f5d2Smrgdnl
11570760f5d2Smrgdnl This program is free software; you can redistribute it and/or modify
11580760f5d2Smrgdnl it under the terms of the GNU General Public License as published by
11590760f5d2Smrgdnl the Free Software Foundation; either version 2 of the License, or
11600760f5d2Smrgdnl (at your option) any later version.
11610760f5d2Smrgdnl
11620760f5d2Smrgdnl This program is distributed in the hope that it will be useful, but
11630760f5d2Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
11640760f5d2Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11650760f5d2Smrgdnl General Public License for more details.
11660760f5d2Smrgdnl
11670760f5d2Smrgdnl You should have received a copy of the GNU General Public License
11680760f5d2Smrgdnl along with this program; if not, write to the Free Software
11690760f5d2Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
11700760f5d2Smrgdnl 02111-1307, USA.
11710760f5d2Smrgdnl
11720760f5d2Smrgdnl As a special exception to the GNU General Public License, if you
11730760f5d2Smrgdnl distribute this file as part of a program that contains a
11740760f5d2Smrgdnl configuration script generated by Autoconf, you may include it under
11750760f5d2Smrgdnl the same distribution terms that you use for the rest of that
11760760f5d2Smrgdnl program.
1177cc4920e5Smrg
11780760f5d2Smrgdnl PKG_PREREQ(MIN-VERSION)
11790760f5d2Smrgdnl -----------------------
11800760f5d2Smrgdnl Since: 0.29
11810760f5d2Smrgdnl
11820760f5d2Smrgdnl Verify that the version of the pkg-config macros are at least
11830760f5d2Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
11840760f5d2Smrgdnl installed version of pkg-config, this checks the developer's version
11850760f5d2Smrgdnl of pkg.m4 when generating configure.
11860760f5d2Smrgdnl
11870760f5d2Smrgdnl To ensure that this macro is defined, also add:
11880760f5d2Smrgdnl m4_ifndef([PKG_PREREQ],
11890760f5d2Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
11900760f5d2Smrgdnl
11910760f5d2Smrgdnl See the "Since" comment for each macro you use to see what version
11920760f5d2Smrgdnl of the macros you require.
11930760f5d2Smrgm4_defun([PKG_PREREQ],
11940760f5d2Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
11950760f5d2Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
11960760f5d2Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
11970760f5d2Smrg])dnl PKG_PREREQ
1198caade7ccSmrg
11990760f5d2Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
12000760f5d2Smrgdnl ----------------------------------
12010760f5d2Smrgdnl Since: 0.16
12020760f5d2Smrgdnl
12030760f5d2Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
12040760f5d2Smrgdnl first found in the path. Checks that the version of pkg-config found
12050760f5d2Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
12060760f5d2Smrgdnl used since that's the first version where most current features of
12070760f5d2Smrgdnl pkg-config existed.
12080760f5d2SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
12090760f5d2Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
12100760f5d2Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
12110760f5d2Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
12120760f5d2SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
12130760f5d2SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
12140760f5d2SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1215caade7ccSmrg
12160760f5d2Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
12170760f5d2Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1218af9a7ee5Smrgfi
12190760f5d2Smrgif test -n "$PKG_CONFIG"; then
12200760f5d2Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
12210760f5d2Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
12220760f5d2Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
12230760f5d2Smrg		AC_MSG_RESULT([yes])
12240760f5d2Smrg	else
12250760f5d2Smrg		AC_MSG_RESULT([no])
12260760f5d2Smrg		PKG_CONFIG=""
12270760f5d2Smrg	fi
12280760f5d2Smrgfi[]dnl
12290760f5d2Smrg])dnl PKG_PROG_PKG_CONFIG
1230b9b4fd27Smrg
12310760f5d2Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
12320760f5d2Smrgdnl -------------------------------------------------------------------
12330760f5d2Smrgdnl Since: 0.18
12340760f5d2Smrgdnl
12350760f5d2Smrgdnl Check to see whether a particular set of modules exists. Similar to
12360760f5d2Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
12370760f5d2Smrgdnl
12380760f5d2Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12390760f5d2Smrgdnl only at the first occurence in configure.ac, so if the first place
12400760f5d2Smrgdnl it's called might be skipped (such as if it is within an "if", you
12410760f5d2Smrgdnl have to call PKG_CHECK_EXISTS manually
12420760f5d2SmrgAC_DEFUN([PKG_CHECK_EXISTS],
12430760f5d2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12440760f5d2Smrgif test -n "$PKG_CONFIG" && \
12450760f5d2Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12460760f5d2Smrg  m4_default([$2], [:])
12470760f5d2Smrgm4_ifvaln([$3], [else
12480760f5d2Smrg  $3])dnl
12490760f5d2Smrgfi])
12500760f5d2Smrg
12510760f5d2Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12520760f5d2Smrgdnl ---------------------------------------------
12530760f5d2Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
12540760f5d2Smrgdnl pkg_failed based on the result.
12550760f5d2Smrgm4_define([_PKG_CONFIG],
12560760f5d2Smrg[if test -n "$$1"; then
12570760f5d2Smrg    pkg_cv_[]$1="$$1"
12580760f5d2Smrg elif test -n "$PKG_CONFIG"; then
12590760f5d2Smrg    PKG_CHECK_EXISTS([$3],
12600760f5d2Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
12610760f5d2Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
12620760f5d2Smrg		     [pkg_failed=yes])
12630760f5d2Smrg else
12640760f5d2Smrg    pkg_failed=untried
12650760f5d2Smrgfi[]dnl
12660760f5d2Smrg])dnl _PKG_CONFIG
12670760f5d2Smrg
12680760f5d2Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
12690760f5d2Smrgdnl ---------------------------
12700760f5d2Smrgdnl Internal check to see if pkg-config supports short errors.
12710760f5d2SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
12720760f5d2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12730760f5d2Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
12740760f5d2Smrg        _pkg_short_errors_supported=yes
1275af9a7ee5Smrgelse
12760760f5d2Smrg        _pkg_short_errors_supported=no
12770760f5d2Smrgfi[]dnl
12780760f5d2Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1279caade7ccSmrg
1280caade7ccSmrg
12810760f5d2Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12820760f5d2Smrgdnl   [ACTION-IF-NOT-FOUND])
12830760f5d2Smrgdnl --------------------------------------------------------------
12840760f5d2Smrgdnl Since: 0.4.0
12850760f5d2Smrgdnl
12860760f5d2Smrgdnl Note that if there is a possibility the first call to
12870760f5d2Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
12880760f5d2Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
12890760f5d2SmrgAC_DEFUN([PKG_CHECK_MODULES],
12900760f5d2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12910760f5d2SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
12920760f5d2SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1293cc4920e5Smrg
12940760f5d2Smrgpkg_failed=no
12950760f5d2SmrgAC_MSG_CHECKING([for $1])
1296cc4920e5Smrg
12970760f5d2Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
12980760f5d2Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1299e5383a99Smrg
13000760f5d2Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
13010760f5d2Smrgand $1[]_LIBS to avoid the need to call pkg-config.
13020760f5d2SmrgSee the pkg-config man page for more details.])
1303cc4920e5Smrg
13040760f5d2Smrgif test $pkg_failed = yes; then
13050760f5d2Smrg   	AC_MSG_RESULT([no])
13060760f5d2Smrg        _PKG_SHORT_ERRORS_SUPPORTED
13070760f5d2Smrg        if test $_pkg_short_errors_supported = yes; then
13080760f5d2Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
13090760f5d2Smrg        else 
13100760f5d2Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
13110760f5d2Smrg        fi
13120760f5d2Smrg	# Put the nasty error message in config.log where it belongs
13130760f5d2Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1314cc4920e5Smrg
13150760f5d2Smrg	m4_default([$4], [AC_MSG_ERROR(
13160760f5d2Smrg[Package requirements ($2) were not met:
1317e5383a99Smrg
13180760f5d2Smrg$$1_PKG_ERRORS
13190760f5d2Smrg
13200760f5d2SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
13210760f5d2Smrginstalled software in a non-standard prefix.
13220760f5d2Smrg
13230760f5d2Smrg_PKG_TEXT])[]dnl
13240760f5d2Smrg        ])
13250760f5d2Smrgelif test $pkg_failed = untried; then
13260760f5d2Smrg     	AC_MSG_RESULT([no])
13270760f5d2Smrg	m4_default([$4], [AC_MSG_FAILURE(
13280760f5d2Smrg[The pkg-config script could not be found or is too old.  Make sure it
13290760f5d2Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
13300760f5d2Smrgpath to pkg-config.
13310760f5d2Smrg
13320760f5d2Smrg_PKG_TEXT
13330760f5d2Smrg
13340760f5d2SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
13350760f5d2Smrg        ])
1336cc4920e5Smrgelse
13370760f5d2Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
13380760f5d2Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
13390760f5d2Smrg        AC_MSG_RESULT([yes])
13400760f5d2Smrg	$3
13410760f5d2Smrgfi[]dnl
13420760f5d2Smrg])dnl PKG_CHECK_MODULES
1343caade7ccSmrg
1344cc4920e5Smrg
13450760f5d2Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
13460760f5d2Smrgdnl   [ACTION-IF-NOT-FOUND])
13470760f5d2Smrgdnl ---------------------------------------------------------------------
13480760f5d2Smrgdnl Since: 0.29
13490760f5d2Smrgdnl
13500760f5d2Smrgdnl Checks for existence of MODULES and gathers its build flags with
13510760f5d2Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
13520760f5d2Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
13530760f5d2Smrgdnl
13540760f5d2Smrgdnl Note that if there is a possibility the first call to
13550760f5d2Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
13560760f5d2Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
13570760f5d2Smrgdnl configure.ac.
13580760f5d2SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
13590760f5d2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
13600760f5d2Smrg_save_PKG_CONFIG=$PKG_CONFIG
13610760f5d2SmrgPKG_CONFIG="$PKG_CONFIG --static"
13620760f5d2SmrgPKG_CHECK_MODULES($@)
13630760f5d2SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
13640760f5d2Smrg])dnl PKG_CHECK_MODULES_STATIC
1365caade7ccSmrg
1366cc4920e5Smrg
13670760f5d2Smrgdnl PKG_INSTALLDIR([DIRECTORY])
13680760f5d2Smrgdnl -------------------------
13690760f5d2Smrgdnl Since: 0.27
13700760f5d2Smrgdnl
13710760f5d2Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
13720760f5d2Smrgdnl should install pkg-config .pc files. By default the directory is
13730760f5d2Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
13740760f5d2Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
13750760f5d2Smrgdnl parameter.
13760760f5d2SmrgAC_DEFUN([PKG_INSTALLDIR],
13770760f5d2Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
13780760f5d2Smrgm4_pushdef([pkg_description],
13790760f5d2Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
13800760f5d2SmrgAC_ARG_WITH([pkgconfigdir],
13810760f5d2Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
13820760f5d2Smrg    [with_pkgconfigdir=]pkg_default)
13830760f5d2SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
13840760f5d2Smrgm4_popdef([pkg_default])
13850760f5d2Smrgm4_popdef([pkg_description])
13860760f5d2Smrg])dnl PKG_INSTALLDIR
13870760f5d2Smrg
13880760f5d2Smrg
13890760f5d2Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
13900760f5d2Smrgdnl --------------------------------
13910760f5d2Smrgdnl Since: 0.27
13920760f5d2Smrgdnl
13930760f5d2Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
13940760f5d2Smrgdnl module should install arch-independent pkg-config .pc files. By
13950760f5d2Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
13960760f5d2Smrgdnl changed by passing DIRECTORY. The user can override through the
13970760f5d2Smrgdnl --with-noarch-pkgconfigdir parameter.
13980760f5d2SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
13990760f5d2Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
14000760f5d2Smrgm4_pushdef([pkg_description],
14010760f5d2Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
14020760f5d2SmrgAC_ARG_WITH([noarch-pkgconfigdir],
14030760f5d2Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
14040760f5d2Smrg    [with_noarch_pkgconfigdir=]pkg_default)
14050760f5d2SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
14060760f5d2Smrgm4_popdef([pkg_default])
14070760f5d2Smrgm4_popdef([pkg_description])
14080760f5d2Smrg])dnl PKG_NOARCH_INSTALLDIR
14090760f5d2Smrg
1410cc4920e5Smrg
14110760f5d2Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
14120760f5d2Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
14130760f5d2Smrgdnl -------------------------------------------
14140760f5d2Smrgdnl Since: 0.28
14150760f5d2Smrgdnl
14160760f5d2Smrgdnl Retrieves the value of the pkg-config variable for the given module.
14170760f5d2SmrgAC_DEFUN([PKG_CHECK_VAR],
14180760f5d2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14190760f5d2SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1420caade7ccSmrg
14210760f5d2Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
14220760f5d2SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1423b9b4fd27Smrg
14240760f5d2SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
14250760f5d2Smrg])dnl PKG_CHECK_VAR
1426caade7ccSmrg
14270760f5d2Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
14280760f5d2Smrgdnl
142905789e77Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
14300760f5d2Smrgdnl
14310760f5d2Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14320760f5d2Smrgdnl copy of this software and associated documentation files (the "Software"),
14330760f5d2Smrgdnl to deal in the Software without restriction, including without limitation
14340760f5d2Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14350760f5d2Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
14360760f5d2Smrgdnl Software is furnished to do so, subject to the following conditions:
14370760f5d2Smrgdnl
14380760f5d2Smrgdnl The above copyright notice and this permission notice (including the next
14390760f5d2Smrgdnl paragraph) shall be included in all copies or substantial portions of the
14400760f5d2Smrgdnl Software.
14410760f5d2Smrgdnl
14420760f5d2Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14430760f5d2Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14440760f5d2Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14450760f5d2Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14460760f5d2Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14470760f5d2Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14480760f5d2Smrgdnl DEALINGS IN THE SOFTWARE.
1449cc4920e5Smrg
14500760f5d2Smrg# XORG_MACROS_VERSION(required-version)
14510760f5d2Smrg# -------------------------------------
1452cc4920e5Smrg# Minimum version: 1.1.0
1453af9a7ee5Smrg#
14540760f5d2Smrg# If you're using a macro added in Version 1.1 or newer, include this in
14550760f5d2Smrg# your configure.ac with the minimum required version, such as:
14560760f5d2Smrg# XORG_MACROS_VERSION(1.1)
1457af9a7ee5Smrg#
14580760f5d2Smrg# To ensure that this macro is defined, also add:
14590760f5d2Smrg# m4_ifndef([XORG_MACROS_VERSION],
14600760f5d2Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1461af9a7ee5Smrg#
14620760f5d2Smrg#
14630760f5d2Smrg# See the "minimum version" comment for each macro you use to see what
14640760f5d2Smrg# version you require.
14650760f5d2Smrgm4_defun([XORG_MACROS_VERSION],[
146605789e77Smrgm4_define([vers_have], [1.20.0])
14670760f5d2Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14680760f5d2Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14690760f5d2Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14700760f5d2Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
14710760f5d2Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
14720760f5d2Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
14730760f5d2Smrgm4_undefine([vers_have])
14740760f5d2Smrgm4_undefine([maj_have])
14750760f5d2Smrgm4_undefine([maj_needed])
14760760f5d2Smrg]) # XORG_MACROS_VERSION
1477caade7ccSmrg
14780760f5d2Smrg# XORG_PROG_RAWCPP()
14790760f5d2Smrg# ------------------
14800760f5d2Smrg# Minimum version: 1.0.0
14810760f5d2Smrg#
14820760f5d2Smrg# Find cpp program and necessary flags for use in pre-processing text files
14830760f5d2Smrg# such as man pages and config files
14840760f5d2SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
14850760f5d2SmrgAC_REQUIRE([AC_PROG_CPP])
14860760f5d2SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
14870760f5d2Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1488cc4920e5Smrg
14890760f5d2Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
14900760f5d2Smrg# which is not the best choice for supporting other OS'es, but covers most
14910760f5d2Smrg# of the ones we need for now.
14920760f5d2SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14930760f5d2SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
14940760f5d2Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14950760f5d2Smrg	AC_MSG_RESULT([no])
14960760f5d2Smrgelse
14970760f5d2Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14980760f5d2Smrg		RAWCPPFLAGS=-undef
14990760f5d2Smrg		AC_MSG_RESULT([yes])
15000760f5d2Smrg	# under Cygwin unix is still defined even with -undef
15010760f5d2Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
15020760f5d2Smrg		RAWCPPFLAGS="-undef -ansi"
15030760f5d2Smrg		AC_MSG_RESULT([yes, with -ansi])
15040760f5d2Smrg	else
15050760f5d2Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
15060760f5d2Smrg	fi
1507af9a7ee5Smrgfi
15080760f5d2Smrgrm -f conftest.$ac_ext
1509caade7ccSmrg
15100760f5d2SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
15110760f5d2SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
151205789e77Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
15130760f5d2Smrg	AC_MSG_RESULT([no])
15140760f5d2Smrgelse
151505789e77Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
15160760f5d2Smrg		TRADITIONALCPPFLAGS="-traditional"
15170760f5d2Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
15180760f5d2Smrg		AC_MSG_RESULT([yes])
15190760f5d2Smrg	else
15200760f5d2Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
15210760f5d2Smrg	fi
15220760f5d2Smrgfi
15230760f5d2Smrgrm -f conftest.$ac_ext
15240760f5d2SmrgAC_SUBST(RAWCPPFLAGS)
15250760f5d2SmrgAC_SUBST(TRADITIONALCPPFLAGS)
15260760f5d2Smrg]) # XORG_PROG_RAWCPP
1527cc4920e5Smrg
15280760f5d2Smrg# XORG_MANPAGE_SECTIONS()
15290760f5d2Smrg# -----------------------
15300760f5d2Smrg# Minimum version: 1.0.0
1531e5383a99Smrg#
15320760f5d2Smrg# Determine which sections man pages go in for the different man page types
15330760f5d2Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
15340760f5d2Smrg# Not sure if there's any better way than just hardcoding by OS name.
15350760f5d2Smrg# Override default settings by setting environment variables
15360760f5d2Smrg# Added MAN_SUBSTS in version 1.8
15370760f5d2Smrg# Added AC_PROG_SED in version 1.8
1538cc4920e5Smrg
15390760f5d2SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
15400760f5d2SmrgAC_REQUIRE([AC_CANONICAL_HOST])
15410760f5d2SmrgAC_REQUIRE([AC_PROG_SED])
1542e5383a99Smrg
15430760f5d2Smrgcase $host_os in
15440760f5d2Smrg    solaris*)
15450760f5d2Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
15460760f5d2Smrg        # check for a man page file found in later versions that use
15470760f5d2Smrg        # traditional section numbers instead
15480760f5d2Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
15490760f5d2Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
15500760f5d2Smrg        ;;
15510760f5d2Smrg    *) SYSV_MAN_SECTIONS=false ;;
15520760f5d2Smrgesac
1553e5383a99Smrg
15540760f5d2Smrgif test x$APP_MAN_SUFFIX = x    ; then
15550760f5d2Smrg    APP_MAN_SUFFIX=1
15560760f5d2Smrgfi
15570760f5d2Smrgif test x$APP_MAN_DIR = x    ; then
15580760f5d2Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
15590760f5d2Smrgfi
1560cc4920e5Smrg
15610760f5d2Smrgif test x$LIB_MAN_SUFFIX = x    ; then
15620760f5d2Smrg    LIB_MAN_SUFFIX=3
15630760f5d2Smrgfi
15640760f5d2Smrgif test x$LIB_MAN_DIR = x    ; then
15650760f5d2Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
15660760f5d2Smrgfi
1567cc4920e5Smrg
15680760f5d2Smrgif test x$FILE_MAN_SUFFIX = x    ; then
15690760f5d2Smrg    case $SYSV_MAN_SECTIONS in
15700760f5d2Smrg	true)				FILE_MAN_SUFFIX=4  ;;
15710760f5d2Smrg	*)				FILE_MAN_SUFFIX=5  ;;
15720760f5d2Smrg    esac
15730760f5d2Smrgfi
15740760f5d2Smrgif test x$FILE_MAN_DIR = x    ; then
15750760f5d2Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1576cc4920e5Smrgfi
1577cc4920e5Smrg
15780760f5d2Smrgif test x$MISC_MAN_SUFFIX = x    ; then
15790760f5d2Smrg    case $SYSV_MAN_SECTIONS in
15800760f5d2Smrg	true)				MISC_MAN_SUFFIX=5  ;;
15810760f5d2Smrg	*)				MISC_MAN_SUFFIX=7  ;;
15820760f5d2Smrg    esac
15830760f5d2Smrgfi
15840760f5d2Smrgif test x$MISC_MAN_DIR = x    ; then
15850760f5d2Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1586cc4920e5Smrgfi
1587cc4920e5Smrg
15880760f5d2Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
15890760f5d2Smrg    case $SYSV_MAN_SECTIONS in
15900760f5d2Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
15910760f5d2Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
15920760f5d2Smrg    esac
15930760f5d2Smrgfi
15940760f5d2Smrgif test x$DRIVER_MAN_DIR = x    ; then
15950760f5d2Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
15960760f5d2Smrgfi
1597cc4920e5Smrg
15980760f5d2Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
15990760f5d2Smrg    case $SYSV_MAN_SECTIONS in
16000760f5d2Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
16010760f5d2Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
16020760f5d2Smrg    esac
16030760f5d2Smrgfi
16040760f5d2Smrgif test x$ADMIN_MAN_DIR = x    ; then
16050760f5d2Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
16060760f5d2Smrgfi
1607cc4920e5Smrg
1608cc4920e5Smrg
16090760f5d2SmrgAC_SUBST([APP_MAN_SUFFIX])
16100760f5d2SmrgAC_SUBST([LIB_MAN_SUFFIX])
16110760f5d2SmrgAC_SUBST([FILE_MAN_SUFFIX])
16120760f5d2SmrgAC_SUBST([MISC_MAN_SUFFIX])
16130760f5d2SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
16140760f5d2SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
16150760f5d2SmrgAC_SUBST([APP_MAN_DIR])
16160760f5d2SmrgAC_SUBST([LIB_MAN_DIR])
16170760f5d2SmrgAC_SUBST([FILE_MAN_DIR])
16180760f5d2SmrgAC_SUBST([MISC_MAN_DIR])
16190760f5d2SmrgAC_SUBST([DRIVER_MAN_DIR])
16200760f5d2SmrgAC_SUBST([ADMIN_MAN_DIR])
1621cc4920e5Smrg
16220760f5d2SmrgXORG_MAN_PAGE="X Version 11"
16230760f5d2SmrgAC_SUBST([XORG_MAN_PAGE])
16240760f5d2SmrgMAN_SUBSTS="\
16250760f5d2Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16260760f5d2Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
16270760f5d2Smrg	-e 's|__xservername__|Xorg|g' \
16280760f5d2Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
16290760f5d2Smrg	-e 's|__projectroot__|\$(prefix)|g' \
16300760f5d2Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
16310760f5d2Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
16320760f5d2Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
16330760f5d2Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
16340760f5d2Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
16350760f5d2Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
16360760f5d2Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
16370760f5d2SmrgAC_SUBST([MAN_SUBSTS])
1638cc4920e5Smrg
16390760f5d2Smrg]) # XORG_MANPAGE_SECTIONS
1640cc4920e5Smrg
16410760f5d2Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
16420760f5d2Smrg# ------------------------
16430760f5d2Smrg# Minimum version: 1.7.0
1644af9a7ee5Smrg#
16450760f5d2Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
16460760f5d2Smrg# provided by xorg-sgml-doctools, if installed.
16470760f5d2SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
16480760f5d2SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
16490760f5d2SmrgXORG_SGML_PATH=
16500760f5d2SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
16510760f5d2Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
16520760f5d2Smrg    [m4_ifval([$1],[:],
16530760f5d2Smrg        [if test x"$cross_compiling" != x"yes" ; then
16540760f5d2Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
16550760f5d2Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
16560760f5d2Smrg         fi])
16570760f5d2Smrg    ])
16580760f5d2Smrg
16590760f5d2Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
16600760f5d2Smrg# the path and the name of the doc stylesheet
16610760f5d2Smrgif test "x$XORG_SGML_PATH" != "x" ; then
16620760f5d2Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
16630760f5d2Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
16640760f5d2Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
16650760f5d2Smrgelse
16660760f5d2Smrg   AC_MSG_RESULT([no])
16670760f5d2Smrgfi
16680760f5d2Smrg
16690760f5d2SmrgAC_SUBST(XORG_SGML_PATH)
16700760f5d2SmrgAC_SUBST(STYLESHEET_SRCDIR)
16710760f5d2SmrgAC_SUBST(XSL_STYLESHEET)
16720760f5d2SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
16730760f5d2Smrg]) # XORG_CHECK_SGML_DOCTOOLS
16740760f5d2Smrg
16750760f5d2Smrg# XORG_CHECK_LINUXDOC
16760760f5d2Smrg# -------------------
16770760f5d2Smrg# Minimum version: 1.0.0
1678af9a7ee5Smrg#
16790760f5d2Smrg# Defines the variable MAKE_TEXT if the necessary tools and
16800760f5d2Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
16810760f5d2Smrg# Whether or not the necessary tools and files are found can be checked
16820760f5d2Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
16830760f5d2SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
16840760f5d2SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16850760f5d2SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1686caade7ccSmrg
16870760f5d2SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1688cc4920e5Smrg
16890760f5d2SmrgAC_MSG_CHECKING([whether to build documentation])
16900760f5d2Smrg
16910760f5d2Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
16920760f5d2Smrg   BUILDDOC=yes
1693af9a7ee5Smrgelse
16940760f5d2Smrg   BUILDDOC=no
1695af9a7ee5Smrgfi
1696caade7ccSmrg
16970760f5d2SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1698caade7ccSmrg
16990760f5d2SmrgAC_MSG_RESULT([$BUILDDOC])
1700caade7ccSmrg
17010760f5d2SmrgAC_MSG_CHECKING([whether to build pdf documentation])
17020760f5d2Smrg
17030760f5d2Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
17040760f5d2Smrg   BUILDPDFDOC=yes
17050760f5d2Smrgelse
17060760f5d2Smrg   BUILDPDFDOC=no
17070760f5d2Smrgfi
17080760f5d2Smrg
17090760f5d2SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17100760f5d2Smrg
17110760f5d2SmrgAC_MSG_RESULT([$BUILDPDFDOC])
17120760f5d2Smrg
17130760f5d2SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
17140760f5d2SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
17150760f5d2SmrgMAKE_PDF="$PS2PDF"
17160760f5d2SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
17170760f5d2Smrg
17180760f5d2SmrgAC_SUBST(MAKE_TEXT)
17190760f5d2SmrgAC_SUBST(MAKE_PS)
17200760f5d2SmrgAC_SUBST(MAKE_PDF)
17210760f5d2SmrgAC_SUBST(MAKE_HTML)
17220760f5d2Smrg]) # XORG_CHECK_LINUXDOC
17230760f5d2Smrg
17240760f5d2Smrg# XORG_CHECK_DOCBOOK
17250760f5d2Smrg# -------------------
17260760f5d2Smrg# Minimum version: 1.0.0
17270760f5d2Smrg#
17280760f5d2Smrg# Checks for the ability to build output formats from SGML DocBook source.
17290760f5d2Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
17300760f5d2Smrg# indicates whether the necessary tools and files are found and, if set,
17310760f5d2Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
17320760f5d2SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
17330760f5d2SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
17340760f5d2Smrg
17350760f5d2SmrgBUILDTXTDOC=no
17360760f5d2SmrgBUILDPDFDOC=no
17370760f5d2SmrgBUILDPSDOC=no
17380760f5d2SmrgBUILDHTMLDOC=no
17390760f5d2Smrg
17400760f5d2SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
17410760f5d2SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
17420760f5d2SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
17430760f5d2SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1744485f0483Smrg
17450760f5d2SmrgAC_MSG_CHECKING([whether to build text documentation])
17460760f5d2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
17470760f5d2Smrg   test x$BUILD_TXTDOC != xno; then
17480760f5d2Smrg	BUILDTXTDOC=yes
17490760f5d2Smrgfi
17500760f5d2SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
17510760f5d2SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1752cc4920e5Smrg
17530760f5d2SmrgAC_MSG_CHECKING([whether to build PDF documentation])
17540760f5d2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
17550760f5d2Smrg   test x$BUILD_PDFDOC != xno; then
17560760f5d2Smrg	BUILDPDFDOC=yes
17570760f5d2Smrgfi
17580760f5d2SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
17590760f5d2SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1760cc4920e5Smrg
17610760f5d2SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
17620760f5d2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
17630760f5d2Smrg   test x$BUILD_PSDOC != xno; then
17640760f5d2Smrg	BUILDPSDOC=yes
1765cc4920e5Smrgfi
17660760f5d2SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
17670760f5d2SmrgAC_MSG_RESULT([$BUILDPSDOC])
1768485f0483Smrg
17690760f5d2SmrgAC_MSG_CHECKING([whether to build HTML documentation])
17700760f5d2Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
17710760f5d2Smrg   test x$BUILD_HTMLDOC != xno; then
17720760f5d2Smrg	BUILDHTMLDOC=yes
17730760f5d2Smrgfi
17740760f5d2SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
17750760f5d2SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1776485f0483Smrg
17770760f5d2SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
17780760f5d2SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
17790760f5d2SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
17800760f5d2SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
17810760f5d2Smrg
17820760f5d2SmrgAC_SUBST(MAKE_TEXT)
17830760f5d2SmrgAC_SUBST(MAKE_PS)
17840760f5d2SmrgAC_SUBST(MAKE_PDF)
17850760f5d2SmrgAC_SUBST(MAKE_HTML)
17860760f5d2Smrg]) # XORG_CHECK_DOCBOOK
17870760f5d2Smrg
17880760f5d2Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
17890760f5d2Smrg# ----------------
17900760f5d2Smrg# Minimum version: 1.5.0
17910760f5d2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1792af9a7ee5Smrg#
17930760f5d2Smrg# Documentation tools are not always available on all platforms and sometimes
17940760f5d2Smrg# not at the appropriate level. This macro enables a module to test for the
17950760f5d2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
179605789e77Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
17970760f5d2Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17980760f5d2Smrg# --with-xmlto assumes 'auto'.
1799af9a7ee5Smrg#
18000760f5d2Smrg# Interface to module:
18010760f5d2Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
18020760f5d2Smrg# XMLTO:	returns the path of the xmlto program found
18030760f5d2Smrg#		returns the path set by the user in the environment
18040760f5d2Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
18050760f5d2Smrg#		'no' user instructs the module not to use xmlto
1806af9a7ee5Smrg#
18070760f5d2Smrg# Added in version 1.10.0
18080760f5d2Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
18090760f5d2Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1810af9a7ee5Smrg#
18110760f5d2Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1812af9a7ee5Smrg#
18130760f5d2SmrgAC_DEFUN([XORG_WITH_XMLTO],[
18140760f5d2SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
18150760f5d2Smrgm4_define([_defopt], m4_default([$2], [auto]))
18160760f5d2SmrgAC_ARG_WITH(xmlto,
18170760f5d2Smrg	AS_HELP_STRING([--with-xmlto],
18180760f5d2Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
18190760f5d2Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
18200760f5d2Smrgm4_undefine([_defopt])
1821485f0483Smrg
18220760f5d2Smrgif test "x$use_xmlto" = x"auto"; then
18230760f5d2Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18240760f5d2Smrg   if test "x$XMLTO" = "x"; then
18250760f5d2Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
18260760f5d2Smrg	have_xmlto=no
18270760f5d2Smrg   else
18280760f5d2Smrg        have_xmlto=yes
18290760f5d2Smrg   fi
18300760f5d2Smrgelif test "x$use_xmlto" = x"yes" ; then
18310760f5d2Smrg   AC_PATH_PROG([XMLTO], [xmlto])
18320760f5d2Smrg   if test "x$XMLTO" = "x"; then
18330760f5d2Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
18340760f5d2Smrg   fi
18350760f5d2Smrg   have_xmlto=yes
18360760f5d2Smrgelif test "x$use_xmlto" = x"no" ; then
18370760f5d2Smrg   if test "x$XMLTO" != "x"; then
18380760f5d2Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
18390760f5d2Smrg   fi
18400760f5d2Smrg   have_xmlto=no
18410760f5d2Smrgelse
18420760f5d2Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
18430760f5d2Smrgfi
1844b9b4fd27Smrg
18450760f5d2Smrg# Test for a minimum version of xmlto, if provided.
18460760f5d2Smrgm4_ifval([$1],
18470760f5d2Smrg[if test "$have_xmlto" = yes; then
18480760f5d2Smrg    # scrape the xmlto version
18490760f5d2Smrg    AC_MSG_CHECKING([the xmlto version])
18500760f5d2Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
18510760f5d2Smrg    AC_MSG_RESULT([$xmlto_version])
18520760f5d2Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
18530760f5d2Smrg        [if test "x$use_xmlto" = xauto; then
18540760f5d2Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
18550760f5d2Smrg            have_xmlto=no
18560760f5d2Smrg        else
18570760f5d2Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
18580760f5d2Smrg        fi])
18590760f5d2Smrgfi])
1860b9b4fd27Smrg
18610760f5d2Smrg# Test for the ability of xmlto to generate a text target
18620760f5d2Smrg#
18630760f5d2Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
18640760f5d2Smrg# following test for empty XML docbook files.
18650760f5d2Smrg# For compatibility reasons use the following empty XML docbook file and if
18660760f5d2Smrg# it fails try it again with a non-empty XML file.
18670760f5d2Smrghave_xmlto_text=no
18680760f5d2Smrgcat > conftest.xml << "EOF"
18690760f5d2SmrgEOF
18700760f5d2SmrgAS_IF([test "$have_xmlto" = yes],
18710760f5d2Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18720760f5d2Smrg             [have_xmlto_text=yes],
18730760f5d2Smrg             [# Try it again with a non-empty XML file.
18740760f5d2Smrg              cat > conftest.xml << "EOF"
18750760f5d2Smrg<x></x>
18760760f5d2SmrgEOF
18770760f5d2Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
18780760f5d2Smrg                    [have_xmlto_text=yes],
18790760f5d2Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
18800760f5d2Smrgrm -f conftest.xml
18810760f5d2SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
18820760f5d2SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
18830760f5d2Smrg]) # XORG_WITH_XMLTO
1884caade7ccSmrg
18850760f5d2Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
18860760f5d2Smrg# --------------------------------------------
18870760f5d2Smrg# Minimum version: 1.12.0
18880760f5d2Smrg# Minimum version for optional DEFAULT argument: 1.12.0
18890760f5d2Smrg#
18900760f5d2Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
18910760f5d2Smrg# XML-based language used for the transformation of XML documents.
18920760f5d2Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
18930760f5d2Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
18940760f5d2Smrg# The XSLT processor is often used as a standalone tool for transformations.
18950760f5d2Smrg# It should not be assumed that this tool is used only to work with documnetation.
18960760f5d2Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
18970760f5d2Smrg#
18980760f5d2Smrg# Interface to module:
18990760f5d2Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
19000760f5d2Smrg# XSLTPROC:	 returns the path of the xsltproc program found
19010760f5d2Smrg#		 returns the path set by the user in the environment
19020760f5d2Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
19030760f5d2Smrg#		  'no' user instructs the module not to use xsltproc
19040760f5d2Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
19050760f5d2Smrg#
19060760f5d2Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
19070760f5d2Smrg#
19080760f5d2SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
19090760f5d2SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
19100760f5d2Smrg# Preserves the interface, should it be implemented later
19110760f5d2Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
19120760f5d2Smrgm4_define([_defopt], m4_default([$2], [auto]))
19130760f5d2SmrgAC_ARG_WITH(xsltproc,
19140760f5d2Smrg	AS_HELP_STRING([--with-xsltproc],
19150760f5d2Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
19160760f5d2Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
19170760f5d2Smrgm4_undefine([_defopt])
1918caade7ccSmrg
19190760f5d2Smrgif test "x$use_xsltproc" = x"auto"; then
19200760f5d2Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19210760f5d2Smrg   if test "x$XSLTPROC" = "x"; then
19220760f5d2Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
19230760f5d2Smrg	have_xsltproc=no
19240760f5d2Smrg   else
19250760f5d2Smrg        have_xsltproc=yes
19260760f5d2Smrg   fi
19270760f5d2Smrgelif test "x$use_xsltproc" = x"yes" ; then
19280760f5d2Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
19290760f5d2Smrg   if test "x$XSLTPROC" = "x"; then
19300760f5d2Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
19310760f5d2Smrg   fi
19320760f5d2Smrg   have_xsltproc=yes
19330760f5d2Smrgelif test "x$use_xsltproc" = x"no" ; then
19340760f5d2Smrg   if test "x$XSLTPROC" != "x"; then
19350760f5d2Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
19360760f5d2Smrg   fi
19370760f5d2Smrg   have_xsltproc=no
19380760f5d2Smrgelse
19390760f5d2Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1940cc4920e5Smrgfi
1941caade7ccSmrg
19420760f5d2SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
19430760f5d2Smrg]) # XORG_WITH_XSLTPROC
19440760f5d2Smrg
19450760f5d2Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
19460760f5d2Smrg# ----------------------------------------
19470760f5d2Smrg# Minimum version: 1.15.0
1948af9a7ee5Smrg#
19490760f5d2Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
19500760f5d2Smrg# scanning arbitrary text files, extracting information from those text files,
19510760f5d2Smrg# and printing reports based on that information.
1952af9a7ee5Smrg#
19530760f5d2Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1954af9a7ee5Smrg#
19550760f5d2Smrg# Interface to module:
19560760f5d2Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
19570760f5d2Smrg# PERL:	     returns the path of the perl program found
19580760f5d2Smrg#	     returns the path set by the user in the environment
19590760f5d2Smrg# --with-perl: 'yes' user instructs the module to use perl
19600760f5d2Smrg#	       'no' user instructs the module not to use perl
19610760f5d2Smrg# have_perl: returns yes if perl found in PATH or no
1962af9a7ee5Smrg#
19630760f5d2Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
19640760f5d2Smrg#
19650760f5d2SmrgAC_DEFUN([XORG_WITH_PERL],[
19660760f5d2SmrgAC_ARG_VAR([PERL], [Path to perl command])
19670760f5d2Smrg# Preserves the interface, should it be implemented later
19680760f5d2Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
19690760f5d2Smrgm4_define([_defopt], m4_default([$2], [auto]))
19700760f5d2SmrgAC_ARG_WITH(perl,
19710760f5d2Smrg	AS_HELP_STRING([--with-perl],
19720760f5d2Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
19730760f5d2Smrg	   [use_perl=$withval], [use_perl=]_defopt)
19740760f5d2Smrgm4_undefine([_defopt])
1975cc4920e5Smrg
19760760f5d2Smrgif test "x$use_perl" = x"auto"; then
19770760f5d2Smrg   AC_PATH_PROG([PERL], [perl])
19780760f5d2Smrg   if test "x$PERL" = "x"; then
19790760f5d2Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
19800760f5d2Smrg	have_perl=no
19810760f5d2Smrg   else
19820760f5d2Smrg        have_perl=yes
19830760f5d2Smrg   fi
19840760f5d2Smrgelif test "x$use_perl" = x"yes" ; then
19850760f5d2Smrg   AC_PATH_PROG([PERL], [perl])
19860760f5d2Smrg   if test "x$PERL" = "x"; then
19870760f5d2Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
19880760f5d2Smrg   fi
19890760f5d2Smrg   have_perl=yes
19900760f5d2Smrgelif test "x$use_perl" = x"no" ; then
19910760f5d2Smrg   if test "x$PERL" != "x"; then
19920760f5d2Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
19930760f5d2Smrg   fi
19940760f5d2Smrg   have_perl=no
19950760f5d2Smrgelse
19960760f5d2Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
19970760f5d2Smrgfi
1998cc4920e5Smrg
19990760f5d2SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
20000760f5d2Smrg]) # XORG_WITH_PERL
2001b9b4fd27Smrg
20020760f5d2Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2003cc4920e5Smrg# ----------------
20040760f5d2Smrg# Minimum version: 1.5.0
20050760f5d2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2006af9a7ee5Smrg#
20070760f5d2Smrg# Documentation tools are not always available on all platforms and sometimes
20080760f5d2Smrg# not at the appropriate level. This macro enables a module to test for the
20090760f5d2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
201005789e77Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
20110760f5d2Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
20120760f5d2Smrg# --with-asciidoc assumes 'auto'.
2013af9a7ee5Smrg#
20140760f5d2Smrg# Interface to module:
20150760f5d2Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
20160760f5d2Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
20170760f5d2Smrg#		 returns the path set by the user in the environment
20180760f5d2Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
20190760f5d2Smrg#		  'no' user instructs the module not to use asciidoc
2020af9a7ee5Smrg#
20210760f5d2Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2022af9a7ee5Smrg#
20230760f5d2SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
20240760f5d2SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
20250760f5d2Smrgm4_define([_defopt], m4_default([$2], [auto]))
20260760f5d2SmrgAC_ARG_WITH(asciidoc,
20270760f5d2Smrg	AS_HELP_STRING([--with-asciidoc],
20280760f5d2Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
20290760f5d2Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
20300760f5d2Smrgm4_undefine([_defopt])
2031cc4920e5Smrg
20320760f5d2Smrgif test "x$use_asciidoc" = x"auto"; then
20330760f5d2Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20340760f5d2Smrg   if test "x$ASCIIDOC" = "x"; then
20350760f5d2Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
20360760f5d2Smrg	have_asciidoc=no
20370760f5d2Smrg   else
20380760f5d2Smrg        have_asciidoc=yes
20390760f5d2Smrg   fi
20400760f5d2Smrgelif test "x$use_asciidoc" = x"yes" ; then
20410760f5d2Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
20420760f5d2Smrg   if test "x$ASCIIDOC" = "x"; then
20430760f5d2Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
20440760f5d2Smrg   fi
20450760f5d2Smrg   have_asciidoc=yes
20460760f5d2Smrgelif test "x$use_asciidoc" = x"no" ; then
20470760f5d2Smrg   if test "x$ASCIIDOC" != "x"; then
20480760f5d2Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
20490760f5d2Smrg   fi
20500760f5d2Smrg   have_asciidoc=no
20510760f5d2Smrgelse
20520760f5d2Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
20530760f5d2Smrgfi
20540760f5d2Smrgm4_ifval([$1],
20550760f5d2Smrg[if test "$have_asciidoc" = yes; then
20560760f5d2Smrg    # scrape the asciidoc version
20570760f5d2Smrg    AC_MSG_CHECKING([the asciidoc version])
20580760f5d2Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
20590760f5d2Smrg    AC_MSG_RESULT([$asciidoc_version])
20600760f5d2Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
20610760f5d2Smrg        [if test "x$use_asciidoc" = xauto; then
20620760f5d2Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
20630760f5d2Smrg            have_asciidoc=no
20640760f5d2Smrg        else
20650760f5d2Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
20660760f5d2Smrg        fi])
20670760f5d2Smrgfi])
20680760f5d2SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
20690760f5d2Smrg]) # XORG_WITH_ASCIIDOC
2070cc4920e5Smrg
20710760f5d2Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
20720760f5d2Smrg# -------------------------------------------
20730760f5d2Smrg# Minimum version: 1.5.0
20740760f5d2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20750760f5d2Smrg# Minimum version for optional DOT checking: 1.18.0
2076af9a7ee5Smrg#
20770760f5d2Smrg# Documentation tools are not always available on all platforms and sometimes
20780760f5d2Smrg# not at the appropriate level. This macro enables a module to test for the
20790760f5d2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
208005789e77Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
20810760f5d2Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
20820760f5d2Smrg# --with-doxygen assumes 'auto'.
2083af9a7ee5Smrg#
20840760f5d2Smrg# Interface to module:
20850760f5d2Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
20860760f5d2Smrg# DOXYGEN:	 returns the path of the doxygen program found
20870760f5d2Smrg#		 returns the path set by the user in the environment
20880760f5d2Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
20890760f5d2Smrg#		  'no' user instructs the module not to use doxygen
2090af9a7ee5Smrg#
20910760f5d2Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2092af9a7ee5Smrg#
20930760f5d2SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
20940760f5d2SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
20950760f5d2SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
20960760f5d2Smrgm4_define([_defopt], m4_default([$2], [auto]))
20970760f5d2SmrgAC_ARG_WITH(doxygen,
20980760f5d2Smrg	AS_HELP_STRING([--with-doxygen],
20990760f5d2Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
21000760f5d2Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
21010760f5d2Smrgm4_undefine([_defopt])
2102cc4920e5Smrg
21030760f5d2Smrgif test "x$use_doxygen" = x"auto"; then
21040760f5d2Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21050760f5d2Smrg   if test "x$DOXYGEN" = "x"; then
21060760f5d2Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
21070760f5d2Smrg	have_doxygen=no
21080760f5d2Smrg   else
21090760f5d2Smrg        have_doxygen=yes
21100760f5d2Smrg   fi
21110760f5d2Smrgelif test "x$use_doxygen" = x"yes" ; then
21120760f5d2Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
21130760f5d2Smrg   if test "x$DOXYGEN" = "x"; then
21140760f5d2Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
21150760f5d2Smrg   fi
21160760f5d2Smrg   have_doxygen=yes
21170760f5d2Smrgelif test "x$use_doxygen" = x"no" ; then
21180760f5d2Smrg   if test "x$DOXYGEN" != "x"; then
21190760f5d2Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
21200760f5d2Smrg   fi
21210760f5d2Smrg   have_doxygen=no
2122cc4920e5Smrgelse
21230760f5d2Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2124cc4920e5Smrgfi
21250760f5d2Smrgm4_ifval([$1],
21260760f5d2Smrg[if test "$have_doxygen" = yes; then
21270760f5d2Smrg    # scrape the doxygen version
21280760f5d2Smrg    AC_MSG_CHECKING([the doxygen version])
21290760f5d2Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
21300760f5d2Smrg    AC_MSG_RESULT([$doxygen_version])
21310760f5d2Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
21320760f5d2Smrg        [if test "x$use_doxygen" = xauto; then
21330760f5d2Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
21340760f5d2Smrg            have_doxygen=no
21350760f5d2Smrg        else
21360760f5d2Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
21370760f5d2Smrg        fi])
21380760f5d2Smrgfi])
2139cc4920e5Smrg
21400760f5d2Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
21410760f5d2Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
21420760f5d2Smrgdnl 	HAVE_DOT = @HAVE_DOT@
21430760f5d2SmrgHAVE_DOT=no
21440760f5d2Smrgif test "x$have_doxygen" = "xyes"; then
21450760f5d2Smrg  AC_PATH_PROG([DOT], [dot])
21460760f5d2Smrg    if test "x$DOT" != "x"; then
21470760f5d2Smrg      HAVE_DOT=yes
21480760f5d2Smrg    fi
21490760f5d2Smrgfi
2150cc4920e5Smrg
21510760f5d2SmrgAC_SUBST([HAVE_DOT])
21520760f5d2SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
21530760f5d2SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
21540760f5d2Smrg]) # XORG_WITH_DOXYGEN
2155cc4920e5Smrg
21560760f5d2Smrg# XORG_WITH_GROFF([DEFAULT])
21570760f5d2Smrg# ----------------
21580760f5d2Smrg# Minimum version: 1.6.0
21590760f5d2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2160af9a7ee5Smrg#
21610760f5d2Smrg# Documentation tools are not always available on all platforms and sometimes
21620760f5d2Smrg# not at the appropriate level. This macro enables a module to test for the
21630760f5d2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
216405789e77Smrg# the --with-groff option, it allows maximum flexibility in making decisions
21650760f5d2Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
21660760f5d2Smrg# --with-groff assumes 'auto'.
21670760f5d2Smrg#
21680760f5d2Smrg# Interface to module:
21690760f5d2Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
21700760f5d2Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
21710760f5d2Smrg# HAVE_GROFF_MS: the -ms macros package
21720760f5d2Smrg# GROFF:	 returns the path of the groff program found
21730760f5d2Smrg#		 returns the path set by the user in the environment
21740760f5d2Smrg# --with-groff:	 'yes' user instructs the module to use groff
21750760f5d2Smrg#		 'no' user instructs the module not to use groff
21760760f5d2Smrg#
21770760f5d2Smrg# Added in version 1.9.0:
21780760f5d2Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
21790760f5d2Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
21800760f5d2Smrg#		   psselect from the psutils package.
21810760f5d2Smrg#		   the ghostcript package. Refer to the grohtml man pages
21820760f5d2Smrg#
21830760f5d2Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
21840760f5d2Smrg#
21850760f5d2Smrg# OS and distros often splits groff in a basic and full package, the former
21860760f5d2Smrg# having the groff program and the later having devices, fonts and macros
21870760f5d2Smrg# Checking for the groff executable is not enough.
21880760f5d2Smrg#
21890760f5d2Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
21900760f5d2Smrg# unset HAVE_GROFF or GROFF env variables.
21910760f5d2Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
21920760f5d2Smrg#
21930760f5d2SmrgAC_DEFUN([XORG_WITH_GROFF],[
21940760f5d2SmrgAC_ARG_VAR([GROFF], [Path to groff command])
21950760f5d2Smrgm4_define([_defopt], m4_default([$1], [auto]))
21960760f5d2SmrgAC_ARG_WITH(groff,
21970760f5d2Smrg	AS_HELP_STRING([--with-groff],
21980760f5d2Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
21990760f5d2Smrg	   [use_groff=$withval], [use_groff=]_defopt)
22000760f5d2Smrgm4_undefine([_defopt])
2201cc4920e5Smrg
22020760f5d2Smrgif test "x$use_groff" = x"auto"; then
22030760f5d2Smrg   AC_PATH_PROG([GROFF], [groff])
22040760f5d2Smrg   if test "x$GROFF" = "x"; then
22050760f5d2Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
22060760f5d2Smrg	have_groff=no
22070760f5d2Smrg   else
22080760f5d2Smrg        have_groff=yes
22090760f5d2Smrg   fi
22100760f5d2Smrgelif test "x$use_groff" = x"yes" ; then
22110760f5d2Smrg   AC_PATH_PROG([GROFF], [groff])
22120760f5d2Smrg   if test "x$GROFF" = "x"; then
22130760f5d2Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
22140760f5d2Smrg   fi
22150760f5d2Smrg   have_groff=yes
22160760f5d2Smrgelif test "x$use_groff" = x"no" ; then
22170760f5d2Smrg   if test "x$GROFF" != "x"; then
22180760f5d2Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
22190760f5d2Smrg   fi
22200760f5d2Smrg   have_groff=no
22210760f5d2Smrgelse
22220760f5d2Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
22230760f5d2Smrgfi
2224cc4920e5Smrg
22250760f5d2Smrg# We have groff, test for the presence of the macro packages
22260760f5d2Smrgif test "x$have_groff" = x"yes"; then
22270760f5d2Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
22280760f5d2Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
22290760f5d2Smrg        groff_ms_works=yes
22300760f5d2Smrg    else
22310760f5d2Smrg        groff_ms_works=no
2232cc4920e5Smrg    fi
22330760f5d2Smrg    AC_MSG_RESULT([$groff_ms_works])
22340760f5d2Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
22350760f5d2Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
22360760f5d2Smrg        groff_mm_works=yes
22370760f5d2Smrg    else
22380760f5d2Smrg        groff_mm_works=no
22390760f5d2Smrg    fi
22400760f5d2Smrg    AC_MSG_RESULT([$groff_mm_works])
22410760f5d2Smrgfi
2242cc4920e5Smrg
22430760f5d2Smrg# We have groff, test for HTML dependencies, one command per package
22440760f5d2Smrgif test "x$have_groff" = x"yes"; then
22450760f5d2Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
22460760f5d2Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
22470760f5d2Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
22480760f5d2Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
22490760f5d2Smrg      have_groff_html=yes
22500760f5d2Smrg   else
22510760f5d2Smrg      have_groff_html=no
22520760f5d2Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
22530760f5d2Smrg   fi
22540760f5d2Smrgfi
22550760f5d2Smrg
22560760f5d2Smrg# Set Automake conditionals for Makefiles
22570760f5d2SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
22580760f5d2SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
22590760f5d2SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
22600760f5d2SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
22610760f5d2Smrg]) # XORG_WITH_GROFF
22620760f5d2Smrg
22630760f5d2Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
22640760f5d2Smrg# ---------------------------------------
22650760f5d2Smrg# Minimum version: 1.6.0
22660760f5d2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
22670760f5d2Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
22680760f5d2Smrg#
22690760f5d2Smrg# Documentation tools are not always available on all platforms and sometimes
22700760f5d2Smrg# not at the appropriate level. This macro enables a module to test for the
22710760f5d2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
227205789e77Smrg# the --with-fop option, it allows maximum flexibility in making decisions
22730760f5d2Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
22740760f5d2Smrg# --with-fop assumes 'auto'.
22750760f5d2Smrg#
22760760f5d2Smrg# Interface to module:
22770760f5d2Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
22780760f5d2Smrg# FOP:	 	returns the path of the fop program found
22790760f5d2Smrg#		returns the path set by the user in the environment
22800760f5d2Smrg# --with-fop: 	'yes' user instructs the module to use fop
22810760f5d2Smrg#		'no' user instructs the module not to use fop
22820760f5d2Smrg#
22830760f5d2Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
22840760f5d2Smrg#
22850760f5d2SmrgAC_DEFUN([XORG_WITH_FOP],[
22860760f5d2SmrgAC_ARG_VAR([FOP], [Path to fop command])
22870760f5d2Smrgm4_define([_defopt], m4_default([$2], [auto]))
22880760f5d2SmrgAC_ARG_WITH(fop,
22890760f5d2Smrg	AS_HELP_STRING([--with-fop],
22900760f5d2Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
22910760f5d2Smrg	   [use_fop=$withval], [use_fop=]_defopt)
22920760f5d2Smrgm4_undefine([_defopt])
22930760f5d2Smrg
22940760f5d2Smrgif test "x$use_fop" = x"auto"; then
22950760f5d2Smrg   AC_PATH_PROG([FOP], [fop])
22960760f5d2Smrg   if test "x$FOP" = "x"; then
22970760f5d2Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
22980760f5d2Smrg	have_fop=no
22990760f5d2Smrg   else
23000760f5d2Smrg        have_fop=yes
23010760f5d2Smrg   fi
23020760f5d2Smrgelif test "x$use_fop" = x"yes" ; then
23030760f5d2Smrg   AC_PATH_PROG([FOP], [fop])
23040760f5d2Smrg   if test "x$FOP" = "x"; then
23050760f5d2Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
23060760f5d2Smrg   fi
23070760f5d2Smrg   have_fop=yes
23080760f5d2Smrgelif test "x$use_fop" = x"no" ; then
23090760f5d2Smrg   if test "x$FOP" != "x"; then
23100760f5d2Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
23110760f5d2Smrg   fi
23120760f5d2Smrg   have_fop=no
2313af9a7ee5Smrgelse
23140760f5d2Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2315af9a7ee5Smrgfi
2316b9b4fd27Smrg
23170760f5d2Smrg# Test for a minimum version of fop, if provided.
23180760f5d2Smrgm4_ifval([$1],
23190760f5d2Smrg[if test "$have_fop" = yes; then
23200760f5d2Smrg    # scrape the fop version
23210760f5d2Smrg    AC_MSG_CHECKING([for fop minimum version])
23220760f5d2Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
23230760f5d2Smrg    AC_MSG_RESULT([$fop_version])
23240760f5d2Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
23250760f5d2Smrg        [if test "x$use_fop" = xauto; then
23260760f5d2Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
23270760f5d2Smrg            have_fop=no
23280760f5d2Smrg        else
23290760f5d2Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
23300760f5d2Smrg        fi])
23310760f5d2Smrgfi])
23320760f5d2SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
23330760f5d2Smrg]) # XORG_WITH_FOP
23340760f5d2Smrg
23350760f5d2Smrg# XORG_WITH_M4([MIN-VERSION])
23360760f5d2Smrg# ---------------------------
23370760f5d2Smrg# Minimum version: 1.19.0
23380760f5d2Smrg#
23390760f5d2Smrg# This macro attempts to locate an m4 macro processor which supports
23400760f5d2Smrg# -I option and is only useful for modules relying on M4 in order to
23410760f5d2Smrg# expand macros in source code files.
23420760f5d2Smrg#
23430760f5d2Smrg# Interface to module:
23440760f5d2Smrg# M4:	 	returns the path of the m4 program found
23450760f5d2Smrg#		returns the path set by the user in the environment
23460760f5d2Smrg#
23470760f5d2SmrgAC_DEFUN([XORG_WITH_M4], [
23480760f5d2SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
23490760f5d2Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
23500760f5d2Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
23510760f5d2Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
23520760f5d2Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
23530760f5d2Smrg   [$PATH:/usr/gnu/bin])])
2354caade7ccSmrg
23550760f5d2SmrgAC_SUBST([M4], [$ac_cv_path_M4])
23560760f5d2Smrg]) # XORG_WITH_M4
2357caade7ccSmrg
23580760f5d2Smrg# XORG_WITH_PS2PDF([DEFAULT])
23590760f5d2Smrg# ----------------
23600760f5d2Smrg# Minimum version: 1.6.0
23610760f5d2Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23620760f5d2Smrg#
23630760f5d2Smrg# Documentation tools are not always available on all platforms and sometimes
23640760f5d2Smrg# not at the appropriate level. This macro enables a module to test for the
23650760f5d2Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
236605789e77Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
23670760f5d2Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
23680760f5d2Smrg# --with-ps2pdf assumes 'auto'.
23690760f5d2Smrg#
23700760f5d2Smrg# Interface to module:
23710760f5d2Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
23720760f5d2Smrg# PS2PDF:	returns the path of the ps2pdf program found
23730760f5d2Smrg#		returns the path set by the user in the environment
23740760f5d2Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
23750760f5d2Smrg#		 'no' user instructs the module not to use ps2pdf
23760760f5d2Smrg#
23770760f5d2Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
23780760f5d2Smrg#
23790760f5d2SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
23800760f5d2SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
23810760f5d2Smrgm4_define([_defopt], m4_default([$1], [auto]))
23820760f5d2SmrgAC_ARG_WITH(ps2pdf,
23830760f5d2Smrg	AS_HELP_STRING([--with-ps2pdf],
23840760f5d2Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
23850760f5d2Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
23860760f5d2Smrgm4_undefine([_defopt])
2387caade7ccSmrg
23880760f5d2Smrgif test "x$use_ps2pdf" = x"auto"; then
23890760f5d2Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23900760f5d2Smrg   if test "x$PS2PDF" = "x"; then
23910760f5d2Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
23920760f5d2Smrg	have_ps2pdf=no
23930760f5d2Smrg   else
23940760f5d2Smrg        have_ps2pdf=yes
23950760f5d2Smrg   fi
23960760f5d2Smrgelif test "x$use_ps2pdf" = x"yes" ; then
23970760f5d2Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
23980760f5d2Smrg   if test "x$PS2PDF" = "x"; then
23990760f5d2Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
24000760f5d2Smrg   fi
24010760f5d2Smrg   have_ps2pdf=yes
24020760f5d2Smrgelif test "x$use_ps2pdf" = x"no" ; then
24030760f5d2Smrg   if test "x$PS2PDF" != "x"; then
24040760f5d2Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
24050760f5d2Smrg   fi
24060760f5d2Smrg   have_ps2pdf=no
24070760f5d2Smrgelse
24080760f5d2Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2409af9a7ee5Smrgfi
24100760f5d2SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
24110760f5d2Smrg]) # XORG_WITH_PS2PDF
2412b9b4fd27Smrg
24130760f5d2Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
24140760f5d2Smrg# ----------------
24150760f5d2Smrg# Minimum version: 1.6.0
2416af9a7ee5Smrg#
24170760f5d2Smrg# Documentation tools are not always available on all platforms and sometimes
24180760f5d2Smrg# not at the appropriate level. This macro enables a builder to skip all
24190760f5d2Smrg# documentation targets except traditional man pages.
24200760f5d2Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
242105789e77Smrg# maximum flexibility in controlling documentation building.
24220760f5d2Smrg# Refer to:
24230760f5d2Smrg# XORG_WITH_XMLTO         --with-xmlto
24240760f5d2Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24250760f5d2Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24260760f5d2Smrg# XORG_WITH_FOP           --with-fop
24270760f5d2Smrg# XORG_WITH_GROFF         --with-groff
24280760f5d2Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24290760f5d2Smrg#
24300760f5d2Smrg# Interface to module:
24310760f5d2Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
24320760f5d2Smrg# --enable-docs: 'yes' user instructs the module to generate docs
24330760f5d2Smrg#		 'no' user instructs the module not to generate docs
24340760f5d2Smrg# parm1:	specify the default value, yes or no.
24350760f5d2Smrg#
24360760f5d2SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
24370760f5d2Smrgm4_define([docs_default], m4_default([$1], [yes]))
24380760f5d2SmrgAC_ARG_ENABLE(docs,
24390760f5d2Smrg	AS_HELP_STRING([--enable-docs],
24400760f5d2Smrg	   [Enable building the documentation (default: ]docs_default[)]),
24410760f5d2Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
24420760f5d2Smrgm4_undefine([docs_default])
24430760f5d2SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
24440760f5d2SmrgAC_MSG_CHECKING([whether to build documentation])
24450760f5d2SmrgAC_MSG_RESULT([$build_docs])
24460760f5d2Smrg]) # XORG_ENABLE_DOCS
2447cc4920e5Smrg
24480760f5d2Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
24490760f5d2Smrg# ----------------
24500760f5d2Smrg# Minimum version: 1.6.0
24510760f5d2Smrg#
24520760f5d2Smrg# This macro enables a builder to skip all developer documentation.
24530760f5d2Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
245405789e77Smrg# maximum flexibility in controlling documentation building.
24550760f5d2Smrg# Refer to:
24560760f5d2Smrg# XORG_WITH_XMLTO         --with-xmlto
24570760f5d2Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24580760f5d2Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24590760f5d2Smrg# XORG_WITH_FOP           --with-fop
24600760f5d2Smrg# XORG_WITH_GROFF         --with-groff
24610760f5d2Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24620760f5d2Smrg#
24630760f5d2Smrg# Interface to module:
24640760f5d2Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
24650760f5d2Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
24660760f5d2Smrg#			'no' user instructs the module not to generate developer docs
24670760f5d2Smrg# parm1:		specify the default value, yes or no.
24680760f5d2Smrg#
24690760f5d2SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
24700760f5d2Smrgm4_define([devel_default], m4_default([$1], [yes]))
24710760f5d2SmrgAC_ARG_ENABLE(devel-docs,
24720760f5d2Smrg	AS_HELP_STRING([--enable-devel-docs],
24730760f5d2Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
24740760f5d2Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
24750760f5d2Smrgm4_undefine([devel_default])
24760760f5d2SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
24770760f5d2SmrgAC_MSG_CHECKING([whether to build developer documentation])
24780760f5d2SmrgAC_MSG_RESULT([$build_devel_docs])
24790760f5d2Smrg]) # XORG_ENABLE_DEVEL_DOCS
2480cc4920e5Smrg
24810760f5d2Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
24820760f5d2Smrg# ----------------
24830760f5d2Smrg# Minimum version: 1.6.0
24840760f5d2Smrg#
24850760f5d2Smrg# This macro enables a builder to skip all functional specification targets.
24860760f5d2Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
248705789e77Smrg# maximum flexibility in controlling documentation building.
24880760f5d2Smrg# Refer to:
24890760f5d2Smrg# XORG_WITH_XMLTO         --with-xmlto
24900760f5d2Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
24910760f5d2Smrg# XORG_WITH_DOXYGEN       --with-doxygen
24920760f5d2Smrg# XORG_WITH_FOP           --with-fop
24930760f5d2Smrg# XORG_WITH_GROFF         --with-groff
24940760f5d2Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
24950760f5d2Smrg#
24960760f5d2Smrg# Interface to module:
24970760f5d2Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
24980760f5d2Smrg# --enable-specs:	'yes' user instructs the module to generate specs
24990760f5d2Smrg#			'no' user instructs the module not to generate specs
25000760f5d2Smrg# parm1:		specify the default value, yes or no.
25010760f5d2Smrg#
25020760f5d2SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
25030760f5d2Smrgm4_define([spec_default], m4_default([$1], [yes]))
25040760f5d2SmrgAC_ARG_ENABLE(specs,
25050760f5d2Smrg	AS_HELP_STRING([--enable-specs],
25060760f5d2Smrg	   [Enable building the specs (default: ]spec_default[)]),
25070760f5d2Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
25080760f5d2Smrgm4_undefine([spec_default])
25090760f5d2SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
25100760f5d2SmrgAC_MSG_CHECKING([whether to build functional specifications])
25110760f5d2SmrgAC_MSG_RESULT([$build_specs])
25120760f5d2Smrg]) # XORG_ENABLE_SPECS
2513cc4920e5Smrg
25140760f5d2Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
25150760f5d2Smrg# ----------------------------------------------
25160760f5d2Smrg# Minimum version: 1.13.0
2517cc4920e5Smrg#
25180760f5d2Smrg# This macro enables a builder to enable/disable unit testing
25190760f5d2Smrg# It makes no assumption about the test cases implementation
25200760f5d2Smrg# Test cases may or may not use Automake "Support for test suites"
25210760f5d2Smrg# They may or may not use the software utility library GLib
25220760f5d2Smrg#
25230760f5d2Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
25240760f5d2Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
25250760f5d2Smrg# The variable enable_unit_tests is used by other macros in this file.
25260760f5d2Smrg#
25270760f5d2Smrg# Interface to module:
25280760f5d2Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
25290760f5d2Smrg# enable_unit_tests:    used in configure.ac for additional configuration
25300760f5d2Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
25310760f5d2Smrg#			'no' user instructs the module not to build tests
25320760f5d2Smrg# parm1:		specify the default value, yes or no.
25330760f5d2Smrg#
25340760f5d2SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
25350760f5d2SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
25360760f5d2SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
25370760f5d2SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25380760f5d2Smrgm4_define([_defopt], m4_default([$1], [auto]))
25390760f5d2SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
25400760f5d2Smrg	[Enable building unit test cases (default: ]_defopt[)]),
25410760f5d2Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
25420760f5d2Smrgm4_undefine([_defopt])
25430760f5d2SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
25440760f5d2SmrgAC_MSG_CHECKING([whether to build unit test cases])
25450760f5d2SmrgAC_MSG_RESULT([$enable_unit_tests])
25460760f5d2Smrg]) # XORG_ENABLE_UNIT_TESTS
2547cc4920e5Smrg
25480760f5d2Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
25490760f5d2Smrg# ------------------------------------------------------
25500760f5d2Smrg# Minimum version: 1.17.0
25510760f5d2Smrg#
25520760f5d2Smrg# This macro enables a builder to enable/disable integration testing
25530760f5d2Smrg# It makes no assumption about the test cases' implementation
25540760f5d2Smrg# Test cases may or may not use Automake "Support for test suites"
25550760f5d2Smrg#
25560760f5d2Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
25570760f5d2Smrg# usually requires less dependencies and may be built and run under less
25580760f5d2Smrg# stringent environments than integration tests.
25590760f5d2Smrg#
25600760f5d2Smrg# Interface to module:
25610760f5d2Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
25620760f5d2Smrg# enable_integration_tests:   used in configure.ac for additional configuration
25630760f5d2Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
25640760f5d2Smrg#                             'no' user instructs the module not to build tests
25650760f5d2Smrg# parm1:                      specify the default value, yes or no.
25660760f5d2Smrg#
25670760f5d2SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
25680760f5d2SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
25690760f5d2Smrgm4_define([_defopt], m4_default([$1], [auto]))
25700760f5d2SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
25710760f5d2Smrg	[Enable building integration test cases (default: ]_defopt[)]),
25720760f5d2Smrg	[enable_integration_tests=$enableval],
25730760f5d2Smrg	[enable_integration_tests=]_defopt)
25740760f5d2Smrgm4_undefine([_defopt])
25750760f5d2SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
25760760f5d2Smrg	[test "x$enable_integration_tests" != xno])
25770760f5d2SmrgAC_MSG_CHECKING([whether to build unit test cases])
25780760f5d2SmrgAC_MSG_RESULT([$enable_integration_tests])
25790760f5d2Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2580cc4920e5Smrg
25810760f5d2Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
25820760f5d2Smrg# ----------------------------------------
25830760f5d2Smrg# Minimum version: 1.13.0
25840760f5d2Smrg#
25850760f5d2Smrg# GLib is a library which provides advanced data structures and functions.
25860760f5d2Smrg# This macro enables a module to test for the presence of Glib.
25870760f5d2Smrg#
25880760f5d2Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
25890760f5d2Smrg# Otherwise the value of $enable_unit_tests is blank.
25900760f5d2Smrg#
25910760f5d2Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
25920760f5d2Smrg# test support usually requires less dependencies and may be built and run under
25930760f5d2Smrg# less stringent environments than integration tests.
2594cc4920e5Smrg#
25950760f5d2Smrg# Interface to module:
25960760f5d2Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
25970760f5d2Smrg# with_glib: used in configure.ac to know if GLib has been found
25980760f5d2Smrg# --with-glib:	'yes' user instructs the module to use glib
25990760f5d2Smrg#		'no' user instructs the module not to use glib
26000760f5d2Smrg#
26010760f5d2SmrgAC_DEFUN([XORG_WITH_GLIB],[
26020760f5d2SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
26030760f5d2Smrgm4_define([_defopt], m4_default([$2], [auto]))
26040760f5d2SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
26050760f5d2Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
26060760f5d2Smrg	[with_glib=$withval], [with_glib=]_defopt)
26070760f5d2Smrgm4_undefine([_defopt])
2608cc4920e5Smrg
26090760f5d2Smrghave_glib=no
26100760f5d2Smrg# Do not probe GLib if user explicitly disabled unit testing
26110760f5d2Smrgif test "x$enable_unit_tests" != x"no"; then
26120760f5d2Smrg  # Do not probe GLib if user explicitly disabled it
26130760f5d2Smrg  if test "x$with_glib" != x"no"; then
26140760f5d2Smrg    m4_ifval(
26150760f5d2Smrg      [$1],
26160760f5d2Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
26170760f5d2Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
26180760f5d2Smrg    )
2619cc4920e5Smrg  fi
2620af9a7ee5Smrgfi
2621af9a7ee5Smrg
26220760f5d2Smrg# Not having GLib when unit testing has been explicitly requested is an error
26230760f5d2Smrgif test "x$enable_unit_tests" = x"yes"; then
26240760f5d2Smrg  if test "x$have_glib" = x"no"; then
26250760f5d2Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2626cc4920e5Smrg  fi
2627af9a7ee5Smrgfi
2628b9b4fd27Smrg
26290760f5d2Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
26300760f5d2Smrgif test "x$enable_unit_tests" = x"no"; then
26310760f5d2Smrg  if test "x$with_glib" = x"yes"; then
26320760f5d2Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
26330760f5d2Smrg  fi
26340760f5d2Smrgfi
2635b9b4fd27Smrg
26360760f5d2Smrg# Not having GLib when it has been explicitly requested is an error
26370760f5d2Smrgif test "x$with_glib" = x"yes"; then
26380760f5d2Smrg  if test "x$have_glib" = x"no"; then
26390760f5d2Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
26400760f5d2Smrg  fi
26410760f5d2Smrgfi
2642b9b4fd27Smrg
26430760f5d2SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
26440760f5d2Smrg]) # XORG_WITH_GLIB
2645cc4920e5Smrg
26460760f5d2Smrg# XORG_LD_WRAP([required|optional])
26470760f5d2Smrg# ---------------------------------
26480760f5d2Smrg# Minimum version: 1.13.0
26490760f5d2Smrg#
26500760f5d2Smrg# Check if linker supports -wrap, passed via compiler flags
26510760f5d2Smrg#
26520760f5d2Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
26530760f5d2Smrg# Otherwise the value of $enable_unit_tests is blank.
26540760f5d2Smrg#
26550760f5d2Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
26560760f5d2Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
26570760f5d2Smrg# available, an argument of "optional" allows use when some unit tests require
26580760f5d2Smrg# ld -wrap and others do not.
26590760f5d2Smrg#
26600760f5d2SmrgAC_DEFUN([XORG_LD_WRAP],[
26610760f5d2SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
26620760f5d2Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
26630760f5d2Smrg                      void __wrap_exit(int status) { return; }],
26640760f5d2Smrg                     [exit(0);])])
26650760f5d2Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
26660760f5d2Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
26670760f5d2Smrg  if test "x$have_ld_wrap" = x"no"; then
26680760f5d2Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
26690760f5d2Smrg  fi
26700760f5d2Smrgfi
26710760f5d2SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
26720760f5d2Smrg#
26730760f5d2Smrg]) # XORG_LD_WRAP
2674cc4920e5Smrg
26750760f5d2Smrg# XORG_CHECK_LINKER_FLAGS
26760760f5d2Smrg# -----------------------
26770760f5d2Smrg# SYNOPSIS
26780760f5d2Smrg#
26790760f5d2Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
26800760f5d2Smrg#
26810760f5d2Smrg# DESCRIPTION
26820760f5d2Smrg#
26830760f5d2Smrg#   Check whether the given linker FLAGS work with the current language's
26840760f5d2Smrg#   linker, or whether they give an error.
26850760f5d2Smrg#
26860760f5d2Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
26870760f5d2Smrg#   success/failure.
26880760f5d2Smrg#
26890760f5d2Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
26900760f5d2Smrg#
26910760f5d2Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
26920760f5d2Smrg#
26930760f5d2Smrg# LICENSE
26940760f5d2Smrg#
26950760f5d2Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
26960760f5d2Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
26970760f5d2Smrg#   Copyright (c) 2009 Matteo Frigo
26980760f5d2Smrg#
26990760f5d2Smrg#   This program is free software: you can redistribute it and/or modify it
27000760f5d2Smrg#   under the terms of the GNU General Public License as published by the
27010760f5d2Smrg#   Free Software Foundation, either version 3 of the License, or (at your
27020760f5d2Smrg#   option) any later version.
27030760f5d2Smrg#
27040760f5d2Smrg#   This program is distributed in the hope that it will be useful, but
27050760f5d2Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
27060760f5d2Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27070760f5d2Smrg#   Public License for more details.
27080760f5d2Smrg#
27090760f5d2Smrg#   You should have received a copy of the GNU General Public License along
27100760f5d2Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
27110760f5d2Smrg#
27120760f5d2Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
27130760f5d2Smrg#   gives unlimited permission to copy, distribute and modify the configure
27140760f5d2Smrg#   scripts that are the output of Autoconf when processing the Macro. You
27150760f5d2Smrg#   need not follow the terms of the GNU General Public License when using
27160760f5d2Smrg#   or distributing such scripts, even though portions of the text of the
27170760f5d2Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
27180760f5d2Smrg#   all other use of the material that constitutes the Autoconf Macro.
27190760f5d2Smrg#
27200760f5d2Smrg#   This special exception to the GPL applies to versions of the Autoconf
27210760f5d2Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
27220760f5d2Smrg#   modified version of the Autoconf Macro, you may extend this special
27230760f5d2Smrg#   exception to the GPL to apply to your modified version as well.#
27240760f5d2SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
27250760f5d2Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
27260760f5d2Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
27270760f5d2SmrgAS_LITERAL_IF([$1],
27280760f5d2Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
27290760f5d2Smrg      ax_save_FLAGS=$LDFLAGS
27300760f5d2Smrg      LDFLAGS="$1"
27310760f5d2Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
27320760f5d2Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27330760f5d2Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27340760f5d2Smrg      LDFLAGS=$ax_save_FLAGS])],
27350760f5d2Smrg  [ax_save_FLAGS=$LDFLAGS
27360760f5d2Smrg   LDFLAGS="$1"
27370760f5d2Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
27380760f5d2Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
27390760f5d2Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
27400760f5d2Smrg   LDFLAGS=$ax_save_FLAGS])
27410760f5d2Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
27420760f5d2SmrgAC_MSG_RESULT($xorg_check_linker_flags)
27430760f5d2Smrgif test "x$xorg_check_linker_flags" = xyes; then
27440760f5d2Smrg	m4_default([$2], :)
27450760f5d2Smrgelse
27460760f5d2Smrg	m4_default([$3], :)
27470760f5d2Smrgfi
27480760f5d2Smrg]) # XORG_CHECK_LINKER_FLAGS
2749b9b4fd27Smrg
27500760f5d2Smrg# XORG_MEMORY_CHECK_FLAGS
27510760f5d2Smrg# -----------------------
27520760f5d2Smrg# Minimum version: 1.16.0
27530760f5d2Smrg#
27540760f5d2Smrg# This macro attempts to find appropriate memory checking functionality
27550760f5d2Smrg# for various platforms which unit testing code may use to catch various
27560760f5d2Smrg# forms of memory allocation and access errors in testing.
27570760f5d2Smrg#
27580760f5d2Smrg# Interface to module:
27590760f5d2Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
27600760f5d2Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
27610760f5d2Smrg#
27620760f5d2Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
27630760f5d2Smrg#
27640760f5d2SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2765b9b4fd27Smrg
27660760f5d2SmrgAC_REQUIRE([AC_CANONICAL_HOST])
27670760f5d2SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
27680760f5d2Smrg           [Environment variables to enable memory checking in tests])
2769cc4920e5Smrg
27700760f5d2Smrg# Check for different types of support on different platforms
27710760f5d2Smrgcase $host_os in
27720760f5d2Smrg    solaris*)
27730760f5d2Smrg        AC_CHECK_LIB([umem], [umem_alloc],
27740760f5d2Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
27750760f5d2Smrg        ;;
27760760f5d2Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
27770760f5d2Smrg        # both directly and inverted, so should not be 0 or 255.
27780760f5d2Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
27790760f5d2Smrg        ;;
27800760f5d2Smrg    darwin*)
27810760f5d2Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
27820760f5d2Smrg        ;;
27830760f5d2Smrg    *bsd*)
27840760f5d2Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
27850760f5d2Smrg        ;;
27860760f5d2Smrgesac
2787cc4920e5Smrg
27880760f5d2Smrg# User supplied flags override default flags
27890760f5d2Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
27900760f5d2Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2791af9a7ee5Smrgfi
2792b9b4fd27Smrg
27930760f5d2SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
27940760f5d2Smrg]) # XORG_WITH_LINT
2795485f0483Smrg
27960760f5d2Smrg# XORG_CHECK_MALLOC_ZERO
27970760f5d2Smrg# ----------------------
27980760f5d2Smrg# Minimum version: 1.0.0
2799cc4920e5Smrg#
28000760f5d2Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
28010760f5d2Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
28020760f5d2Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
28030760f5d2SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
28040760f5d2SmrgAC_ARG_ENABLE(malloc0returnsnull,
28050760f5d2Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
28060760f5d2Smrg		       [malloc(0) returns NULL (default: auto)]),
28070760f5d2Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
28080760f5d2Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2809485f0483Smrg
28100760f5d2SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
28110760f5d2Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
28120760f5d2SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
28130760f5d2Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
28140760f5d2Smrg#include <stdlib.h>
28150760f5d2Smrg],[
28160760f5d2Smrg    char *m0, *r0, *c0, *p;
28170760f5d2Smrg    m0 = malloc(0);
28180760f5d2Smrg    p = malloc(10);
28190760f5d2Smrg    r0 = realloc(p,0);
28200760f5d2Smrg    c0 = calloc(0,10);
28210760f5d2Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
28220760f5d2Smrg])],
28230760f5d2Smrg		[xorg_cv_malloc0_returns_null=yes],
28240760f5d2Smrg		[xorg_cv_malloc0_returns_null=no])])
28250760f5d2SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2826af9a7ee5Smrgfi
28270760f5d2SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2828cc4920e5Smrg
28290760f5d2Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
28300760f5d2Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
28310760f5d2Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
28320760f5d2Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2833cc4920e5Smrgelse
28340760f5d2Smrg	MALLOC_ZERO_CFLAGS=""
28350760f5d2Smrg	XMALLOC_ZERO_CFLAGS=""
28360760f5d2Smrg	XTMALLOC_ZERO_CFLAGS=""
2837cc4920e5Smrgfi
2838caade7ccSmrg
28390760f5d2SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
28400760f5d2SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
28410760f5d2SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
28420760f5d2Smrg]) # XORG_CHECK_MALLOC_ZERO
2843af9a7ee5Smrg
28440760f5d2Smrg# XORG_WITH_LINT()
28450760f5d2Smrg# ----------------
28460760f5d2Smrg# Minimum version: 1.1.0
2847af9a7ee5Smrg#
28480760f5d2Smrg# This macro enables the use of a tool that flags some suspicious and
28490760f5d2Smrg# non-portable constructs (likely to be bugs) in C language source code.
28500760f5d2Smrg# It will attempt to locate the tool and use appropriate options.
28510760f5d2Smrg# There are various lint type tools on different platforms.
2852cc4920e5Smrg#
28530760f5d2Smrg# Interface to module:
28540760f5d2Smrg# LINT:		returns the path to the tool found on the platform
28550760f5d2Smrg#		or the value set to LINT on the configure cmd line
28560760f5d2Smrg#		also an Automake conditional
28570760f5d2Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
28580760f5d2Smrg#
28590760f5d2Smrg# --with-lint:	'yes' user instructs the module to use lint
28600760f5d2Smrg#		'no' user instructs the module not to use lint (default)
28610760f5d2Smrg#
28620760f5d2Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
28630760f5d2Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
28640760f5d2Smrg#
28650760f5d2SmrgAC_DEFUN([XORG_WITH_LINT],[
2866485f0483Smrg
28670760f5d2SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
28680760f5d2SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
28690760f5d2SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
28700760f5d2Smrg		[Use a lint-style source code checker (default: disabled)])],
28710760f5d2Smrg		[use_lint=$withval], [use_lint=no])
2872af9a7ee5Smrg
28730760f5d2Smrg# Obtain platform specific info like program name and options
28740760f5d2Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
28750760f5d2Smrgcase $host_os in
28760760f5d2Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
28770760f5d2Smrg	lint_name=splint
28780760f5d2Smrg	lint_options="-badflag"
28790760f5d2Smrg	;;
28800760f5d2Smrg  *freebsd* | *netbsd*)
28810760f5d2Smrg	lint_name=lint
28820760f5d2Smrg	lint_options="-u -b"
28830760f5d2Smrg	;;
28840760f5d2Smrg  *solaris*)
28850760f5d2Smrg	lint_name=lint
28860760f5d2Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
28870760f5d2Smrg	;;
28880760f5d2Smrgesac
28890760f5d2Smrg
28900760f5d2Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
28910760f5d2Smrgif test "x$use_lint" = x"yes" ; then
28920760f5d2Smrg   AC_PATH_PROG([LINT], [$lint_name])
28930760f5d2Smrg   if test "x$LINT" = "x"; then
28940760f5d2Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
28950760f5d2Smrg   fi
28960760f5d2Smrgelif test "x$use_lint" = x"no" ; then
28970760f5d2Smrg   if test "x$LINT" != "x"; then
28980760f5d2Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
28990760f5d2Smrg   fi
2900cc4920e5Smrgelse
29010760f5d2Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2902af9a7ee5Smrgfi
2903af9a7ee5Smrg
29040760f5d2Smrg# User supplied flags override default flags
29050760f5d2Smrgif test "x$LINT_FLAGS" != "x"; then
29060760f5d2Smrg   lint_options=$LINT_FLAGS
29070760f5d2Smrgfi
2908af9a7ee5Smrg
29090760f5d2SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
29100760f5d2SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2911af9a7ee5Smrg
29120760f5d2Smrg]) # XORG_WITH_LINT
2913485f0483Smrg
29140760f5d2Smrg# XORG_LINT_LIBRARY(LIBNAME)
29150760f5d2Smrg# --------------------------
29160760f5d2Smrg# Minimum version: 1.1.0
2917af9a7ee5Smrg#
29180760f5d2Smrg# Sets up flags for building lint libraries for checking programs that call
29190760f5d2Smrg# functions in the library.
29200760f5d2Smrg#
29210760f5d2Smrg# Interface to module:
29220760f5d2Smrg# LINTLIB		- Automake variable with the name of lint library file to make
29230760f5d2Smrg# MAKE_LINT_LIB		- Automake conditional
29240760f5d2Smrg#
29250760f5d2Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
29260760f5d2Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2927af9a7ee5Smrg
29280760f5d2SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
29290760f5d2SmrgAC_REQUIRE([XORG_WITH_LINT])
29300760f5d2SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
29310760f5d2Smrg	[Create lint library (default: disabled)])],
29320760f5d2Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
29330760f5d2Smrg
29340760f5d2Smrgif test "x$make_lint_lib" = x"yes" ; then
29350760f5d2Smrg   LINTLIB=llib-l$1.ln
29360760f5d2Smrg   if test "x$LINT" = "x"; then
29370760f5d2Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
29380760f5d2Smrg   fi
29390760f5d2Smrgelif test "x$make_lint_lib" != x"no" ; then
29400760f5d2Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2941af9a7ee5Smrgfi
2942cc4920e5Smrg
29430760f5d2SmrgAC_SUBST(LINTLIB)
29440760f5d2SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2945cc4920e5Smrg
29460760f5d2Smrg]) # XORG_LINT_LIBRARY
2947caade7ccSmrg
29480760f5d2Smrg# XORG_COMPILER_BRAND
2949cc4920e5Smrg# -------------------
29500760f5d2Smrg# Minimum version: 1.14.0
2951cc4920e5Smrg#
29520760f5d2Smrg# Checks for various brands of compilers and sets flags as appropriate:
29530760f5d2Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
29540760f5d2Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
29550760f5d2Smrg#   clang compiler - sets CLANGCC to "yes"
29560760f5d2Smrg#   Intel compiler - sets INTELCC to "yes"
29570760f5d2Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
29580760f5d2Smrg#
29590760f5d2SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
29600760f5d2SmrgAC_LANG_CASE(
29610760f5d2Smrg	[C], [
296205789e77Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
296305789e77Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
296405789e77Smrg		m4_version_prereq([2.70],
296505789e77Smrg			[AC_REQUIRE([AC_PROG_CC])],
296605789e77Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
29670760f5d2Smrg	],
29680760f5d2Smrg	[C++], [
29690760f5d2Smrg		AC_REQUIRE([AC_PROG_CXX])
29700760f5d2Smrg	]
29710760f5d2Smrg)
29720760f5d2SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
29730760f5d2SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
29740760f5d2SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
29750760f5d2Smrg]) # XORG_COMPILER_BRAND
2976af9a7ee5Smrg
29770760f5d2Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2978cc4920e5Smrg# ---------------
29790760f5d2Smrg# Minimum version: 1.16.0
29800760f5d2Smrg#
29810760f5d2Smrg# Test if the compiler works when passed the given flag as a command line argument.
298205789e77Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
29830760f5d2Smrg# next flag in the list until there are no more options.
29840760f5d2Smrg#
29850760f5d2Smrg# Note that this does not guarantee that the compiler supports the flag as some
29860760f5d2Smrg# compilers will simply ignore arguments that they do not understand, but we do
29870760f5d2Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
29880760f5d2Smrg# -Werror=unused-command-line-argument
29890760f5d2Smrg#
29900760f5d2SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
29910760f5d2Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
29920760f5d2Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2993af9a7ee5Smrg
29940760f5d2SmrgAC_LANG_COMPILER_REQUIRE
2995af9a7ee5Smrg
29960760f5d2SmrgAC_LANG_CASE(
29970760f5d2Smrg	[C], [
299805789e77Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
299905789e77Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
300005789e77Smrg		m4_version_prereq([2.70],
300105789e77Smrg			[AC_REQUIRE([AC_PROG_CC])],
300205789e77Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
30030760f5d2Smrg		define([PREFIX], [C])
30040760f5d2Smrg		define([CACHE_PREFIX], [cc])
30050760f5d2Smrg		define([COMPILER], [$CC])
30060760f5d2Smrg	],
30070760f5d2Smrg	[C++], [
30080760f5d2Smrg		define([PREFIX], [CXX])
30090760f5d2Smrg		define([CACHE_PREFIX], [cxx])
30100760f5d2Smrg		define([COMPILER], [$CXX])
30110760f5d2Smrg	]
30120760f5d2Smrg)
30130760f5d2Smrg
30140760f5d2Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
30150760f5d2Smrg
30160760f5d2Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
30170760f5d2Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30180760f5d2Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
30190760f5d2Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
30200760f5d2Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30210760f5d2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
30220760f5d2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
30230760f5d2Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
30240760f5d2Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3025cc4920e5Smrgfi
30260760f5d2Smrg
30270760f5d2Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
30280760f5d2Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
30290760f5d2Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30300760f5d2Smrg	fi
30310760f5d2Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30320760f5d2Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
30330760f5d2Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
30340760f5d2Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
30350760f5d2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
30360760f5d2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
30370760f5d2Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
30380760f5d2Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30390760f5d2Smrgfi
30400760f5d2Smrg
30410760f5d2Smrgfound="no"
30420760f5d2Smrgm4_foreach([flag], m4_cdr($@), [
30430760f5d2Smrg	if test $found = "no" ; then
30440760f5d2Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
30450760f5d2Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
30460760f5d2Smrg		fi
30470760f5d2Smrg
30480760f5d2Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
30490760f5d2Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
30500760f5d2Smrg		fi
30510760f5d2Smrg
30520760f5d2Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
30530760f5d2Smrg
30540760f5d2Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
30550760f5d2Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
30560760f5d2Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
30570760f5d2Smrg		AC_CACHE_VAL($cacheid,
30580760f5d2Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
30590760f5d2Smrg					     [eval $cacheid=yes],
30600760f5d2Smrg					     [eval $cacheid=no])])
30610760f5d2Smrg
30620760f5d2Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
30630760f5d2Smrg
30640760f5d2Smrg		eval supported=\$$cacheid
30650760f5d2Smrg		AC_MSG_RESULT([$supported])
30660760f5d2Smrg		if test "$supported" = "yes" ; then
30670760f5d2Smrg			$1="$$1 ]flag["
30680760f5d2Smrg			found="yes"
30690760f5d2Smrg		fi
30700760f5d2Smrg	fi
3071cc4920e5Smrg])
30720760f5d2Smrg]) # XORG_TESTSET_CFLAG
3073b9b4fd27Smrg
30740760f5d2Smrg# XORG_COMPILER_FLAGS
30750760f5d2Smrg# ---------------
30760760f5d2Smrg# Minimum version: 1.16.0
3077b9b4fd27Smrg#
30780760f5d2Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
30790760f5d2Smrg# arguments supported by the selected compiler which do NOT alter the generated
30800760f5d2Smrg# code.  These arguments will cause the compiler to print various warnings
30810760f5d2Smrg# during compilation AND turn a conservative set of warnings into errors.
30820760f5d2Smrg#
30830760f5d2Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
30840760f5d2Smrg# future versions of util-macros as options are added to new compilers.
30850760f5d2Smrg#
30860760f5d2SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
30870760f5d2SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3088b9b4fd27Smrg
30890760f5d2SmrgAC_ARG_ENABLE(selective-werror,
30900760f5d2Smrg              AS_HELP_STRING([--disable-selective-werror],
30910760f5d2Smrg                             [Turn off selective compiler errors. (default: enabled)]),
30920760f5d2Smrg              [SELECTIVE_WERROR=$enableval],
30930760f5d2Smrg              [SELECTIVE_WERROR=yes])
30940760f5d2Smrg
30950760f5d2SmrgAC_LANG_CASE(
30960760f5d2Smrg        [C], [
30970760f5d2Smrg                define([PREFIX], [C])
30980760f5d2Smrg        ],
30990760f5d2Smrg        [C++], [
31000760f5d2Smrg                define([PREFIX], [CXX])
31010760f5d2Smrg        ]
31020760f5d2Smrg)
31030760f5d2Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
31040760f5d2Smrgif test "x$SUNCC" = "xyes"; then
31050760f5d2Smrg    [BASE_]PREFIX[FLAGS]="-v"
3106cc4920e5Smrgelse
31070760f5d2Smrg    [BASE_]PREFIX[FLAGS]=""
3108cc4920e5Smrgfi
3109cc4920e5Smrg
31100760f5d2Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
31110760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
31120760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
31130760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
31140760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3115cc4920e5Smrg
31160760f5d2SmrgAC_LANG_CASE(
31170760f5d2Smrg	[C], [
31180760f5d2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
31190760f5d2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
31200760f5d2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
31210760f5d2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
31220760f5d2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
31230760f5d2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
31240760f5d2Smrg	]
31250760f5d2Smrg)
3126b9b4fd27Smrg
31270760f5d2Smrg# This chunk adds additional warnings that could catch undesired effects.
31280760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
31290760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
31300760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
31310760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
31320760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
31330760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
31340760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3135af9a7ee5Smrg
31360760f5d2Smrg# These are currently disabled because they are noisy.  They will be enabled
31370760f5d2Smrg# in the future once the codebase is sufficiently modernized to silence
31380760f5d2Smrg# them.  For now, I don't want them to drown out the other warnings.
31390760f5d2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
31400760f5d2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
31410760f5d2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3142af9a7ee5Smrg
314305789e77Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
31440760f5d2Smrg# when there are problems that should be fixed.
3145af9a7ee5Smrg
31460760f5d2Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
31470760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
31480760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
31490760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
31500760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
31510760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
31520760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
31530760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
31540760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
31550760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
31560760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
31570760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
31580760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
31590760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
31600760f5d2Smrgelse
31610760f5d2SmrgAC_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])
31620760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
31630760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
31640760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
31650760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
31660760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
31670760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
31680760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
31690760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
31700760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
31710760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
31720760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
31730760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
31740760f5d2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
31750760f5d2Smrgfi
3176af9a7ee5Smrg
31770760f5d2SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31780760f5d2Smrg]) # XORG_COMPILER_FLAGS
3179af9a7ee5Smrg
31800760f5d2Smrg# XORG_CWARNFLAGS
31810760f5d2Smrg# ---------------
31820760f5d2Smrg# Minimum version: 1.2.0
31830760f5d2Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3184b9b4fd27Smrg#
31850760f5d2Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3186b9b4fd27Smrg#
31870760f5d2Smrg# This function is deprecated because it defines -fno-strict-aliasing
31880760f5d2Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
31890760f5d2Smrg# is needed, then it should be added explicitly in the module when
31900760f5d2Smrg# it is updated to use BASE_CFLAGS.
3191b9b4fd27Smrg#
31920760f5d2SmrgAC_DEFUN([XORG_CWARNFLAGS], [
31930760f5d2SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
31940760f5d2SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
31950760f5d2SmrgAC_LANG_CASE(
31960760f5d2Smrg	[C], [
31970760f5d2Smrg		CWARNFLAGS="$BASE_CFLAGS"
31980760f5d2Smrg		if  test "x$GCC" = xyes ; then
31990760f5d2Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
32000760f5d2Smrg		fi
32010760f5d2Smrg		AC_SUBST(CWARNFLAGS)
32020760f5d2Smrg	]
32030760f5d2Smrg)
32040760f5d2Smrg]) # XORG_CWARNFLAGS
3205e5383a99Smrg
32060760f5d2Smrg# XORG_STRICT_OPTION
32070760f5d2Smrg# -----------------------
32080760f5d2Smrg# Minimum version: 1.3.0
32090760f5d2Smrg#
32100760f5d2Smrg# Add configure option to enable strict compilation flags, such as treating
32110760f5d2Smrg# warnings as fatal errors.
32120760f5d2Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
32130760f5d2Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
32140760f5d2Smrg#
32150760f5d2Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
32160760f5d2Smrg# when strict compilation is unconditionally desired.
32170760f5d2SmrgAC_DEFUN([XORG_STRICT_OPTION], [
32180760f5d2SmrgAC_REQUIRE([XORG_CWARNFLAGS])
32190760f5d2SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3220b9b4fd27Smrg
32210760f5d2SmrgAC_ARG_ENABLE(strict-compilation,
32220760f5d2Smrg			  AS_HELP_STRING([--enable-strict-compilation],
32230760f5d2Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
32240760f5d2Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3225cc4920e5Smrg
32260760f5d2SmrgAC_LANG_CASE(
32270760f5d2Smrg        [C], [
32280760f5d2Smrg                define([PREFIX], [C])
32290760f5d2Smrg        ],
32300760f5d2Smrg        [C++], [
32310760f5d2Smrg                define([PREFIX], [CXX])
32320760f5d2Smrg        ]
32330760f5d2Smrg)
3234cc4920e5Smrg
32350760f5d2Smrg[STRICT_]PREFIX[FLAGS]=""
32360760f5d2SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
32370760f5d2SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3238cc4920e5Smrg
32390760f5d2Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
32400760f5d2Smrg# activate it with -Werror, so we add it here explicitly.
32410760f5d2SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3242cc4920e5Smrg
32430760f5d2Smrgif test "x$STRICT_COMPILE" = "xyes"; then
32440760f5d2Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
32450760f5d2Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
32460760f5d2Smrgfi
32470760f5d2SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
32480760f5d2SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
32490760f5d2SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
32500760f5d2Smrg]) # XORG_STRICT_OPTION
3251cc4920e5Smrg
325205789e77Smrg# XORG_DEFAULT_NOCODE_OPTIONS
325305789e77Smrg# ---------------------------
325405789e77Smrg# Minimum version: 1.20.0
325505789e77Smrg#
325605789e77Smrg# Defines default options for X.Org modules which don't compile code,
325705789e77Smrg# such as fonts, bitmaps, cursors, and docs.
325805789e77Smrg#
325905789e77SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
326005789e77SmrgAC_REQUIRE([AC_PROG_INSTALL])
326105789e77SmrgXORG_RELEASE_VERSION
326205789e77SmrgXORG_CHANGELOG
326305789e77SmrgXORG_INSTALL
326405789e77SmrgXORG_MANPAGE_SECTIONS
326505789e77Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
326605789e77Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
326705789e77Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
326805789e77Smrg
32690760f5d2Smrg# XORG_DEFAULT_OPTIONS
32700760f5d2Smrg# --------------------
32710760f5d2Smrg# Minimum version: 1.3.0
32720760f5d2Smrg#
327305789e77Smrg# Defines default options for X.Org modules which compile code.
32740760f5d2Smrg#
32750760f5d2SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
32760760f5d2SmrgAC_REQUIRE([AC_PROG_INSTALL])
32770760f5d2SmrgXORG_COMPILER_FLAGS
32780760f5d2SmrgXORG_CWARNFLAGS
32790760f5d2SmrgXORG_STRICT_OPTION
328005789e77SmrgXORG_DEFAULT_NOCODE_OPTIONS
32810760f5d2Smrg]) # XORG_DEFAULT_OPTIONS
3282cc4920e5Smrg
32830760f5d2Smrg# XORG_INSTALL()
32840760f5d2Smrg# ----------------
32850760f5d2Smrg# Minimum version: 1.4.0
32860760f5d2Smrg#
32870760f5d2Smrg# Defines the variable INSTALL_CMD as the command to copy
32880760f5d2Smrg# INSTALL from $prefix/share/util-macros.
32890760f5d2Smrg#
32900760f5d2SmrgAC_DEFUN([XORG_INSTALL], [
32910760f5d2SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
32920760f5d2Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
32930760f5d2SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
32940760f5d2Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
32950760f5d2Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
32960760f5d2Smrgtouch \$(top_srcdir)/INSTALL; \
32970760f5d2Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
32980760f5d2SmrgAC_SUBST([INSTALL_CMD])
32990760f5d2Smrg]) # XORG_INSTALL
33000760f5d2Smrgdnl Copyright 2005 Red Hat, Inc
33010760f5d2Smrgdnl
33020760f5d2Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
33030760f5d2Smrgdnl documentation for any purpose is hereby granted without fee, provided that
33040760f5d2Smrgdnl the above copyright notice appear in all copies and that both that
33050760f5d2Smrgdnl copyright notice and this permission notice appear in supporting
33060760f5d2Smrgdnl documentation.
33070760f5d2Smrgdnl
33080760f5d2Smrgdnl The above copyright notice and this permission notice shall be included
33090760f5d2Smrgdnl in all copies or substantial portions of the Software.
33100760f5d2Smrgdnl
33110760f5d2Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
33120760f5d2Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33130760f5d2Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
33140760f5d2Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
33150760f5d2Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
33160760f5d2Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
33170760f5d2Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
33180760f5d2Smrgdnl
33190760f5d2Smrgdnl Except as contained in this notice, the name of the copyright holders shall
33200760f5d2Smrgdnl not be used in advertising or otherwise to promote the sale, use or
33210760f5d2Smrgdnl other dealings in this Software without prior written authorization
33220760f5d2Smrgdnl from the copyright holders.
33230760f5d2Smrgdnl
3324cc4920e5Smrg
33250760f5d2Smrg# XORG_RELEASE_VERSION
33260760f5d2Smrg# --------------------
33270760f5d2Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3328cc4920e5Smrg
33290760f5d2SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
33300760f5d2Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
33310760f5d2Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
33320760f5d2Smrg		[Major version of this package])
33330760f5d2Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
33340760f5d2Smrg	if test "x$PVM" = "x"; then
33350760f5d2Smrg		PVM="0"
33360760f5d2Smrg	fi
33370760f5d2Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
33380760f5d2Smrg		[$PVM],
33390760f5d2Smrg		[Minor version of this package])
33400760f5d2Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
33410760f5d2Smrg	if test "x$PVP" = "x"; then
33420760f5d2Smrg		PVP="0"
33430760f5d2Smrg	fi
33440760f5d2Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
33450760f5d2Smrg		[$PVP],
33460760f5d2Smrg		[Patch version of this package])
33470760f5d2Smrg])
3348cc4920e5Smrg
33490760f5d2Smrg# XORG_CHANGELOG()
33500760f5d2Smrg# ----------------
33510760f5d2Smrg# Minimum version: 1.2.0
33520760f5d2Smrg#
33530760f5d2Smrg# Defines the variable CHANGELOG_CMD as the command to generate
33540760f5d2Smrg# ChangeLog from git.
33550760f5d2Smrg#
33560760f5d2Smrg#
33570760f5d2SmrgAC_DEFUN([XORG_CHANGELOG], [
33580760f5d2SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
33590760f5d2Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
33600760f5d2Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
33610760f5d2Smrgtouch \$(top_srcdir)/ChangeLog; \
33620760f5d2Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
33630760f5d2SmrgAC_SUBST([CHANGELOG_CMD])
33640760f5d2Smrg]) # XORG_CHANGELOG
3365caade7ccSmrg
3366cc4920e5Smrgm4_include([m4/ax_gcc_builtin.m4])
3367cc4920e5Smrgm4_include([m4/libtool.m4])
3368cc4920e5Smrgm4_include([m4/ltoptions.m4])
3369cc4920e5Smrgm4_include([m4/ltsugar.m4])
3370cc4920e5Smrgm4_include([m4/ltversion.m4])
3371cc4920e5Smrgm4_include([m4/lt~obsolete.m4])
3372