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