aclocal.m4 revision b8df70be
1b8df70beSmrg# generated automatically by aclocal 1.16.4 -*- Autoconf -*-
21c80d5b0Smrg
3b8df70beSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
411d341caSmrg
511d341caSmrg# This file is free software; the Free Software Foundation
611d341caSmrg# gives unlimited permission to copy and/or distribute it,
711d341caSmrg# with or without modifications, as long as this notice is preserved.
811d341caSmrg
911d341caSmrg# This program is distributed in the hope that it will be useful,
1011d341caSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1111d341caSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1211d341caSmrg# PARTICULAR PURPOSE.
1311d341caSmrg
141c80d5b0Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
154c61c93dSmrgm4_ifndef([AC_AUTOCONF_VERSION],
164c61c93dSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17b8df70beSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
18b8df70beSmrg[m4_warning([this file was generated for autoconf 2.71.
194c61c93dSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
204c61c93dSmrgIf you have problems, you may need to regenerate the build system entirely.
211c80d5b0SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2211d341caSmrg
23b8df70beSmrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2411d341caSmrg#
2511d341caSmrg# This file is free software; the Free Software Foundation
2611d341caSmrg# gives unlimited permission to copy and/or distribute it,
2711d341caSmrg# with or without modifications, as long as this notice is preserved.
2811d341caSmrg
2911d341caSmrg# AM_AUTOMAKE_VERSION(VERSION)
3011d341caSmrg# ----------------------------
3111d341caSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3211d341caSmrg# generated from the m4 files accompanying Automake X.Y.
334c61c93dSmrg# (This private macro should not be called outside this file.)
344c61c93dSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35b8df70beSmrg[am__api_version='1.16'
364c61c93dSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
374c61c93dSmrgdnl require some minimum version.  Point them to the right macro.
38b8df70beSmrgm4_if([$1], [1.16.4], [],
394c61c93dSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
404c61c93dSmrg])
414c61c93dSmrg
424c61c93dSmrg# _AM_AUTOCONF_VERSION(VERSION)
434c61c93dSmrg# -----------------------------
444c61c93dSmrg# aclocal traces this macro to find the Autoconf version.
454c61c93dSmrg# This is a private macro too.  Using m4_define simplifies
464c61c93dSmrg# the logic in aclocal, which can simply ignore this definition.
474c61c93dSmrgm4_define([_AM_AUTOCONF_VERSION], [])
4811d341caSmrg
4911d341caSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5011d341caSmrg# -------------------------------
514c61c93dSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
524c61c93dSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5311d341caSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54b8df70beSmrg[AM_AUTOMAKE_VERSION([1.16.4])dnl
554c61c93dSmrgm4_ifndef([AC_AUTOCONF_VERSION],
564c61c93dSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
574c61c93dSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5811d341caSmrg
5911d341caSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6011d341caSmrg
61b8df70beSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6211d341caSmrg#
6311d341caSmrg# This file is free software; the Free Software Foundation
6411d341caSmrg# gives unlimited permission to copy and/or distribute it,
6511d341caSmrg# with or without modifications, as long as this notice is preserved.
6611d341caSmrg
6711d341caSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
681c80d5b0Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
691c80d5b0Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7011d341caSmrg#
7111d341caSmrg# Of course, Automake must honor this variable whenever it calls a
7211d341caSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7311d341caSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7411d341caSmrg# depending on how configure is run.  This is pretty annoying, since
7511d341caSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7611d341caSmrg# source directory, any form will work fine, but in subdirectories a
7711d341caSmrg# relative path needs to be adjusted first.
7811d341caSmrg#
7911d341caSmrg# $ac_aux_dir/missing
8011d341caSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8111d341caSmrg# $top_srcdir/$ac_aux_dir/missing
8211d341caSmrg#    fails if $ac_aux_dir is absolute,
8311d341caSmrg#    fails when called from a subdirectory in a VPATH build with
8411d341caSmrg#          a relative $ac_aux_dir
8511d341caSmrg#
8611d341caSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8711d341caSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
881c80d5b0Smrg# harmless because $srcdir is '.', but things will broke when you
8911d341caSmrg# start a VPATH build or use an absolute $srcdir.
9011d341caSmrg#
9111d341caSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9211d341caSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9311d341caSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9411d341caSmrg# and then we would define $MISSING as
9511d341caSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9611d341caSmrg# This will work as long as MISSING is not called from configure, because
9711d341caSmrg# unfortunately $(top_srcdir) has no meaning in configure.
9811d341caSmrg# However there are other variables, like CC, which are often used in
9911d341caSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10011d341caSmrg#
10111d341caSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
10211d341caSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
10311d341caSmrg# configured tree to be moved without reconfiguration.
10411d341caSmrg
10511d341caSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10641fe0c2aSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10741fe0c2aSmrg# Expand $ac_aux_dir to an absolute path.
10841fe0c2aSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10911d341caSmrg])
11011d341caSmrg
11111d341caSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11211d341caSmrg
113b8df70beSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11411d341caSmrg#
11511d341caSmrg# This file is free software; the Free Software Foundation
11611d341caSmrg# gives unlimited permission to copy and/or distribute it,
11711d341caSmrg# with or without modifications, as long as this notice is preserved.
11811d341caSmrg
11911d341caSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12011d341caSmrg# -------------------------------------
12111d341caSmrg# Define a conditional.
12211d341caSmrgAC_DEFUN([AM_CONDITIONAL],
1231c80d5b0Smrg[AC_PREREQ([2.52])dnl
1241c80d5b0Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1251c80d5b0Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1264c61c93dSmrgAC_SUBST([$1_TRUE])dnl
1274c61c93dSmrgAC_SUBST([$1_FALSE])dnl
1284c61c93dSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1294c61c93dSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1304c61c93dSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13111d341caSmrgif $2; then
13211d341caSmrg  $1_TRUE=
13311d341caSmrg  $1_FALSE='#'
13411d341caSmrgelse
13511d341caSmrg  $1_TRUE='#'
13611d341caSmrg  $1_FALSE=
13711d341caSmrgfi
13811d341caSmrgAC_CONFIG_COMMANDS_PRE(
13911d341caSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14011d341caSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14111d341caSmrgUsually this means the macro was only invoked conditionally.]])
14211d341caSmrgfi])])
14311d341caSmrg
144b8df70beSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
1454c61c93dSmrg#
1464c61c93dSmrg# This file is free software; the Free Software Foundation
1474c61c93dSmrg# gives unlimited permission to copy and/or distribute it,
1484c61c93dSmrg# with or without modifications, as long as this notice is preserved.
1494c61c93dSmrg
1504c61c93dSmrg
1511c80d5b0Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1524c61c93dSmrg# written in clear, in which case automake, when reading aclocal.m4,
1534c61c93dSmrg# will think it sees a *use*, and therefore will trigger all it's
1544c61c93dSmrg# C support machinery.  Also note that it means that autoscan, seeing
1554c61c93dSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
15611d341caSmrg
1574c61c93dSmrg
1584c61c93dSmrg# _AM_DEPENDENCIES(NAME)
1594c61c93dSmrg# ----------------------
1604c61c93dSmrg# See how the compiler implements dependency checking.
1611c80d5b0Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1624c61c93dSmrg# We try a few techniques and use that to set a single cache variable.
1634c61c93dSmrg#
1644c61c93dSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1654c61c93dSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1664c61c93dSmrg# dependency, and given that the user is not expected to run this macro,
1674c61c93dSmrg# just rely on AC_PROG_CC.
1684c61c93dSmrgAC_DEFUN([_AM_DEPENDENCIES],
1694c61c93dSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1704c61c93dSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1714c61c93dSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1724c61c93dSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
1734c61c93dSmrg
1741c80d5b0Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1751c80d5b0Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1761c80d5b0Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1771c80d5b0Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1781c80d5b0Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1791c80d5b0Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1801c80d5b0Smrg                    [depcc="$$1"   am_compiler_list=])
1814c61c93dSmrg
1824c61c93dSmrgAC_CACHE_CHECK([dependency style of $depcc],
1834c61c93dSmrg               [am_cv_$1_dependencies_compiler_type],
1844c61c93dSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1854c61c93dSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
1864c61c93dSmrg  # making bogus files that we don't know about and never remove.  For
1874c61c93dSmrg  # instance it was reported that on HP-UX the gcc test will end up
1881c80d5b0Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1891c80d5b0Smrg  # in D".
1901c80d5b0Smrg  rm -rf conftest.dir
1914c61c93dSmrg  mkdir conftest.dir
1924c61c93dSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1934c61c93dSmrg  # using a relative directory.
1944c61c93dSmrg  cp "$am_depcomp" conftest.dir
1954c61c93dSmrg  cd conftest.dir
1964c61c93dSmrg  # We will build objects and dependencies in a subdirectory because
1974c61c93dSmrg  # it helps to detect inapplicable dependency modes.  For instance
1984c61c93dSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1994c61c93dSmrg  # side effect of compilation, but ICC will put the dependencies in
2004c61c93dSmrg  # the current directory while Tru64 will put them in the object
2014c61c93dSmrg  # directory.
2024c61c93dSmrg  mkdir sub
2034c61c93dSmrg
2044c61c93dSmrg  am_cv_$1_dependencies_compiler_type=none
2054c61c93dSmrg  if test "$am_compiler_list" = ""; then
2064c61c93dSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2074c61c93dSmrg  fi
2084c61c93dSmrg  am__universal=false
2094c61c93dSmrg  m4_case([$1], [CC],
2104c61c93dSmrg    [case " $depcc " in #(
2114c61c93dSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2124c61c93dSmrg     esac],
2134c61c93dSmrg    [CXX],
2144c61c93dSmrg    [case " $depcc " in #(
2154c61c93dSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2164c61c93dSmrg     esac])
2174c61c93dSmrg
2184c61c93dSmrg  for depmode in $am_compiler_list; do
2194c61c93dSmrg    # Setup a source with many dependencies, because some compilers
2204c61c93dSmrg    # like to wrap large dependency lists on column 80 (with \), and
2214c61c93dSmrg    # we should not choose a depcomp mode which is confused by this.
2224c61c93dSmrg    #
2234c61c93dSmrg    # We need to recreate these files for each test, as the compiler may
2244c61c93dSmrg    # overwrite some of them when testing with obscure command lines.
2254c61c93dSmrg    # This happens at least with the AIX C compiler.
2264c61c93dSmrg    : > sub/conftest.c
2274c61c93dSmrg    for i in 1 2 3 4 5 6; do
2284c61c93dSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2291c80d5b0Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2301c80d5b0Smrg      # Solaris 10 /bin/sh.
2311c80d5b0Smrg      echo '/* dummy */' > sub/conftst$i.h
2324c61c93dSmrg    done
2334c61c93dSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2344c61c93dSmrg
2351c80d5b0Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2364c61c93dSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2371c80d5b0Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2381c80d5b0Smrg    # versions had trouble with output in subdirs.
2394c61c93dSmrg    am__obj=sub/conftest.${OBJEXT-o}
2404c61c93dSmrg    am__minus_obj="-o $am__obj"
2414c61c93dSmrg    case $depmode in
2424c61c93dSmrg    gcc)
2434c61c93dSmrg      # This depmode causes a compiler race in universal mode.
2444c61c93dSmrg      test "$am__universal" = false || continue
2454c61c93dSmrg      ;;
2464c61c93dSmrg    nosideeffect)
2471c80d5b0Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2481c80d5b0Smrg      # only be used when explicitly requested.
2494c61c93dSmrg      if test "x$enable_dependency_tracking" = xyes; then
2504c61c93dSmrg	continue
2514c61c93dSmrg      else
2524c61c93dSmrg	break
2534c61c93dSmrg      fi
2544c61c93dSmrg      ;;
2551c80d5b0Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2561c80d5b0Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2574c61c93dSmrg      # not run yet.  These depmodes are late enough in the game, and
2584c61c93dSmrg      # so weak that their functioning should not be impacted.
2594c61c93dSmrg      am__obj=conftest.${OBJEXT-o}
2604c61c93dSmrg      am__minus_obj=
2614c61c93dSmrg      ;;
2624c61c93dSmrg    none) break ;;
2634c61c93dSmrg    esac
2644c61c93dSmrg    if depmode=$depmode \
2654c61c93dSmrg       source=sub/conftest.c object=$am__obj \
2664c61c93dSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2674c61c93dSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2684c61c93dSmrg         >/dev/null 2>conftest.err &&
2694c61c93dSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2704c61c93dSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2714c61c93dSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2724c61c93dSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2734c61c93dSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2744c61c93dSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
2754c61c93dSmrg      # that says an option was ignored or not supported.
2764c61c93dSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2774c61c93dSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2784c61c93dSmrg      # The diagnosis changed in icc 8.0:
2794c61c93dSmrg      #   icc: Command line remark: option '-MP' not supported
2804c61c93dSmrg      if (grep 'ignoring option' conftest.err ||
2814c61c93dSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2824c61c93dSmrg        am_cv_$1_dependencies_compiler_type=$depmode
2834c61c93dSmrg        break
2844c61c93dSmrg      fi
2854c61c93dSmrg    fi
2864c61c93dSmrg  done
2874c61c93dSmrg
2884c61c93dSmrg  cd ..
2894c61c93dSmrg  rm -rf conftest.dir
2904c61c93dSmrgelse
2914c61c93dSmrg  am_cv_$1_dependencies_compiler_type=none
2924c61c93dSmrgfi
2934c61c93dSmrg])
2944c61c93dSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2954c61c93dSmrgAM_CONDITIONAL([am__fastdep$1], [
2964c61c93dSmrg  test "x$enable_dependency_tracking" != xno \
2974c61c93dSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2984c61c93dSmrg])
2994c61c93dSmrg
3004c61c93dSmrg
3014c61c93dSmrg# AM_SET_DEPDIR
3024c61c93dSmrg# -------------
3034c61c93dSmrg# Choose a directory name for dependency files.
3041c80d5b0Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3054c61c93dSmrgAC_DEFUN([AM_SET_DEPDIR],
3064c61c93dSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3074c61c93dSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3084c61c93dSmrg])
3094c61c93dSmrg
3104c61c93dSmrg
3114c61c93dSmrg# AM_DEP_TRACK
3124c61c93dSmrg# ------------
3134c61c93dSmrgAC_DEFUN([AM_DEP_TRACK],
3141c80d5b0Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3151c80d5b0SmrgAS_HELP_STRING(
3161c80d5b0Smrg  [--enable-dependency-tracking],
3171c80d5b0Smrg  [do not reject slow dependency extractors])
3181c80d5b0SmrgAS_HELP_STRING(
3191c80d5b0Smrg  [--disable-dependency-tracking],
3201c80d5b0Smrg  [speeds up one-time build])])
3214c61c93dSmrgif test "x$enable_dependency_tracking" != xno; then
3224c61c93dSmrg  am_depcomp="$ac_aux_dir/depcomp"
3234c61c93dSmrg  AMDEPBACKSLASH='\'
3241c80d5b0Smrg  am__nodep='_no'
3254c61c93dSmrgfi
3264c61c93dSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3274c61c93dSmrgAC_SUBST([AMDEPBACKSLASH])dnl
3284c61c93dSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3291c80d5b0SmrgAC_SUBST([am__nodep])dnl
3301c80d5b0Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3314c61c93dSmrg])
3324c61c93dSmrg
3334c61c93dSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
3344c61c93dSmrg
335b8df70beSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
33611d341caSmrg#
33711d341caSmrg# This file is free software; the Free Software Foundation
33811d341caSmrg# gives unlimited permission to copy and/or distribute it,
33911d341caSmrg# with or without modifications, as long as this notice is preserved.
34011d341caSmrg
3414c61c93dSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3424c61c93dSmrg# ------------------------------
3434c61c93dSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3444c61c93dSmrg[{
3451c80d5b0Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3464c61c93dSmrg  # are listed without --file.  Let's play safe and only enable the eval
3474c61c93dSmrg  # if we detect the quoting.
348b8df70beSmrg  # TODO: see whether this extra hack can be removed once we start
349b8df70beSmrg  # requiring Autoconf 2.70 or later.
350b8df70beSmrg  AS_CASE([$CONFIG_FILES],
351b8df70beSmrg          [*\'*], [eval set x "$CONFIG_FILES"],
352b8df70beSmrg          [*], [set x $CONFIG_FILES])
3534c61c93dSmrg  shift
354b8df70beSmrg  # Used to flag and report bootstrapping failures.
355b8df70beSmrg  am_rc=0
356b8df70beSmrg  for am_mf
3574c61c93dSmrg  do
3584c61c93dSmrg    # Strip MF so we end up with the name of the file.
359b8df70beSmrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360b8df70beSmrg    # Check whether this is an Automake generated Makefile which includes
361b8df70beSmrg    # dependency-tracking related rules and includes.
362b8df70beSmrg    # Grep'ing the whole file directly is not great: AIX grep has a line
3634c61c93dSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
364b8df70beSmrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365b8df70beSmrg      || continue
366b8df70beSmrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367b8df70beSmrg    am_filepart=`AS_BASENAME(["$am_mf"])`
368b8df70beSmrg    AM_RUN_LOG([cd "$am_dirpart" \
369b8df70beSmrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
370b8df70beSmrg        | $MAKE -f - am--depfiles]) || am_rc=$?
3714c61c93dSmrg  done
372b8df70beSmrg  if test $am_rc -ne 0; then
373b8df70beSmrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374b8df70beSmrg    for automatic dependency tracking.  If GNU make was not used, consider
375b8df70beSmrg    re-running the configure script with MAKE="gmake" (or whatever is
376b8df70beSmrg    necessary).  You can also try re-running configure with the
377b8df70beSmrg    '--disable-dependency-tracking' option to at least be able to build
378b8df70beSmrg    the package (albeit without support for automatic dependency tracking).])
379b8df70beSmrg  fi
380b8df70beSmrg  AS_UNSET([am_dirpart])
381b8df70beSmrg  AS_UNSET([am_filepart])
382b8df70beSmrg  AS_UNSET([am_mf])
383b8df70beSmrg  AS_UNSET([am_rc])
384b8df70beSmrg  rm -f conftest-deps.mk
3854c61c93dSmrg}
3864c61c93dSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
3874c61c93dSmrg
3884c61c93dSmrg
3894c61c93dSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3904c61c93dSmrg# -----------------------------
3914c61c93dSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
3924c61c93dSmrg#
393b8df70beSmrg# This code is only required when automatic dependency tracking is enabled.
394b8df70beSmrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395b8df70beSmrg# order to bootstrap the dependency handling code.
3964c61c93dSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3974c61c93dSmrg[AC_CONFIG_COMMANDS([depfiles],
3984c61c93dSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399b8df70beSmrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
4004c61c93dSmrg
4014c61c93dSmrg# Do all the work for Automake.                             -*- Autoconf -*-
4024c61c93dSmrg
403b8df70beSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4044c61c93dSmrg#
4054c61c93dSmrg# This file is free software; the Free Software Foundation
4064c61c93dSmrg# gives unlimited permission to copy and/or distribute it,
4074c61c93dSmrg# with or without modifications, as long as this notice is preserved.
4084c61c93dSmrg
40911d341caSmrg# This macro actually does too much.  Some checks are only needed if
41011d341caSmrg# your package does certain things.  But this isn't really a big deal.
41111d341caSmrg
4121c80d5b0Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4131c80d5b0Smrgm4_define([AC_PROG_CC],
4141c80d5b0Smrgm4_defn([AC_PROG_CC])
4151c80d5b0Smrg[_AM_PROG_CC_C_O
4161c80d5b0Smrg])
4171c80d5b0Smrg
41811d341caSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41911d341caSmrg# AM_INIT_AUTOMAKE([OPTIONS])
42011d341caSmrg# -----------------------------------------------
42111d341caSmrg# The call with PACKAGE and VERSION arguments is the old style
42211d341caSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42311d341caSmrg# and VERSION should now be passed to AC_INIT and removed from
42411d341caSmrg# the call to AM_INIT_AUTOMAKE.
42511d341caSmrg# We support both call styles for the transition.  After
42611d341caSmrg# the next Automake release, Autoconf can make the AC_INIT
42711d341caSmrg# arguments mandatory, and then we can depend on a new Autoconf
42811d341caSmrg# release and drop the old call support.
42911d341caSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4301c80d5b0Smrg[AC_PREREQ([2.65])dnl
43111d341caSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43211d341caSmrgdnl the ones we care about.
43311d341caSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43411d341caSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43511d341caSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4364c61c93dSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4374c61c93dSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4384c61c93dSmrg  # is not polluted with repeated "-I."
4394c61c93dSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4404c61c93dSmrg  # test to see if srcdir already configured
4414c61c93dSmrg  if test -f $srcdir/config.status; then
4424c61c93dSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4434c61c93dSmrg  fi
44411d341caSmrgfi
44511d341caSmrg
44611d341caSmrg# test whether we have cygpath
44711d341caSmrgif test -z "$CYGPATH_W"; then
44811d341caSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
44911d341caSmrg    CYGPATH_W='cygpath -w'
45011d341caSmrg  else
45111d341caSmrg    CYGPATH_W=echo
45211d341caSmrg  fi
45311d341caSmrgfi
45411d341caSmrgAC_SUBST([CYGPATH_W])
45511d341caSmrg
45611d341caSmrg# Define the identity of the package.
45711d341caSmrgdnl Distinguish between old-style and new-style calls.
45811d341caSmrgm4_ifval([$2],
4591c80d5b0Smrg[AC_DIAGNOSE([obsolete],
4601c80d5b0Smrg             [$0: two- and three-arguments forms are deprecated.])
4611c80d5b0Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46211d341caSmrg AC_SUBST([PACKAGE], [$1])dnl
46311d341caSmrg AC_SUBST([VERSION], [$2])],
46411d341caSmrg[_AM_SET_OPTIONS([$1])dnl
4654c61c93dSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4661c80d5b0Smrgm4_if(
467b8df70beSmrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4681c80d5b0Smrg  [ok:ok],,
4694c61c93dSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47011d341caSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47111d341caSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
47211d341caSmrg
47311d341caSmrg_AM_IF_OPTION([no-define],,
4741c80d5b0Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4751c80d5b0Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
47611d341caSmrg
47711d341caSmrg# Some tools Automake needs.
47811d341caSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
47911d341caSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4801c80d5b0SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4811c80d5b0SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4821c80d5b0SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4831c80d5b0SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4841c80d5b0SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4854c61c93dSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4864c61c93dSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4871c80d5b0SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4881c80d5b0Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4891c80d5b0Smrg# dies out for good.  For more background, see:
490b8df70beSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
491b8df70beSmrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4921c80d5b0SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49341fe0c2aSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
49441fe0c2aSmrg# system "awk" is bad on some platforms.
49511d341caSmrgAC_REQUIRE([AC_PROG_AWK])dnl
49611d341caSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
49711d341caSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
49811d341caSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
4994c61c93dSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5004c61c93dSmrg			     [_AM_PROG_TAR([v7])])])
50111d341caSmrg_AM_IF_OPTION([no-dependencies],,
50211d341caSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5031c80d5b0Smrg		  [_AM_DEPENDENCIES([CC])],
5041c80d5b0Smrg		  [m4_define([AC_PROG_CC],
5051c80d5b0Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
50611d341caSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5071c80d5b0Smrg		  [_AM_DEPENDENCIES([CXX])],
5081c80d5b0Smrg		  [m4_define([AC_PROG_CXX],
5091c80d5b0Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5104c61c93dSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5111c80d5b0Smrg		  [_AM_DEPENDENCIES([OBJC])],
5121c80d5b0Smrg		  [m4_define([AC_PROG_OBJC],
5131c80d5b0Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5141c80d5b0SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5151c80d5b0Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5161c80d5b0Smrg		  [m4_define([AC_PROG_OBJCXX],
5171c80d5b0Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
51811d341caSmrg])
519b8df70beSmrg# Variables for tags utilities; see am/tags.am
520b8df70beSmrgif test -z "$CTAGS"; then
521b8df70beSmrg  CTAGS=ctags
522b8df70beSmrgfi
523b8df70beSmrgAC_SUBST([CTAGS])
524b8df70beSmrgif test -z "$ETAGS"; then
525b8df70beSmrg  ETAGS=etags
526b8df70beSmrgfi
527b8df70beSmrgAC_SUBST([ETAGS])
528b8df70beSmrgif test -z "$CSCOPE"; then
529b8df70beSmrg  CSCOPE=cscope
530b8df70beSmrgfi
531b8df70beSmrgAC_SUBST([CSCOPE])
532b8df70beSmrg
5331c80d5b0SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5341c80d5b0Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5351c80d5b0Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5361c80d5b0Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5374c61c93dSmrgAC_CONFIG_COMMANDS_PRE(dnl
5384c61c93dSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5394c61c93dSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
54011d341caSmrg
5411c80d5b0Smrg# POSIX will say in a future version that running "rm -f" with no argument
5421c80d5b0Smrg# is OK; and we want to be able to make that assumption in our Makefile
5431c80d5b0Smrg# recipes.  So use an aggressive probe to check that the usage we want is
5441c80d5b0Smrg# actually supported "in the wild" to an acceptable degree.
5451c80d5b0Smrg# See automake bug#10828.
5461c80d5b0Smrg# To make any issue more visible, cause the running configure to be aborted
5471c80d5b0Smrg# by default if the 'rm' program in use doesn't match our expectations; the
5481c80d5b0Smrg# user can still override this though.
5491c80d5b0Smrgif rm -f && rm -fr && rm -rf; then : OK; else
5501c80d5b0Smrg  cat >&2 <<'END'
5511c80d5b0SmrgOops!
5521c80d5b0Smrg
5531c80d5b0SmrgYour 'rm' program seems unable to run without file operands specified
5541c80d5b0Smrgon the command line, even when the '-f' option is present.  This is contrary
5551c80d5b0Smrgto the behaviour of most rm programs out there, and not conforming with
5561c80d5b0Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5571c80d5b0Smrg
5581c80d5b0SmrgPlease tell bug-automake@gnu.org about your system, including the value
5591c80d5b0Smrgof your $PATH and any error possibly output before this message.  This
5601c80d5b0Smrgcan help us improve future automake versions.
5611c80d5b0Smrg
5621c80d5b0SmrgEND
5631c80d5b0Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5641c80d5b0Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5651c80d5b0Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5661c80d5b0Smrg    echo >&2
5671c80d5b0Smrg  else
5681c80d5b0Smrg    cat >&2 <<'END'
5691c80d5b0SmrgAborting the configuration process, to ensure you take notice of the issue.
5701c80d5b0Smrg
5711c80d5b0SmrgYou can download and install GNU coreutils to get an 'rm' implementation
572b8df70beSmrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
5731c80d5b0Smrg
5741c80d5b0SmrgIf you want to complete the configuration process using your problematic
5751c80d5b0Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5761c80d5b0Smrgto "yes", and re-run configure.
5771c80d5b0Smrg
5781c80d5b0SmrgEND
5791c80d5b0Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5801c80d5b0Smrg  fi
58141fe0c2aSmrgfi
58241fe0c2aSmrgdnl The trailing newline in this macro's definition is deliberate, for
58341fe0c2aSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
58441fe0c2aSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
58541fe0c2aSmrg])
5861c80d5b0Smrg
5871c80d5b0Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5884c61c93dSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5894c61c93dSmrgdnl mangled by Autoconf and run in a shell conditional statement.
5904c61c93dSmrgm4_define([_AC_COMPILER_EXEEXT],
5914c61c93dSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5924c61c93dSmrg
59311d341caSmrg# When config.status generates a header, we must update the stamp-h file.
59411d341caSmrg# This file resides in the same directory as the config header
59511d341caSmrg# that is generated.  The stamp files are numbered to have different names.
59611d341caSmrg
59711d341caSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
59811d341caSmrg# loop where config.status creates the headers, so we can generate
59911d341caSmrg# our stamp files there.
60011d341caSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
60111d341caSmrg[# Compute $1's index in $config_headers.
6024c61c93dSmrg_am_arg=$1
60311d341caSmrg_am_stamp_count=1
60411d341caSmrgfor _am_header in $config_headers :; do
60511d341caSmrg  case $_am_header in
6064c61c93dSmrg    $_am_arg | $_am_arg:* )
60711d341caSmrg      break ;;
60811d341caSmrg    * )
60911d341caSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
61011d341caSmrg  esac
61111d341caSmrgdone
6124c61c93dSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
61311d341caSmrg
614b8df70beSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
61511d341caSmrg#
61611d341caSmrg# This file is free software; the Free Software Foundation
61711d341caSmrg# gives unlimited permission to copy and/or distribute it,
61811d341caSmrg# with or without modifications, as long as this notice is preserved.
61911d341caSmrg
62011d341caSmrg# AM_PROG_INSTALL_SH
62111d341caSmrg# ------------------
62211d341caSmrg# Define $install_sh.
62311d341caSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
62411d341caSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
62541fe0c2aSmrgif test x"${install_sh+set}" != xset; then
6264c61c93dSmrg  case $am_aux_dir in
6274c61c93dSmrg  *\ * | *\	*)
6284c61c93dSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6294c61c93dSmrg  *)
6304c61c93dSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6314c61c93dSmrg  esac
6324c61c93dSmrgfi
6331c80d5b0SmrgAC_SUBST([install_sh])])
63411d341caSmrg
635b8df70beSmrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
63611d341caSmrg#
63711d341caSmrg# This file is free software; the Free Software Foundation
63811d341caSmrg# gives unlimited permission to copy and/or distribute it,
63911d341caSmrg# with or without modifications, as long as this notice is preserved.
64011d341caSmrg
64111d341caSmrg# Check whether the underlying file-system supports filenames
64211d341caSmrg# with a leading dot.  For instance MS-DOS doesn't.
64311d341caSmrgAC_DEFUN([AM_SET_LEADING_DOT],
64411d341caSmrg[rm -rf .tst 2>/dev/null
64511d341caSmrgmkdir .tst 2>/dev/null
64611d341caSmrgif test -d .tst; then
64711d341caSmrg  am__leading_dot=.
64811d341caSmrgelse
64911d341caSmrg  am__leading_dot=_
65011d341caSmrgfi
65111d341caSmrgrmdir .tst 2>/dev/null
65211d341caSmrgAC_SUBST([am__leading_dot])])
65311d341caSmrg
6544c61c93dSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6554c61c93dSmrg
656b8df70beSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6574c61c93dSmrg#
6584c61c93dSmrg# This file is free software; the Free Software Foundation
6594c61c93dSmrg# gives unlimited permission to copy and/or distribute it,
6604c61c93dSmrg# with or without modifications, as long as this notice is preserved.
6614c61c93dSmrg
6624c61c93dSmrg# AM_MAKE_INCLUDE()
6634c61c93dSmrg# -----------------
664b8df70beSmrg# Check whether make has an 'include' directive that can support all
665b8df70beSmrg# the idioms we need for our automatic dependency tracking code.
6664c61c93dSmrgAC_DEFUN([AM_MAKE_INCLUDE],
667b8df70beSmrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
668b8df70beSmrgcat > confinc.mk << 'END'
6694c61c93dSmrgam__doit:
670b8df70beSmrg	@echo this is the am__doit target >confinc.out
6714c61c93dSmrg.PHONY: am__doit
6724c61c93dSmrgEND
6734c61c93dSmrgam__include="#"
6744c61c93dSmrgam__quote=
675b8df70beSmrg# BSD make does it like this.
676b8df70beSmrgecho '.include "confinc.mk" # ignored' > confmf.BSD
677b8df70beSmrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
678b8df70beSmrgecho 'include confinc.mk # ignored' > confmf.GNU
679b8df70beSmrg_am_result=no
680b8df70beSmrgfor s in GNU BSD; do
681b8df70beSmrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
682b8df70beSmrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
683b8df70beSmrg      ['0:this is the am__doit target'],
684b8df70beSmrg      [AS_CASE([$s],
685b8df70beSmrg          [BSD], [am__include='.include' am__quote='"'],
686b8df70beSmrg          [am__include='include' am__quote=''])])
687b8df70beSmrg  if test "$am__include" != "#"; then
688b8df70beSmrg    _am_result="yes ($s style)"
689b8df70beSmrg    break
690b8df70beSmrg  fi
691b8df70beSmrgdone
692b8df70beSmrgrm -f confinc.* confmf.*
693b8df70beSmrgAC_MSG_RESULT([${_am_result}])
694b8df70beSmrgAC_SUBST([am__include])])
695b8df70beSmrgAC_SUBST([am__quote])])
6964c61c93dSmrg
69711d341caSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
69811d341caSmrg
699b8df70beSmrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
70011d341caSmrg#
70111d341caSmrg# This file is free software; the Free Software Foundation
70211d341caSmrg# gives unlimited permission to copy and/or distribute it,
70311d341caSmrg# with or without modifications, as long as this notice is preserved.
70411d341caSmrg
70511d341caSmrg# AM_MISSING_PROG(NAME, PROGRAM)
70611d341caSmrg# ------------------------------
70711d341caSmrgAC_DEFUN([AM_MISSING_PROG],
70811d341caSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
70911d341caSmrg$1=${$1-"${am_missing_run}$2"}
71011d341caSmrgAC_SUBST($1)])
71111d341caSmrg
71211d341caSmrg# AM_MISSING_HAS_RUN
71311d341caSmrg# ------------------
7141c80d5b0Smrg# Define MISSING if not defined so far and test if it is modern enough.
7151c80d5b0Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
71611d341caSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
71711d341caSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7184c61c93dSmrgAC_REQUIRE_AUX_FILE([missing])dnl
7194c61c93dSmrgif test x"${MISSING+set}" != xset; then
720b8df70beSmrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
7214c61c93dSmrgfi
72211d341caSmrg# Use eval to expand $SHELL
7231c80d5b0Smrgif eval "$MISSING --is-lightweight"; then
7241c80d5b0Smrg  am_missing_run="$MISSING "
72511d341caSmrgelse
72611d341caSmrg  am_missing_run=
7271c80d5b0Smrg  AC_MSG_WARN(['missing' script is too old or missing])
72811d341caSmrgfi
72911d341caSmrg])
73011d341caSmrg
73111d341caSmrg# Helper functions for option handling.                     -*- Autoconf -*-
73211d341caSmrg
733b8df70beSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
73411d341caSmrg#
73511d341caSmrg# This file is free software; the Free Software Foundation
73611d341caSmrg# gives unlimited permission to copy and/or distribute it,
73711d341caSmrg# with or without modifications, as long as this notice is preserved.
73811d341caSmrg
73911d341caSmrg# _AM_MANGLE_OPTION(NAME)
74011d341caSmrg# -----------------------
74111d341caSmrgAC_DEFUN([_AM_MANGLE_OPTION],
74211d341caSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
74311d341caSmrg
74411d341caSmrg# _AM_SET_OPTION(NAME)
7451c80d5b0Smrg# --------------------
74611d341caSmrg# Set option NAME.  Presently that only means defining a flag for this option.
74711d341caSmrgAC_DEFUN([_AM_SET_OPTION],
7481c80d5b0Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
74911d341caSmrg
75011d341caSmrg# _AM_SET_OPTIONS(OPTIONS)
7511c80d5b0Smrg# ------------------------
75211d341caSmrg# OPTIONS is a space-separated list of Automake options.
75311d341caSmrgAC_DEFUN([_AM_SET_OPTIONS],
7544c61c93dSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
75511d341caSmrg
75611d341caSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
75711d341caSmrg# -------------------------------------------
75811d341caSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
75911d341caSmrgAC_DEFUN([_AM_IF_OPTION],
76011d341caSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76111d341caSmrg
762b8df70beSmrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
7631c80d5b0Smrg#
7641c80d5b0Smrg# This file is free software; the Free Software Foundation
7651c80d5b0Smrg# gives unlimited permission to copy and/or distribute it,
7661c80d5b0Smrg# with or without modifications, as long as this notice is preserved.
7671c80d5b0Smrg
7681c80d5b0Smrg# _AM_PROG_CC_C_O
7691c80d5b0Smrg# ---------------
7701c80d5b0Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7711c80d5b0Smrg# to automatically call this.
7721c80d5b0SmrgAC_DEFUN([_AM_PROG_CC_C_O],
7731c80d5b0Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7741c80d5b0SmrgAC_REQUIRE_AUX_FILE([compile])dnl
7751c80d5b0SmrgAC_LANG_PUSH([C])dnl
7761c80d5b0SmrgAC_CACHE_CHECK(
7771c80d5b0Smrg  [whether $CC understands -c and -o together],
7781c80d5b0Smrg  [am_cv_prog_cc_c_o],
7791c80d5b0Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7801c80d5b0Smrg  # Make sure it works both with $CC and with simple cc.
7811c80d5b0Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7821c80d5b0Smrg  # compilers refuse to overwrite an existing .o file with -o,
7831c80d5b0Smrg  # though they will create one.
7841c80d5b0Smrg  am_cv_prog_cc_c_o=yes
7851c80d5b0Smrg  for am_i in 1 2; do
7861c80d5b0Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7871c80d5b0Smrg         && test -f conftest2.$ac_objext; then
7881c80d5b0Smrg      : OK
7891c80d5b0Smrg    else
7901c80d5b0Smrg      am_cv_prog_cc_c_o=no
7911c80d5b0Smrg      break
7921c80d5b0Smrg    fi
7931c80d5b0Smrg  done
7941c80d5b0Smrg  rm -f core conftest*
7951c80d5b0Smrg  unset am_i])
7961c80d5b0Smrgif test "$am_cv_prog_cc_c_o" != yes; then
7971c80d5b0Smrg   # Losing compiler, so override with the script.
7981c80d5b0Smrg   # FIXME: It is wrong to rewrite CC.
7991c80d5b0Smrg   # But if we don't then we get into trouble of one sort or another.
8001c80d5b0Smrg   # A longer-term fix would be to have automake use am__CC in this case,
8011c80d5b0Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8021c80d5b0Smrg   CC="$am_aux_dir/compile $CC"
8031c80d5b0Smrgfi
8041c80d5b0SmrgAC_LANG_POP([C])])
80511d341caSmrg
8061c80d5b0Smrg# For backward compatibility.
8071c80d5b0SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8081c80d5b0Smrg
809b8df70beSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
81011d341caSmrg#
81111d341caSmrg# This file is free software; the Free Software Foundation
81211d341caSmrg# gives unlimited permission to copy and/or distribute it,
81311d341caSmrg# with or without modifications, as long as this notice is preserved.
81411d341caSmrg
8151c80d5b0Smrg# AM_RUN_LOG(COMMAND)
8161c80d5b0Smrg# -------------------
8171c80d5b0Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8181c80d5b0Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8191c80d5b0SmrgAC_DEFUN([AM_RUN_LOG],
8201c80d5b0Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8211c80d5b0Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8221c80d5b0Smrg   ac_status=$?
8231c80d5b0Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8241c80d5b0Smrg   (exit $ac_status); }])
8251c80d5b0Smrg
8261c80d5b0Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8271c80d5b0Smrg
828b8df70beSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
8291c80d5b0Smrg#
8301c80d5b0Smrg# This file is free software; the Free Software Foundation
8311c80d5b0Smrg# gives unlimited permission to copy and/or distribute it,
8321c80d5b0Smrg# with or without modifications, as long as this notice is preserved.
83311d341caSmrg
83411d341caSmrg# AM_SANITY_CHECK
83511d341caSmrg# ---------------
83611d341caSmrgAC_DEFUN([AM_SANITY_CHECK],
83711d341caSmrg[AC_MSG_CHECKING([whether build environment is sane])
8384c61c93dSmrg# Reject unsafe characters in $srcdir or the absolute working directory
8394c61c93dSmrg# name.  Accept space and tab only in the latter.
8404c61c93dSmrgam_lf='
8414c61c93dSmrg'
8424c61c93dSmrgcase `pwd` in
8434c61c93dSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8444c61c93dSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8454c61c93dSmrgesac
8464c61c93dSmrgcase $srcdir in
8474c61c93dSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8481c80d5b0Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8494c61c93dSmrgesac
8504c61c93dSmrg
8511c80d5b0Smrg# Do 'set' in a subshell so we don't clobber the current shell's
85211d341caSmrg# arguments.  Must try -L first in case configure is actually a
85311d341caSmrg# symlink; some systems play weird games with the mod time of symlinks
85411d341caSmrg# (eg FreeBSD returns the mod time of the symlink's containing
85511d341caSmrg# directory).
85611d341caSmrgif (
8571c80d5b0Smrg   am_has_slept=no
8581c80d5b0Smrg   for am_try in 1 2; do
8591c80d5b0Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8601c80d5b0Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
8611c80d5b0Smrg     if test "$[*]" = "X"; then
8621c80d5b0Smrg	# -L didn't work.
8631c80d5b0Smrg	set X `ls -t "$srcdir/configure" conftest.file`
8641c80d5b0Smrg     fi
8651c80d5b0Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
8661c80d5b0Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
8671c80d5b0Smrg
8681c80d5b0Smrg	# If neither matched, then we have a broken ls.  This can happen
8691c80d5b0Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
8701c80d5b0Smrg	# broken ls alias from the environment.  This has actually
8711c80d5b0Smrg	# happened.  Such a system could not be considered "sane".
8721c80d5b0Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
8731c80d5b0Smrg  alias in your environment])
8741c80d5b0Smrg     fi
8751c80d5b0Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
8761c80d5b0Smrg       break
8771c80d5b0Smrg     fi
8781c80d5b0Smrg     # Just in case.
8791c80d5b0Smrg     sleep 1
8801c80d5b0Smrg     am_has_slept=yes
8811c80d5b0Smrg   done
88211d341caSmrg   test "$[2]" = conftest.file
88311d341caSmrg   )
88411d341caSmrgthen
88511d341caSmrg   # Ok.
88611d341caSmrg   :
88711d341caSmrgelse
88811d341caSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
88911d341caSmrgCheck your system clock])
89011d341caSmrgfi
8911c80d5b0SmrgAC_MSG_RESULT([yes])
8921c80d5b0Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
8931c80d5b0Smrg# generated files are strictly newer.
8941c80d5b0Smrgam_sleep_pid=
8951c80d5b0Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
8961c80d5b0Smrg  ( sleep 1 ) &
8971c80d5b0Smrg  am_sleep_pid=$!
8981c80d5b0Smrgfi
8991c80d5b0SmrgAC_CONFIG_COMMANDS_PRE(
9001c80d5b0Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9011c80d5b0Smrg   if test -n "$am_sleep_pid"; then
9021c80d5b0Smrg     # Hide warnings about reused PIDs.
9031c80d5b0Smrg     wait $am_sleep_pid 2>/dev/null
9041c80d5b0Smrg   fi
9051c80d5b0Smrg   AC_MSG_RESULT([done])])
9061c80d5b0Smrgrm -f conftest.file
9071c80d5b0Smrg])
90811d341caSmrg
909b8df70beSmrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
9104c61c93dSmrg#
9114c61c93dSmrg# This file is free software; the Free Software Foundation
9124c61c93dSmrg# gives unlimited permission to copy and/or distribute it,
9134c61c93dSmrg# with or without modifications, as long as this notice is preserved.
9144c61c93dSmrg
9154c61c93dSmrg# AM_SILENT_RULES([DEFAULT])
9164c61c93dSmrg# --------------------------
9174c61c93dSmrg# Enable less verbose build rules; with the default set to DEFAULT
9181c80d5b0Smrg# ("yes" being less verbose, "no" or empty being verbose).
9194c61c93dSmrgAC_DEFUN([AM_SILENT_RULES],
9201c80d5b0Smrg[AC_ARG_ENABLE([silent-rules], [dnl
9211c80d5b0SmrgAS_HELP_STRING(
9221c80d5b0Smrg  [--enable-silent-rules],
9231c80d5b0Smrg  [less verbose build output (undo: "make V=1")])
9241c80d5b0SmrgAS_HELP_STRING(
9251c80d5b0Smrg  [--disable-silent-rules],
9261c80d5b0Smrg  [verbose build output (undo: "make V=0")])dnl
9271c80d5b0Smrg])
9281c80d5b0Smrgcase $enable_silent_rules in @%:@ (((
9291c80d5b0Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
9301c80d5b0Smrg   no) AM_DEFAULT_VERBOSITY=1;;
9311c80d5b0Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9324c61c93dSmrgesac
9331c80d5b0Smrgdnl
9341c80d5b0Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9351c80d5b0Smrgdnl do not support nested variable expansions.
9361c80d5b0Smrgdnl See automake bug#9928 and bug#10237.
9371c80d5b0Smrgam_make=${MAKE-make}
9381c80d5b0SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9391c80d5b0Smrg   [am_cv_make_support_nested_variables],
9401c80d5b0Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9411c80d5b0SmrgBAR0=false
9421c80d5b0SmrgBAR1=true
9431c80d5b0SmrgV=1
9441c80d5b0Smrgam__doit:
9451c80d5b0Smrg	@$(TRUE)
9461c80d5b0Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9471c80d5b0Smrg  am_cv_make_support_nested_variables=yes
9481c80d5b0Smrgelse
9491c80d5b0Smrg  am_cv_make_support_nested_variables=no
9501c80d5b0Smrgfi])
9511c80d5b0Smrgif test $am_cv_make_support_nested_variables = yes; then
9521c80d5b0Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9531c80d5b0Smrg  AM_V='$(V)'
9541c80d5b0Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9551c80d5b0Smrgelse
9561c80d5b0Smrg  AM_V=$AM_DEFAULT_VERBOSITY
9571c80d5b0Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9581c80d5b0Smrgfi
9591c80d5b0SmrgAC_SUBST([AM_V])dnl
9601c80d5b0SmrgAM_SUBST_NOTMAKE([AM_V])dnl
9611c80d5b0SmrgAC_SUBST([AM_DEFAULT_V])dnl
9621c80d5b0SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
9634c61c93dSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
9644c61c93dSmrgAM_BACKSLASH='\'
9654c61c93dSmrgAC_SUBST([AM_BACKSLASH])dnl
9664c61c93dSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
9674c61c93dSmrg])
9684c61c93dSmrg
969b8df70beSmrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
97011d341caSmrg#
97111d341caSmrg# This file is free software; the Free Software Foundation
97211d341caSmrg# gives unlimited permission to copy and/or distribute it,
97311d341caSmrg# with or without modifications, as long as this notice is preserved.
97411d341caSmrg
97511d341caSmrg# AM_PROG_INSTALL_STRIP
97611d341caSmrg# ---------------------
9771c80d5b0Smrg# One issue with vendor 'install' (even GNU) is that you can't
97811d341caSmrg# specify the program used to strip binaries.  This is especially
97911d341caSmrg# annoying in cross-compiling environments, where the build's strip
98011d341caSmrg# is unlikely to handle the host's binaries.
98111d341caSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
9821c80d5b0Smrg# always use install-sh in "make install-strip", and initialize
98311d341caSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
98411d341caSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
98511d341caSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
9861c80d5b0Smrg# Installed binaries are usually stripped using 'strip' when the user
9871c80d5b0Smrg# run "make install-strip".  However 'strip' might not be the right
98811d341caSmrg# tool to use in cross-compilation environments, therefore Automake
9891c80d5b0Smrg# will honor the 'STRIP' environment variable to overrule this program.
9901c80d5b0Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99111d341caSmrgif test "$cross_compiling" != no; then
99211d341caSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
99311d341caSmrgfi
9944c61c93dSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
99511d341caSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
99611d341caSmrg
997b8df70beSmrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
9984c61c93dSmrg#
9994c61c93dSmrg# This file is free software; the Free Software Foundation
10004c61c93dSmrg# gives unlimited permission to copy and/or distribute it,
10014c61c93dSmrg# with or without modifications, as long as this notice is preserved.
10024c61c93dSmrg
10034c61c93dSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
10044c61c93dSmrg# ---------------------------
10054c61c93dSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10064c61c93dSmrg# This macro is traced by Automake.
10074c61c93dSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
10084c61c93dSmrg
10094c61c93dSmrg# AM_SUBST_NOTMAKE(VARIABLE)
10101c80d5b0Smrg# --------------------------
10114c61c93dSmrg# Public sister of _AM_SUBST_NOTMAKE.
10124c61c93dSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
10134c61c93dSmrg
101411d341caSmrg# Check how to create a tarball.                            -*- Autoconf -*-
101511d341caSmrg
1016b8df70beSmrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
101711d341caSmrg#
101811d341caSmrg# This file is free software; the Free Software Foundation
101911d341caSmrg# gives unlimited permission to copy and/or distribute it,
102011d341caSmrg# with or without modifications, as long as this notice is preserved.
102111d341caSmrg
102211d341caSmrg# _AM_PROG_TAR(FORMAT)
102311d341caSmrg# --------------------
102411d341caSmrg# Check how to create a tarball in format FORMAT.
10251c80d5b0Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
102611d341caSmrg#
102711d341caSmrg# Substitute a variable $(am__tar) that is a command
102811d341caSmrg# writing to stdout a FORMAT-tarball containing the directory
102911d341caSmrg# $tardir.
103011d341caSmrg#     tardir=directory && $(am__tar) > result.tar
103111d341caSmrg#
103211d341caSmrg# Substitute a variable $(am__untar) that extract such
103311d341caSmrg# a tarball read from stdin.
103411d341caSmrg#     $(am__untar) < result.tar
10351c80d5b0Smrg#
103611d341caSmrgAC_DEFUN([_AM_PROG_TAR],
10371c80d5b0Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10381c80d5b0Smrg# in the wild :-(  We should find a proper way to deprecate it ...
10391c80d5b0SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10401c80d5b0Smrg
10411c80d5b0Smrg# We'll loop over all known methods to create a tar archive until one works.
104211d341caSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
104311d341caSmrg
10441c80d5b0Smrgm4_if([$1], [v7],
10451c80d5b0Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10461c80d5b0Smrg
10471c80d5b0Smrg  [m4_case([$1],
10481c80d5b0Smrg    [ustar],
10491c80d5b0Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10501c80d5b0Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10511c80d5b0Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10521c80d5b0Smrg      # and bug#13588).
10531c80d5b0Smrg      am_max_uid=2097151 # 2^21 - 1
10541c80d5b0Smrg      am_max_gid=$am_max_uid
10551c80d5b0Smrg      # The $UID and $GID variables are not portable, so we need to resort
10561c80d5b0Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10571c80d5b0Smrg      # below are definitely unexpected, so allow the users to see them
10581c80d5b0Smrg      # (that is, avoid stderr redirection).
10591c80d5b0Smrg      am_uid=`id -u || echo unknown`
10601c80d5b0Smrg      am_gid=`id -g || echo unknown`
10611c80d5b0Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
10621c80d5b0Smrg      if test $am_uid -le $am_max_uid; then
10631c80d5b0Smrg         AC_MSG_RESULT([yes])
10641c80d5b0Smrg      else
10651c80d5b0Smrg         AC_MSG_RESULT([no])
10661c80d5b0Smrg         _am_tools=none
10671c80d5b0Smrg      fi
10681c80d5b0Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
10691c80d5b0Smrg      if test $am_gid -le $am_max_gid; then
10701c80d5b0Smrg         AC_MSG_RESULT([yes])
10711c80d5b0Smrg      else
10721c80d5b0Smrg        AC_MSG_RESULT([no])
10731c80d5b0Smrg        _am_tools=none
10741c80d5b0Smrg      fi],
10751c80d5b0Smrg
10761c80d5b0Smrg  [pax],
10771c80d5b0Smrg    [],
10781c80d5b0Smrg
10791c80d5b0Smrg  [m4_fatal([Unknown tar format])])
10801c80d5b0Smrg
10811c80d5b0Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
10821c80d5b0Smrg
10831c80d5b0Smrg  # Go ahead even if we have the value already cached.  We do so because we
10841c80d5b0Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
10851c80d5b0Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
10861c80d5b0Smrg
10871c80d5b0Smrg  for _am_tool in $_am_tools; do
10881c80d5b0Smrg    case $_am_tool in
10891c80d5b0Smrg    gnutar)
10901c80d5b0Smrg      for _am_tar in tar gnutar gtar; do
10911c80d5b0Smrg        AM_RUN_LOG([$_am_tar --version]) && break
10921c80d5b0Smrg      done
10931c80d5b0Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
10941c80d5b0Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
10951c80d5b0Smrg      am__untar="$_am_tar -xf -"
10961c80d5b0Smrg      ;;
10971c80d5b0Smrg    plaintar)
10981c80d5b0Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
10991c80d5b0Smrg      # ustar tarball either.
11001c80d5b0Smrg      (tar --version) >/dev/null 2>&1 && continue
11011c80d5b0Smrg      am__tar='tar chf - "$$tardir"'
11021c80d5b0Smrg      am__tar_='tar chf - "$tardir"'
11031c80d5b0Smrg      am__untar='tar xf -'
11041c80d5b0Smrg      ;;
11051c80d5b0Smrg    pax)
11061c80d5b0Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
11071c80d5b0Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
11081c80d5b0Smrg      am__untar='pax -r'
11091c80d5b0Smrg      ;;
11101c80d5b0Smrg    cpio)
11111c80d5b0Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11121c80d5b0Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11131c80d5b0Smrg      am__untar='cpio -i -H $1 -d'
11141c80d5b0Smrg      ;;
11151c80d5b0Smrg    none)
11161c80d5b0Smrg      am__tar=false
11171c80d5b0Smrg      am__tar_=false
11181c80d5b0Smrg      am__untar=false
11191c80d5b0Smrg      ;;
11201c80d5b0Smrg    esac
112111d341caSmrg
11221c80d5b0Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
11231c80d5b0Smrg    # and am__untar set.
11241c80d5b0Smrg    test -n "${am_cv_prog_tar_$1}" && break
11251c80d5b0Smrg
11261c80d5b0Smrg    # tar/untar a dummy directory, and stop if the command works.
11271c80d5b0Smrg    rm -rf conftest.dir
11281c80d5b0Smrg    mkdir conftest.dir
11291c80d5b0Smrg    echo GrepMe > conftest.dir/file
11301c80d5b0Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11311c80d5b0Smrg    rm -rf conftest.dir
11321c80d5b0Smrg    if test -s conftest.tar; then
11331c80d5b0Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
11341c80d5b0Smrg      AM_RUN_LOG([cat conftest.dir/file])
11351c80d5b0Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11361c80d5b0Smrg    fi
11371c80d5b0Smrg  done
113811d341caSmrg  rm -rf conftest.dir
113911d341caSmrg
11401c80d5b0Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11411c80d5b0Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11421c80d5b0Smrg
114311d341caSmrgAC_SUBST([am__tar])
114411d341caSmrgAC_SUBST([am__untar])
114511d341caSmrg]) # _AM_PROG_TAR
114611d341caSmrg
1147b8df70beSmrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1148b8df70beSmrgdnl serial 11 (pkg-config-0.29)
1149b8df70beSmrgdnl
1150b8df70beSmrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1151b8df70beSmrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1152b8df70beSmrgdnl
1153b8df70beSmrgdnl This program is free software; you can redistribute it and/or modify
1154b8df70beSmrgdnl it under the terms of the GNU General Public License as published by
1155b8df70beSmrgdnl the Free Software Foundation; either version 2 of the License, or
1156b8df70beSmrgdnl (at your option) any later version.
1157b8df70beSmrgdnl
1158b8df70beSmrgdnl This program is distributed in the hope that it will be useful, but
1159b8df70beSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
1160b8df70beSmrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1161b8df70beSmrgdnl General Public License for more details.
1162b8df70beSmrgdnl
1163b8df70beSmrgdnl You should have received a copy of the GNU General Public License
1164b8df70beSmrgdnl along with this program; if not, write to the Free Software
1165b8df70beSmrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1166b8df70beSmrgdnl 02111-1307, USA.
1167b8df70beSmrgdnl
1168b8df70beSmrgdnl As a special exception to the GNU General Public License, if you
1169b8df70beSmrgdnl distribute this file as part of a program that contains a
1170b8df70beSmrgdnl configuration script generated by Autoconf, you may include it under
1171b8df70beSmrgdnl the same distribution terms that you use for the rest of that
1172b8df70beSmrgdnl program.
1173b8df70beSmrg
1174b8df70beSmrgdnl PKG_PREREQ(MIN-VERSION)
1175b8df70beSmrgdnl -----------------------
1176b8df70beSmrgdnl Since: 0.29
1177b8df70beSmrgdnl
1178b8df70beSmrgdnl Verify that the version of the pkg-config macros are at least
1179b8df70beSmrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1180b8df70beSmrgdnl installed version of pkg-config, this checks the developer's version
1181b8df70beSmrgdnl of pkg.m4 when generating configure.
1182b8df70beSmrgdnl
1183b8df70beSmrgdnl To ensure that this macro is defined, also add:
1184b8df70beSmrgdnl m4_ifndef([PKG_PREREQ],
1185b8df70beSmrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1186b8df70beSmrgdnl
1187b8df70beSmrgdnl See the "Since" comment for each macro you use to see what version
1188b8df70beSmrgdnl of the macros you require.
1189b8df70beSmrgm4_defun([PKG_PREREQ],
1190b8df70beSmrg[m4_define([PKG_MACROS_VERSION], [0.29])
1191b8df70beSmrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1192b8df70beSmrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1193b8df70beSmrg])dnl PKG_PREREQ
1194b8df70beSmrg
1195b8df70beSmrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1196b8df70beSmrgdnl ----------------------------------
1197b8df70beSmrgdnl Since: 0.16
1198b8df70beSmrgdnl
1199b8df70beSmrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1200b8df70beSmrgdnl first found in the path. Checks that the version of pkg-config found
1201b8df70beSmrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1202b8df70beSmrgdnl used since that's the first version where most current features of
1203b8df70beSmrgdnl pkg-config existed.
12041c80d5b0SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
12051c80d5b0Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1206b8df70beSmrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1207b8df70beSmrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1208b8df70beSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1209b8df70beSmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1210b8df70beSmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1211b8df70beSmrg
12121c80d5b0Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
12131c80d5b0Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
12141c80d5b0Smrgfi
12151c80d5b0Smrgif test -n "$PKG_CONFIG"; then
12161c80d5b0Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
12171c80d5b0Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
12181c80d5b0Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
12191c80d5b0Smrg		AC_MSG_RESULT([yes])
12201c80d5b0Smrg	else
12211c80d5b0Smrg		AC_MSG_RESULT([no])
12221c80d5b0Smrg		PKG_CONFIG=""
12231c80d5b0Smrg	fi
12241c80d5b0Smrgfi[]dnl
1225b8df70beSmrg])dnl PKG_PROG_PKG_CONFIG
1226d7ffce2aSmrg
1227b8df70beSmrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1228b8df70beSmrgdnl -------------------------------------------------------------------
1229b8df70beSmrgdnl Since: 0.18
1230b8df70beSmrgdnl
1231b8df70beSmrgdnl Check to see whether a particular set of modules exists. Similar to
1232b8df70beSmrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1233b8df70beSmrgdnl
1234b8df70beSmrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1235b8df70beSmrgdnl only at the first occurence in configure.ac, so if the first place
1236b8df70beSmrgdnl it's called might be skipped (such as if it is within an "if", you
1237b8df70beSmrgdnl have to call PKG_CHECK_EXISTS manually
12381c80d5b0SmrgAC_DEFUN([PKG_CHECK_EXISTS],
12391c80d5b0Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12401c80d5b0Smrgif test -n "$PKG_CONFIG" && \
12411c80d5b0Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1242b8df70beSmrg  m4_default([$2], [:])
12431c80d5b0Smrgm4_ifvaln([$3], [else
12441c80d5b0Smrg  $3])dnl
12451c80d5b0Smrgfi])
12461c80d5b0Smrg
1247b8df70beSmrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1248b8df70beSmrgdnl ---------------------------------------------
1249b8df70beSmrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1250b8df70beSmrgdnl pkg_failed based on the result.
12511c80d5b0Smrgm4_define([_PKG_CONFIG],
12521c80d5b0Smrg[if test -n "$$1"; then
12531c80d5b0Smrg    pkg_cv_[]$1="$$1"
12541c80d5b0Smrg elif test -n "$PKG_CONFIG"; then
12551c80d5b0Smrg    PKG_CHECK_EXISTS([$3],
1256b8df70beSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1257b8df70beSmrg		      test "x$?" != "x0" && pkg_failed=yes ],
12581c80d5b0Smrg		     [pkg_failed=yes])
12591c80d5b0Smrg else
12601c80d5b0Smrg    pkg_failed=untried
12611c80d5b0Smrgfi[]dnl
1262b8df70beSmrg])dnl _PKG_CONFIG
12631c80d5b0Smrg
1264b8df70beSmrgdnl _PKG_SHORT_ERRORS_SUPPORTED
1265b8df70beSmrgdnl ---------------------------
1266b8df70beSmrgdnl Internal check to see if pkg-config supports short errors.
12671c80d5b0SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
12681c80d5b0Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12691c80d5b0Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
12701c80d5b0Smrg        _pkg_short_errors_supported=yes
12711c80d5b0Smrgelse
12721c80d5b0Smrg        _pkg_short_errors_supported=no
12731c80d5b0Smrgfi[]dnl
1274b8df70beSmrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
12751c80d5b0Smrg
12761c80d5b0Smrg
1277b8df70beSmrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1278b8df70beSmrgdnl   [ACTION-IF-NOT-FOUND])
1279b8df70beSmrgdnl --------------------------------------------------------------
1280b8df70beSmrgdnl Since: 0.4.0
1281b8df70beSmrgdnl
1282b8df70beSmrgdnl Note that if there is a possibility the first call to
1283b8df70beSmrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1284b8df70beSmrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
12851c80d5b0SmrgAC_DEFUN([PKG_CHECK_MODULES],
12861c80d5b0Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12871c80d5b0SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
12881c80d5b0SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12891c80d5b0Smrg
12901c80d5b0Smrgpkg_failed=no
12911c80d5b0SmrgAC_MSG_CHECKING([for $1])
12921c80d5b0Smrg
12931c80d5b0Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
12941c80d5b0Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
12951c80d5b0Smrg
12961c80d5b0Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
12971c80d5b0Smrgand $1[]_LIBS to avoid the need to call pkg-config.
12981c80d5b0SmrgSee the pkg-config man page for more details.])
12991c80d5b0Smrg
13001c80d5b0Smrgif test $pkg_failed = yes; then
1301b8df70beSmrg   	AC_MSG_RESULT([no])
13021c80d5b0Smrg        _PKG_SHORT_ERRORS_SUPPORTED
13031c80d5b0Smrg        if test $_pkg_short_errors_supported = yes; then
1304b8df70beSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
13051c80d5b0Smrg        else 
1306b8df70beSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
13071c80d5b0Smrg        fi
13081c80d5b0Smrg	# Put the nasty error message in config.log where it belongs
13091c80d5b0Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
13101c80d5b0Smrg
1311b8df70beSmrg	m4_default([$4], [AC_MSG_ERROR(
13121c80d5b0Smrg[Package requirements ($2) were not met:
13131c80d5b0Smrg
13141c80d5b0Smrg$$1_PKG_ERRORS
13151c80d5b0Smrg
13161c80d5b0SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
13171c80d5b0Smrginstalled software in a non-standard prefix.
13181c80d5b0Smrg
1319b8df70beSmrg_PKG_TEXT])[]dnl
1320b8df70beSmrg        ])
13211c80d5b0Smrgelif test $pkg_failed = untried; then
1322b8df70beSmrg     	AC_MSG_RESULT([no])
1323b8df70beSmrg	m4_default([$4], [AC_MSG_FAILURE(
13241c80d5b0Smrg[The pkg-config script could not be found or is too old.  Make sure it
13251c80d5b0Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
13261c80d5b0Smrgpath to pkg-config.
13271c80d5b0Smrg
13281c80d5b0Smrg_PKG_TEXT
13291c80d5b0Smrg
1330b8df70beSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1331b8df70beSmrg        ])
13321c80d5b0Smrgelse
13331c80d5b0Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
13341c80d5b0Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
13351c80d5b0Smrg        AC_MSG_RESULT([yes])
1336b8df70beSmrg	$3
13371c80d5b0Smrgfi[]dnl
1338b8df70beSmrg])dnl PKG_CHECK_MODULES
1339b8df70beSmrg
1340b8df70beSmrg
1341b8df70beSmrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1342b8df70beSmrgdnl   [ACTION-IF-NOT-FOUND])
1343b8df70beSmrgdnl ---------------------------------------------------------------------
1344b8df70beSmrgdnl Since: 0.29
1345b8df70beSmrgdnl
1346b8df70beSmrgdnl Checks for existence of MODULES and gathers its build flags with
1347b8df70beSmrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1348b8df70beSmrgdnl and VARIABLE-PREFIX_LIBS from --libs.
1349b8df70beSmrgdnl
1350b8df70beSmrgdnl Note that if there is a possibility the first call to
1351b8df70beSmrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1352b8df70beSmrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1353b8df70beSmrgdnl configure.ac.
1354b8df70beSmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
1355b8df70beSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1356b8df70beSmrg_save_PKG_CONFIG=$PKG_CONFIG
1357b8df70beSmrgPKG_CONFIG="$PKG_CONFIG --static"
1358b8df70beSmrgPKG_CHECK_MODULES($@)
1359b8df70beSmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
1360b8df70beSmrg])dnl PKG_CHECK_MODULES_STATIC
1361b8df70beSmrg
1362b8df70beSmrg
1363b8df70beSmrgdnl PKG_INSTALLDIR([DIRECTORY])
1364b8df70beSmrgdnl -------------------------
1365b8df70beSmrgdnl Since: 0.27
1366b8df70beSmrgdnl
1367b8df70beSmrgdnl Substitutes the variable pkgconfigdir as the location where a module
1368b8df70beSmrgdnl should install pkg-config .pc files. By default the directory is
1369b8df70beSmrgdnl $libdir/pkgconfig, but the default can be changed by passing
1370b8df70beSmrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
1371b8df70beSmrgdnl parameter.
1372b8df70beSmrgAC_DEFUN([PKG_INSTALLDIR],
1373b8df70beSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1374b8df70beSmrgm4_pushdef([pkg_description],
1375b8df70beSmrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
1376b8df70beSmrgAC_ARG_WITH([pkgconfigdir],
1377b8df70beSmrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1378b8df70beSmrg    [with_pkgconfigdir=]pkg_default)
1379b8df70beSmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1380b8df70beSmrgm4_popdef([pkg_default])
1381b8df70beSmrgm4_popdef([pkg_description])
1382b8df70beSmrg])dnl PKG_INSTALLDIR
1383b8df70beSmrg
1384b8df70beSmrg
1385b8df70beSmrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1386b8df70beSmrgdnl --------------------------------
1387b8df70beSmrgdnl Since: 0.27
1388b8df70beSmrgdnl
1389b8df70beSmrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
1390b8df70beSmrgdnl module should install arch-independent pkg-config .pc files. By
1391b8df70beSmrgdnl default the directory is $datadir/pkgconfig, but the default can be
1392b8df70beSmrgdnl changed by passing DIRECTORY. The user can override through the
1393b8df70beSmrgdnl --with-noarch-pkgconfigdir parameter.
1394b8df70beSmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
1395b8df70beSmrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1396b8df70beSmrgm4_pushdef([pkg_description],
1397b8df70beSmrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1398b8df70beSmrgAC_ARG_WITH([noarch-pkgconfigdir],
1399b8df70beSmrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1400b8df70beSmrg    [with_noarch_pkgconfigdir=]pkg_default)
1401b8df70beSmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1402b8df70beSmrgm4_popdef([pkg_default])
1403b8df70beSmrgm4_popdef([pkg_description])
1404b8df70beSmrg])dnl PKG_NOARCH_INSTALLDIR
1405b8df70beSmrg
1406b8df70beSmrg
1407b8df70beSmrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1408b8df70beSmrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1409b8df70beSmrgdnl -------------------------------------------
1410b8df70beSmrgdnl Since: 0.28
1411b8df70beSmrgdnl
1412b8df70beSmrgdnl Retrieves the value of the pkg-config variable for the given module.
1413b8df70beSmrgAC_DEFUN([PKG_CHECK_VAR],
1414b8df70beSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1415b8df70beSmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1416b8df70beSmrg
1417b8df70beSmrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1418b8df70beSmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1419b8df70beSmrg
1420b8df70beSmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
1421b8df70beSmrg])dnl PKG_CHECK_VAR
14221c80d5b0Smrg
14231c80d5b0Smrgdnl fontutil.m4.  Generated from fontutil.m4.in by configure.
14241c80d5b0Smrgdnl
1425b8df70beSmrgdnl This file comes from X.Org's font-util 1.3.2
14261c80d5b0Smrgdnl
14271c80d5b0Smrgdnl Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
14281c80d5b0Smrgdnl
14291c80d5b0Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
14301c80d5b0Smrgdnl copy of this software and associated documentation files (the "Software"),
14311c80d5b0Smrgdnl to deal in the Software without restriction, including without limitation
14321c80d5b0Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
14331c80d5b0Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
14341c80d5b0Smrgdnl Software is furnished to do so, subject to the following conditions:
14351c80d5b0Smrgdnl
14361c80d5b0Smrgdnl The above copyright notice and this permission notice (including the next
14371c80d5b0Smrgdnl paragraph) shall be included in all copies or substantial portions of the
14381c80d5b0Smrgdnl Software.
14391c80d5b0Smrgdnl
14401c80d5b0Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14411c80d5b0Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14421c80d5b0Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
14431c80d5b0Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14441c80d5b0Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14451c80d5b0Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
14461c80d5b0Smrgdnl DEALINGS IN THE SOFTWARE.
14471c80d5b0Smrgdnl
14481c80d5b0Smrgdnl --------------------------------------------------------------------
14491c80d5b0Smrgdnl
14501c80d5b0Smrgdnl Copyright 2005 Red Hat, Inc
14511c80d5b0Smrgdnl
14521c80d5b0Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
14531c80d5b0Smrgdnl documentation for any purpose is hereby granted without fee, provided that
14541c80d5b0Smrgdnl the above copyright notice appear in all copies and that both that
14551c80d5b0Smrgdnl copyright notice and this permission notice appear in supporting
14561c80d5b0Smrgdnl documentation.
14571c80d5b0Smrgdnl
14581c80d5b0Smrgdnl The above copyright notice and this permission notice shall be included
14591c80d5b0Smrgdnl in all copies or substantial portions of the Software.
14601c80d5b0Smrgdnl
14611c80d5b0Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14621c80d5b0Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14631c80d5b0Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
14641c80d5b0Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
14651c80d5b0Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
14661c80d5b0Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
14671c80d5b0Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
14681c80d5b0Smrgdnl
14691c80d5b0Smrgdnl Except as contained in this notice, the name of the copyright holders shall
14701c80d5b0Smrgdnl not be used in advertising or otherwise to promote the sale, use or
14711c80d5b0Smrgdnl other dealings in this Software without prior written authorization
14721c80d5b0Smrgdnl from the copyright holders.
14731c80d5b0Smrg
14741c80d5b0Smrg# XORG_FONT_MACROS_VERSION(required-version)
14751c80d5b0Smrg# ------------------------------------------
14761c80d5b0Smrg# Minimum version: 1.1.0
14771c80d5b0Smrg#
14781c80d5b0Smrg# If you're using a macro added in Version 1.1 or newer, include this in
14791c80d5b0Smrg# your configure.ac with the minimum required version, such as:
14801c80d5b0Smrg# XORG_FONT_MACROS_VERSION(1.1)
14811c80d5b0Smrg#
14821c80d5b0Smrg# To ensure that this macro is defined, also add:
14831c80d5b0Smrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
14841c80d5b0Smrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
14851c80d5b0Smrg#
14861c80d5b0Smrg#
14871c80d5b0Smrg# See the "minimum version" comment for each macro you use to see what
14881c80d5b0Smrg# version you require.
14891c80d5b0Smrgm4_defun([XORG_FONT_MACROS_VERSION],[
1490b8df70beSmrgm4_define([vers_have], [1.3.2])
14911c80d5b0Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
14921c80d5b0Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
14931c80d5b0Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
14941c80d5b0Smrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
14951c80d5b0Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
14961c80d5b0Smrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
14971c80d5b0Smrgm4_undefine([vers_have])
14981c80d5b0Smrgm4_undefine([maj_have])
14991c80d5b0Smrgm4_undefine([maj_needed])
15001c80d5b0Smrg]) # XORG_FONT_MACROS_VERSION
15011c80d5b0Smrg
15021c80d5b0Smrg# XORG_FONT_CHECK_{maps}()
15031c80d5b0Smrg# ------------------------
15041c80d5b0Smrg# Minimum version: 1.0.0
15051c80d5b0Smrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
15061c80d5b0Smrg# JISX0201 or KOI8_R.  By default, they are all enabled.
15071c80d5b0Smrg
15081c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
15091c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
15101c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
15111c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
15121c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
15131c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
15141c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
15151c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
15161c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
15171c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
15181c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
15191c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
15201c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
15211c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
15221c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
15231c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
15241c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
15251c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
15261c80d5b0Smrg
15271c80d5b0Smrg# XORG_FONT_CHECK_ENCODING(encoding)
15281c80d5b0Smrg# ----------------------------------
15291c80d5b0Smrg# Minimum version: 1.1.0
15301c80d5b0Smrg# This macro adds --enable/disable-<encoding>, enabled by default.
15311c80d5b0Smrg# It replaced individual copies of this code in the above macros in 1.1.
15321c80d5b0Smrg# Currently assumes encoding names will be all upper-case - add m4_toupper
15331c80d5b0Smrg# calls if this is not true in the future.
15341c80d5b0Smrg
15351c80d5b0SmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
15361c80d5b0Smrg	AC_ARG_ENABLE(m4_tolower($1),
15371c80d5b0Smrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
15381c80d5b0Smrg				[Build $1 fonts (default: yes)]),
15391c80d5b0Smrg		[AS_TR_SH($1)=$enableval])
15401c80d5b0Smrg	AC_MSG_CHECKING([whether to build $1 fonts])
15411c80d5b0Smrg	AC_MSG_RESULT($[AS_TR_SH($1)])
15421c80d5b0Smrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
15431c80d5b0Smrg]) # XORG_FONT_CHECK_ENCODING
15441c80d5b0Smrg
15451c80d5b0Smrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
15461c80d5b0Smrg# -----------------------------------------------------
15471c80d5b0Smrg# Minimum version: 1.1.0
1548d7ffce2aSmrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
1549d7ffce2aSmrg# Add a shorthand --enable/disable-all-encodings option.
1550d7ffce2aSmrg
1551d7ffce2aSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
1552d7ffce2aSmrg	AC_ARG_ENABLE([all-encodings],
1553d7ffce2aSmrg		AS_HELP_STRING([--disable-all-encodings],
1554d7ffce2aSmrg				[Disable building of all font encodings]),
1555d7ffce2aSmrg		[m4_foreach_w([enc], [$1], [
1556d7ffce2aSmrg			AS_TR_SH(enc)=$enableval
1557d7ffce2aSmrg		])],
1558d7ffce2aSmrg		[m4_foreach_w([enc], [$1], [
1559d7ffce2aSmrg			AS_TR_SH(enc)=yes
1560d7ffce2aSmrg		])])
1561d7ffce2aSmrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
1562d7ffce2aSmrg]) # XORG_FONT_CHECK_ENCODING_LIST
1563d7ffce2aSmrg
1564d7ffce2aSmrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
1565d7ffce2aSmrg# ------------------------------------------
1566d7ffce2aSmrg# Minimum version: 1.1.0
1567d7ffce2aSmrg#
1568d7ffce2aSmrg# Simple wrapper around AC_PATH_PROG that errors if not found
1569d7ffce2aSmrg#
1570d7ffce2aSmrg
1571d7ffce2aSmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
1572d7ffce2aSmrg	AC_PATH_PROG($1, $2)
1573d7ffce2aSmrg	if test x"$$1" = x; then
1574d7ffce2aSmrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
1575d7ffce2aSmrg	fi
1576d7ffce2aSmrg])
1577d7ffce2aSmrg
1578d7ffce2aSmrg
1579d7ffce2aSmrg# XORG_FONT_FCCACHE()
1580d7ffce2aSmrg# -------------------
1581d7ffce2aSmrg# Minimum version: 1.1.0
1582d7ffce2aSmrg#
1583d7ffce2aSmrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
1584d7ffce2aSmrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
15851c80d5b0Smrg# to run fc-cache if found and not installing to $DESTDIR and not
15861c80d5b0Smrg# cross-compiling
1587d7ffce2aSmrg#
1588d7ffce2aSmrg# fc-cache is optional, not required, and should be skipped when making
15891c80d5b0Smrg# packages (installing to $DESTDIR) or cross-compiling
1590d7ffce2aSmrg#
1591d7ffce2aSmrgAC_DEFUN([XORG_FONT_FCCACHE],[
1592d7ffce2aSmrg	AC_PATH_PROG(FCCACHE, fc-cache)
1593d7ffce2aSmrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
15941c80d5b0Smrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
1595d7ffce2aSmrg		RUN_FCCACHE="${FCCACHE_WARN}"
1596d7ffce2aSmrg	else
1597d7ffce2aSmrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
1598d7ffce2aSmrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
1599d7ffce2aSmrg	fi
1600d7ffce2aSmrg	AC_SUBST([RUN_FCCACHE])
1601d7ffce2aSmrg])
1602d7ffce2aSmrg
16031c80d5b0Smrg# XORG_FONT_MKFONTDIR()
16041c80d5b0Smrg# -------------------
16051c80d5b0Smrg# Minimum version: 1.3.0
16061c80d5b0Smrg#
16071c80d5b0Smrg# Set MKFONTDIR to path to mkfontdir.
16081c80d5b0Smrg#
16091c80d5b0Smrg# If cross-compiling, and if mkdir is not found, use a shell command
16101c80d5b0Smrg# which warns mkfontdir needs to be run on the target
16111c80d5b0Smrg#
16121c80d5b0Smrg# If not cross-compiling, mkfontdir must be found
16131c80d5b0Smrg#
16141c80d5b0SmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
16151c80d5b0Smrg	if test x"$cross_compiling" != x"no" ; then
16161c80d5b0Smrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
16171c80d5b0Smrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
16181c80d5b0Smrg
16191c80d5b0Smrg		if test x"$MKFONTDIR" = x; then
16201c80d5b0Smrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
16211c80d5b0Smrg		fi
16221c80d5b0Smrg	else
16231c80d5b0Smrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
16241c80d5b0Smrg	fi
16251c80d5b0Smrg
16261c80d5b0Smrg	AC_SUBST([MKFONTDIR])
16271c80d5b0Smrg])
1628d7ffce2aSmrg
1629d7ffce2aSmrg# XORG_FONT_COMMON_UTILS()
1630d7ffce2aSmrg# ------------------------
1631d7ffce2aSmrg# Minimum version: 1.1.0
1632d7ffce2aSmrg#
1633d7ffce2aSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
1634d7ffce2aSmrg
1635d7ffce2aSmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
1636d7ffce2aSmrg	XORG_FONT_FCCACHE
16371c80d5b0Smrg	XORG_FONT_MKFONTDIR
1638d7ffce2aSmrg])
1639d7ffce2aSmrg
1640d7ffce2aSmrg# XORG_FONT_SCALED_UTILS()
1641d7ffce2aSmrg# ------------------------
1642d7ffce2aSmrg# Minimum version: 1.1.0
1643d7ffce2aSmrg#
1644d7ffce2aSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
1645d7ffce2aSmrg# (TrueType, OpenType, Type1)
1646d7ffce2aSmrg
1647d7ffce2aSmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
1648d7ffce2aSmrg	XORG_FONT_COMMON_UTILS
1649d7ffce2aSmrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
1650d7ffce2aSmrg])
1651d7ffce2aSmrg
1652d7ffce2aSmrg# XORG_FONT_BDF_UTILS()
1653d7ffce2aSmrg# ---------------------
1654d7ffce2aSmrg# Minimum version: 1.1.0
1655d7ffce2aSmrg#
1656d7ffce2aSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
1657d7ffce2aSmrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
1658d7ffce2aSmrg# PCF output files created by bdftopcf
1659d7ffce2aSmrg
1660d7ffce2aSmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
1661d7ffce2aSmrg	XORG_FONT_COMMON_UTILS
1662d7ffce2aSmrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
1663d7ffce2aSmrg	XORG_FONT_CHECK_COMPRESSION
1664d7ffce2aSmrg])
1665d7ffce2aSmrg
1666d7ffce2aSmrg# XORG_FONT_CHECK_COMPRESSION()
1667d7ffce2aSmrg# -----------------------------
1668d7ffce2aSmrg# Minimum version: 1.1.0
1669d7ffce2aSmrg#
1670d7ffce2aSmrg# Offer a --with-compression flag to control what compression method is
1671d7ffce2aSmrg# used for pcf font files.   Offers all the methods currently supported
1672d7ffce2aSmrg# by libXfont, including no compression.
1673d7ffce2aSmrg
1674d7ffce2aSmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
1675d7ffce2aSmrg	AC_MSG_CHECKING([font compression method])
1676d7ffce2aSmrg	AC_ARG_WITH(compression,
1677d7ffce2aSmrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
1678d7ffce2aSmrg			 [compression method to use on pcf fonts])],
1679d7ffce2aSmrg         [compression="$withval"], [compression="yes"])
1680d7ffce2aSmrg	if test x"$compression" = "xyes" ; then
1681d7ffce2aSmrg		compression="gzip"
1682d7ffce2aSmrg	fi
1683d7ffce2aSmrg	AC_MSG_RESULT([${compression}])
1684d7ffce2aSmrg	case ${compression} in
1685d7ffce2aSmrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
1686d7ffce2aSmrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;;
1687d7ffce2aSmrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
1688d7ffce2aSmrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
1689d7ffce2aSmrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
1690d7ffce2aSmrg	esac
1691d7ffce2aSmrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
1692d7ffce2aSmrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
1693d7ffce2aSmrg	fi
1694d7ffce2aSmrg	AC_SUBST([COMPRESS_SUFFIX])
1695d7ffce2aSmrg])
1696d7ffce2aSmrg
1697d7ffce2aSmrg# XORG_FONT_UCS2ANY()
1698d7ffce2aSmrg# -------------------
1699d7ffce2aSmrg# Minimum version: 1.1.0
1700d7ffce2aSmrg#
1701d7ffce2aSmrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
1702d7ffce2aSmrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
1703d7ffce2aSmrg# Also call pkg-config to find the directory with the encoding files needed
1704d7ffce2aSmrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
1705d7ffce2aSmrg
1706d7ffce2aSmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
170741fe0c2aSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1708d7ffce2aSmrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
1709d7ffce2aSmrg	PKG_CHECK_MODULES(MAPS, [fontutil])
1710d7ffce2aSmrg	AC_MSG_CHECKING([for ucs2any encoding data files])
171141fe0c2aSmrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
1712d7ffce2aSmrg	AC_SUBST(MAPFILES_PATH)
1713d7ffce2aSmrg	AC_MSG_RESULT([${MAPFILES_PATH}])
1714d7ffce2aSmrg])
1715d7ffce2aSmrg
1716d7ffce2aSmrg
1717d7ffce2aSmrg
1718d7ffce2aSmrg# XORG_FONT_FC_CONFDIR()
1719d7ffce2aSmrg# --------------------
1720d7ffce2aSmrg# Minimum version: 1.2.0
1721d7ffce2aSmrg#
1722d7ffce2aSmrg# Sets FC_CONFDIR to the fontconfig config directory
1723d7ffce2aSmrg# (which should be --with-confdir=... when building fontconfig)
1724d7ffce2aSmrg# found from:
1725d7ffce2aSmrg#	--with-fc-confdir=...
1726d7ffce2aSmrg#	pkg-config --variable=confdir fontconfig
1727d7ffce2aSmrg#	${sysconfdir}/fonts
1728d7ffce2aSmrg
1729d7ffce2aSmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
1730d7ffce2aSmrg	dnl Ensure $PKG_CONFIG is set first
1731d7ffce2aSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1732d7ffce2aSmrg
1733d7ffce2aSmrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
1734d7ffce2aSmrg	AC_ARG_WITH(fc-confdir,
1735d7ffce2aSmrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
1736d7ffce2aSmrg			   [Path to fontconfig's configuration directory]),
1737d7ffce2aSmrg		    [FC_CONFDIR="$withval"])
1738d7ffce2aSmrg	# if --with-fc-confdir was not specified
1739d7ffce2aSmrg	if test "x${FC_CONFDIR}" = "x"; then
1740d7ffce2aSmrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
1741d7ffce2aSmrg	fi
1742d7ffce2aSmrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
1743d7ffce2aSmrg	if test "x${FC_CONFDIR}" = "x"; then
1744d7ffce2aSmrg		FC_CONFDIR="${sysconfdir}/fonts"
1745d7ffce2aSmrg	fi
1746d7ffce2aSmrg	AC_SUBST(FC_CONFDIR)
1747d7ffce2aSmrg	AC_MSG_RESULT([${FC_CONFDIR}])
1748d7ffce2aSmrg])
1749d7ffce2aSmrg
1750d7ffce2aSmrg
1751d7ffce2aSmrg
1752d7ffce2aSmrg# XORG_FONTROOTDIR()
1753d7ffce2aSmrg# --------------------
1754d7ffce2aSmrg# Minimum version: 1.1.0
1755d7ffce2aSmrg#
1756d7ffce2aSmrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
1757d7ffce2aSmrg# found from:
1758d7ffce2aSmrg#	--with-fontrootdir
1759d7ffce2aSmrg#	pkg-config --variable=fontrootdir fontutil
1760d7ffce2aSmrg#	${datadir}/fonts/X11
1761d7ffce2aSmrg
1762d7ffce2aSmrgAC_DEFUN([XORG_FONTROOTDIR],[
1763d7ffce2aSmrg	dnl Ensure $PKG_CONFIG is set first
1764d7ffce2aSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1765d7ffce2aSmrg
1766d7ffce2aSmrg	AC_MSG_CHECKING([for root directory for font files])
1767d7ffce2aSmrg	AC_ARG_WITH(fontrootdir,
1768d7ffce2aSmrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
1769d7ffce2aSmrg			   [Path to root directory for font files]),
1770d7ffce2aSmrg		    [FONTROOTDIR="$withval"])
1771d7ffce2aSmrg	# if --with-fontrootdir not specified...
1772d7ffce2aSmrg	if test "x${FONTROOTDIR}" = "x"; then
1773d7ffce2aSmrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
1774d7ffce2aSmrg	fi
1775d7ffce2aSmrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
1776d7ffce2aSmrg	if test "x${FONTROOTDIR}" = "x"; then
1777d7ffce2aSmrg		FONTROOTDIR="${datadir}/fonts/X11"
1778d7ffce2aSmrg	fi
1779d7ffce2aSmrg	AC_SUBST(FONTROOTDIR)
1780d7ffce2aSmrg	AC_MSG_RESULT([${FONTROOTDIR}])
1781d7ffce2aSmrg])
1782d7ffce2aSmrg
1783d7ffce2aSmrg# XORG_FONTSUBDIR(variable, flag, subdir)
1784d7ffce2aSmrg# ---------------------------------------
1785d7ffce2aSmrg# Minimum version: 1.1.0
1786d7ffce2aSmrg#
1787d7ffce2aSmrg# Offer a --with-<flag> flag to control directory for font installation
1788d7ffce2aSmrg# Default is the specified <subdir> of the font root directory.
1789d7ffce2aSmrg# Sets <variable> to the selected directory
1790d7ffce2aSmrg
1791d7ffce2aSmrgAC_DEFUN([XORG_FONTSUBDIR],[
1792d7ffce2aSmrg	AC_REQUIRE([XORG_FONTROOTDIR])
1793d7ffce2aSmrg
1794d7ffce2aSmrg	AC_MSG_CHECKING([for directory for $3 files])
1795d7ffce2aSmrg	AC_ARG_WITH($2,
1796d7ffce2aSmrg		    [AS_HELP_STRING([--with-$2=DIR],
1797d7ffce2aSmrg				    [Path to $3 files [FONTROOTDIR/$3]])],
1798d7ffce2aSmrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
1799d7ffce2aSmrg	AC_SUBST($1)
1800d7ffce2aSmrg	AC_MSG_RESULT([${$1}])
1801d7ffce2aSmrg]) # XORG_FONTSUBDIR
1802d7ffce2aSmrg
1803d7ffce2aSmrg# XORG_FONTDIR(subdir)
1804d7ffce2aSmrg# --------------------
1805d7ffce2aSmrg# Minimum version: 1.1.0
1806d7ffce2aSmrg#
1807d7ffce2aSmrg# Offer a --with-fontdir flag to control directory for font installation
1808d7ffce2aSmrg# Default is the specified subdir of the font root directory.
1809d7ffce2aSmrg# Sets FONTDIR to the selected directory
1810d7ffce2aSmrg
1811d7ffce2aSmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
1812d7ffce2aSmrg
1813d7ffce2aSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
18144c61c93dSmrgdnl
181541fe0c2aSmrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
181641fe0c2aSmrgdnl
1817d7ffce2aSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1818d7ffce2aSmrgdnl copy of this software and associated documentation files (the "Software"),
1819d7ffce2aSmrgdnl to deal in the Software without restriction, including without limitation
1820d7ffce2aSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1821d7ffce2aSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1822d7ffce2aSmrgdnl Software is furnished to do so, subject to the following conditions:
1823d7ffce2aSmrgdnl
1824d7ffce2aSmrgdnl The above copyright notice and this permission notice (including the next
1825d7ffce2aSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1826d7ffce2aSmrgdnl Software.
1827d7ffce2aSmrgdnl
1828d7ffce2aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1829d7ffce2aSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1830d7ffce2aSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1831d7ffce2aSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1832d7ffce2aSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1833d7ffce2aSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1834d7ffce2aSmrgdnl DEALINGS IN THE SOFTWARE.
18354c61c93dSmrg
18364c61c93dSmrg# XORG_MACROS_VERSION(required-version)
18374c61c93dSmrg# -------------------------------------
18384c61c93dSmrg# Minimum version: 1.1.0
18394c61c93dSmrg#
18404c61c93dSmrg# If you're using a macro added in Version 1.1 or newer, include this in
18414c61c93dSmrg# your configure.ac with the minimum required version, such as:
18424c61c93dSmrg# XORG_MACROS_VERSION(1.1)
18434c61c93dSmrg#
18444c61c93dSmrg# To ensure that this macro is defined, also add:
18454c61c93dSmrg# m4_ifndef([XORG_MACROS_VERSION],
18464c61c93dSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
18474c61c93dSmrg#
18484c61c93dSmrg#
184941fe0c2aSmrg# See the "minimum version" comment for each macro you use to see what
18504c61c93dSmrg# version you require.
18514c61c93dSmrgm4_defun([XORG_MACROS_VERSION],[
1852b8df70beSmrgm4_define([vers_have], [1.19.3])
18534c61c93dSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
18544c61c93dSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
18554c61c93dSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
18564c61c93dSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
18574c61c93dSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
18584c61c93dSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
18594c61c93dSmrgm4_undefine([vers_have])
18604c61c93dSmrgm4_undefine([maj_have])
18614c61c93dSmrgm4_undefine([maj_needed])
18624c61c93dSmrg]) # XORG_MACROS_VERSION
18634c61c93dSmrg
18644c61c93dSmrg# XORG_PROG_RAWCPP()
18654c61c93dSmrg# ------------------
18664c61c93dSmrg# Minimum version: 1.0.0
18674c61c93dSmrg#
18684c61c93dSmrg# Find cpp program and necessary flags for use in pre-processing text files
18694c61c93dSmrg# such as man pages and config files
18704c61c93dSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
18714c61c93dSmrgAC_REQUIRE([AC_PROG_CPP])
1872b8df70beSmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
18734c61c93dSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
18744c61c93dSmrg
18754c61c93dSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
18764c61c93dSmrg# which is not the best choice for supporting other OS'es, but covers most
18774c61c93dSmrg# of the ones we need for now.
18784c61c93dSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
18791c80d5b0SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
18804c61c93dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
18814c61c93dSmrg	AC_MSG_RESULT([no])
18824c61c93dSmrgelse
18834c61c93dSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
18844c61c93dSmrg		RAWCPPFLAGS=-undef
18854c61c93dSmrg		AC_MSG_RESULT([yes])
18864c61c93dSmrg	# under Cygwin unix is still defined even with -undef
18874c61c93dSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
18884c61c93dSmrg		RAWCPPFLAGS="-undef -ansi"
18894c61c93dSmrg		AC_MSG_RESULT([yes, with -ansi])
18904c61c93dSmrg	else
18914c61c93dSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
18924c61c93dSmrg	fi
18934c61c93dSmrgfi
18944c61c93dSmrgrm -f conftest.$ac_ext
18954c61c93dSmrg
18964c61c93dSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
18971c80d5b0SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
18984c61c93dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
18994c61c93dSmrg	AC_MSG_RESULT([no])
19004c61c93dSmrgelse
19014c61c93dSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
190241fe0c2aSmrg		TRADITIONALCPPFLAGS="-traditional"
19034c61c93dSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
19044c61c93dSmrg		AC_MSG_RESULT([yes])
19054c61c93dSmrg	else
19064c61c93dSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
19074c61c93dSmrg	fi
19084c61c93dSmrgfi
19094c61c93dSmrgrm -f conftest.$ac_ext
19104c61c93dSmrgAC_SUBST(RAWCPPFLAGS)
191141fe0c2aSmrgAC_SUBST(TRADITIONALCPPFLAGS)
19124c61c93dSmrg]) # XORG_PROG_RAWCPP
19134c61c93dSmrg
19144c61c93dSmrg# XORG_MANPAGE_SECTIONS()
19154c61c93dSmrg# -----------------------
19164c61c93dSmrg# Minimum version: 1.0.0
19174c61c93dSmrg#
19184c61c93dSmrg# Determine which sections man pages go in for the different man page types
19194c61c93dSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
19204c61c93dSmrg# Not sure if there's any better way than just hardcoding by OS name.
19214c61c93dSmrg# Override default settings by setting environment variables
1922d7ffce2aSmrg# Added MAN_SUBSTS in version 1.8
1923d7ffce2aSmrg# Added AC_PROG_SED in version 1.8
19244c61c93dSmrg
19254c61c93dSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
19264c61c93dSmrgAC_REQUIRE([AC_CANONICAL_HOST])
1927d7ffce2aSmrgAC_REQUIRE([AC_PROG_SED])
19284c61c93dSmrg
1929b8df70beSmrgcase $host_os in
1930b8df70beSmrg    solaris*)
1931b8df70beSmrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1932b8df70beSmrg        # check for a man page file found in later versions that use
1933b8df70beSmrg        # traditional section numbers instead
1934b8df70beSmrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1935b8df70beSmrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1936b8df70beSmrg        ;;
1937b8df70beSmrg    *) SYSV_MAN_SECTIONS=false ;;
1938b8df70beSmrgesac
1939b8df70beSmrg
19404c61c93dSmrgif test x$APP_MAN_SUFFIX = x    ; then
19414c61c93dSmrg    APP_MAN_SUFFIX=1
19424c61c93dSmrgfi
19434c61c93dSmrgif test x$APP_MAN_DIR = x    ; then
19444c61c93dSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
19454c61c93dSmrgfi
19464c61c93dSmrg
19474c61c93dSmrgif test x$LIB_MAN_SUFFIX = x    ; then
19484c61c93dSmrg    LIB_MAN_SUFFIX=3
19494c61c93dSmrgfi
19504c61c93dSmrgif test x$LIB_MAN_DIR = x    ; then
19514c61c93dSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
19524c61c93dSmrgfi
19534c61c93dSmrg
19544c61c93dSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1955b8df70beSmrg    case $SYSV_MAN_SECTIONS in
1956b8df70beSmrg	true)				FILE_MAN_SUFFIX=4  ;;
195741fe0c2aSmrg	*)				FILE_MAN_SUFFIX=5  ;;
19584c61c93dSmrg    esac
19594c61c93dSmrgfi
19604c61c93dSmrgif test x$FILE_MAN_DIR = x    ; then
19614c61c93dSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
19624c61c93dSmrgfi
19634c61c93dSmrg
19644c61c93dSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1965b8df70beSmrg    case $SYSV_MAN_SECTIONS in
1966b8df70beSmrg	true)				MISC_MAN_SUFFIX=5  ;;
196741fe0c2aSmrg	*)				MISC_MAN_SUFFIX=7  ;;
19684c61c93dSmrg    esac
19694c61c93dSmrgfi
19704c61c93dSmrgif test x$MISC_MAN_DIR = x    ; then
19714c61c93dSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
19724c61c93dSmrgfi
19734c61c93dSmrg
19744c61c93dSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1975b8df70beSmrg    case $SYSV_MAN_SECTIONS in
1976b8df70beSmrg	true)				DRIVER_MAN_SUFFIX=7  ;;
197741fe0c2aSmrg	*)				DRIVER_MAN_SUFFIX=4  ;;
19784c61c93dSmrg    esac
19794c61c93dSmrgfi
19804c61c93dSmrgif test x$DRIVER_MAN_DIR = x    ; then
19814c61c93dSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
19824c61c93dSmrgfi
19834c61c93dSmrg
19844c61c93dSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1985b8df70beSmrg    case $SYSV_MAN_SECTIONS in
1986b8df70beSmrg	true)				ADMIN_MAN_SUFFIX=1m ;;
198741fe0c2aSmrg	*)				ADMIN_MAN_SUFFIX=8  ;;
19884c61c93dSmrg    esac
19894c61c93dSmrgfi
19904c61c93dSmrgif test x$ADMIN_MAN_DIR = x    ; then
19914c61c93dSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
19924c61c93dSmrgfi
19934c61c93dSmrg
19944c61c93dSmrg
19954c61c93dSmrgAC_SUBST([APP_MAN_SUFFIX])
19964c61c93dSmrgAC_SUBST([LIB_MAN_SUFFIX])
19974c61c93dSmrgAC_SUBST([FILE_MAN_SUFFIX])
19984c61c93dSmrgAC_SUBST([MISC_MAN_SUFFIX])
19994c61c93dSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
20004c61c93dSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
20014c61c93dSmrgAC_SUBST([APP_MAN_DIR])
20024c61c93dSmrgAC_SUBST([LIB_MAN_DIR])
20034c61c93dSmrgAC_SUBST([FILE_MAN_DIR])
20044c61c93dSmrgAC_SUBST([MISC_MAN_DIR])
20054c61c93dSmrgAC_SUBST([DRIVER_MAN_DIR])
20064c61c93dSmrgAC_SUBST([ADMIN_MAN_DIR])
2007d7ffce2aSmrg
2008d7ffce2aSmrgXORG_MAN_PAGE="X Version 11"
2009d7ffce2aSmrgAC_SUBST([XORG_MAN_PAGE])
2010d7ffce2aSmrgMAN_SUBSTS="\
2011d7ffce2aSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
2012d7ffce2aSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
2013d7ffce2aSmrg	-e 's|__xservername__|Xorg|g' \
2014d7ffce2aSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
2015d7ffce2aSmrg	-e 's|__projectroot__|\$(prefix)|g' \
2016d7ffce2aSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
2017d7ffce2aSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
2018d7ffce2aSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
2019d7ffce2aSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
2020d7ffce2aSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
2021d7ffce2aSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
2022d7ffce2aSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
2023d7ffce2aSmrgAC_SUBST([MAN_SUBSTS])
2024d7ffce2aSmrg
20254c61c93dSmrg]) # XORG_MANPAGE_SECTIONS
20264c61c93dSmrg
2027d7ffce2aSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
2028d7ffce2aSmrg# ------------------------
2029d7ffce2aSmrg# Minimum version: 1.7.0
2030d7ffce2aSmrg#
2031d7ffce2aSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
2032d7ffce2aSmrg# provided by xorg-sgml-doctools, if installed.
2033d7ffce2aSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
2034d7ffce2aSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
2035d7ffce2aSmrgXORG_SGML_PATH=
2036d7ffce2aSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
2037d7ffce2aSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
2038d7ffce2aSmrg    [m4_ifval([$1],[:],
2039d7ffce2aSmrg        [if test x"$cross_compiling" != x"yes" ; then
2040d7ffce2aSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
2041d7ffce2aSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
2042d7ffce2aSmrg         fi])
2043d7ffce2aSmrg    ])
2044d7ffce2aSmrg
2045d7ffce2aSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
2046d7ffce2aSmrg# the path and the name of the doc stylesheet
2047d7ffce2aSmrgif test "x$XORG_SGML_PATH" != "x" ; then
2048d7ffce2aSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
2049d7ffce2aSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
2050d7ffce2aSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
2051d7ffce2aSmrgelse
2052d7ffce2aSmrg   AC_MSG_RESULT([no])
2053d7ffce2aSmrgfi
2054d7ffce2aSmrg
2055d7ffce2aSmrgAC_SUBST(XORG_SGML_PATH)
2056d7ffce2aSmrgAC_SUBST(STYLESHEET_SRCDIR)
2057d7ffce2aSmrgAC_SUBST(XSL_STYLESHEET)
2058d7ffce2aSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
2059d7ffce2aSmrg]) # XORG_CHECK_SGML_DOCTOOLS
2060d7ffce2aSmrg
20614c61c93dSmrg# XORG_CHECK_LINUXDOC
20624c61c93dSmrg# -------------------
20634c61c93dSmrg# Minimum version: 1.0.0
20644c61c93dSmrg#
20654c61c93dSmrg# Defines the variable MAKE_TEXT if the necessary tools and
20664c61c93dSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
20674c61c93dSmrg# Whether or not the necessary tools and files are found can be checked
20684c61c93dSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
20694c61c93dSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
2070d7ffce2aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
2071d7ffce2aSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
20724c61c93dSmrg
20734c61c93dSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
20744c61c93dSmrg
2075d7ffce2aSmrgAC_MSG_CHECKING([whether to build documentation])
20764c61c93dSmrg
2077d7ffce2aSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
20784c61c93dSmrg   BUILDDOC=yes
20794c61c93dSmrgelse
20804c61c93dSmrg   BUILDDOC=no
20814c61c93dSmrgfi
20824c61c93dSmrg
20834c61c93dSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
20844c61c93dSmrg
20854c61c93dSmrgAC_MSG_RESULT([$BUILDDOC])
20864c61c93dSmrg
2087d7ffce2aSmrgAC_MSG_CHECKING([whether to build pdf documentation])
20884c61c93dSmrg
2089d7ffce2aSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
20904c61c93dSmrg   BUILDPDFDOC=yes
20914c61c93dSmrgelse
20924c61c93dSmrg   BUILDPDFDOC=no
20934c61c93dSmrgfi
20944c61c93dSmrg
20954c61c93dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
20964c61c93dSmrg
20974c61c93dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
20984c61c93dSmrg
2099d7ffce2aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
21004c61c93dSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
21014c61c93dSmrgMAKE_PDF="$PS2PDF"
21024c61c93dSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
21034c61c93dSmrg
21044c61c93dSmrgAC_SUBST(MAKE_TEXT)
21054c61c93dSmrgAC_SUBST(MAKE_PS)
21064c61c93dSmrgAC_SUBST(MAKE_PDF)
21074c61c93dSmrgAC_SUBST(MAKE_HTML)
21084c61c93dSmrg]) # XORG_CHECK_LINUXDOC
21094c61c93dSmrg
21104c61c93dSmrg# XORG_CHECK_DOCBOOK
21114c61c93dSmrg# -------------------
21124c61c93dSmrg# Minimum version: 1.0.0
21134c61c93dSmrg#
21144c61c93dSmrg# Checks for the ability to build output formats from SGML DocBook source.
21154c61c93dSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
21164c61c93dSmrg# indicates whether the necessary tools and files are found and, if set,
21174c61c93dSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
21184c61c93dSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
2119d7ffce2aSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
2120d7ffce2aSmrg
21214c61c93dSmrgBUILDTXTDOC=no
21224c61c93dSmrgBUILDPDFDOC=no
21234c61c93dSmrgBUILDPSDOC=no
21244c61c93dSmrgBUILDHTMLDOC=no
21254c61c93dSmrg
21264c61c93dSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
21274c61c93dSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
21284c61c93dSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
21294c61c93dSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
21304c61c93dSmrg
2131d7ffce2aSmrgAC_MSG_CHECKING([whether to build text documentation])
2132d7ffce2aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
21334c61c93dSmrg   test x$BUILD_TXTDOC != xno; then
21344c61c93dSmrg	BUILDTXTDOC=yes
21354c61c93dSmrgfi
21364c61c93dSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
21374c61c93dSmrgAC_MSG_RESULT([$BUILDTXTDOC])
21384c61c93dSmrg
2139d7ffce2aSmrgAC_MSG_CHECKING([whether to build PDF documentation])
2140d7ffce2aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
21414c61c93dSmrg   test x$BUILD_PDFDOC != xno; then
21424c61c93dSmrg	BUILDPDFDOC=yes
21434c61c93dSmrgfi
21444c61c93dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
21454c61c93dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
21464c61c93dSmrg
2147d7ffce2aSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
2148d7ffce2aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
21494c61c93dSmrg   test x$BUILD_PSDOC != xno; then
21504c61c93dSmrg	BUILDPSDOC=yes
21514c61c93dSmrgfi
21524c61c93dSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
21534c61c93dSmrgAC_MSG_RESULT([$BUILDPSDOC])
21544c61c93dSmrg
2155d7ffce2aSmrgAC_MSG_CHECKING([whether to build HTML documentation])
2156d7ffce2aSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
21574c61c93dSmrg   test x$BUILD_HTMLDOC != xno; then
21584c61c93dSmrg	BUILDHTMLDOC=yes
21594c61c93dSmrgfi
21604c61c93dSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
21614c61c93dSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
21624c61c93dSmrg
21634c61c93dSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
21644c61c93dSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
21654c61c93dSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
21664c61c93dSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
21674c61c93dSmrg
21684c61c93dSmrgAC_SUBST(MAKE_TEXT)
21694c61c93dSmrgAC_SUBST(MAKE_PS)
21704c61c93dSmrgAC_SUBST(MAKE_PDF)
21714c61c93dSmrgAC_SUBST(MAKE_HTML)
21724c61c93dSmrg]) # XORG_CHECK_DOCBOOK
21734c61c93dSmrg
2174d7ffce2aSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
2175d7ffce2aSmrg# ----------------
2176d7ffce2aSmrg# Minimum version: 1.5.0
2177d7ffce2aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2178d7ffce2aSmrg#
2179d7ffce2aSmrg# Documentation tools are not always available on all platforms and sometimes
2180d7ffce2aSmrg# not at the appropriate level. This macro enables a module to test for the
2181d7ffce2aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2182d7ffce2aSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
2183d7ffce2aSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
2184d7ffce2aSmrg# --with-xmlto assumes 'auto'.
2185d7ffce2aSmrg#
2186d7ffce2aSmrg# Interface to module:
2187d7ffce2aSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
2188d7ffce2aSmrg# XMLTO:	returns the path of the xmlto program found
2189d7ffce2aSmrg#		returns the path set by the user in the environment
2190d7ffce2aSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
2191d7ffce2aSmrg#		'no' user instructs the module not to use xmlto
2192d7ffce2aSmrg#
2193d7ffce2aSmrg# Added in version 1.10.0
2194d7ffce2aSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
2195d7ffce2aSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
2196d7ffce2aSmrg#
2197d7ffce2aSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
2198d7ffce2aSmrg#
2199d7ffce2aSmrgAC_DEFUN([XORG_WITH_XMLTO],[
2200d7ffce2aSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
2201d7ffce2aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2202d7ffce2aSmrgAC_ARG_WITH(xmlto,
2203d7ffce2aSmrg	AS_HELP_STRING([--with-xmlto],
2204d7ffce2aSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
2205d7ffce2aSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
2206d7ffce2aSmrgm4_undefine([_defopt])
2207d7ffce2aSmrg
2208d7ffce2aSmrgif test "x$use_xmlto" = x"auto"; then
2209d7ffce2aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
2210d7ffce2aSmrg   if test "x$XMLTO" = "x"; then
2211d7ffce2aSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
2212d7ffce2aSmrg	have_xmlto=no
2213d7ffce2aSmrg   else
2214d7ffce2aSmrg        have_xmlto=yes
2215d7ffce2aSmrg   fi
2216d7ffce2aSmrgelif test "x$use_xmlto" = x"yes" ; then
2217d7ffce2aSmrg   AC_PATH_PROG([XMLTO], [xmlto])
2218d7ffce2aSmrg   if test "x$XMLTO" = "x"; then
2219d7ffce2aSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
2220d7ffce2aSmrg   fi
2221d7ffce2aSmrg   have_xmlto=yes
2222d7ffce2aSmrgelif test "x$use_xmlto" = x"no" ; then
2223d7ffce2aSmrg   if test "x$XMLTO" != "x"; then
2224d7ffce2aSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
2225d7ffce2aSmrg   fi
2226d7ffce2aSmrg   have_xmlto=no
2227d7ffce2aSmrgelse
2228d7ffce2aSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
2229d7ffce2aSmrgfi
2230d7ffce2aSmrg
2231d7ffce2aSmrg# Test for a minimum version of xmlto, if provided.
2232d7ffce2aSmrgm4_ifval([$1],
2233d7ffce2aSmrg[if test "$have_xmlto" = yes; then
2234d7ffce2aSmrg    # scrape the xmlto version
2235d7ffce2aSmrg    AC_MSG_CHECKING([the xmlto version])
2236d7ffce2aSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
2237d7ffce2aSmrg    AC_MSG_RESULT([$xmlto_version])
2238d7ffce2aSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
2239d7ffce2aSmrg        [if test "x$use_xmlto" = xauto; then
2240d7ffce2aSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
2241d7ffce2aSmrg            have_xmlto=no
2242d7ffce2aSmrg        else
2243d7ffce2aSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
2244d7ffce2aSmrg        fi])
2245d7ffce2aSmrgfi])
2246d7ffce2aSmrg
2247d7ffce2aSmrg# Test for the ability of xmlto to generate a text target
2248b8df70beSmrg#
2249b8df70beSmrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
2250b8df70beSmrg# following test for empty XML docbook files.
2251b8df70beSmrg# For compatibility reasons use the following empty XML docbook file and if
2252b8df70beSmrg# it fails try it again with a non-empty XML file.
2253d7ffce2aSmrghave_xmlto_text=no
2254d7ffce2aSmrgcat > conftest.xml << "EOF"
2255d7ffce2aSmrgEOF
2256d7ffce2aSmrgAS_IF([test "$have_xmlto" = yes],
2257d7ffce2aSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2258d7ffce2aSmrg             [have_xmlto_text=yes],
2259b8df70beSmrg             [# Try it again with a non-empty XML file.
2260b8df70beSmrg              cat > conftest.xml << "EOF"
2261b8df70beSmrg<x></x>
2262b8df70beSmrgEOF
2263b8df70beSmrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2264b8df70beSmrg                    [have_xmlto_text=yes],
2265b8df70beSmrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
2266d7ffce2aSmrgrm -f conftest.xml
2267d7ffce2aSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
2268d7ffce2aSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
2269d7ffce2aSmrg]) # XORG_WITH_XMLTO
2270d7ffce2aSmrg
22711c80d5b0Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
22721c80d5b0Smrg# --------------------------------------------
22731c80d5b0Smrg# Minimum version: 1.12.0
22741c80d5b0Smrg# Minimum version for optional DEFAULT argument: 1.12.0
2275d7ffce2aSmrg#
22761c80d5b0Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
22771c80d5b0Smrg# XML-based language used for the transformation of XML documents.
22781c80d5b0Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
22791c80d5b0Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
22801c80d5b0Smrg# The XSLT processor is often used as a standalone tool for transformations.
22811c80d5b0Smrg# It should not be assumed that this tool is used only to work with documnetation.
22821c80d5b0Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
2283d7ffce2aSmrg#
2284d7ffce2aSmrg# Interface to module:
22851c80d5b0Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
22861c80d5b0Smrg# XSLTPROC:	 returns the path of the xsltproc program found
22871c80d5b0Smrg#		 returns the path set by the user in the environment
22881c80d5b0Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
22891c80d5b0Smrg#		  'no' user instructs the module not to use xsltproc
22901c80d5b0Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
22911c80d5b0Smrg#
22921c80d5b0Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
22931c80d5b0Smrg#
22941c80d5b0SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
22951c80d5b0SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
22961c80d5b0Smrg# Preserves the interface, should it be implemented later
22971c80d5b0Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
22981c80d5b0Smrgm4_define([_defopt], m4_default([$2], [auto]))
22991c80d5b0SmrgAC_ARG_WITH(xsltproc,
23001c80d5b0Smrg	AS_HELP_STRING([--with-xsltproc],
23011c80d5b0Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
23021c80d5b0Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
23031c80d5b0Smrgm4_undefine([_defopt])
23041c80d5b0Smrg
23051c80d5b0Smrgif test "x$use_xsltproc" = x"auto"; then
23061c80d5b0Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
23071c80d5b0Smrg   if test "x$XSLTPROC" = "x"; then
23081c80d5b0Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
23091c80d5b0Smrg	have_xsltproc=no
23101c80d5b0Smrg   else
23111c80d5b0Smrg        have_xsltproc=yes
23121c80d5b0Smrg   fi
23131c80d5b0Smrgelif test "x$use_xsltproc" = x"yes" ; then
23141c80d5b0Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
23151c80d5b0Smrg   if test "x$XSLTPROC" = "x"; then
23161c80d5b0Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
23171c80d5b0Smrg   fi
23181c80d5b0Smrg   have_xsltproc=yes
23191c80d5b0Smrgelif test "x$use_xsltproc" = x"no" ; then
23201c80d5b0Smrg   if test "x$XSLTPROC" != "x"; then
23211c80d5b0Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
23221c80d5b0Smrg   fi
23231c80d5b0Smrg   have_xsltproc=no
23241c80d5b0Smrgelse
23251c80d5b0Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
23261c80d5b0Smrgfi
23271c80d5b0Smrg
23281c80d5b0SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
23291c80d5b0Smrg]) # XORG_WITH_XSLTPROC
23301c80d5b0Smrg
23311c80d5b0Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
23321c80d5b0Smrg# ----------------------------------------
23331c80d5b0Smrg# Minimum version: 1.15.0
23341c80d5b0Smrg#
23351c80d5b0Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
23361c80d5b0Smrg# scanning arbitrary text files, extracting information from those text files,
23371c80d5b0Smrg# and printing reports based on that information.
23381c80d5b0Smrg#
23391c80d5b0Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
23401c80d5b0Smrg#
23411c80d5b0Smrg# Interface to module:
23421c80d5b0Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
23431c80d5b0Smrg# PERL:	     returns the path of the perl program found
23441c80d5b0Smrg#	     returns the path set by the user in the environment
23451c80d5b0Smrg# --with-perl: 'yes' user instructs the module to use perl
23461c80d5b0Smrg#	       'no' user instructs the module not to use perl
23471c80d5b0Smrg# have_perl: returns yes if perl found in PATH or no
23481c80d5b0Smrg#
23491c80d5b0Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
23501c80d5b0Smrg#
23511c80d5b0SmrgAC_DEFUN([XORG_WITH_PERL],[
23521c80d5b0SmrgAC_ARG_VAR([PERL], [Path to perl command])
23531c80d5b0Smrg# Preserves the interface, should it be implemented later
23541c80d5b0Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
23551c80d5b0Smrgm4_define([_defopt], m4_default([$2], [auto]))
23561c80d5b0SmrgAC_ARG_WITH(perl,
23571c80d5b0Smrg	AS_HELP_STRING([--with-perl],
23581c80d5b0Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
23591c80d5b0Smrg	   [use_perl=$withval], [use_perl=]_defopt)
23601c80d5b0Smrgm4_undefine([_defopt])
23611c80d5b0Smrg
23621c80d5b0Smrgif test "x$use_perl" = x"auto"; then
23631c80d5b0Smrg   AC_PATH_PROG([PERL], [perl])
23641c80d5b0Smrg   if test "x$PERL" = "x"; then
23651c80d5b0Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
23661c80d5b0Smrg	have_perl=no
23671c80d5b0Smrg   else
23681c80d5b0Smrg        have_perl=yes
23691c80d5b0Smrg   fi
23701c80d5b0Smrgelif test "x$use_perl" = x"yes" ; then
23711c80d5b0Smrg   AC_PATH_PROG([PERL], [perl])
23721c80d5b0Smrg   if test "x$PERL" = "x"; then
23731c80d5b0Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
23741c80d5b0Smrg   fi
23751c80d5b0Smrg   have_perl=yes
23761c80d5b0Smrgelif test "x$use_perl" = x"no" ; then
23771c80d5b0Smrg   if test "x$PERL" != "x"; then
23781c80d5b0Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
23791c80d5b0Smrg   fi
23801c80d5b0Smrg   have_perl=no
23811c80d5b0Smrgelse
23821c80d5b0Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
23831c80d5b0Smrgfi
23841c80d5b0Smrg
23851c80d5b0SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
23861c80d5b0Smrg]) # XORG_WITH_PERL
23871c80d5b0Smrg
23881c80d5b0Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
23891c80d5b0Smrg# ----------------
23901c80d5b0Smrg# Minimum version: 1.5.0
23911c80d5b0Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23921c80d5b0Smrg#
23931c80d5b0Smrg# Documentation tools are not always available on all platforms and sometimes
23941c80d5b0Smrg# not at the appropriate level. This macro enables a module to test for the
23951c80d5b0Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
23961c80d5b0Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
23971c80d5b0Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
23981c80d5b0Smrg# --with-asciidoc assumes 'auto'.
23991c80d5b0Smrg#
24001c80d5b0Smrg# Interface to module:
24011c80d5b0Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2402d7ffce2aSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
2403d7ffce2aSmrg#		 returns the path set by the user in the environment
2404d7ffce2aSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2405d7ffce2aSmrg#		  'no' user instructs the module not to use asciidoc
2406d7ffce2aSmrg#
2407d7ffce2aSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2408d7ffce2aSmrg#
2409d7ffce2aSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
2410d7ffce2aSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2411d7ffce2aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2412d7ffce2aSmrgAC_ARG_WITH(asciidoc,
2413d7ffce2aSmrg	AS_HELP_STRING([--with-asciidoc],
2414d7ffce2aSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2415d7ffce2aSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2416d7ffce2aSmrgm4_undefine([_defopt])
2417d7ffce2aSmrg
2418d7ffce2aSmrgif test "x$use_asciidoc" = x"auto"; then
2419d7ffce2aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2420d7ffce2aSmrg   if test "x$ASCIIDOC" = "x"; then
2421d7ffce2aSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2422d7ffce2aSmrg	have_asciidoc=no
2423d7ffce2aSmrg   else
2424d7ffce2aSmrg        have_asciidoc=yes
2425d7ffce2aSmrg   fi
2426d7ffce2aSmrgelif test "x$use_asciidoc" = x"yes" ; then
2427d7ffce2aSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2428d7ffce2aSmrg   if test "x$ASCIIDOC" = "x"; then
2429d7ffce2aSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2430d7ffce2aSmrg   fi
2431d7ffce2aSmrg   have_asciidoc=yes
2432d7ffce2aSmrgelif test "x$use_asciidoc" = x"no" ; then
2433d7ffce2aSmrg   if test "x$ASCIIDOC" != "x"; then
2434d7ffce2aSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2435d7ffce2aSmrg   fi
2436d7ffce2aSmrg   have_asciidoc=no
2437d7ffce2aSmrgelse
2438d7ffce2aSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2439d7ffce2aSmrgfi
2440d7ffce2aSmrgm4_ifval([$1],
2441d7ffce2aSmrg[if test "$have_asciidoc" = yes; then
2442d7ffce2aSmrg    # scrape the asciidoc version
2443d7ffce2aSmrg    AC_MSG_CHECKING([the asciidoc version])
2444d7ffce2aSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2445d7ffce2aSmrg    AC_MSG_RESULT([$asciidoc_version])
2446d7ffce2aSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2447d7ffce2aSmrg        [if test "x$use_asciidoc" = xauto; then
2448d7ffce2aSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2449d7ffce2aSmrg            have_asciidoc=no
2450d7ffce2aSmrg        else
2451d7ffce2aSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2452d7ffce2aSmrg        fi])
2453d7ffce2aSmrgfi])
2454d7ffce2aSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2455d7ffce2aSmrg]) # XORG_WITH_ASCIIDOC
2456d7ffce2aSmrg
2457d7ffce2aSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
245841fe0c2aSmrg# -------------------------------------------
2459d7ffce2aSmrg# Minimum version: 1.5.0
2460d7ffce2aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
246141fe0c2aSmrg# Minimum version for optional DOT checking: 1.18.0
2462d7ffce2aSmrg#
2463d7ffce2aSmrg# Documentation tools are not always available on all platforms and sometimes
2464d7ffce2aSmrg# not at the appropriate level. This macro enables a module to test for the
2465d7ffce2aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2466d7ffce2aSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
2467d7ffce2aSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
2468d7ffce2aSmrg# --with-doxygen assumes 'auto'.
2469d7ffce2aSmrg#
2470d7ffce2aSmrg# Interface to module:
2471d7ffce2aSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2472d7ffce2aSmrg# DOXYGEN:	 returns the path of the doxygen program found
2473d7ffce2aSmrg#		 returns the path set by the user in the environment
2474d7ffce2aSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
2475d7ffce2aSmrg#		  'no' user instructs the module not to use doxygen
2476d7ffce2aSmrg#
2477d7ffce2aSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2478d7ffce2aSmrg#
2479d7ffce2aSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
2480d7ffce2aSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
248141fe0c2aSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
2482d7ffce2aSmrgm4_define([_defopt], m4_default([$2], [auto]))
2483d7ffce2aSmrgAC_ARG_WITH(doxygen,
2484d7ffce2aSmrg	AS_HELP_STRING([--with-doxygen],
2485d7ffce2aSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2486d7ffce2aSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2487d7ffce2aSmrgm4_undefine([_defopt])
2488d7ffce2aSmrg
2489d7ffce2aSmrgif test "x$use_doxygen" = x"auto"; then
2490d7ffce2aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2491d7ffce2aSmrg   if test "x$DOXYGEN" = "x"; then
2492d7ffce2aSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2493d7ffce2aSmrg	have_doxygen=no
2494d7ffce2aSmrg   else
2495d7ffce2aSmrg        have_doxygen=yes
2496d7ffce2aSmrg   fi
2497d7ffce2aSmrgelif test "x$use_doxygen" = x"yes" ; then
2498d7ffce2aSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
2499d7ffce2aSmrg   if test "x$DOXYGEN" = "x"; then
2500d7ffce2aSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2501d7ffce2aSmrg   fi
2502d7ffce2aSmrg   have_doxygen=yes
2503d7ffce2aSmrgelif test "x$use_doxygen" = x"no" ; then
2504d7ffce2aSmrg   if test "x$DOXYGEN" != "x"; then
2505d7ffce2aSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2506d7ffce2aSmrg   fi
2507d7ffce2aSmrg   have_doxygen=no
2508d7ffce2aSmrgelse
2509d7ffce2aSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2510d7ffce2aSmrgfi
2511d7ffce2aSmrgm4_ifval([$1],
2512d7ffce2aSmrg[if test "$have_doxygen" = yes; then
2513d7ffce2aSmrg    # scrape the doxygen version
2514d7ffce2aSmrg    AC_MSG_CHECKING([the doxygen version])
2515d7ffce2aSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2516d7ffce2aSmrg    AC_MSG_RESULT([$doxygen_version])
2517d7ffce2aSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
2518d7ffce2aSmrg        [if test "x$use_doxygen" = xauto; then
2519d7ffce2aSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2520d7ffce2aSmrg            have_doxygen=no
2521d7ffce2aSmrg        else
2522d7ffce2aSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2523d7ffce2aSmrg        fi])
2524d7ffce2aSmrgfi])
252541fe0c2aSmrg
252641fe0c2aSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
252741fe0c2aSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
252841fe0c2aSmrgdnl 	HAVE_DOT = @HAVE_DOT@
252941fe0c2aSmrgHAVE_DOT=no
253041fe0c2aSmrgif test "x$have_doxygen" = "xyes"; then
253141fe0c2aSmrg  AC_PATH_PROG([DOT], [dot])
253241fe0c2aSmrg    if test "x$DOT" != "x"; then
253341fe0c2aSmrg      HAVE_DOT=yes
253441fe0c2aSmrg    fi
253541fe0c2aSmrgfi
253641fe0c2aSmrg
253741fe0c2aSmrgAC_SUBST([HAVE_DOT])
253841fe0c2aSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2539d7ffce2aSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2540d7ffce2aSmrg]) # XORG_WITH_DOXYGEN
2541d7ffce2aSmrg
2542d7ffce2aSmrg# XORG_WITH_GROFF([DEFAULT])
2543d7ffce2aSmrg# ----------------
2544d7ffce2aSmrg# Minimum version: 1.6.0
2545d7ffce2aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2546d7ffce2aSmrg#
2547d7ffce2aSmrg# Documentation tools are not always available on all platforms and sometimes
2548d7ffce2aSmrg# not at the appropriate level. This macro enables a module to test for the
2549d7ffce2aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2550d7ffce2aSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
2551d7ffce2aSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
2552d7ffce2aSmrg# --with-groff assumes 'auto'.
2553d7ffce2aSmrg#
2554d7ffce2aSmrg# Interface to module:
2555d7ffce2aSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2556d7ffce2aSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2557d7ffce2aSmrg# HAVE_GROFF_MS: the -ms macros package
2558d7ffce2aSmrg# GROFF:	 returns the path of the groff program found
2559d7ffce2aSmrg#		 returns the path set by the user in the environment
2560d7ffce2aSmrg# --with-groff:	 'yes' user instructs the module to use groff
2561d7ffce2aSmrg#		 'no' user instructs the module not to use groff
2562d7ffce2aSmrg#
2563d7ffce2aSmrg# Added in version 1.9.0:
2564d7ffce2aSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2565d7ffce2aSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2566d7ffce2aSmrg#		   psselect from the psutils package.
2567d7ffce2aSmrg#		   the ghostcript package. Refer to the grohtml man pages
2568d7ffce2aSmrg#
2569d7ffce2aSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2570d7ffce2aSmrg#
2571d7ffce2aSmrg# OS and distros often splits groff in a basic and full package, the former
2572d7ffce2aSmrg# having the groff program and the later having devices, fonts and macros
2573d7ffce2aSmrg# Checking for the groff executable is not enough.
2574d7ffce2aSmrg#
2575d7ffce2aSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
2576d7ffce2aSmrg# unset HAVE_GROFF or GROFF env variables.
2577d7ffce2aSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2578d7ffce2aSmrg#
2579d7ffce2aSmrgAC_DEFUN([XORG_WITH_GROFF],[
2580d7ffce2aSmrgAC_ARG_VAR([GROFF], [Path to groff command])
2581d7ffce2aSmrgm4_define([_defopt], m4_default([$1], [auto]))
2582d7ffce2aSmrgAC_ARG_WITH(groff,
2583d7ffce2aSmrg	AS_HELP_STRING([--with-groff],
2584d7ffce2aSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2585d7ffce2aSmrg	   [use_groff=$withval], [use_groff=]_defopt)
2586d7ffce2aSmrgm4_undefine([_defopt])
2587d7ffce2aSmrg
2588d7ffce2aSmrgif test "x$use_groff" = x"auto"; then
2589d7ffce2aSmrg   AC_PATH_PROG([GROFF], [groff])
2590d7ffce2aSmrg   if test "x$GROFF" = "x"; then
2591d7ffce2aSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2592d7ffce2aSmrg	have_groff=no
2593d7ffce2aSmrg   else
2594d7ffce2aSmrg        have_groff=yes
2595d7ffce2aSmrg   fi
2596d7ffce2aSmrgelif test "x$use_groff" = x"yes" ; then
2597d7ffce2aSmrg   AC_PATH_PROG([GROFF], [groff])
2598d7ffce2aSmrg   if test "x$GROFF" = "x"; then
2599d7ffce2aSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2600d7ffce2aSmrg   fi
2601d7ffce2aSmrg   have_groff=yes
2602d7ffce2aSmrgelif test "x$use_groff" = x"no" ; then
2603d7ffce2aSmrg   if test "x$GROFF" != "x"; then
2604d7ffce2aSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2605d7ffce2aSmrg   fi
2606d7ffce2aSmrg   have_groff=no
2607d7ffce2aSmrgelse
2608d7ffce2aSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2609d7ffce2aSmrgfi
2610d7ffce2aSmrg
2611d7ffce2aSmrg# We have groff, test for the presence of the macro packages
2612d7ffce2aSmrgif test "x$have_groff" = x"yes"; then
2613d7ffce2aSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2614d7ffce2aSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2615d7ffce2aSmrg        groff_ms_works=yes
2616d7ffce2aSmrg    else
2617d7ffce2aSmrg        groff_ms_works=no
2618d7ffce2aSmrg    fi
2619d7ffce2aSmrg    AC_MSG_RESULT([$groff_ms_works])
2620d7ffce2aSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2621d7ffce2aSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2622d7ffce2aSmrg        groff_mm_works=yes
2623d7ffce2aSmrg    else
2624d7ffce2aSmrg        groff_mm_works=no
2625d7ffce2aSmrg    fi
2626d7ffce2aSmrg    AC_MSG_RESULT([$groff_mm_works])
2627d7ffce2aSmrgfi
2628d7ffce2aSmrg
2629d7ffce2aSmrg# We have groff, test for HTML dependencies, one command per package
2630d7ffce2aSmrgif test "x$have_groff" = x"yes"; then
2631d7ffce2aSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2632d7ffce2aSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2633d7ffce2aSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2634d7ffce2aSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2635d7ffce2aSmrg      have_groff_html=yes
2636d7ffce2aSmrg   else
2637d7ffce2aSmrg      have_groff_html=no
2638d7ffce2aSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2639d7ffce2aSmrg   fi
2640d7ffce2aSmrgfi
2641d7ffce2aSmrg
2642d7ffce2aSmrg# Set Automake conditionals for Makefiles
2643d7ffce2aSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2644d7ffce2aSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2645d7ffce2aSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2646d7ffce2aSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2647d7ffce2aSmrg]) # XORG_WITH_GROFF
2648d7ffce2aSmrg
26491c80d5b0Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
26501c80d5b0Smrg# ---------------------------------------
2651d7ffce2aSmrg# Minimum version: 1.6.0
2652d7ffce2aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
26531c80d5b0Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2654d7ffce2aSmrg#
2655d7ffce2aSmrg# Documentation tools are not always available on all platforms and sometimes
2656d7ffce2aSmrg# not at the appropriate level. This macro enables a module to test for the
2657d7ffce2aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2658d7ffce2aSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
2659d7ffce2aSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
2660d7ffce2aSmrg# --with-fop assumes 'auto'.
2661d7ffce2aSmrg#
2662d7ffce2aSmrg# Interface to module:
2663d7ffce2aSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2664d7ffce2aSmrg# FOP:	 	returns the path of the fop program found
2665d7ffce2aSmrg#		returns the path set by the user in the environment
2666d7ffce2aSmrg# --with-fop: 	'yes' user instructs the module to use fop
2667d7ffce2aSmrg#		'no' user instructs the module not to use fop
2668d7ffce2aSmrg#
2669d7ffce2aSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2670d7ffce2aSmrg#
2671d7ffce2aSmrgAC_DEFUN([XORG_WITH_FOP],[
2672d7ffce2aSmrgAC_ARG_VAR([FOP], [Path to fop command])
26731c80d5b0Smrgm4_define([_defopt], m4_default([$2], [auto]))
2674d7ffce2aSmrgAC_ARG_WITH(fop,
2675d7ffce2aSmrg	AS_HELP_STRING([--with-fop],
2676d7ffce2aSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2677d7ffce2aSmrg	   [use_fop=$withval], [use_fop=]_defopt)
2678d7ffce2aSmrgm4_undefine([_defopt])
2679d7ffce2aSmrg
2680d7ffce2aSmrgif test "x$use_fop" = x"auto"; then
2681d7ffce2aSmrg   AC_PATH_PROG([FOP], [fop])
2682d7ffce2aSmrg   if test "x$FOP" = "x"; then
2683d7ffce2aSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2684d7ffce2aSmrg	have_fop=no
2685d7ffce2aSmrg   else
2686d7ffce2aSmrg        have_fop=yes
2687d7ffce2aSmrg   fi
2688d7ffce2aSmrgelif test "x$use_fop" = x"yes" ; then
2689d7ffce2aSmrg   AC_PATH_PROG([FOP], [fop])
2690d7ffce2aSmrg   if test "x$FOP" = "x"; then
2691d7ffce2aSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2692d7ffce2aSmrg   fi
2693d7ffce2aSmrg   have_fop=yes
2694d7ffce2aSmrgelif test "x$use_fop" = x"no" ; then
2695d7ffce2aSmrg   if test "x$FOP" != "x"; then
2696d7ffce2aSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2697d7ffce2aSmrg   fi
2698d7ffce2aSmrg   have_fop=no
2699d7ffce2aSmrgelse
2700d7ffce2aSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2701d7ffce2aSmrgfi
27021c80d5b0Smrg
27031c80d5b0Smrg# Test for a minimum version of fop, if provided.
27041c80d5b0Smrgm4_ifval([$1],
27051c80d5b0Smrg[if test "$have_fop" = yes; then
27061c80d5b0Smrg    # scrape the fop version
27071c80d5b0Smrg    AC_MSG_CHECKING([for fop minimum version])
27081c80d5b0Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
27091c80d5b0Smrg    AC_MSG_RESULT([$fop_version])
27101c80d5b0Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
27111c80d5b0Smrg        [if test "x$use_fop" = xauto; then
27121c80d5b0Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
27131c80d5b0Smrg            have_fop=no
27141c80d5b0Smrg        else
27151c80d5b0Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
27161c80d5b0Smrg        fi])
27171c80d5b0Smrgfi])
2718d7ffce2aSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2719d7ffce2aSmrg]) # XORG_WITH_FOP
2720d7ffce2aSmrg
272141fe0c2aSmrg# XORG_WITH_M4([MIN-VERSION])
272241fe0c2aSmrg# ---------------------------
272341fe0c2aSmrg# Minimum version: 1.19.0
272441fe0c2aSmrg#
272541fe0c2aSmrg# This macro attempts to locate an m4 macro processor which supports
272641fe0c2aSmrg# -I option and is only useful for modules relying on M4 in order to
272741fe0c2aSmrg# expand macros in source code files.
272841fe0c2aSmrg#
272941fe0c2aSmrg# Interface to module:
273041fe0c2aSmrg# M4:	 	returns the path of the m4 program found
273141fe0c2aSmrg#		returns the path set by the user in the environment
273241fe0c2aSmrg#
273341fe0c2aSmrgAC_DEFUN([XORG_WITH_M4], [
273441fe0c2aSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
273541fe0c2aSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
273641fe0c2aSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
273741fe0c2aSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
273841fe0c2aSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
273941fe0c2aSmrg   [$PATH:/usr/gnu/bin])])
274041fe0c2aSmrg
274141fe0c2aSmrgAC_SUBST([M4], [$ac_cv_path_M4])
274241fe0c2aSmrg]) # XORG_WITH_M4
274341fe0c2aSmrg
2744d7ffce2aSmrg# XORG_WITH_PS2PDF([DEFAULT])
2745d7ffce2aSmrg# ----------------
2746d7ffce2aSmrg# Minimum version: 1.6.0
2747d7ffce2aSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2748d7ffce2aSmrg#
2749d7ffce2aSmrg# Documentation tools are not always available on all platforms and sometimes
2750d7ffce2aSmrg# not at the appropriate level. This macro enables a module to test for the
2751d7ffce2aSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
2752d7ffce2aSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2753d7ffce2aSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2754d7ffce2aSmrg# --with-ps2pdf assumes 'auto'.
2755d7ffce2aSmrg#
2756d7ffce2aSmrg# Interface to module:
2757d7ffce2aSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2758d7ffce2aSmrg# PS2PDF:	returns the path of the ps2pdf program found
2759d7ffce2aSmrg#		returns the path set by the user in the environment
2760d7ffce2aSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2761d7ffce2aSmrg#		 'no' user instructs the module not to use ps2pdf
2762d7ffce2aSmrg#
2763d7ffce2aSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2764d7ffce2aSmrg#
2765d7ffce2aSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2766d7ffce2aSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2767d7ffce2aSmrgm4_define([_defopt], m4_default([$1], [auto]))
2768d7ffce2aSmrgAC_ARG_WITH(ps2pdf,
2769d7ffce2aSmrg	AS_HELP_STRING([--with-ps2pdf],
2770d7ffce2aSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2771d7ffce2aSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2772d7ffce2aSmrgm4_undefine([_defopt])
2773d7ffce2aSmrg
2774d7ffce2aSmrgif test "x$use_ps2pdf" = x"auto"; then
2775d7ffce2aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2776d7ffce2aSmrg   if test "x$PS2PDF" = "x"; then
2777d7ffce2aSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2778d7ffce2aSmrg	have_ps2pdf=no
2779d7ffce2aSmrg   else
2780d7ffce2aSmrg        have_ps2pdf=yes
2781d7ffce2aSmrg   fi
2782d7ffce2aSmrgelif test "x$use_ps2pdf" = x"yes" ; then
2783d7ffce2aSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2784d7ffce2aSmrg   if test "x$PS2PDF" = "x"; then
2785d7ffce2aSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2786d7ffce2aSmrg   fi
2787d7ffce2aSmrg   have_ps2pdf=yes
2788d7ffce2aSmrgelif test "x$use_ps2pdf" = x"no" ; then
2789d7ffce2aSmrg   if test "x$PS2PDF" != "x"; then
2790d7ffce2aSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2791d7ffce2aSmrg   fi
2792d7ffce2aSmrg   have_ps2pdf=no
2793d7ffce2aSmrgelse
2794d7ffce2aSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2795d7ffce2aSmrgfi
2796d7ffce2aSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2797d7ffce2aSmrg]) # XORG_WITH_PS2PDF
2798d7ffce2aSmrg
2799d7ffce2aSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
2800d7ffce2aSmrg# ----------------
2801d7ffce2aSmrg# Minimum version: 1.6.0
2802d7ffce2aSmrg#
2803d7ffce2aSmrg# Documentation tools are not always available on all platforms and sometimes
2804d7ffce2aSmrg# not at the appropriate level. This macro enables a builder to skip all
2805d7ffce2aSmrg# documentation targets except traditional man pages.
2806d7ffce2aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2807d7ffce2aSmrg# maximum flexibilty in controlling documentation building.
2808d7ffce2aSmrg# Refer to:
2809d7ffce2aSmrg# XORG_WITH_XMLTO         --with-xmlto
2810d7ffce2aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2811d7ffce2aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2812d7ffce2aSmrg# XORG_WITH_FOP           --with-fop
2813d7ffce2aSmrg# XORG_WITH_GROFF         --with-groff
2814d7ffce2aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2815d7ffce2aSmrg#
2816d7ffce2aSmrg# Interface to module:
2817d7ffce2aSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2818d7ffce2aSmrg# --enable-docs: 'yes' user instructs the module to generate docs
2819d7ffce2aSmrg#		 'no' user instructs the module not to generate docs
2820d7ffce2aSmrg# parm1:	specify the default value, yes or no.
2821d7ffce2aSmrg#
2822d7ffce2aSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2823d7ffce2aSmrgm4_define([docs_default], m4_default([$1], [yes]))
2824d7ffce2aSmrgAC_ARG_ENABLE(docs,
2825d7ffce2aSmrg	AS_HELP_STRING([--enable-docs],
2826d7ffce2aSmrg	   [Enable building the documentation (default: ]docs_default[)]),
2827d7ffce2aSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
2828d7ffce2aSmrgm4_undefine([docs_default])
2829d7ffce2aSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2830d7ffce2aSmrgAC_MSG_CHECKING([whether to build documentation])
2831d7ffce2aSmrgAC_MSG_RESULT([$build_docs])
2832d7ffce2aSmrg]) # XORG_ENABLE_DOCS
2833d7ffce2aSmrg
2834d7ffce2aSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2835d7ffce2aSmrg# ----------------
2836d7ffce2aSmrg# Minimum version: 1.6.0
2837d7ffce2aSmrg#
2838d7ffce2aSmrg# This macro enables a builder to skip all developer documentation.
2839d7ffce2aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2840d7ffce2aSmrg# maximum flexibilty in controlling documentation building.
2841d7ffce2aSmrg# Refer to:
2842d7ffce2aSmrg# XORG_WITH_XMLTO         --with-xmlto
2843d7ffce2aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2844d7ffce2aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2845d7ffce2aSmrg# XORG_WITH_FOP           --with-fop
2846d7ffce2aSmrg# XORG_WITH_GROFF         --with-groff
2847d7ffce2aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2848d7ffce2aSmrg#
2849d7ffce2aSmrg# Interface to module:
2850d7ffce2aSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2851d7ffce2aSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2852d7ffce2aSmrg#			'no' user instructs the module not to generate developer docs
2853d7ffce2aSmrg# parm1:		specify the default value, yes or no.
2854d7ffce2aSmrg#
2855d7ffce2aSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2856d7ffce2aSmrgm4_define([devel_default], m4_default([$1], [yes]))
2857d7ffce2aSmrgAC_ARG_ENABLE(devel-docs,
2858d7ffce2aSmrg	AS_HELP_STRING([--enable-devel-docs],
2859d7ffce2aSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2860d7ffce2aSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2861d7ffce2aSmrgm4_undefine([devel_default])
2862d7ffce2aSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2863d7ffce2aSmrgAC_MSG_CHECKING([whether to build developer documentation])
2864d7ffce2aSmrgAC_MSG_RESULT([$build_devel_docs])
2865d7ffce2aSmrg]) # XORG_ENABLE_DEVEL_DOCS
2866d7ffce2aSmrg
2867d7ffce2aSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
2868d7ffce2aSmrg# ----------------
2869d7ffce2aSmrg# Minimum version: 1.6.0
2870d7ffce2aSmrg#
2871d7ffce2aSmrg# This macro enables a builder to skip all functional specification targets.
2872d7ffce2aSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2873d7ffce2aSmrg# maximum flexibilty in controlling documentation building.
2874d7ffce2aSmrg# Refer to:
2875d7ffce2aSmrg# XORG_WITH_XMLTO         --with-xmlto
2876d7ffce2aSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2877d7ffce2aSmrg# XORG_WITH_DOXYGEN       --with-doxygen
2878d7ffce2aSmrg# XORG_WITH_FOP           --with-fop
2879d7ffce2aSmrg# XORG_WITH_GROFF         --with-groff
2880d7ffce2aSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
2881d7ffce2aSmrg#
2882d7ffce2aSmrg# Interface to module:
2883d7ffce2aSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2884d7ffce2aSmrg# --enable-specs:	'yes' user instructs the module to generate specs
2885d7ffce2aSmrg#			'no' user instructs the module not to generate specs
2886d7ffce2aSmrg# parm1:		specify the default value, yes or no.
2887d7ffce2aSmrg#
2888d7ffce2aSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2889d7ffce2aSmrgm4_define([spec_default], m4_default([$1], [yes]))
2890d7ffce2aSmrgAC_ARG_ENABLE(specs,
2891d7ffce2aSmrg	AS_HELP_STRING([--enable-specs],
2892d7ffce2aSmrg	   [Enable building the specs (default: ]spec_default[)]),
2893d7ffce2aSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
2894d7ffce2aSmrgm4_undefine([spec_default])
2895d7ffce2aSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2896d7ffce2aSmrgAC_MSG_CHECKING([whether to build functional specifications])
2897d7ffce2aSmrgAC_MSG_RESULT([$build_specs])
2898d7ffce2aSmrg]) # XORG_ENABLE_SPECS
2899d7ffce2aSmrg
29001c80d5b0Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
29011c80d5b0Smrg# ----------------------------------------------
29021c80d5b0Smrg# Minimum version: 1.13.0
29031c80d5b0Smrg#
29041c80d5b0Smrg# This macro enables a builder to enable/disable unit testing
29051c80d5b0Smrg# It makes no assumption about the test cases implementation
29061c80d5b0Smrg# Test cases may or may not use Automake "Support for test suites"
29071c80d5b0Smrg# They may or may not use the software utility library GLib
29081c80d5b0Smrg#
29091c80d5b0Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
29101c80d5b0Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
29111c80d5b0Smrg# The variable enable_unit_tests is used by other macros in this file.
29121c80d5b0Smrg#
29131c80d5b0Smrg# Interface to module:
29141c80d5b0Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
29151c80d5b0Smrg# enable_unit_tests:    used in configure.ac for additional configuration
29161c80d5b0Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
29171c80d5b0Smrg#			'no' user instructs the module not to build tests
29181c80d5b0Smrg# parm1:		specify the default value, yes or no.
29191c80d5b0Smrg#
29201c80d5b0SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
29211c80d5b0SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
29221c80d5b0SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
29231c80d5b0SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
29241c80d5b0Smrgm4_define([_defopt], m4_default([$1], [auto]))
29251c80d5b0SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
29261c80d5b0Smrg	[Enable building unit test cases (default: ]_defopt[)]),
29271c80d5b0Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
29281c80d5b0Smrgm4_undefine([_defopt])
29291c80d5b0SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
29301c80d5b0SmrgAC_MSG_CHECKING([whether to build unit test cases])
29311c80d5b0SmrgAC_MSG_RESULT([$enable_unit_tests])
29321c80d5b0Smrg]) # XORG_ENABLE_UNIT_TESTS
29331c80d5b0Smrg
29341c80d5b0Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
29351c80d5b0Smrg# ------------------------------------------------------
29361c80d5b0Smrg# Minimum version: 1.17.0
29371c80d5b0Smrg#
29381c80d5b0Smrg# This macro enables a builder to enable/disable integration testing
29391c80d5b0Smrg# It makes no assumption about the test cases' implementation
29401c80d5b0Smrg# Test cases may or may not use Automake "Support for test suites"
29411c80d5b0Smrg#
29421c80d5b0Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
29431c80d5b0Smrg# usually requires less dependencies and may be built and run under less
29441c80d5b0Smrg# stringent environments than integration tests.
29451c80d5b0Smrg#
29461c80d5b0Smrg# Interface to module:
29471c80d5b0Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
29481c80d5b0Smrg# enable_integration_tests:   used in configure.ac for additional configuration
29491c80d5b0Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
29501c80d5b0Smrg#                             'no' user instructs the module not to build tests
29511c80d5b0Smrg# parm1:                      specify the default value, yes or no.
29521c80d5b0Smrg#
29531c80d5b0SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
29541c80d5b0SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
29551c80d5b0Smrgm4_define([_defopt], m4_default([$1], [auto]))
29561c80d5b0SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
29571c80d5b0Smrg	[Enable building integration test cases (default: ]_defopt[)]),
29581c80d5b0Smrg	[enable_integration_tests=$enableval],
29591c80d5b0Smrg	[enable_integration_tests=]_defopt)
29601c80d5b0Smrgm4_undefine([_defopt])
29611c80d5b0SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
29621c80d5b0Smrg	[test "x$enable_integration_tests" != xno])
29631c80d5b0SmrgAC_MSG_CHECKING([whether to build unit test cases])
29641c80d5b0SmrgAC_MSG_RESULT([$enable_integration_tests])
29651c80d5b0Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
29661c80d5b0Smrg
29671c80d5b0Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
29681c80d5b0Smrg# ----------------------------------------
29691c80d5b0Smrg# Minimum version: 1.13.0
29701c80d5b0Smrg#
29711c80d5b0Smrg# GLib is a library which provides advanced data structures and functions.
29721c80d5b0Smrg# This macro enables a module to test for the presence of Glib.
29731c80d5b0Smrg#
29741c80d5b0Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
29751c80d5b0Smrg# Otherwise the value of $enable_unit_tests is blank.
29761c80d5b0Smrg#
29771c80d5b0Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
29781c80d5b0Smrg# test support usually requires less dependencies and may be built and run under
29791c80d5b0Smrg# less stringent environments than integration tests.
29801c80d5b0Smrg#
29811c80d5b0Smrg# Interface to module:
29821c80d5b0Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
29831c80d5b0Smrg# with_glib: used in configure.ac to know if GLib has been found
29841c80d5b0Smrg# --with-glib:	'yes' user instructs the module to use glib
29851c80d5b0Smrg#		'no' user instructs the module not to use glib
29861c80d5b0Smrg#
29871c80d5b0SmrgAC_DEFUN([XORG_WITH_GLIB],[
29881c80d5b0SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
29891c80d5b0Smrgm4_define([_defopt], m4_default([$2], [auto]))
29901c80d5b0SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
29911c80d5b0Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
29921c80d5b0Smrg	[with_glib=$withval], [with_glib=]_defopt)
29931c80d5b0Smrgm4_undefine([_defopt])
29941c80d5b0Smrg
29951c80d5b0Smrghave_glib=no
29961c80d5b0Smrg# Do not probe GLib if user explicitly disabled unit testing
29971c80d5b0Smrgif test "x$enable_unit_tests" != x"no"; then
29981c80d5b0Smrg  # Do not probe GLib if user explicitly disabled it
29991c80d5b0Smrg  if test "x$with_glib" != x"no"; then
30001c80d5b0Smrg    m4_ifval(
30011c80d5b0Smrg      [$1],
30021c80d5b0Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
30031c80d5b0Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
30041c80d5b0Smrg    )
30051c80d5b0Smrg  fi
30061c80d5b0Smrgfi
30071c80d5b0Smrg
30081c80d5b0Smrg# Not having GLib when unit testing has been explicitly requested is an error
30091c80d5b0Smrgif test "x$enable_unit_tests" = x"yes"; then
30101c80d5b0Smrg  if test "x$have_glib" = x"no"; then
30111c80d5b0Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
30121c80d5b0Smrg  fi
30131c80d5b0Smrgfi
30141c80d5b0Smrg
30151c80d5b0Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
30161c80d5b0Smrgif test "x$enable_unit_tests" = x"no"; then
30171c80d5b0Smrg  if test "x$with_glib" = x"yes"; then
30181c80d5b0Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
30191c80d5b0Smrg  fi
30201c80d5b0Smrgfi
30211c80d5b0Smrg
30221c80d5b0Smrg# Not having GLib when it has been explicitly requested is an error
30231c80d5b0Smrgif test "x$with_glib" = x"yes"; then
30241c80d5b0Smrg  if test "x$have_glib" = x"no"; then
30251c80d5b0Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
30261c80d5b0Smrg  fi
30271c80d5b0Smrgfi
30281c80d5b0Smrg
30291c80d5b0SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
30301c80d5b0Smrg]) # XORG_WITH_GLIB
30311c80d5b0Smrg
30321c80d5b0Smrg# XORG_LD_WRAP([required|optional])
30331c80d5b0Smrg# ---------------------------------
30341c80d5b0Smrg# Minimum version: 1.13.0
30351c80d5b0Smrg#
30361c80d5b0Smrg# Check if linker supports -wrap, passed via compiler flags
30371c80d5b0Smrg#
30381c80d5b0Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
30391c80d5b0Smrg# Otherwise the value of $enable_unit_tests is blank.
30401c80d5b0Smrg#
30411c80d5b0Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
30421c80d5b0Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
30431c80d5b0Smrg# available, an argument of "optional" allows use when some unit tests require
30441c80d5b0Smrg# ld -wrap and others do not.
30451c80d5b0Smrg#
30461c80d5b0SmrgAC_DEFUN([XORG_LD_WRAP],[
30471c80d5b0SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
30481c80d5b0Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
30491c80d5b0Smrg                      void __wrap_exit(int status) { return; }],
30501c80d5b0Smrg                     [exit(0);])])
30511c80d5b0Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
30521c80d5b0Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
30531c80d5b0Smrg  if test "x$have_ld_wrap" = x"no"; then
30541c80d5b0Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
30551c80d5b0Smrg  fi
30561c80d5b0Smrgfi
30571c80d5b0SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
30581c80d5b0Smrg#
30591c80d5b0Smrg]) # XORG_LD_WRAP
30601c80d5b0Smrg
30611c80d5b0Smrg# XORG_CHECK_LINKER_FLAGS
30621c80d5b0Smrg# -----------------------
30631c80d5b0Smrg# SYNOPSIS
30641c80d5b0Smrg#
30651c80d5b0Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
30661c80d5b0Smrg#
30671c80d5b0Smrg# DESCRIPTION
30681c80d5b0Smrg#
30691c80d5b0Smrg#   Check whether the given linker FLAGS work with the current language's
30701c80d5b0Smrg#   linker, or whether they give an error.
30711c80d5b0Smrg#
30721c80d5b0Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
30731c80d5b0Smrg#   success/failure.
30741c80d5b0Smrg#
30751c80d5b0Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
30761c80d5b0Smrg#
30771c80d5b0Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
30781c80d5b0Smrg#
30791c80d5b0Smrg# LICENSE
30801c80d5b0Smrg#
30811c80d5b0Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
30821c80d5b0Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
30831c80d5b0Smrg#   Copyright (c) 2009 Matteo Frigo
30841c80d5b0Smrg#
30851c80d5b0Smrg#   This program is free software: you can redistribute it and/or modify it
30861c80d5b0Smrg#   under the terms of the GNU General Public License as published by the
30871c80d5b0Smrg#   Free Software Foundation, either version 3 of the License, or (at your
30881c80d5b0Smrg#   option) any later version.
30891c80d5b0Smrg#
30901c80d5b0Smrg#   This program is distributed in the hope that it will be useful, but
30911c80d5b0Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
30921c80d5b0Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
30931c80d5b0Smrg#   Public License for more details.
30941c80d5b0Smrg#
30951c80d5b0Smrg#   You should have received a copy of the GNU General Public License along
30961c80d5b0Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
30971c80d5b0Smrg#
30981c80d5b0Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
30991c80d5b0Smrg#   gives unlimited permission to copy, distribute and modify the configure
31001c80d5b0Smrg#   scripts that are the output of Autoconf when processing the Macro. You
31011c80d5b0Smrg#   need not follow the terms of the GNU General Public License when using
31021c80d5b0Smrg#   or distributing such scripts, even though portions of the text of the
31031c80d5b0Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
31041c80d5b0Smrg#   all other use of the material that constitutes the Autoconf Macro.
31051c80d5b0Smrg#
31061c80d5b0Smrg#   This special exception to the GPL applies to versions of the Autoconf
31071c80d5b0Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
31081c80d5b0Smrg#   modified version of the Autoconf Macro, you may extend this special
31091c80d5b0Smrg#   exception to the GPL to apply to your modified version as well.#
31101c80d5b0SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
31111c80d5b0Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
31121c80d5b0Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
31131c80d5b0SmrgAS_LITERAL_IF([$1],
31141c80d5b0Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
31151c80d5b0Smrg      ax_save_FLAGS=$LDFLAGS
31161c80d5b0Smrg      LDFLAGS="$1"
31171c80d5b0Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
31181c80d5b0Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
31191c80d5b0Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
31201c80d5b0Smrg      LDFLAGS=$ax_save_FLAGS])],
31211c80d5b0Smrg  [ax_save_FLAGS=$LDFLAGS
31221c80d5b0Smrg   LDFLAGS="$1"
31231c80d5b0Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
31241c80d5b0Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
31251c80d5b0Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
31261c80d5b0Smrg   LDFLAGS=$ax_save_FLAGS])
31271c80d5b0Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
31281c80d5b0SmrgAC_MSG_RESULT($xorg_check_linker_flags)
31291c80d5b0Smrgif test "x$xorg_check_linker_flags" = xyes; then
31301c80d5b0Smrg	m4_default([$2], :)
31311c80d5b0Smrgelse
31321c80d5b0Smrg	m4_default([$3], :)
31331c80d5b0Smrgfi
31341c80d5b0Smrg]) # XORG_CHECK_LINKER_FLAGS
31351c80d5b0Smrg
31361c80d5b0Smrg# XORG_MEMORY_CHECK_FLAGS
31371c80d5b0Smrg# -----------------------
31381c80d5b0Smrg# Minimum version: 1.16.0
31391c80d5b0Smrg#
31401c80d5b0Smrg# This macro attempts to find appropriate memory checking functionality
31411c80d5b0Smrg# for various platforms which unit testing code may use to catch various
31421c80d5b0Smrg# forms of memory allocation and access errors in testing.
31431c80d5b0Smrg#
31441c80d5b0Smrg# Interface to module:
31451c80d5b0Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
31461c80d5b0Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
31471c80d5b0Smrg#
31481c80d5b0Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
31491c80d5b0Smrg#
31501c80d5b0SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
31511c80d5b0Smrg
31521c80d5b0SmrgAC_REQUIRE([AC_CANONICAL_HOST])
31531c80d5b0SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
31541c80d5b0Smrg           [Environment variables to enable memory checking in tests])
31551c80d5b0Smrg
31561c80d5b0Smrg# Check for different types of support on different platforms
31571c80d5b0Smrgcase $host_os in
31581c80d5b0Smrg    solaris*)
31591c80d5b0Smrg        AC_CHECK_LIB([umem], [umem_alloc],
31601c80d5b0Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
31611c80d5b0Smrg        ;;
31621c80d5b0Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
31631c80d5b0Smrg        # both directly and inverted, so should not be 0 or 255.
31641c80d5b0Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
31651c80d5b0Smrg        ;;
31661c80d5b0Smrg    darwin*)
31671c80d5b0Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
31681c80d5b0Smrg        ;;
31691c80d5b0Smrg    *bsd*)
31701c80d5b0Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
31711c80d5b0Smrg        ;;
31721c80d5b0Smrgesac
31731c80d5b0Smrg
31741c80d5b0Smrg# User supplied flags override default flags
31751c80d5b0Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
31761c80d5b0Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
31771c80d5b0Smrgfi
31781c80d5b0Smrg
31791c80d5b0SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
31801c80d5b0Smrg]) # XORG_WITH_LINT
31811c80d5b0Smrg
31824c61c93dSmrg# XORG_CHECK_MALLOC_ZERO
31834c61c93dSmrg# ----------------------
31844c61c93dSmrg# Minimum version: 1.0.0
31854c61c93dSmrg#
31864c61c93dSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
31874c61c93dSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
31884c61c93dSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
31894c61c93dSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
31904c61c93dSmrgAC_ARG_ENABLE(malloc0returnsnull,
31914c61c93dSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
31924c61c93dSmrg		       [malloc(0) returns NULL (default: auto)]),
31934c61c93dSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
31944c61c93dSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
31954c61c93dSmrg
31964c61c93dSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
31974c61c93dSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
319841fe0c2aSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
319941fe0c2aSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
3200d7ffce2aSmrg#include <stdlib.h>
3201d7ffce2aSmrg],[
32024c61c93dSmrg    char *m0, *r0, *c0, *p;
32034c61c93dSmrg    m0 = malloc(0);
32044c61c93dSmrg    p = malloc(10);
32054c61c93dSmrg    r0 = realloc(p,0);
3206d7ffce2aSmrg    c0 = calloc(0,10);
3207d7ffce2aSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
3208d7ffce2aSmrg])],
320941fe0c2aSmrg		[xorg_cv_malloc0_returns_null=yes],
321041fe0c2aSmrg		[xorg_cv_malloc0_returns_null=no])])
321141fe0c2aSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
32124c61c93dSmrgfi
32134c61c93dSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
32144c61c93dSmrg
32154c61c93dSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
32164c61c93dSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
32174c61c93dSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
32184c61c93dSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
32194c61c93dSmrgelse
32204c61c93dSmrg	MALLOC_ZERO_CFLAGS=""
32214c61c93dSmrg	XMALLOC_ZERO_CFLAGS=""
32224c61c93dSmrg	XTMALLOC_ZERO_CFLAGS=""
32234c61c93dSmrgfi
32244c61c93dSmrg
32254c61c93dSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
32264c61c93dSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
32274c61c93dSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
32284c61c93dSmrg]) # XORG_CHECK_MALLOC_ZERO
32294c61c93dSmrg
32304c61c93dSmrg# XORG_WITH_LINT()
32314c61c93dSmrg# ----------------
32324c61c93dSmrg# Minimum version: 1.1.0
32334c61c93dSmrg#
3234d7ffce2aSmrg# This macro enables the use of a tool that flags some suspicious and
3235d7ffce2aSmrg# non-portable constructs (likely to be bugs) in C language source code.
3236d7ffce2aSmrg# It will attempt to locate the tool and use appropriate options.
3237d7ffce2aSmrg# There are various lint type tools on different platforms.
3238d7ffce2aSmrg#
3239d7ffce2aSmrg# Interface to module:
3240d7ffce2aSmrg# LINT:		returns the path to the tool found on the platform
3241d7ffce2aSmrg#		or the value set to LINT on the configure cmd line
3242d7ffce2aSmrg#		also an Automake conditional
3243d7ffce2aSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
3244d7ffce2aSmrg#
3245d7ffce2aSmrg# --with-lint:	'yes' user instructs the module to use lint
3246d7ffce2aSmrg#		'no' user instructs the module not to use lint (default)
3247d7ffce2aSmrg#
3248d7ffce2aSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
3249d7ffce2aSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
32504c61c93dSmrg#
32514c61c93dSmrgAC_DEFUN([XORG_WITH_LINT],[
32524c61c93dSmrg
3253d7ffce2aSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
3254d7ffce2aSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
32554c61c93dSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
32564c61c93dSmrg		[Use a lint-style source code checker (default: disabled)])],
32574c61c93dSmrg		[use_lint=$withval], [use_lint=no])
3258d7ffce2aSmrg
3259d7ffce2aSmrg# Obtain platform specific info like program name and options
3260d7ffce2aSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
3261d7ffce2aSmrgcase $host_os in
3262d7ffce2aSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
3263d7ffce2aSmrg	lint_name=splint
3264d7ffce2aSmrg	lint_options="-badflag"
3265d7ffce2aSmrg	;;
3266d7ffce2aSmrg  *freebsd* | *netbsd*)
3267d7ffce2aSmrg	lint_name=lint
3268d7ffce2aSmrg	lint_options="-u -b"
3269d7ffce2aSmrg	;;
3270d7ffce2aSmrg  *solaris*)
3271d7ffce2aSmrg	lint_name=lint
3272d7ffce2aSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
3273d7ffce2aSmrg	;;
3274d7ffce2aSmrgesac
3275d7ffce2aSmrg
3276d7ffce2aSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
3277d7ffce2aSmrgif test "x$use_lint" = x"yes" ; then
3278d7ffce2aSmrg   AC_PATH_PROG([LINT], [$lint_name])
3279d7ffce2aSmrg   if test "x$LINT" = "x"; then
3280d7ffce2aSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
3281d7ffce2aSmrg   fi
3282d7ffce2aSmrgelif test "x$use_lint" = x"no" ; then
3283d7ffce2aSmrg   if test "x$LINT" != "x"; then
3284d7ffce2aSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
3285d7ffce2aSmrg   fi
32864c61c93dSmrgelse
3287d7ffce2aSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
32884c61c93dSmrgfi
3289d7ffce2aSmrg
3290d7ffce2aSmrg# User supplied flags override default flags
3291d7ffce2aSmrgif test "x$LINT_FLAGS" != "x"; then
3292d7ffce2aSmrg   lint_options=$LINT_FLAGS
32934c61c93dSmrgfi
32944c61c93dSmrg
3295d7ffce2aSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
3296d7ffce2aSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
32974c61c93dSmrg
32984c61c93dSmrg]) # XORG_WITH_LINT
32994c61c93dSmrg
33004c61c93dSmrg# XORG_LINT_LIBRARY(LIBNAME)
33014c61c93dSmrg# --------------------------
33024c61c93dSmrg# Minimum version: 1.1.0
33034c61c93dSmrg#
33044c61c93dSmrg# Sets up flags for building lint libraries for checking programs that call
33054c61c93dSmrg# functions in the library.
33064c61c93dSmrg#
3307d7ffce2aSmrg# Interface to module:
3308d7ffce2aSmrg# LINTLIB		- Automake variable with the name of lint library file to make
3309d7ffce2aSmrg# MAKE_LINT_LIB		- Automake conditional
3310d7ffce2aSmrg#
3311d7ffce2aSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
3312d7ffce2aSmrg#			  - 'no' user instructs the module not to create a lint library (default)
33134c61c93dSmrg
33144c61c93dSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
33154c61c93dSmrgAC_REQUIRE([XORG_WITH_LINT])
33164c61c93dSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
33174c61c93dSmrg	[Create lint library (default: disabled)])],
33184c61c93dSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
3319d7ffce2aSmrg
3320d7ffce2aSmrgif test "x$make_lint_lib" = x"yes" ; then
3321d7ffce2aSmrg   LINTLIB=llib-l$1.ln
3322d7ffce2aSmrg   if test "x$LINT" = "x"; then
3323d7ffce2aSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
3324d7ffce2aSmrg   fi
3325d7ffce2aSmrgelif test "x$make_lint_lib" != x"no" ; then
3326d7ffce2aSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
33274c61c93dSmrgfi
3328d7ffce2aSmrg
33294c61c93dSmrgAC_SUBST(LINTLIB)
33304c61c93dSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
33314c61c93dSmrg
33324c61c93dSmrg]) # XORG_LINT_LIBRARY
33334c61c93dSmrg
33341c80d5b0Smrg# XORG_COMPILER_BRAND
33351c80d5b0Smrg# -------------------
33361c80d5b0Smrg# Minimum version: 1.14.0
33371c80d5b0Smrg#
33381c80d5b0Smrg# Checks for various brands of compilers and sets flags as appropriate:
33391c80d5b0Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
33401c80d5b0Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
33411c80d5b0Smrg#   clang compiler - sets CLANGCC to "yes"
33421c80d5b0Smrg#   Intel compiler - sets INTELCC to "yes"
33431c80d5b0Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
33441c80d5b0Smrg#
33451c80d5b0SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
33461c80d5b0SmrgAC_LANG_CASE(
33471c80d5b0Smrg	[C], [
33481c80d5b0Smrg		AC_REQUIRE([AC_PROG_CC_C99])
33491c80d5b0Smrg	],
33501c80d5b0Smrg	[C++], [
33511c80d5b0Smrg		AC_REQUIRE([AC_PROG_CXX])
33521c80d5b0Smrg	]
33531c80d5b0Smrg)
33541c80d5b0SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
33551c80d5b0SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
33561c80d5b0SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
33571c80d5b0Smrg]) # XORG_COMPILER_BRAND
33581c80d5b0Smrg
33591c80d5b0Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
33601c80d5b0Smrg# ---------------
33611c80d5b0Smrg# Minimum version: 1.16.0
33621c80d5b0Smrg#
33631c80d5b0Smrg# Test if the compiler works when passed the given flag as a command line argument.
33641c80d5b0Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
33651c80d5b0Smrg# next flag in the list until there are no more options.
33661c80d5b0Smrg#
33671c80d5b0Smrg# Note that this does not guarantee that the compiler supports the flag as some
33681c80d5b0Smrg# compilers will simply ignore arguments that they do not understand, but we do
33691c80d5b0Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
33701c80d5b0Smrg# -Werror=unused-command-line-argument
33711c80d5b0Smrg#
33721c80d5b0SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
33731c80d5b0Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
33741c80d5b0Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
33751c80d5b0Smrg
33761c80d5b0SmrgAC_LANG_COMPILER_REQUIRE
33771c80d5b0Smrg
33781c80d5b0SmrgAC_LANG_CASE(
33791c80d5b0Smrg	[C], [
33801c80d5b0Smrg		AC_REQUIRE([AC_PROG_CC_C99])
33811c80d5b0Smrg		define([PREFIX], [C])
33821c80d5b0Smrg		define([CACHE_PREFIX], [cc])
33831c80d5b0Smrg		define([COMPILER], [$CC])
33841c80d5b0Smrg	],
33851c80d5b0Smrg	[C++], [
33861c80d5b0Smrg		define([PREFIX], [CXX])
33871c80d5b0Smrg		define([CACHE_PREFIX], [cxx])
33881c80d5b0Smrg		define([COMPILER], [$CXX])
33891c80d5b0Smrg	]
33901c80d5b0Smrg)
33911c80d5b0Smrg
33921c80d5b0Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
33931c80d5b0Smrg
33941c80d5b0Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
33951c80d5b0Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
33961c80d5b0Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
33971c80d5b0Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
33981c80d5b0Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
33991c80d5b0Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
34001c80d5b0Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
34011c80d5b0Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
34021c80d5b0Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
34031c80d5b0Smrgfi
34041c80d5b0Smrg
34051c80d5b0Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
34061c80d5b0Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
34071c80d5b0Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
34081c80d5b0Smrg	fi
34091c80d5b0Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
34101c80d5b0Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
34111c80d5b0Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
34121c80d5b0Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
34131c80d5b0Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
34141c80d5b0Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
34151c80d5b0Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
34161c80d5b0Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
34171c80d5b0Smrgfi
34181c80d5b0Smrg
34191c80d5b0Smrgfound="no"
34201c80d5b0Smrgm4_foreach([flag], m4_cdr($@), [
34211c80d5b0Smrg	if test $found = "no" ; then
342241fe0c2aSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
34231c80d5b0Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
34241c80d5b0Smrg		fi
34251c80d5b0Smrg
342641fe0c2aSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
34271c80d5b0Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
34281c80d5b0Smrg		fi
34291c80d5b0Smrg
34301c80d5b0Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
34311c80d5b0Smrg
34321c80d5b0Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
34331c80d5b0Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
34341c80d5b0Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
34351c80d5b0Smrg		AC_CACHE_VAL($cacheid,
34361c80d5b0Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
34371c80d5b0Smrg					     [eval $cacheid=yes],
34381c80d5b0Smrg					     [eval $cacheid=no])])
34391c80d5b0Smrg
34401c80d5b0Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
34411c80d5b0Smrg
34421c80d5b0Smrg		eval supported=\$$cacheid
34431c80d5b0Smrg		AC_MSG_RESULT([$supported])
34441c80d5b0Smrg		if test "$supported" = "yes" ; then
34451c80d5b0Smrg			$1="$$1 ]flag["
34461c80d5b0Smrg			found="yes"
34471c80d5b0Smrg		fi
34481c80d5b0Smrg	fi
34491c80d5b0Smrg])
34501c80d5b0Smrg]) # XORG_TESTSET_CFLAG
34511c80d5b0Smrg
34521c80d5b0Smrg# XORG_COMPILER_FLAGS
34531c80d5b0Smrg# ---------------
34541c80d5b0Smrg# Minimum version: 1.16.0
34551c80d5b0Smrg#
34561c80d5b0Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
34571c80d5b0Smrg# arguments supported by the selected compiler which do NOT alter the generated
34581c80d5b0Smrg# code.  These arguments will cause the compiler to print various warnings
34591c80d5b0Smrg# during compilation AND turn a conservative set of warnings into errors.
34601c80d5b0Smrg#
34611c80d5b0Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
34621c80d5b0Smrg# future versions of util-macros as options are added to new compilers.
34631c80d5b0Smrg#
34641c80d5b0SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
34651c80d5b0SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
34661c80d5b0Smrg
34671c80d5b0SmrgAC_ARG_ENABLE(selective-werror,
34681c80d5b0Smrg              AS_HELP_STRING([--disable-selective-werror],
34691c80d5b0Smrg                             [Turn off selective compiler errors. (default: enabled)]),
34701c80d5b0Smrg              [SELECTIVE_WERROR=$enableval],
34711c80d5b0Smrg              [SELECTIVE_WERROR=yes])
34721c80d5b0Smrg
34731c80d5b0SmrgAC_LANG_CASE(
34741c80d5b0Smrg        [C], [
34751c80d5b0Smrg                define([PREFIX], [C])
34761c80d5b0Smrg        ],
34771c80d5b0Smrg        [C++], [
34781c80d5b0Smrg                define([PREFIX], [CXX])
34791c80d5b0Smrg        ]
34801c80d5b0Smrg)
34811c80d5b0Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
34821c80d5b0Smrgif test "x$SUNCC" = "xyes"; then
34831c80d5b0Smrg    [BASE_]PREFIX[FLAGS]="-v"
34841c80d5b0Smrgelse
34851c80d5b0Smrg    [BASE_]PREFIX[FLAGS]=""
34861c80d5b0Smrgfi
34871c80d5b0Smrg
34881c80d5b0Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
34891c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
34901c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
34911c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
34921c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
34931c80d5b0Smrg
34941c80d5b0SmrgAC_LANG_CASE(
34951c80d5b0Smrg	[C], [
34961c80d5b0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
34971c80d5b0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
34981c80d5b0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
34991c80d5b0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
350041fe0c2aSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
35011c80d5b0Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
35021c80d5b0Smrg	]
35031c80d5b0Smrg)
35041c80d5b0Smrg
35051c80d5b0Smrg# This chunk adds additional warnings that could catch undesired effects.
35061c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
35071c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
35081c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
35091c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
35101c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
35111c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
351241fe0c2aSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
35131c80d5b0Smrg
35141c80d5b0Smrg# These are currently disabled because they are noisy.  They will be enabled
35151c80d5b0Smrg# in the future once the codebase is sufficiently modernized to silence
35161c80d5b0Smrg# them.  For now, I don't want them to drown out the other warnings.
35171c80d5b0Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
35181c80d5b0Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
351941fe0c2aSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
35201c80d5b0Smrg
35211c80d5b0Smrg# Turn some warnings into errors, so we don't accidently get successful builds
35221c80d5b0Smrg# when there are problems that should be fixed.
35231c80d5b0Smrg
35241c80d5b0Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
35251c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
35261c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
35271c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
35281c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
35291c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
35301c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
35311c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
35321c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
35331c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
35341c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
35351c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
35361c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
35371c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
35381c80d5b0Smrgelse
35391c80d5b0SmrgAC_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])
35401c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
35411c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
35421c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
35431c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
35441c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
35451c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
35461c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
35471c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
35481c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
35491c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
35501c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
35511c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
35521c80d5b0SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
35531c80d5b0Smrgfi
35541c80d5b0Smrg
35551c80d5b0SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
35561c80d5b0Smrg]) # XORG_COMPILER_FLAGS
35571c80d5b0Smrg
35584c61c93dSmrg# XORG_CWARNFLAGS
35594c61c93dSmrg# ---------------
35604c61c93dSmrg# Minimum version: 1.2.0
35611c80d5b0Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
35624c61c93dSmrg#
35634c61c93dSmrg# Defines CWARNFLAGS to enable C compiler warnings.
35644c61c93dSmrg#
35651c80d5b0Smrg# This function is deprecated because it defines -fno-strict-aliasing
35661c80d5b0Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
35671c80d5b0Smrg# is needed, then it should be added explicitly in the module when
35681c80d5b0Smrg# it is updated to use BASE_CFLAGS.
35691c80d5b0Smrg#
35704c61c93dSmrgAC_DEFUN([XORG_CWARNFLAGS], [
35711c80d5b0SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
35721c80d5b0SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
35731c80d5b0SmrgAC_LANG_CASE(
35741c80d5b0Smrg	[C], [
35751c80d5b0Smrg		CWARNFLAGS="$BASE_CFLAGS"
35761c80d5b0Smrg		if  test "x$GCC" = xyes ; then
35771c80d5b0Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
35781c80d5b0Smrg		fi
35791c80d5b0Smrg		AC_SUBST(CWARNFLAGS)
35801c80d5b0Smrg	]
35811c80d5b0Smrg)
35824c61c93dSmrg]) # XORG_CWARNFLAGS
35834c61c93dSmrg
35844c61c93dSmrg# XORG_STRICT_OPTION
35854c61c93dSmrg# -----------------------
35864c61c93dSmrg# Minimum version: 1.3.0
35874c61c93dSmrg#
35881c80d5b0Smrg# Add configure option to enable strict compilation flags, such as treating
35891c80d5b0Smrg# warnings as fatal errors.
35901c80d5b0Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
35911c80d5b0Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
35921c80d5b0Smrg#
35931c80d5b0Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
35941c80d5b0Smrg# when strict compilation is unconditionally desired.
35954c61c93dSmrgAC_DEFUN([XORG_STRICT_OPTION], [
35964c61c93dSmrgAC_REQUIRE([XORG_CWARNFLAGS])
35971c80d5b0SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
35984c61c93dSmrg
35994c61c93dSmrgAC_ARG_ENABLE(strict-compilation,
36004c61c93dSmrg			  AS_HELP_STRING([--enable-strict-compilation],
36014c61c93dSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
36024c61c93dSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
36031c80d5b0Smrg
36041c80d5b0SmrgAC_LANG_CASE(
36051c80d5b0Smrg        [C], [
36061c80d5b0Smrg                define([PREFIX], [C])
36071c80d5b0Smrg        ],
36081c80d5b0Smrg        [C++], [
36091c80d5b0Smrg                define([PREFIX], [CXX])
36101c80d5b0Smrg        ]
36111c80d5b0Smrg)
36121c80d5b0Smrg
36131c80d5b0Smrg[STRICT_]PREFIX[FLAGS]=""
36141c80d5b0SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
36151c80d5b0SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
36161c80d5b0Smrg
36171c80d5b0Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
36181c80d5b0Smrg# activate it with -Werror, so we add it here explicitly.
36191c80d5b0SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
36201c80d5b0Smrg
36214c61c93dSmrgif test "x$STRICT_COMPILE" = "xyes"; then
36221c80d5b0Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
36231c80d5b0Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
36244c61c93dSmrgfi
36251c80d5b0SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
36261c80d5b0SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
36271c80d5b0SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
36284c61c93dSmrg]) # XORG_STRICT_OPTION
36294c61c93dSmrg
36304c61c93dSmrg# XORG_DEFAULT_OPTIONS
36314c61c93dSmrg# --------------------
36324c61c93dSmrg# Minimum version: 1.3.0
36334c61c93dSmrg#
36344c61c93dSmrg# Defines default options for X.Org modules.
36354c61c93dSmrg#
36364c61c93dSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3637d7ffce2aSmrgAC_REQUIRE([AC_PROG_INSTALL])
36381c80d5b0SmrgXORG_COMPILER_FLAGS
36394c61c93dSmrgXORG_CWARNFLAGS
36404c61c93dSmrgXORG_STRICT_OPTION
36414c61c93dSmrgXORG_RELEASE_VERSION
36424c61c93dSmrgXORG_CHANGELOG
3643d7ffce2aSmrgXORG_INSTALL
36444c61c93dSmrgXORG_MANPAGE_SECTIONS
3645d7ffce2aSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3646d7ffce2aSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
36474c61c93dSmrg]) # XORG_DEFAULT_OPTIONS
3648d7ffce2aSmrg
3649d7ffce2aSmrg# XORG_INSTALL()
3650d7ffce2aSmrg# ----------------
3651d7ffce2aSmrg# Minimum version: 1.4.0
3652d7ffce2aSmrg#
3653d7ffce2aSmrg# Defines the variable INSTALL_CMD as the command to copy
3654d7ffce2aSmrg# INSTALL from $prefix/share/util-macros.
3655d7ffce2aSmrg#
3656d7ffce2aSmrgAC_DEFUN([XORG_INSTALL], [
3657d7ffce2aSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3658d7ffce2aSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3659d7ffce2aSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3660d7ffce2aSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3661b8df70beSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3662b8df70beSmrgtouch \$(top_srcdir)/INSTALL; \
3663b8df70beSmrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3664d7ffce2aSmrgAC_SUBST([INSTALL_CMD])
3665d7ffce2aSmrg]) # XORG_INSTALL
36664c61c93dSmrgdnl Copyright 2005 Red Hat, Inc
36674c61c93dSmrgdnl
36684c61c93dSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
36694c61c93dSmrgdnl documentation for any purpose is hereby granted without fee, provided that
36704c61c93dSmrgdnl the above copyright notice appear in all copies and that both that
36714c61c93dSmrgdnl copyright notice and this permission notice appear in supporting
36724c61c93dSmrgdnl documentation.
36734c61c93dSmrgdnl
36744c61c93dSmrgdnl The above copyright notice and this permission notice shall be included
36754c61c93dSmrgdnl in all copies or substantial portions of the Software.
36764c61c93dSmrgdnl
36774c61c93dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
36784c61c93dSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
36794c61c93dSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
36804c61c93dSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
36814c61c93dSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
36824c61c93dSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
36834c61c93dSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
36844c61c93dSmrgdnl
36854c61c93dSmrgdnl Except as contained in this notice, the name of the copyright holders shall
36864c61c93dSmrgdnl not be used in advertising or otherwise to promote the sale, use or
36874c61c93dSmrgdnl other dealings in this Software without prior written authorization
36884c61c93dSmrgdnl from the copyright holders.
36894c61c93dSmrgdnl
36904c61c93dSmrg
36914c61c93dSmrg# XORG_RELEASE_VERSION
36924c61c93dSmrg# --------------------
3693d7ffce2aSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
369441fe0c2aSmrg
36954c61c93dSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
36964c61c93dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
36974c61c93dSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
36984c61c93dSmrg		[Major version of this package])
36994c61c93dSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
37004c61c93dSmrg	if test "x$PVM" = "x"; then
37014c61c93dSmrg		PVM="0"
37024c61c93dSmrg	fi
37034c61c93dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
37044c61c93dSmrg		[$PVM],
37054c61c93dSmrg		[Minor version of this package])
37064c61c93dSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
37074c61c93dSmrg	if test "x$PVP" = "x"; then
37084c61c93dSmrg		PVP="0"
37094c61c93dSmrg	fi
37104c61c93dSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
37114c61c93dSmrg		[$PVP],
37124c61c93dSmrg		[Patch version of this package])
37134c61c93dSmrg])
37144c61c93dSmrg
37154c61c93dSmrg# XORG_CHANGELOG()
37164c61c93dSmrg# ----------------
37174c61c93dSmrg# Minimum version: 1.2.0
37184c61c93dSmrg#
37194c61c93dSmrg# Defines the variable CHANGELOG_CMD as the command to generate
37204c61c93dSmrg# ChangeLog from git.
37214c61c93dSmrg#
37224c61c93dSmrg#
37234c61c93dSmrgAC_DEFUN([XORG_CHANGELOG], [
3724b8df70beSmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3725d7ffce2aSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3726b8df70beSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3727b8df70beSmrgtouch \$(top_srcdir)/ChangeLog; \
3728b8df70beSmrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
37294c61c93dSmrgAC_SUBST([CHANGELOG_CMD])
37304c61c93dSmrg]) # XORG_CHANGELOG
37314c61c93dSmrg
3732