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