13bf3b463Smrg# generated automatically by aclocal 1.17 -*- Autoconf -*-
2fb5e8d76Smrg
33bf3b463Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
4266e564dSmrg
5266e564dSmrg# This file is free software; the Free Software Foundation
6266e564dSmrg# gives unlimited permission to copy and/or distribute it,
7266e564dSmrg# with or without modifications, as long as this notice is preserved.
8266e564dSmrg
9266e564dSmrg# This program is distributed in the hope that it will be useful,
10266e564dSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11266e564dSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12266e564dSmrg# PARTICULAR PURPOSE.
13266e564dSmrg
14fb5e8d76Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15c5629e66Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16c5629e66Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
173bf3b463Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
183bf3b463Smrg[m4_warning([this file was generated for autoconf 2.72.
19c5629e66SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20c5629e66SmrgIf you have problems, you may need to regenerate the build system entirely.
21fb5e8d76SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22266e564dSmrg
233bf3b463Smrg# Copyright (C) 2002-2024 Free Software Foundation, Inc.
24698f425bSmrg#
253bf3b463Smrg# This file is free software; the Free Software Foundation
263bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
273bf3b463Smrg# with or without modifications, as long as this notice is preserved.
28698f425bSmrg
293bf3b463Smrg# AM_AUTOMAKE_VERSION(VERSION)
303bf3b463Smrg# ----------------------------
313bf3b463Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
323bf3b463Smrg# generated from the m4 files accompanying Automake X.Y.
333bf3b463Smrg# (This private macro should not be called outside this file.)
343bf3b463SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
353bf3b463Smrg[am__api_version='1.17'
363bf3b463Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
373bf3b463Smrgdnl require some minimum version.  Point them to the right macro.
383bf3b463Smrgm4_if([$1], [1.17], [],
393bf3b463Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
409ef0b394Smrg])
41698f425bSmrg
423bf3b463Smrg# _AM_AUTOCONF_VERSION(VERSION)
43a3129944Smrg# -----------------------------
443bf3b463Smrg# aclocal traces this macro to find the Autoconf version.
453bf3b463Smrg# This is a private macro too.  Using m4_define simplifies
463bf3b463Smrg# the logic in aclocal, which can simply ignore this definition.
473bf3b463Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48698f425bSmrg
493bf3b463Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
503bf3b463Smrg# -------------------------------
513bf3b463Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
523bf3b463Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
533bf3b463SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
543bf3b463Smrg[AM_AUTOMAKE_VERSION([1.17])dnl
553bf3b463Smrgm4_ifndef([AC_AUTOCONF_VERSION],
563bf3b463Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
573bf3b463Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58698f425bSmrg
593bf3b463Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60698f425bSmrg
613bf3b463Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
623bf3b463Smrg#
633bf3b463Smrg# This file is free software; the Free Software Foundation
643bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
653bf3b463Smrg# with or without modifications, as long as this notice is preserved.
66698f425bSmrg
673bf3b463Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
683bf3b463Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
693bf3b463Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
703bf3b463Smrg#
713bf3b463Smrg# Of course, Automake must honor this variable whenever it calls a
723bf3b463Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
733bf3b463Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
743bf3b463Smrg# depending on how configure is run.  This is pretty annoying, since
753bf3b463Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
763bf3b463Smrg# source directory, any form will work fine, but in subdirectories a
773bf3b463Smrg# relative path needs to be adjusted first.
783bf3b463Smrg#
793bf3b463Smrg# $ac_aux_dir/missing
803bf3b463Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
813bf3b463Smrg# $top_srcdir/$ac_aux_dir/missing
823bf3b463Smrg#    fails if $ac_aux_dir is absolute,
833bf3b463Smrg#    fails when called from a subdirectory in a VPATH build with
843bf3b463Smrg#          a relative $ac_aux_dir
853bf3b463Smrg#
863bf3b463Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
873bf3b463Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
883bf3b463Smrg# harmless because $srcdir is '.', but things will broke when you
893bf3b463Smrg# start a VPATH build or use an absolute $srcdir.
903bf3b463Smrg#
913bf3b463Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
923bf3b463Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
933bf3b463Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
943bf3b463Smrg# and then we would define $MISSING as
953bf3b463Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
963bf3b463Smrg# This will work as long as MISSING is not called from configure, because
973bf3b463Smrg# unfortunately $(top_srcdir) has no meaning in configure.
983bf3b463Smrg# However there are other variables, like CC, which are often used in
993bf3b463Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1003bf3b463Smrg#
1013bf3b463Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1023bf3b463Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1033bf3b463Smrg# configured tree to be moved without reconfiguration.
104698f425bSmrg
1053bf3b463SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1063bf3b463Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1073bf3b463Smrg# Expand $ac_aux_dir to an absolute path.
1083bf3b463Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109a3129944Smrg])
110698f425bSmrg
1113bf3b463Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112fb5e8d76Smrg
1133bf3b463Smrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
1143bf3b463Smrg#
1153bf3b463Smrg# This file is free software; the Free Software Foundation
1163bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
1173bf3b463Smrg# with or without modifications, as long as this notice is preserved.
118fb5e8d76Smrg
1193bf3b463Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1203bf3b463Smrg# -------------------------------------
1213bf3b463Smrg# Define a conditional.
1223bf3b463SmrgAC_DEFUN([AM_CONDITIONAL],
1233bf3b463Smrg[AC_PREREQ([2.52])dnl
1243bf3b463Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1253bf3b463Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1263bf3b463SmrgAC_SUBST([$1_TRUE])dnl
1273bf3b463SmrgAC_SUBST([$1_FALSE])dnl
1283bf3b463Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1293bf3b463Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1303bf3b463Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1313bf3b463Smrgif $2; then
1323bf3b463Smrg  $1_TRUE=
1333bf3b463Smrg  $1_FALSE='#'
1343bf3b463Smrgelse
1353bf3b463Smrg  $1_TRUE='#'
1363bf3b463Smrg  $1_FALSE=
1373bf3b463Smrgfi
1383bf3b463SmrgAC_CONFIG_COMMANDS_PRE(
1393bf3b463Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1403bf3b463Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1413bf3b463SmrgUsually this means the macro was only invoked conditionally.]])
1423bf3b463Smrgfi])])
143698f425bSmrg
1443bf3b463Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
1453bf3b463Smrg#
1463bf3b463Smrg# This file is free software; the Free Software Foundation
1473bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
1483bf3b463Smrg# with or without modifications, as long as this notice is preserved.
149698f425bSmrg
150fb5e8d76Smrg
1513bf3b463Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1523bf3b463Smrg# written in clear, in which case automake, when reading aclocal.m4,
1533bf3b463Smrg# will think it sees a *use*, and therefore will trigger all it's
1543bf3b463Smrg# C support machinery.  Also note that it means that autoscan, seeing
1553bf3b463Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156a3129944Smrg
157698f425bSmrg
1583bf3b463Smrg# _AM_DEPENDENCIES(NAME)
1593bf3b463Smrg# ----------------------
1603bf3b463Smrg# See how the compiler implements dependency checking.
1613bf3b463Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1623bf3b463Smrg# We try a few techniques and use that to set a single cache variable.
1639ef0b394Smrg#
1643bf3b463Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1653bf3b463Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1663bf3b463Smrg# dependency, and given that the user is not expected to run this macro,
1673bf3b463Smrg# just rely on AC_PROG_CC.
1683bf3b463SmrgAC_DEFUN([_AM_DEPENDENCIES],
1693bf3b463Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1703bf3b463SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1713bf3b463SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1723bf3b463SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173a3129944Smrg
1743bf3b463Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1753bf3b463Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1763bf3b463Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1773bf3b463Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1783bf3b463Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1793bf3b463Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1803bf3b463Smrg                    [depcc="$$1"   am_compiler_list=])
181698f425bSmrg
1823bf3b463SmrgAC_CACHE_CHECK([dependency style of $depcc],
1833bf3b463Smrg               [am_cv_$1_dependencies_compiler_type],
1843bf3b463Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1853bf3b463Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
1863bf3b463Smrg  # making bogus files that we don't know about and never remove.  For
1873bf3b463Smrg  # instance it was reported that on HP-UX the gcc test will end up
1883bf3b463Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1893bf3b463Smrg  # in D".
1903bf3b463Smrg  rm -rf conftest.dir
1913bf3b463Smrg  mkdir conftest.dir
1923bf3b463Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1933bf3b463Smrg  # using a relative directory.
1943bf3b463Smrg  cp "$am_depcomp" conftest.dir
1953bf3b463Smrg  cd conftest.dir
1963bf3b463Smrg  # We will build objects and dependencies in a subdirectory because
1973bf3b463Smrg  # it helps to detect inapplicable dependency modes.  For instance
1983bf3b463Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1993bf3b463Smrg  # side effect of compilation, but ICC will put the dependencies in
2003bf3b463Smrg  # the current directory while Tru64 will put them in the object
2013bf3b463Smrg  # directory.
2023bf3b463Smrg  mkdir sub
203698f425bSmrg
2043bf3b463Smrg  am_cv_$1_dependencies_compiler_type=none
2053bf3b463Smrg  if test "$am_compiler_list" = ""; then
2063bf3b463Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2073bf3b463Smrg  fi
2083bf3b463Smrg  am__universal=false
2093bf3b463Smrg  m4_case([$1], [CC],
2103bf3b463Smrg    [case " $depcc " in #(
2113bf3b463Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2123bf3b463Smrg     esac],
2133bf3b463Smrg    [CXX],
2143bf3b463Smrg    [case " $depcc " in #(
2153bf3b463Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2163bf3b463Smrg     esac])
217698f425bSmrg
2183bf3b463Smrg  for depmode in $am_compiler_list; do
2193bf3b463Smrg    # Setup a source with many dependencies, because some compilers
2203bf3b463Smrg    # like to wrap large dependency lists on column 80 (with \), and
2213bf3b463Smrg    # we should not choose a depcomp mode which is confused by this.
2223bf3b463Smrg    #
2233bf3b463Smrg    # We need to recreate these files for each test, as the compiler may
2243bf3b463Smrg    # overwrite some of them when testing with obscure command lines.
2253bf3b463Smrg    # This happens at least with the AIX C compiler.
2263bf3b463Smrg    : > sub/conftest.c
2273bf3b463Smrg    for i in 1 2 3 4 5 6; do
2283bf3b463Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2293bf3b463Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2303bf3b463Smrg      # Solaris 10 /bin/sh.
2313bf3b463Smrg      echo '/* dummy */' > sub/conftst$i.h
2323bf3b463Smrg    done
2333bf3b463Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234698f425bSmrg
2353bf3b463Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2363bf3b463Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2373bf3b463Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2383bf3b463Smrg    # versions had trouble with output in subdirs.
2393bf3b463Smrg    am__obj=sub/conftest.${OBJEXT-o}
2403bf3b463Smrg    am__minus_obj="-o $am__obj"
2413bf3b463Smrg    case $depmode in
2423bf3b463Smrg    gcc)
2433bf3b463Smrg      # This depmode causes a compiler race in universal mode.
2443bf3b463Smrg      test "$am__universal" = false || continue
245fb5e8d76Smrg      ;;
2463bf3b463Smrg    nosideeffect)
2473bf3b463Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2483bf3b463Smrg      # only be used when explicitly requested.
2493bf3b463Smrg      if test "x$enable_dependency_tracking" = xyes; then
2503bf3b463Smrg	continue
2513bf3b463Smrg      else
2523bf3b463Smrg	break
2533bf3b463Smrg      fi
254fb5e8d76Smrg      ;;
2553bf3b463Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2563bf3b463Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2573bf3b463Smrg      # not run yet.  These depmodes are late enough in the game, and
2583bf3b463Smrg      # so weak that their functioning should not be impacted.
2593bf3b463Smrg      am__obj=conftest.${OBJEXT-o}
2603bf3b463Smrg      am__minus_obj=
261fb5e8d76Smrg      ;;
2623bf3b463Smrg    none) break ;;
263fb5e8d76Smrg    esac
2643bf3b463Smrg    if depmode=$depmode \
2653bf3b463Smrg       source=sub/conftest.c object=$am__obj \
2663bf3b463Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2673bf3b463Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2683bf3b463Smrg         >/dev/null 2>conftest.err &&
2693bf3b463Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2703bf3b463Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2713bf3b463Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2723bf3b463Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2733bf3b463Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2743bf3b463Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2753bf3b463Smrg      # that says an option was ignored or not supported.
2763bf3b463Smrg      # When given -MP, icc 7.0 and 7.1 complain thus:
2773bf3b463Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2783bf3b463Smrg      # The diagnosis changed in icc 8.0:
2793bf3b463Smrg      #   icc: Command line remark: option '-MP' not supported
2803bf3b463Smrg      if (grep 'ignoring option' conftest.err ||
2813bf3b463Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2823bf3b463Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2833bf3b463Smrg        break
2843bf3b463Smrg      fi
2853bf3b463Smrg    fi
2863bf3b463Smrg  done
287266e564dSmrg
2883bf3b463Smrg  cd ..
2893bf3b463Smrg  rm -rf conftest.dir
2903bf3b463Smrgelse
2913bf3b463Smrg  am_cv_$1_dependencies_compiler_type=none
2923bf3b463Smrgfi
2933bf3b463Smrg])
2943bf3b463SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2953bf3b463SmrgAM_CONDITIONAL([am__fastdep$1], [
2963bf3b463Smrg  test "x$enable_dependency_tracking" != xno \
2973bf3b463Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298a3129944Smrg])
299266e564dSmrg
3009ef0b394Smrg
3013bf3b463Smrg# AM_SET_DEPDIR
3023bf3b463Smrg# -------------
3033bf3b463Smrg# Choose a directory name for dependency files.
3043bf3b463Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3053bf3b463SmrgAC_DEFUN([AM_SET_DEPDIR],
3063bf3b463Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3073bf3b463SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3083bf3b463Smrg])
309266e564dSmrg
310266e564dSmrg
3113bf3b463Smrg# AM_DEP_TRACK
3123bf3b463Smrg# ------------
3133bf3b463SmrgAC_DEFUN([AM_DEP_TRACK],
3143bf3b463Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3153bf3b463SmrgAS_HELP_STRING(
3163bf3b463Smrg  [--enable-dependency-tracking],
3173bf3b463Smrg  [do not reject slow dependency extractors])
3183bf3b463SmrgAS_HELP_STRING(
3193bf3b463Smrg  [--disable-dependency-tracking],
3203bf3b463Smrg  [speeds up one-time build])])
3213bf3b463Smrgif test "x$enable_dependency_tracking" != xno; then
3223bf3b463Smrg  am_depcomp="$ac_aux_dir/depcomp"
3233bf3b463Smrg  AMDEPBACKSLASH='\'
3243bf3b463Smrg  am__nodep='_no'
3253bf3b463Smrgfi
3263bf3b463SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3273bf3b463SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3283bf3b463Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3293bf3b463SmrgAC_SUBST([am__nodep])dnl
3303bf3b463Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
3313bf3b463Smrg])
332266e564dSmrg
3333bf3b463Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334266e564dSmrg
3353bf3b463Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
3363bf3b463Smrg#
3373bf3b463Smrg# This file is free software; the Free Software Foundation
3383bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
3393bf3b463Smrg# with or without modifications, as long as this notice is preserved.
340266e564dSmrg
3413bf3b463Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3423bf3b463Smrg# ------------------------------
3433bf3b463SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3443bf3b463Smrg[{
3453bf3b463Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3463bf3b463Smrg  # are listed without --file.  Let's play safe and only enable the eval
3473bf3b463Smrg  # if we detect the quoting.
3483bf3b463Smrg  # TODO: see whether this extra hack can be removed once we start
3493bf3b463Smrg  # requiring Autoconf 2.70 or later.
3503bf3b463Smrg  AS_CASE([$CONFIG_FILES],
3513bf3b463Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
3523bf3b463Smrg          [*], [set x $CONFIG_FILES])
3533bf3b463Smrg  shift
3543bf3b463Smrg  # Used to flag and report bootstrapping failures.
3553bf3b463Smrg  am_rc=0
3563bf3b463Smrg  for am_mf
3573bf3b463Smrg  do
3583bf3b463Smrg    # Strip MF so we end up with the name of the file.
3593bf3b463Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
3603bf3b463Smrg    # Check whether this is an Automake generated Makefile which includes
3613bf3b463Smrg    # dependency-tracking related rules and includes.
3623bf3b463Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
3633bf3b463Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3643bf3b463Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
3653bf3b463Smrg      || continue
3663bf3b463Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
3673bf3b463Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
3683bf3b463Smrg    AM_RUN_LOG([cd "$am_dirpart" \
3693bf3b463Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
3703bf3b463Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
3713bf3b463Smrg  done
3723bf3b463Smrg  if test $am_rc -ne 0; then
3733bf3b463Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
3743bf3b463Smrg    for automatic dependency tracking.  If GNU make was not used, consider
3753bf3b463Smrg    re-running the configure script with MAKE="gmake" (or whatever is
3763bf3b463Smrg    necessary).  You can also try re-running configure with the
3773bf3b463Smrg    '--disable-dependency-tracking' option to at least be able to build
3783bf3b463Smrg    the package (albeit without support for automatic dependency tracking).])
3793bf3b463Smrg  fi
3803bf3b463Smrg  AS_UNSET([am_dirpart])
3813bf3b463Smrg  AS_UNSET([am_filepart])
3823bf3b463Smrg  AS_UNSET([am_mf])
3833bf3b463Smrg  AS_UNSET([am_rc])
3843bf3b463Smrg  rm -f conftest-deps.mk
3853bf3b463Smrg}
3863bf3b463Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387266e564dSmrg
388266e564dSmrg
3893bf3b463Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3903bf3b463Smrg# -----------------------------
3913bf3b463Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
3923bf3b463Smrg#
3933bf3b463Smrg# This code is only required when automatic dependency tracking is enabled.
3943bf3b463Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
3953bf3b463Smrg# order to bootstrap the dependency handling code.
3963bf3b463SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3973bf3b463Smrg[AC_CONFIG_COMMANDS([depfiles],
3983bf3b463Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3993bf3b463Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
4009ef0b394Smrg
4013bf3b463Smrg# Do all the work for Automake.                             -*- Autoconf -*-
4029ef0b394Smrg
4033bf3b463Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
4043bf3b463Smrg#
4053bf3b463Smrg# This file is free software; the Free Software Foundation
4063bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
4073bf3b463Smrg# with or without modifications, as long as this notice is preserved.
4089ef0b394Smrg
4093bf3b463Smrg# This macro actually does too much.  Some checks are only needed if
4103bf3b463Smrg# your package does certain things.  But this isn't really a big deal.
4119ef0b394Smrg
4123bf3b463Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4133bf3b463Smrgm4_define([AC_PROG_CC],
4143bf3b463Smrgm4_defn([AC_PROG_CC])
4153bf3b463Smrg[_AM_PROG_CC_C_O
4163bf3b463Smrg])
4179ef0b394Smrg
4183bf3b463Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4193bf3b463Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4203bf3b463Smrg# -----------------------------------------------
4213bf3b463Smrg# The call with PACKAGE and VERSION arguments is the old style
4223bf3b463Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4233bf3b463Smrg# and VERSION should now be passed to AC_INIT and removed from
4243bf3b463Smrg# the call to AM_INIT_AUTOMAKE.
4253bf3b463Smrg# We support both call styles for the transition.  After
4263bf3b463Smrg# the next Automake release, Autoconf can make the AC_INIT
4273bf3b463Smrg# arguments mandatory, and then we can depend on a new Autoconf
4283bf3b463Smrg# release and drop the old call support.
4293bf3b463SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4303bf3b463Smrg[AC_PREREQ([2.65])dnl
4313bf3b463Smrgm4_ifdef([_$0_ALREADY_INIT],
4323bf3b463Smrg  [m4_fatal([$0 expanded multiple times
4333bf3b463Smrg]m4_defn([_$0_ALREADY_INIT]))],
4343bf3b463Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
4353bf3b463Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4363bf3b463Smrgdnl the ones we care about.
4373bf3b463Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4383bf3b463SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4393bf3b463SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4403bf3b463Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4413bf3b463Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4423bf3b463Smrg  # is not polluted with repeated "-I."
4433bf3b463Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4443bf3b463Smrg  # test to see if srcdir already configured
4453bf3b463Smrg  if test -f $srcdir/config.status; then
4463bf3b463Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4473bf3b463Smrg  fi
448a3129944Smrgfi
449698f425bSmrg
4503bf3b463Smrg# test whether we have cygpath
4513bf3b463Smrgif test -z "$CYGPATH_W"; then
4523bf3b463Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4533bf3b463Smrg    CYGPATH_W='cygpath -w'
4543bf3b463Smrg  else
4553bf3b463Smrg    CYGPATH_W=echo
456a3129944Smrg  fi
457a3129944Smrgfi
4583bf3b463SmrgAC_SUBST([CYGPATH_W])
459266e564dSmrg
4603bf3b463Smrg# Define the identity of the package.
4613bf3b463Smrgdnl Distinguish between old-style and new-style calls.
4623bf3b463Smrgm4_ifval([$2],
4633bf3b463Smrg[AC_DIAGNOSE([obsolete],
4643bf3b463Smrg             [$0: two- and three-arguments forms are deprecated.])
4653bf3b463Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4663bf3b463Smrg AC_SUBST([PACKAGE], [$1])dnl
4673bf3b463Smrg AC_SUBST([VERSION], [$2])],
4683bf3b463Smrg[_AM_SET_OPTIONS([$1])dnl
4693bf3b463Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4703bf3b463Smrgm4_if(
4713bf3b463Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4723bf3b463Smrg  [ok:ok],,
4733bf3b463Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4743bf3b463Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4753bf3b463Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
476266e564dSmrg
4773bf3b463Smrg_AM_IF_OPTION([no-define],,
4783bf3b463Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4793bf3b463Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
480266e564dSmrg
4813bf3b463Smrg# Some tools Automake needs.
4823bf3b463SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4833bf3b463SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4843bf3b463SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4853bf3b463SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4863bf3b463SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4873bf3b463SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4883bf3b463SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4893bf3b463SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4903bf3b463SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4913bf3b463SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4923bf3b463Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4933bf3b463Smrg# dies out for good.  For more background, see:
4943bf3b463Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4953bf3b463Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4963bf3b463SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
4973bf3b463Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
4983bf3b463Smrg# system "awk" is bad on some platforms.
4993bf3b463SmrgAC_REQUIRE([AC_PROG_AWK])dnl
5003bf3b463SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5013bf3b463SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5023bf3b463Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5033bf3b463Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5043bf3b463Smrg			     [_AM_PROG_TAR([v7])])])
5053bf3b463Smrg_AM_IF_OPTION([no-dependencies],,
5063bf3b463Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5073bf3b463Smrg		  [_AM_DEPENDENCIES([CC])],
5083bf3b463Smrg		  [m4_define([AC_PROG_CC],
5093bf3b463Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5103bf3b463SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5113bf3b463Smrg		  [_AM_DEPENDENCIES([CXX])],
5123bf3b463Smrg		  [m4_define([AC_PROG_CXX],
5133bf3b463Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5143bf3b463SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5153bf3b463Smrg		  [_AM_DEPENDENCIES([OBJC])],
5163bf3b463Smrg		  [m4_define([AC_PROG_OBJC],
5173bf3b463Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5183bf3b463SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5193bf3b463Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5203bf3b463Smrg		  [m4_define([AC_PROG_OBJCXX],
5213bf3b463Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522a3129944Smrg])
5233bf3b463Smrg# Variables for tags utilities; see am/tags.am
5243bf3b463Smrgif test -z "$CTAGS"; then
5253bf3b463Smrg  CTAGS=ctags
526a3129944Smrgfi
5273bf3b463SmrgAC_SUBST([CTAGS])
5283bf3b463Smrgif test -z "$ETAGS"; then
5293bf3b463Smrg  ETAGS=etags
530a3129944Smrgfi
5313bf3b463SmrgAC_SUBST([ETAGS])
5323bf3b463Smrgif test -z "$CSCOPE"; then
5333bf3b463Smrg  CSCOPE=cscope
5343bf3b463Smrgfi
5353bf3b463SmrgAC_SUBST([CSCOPE])
536266e564dSmrg
5373bf3b463SmrgAC_REQUIRE([_AM_SILENT_RULES])dnl
5383bf3b463Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5393bf3b463Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5403bf3b463Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5413bf3b463SmrgAC_CONFIG_COMMANDS_PRE(dnl
5423bf3b463Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5433bf3b463Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544266e564dSmrg
5453bf3b463SmrgAC_REQUIRE([_AM_PROG_RM_F])
5463bf3b463SmrgAC_REQUIRE([_AM_PROG_XARGS_N])
547266e564dSmrg
5483bf3b463Smrgdnl The trailing newline in this macro's definition is deliberate, for
5493bf3b463Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5503bf3b463Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
5513bf3b463Smrg])
552266e564dSmrg
5533bf3b463Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5543bf3b463Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5553bf3b463Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5563bf3b463Smrgm4_define([_AC_COMPILER_EXEEXT],
5573bf3b463Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
558266e564dSmrg
5593bf3b463Smrg# When config.status generates a header, we must update the stamp-h file.
5603bf3b463Smrg# This file resides in the same directory as the config header
5613bf3b463Smrg# that is generated.  The stamp files are numbered to have different names.
562266e564dSmrg
5633bf3b463Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5643bf3b463Smrg# loop where config.status creates the headers, so we can generate
5653bf3b463Smrg# our stamp files there.
5663bf3b463SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5673bf3b463Smrg[# Compute $1's index in $config_headers.
5683bf3b463Smrg_am_arg=$1
5693bf3b463Smrg_am_stamp_count=1
5703bf3b463Smrgfor _am_header in $config_headers :; do
5713bf3b463Smrg  case $_am_header in
5723bf3b463Smrg    $_am_arg | $_am_arg:* )
5733bf3b463Smrg      break ;;
5743bf3b463Smrg    * )
5753bf3b463Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
576c5629e66Smrg  esac
5773bf3b463Smrgdone
5783bf3b463Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
5799ef0b394Smrg
5803bf3b463Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
5813bf3b463Smrg#
5823bf3b463Smrg# This file is free software; the Free Software Foundation
5833bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
5843bf3b463Smrg# with or without modifications, as long as this notice is preserved.
585266e564dSmrg
5863bf3b463Smrg# AM_PROG_INSTALL_SH
5873bf3b463Smrg# ------------------
5883bf3b463Smrg# Define $install_sh.
5893bf3b463SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
5903bf3b463Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5913bf3b463Smrgif test x"${install_sh+set}" != xset; then
5923bf3b463Smrg  case $am_aux_dir in
5933bf3b463Smrg  *\ * | *\	*)
5943bf3b463Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
595a3129944Smrg  *)
5963bf3b463Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
597a3129944Smrg  esac
598a3129944Smrgfi
5993bf3b463SmrgAC_SUBST([install_sh])])
600266e564dSmrg
6013bf3b463Smrg# Copyright (C) 2003-2024 Free Software Foundation, Inc.
6023bf3b463Smrg#
6033bf3b463Smrg# This file is free software; the Free Software Foundation
6043bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
6053bf3b463Smrg# with or without modifications, as long as this notice is preserved.
606fb5e8d76Smrg
6073bf3b463Smrg# Check whether the underlying file-system supports filenames
6083bf3b463Smrg# with a leading dot.  For instance MS-DOS doesn't.
6093bf3b463SmrgAC_DEFUN([AM_SET_LEADING_DOT],
6103bf3b463Smrg[rm -rf .tst 2>/dev/null
6113bf3b463Smrgmkdir .tst 2>/dev/null
6123bf3b463Smrgif test -d .tst; then
6133bf3b463Smrg  am__leading_dot=.
614a3129944Smrgelse
6153bf3b463Smrg  am__leading_dot=_
616a3129944Smrgfi
6173bf3b463Smrgrmdir .tst 2>/dev/null
6183bf3b463SmrgAC_SUBST([am__leading_dot])])
619266e564dSmrg
6203bf3b463Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
621266e564dSmrg
6223bf3b463Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
6233bf3b463Smrg#
6243bf3b463Smrg# This file is free software; the Free Software Foundation
6253bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
6263bf3b463Smrg# with or without modifications, as long as this notice is preserved.
627698f425bSmrg
6283bf3b463Smrg# AM_MAKE_INCLUDE()
6293bf3b463Smrg# -----------------
6303bf3b463Smrg# Check whether make has an 'include' directive that can support all
6313bf3b463Smrg# the idioms we need for our automatic dependency tracking code.
6323bf3b463SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6333bf3b463Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
6343bf3b463Smrgcat > confinc.mk << 'END'
6353bf3b463Smrgam__doit:
6363bf3b463Smrg	@echo this is the am__doit target >confinc.out
6373bf3b463Smrg.PHONY: am__doit
6383bf3b463SmrgEND
6393bf3b463Smrgam__include="#"
6403bf3b463Smrgam__quote=
6413bf3b463Smrg# BSD make does it like this.
6423bf3b463Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
6433bf3b463Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
6443bf3b463Smrgecho 'include confinc.mk # ignored' > confmf.GNU
6453bf3b463Smrg_am_result=no
6463bf3b463Smrgfor s in GNU BSD; do
6473bf3b463Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
6483bf3b463Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
6493bf3b463Smrg      ['0:this is the am__doit target'],
6503bf3b463Smrg      [AS_CASE([$s],
6513bf3b463Smrg          [BSD], [am__include='.include' am__quote='"'],
6523bf3b463Smrg          [am__include='include' am__quote=''])])
6533bf3b463Smrg  if test "$am__include" != "#"; then
6543bf3b463Smrg    _am_result="yes ($s style)"
6553bf3b463Smrg    break
656a3129944Smrg  fi
6573bf3b463Smrgdone
6583bf3b463Smrgrm -f confinc.* confmf.*
6593bf3b463SmrgAC_MSG_RESULT([${_am_result}])
6603bf3b463SmrgAC_SUBST([am__include])])
6613bf3b463SmrgAC_SUBST([am__quote])])
662fb5e8d76Smrg
6633bf3b463Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
664a3129944Smrg
6653bf3b463Smrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
6663bf3b463Smrg#
6673bf3b463Smrg# This file is free software; the Free Software Foundation
6683bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
6693bf3b463Smrg# with or without modifications, as long as this notice is preserved.
670a3129944Smrg
6713bf3b463Smrg# AM_MISSING_PROG(NAME, PROGRAM)
6723bf3b463Smrg# ------------------------------
6733bf3b463SmrgAC_DEFUN([AM_MISSING_PROG],
6743bf3b463Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
6753bf3b463Smrg$1=${$1-"${am_missing_run}$2"}
6763bf3b463SmrgAC_SUBST($1)])
677a3129944Smrg
6783bf3b463Smrg# AM_MISSING_HAS_RUN
6793bf3b463Smrg# ------------------
6803bf3b463Smrg# Define MISSING if not defined so far and test if it is modern enough.
6813bf3b463Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
6823bf3b463SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
6833bf3b463Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6843bf3b463SmrgAC_REQUIRE_AUX_FILE([missing])dnl
6853bf3b463Smrgif test x"${MISSING+set}" != xset; then
6863bf3b463Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
6873bf3b463Smrgfi
6883bf3b463Smrg# Use eval to expand $SHELL
6893bf3b463Smrgif eval "$MISSING --is-lightweight"; then
6903bf3b463Smrg  am_missing_run="$MISSING "
6913bf3b463Smrgelse
6923bf3b463Smrg  am_missing_run=
6933bf3b463Smrg  AC_MSG_WARN(['missing' script is too old or missing])
6943bf3b463Smrgfi
6953bf3b463Smrg])
696fb5e8d76Smrg
6973bf3b463Smrg# Helper functions for option handling.                     -*- Autoconf -*-
698a3129944Smrg
6993bf3b463Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
7003bf3b463Smrg#
7013bf3b463Smrg# This file is free software; the Free Software Foundation
7023bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
7033bf3b463Smrg# with or without modifications, as long as this notice is preserved.
7049ef0b394Smrg
7053bf3b463Smrg# _AM_MANGLE_OPTION(NAME)
7063bf3b463Smrg# -----------------------
7073bf3b463SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7083bf3b463Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7099ef0b394Smrg
7103bf3b463Smrg# _AM_SET_OPTION(NAME)
7113bf3b463Smrg# --------------------
7123bf3b463Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7133bf3b463SmrgAC_DEFUN([_AM_SET_OPTION],
7143bf3b463Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7153bf3b463Smrg
7163bf3b463Smrg# _AM_SET_OPTIONS(OPTIONS)
7173bf3b463Smrg# ------------------------
7183bf3b463Smrg# OPTIONS is a space-separated list of Automake options.
7193bf3b463SmrgAC_DEFUN([_AM_SET_OPTIONS],
7203bf3b463Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
7213bf3b463Smrg
7223bf3b463Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7233bf3b463Smrg# -------------------------------------------
7243bf3b463Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7253bf3b463SmrgAC_DEFUN([_AM_IF_OPTION],
7263bf3b463Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
7273bf3b463Smrg
7283bf3b463Smrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
7293bf3b463Smrg#
7303bf3b463Smrg# This file is free software; the Free Software Foundation
7313bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
7323bf3b463Smrg# with or without modifications, as long as this notice is preserved.
7333bf3b463Smrg
7343bf3b463Smrg# _AM_PROG_CC_C_O
7353bf3b463Smrg# ---------------
7363bf3b463Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7373bf3b463Smrg# to automatically call this.
7383bf3b463SmrgAC_DEFUN([_AM_PROG_CC_C_O],
7393bf3b463Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7403bf3b463SmrgAC_REQUIRE_AUX_FILE([compile])dnl
7413bf3b463SmrgAC_LANG_PUSH([C])dnl
7423bf3b463SmrgAC_CACHE_CHECK(
7433bf3b463Smrg  [whether $CC understands -c and -o together],
7443bf3b463Smrg  [am_cv_prog_cc_c_o],
7453bf3b463Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7463bf3b463Smrg  # Make sure it works both with $CC and with simple cc.
7473bf3b463Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7483bf3b463Smrg  # compilers refuse to overwrite an existing .o file with -o,
7493bf3b463Smrg  # though they will create one.
7503bf3b463Smrg  am_cv_prog_cc_c_o=yes
7513bf3b463Smrg  for am_i in 1 2; do
7523bf3b463Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7533bf3b463Smrg         && test -f conftest2.$ac_objext; then
7543bf3b463Smrg      : OK
7553bf3b463Smrg    else
7563bf3b463Smrg      am_cv_prog_cc_c_o=no
7573bf3b463Smrg      break
7583bf3b463Smrg    fi
7593bf3b463Smrg  done
7603bf3b463Smrg  rm -f core conftest*
7613bf3b463Smrg  unset am_i])
7623bf3b463Smrgif test "$am_cv_prog_cc_c_o" != yes; then
7633bf3b463Smrg   # Losing compiler, so override with the script.
7643bf3b463Smrg   # FIXME: It is wrong to rewrite CC.
7653bf3b463Smrg   # But if we don't then we get into trouble of one sort or another.
7663bf3b463Smrg   # A longer-term fix would be to have automake use am__CC in this case,
7673bf3b463Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
7683bf3b463Smrg   CC="$am_aux_dir/compile $CC"
769266e564dSmrgfi
7703bf3b463SmrgAC_LANG_POP([C])])
7713bf3b463Smrg
7723bf3b463Smrg# For backward compatibility.
7733bf3b463SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
7743bf3b463Smrg
7753bf3b463Smrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
7763bf3b463Smrg#
7773bf3b463Smrg# This file is free software; the Free Software Foundation
7783bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
7793bf3b463Smrg# with or without modifications, as long as this notice is preserved.
780266e564dSmrg
7813bf3b463Smrg# _AM_PROG_RM_F
7823bf3b463Smrg# ---------------
7833bf3b463Smrg# Check whether 'rm -f' without any arguments works.
7843bf3b463Smrg# https://bugs.gnu.org/10828
7853bf3b463SmrgAC_DEFUN([_AM_PROG_RM_F],
7863bf3b463Smrg[am__rm_f_notfound=
7873bf3b463SmrgAS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
7883bf3b463SmrgAC_SUBST(am__rm_f_notfound)
7893bf3b463Smrg])
790266e564dSmrg
7913bf3b463Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
7923bf3b463Smrg#
7933bf3b463Smrg# This file is free software; the Free Software Foundation
7943bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
7953bf3b463Smrg# with or without modifications, as long as this notice is preserved.
796698f425bSmrg
7973bf3b463Smrg# AM_RUN_LOG(COMMAND)
7983bf3b463Smrg# -------------------
7993bf3b463Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8003bf3b463Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8013bf3b463SmrgAC_DEFUN([AM_RUN_LOG],
8023bf3b463Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8033bf3b463Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
804a3129944Smrg   ac_status=$?
805a3129944Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8063bf3b463Smrg   (exit $ac_status); }])
807266e564dSmrg
8083bf3b463Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8099ef0b394Smrg
8103bf3b463Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
8113bf3b463Smrg#
8123bf3b463Smrg# This file is free software; the Free Software Foundation
8133bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
8143bf3b463Smrg# with or without modifications, as long as this notice is preserved.
8153bf3b463Smrg
8163bf3b463Smrg# _AM_SLEEP_FRACTIONAL_SECONDS
8173bf3b463Smrg# ----------------------------
8183bf3b463SmrgAC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
8193bf3b463SmrgAC_CACHE_CHECK([whether sleep supports fractional seconds],
8203bf3b463Smrg               am_cv_sleep_fractional_seconds, [dnl
8213bf3b463SmrgAS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
8223bf3b463Smrg                                 [am_cv_sleep_fractional_seconds=no])
8233bf3b463Smrg])])
8243bf3b463Smrg
8253bf3b463Smrg# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
8263bf3b463Smrg# -----------------------------------
8273bf3b463Smrg# Determine the filesystem's resolution for file modification
8283bf3b463Smrg# timestamps.  The coarsest we know of is FAT, with a resolution
8293bf3b463Smrg# of only two seconds, even with the most recent "exFAT" extensions.
8303bf3b463Smrg# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
8313bf3b463Smrg# nanosecond, matching clock_gettime.  However, it is probably not
8323bf3b463Smrg# possible to delay execution of a shell script for less than one
8333bf3b463Smrg# millisecond, due to process creation overhead and scheduling
8343bf3b463Smrg# granularity, so we don't check for anything finer than that. (See below.)
8353bf3b463SmrgAC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
8363bf3b463SmrgAC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
8373bf3b463SmrgAC_CACHE_CHECK([filesystem timestamp resolution],
8383bf3b463Smrg               am_cv_filesystem_timestamp_resolution, [dnl
8393bf3b463Smrg# Default to the worst case.
8403bf3b463Smrgam_cv_filesystem_timestamp_resolution=2
8413bf3b463Smrg
8423bf3b463Smrg# Only try to go finer than 1 sec if sleep can do it.
8433bf3b463Smrg# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
8443bf3b463Smrg# - 1 sec is not much of a win compared to 2 sec, and
8453bf3b463Smrg# - it takes 2 seconds to perform the test whether 1 sec works.
8463bf3b463Smrg# 
8473bf3b463Smrg# Instead, just use the default 2s on platforms that have 1s resolution,
8483bf3b463Smrg# accept the extra 1s delay when using $sleep in the Automake tests, in
8493bf3b463Smrg# exchange for not incurring the 2s delay for running the test for all
8503bf3b463Smrg# packages.
8513bf3b463Smrg#
8523bf3b463Smrgam_try_resolutions=
8533bf3b463Smrgif test "$am_cv_sleep_fractional_seconds" = yes; then
8543bf3b463Smrg  # Even a millisecond often causes a bunch of false positives,
8553bf3b463Smrg  # so just try a hundredth of a second. The time saved between .001 and
8563bf3b463Smrg  # .01 is not terribly consequential.
8573bf3b463Smrg  am_try_resolutions="0.01 0.1 $am_try_resolutions"
8583bf3b463Smrgfi
8593bf3b463Smrg
8603bf3b463Smrg# In order to catch current-generation FAT out, we must *modify* files
8613bf3b463Smrg# that already exist; the *creation* timestamp is finer.  Use names
8623bf3b463Smrg# that make ls -t sort them differently when they have equal
8633bf3b463Smrg# timestamps than when they have distinct timestamps, keeping
8643bf3b463Smrg# in mind that ls -t prints the *newest* file first.
8653bf3b463Smrgrm -f conftest.ts?
8663bf3b463Smrg: > conftest.ts1
8673bf3b463Smrg: > conftest.ts2
8683bf3b463Smrg: > conftest.ts3
8693bf3b463Smrg
8703bf3b463Smrg# Make sure ls -t actually works.  Do 'set' in a subshell so we don't
8713bf3b463Smrg# clobber the current shell's arguments. (Outer-level square brackets
8723bf3b463Smrg# are removed by m4; they're present so that m4 does not expand
8733bf3b463Smrg# <dollar><star>; be careful, easy to get confused.)
8743bf3b463Smrgif (
8753bf3b463Smrg     set X `[ls -t conftest.ts[12]]` &&
8763bf3b463Smrg     {
8773bf3b463Smrg       test "$[]*" != "X conftest.ts1 conftest.ts2" ||
8783bf3b463Smrg       test "$[]*" != "X conftest.ts2 conftest.ts1";
8793bf3b463Smrg     }
8803bf3b463Smrg); then :; else
8813bf3b463Smrg  # If neither matched, then we have a broken ls.  This can happen
8823bf3b463Smrg  # if, for instance, CONFIG_SHELL is bash and it inherits a
8833bf3b463Smrg  # broken ls alias from the environment.  This has actually
8843bf3b463Smrg  # happened.  Such a system could not be considered "sane".
8853bf3b463Smrg  _AS_ECHO_UNQUOTED(
8863bf3b463Smrg    ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
8873bf3b463Smrg    [AS_MESSAGE_LOG_FD])
8883bf3b463Smrg  AC_MSG_FAILURE([ls -t produces unexpected output.
8893bf3b463SmrgMake sure there is not a broken ls alias in your environment.])
8903bf3b463Smrgfi
8913bf3b463Smrg
8923bf3b463Smrgfor am_try_res in $am_try_resolutions; do
8933bf3b463Smrg  # Any one fine-grained sleep might happen to cross the boundary
8943bf3b463Smrg  # between two values of a coarser actual resolution, but if we do
8953bf3b463Smrg  # two fine-grained sleeps in a row, at least one of them will fall
8963bf3b463Smrg  # entirely within a coarse interval.
8973bf3b463Smrg  echo alpha > conftest.ts1
8983bf3b463Smrg  sleep $am_try_res
8993bf3b463Smrg  echo beta > conftest.ts2
9003bf3b463Smrg  sleep $am_try_res
9013bf3b463Smrg  echo gamma > conftest.ts3
9023bf3b463Smrg
9033bf3b463Smrg  # We assume that 'ls -t' will make use of high-resolution
9043bf3b463Smrg  # timestamps if the operating system supports them at all.
9053bf3b463Smrg  if (set X `ls -t conftest.ts?` &&
9063bf3b463Smrg      test "$[]2" = conftest.ts3 &&
9073bf3b463Smrg      test "$[]3" = conftest.ts2 &&
9083bf3b463Smrg      test "$[]4" = conftest.ts1); then
9093bf3b463Smrg    #
9103bf3b463Smrg    # Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
9113bf3b463Smrg    # because we don't need to test make.
9123bf3b463Smrg    make_ok=true
9133bf3b463Smrg    if test $am_try_res != 1; then
9143bf3b463Smrg      # But if we've succeeded so far with a subsecond resolution, we
9153bf3b463Smrg      # have one more thing to check: make. It can happen that
9163bf3b463Smrg      # everything else supports the subsecond mtimes, but make doesn't;
9173bf3b463Smrg      # notably on macOS, which ships make 3.81 from 2006 (the last one
9183bf3b463Smrg      # released under GPLv2). https://bugs.gnu.org/68808
9193bf3b463Smrg      # 
9203bf3b463Smrg      # We test $MAKE if it is defined in the environment, else "make".
9213bf3b463Smrg      # It might get overridden later, but our hope is that in practice
9223bf3b463Smrg      # it does not matter: it is the system "make" which is (by far)
9233bf3b463Smrg      # the most likely to be broken, whereas if the user overrides it,
9243bf3b463Smrg      # probably they did so with a better, or at least not worse, make.
9253bf3b463Smrg      # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
9263bf3b463Smrg      #
9273bf3b463Smrg      # Create a Makefile (real tab character here):
9283bf3b463Smrg      rm -f conftest.mk
9293bf3b463Smrg      echo 'conftest.ts1: conftest.ts2' >conftest.mk
9303bf3b463Smrg      echo '	touch conftest.ts2' >>conftest.mk
9313bf3b463Smrg      #
9323bf3b463Smrg      # Now, running
9333bf3b463Smrg      #   touch conftest.ts1; touch conftest.ts2; make
9343bf3b463Smrg      # should touch ts1 because ts2 is newer. This could happen by luck,
9353bf3b463Smrg      # but most often, it will fail if make's support is insufficient. So
9363bf3b463Smrg      # test for several consecutive successes.
9373bf3b463Smrg      #
9383bf3b463Smrg      # (We reuse conftest.ts[12] because we still want to modify existing
9393bf3b463Smrg      # files, not create new ones, per above.)
9403bf3b463Smrg      n=0
9413bf3b463Smrg      make=${MAKE-make}
9423bf3b463Smrg      until test $n -eq 3; do
9433bf3b463Smrg        echo one > conftest.ts1
9443bf3b463Smrg        sleep $am_try_res
9453bf3b463Smrg        echo two > conftest.ts2 # ts2 should now be newer than ts1
9463bf3b463Smrg        if $make -f conftest.mk | grep 'up to date' >/dev/null; then
9473bf3b463Smrg          make_ok=false
9483bf3b463Smrg          break # out of $n loop
9493bf3b463Smrg        fi
9503bf3b463Smrg        n=`expr $n + 1`
9513bf3b463Smrg      done
9523bf3b463Smrg    fi
9533bf3b463Smrg    #
9543bf3b463Smrg    if $make_ok; then
9553bf3b463Smrg      # Everything we know to check worked out, so call this resolution good.
9563bf3b463Smrg      am_cv_filesystem_timestamp_resolution=$am_try_res
9573bf3b463Smrg      break # out of $am_try_res loop
9583bf3b463Smrg    fi
9593bf3b463Smrg    # Otherwise, we'll go on to check the next resolution.
960a3129944Smrg  fi
9613bf3b463Smrgdone
9623bf3b463Smrgrm -f conftest.ts?
9633bf3b463Smrg# (end _am_filesystem_timestamp_resolution)
9643bf3b463Smrg])])
965266e564dSmrg
9663bf3b463Smrg# AM_SANITY_CHECK
9673bf3b463Smrg# ---------------
9683bf3b463SmrgAC_DEFUN([AM_SANITY_CHECK],
9693bf3b463Smrg[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
9703bf3b463Smrg# This check should not be cached, as it may vary across builds of
9713bf3b463Smrg# different projects.
9723bf3b463SmrgAC_MSG_CHECKING([whether build environment is sane])
9733bf3b463Smrg# Reject unsafe characters in $srcdir or the absolute working directory
9743bf3b463Smrg# name.  Accept space and tab only in the latter.
9753bf3b463Smrgam_lf='
9763bf3b463Smrg'
9773bf3b463Smrgcase `pwd` in
9783bf3b463Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
9793bf3b463Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
9803bf3b463Smrgesac
9813bf3b463Smrgcase $srcdir in
9823bf3b463Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
9833bf3b463Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
9843bf3b463Smrgesac
985266e564dSmrg
9863bf3b463Smrg# Do 'set' in a subshell so we don't clobber the current shell's
9873bf3b463Smrg# arguments.  Must try -L first in case configure is actually a
9883bf3b463Smrg# symlink; some systems play weird games with the mod time of symlinks
9893bf3b463Smrg# (eg FreeBSD returns the mod time of the symlink's containing
9903bf3b463Smrg# directory).
9913bf3b463Smrgam_build_env_is_sane=no
9923bf3b463Smrgam_has_slept=no
9933bf3b463Smrgrm -f conftest.file
9943bf3b463Smrgfor am_try in 1 2; do
9953bf3b463Smrg  echo "timestamp, slept: $am_has_slept" > conftest.file
9963bf3b463Smrg  if (
9973bf3b463Smrg    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
9983bf3b463Smrg    if test "$[]*" = "X"; then
9993bf3b463Smrg      # -L didn't work.
10003bf3b463Smrg      set X `ls -t "$srcdir/configure" conftest.file`
10013bf3b463Smrg    fi
10023bf3b463Smrg    test "$[]2" = conftest.file
10033bf3b463Smrg  ); then
10043bf3b463Smrg    am_build_env_is_sane=yes
10053bf3b463Smrg    break
10061009a292Smrg  fi
10073bf3b463Smrg  # Just in case.
10083bf3b463Smrg  sleep "$am_cv_filesystem_timestamp_resolution"
10093bf3b463Smrg  am_has_slept=yes
10103bf3b463Smrgdone
1011698f425bSmrg
10123bf3b463SmrgAC_MSG_RESULT([$am_build_env_is_sane])
10133bf3b463Smrgif test "$am_build_env_is_sane" = no; then
10143bf3b463Smrg  AC_MSG_ERROR([newly created file is older than distributed files!
10153bf3b463SmrgCheck your system clock])
10163bf3b463Smrgfi
1017c5629e66Smrg
10183bf3b463Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
10193bf3b463Smrg# generated files are strictly newer.
10203bf3b463Smrgam_sleep_pid=
10213bf3b463SmrgAS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
10223bf3b463Smrg  ( sleep "$am_cv_filesystem_timestamp_resolution" ) &
10233bf3b463Smrg  am_sleep_pid=$!
10243bf3b463Smrg])
10253bf3b463SmrgAC_CONFIG_COMMANDS_PRE(
10263bf3b463Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
10273bf3b463Smrg   if test -n "$am_sleep_pid"; then
10283bf3b463Smrg     # Hide warnings about reused PIDs.
10293bf3b463Smrg     wait $am_sleep_pid 2>/dev/null
10303bf3b463Smrg   fi
10313bf3b463Smrg   AC_MSG_RESULT([done])])
10323bf3b463Smrgrm -f conftest.file
10333bf3b463Smrg])
10349ef0b394Smrg
10353bf3b463Smrg# Copyright (C) 2009-2024 Free Software Foundation, Inc.
10363bf3b463Smrg#
10373bf3b463Smrg# This file is free software; the Free Software Foundation
10383bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
10393bf3b463Smrg# with or without modifications, as long as this notice is preserved.
1040c5629e66Smrg
10413bf3b463Smrg# _AM_SILENT_RULES
10423bf3b463Smrg# ----------------
10433bf3b463Smrg# Enable less verbose build rules support.
10443bf3b463SmrgAC_DEFUN([_AM_SILENT_RULES],
10453bf3b463Smrg[AM_DEFAULT_VERBOSITY=1
10463bf3b463SmrgAC_ARG_ENABLE([silent-rules], [dnl
10473bf3b463SmrgAS_HELP_STRING(
10483bf3b463Smrg  [--enable-silent-rules],
10493bf3b463Smrg  [less verbose build output (undo: "make V=1")])
10503bf3b463SmrgAS_HELP_STRING(
10513bf3b463Smrg  [--disable-silent-rules],
10523bf3b463Smrg  [verbose build output (undo: "make V=0")])dnl
10533bf3b463Smrg])
10543bf3b463Smrgdnl
10553bf3b463Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
10563bf3b463Smrgdnl do not support nested variable expansions.
10573bf3b463Smrgdnl See automake bug#9928 and bug#10237.
10583bf3b463Smrgam_make=${MAKE-make}
10593bf3b463SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
10603bf3b463Smrg   [am_cv_make_support_nested_variables],
10613bf3b463Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
10623bf3b463SmrgBAR0=false
10633bf3b463SmrgBAR1=true
10643bf3b463SmrgV=1
10653bf3b463Smrgam__doit:
10663bf3b463Smrg	@$(TRUE)
10673bf3b463Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
10683bf3b463Smrg  am_cv_make_support_nested_variables=yes
10699ef0b394Smrgelse
10703bf3b463Smrg  am_cv_make_support_nested_variables=no
1071a3129944Smrgfi])
10723bf3b463SmrgAC_SUBST([AM_V])dnl
10733bf3b463SmrgAM_SUBST_NOTMAKE([AM_V])dnl
10743bf3b463SmrgAC_SUBST([AM_DEFAULT_V])dnl
10753bf3b463SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
10763bf3b463SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
10773bf3b463SmrgAM_BACKSLASH='\'
10783bf3b463SmrgAC_SUBST([AM_BACKSLASH])dnl
10793bf3b463Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
10803bf3b463Smrgdnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
10813bf3b463Smrgdnl to AM_SILENT_RULES to change the default value.
10823bf3b463SmrgAC_CONFIG_COMMANDS_PRE([dnl
10833bf3b463Smrgcase $enable_silent_rules in @%:@ (((
10843bf3b463Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
10853bf3b463Smrg   no) AM_DEFAULT_VERBOSITY=1;;
1086a3129944Smrgesac
10873bf3b463Smrgif test $am_cv_make_support_nested_variables = yes; then
10883bf3b463Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
10893bf3b463Smrg  AM_V='$(V)'
10903bf3b463Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
10913bf3b463Smrgelse
10923bf3b463Smrg  AM_V=$AM_DEFAULT_VERBOSITY
10933bf3b463Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
1094a3129944Smrgfi
10953bf3b463Smrg])dnl
10963bf3b463Smrg])
10979ef0b394Smrg
10983bf3b463Smrg# AM_SILENT_RULES([DEFAULT])
1099a3129944Smrg# --------------------------
11003bf3b463Smrg# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
11013bf3b463Smrg# empty being verbose).
11023bf3b463SmrgAC_DEFUN([AM_SILENT_RULES],
11033bf3b463Smrg[AC_REQUIRE([_AM_SILENT_RULES])
11043bf3b463SmrgAM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
1105a3129944Smrg
11063bf3b463Smrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
11073bf3b463Smrg#
11083bf3b463Smrg# This file is free software; the Free Software Foundation
11093bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
11103bf3b463Smrg# with or without modifications, as long as this notice is preserved.
1111a3129944Smrg
11123bf3b463Smrg# AM_PROG_INSTALL_STRIP
11133bf3b463Smrg# ---------------------
11143bf3b463Smrg# One issue with vendor 'install' (even GNU) is that you can't
11153bf3b463Smrg# specify the program used to strip binaries.  This is especially
11163bf3b463Smrg# annoying in cross-compiling environments, where the build's strip
11173bf3b463Smrg# is unlikely to handle the host's binaries.
11183bf3b463Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
11193bf3b463Smrg# always use install-sh in "make install-strip", and initialize
11203bf3b463Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
11213bf3b463SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
11223bf3b463Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
11233bf3b463Smrg# Installed binaries are usually stripped using 'strip' when the user
11243bf3b463Smrg# run "make install-strip".  However 'strip' might not be the right
11253bf3b463Smrg# tool to use in cross-compilation environments, therefore Automake
11263bf3b463Smrg# will honor the 'STRIP' environment variable to overrule this program.
11273bf3b463Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
11283bf3b463Smrgif test "$cross_compiling" != no; then
11293bf3b463Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
1130a3129944Smrgfi
11313bf3b463SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
11323bf3b463SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1133a3129944Smrg
11343bf3b463Smrg# Copyright (C) 2006-2024 Free Software Foundation, Inc.
11353bf3b463Smrg#
11363bf3b463Smrg# This file is free software; the Free Software Foundation
11373bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
11383bf3b463Smrg# with or without modifications, as long as this notice is preserved.
1139a3129944Smrg
11403bf3b463Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
11413bf3b463Smrg# ---------------------------
11423bf3b463Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
11433bf3b463Smrg# This macro is traced by Automake.
11443bf3b463SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
11459ef0b394Smrg
11463bf3b463Smrg# AM_SUBST_NOTMAKE(VARIABLE)
11473bf3b463Smrg# --------------------------
11483bf3b463Smrg# Public sister of _AM_SUBST_NOTMAKE.
11493bf3b463SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
11509ef0b394Smrg
11513bf3b463Smrg# Check how to create a tarball.                            -*- Autoconf -*-
11529ef0b394Smrg
11533bf3b463Smrg# Copyright (C) 2004-2024 Free Software Foundation, Inc.
11543bf3b463Smrg#
11553bf3b463Smrg# This file is free software; the Free Software Foundation
11563bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
11573bf3b463Smrg# with or without modifications, as long as this notice is preserved.
11589ef0b394Smrg
11593bf3b463Smrg# _AM_PROG_TAR(FORMAT)
11603bf3b463Smrg# --------------------
11613bf3b463Smrg# Check how to create a tarball in format FORMAT.
11623bf3b463Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
11633bf3b463Smrg#
11643bf3b463Smrg# Substitute a variable $(am__tar) that is a command
11653bf3b463Smrg# writing to stdout a FORMAT-tarball containing the directory
11663bf3b463Smrg# $tardir.
11673bf3b463Smrg#     tardir=directory && $(am__tar) > result.tar
11683bf3b463Smrg#
11693bf3b463Smrg# Substitute a variable $(am__untar) that extract such
11703bf3b463Smrg# a tarball read from stdin.
11713bf3b463Smrg#     $(am__untar) < result.tar
11723bf3b463Smrg#
11733bf3b463SmrgAC_DEFUN([_AM_PROG_TAR],
11743bf3b463Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
11753bf3b463Smrg# in the wild :-(  We should find a proper way to deprecate it ...
11763bf3b463SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
11779ef0b394Smrg
11783bf3b463Smrg# We'll loop over all known methods to create a tar archive until one works.
11793bf3b463Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1180698f425bSmrg
11813bf3b463Smrgm4_if([$1], [v7],
11823bf3b463Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1183698f425bSmrg
11843bf3b463Smrg  [m4_case([$1],
11853bf3b463Smrg    [ustar],
11863bf3b463Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
11873bf3b463Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
11883bf3b463Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
11893bf3b463Smrg      # and bug#13588).
11903bf3b463Smrg      am_max_uid=2097151 # 2^21 - 1
11913bf3b463Smrg      am_max_gid=$am_max_uid
11923bf3b463Smrg      # The $UID and $GID variables are not portable, so we need to resort
11933bf3b463Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
11943bf3b463Smrg      # below are definitely unexpected, so allow the users to see them
11953bf3b463Smrg      # (that is, avoid stderr redirection).
11963bf3b463Smrg      am_uid=`id -u || echo unknown`
11973bf3b463Smrg      am_gid=`id -g || echo unknown`
11983bf3b463Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
11993bf3b463Smrg      if test x$am_uid = xunknown; then
12003bf3b463Smrg        AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
12013bf3b463Smrg      elif test $am_uid -le $am_max_uid; then
12023bf3b463Smrg        AC_MSG_RESULT([yes])
1203698f425bSmrg      else
12043bf3b463Smrg        AC_MSG_RESULT([no])
12053bf3b463Smrg        _am_tools=none
1206698f425bSmrg      fi
12073bf3b463Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
12083bf3b463Smrg      if test x$gm_gid = xunknown; then
12093bf3b463Smrg        AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
12103bf3b463Smrg      elif test $am_gid -le $am_max_gid; then
12113bf3b463Smrg        AC_MSG_RESULT([yes])
1212698f425bSmrg      else
12133bf3b463Smrg        AC_MSG_RESULT([no])
12143bf3b463Smrg        _am_tools=none
12153bf3b463Smrg      fi],
1216266e564dSmrg
12173bf3b463Smrg  [pax],
12183bf3b463Smrg    [],
1219266e564dSmrg
12203bf3b463Smrg  [m4_fatal([Unknown tar format])])
1221266e564dSmrg
12223bf3b463Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1223266e564dSmrg
12243bf3b463Smrg  # Go ahead even if we have the value already cached.  We do so because we
12253bf3b463Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
12263bf3b463Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
12279ef0b394Smrg
12283bf3b463Smrg  for _am_tool in $_am_tools; do
12293bf3b463Smrg    case $_am_tool in
12303bf3b463Smrg    gnutar)
12313bf3b463Smrg      for _am_tar in tar gnutar gtar; do
12323bf3b463Smrg        AM_RUN_LOG([$_am_tar --version]) && break
12333bf3b463Smrg      done
12343bf3b463Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
12353bf3b463Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
12363bf3b463Smrg      am__untar="$_am_tar -xf -"
1237698f425bSmrg      ;;
12383bf3b463Smrg    plaintar)
12393bf3b463Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
12403bf3b463Smrg      # ustar tarball either.
12413bf3b463Smrg      (tar --version) >/dev/null 2>&1 && continue
12423bf3b463Smrg      am__tar='tar chf - "$$tardir"'
12433bf3b463Smrg      am__tar_='tar chf - "$tardir"'
12443bf3b463Smrg      am__untar='tar xf -'
1245698f425bSmrg      ;;
12463bf3b463Smrg    pax)
12473bf3b463Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
12483bf3b463Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
12493bf3b463Smrg      am__untar='pax -r'
1250698f425bSmrg      ;;
12513bf3b463Smrg    cpio)
12523bf3b463Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
12533bf3b463Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
12543bf3b463Smrg      am__untar='cpio -i -H $1 -d'
1255698f425bSmrg      ;;
12563bf3b463Smrg    none)
12573bf3b463Smrg      am__tar=false
12583bf3b463Smrg      am__tar_=false
12593bf3b463Smrg      am__untar=false
1260698f425bSmrg      ;;
1261698f425bSmrg    esac
1262698f425bSmrg
12633bf3b463Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
12643bf3b463Smrg    # and am__untar set.
12653bf3b463Smrg    test -n "${am_cv_prog_tar_$1}" && break
1266698f425bSmrg
12673bf3b463Smrg    # tar/untar a dummy directory, and stop if the command works.
12683bf3b463Smrg    rm -rf conftest.dir
12693bf3b463Smrg    mkdir conftest.dir
12703bf3b463Smrg    echo GrepMe > conftest.dir/file
12713bf3b463Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
12723bf3b463Smrg    rm -rf conftest.dir
12733bf3b463Smrg    if test -s conftest.tar; then
12743bf3b463Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
12753bf3b463Smrg      AM_RUN_LOG([cat conftest.dir/file])
12763bf3b463Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
12773bf3b463Smrg    fi
12783bf3b463Smrg  done
12793bf3b463Smrg  rm -rf conftest.dir
1280698f425bSmrg
12813bf3b463Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
12823bf3b463Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1283698f425bSmrg
12843bf3b463SmrgAC_SUBST([am__tar])
12853bf3b463SmrgAC_SUBST([am__untar])
12863bf3b463Smrg]) # _AM_PROG_TAR
1287266e564dSmrg
12883bf3b463Smrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
12893bf3b463Smrg#
12903bf3b463Smrg# This file is free software; the Free Software Foundation
12913bf3b463Smrg# gives unlimited permission to copy and/or distribute it,
12923bf3b463Smrg# with or without modifications, as long as this notice is preserved.
1293266e564dSmrg
12943bf3b463Smrg# _AM_PROG_XARGS_N
12953bf3b463Smrg# ----------------
12963bf3b463Smrg# Check whether 'xargs -n' works.  It should work everywhere, so the fallback
12973bf3b463Smrg# is not optimized at all as we never expect to use it.
12983bf3b463SmrgAC_DEFUN([_AM_PROG_XARGS_N],
12993bf3b463Smrg[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
13003bf3b463SmrgAS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
13013bf3b463Smrg3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
13023bf3b463SmrgAS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
13033bf3b463Smrg  am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
13043bf3b463Smrg])dnl
13053bf3b463SmrgAC_SUBST(am__xargs_n)
13063bf3b463Smrg])
13073bf3b463Smrg
13083bf3b463Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
13093bf3b463Smrgdnl serial 11 (pkg-config-0.29)
13103bf3b463Smrgdnl
13113bf3b463Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
13123bf3b463Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
13133bf3b463Smrgdnl
13143bf3b463Smrgdnl This program is free software; you can redistribute it and/or modify
13153bf3b463Smrgdnl it under the terms of the GNU General Public License as published by
13163bf3b463Smrgdnl the Free Software Foundation; either version 2 of the License, or
13173bf3b463Smrgdnl (at your option) any later version.
13183bf3b463Smrgdnl
13193bf3b463Smrgdnl This program is distributed in the hope that it will be useful, but
13203bf3b463Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
13213bf3b463Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13223bf3b463Smrgdnl General Public License for more details.
13233bf3b463Smrgdnl
13243bf3b463Smrgdnl You should have received a copy of the GNU General Public License
13253bf3b463Smrgdnl along with this program; if not, write to the Free Software
13263bf3b463Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
13273bf3b463Smrgdnl 02111-1307, USA.
13283bf3b463Smrgdnl
13293bf3b463Smrgdnl As a special exception to the GNU General Public License, if you
13303bf3b463Smrgdnl distribute this file as part of a program that contains a
13313bf3b463Smrgdnl configuration script generated by Autoconf, you may include it under
13323bf3b463Smrgdnl the same distribution terms that you use for the rest of that
13333bf3b463Smrgdnl program.
1334266e564dSmrg
13353bf3b463Smrgdnl PKG_PREREQ(MIN-VERSION)
13363bf3b463Smrgdnl -----------------------
13373bf3b463Smrgdnl Since: 0.29
13383bf3b463Smrgdnl
13393bf3b463Smrgdnl Verify that the version of the pkg-config macros are at least
13403bf3b463Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
13413bf3b463Smrgdnl installed version of pkg-config, this checks the developer's version
13423bf3b463Smrgdnl of pkg.m4 when generating configure.
13433bf3b463Smrgdnl
13443bf3b463Smrgdnl To ensure that this macro is defined, also add:
13453bf3b463Smrgdnl m4_ifndef([PKG_PREREQ],
13463bf3b463Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
13473bf3b463Smrgdnl
13483bf3b463Smrgdnl See the "Since" comment for each macro you use to see what version
13493bf3b463Smrgdnl of the macros you require.
13503bf3b463Smrgm4_defun([PKG_PREREQ],
13513bf3b463Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
13523bf3b463Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
13533bf3b463Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
13543bf3b463Smrg])dnl PKG_PREREQ
1355266e564dSmrg
13563bf3b463Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
13573bf3b463Smrgdnl ----------------------------------
13583bf3b463Smrgdnl Since: 0.16
13593bf3b463Smrgdnl
13603bf3b463Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
13613bf3b463Smrgdnl first found in the path. Checks that the version of pkg-config found
13623bf3b463Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
13633bf3b463Smrgdnl used since that's the first version where most current features of
13643bf3b463Smrgdnl pkg-config existed.
13653bf3b463SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
13663bf3b463Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
13673bf3b463Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
13683bf3b463Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
13693bf3b463SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
13703bf3b463SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
13713bf3b463SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1372266e564dSmrg
13733bf3b463Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
13743bf3b463Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
13753bf3b463Smrgfi
13763bf3b463Smrgif test -n "$PKG_CONFIG"; then
13773bf3b463Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
13783bf3b463Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
13793bf3b463Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
13803bf3b463Smrg		AC_MSG_RESULT([yes])
13813bf3b463Smrg	else
13823bf3b463Smrg		AC_MSG_RESULT([no])
13833bf3b463Smrg		PKG_CONFIG=""
13843bf3b463Smrg	fi
13853bf3b463Smrgfi[]dnl
13863bf3b463Smrg])dnl PKG_PROG_PKG_CONFIG
1387266e564dSmrg
13883bf3b463Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
13893bf3b463Smrgdnl -------------------------------------------------------------------
13903bf3b463Smrgdnl Since: 0.18
13913bf3b463Smrgdnl
13923bf3b463Smrgdnl Check to see whether a particular set of modules exists. Similar to
13933bf3b463Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
13943bf3b463Smrgdnl
13953bf3b463Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
13963bf3b463Smrgdnl only at the first occurence in configure.ac, so if the first place
13973bf3b463Smrgdnl it's called might be skipped (such as if it is within an "if", you
13983bf3b463Smrgdnl have to call PKG_CHECK_EXISTS manually
13993bf3b463SmrgAC_DEFUN([PKG_CHECK_EXISTS],
14003bf3b463Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14013bf3b463Smrgif test -n "$PKG_CONFIG" && \
14023bf3b463Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
14033bf3b463Smrg  m4_default([$2], [:])
14043bf3b463Smrgm4_ifvaln([$3], [else
14053bf3b463Smrg  $3])dnl
14063bf3b463Smrgfi])
1407266e564dSmrg
14083bf3b463Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
14093bf3b463Smrgdnl ---------------------------------------------
14103bf3b463Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
14113bf3b463Smrgdnl pkg_failed based on the result.
14123bf3b463Smrgm4_define([_PKG_CONFIG],
14133bf3b463Smrg[if test -n "$$1"; then
14143bf3b463Smrg    pkg_cv_[]$1="$$1"
14153bf3b463Smrg elif test -n "$PKG_CONFIG"; then
14163bf3b463Smrg    PKG_CHECK_EXISTS([$3],
14173bf3b463Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
14183bf3b463Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
14193bf3b463Smrg		     [pkg_failed=yes])
14203bf3b463Smrg else
14213bf3b463Smrg    pkg_failed=untried
14223bf3b463Smrgfi[]dnl
14233bf3b463Smrg])dnl _PKG_CONFIG
1424266e564dSmrg
14253bf3b463Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
14263bf3b463Smrgdnl ---------------------------
14273bf3b463Smrgdnl Internal check to see if pkg-config supports short errors.
14283bf3b463SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
14293bf3b463Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
14303bf3b463Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
14313bf3b463Smrg        _pkg_short_errors_supported=yes
14323bf3b463Smrgelse
14333bf3b463Smrg        _pkg_short_errors_supported=no
14343bf3b463Smrgfi[]dnl
14353bf3b463Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1436a3129944Smrg
1437266e564dSmrg
14383bf3b463Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
14393bf3b463Smrgdnl   [ACTION-IF-NOT-FOUND])
14403bf3b463Smrgdnl --------------------------------------------------------------
14413bf3b463Smrgdnl Since: 0.4.0
14423bf3b463Smrgdnl
14433bf3b463Smrgdnl Note that if there is a possibility the first call to
14443bf3b463Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
14453bf3b463Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
14463bf3b463SmrgAC_DEFUN([PKG_CHECK_MODULES],
14473bf3b463Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14483bf3b463SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
14493bf3b463SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1450698f425bSmrg
14513bf3b463Smrgpkg_failed=no
14523bf3b463SmrgAC_MSG_CHECKING([for $1])
1453266e564dSmrg
14543bf3b463Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
14553bf3b463Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1456266e564dSmrg
14573bf3b463Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
14583bf3b463Smrgand $1[]_LIBS to avoid the need to call pkg-config.
14593bf3b463SmrgSee the pkg-config man page for more details.])
1460698f425bSmrg
14613bf3b463Smrgif test $pkg_failed = yes; then
14623bf3b463Smrg   	AC_MSG_RESULT([no])
14633bf3b463Smrg        _PKG_SHORT_ERRORS_SUPPORTED
14643bf3b463Smrg        if test $_pkg_short_errors_supported = yes; then
14653bf3b463Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
14663bf3b463Smrg        else 
14673bf3b463Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
14683bf3b463Smrg        fi
14693bf3b463Smrg	# Put the nasty error message in config.log where it belongs
14703bf3b463Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1471698f425bSmrg
14723bf3b463Smrg	m4_default([$4], [AC_MSG_ERROR(
14733bf3b463Smrg[Package requirements ($2) were not met:
1474266e564dSmrg
14753bf3b463Smrg$$1_PKG_ERRORS
1476698f425bSmrg
14773bf3b463SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
14783bf3b463Smrginstalled software in a non-standard prefix.
1479266e564dSmrg
14803bf3b463Smrg_PKG_TEXT])[]dnl
14813bf3b463Smrg        ])
14823bf3b463Smrgelif test $pkg_failed = untried; then
14833bf3b463Smrg     	AC_MSG_RESULT([no])
14843bf3b463Smrg	m4_default([$4], [AC_MSG_FAILURE(
14853bf3b463Smrg[The pkg-config script could not be found or is too old.  Make sure it
14863bf3b463Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
14873bf3b463Smrgpath to pkg-config.
1488266e564dSmrg
14893bf3b463Smrg_PKG_TEXT
1490266e564dSmrg
14913bf3b463SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
14923bf3b463Smrg        ])
14933bf3b463Smrgelse
14943bf3b463Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
14953bf3b463Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
14963bf3b463Smrg        AC_MSG_RESULT([yes])
14973bf3b463Smrg	$3
14983bf3b463Smrgfi[]dnl
14993bf3b463Smrg])dnl PKG_CHECK_MODULES
1500266e564dSmrg
1501698f425bSmrg
15023bf3b463Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
15033bf3b463Smrgdnl   [ACTION-IF-NOT-FOUND])
15043bf3b463Smrgdnl ---------------------------------------------------------------------
15053bf3b463Smrgdnl Since: 0.29
15063bf3b463Smrgdnl
15073bf3b463Smrgdnl Checks for existence of MODULES and gathers its build flags with
15083bf3b463Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
15093bf3b463Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
15103bf3b463Smrgdnl
15113bf3b463Smrgdnl Note that if there is a possibility the first call to
15123bf3b463Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
15133bf3b463Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
15143bf3b463Smrgdnl configure.ac.
15153bf3b463SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
15163bf3b463Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
15173bf3b463Smrg_save_PKG_CONFIG=$PKG_CONFIG
15183bf3b463SmrgPKG_CONFIG="$PKG_CONFIG --static"
15193bf3b463SmrgPKG_CHECK_MODULES($@)
15203bf3b463SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
15213bf3b463Smrg])dnl PKG_CHECK_MODULES_STATIC
1522266e564dSmrg
1523266e564dSmrg
15243bf3b463Smrgdnl PKG_INSTALLDIR([DIRECTORY])
15253bf3b463Smrgdnl -------------------------
15263bf3b463Smrgdnl Since: 0.27
15273bf3b463Smrgdnl
15283bf3b463Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
15293bf3b463Smrgdnl should install pkg-config .pc files. By default the directory is
15303bf3b463Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
15313bf3b463Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
15323bf3b463Smrgdnl parameter.
15333bf3b463SmrgAC_DEFUN([PKG_INSTALLDIR],
15343bf3b463Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
15353bf3b463Smrgm4_pushdef([pkg_description],
15363bf3b463Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
15373bf3b463SmrgAC_ARG_WITH([pkgconfigdir],
15383bf3b463Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
15393bf3b463Smrg    [with_pkgconfigdir=]pkg_default)
15403bf3b463SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
15413bf3b463Smrgm4_popdef([pkg_default])
15423bf3b463Smrgm4_popdef([pkg_description])
15433bf3b463Smrg])dnl PKG_INSTALLDIR
1544266e564dSmrg
1545266e564dSmrg
15463bf3b463Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
15473bf3b463Smrgdnl --------------------------------
15483bf3b463Smrgdnl Since: 0.27
15493bf3b463Smrgdnl
15503bf3b463Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
15513bf3b463Smrgdnl module should install arch-independent pkg-config .pc files. By
15523bf3b463Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
15533bf3b463Smrgdnl changed by passing DIRECTORY. The user can override through the
15543bf3b463Smrgdnl --with-noarch-pkgconfigdir parameter.
15553bf3b463SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
15563bf3b463Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
15573bf3b463Smrgm4_pushdef([pkg_description],
15583bf3b463Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
15593bf3b463SmrgAC_ARG_WITH([noarch-pkgconfigdir],
15603bf3b463Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
15613bf3b463Smrg    [with_noarch_pkgconfigdir=]pkg_default)
15623bf3b463SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
15633bf3b463Smrgm4_popdef([pkg_default])
15643bf3b463Smrgm4_popdef([pkg_description])
15653bf3b463Smrg])dnl PKG_NOARCH_INSTALLDIR
1566698f425bSmrg
1567266e564dSmrg
15683bf3b463Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
15693bf3b463Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
15703bf3b463Smrgdnl -------------------------------------------
15713bf3b463Smrgdnl Since: 0.28
15723bf3b463Smrgdnl
15733bf3b463Smrgdnl Retrieves the value of the pkg-config variable for the given module.
15743bf3b463SmrgAC_DEFUN([PKG_CHECK_VAR],
15753bf3b463Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
15763bf3b463SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1577698f425bSmrg
15783bf3b463Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
15793bf3b463SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
15809ef0b394Smrg
15813bf3b463SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
15823bf3b463Smrg])dnl PKG_CHECK_VAR
1583266e564dSmrg
15843bf3b463Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
15853bf3b463Smrgdnl
15863bf3b463Smrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
15873bf3b463Smrgdnl
15883bf3b463Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
15893bf3b463Smrgdnl copy of this software and associated documentation files (the "Software"),
15903bf3b463Smrgdnl to deal in the Software without restriction, including without limitation
15913bf3b463Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
15923bf3b463Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
15933bf3b463Smrgdnl Software is furnished to do so, subject to the following conditions:
15943bf3b463Smrgdnl
15953bf3b463Smrgdnl The above copyright notice and this permission notice (including the next
15963bf3b463Smrgdnl paragraph) shall be included in all copies or substantial portions of the
15973bf3b463Smrgdnl Software.
15983bf3b463Smrgdnl
15993bf3b463Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16003bf3b463Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16013bf3b463Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
16023bf3b463Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16033bf3b463Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
16043bf3b463Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
16053bf3b463Smrgdnl DEALINGS IN THE SOFTWARE.
1606698f425bSmrg
16073bf3b463Smrg# XORG_MACROS_VERSION(required-version)
16083bf3b463Smrg# -------------------------------------
16093bf3b463Smrg# Minimum version: 1.1.0
16103bf3b463Smrg#
16113bf3b463Smrg# If you're using a macro added in Version 1.1 or newer, include this in
16123bf3b463Smrg# your configure.ac with the minimum required version, such as:
16133bf3b463Smrg# XORG_MACROS_VERSION(1.1)
16143bf3b463Smrg#
16153bf3b463Smrg# To ensure that this macro is defined, also add:
16163bf3b463Smrg# m4_ifndef([XORG_MACROS_VERSION],
16173bf3b463Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
16183bf3b463Smrg#
16193bf3b463Smrg#
16203bf3b463Smrg# See the "minimum version" comment for each macro you use to see what
16213bf3b463Smrg# version you require.
16223bf3b463Smrgm4_defun([XORG_MACROS_VERSION],[
16233bf3b463Smrgm4_define([vers_have], [1.20.2])
16243bf3b463Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
16253bf3b463Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
16263bf3b463Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
16273bf3b463Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
16283bf3b463Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
16293bf3b463Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
16303bf3b463Smrgm4_undefine([vers_have])
16313bf3b463Smrgm4_undefine([maj_have])
16323bf3b463Smrgm4_undefine([maj_needed])
16333bf3b463Smrg]) # XORG_MACROS_VERSION
1634698f425bSmrg
16353bf3b463Smrg# XORG_PROG_RAWCPP()
16363bf3b463Smrg# ------------------
16373bf3b463Smrg# Minimum version: 1.0.0
16383bf3b463Smrg#
16393bf3b463Smrg# Find cpp program and necessary flags for use in pre-processing text files
16403bf3b463Smrg# such as man pages and config files
16413bf3b463SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
16423bf3b463SmrgAC_REQUIRE([AC_PROG_CPP])
16433bf3b463SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
16443bf3b463Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1645698f425bSmrg
16463bf3b463Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
16473bf3b463Smrg# which is not the best choice for supporting other OS'es, but covers most
16483bf3b463Smrg# of the ones we need for now.
16493bf3b463SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
16503bf3b463SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
16513bf3b463Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
16523bf3b463Smrg	AC_MSG_RESULT([no])
16533bf3b463Smrgelse
16543bf3b463Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
16553bf3b463Smrg		RAWCPPFLAGS=-undef
16563bf3b463Smrg		AC_MSG_RESULT([yes])
16573bf3b463Smrg	# under Cygwin unix is still defined even with -undef
16583bf3b463Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
16593bf3b463Smrg		RAWCPPFLAGS="-undef -ansi"
16603bf3b463Smrg		AC_MSG_RESULT([yes, with -ansi])
16619ef0b394Smrg	else
16623bf3b463Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
16639ef0b394Smrg	fi
16643bf3b463Smrgfi
16653bf3b463Smrgrm -f conftest.$ac_ext
1666698f425bSmrg
16673bf3b463SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
16683bf3b463SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
16693bf3b463Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
16703bf3b463Smrg	AC_MSG_RESULT([no])
16713bf3b463Smrgelse
16723bf3b463Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
16733bf3b463Smrg		TRADITIONALCPPFLAGS="-traditional"
16743bf3b463Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
16753bf3b463Smrg		AC_MSG_RESULT([yes])
16769ef0b394Smrg	else
16773bf3b463Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
16789ef0b394Smrg	fi
16793bf3b463Smrgfi
16803bf3b463Smrgrm -f conftest.$ac_ext
16813bf3b463SmrgAC_SUBST(RAWCPPFLAGS)
16823bf3b463SmrgAC_SUBST(TRADITIONALCPPFLAGS)
16833bf3b463Smrg]) # XORG_PROG_RAWCPP
1684266e564dSmrg
16853bf3b463Smrg# XORG_MANPAGE_SECTIONS()
16863bf3b463Smrg# -----------------------
16873bf3b463Smrg# Minimum version: 1.0.0
16883bf3b463Smrg#
16893bf3b463Smrg# Determine which sections man pages go in for the different man page types
16903bf3b463Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
16913bf3b463Smrg# Not sure if there's any better way than just hardcoding by OS name.
16923bf3b463Smrg# Override default settings by setting environment variables
16933bf3b463Smrg# Added MAN_SUBSTS in version 1.8
16943bf3b463Smrg# Added AC_PROG_SED in version 1.8
1695266e564dSmrg
16963bf3b463SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
16973bf3b463SmrgAC_REQUIRE([AC_CANONICAL_HOST])
16983bf3b463SmrgAC_REQUIRE([AC_PROG_SED])
1699266e564dSmrg
17003bf3b463Smrgcase $host_os in
17013bf3b463Smrg    solaris*)
17023bf3b463Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
17033bf3b463Smrg        # check for a man page file found in later versions that use
17043bf3b463Smrg        # traditional section numbers instead
17053bf3b463Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
17063bf3b463Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
17073bf3b463Smrg        ;;
17083bf3b463Smrg    *) SYSV_MAN_SECTIONS=false ;;
17093bf3b463Smrgesac
1710698f425bSmrg
17113bf3b463Smrgif test x$APP_MAN_SUFFIX = x    ; then
17123bf3b463Smrg    APP_MAN_SUFFIX=1
17133bf3b463Smrgfi
17143bf3b463Smrgif test x$APP_MAN_DIR = x    ; then
17153bf3b463Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
17163bf3b463Smrgfi
1717266e564dSmrg
17183bf3b463Smrgif test x$LIB_MAN_SUFFIX = x    ; then
17193bf3b463Smrg    LIB_MAN_SUFFIX=3
17203bf3b463Smrgfi
17213bf3b463Smrgif test x$LIB_MAN_DIR = x    ; then
17223bf3b463Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
17233bf3b463Smrgfi
1724266e564dSmrg
17253bf3b463Smrgif test x$FILE_MAN_SUFFIX = x    ; then
17263bf3b463Smrg    case $SYSV_MAN_SECTIONS in
17273bf3b463Smrg	true)				FILE_MAN_SUFFIX=4  ;;
17283bf3b463Smrg	*)				FILE_MAN_SUFFIX=5  ;;
17293bf3b463Smrg    esac
17303bf3b463Smrgfi
17313bf3b463Smrgif test x$FILE_MAN_DIR = x    ; then
17323bf3b463Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
17333bf3b463Smrgfi
1734266e564dSmrg
17353bf3b463Smrgif test x$MISC_MAN_SUFFIX = x    ; then
17363bf3b463Smrg    case $SYSV_MAN_SECTIONS in
17373bf3b463Smrg	true)				MISC_MAN_SUFFIX=5  ;;
17383bf3b463Smrg	*)				MISC_MAN_SUFFIX=7  ;;
17393bf3b463Smrg    esac
17403bf3b463Smrgfi
17413bf3b463Smrgif test x$MISC_MAN_DIR = x    ; then
17423bf3b463Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
17433bf3b463Smrgfi
17449ef0b394Smrg
17453bf3b463Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
17463bf3b463Smrg    case $SYSV_MAN_SECTIONS in
17473bf3b463Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
17483bf3b463Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
17493bf3b463Smrg    esac
17503bf3b463Smrgfi
17513bf3b463Smrgif test x$DRIVER_MAN_DIR = x    ; then
17523bf3b463Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
17533bf3b463Smrgfi
1754698f425bSmrg
17553bf3b463Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
17563bf3b463Smrg    case $SYSV_MAN_SECTIONS in
17573bf3b463Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
17583bf3b463Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
17593bf3b463Smrg    esac
17603bf3b463Smrgfi
17613bf3b463Smrgif test x$ADMIN_MAN_DIR = x    ; then
17623bf3b463Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
17633bf3b463Smrgfi
1764698f425bSmrg
1765266e564dSmrg
17663bf3b463SmrgAC_SUBST([APP_MAN_SUFFIX])
17673bf3b463SmrgAC_SUBST([LIB_MAN_SUFFIX])
17683bf3b463SmrgAC_SUBST([FILE_MAN_SUFFIX])
17693bf3b463SmrgAC_SUBST([MISC_MAN_SUFFIX])
17703bf3b463SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
17713bf3b463SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
17723bf3b463SmrgAC_SUBST([APP_MAN_DIR])
17733bf3b463SmrgAC_SUBST([LIB_MAN_DIR])
17743bf3b463SmrgAC_SUBST([FILE_MAN_DIR])
17753bf3b463SmrgAC_SUBST([MISC_MAN_DIR])
17763bf3b463SmrgAC_SUBST([DRIVER_MAN_DIR])
17773bf3b463SmrgAC_SUBST([ADMIN_MAN_DIR])
1778698f425bSmrg
17793bf3b463SmrgXORG_MAN_PAGE="X Version 11"
17803bf3b463SmrgAC_SUBST([XORG_MAN_PAGE])
17813bf3b463SmrgMAN_SUBSTS="\
17823bf3b463Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
17833bf3b463Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
17843bf3b463Smrg	-e 's|__xservername__|Xorg|g' \
17853bf3b463Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
17863bf3b463Smrg	-e 's|__projectroot__|\$(prefix)|g' \
17873bf3b463Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
17883bf3b463Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
17893bf3b463Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
17903bf3b463Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
17913bf3b463Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
17923bf3b463Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
17933bf3b463Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
17943bf3b463SmrgAC_SUBST([MAN_SUBSTS])
1795698f425bSmrg
17963bf3b463Smrg]) # XORG_MANPAGE_SECTIONS
1797266e564dSmrg
17983bf3b463Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
17993bf3b463Smrg# ------------------------
18003bf3b463Smrg# Minimum version: 1.7.0
18013bf3b463Smrg#
18023bf3b463Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
18033bf3b463Smrg# provided by xorg-sgml-doctools, if installed.
18043bf3b463SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
18053bf3b463SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
18063bf3b463SmrgXORG_SGML_PATH=
18073bf3b463SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
18083bf3b463Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
18093bf3b463Smrg    [m4_ifval([$1],[:],
18103bf3b463Smrg        [if test x"$cross_compiling" != x"yes" ; then
18113bf3b463Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
18123bf3b463Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
18133bf3b463Smrg         fi])
18143bf3b463Smrg    ])
1815266e564dSmrg
18163bf3b463Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
18173bf3b463Smrg# the path and the name of the doc stylesheet
18183bf3b463Smrgif test "x$XORG_SGML_PATH" != "x" ; then
18193bf3b463Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
18203bf3b463Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
18213bf3b463Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
18223bf3b463Smrgelse
18233bf3b463Smrg   AC_MSG_RESULT([no])
18243bf3b463Smrgfi
1825266e564dSmrg
18263bf3b463SmrgAC_SUBST(XORG_SGML_PATH)
18273bf3b463SmrgAC_SUBST(STYLESHEET_SRCDIR)
18283bf3b463SmrgAC_SUBST(XSL_STYLESHEET)
18293bf3b463SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
18303bf3b463Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1831266e564dSmrg
18323bf3b463Smrg# XORG_CHECK_LINUXDOC
18333bf3b463Smrg# -------------------
18343bf3b463Smrg# Minimum version: 1.0.0
18353bf3b463Smrg#
18363bf3b463Smrg# Defines the variable MAKE_TEXT if the necessary tools and
18373bf3b463Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
18383bf3b463Smrg# Whether or not the necessary tools and files are found can be checked
18393bf3b463Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
18403bf3b463SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
18413bf3b463SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
18423bf3b463SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1843266e564dSmrg
18443bf3b463SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1845266e564dSmrg
18463bf3b463SmrgAC_MSG_CHECKING([whether to build documentation])
1847266e564dSmrg
18483bf3b463Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
18493bf3b463Smrg   BUILDDOC=yes
18503bf3b463Smrgelse
18513bf3b463Smrg   BUILDDOC=no
18523bf3b463Smrgfi
1853266e564dSmrg
18543bf3b463SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1855266e564dSmrg
18563bf3b463SmrgAC_MSG_RESULT([$BUILDDOC])
1857266e564dSmrg
18583bf3b463SmrgAC_MSG_CHECKING([whether to build pdf documentation])
18599ef0b394Smrg
18603bf3b463Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
18613bf3b463Smrg   BUILDPDFDOC=yes
18623bf3b463Smrgelse
18633bf3b463Smrg   BUILDPDFDOC=no
18643bf3b463Smrgfi
1865266e564dSmrg
18663bf3b463SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1867266e564dSmrg
18683bf3b463SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1869266e564dSmrg
18703bf3b463SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
18713bf3b463SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
18723bf3b463SmrgMAKE_PDF="$PS2PDF"
18733bf3b463SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1874266e564dSmrg
18753bf3b463SmrgAC_SUBST(MAKE_TEXT)
18763bf3b463SmrgAC_SUBST(MAKE_PS)
18773bf3b463SmrgAC_SUBST(MAKE_PDF)
18783bf3b463SmrgAC_SUBST(MAKE_HTML)
18793bf3b463Smrg]) # XORG_CHECK_LINUXDOC
1880266e564dSmrg
18813bf3b463Smrg# XORG_CHECK_DOCBOOK
18823bf3b463Smrg# -------------------
18833bf3b463Smrg# Minimum version: 1.0.0
18849ef0b394Smrg#
18853bf3b463Smrg# Checks for the ability to build output formats from SGML DocBook source.
18863bf3b463Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
18873bf3b463Smrg# indicates whether the necessary tools and files are found and, if set,
18883bf3b463Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
18893bf3b463SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
18903bf3b463SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1891266e564dSmrg
18923bf3b463SmrgBUILDTXTDOC=no
18933bf3b463SmrgBUILDPDFDOC=no
18943bf3b463SmrgBUILDPSDOC=no
18953bf3b463SmrgBUILDHTMLDOC=no
1896266e564dSmrg
18973bf3b463SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
18983bf3b463SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
18993bf3b463SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
19003bf3b463SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
19019ef0b394Smrg
19023bf3b463SmrgAC_MSG_CHECKING([whether to build text documentation])
19033bf3b463Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
19043bf3b463Smrg   test x$BUILD_TXTDOC != xno; then
19053bf3b463Smrg	BUILDTXTDOC=yes
19069ef0b394Smrgfi
19073bf3b463SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
19083bf3b463SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1909266e564dSmrg
19103bf3b463SmrgAC_MSG_CHECKING([whether to build PDF documentation])
19113bf3b463Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
19123bf3b463Smrg   test x$BUILD_PDFDOC != xno; then
19133bf3b463Smrg	BUILDPDFDOC=yes
19149ef0b394Smrgfi
19153bf3b463SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
19163bf3b463SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1917266e564dSmrg
19183bf3b463SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
19193bf3b463Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
19203bf3b463Smrg   test x$BUILD_PSDOC != xno; then
19213bf3b463Smrg	BUILDPSDOC=yes
19223bf3b463Smrgfi
19233bf3b463SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
19243bf3b463SmrgAC_MSG_RESULT([$BUILDPSDOC])
1925698f425bSmrg
19263bf3b463SmrgAC_MSG_CHECKING([whether to build HTML documentation])
19273bf3b463Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
19283bf3b463Smrg   test x$BUILD_HTMLDOC != xno; then
19293bf3b463Smrg	BUILDHTMLDOC=yes
19303bf3b463Smrgfi
19313bf3b463SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
19323bf3b463SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1933698f425bSmrg
19343bf3b463SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
19353bf3b463SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
19363bf3b463SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
19373bf3b463SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1938266e564dSmrg
19393bf3b463SmrgAC_SUBST(MAKE_TEXT)
19403bf3b463SmrgAC_SUBST(MAKE_PS)
19413bf3b463SmrgAC_SUBST(MAKE_PDF)
19423bf3b463SmrgAC_SUBST(MAKE_HTML)
19433bf3b463Smrg]) # XORG_CHECK_DOCBOOK
1944266e564dSmrg
19453bf3b463Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
19463bf3b463Smrg# ----------------
19473bf3b463Smrg# Minimum version: 1.5.0
19483bf3b463Smrg# Minimum version for optional DEFAULT argument: 1.11.0
19493bf3b463Smrg#
19503bf3b463Smrg# Documentation tools are not always available on all platforms and sometimes
19513bf3b463Smrg# not at the appropriate level. This macro enables a module to test for the
19523bf3b463Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
19533bf3b463Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
19543bf3b463Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
19553bf3b463Smrg# --with-xmlto assumes 'auto'.
19563bf3b463Smrg#
19573bf3b463Smrg# Interface to module:
19583bf3b463Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
19593bf3b463Smrg# XMLTO:	returns the path of the xmlto program found
19603bf3b463Smrg#		returns the path set by the user in the environment
19613bf3b463Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
19623bf3b463Smrg#		'no' user instructs the module not to use xmlto
19633bf3b463Smrg#
19643bf3b463Smrg# Added in version 1.10.0
19653bf3b463Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
19663bf3b463Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
19673bf3b463Smrg#
19683bf3b463Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
19693bf3b463Smrg#
19703bf3b463SmrgAC_DEFUN([XORG_WITH_XMLTO],[
19713bf3b463SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
19723bf3b463Smrgm4_define([_defopt], m4_default([$2], [auto]))
19733bf3b463SmrgAC_ARG_WITH(xmlto,
19743bf3b463Smrg	AS_HELP_STRING([--with-xmlto],
19753bf3b463Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
19763bf3b463Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
19773bf3b463Smrgm4_undefine([_defopt])
1978266e564dSmrg
19793bf3b463Smrgif test "x$use_xmlto" = x"auto"; then
19803bf3b463Smrg   AC_PATH_PROG([XMLTO], [xmlto])
19813bf3b463Smrg   if test "x$XMLTO" = "x"; then
19823bf3b463Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
19833bf3b463Smrg	have_xmlto=no
19843bf3b463Smrg   else
19853bf3b463Smrg        have_xmlto=yes
19863bf3b463Smrg   fi
19873bf3b463Smrgelif test "x$use_xmlto" = x"yes" ; then
19883bf3b463Smrg   AC_PATH_PROG([XMLTO], [xmlto])
19893bf3b463Smrg   if test "x$XMLTO" = "x"; then
19903bf3b463Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
19913bf3b463Smrg   fi
19923bf3b463Smrg   have_xmlto=yes
19933bf3b463Smrgelif test "x$use_xmlto" = x"no" ; then
19943bf3b463Smrg   if test "x$XMLTO" != "x"; then
19953bf3b463Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
19963bf3b463Smrg   fi
19973bf3b463Smrg   have_xmlto=no
19983bf3b463Smrgelse
19993bf3b463Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
20003bf3b463Smrgfi
2001a3129944Smrg
20023bf3b463Smrg# Test for a minimum version of xmlto, if provided.
20033bf3b463Smrgm4_ifval([$1],
20043bf3b463Smrg[if test "$have_xmlto" = yes; then
20053bf3b463Smrg    # scrape the xmlto version
20063bf3b463Smrg    AC_MSG_CHECKING([the xmlto version])
20073bf3b463Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
20083bf3b463Smrg    AC_MSG_RESULT([$xmlto_version])
20093bf3b463Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
20103bf3b463Smrg        [if test "x$use_xmlto" = xauto; then
20113bf3b463Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
20123bf3b463Smrg            have_xmlto=no
20133bf3b463Smrg        else
20143bf3b463Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
20153bf3b463Smrg        fi])
20163bf3b463Smrgfi])
2017266e564dSmrg
20183bf3b463Smrg# Test for the ability of xmlto to generate a text target
20193bf3b463Smrg#
20203bf3b463Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
20213bf3b463Smrg# following test for empty XML docbook files.
20223bf3b463Smrg# For compatibility reasons use the following empty XML docbook file and if
20233bf3b463Smrg# it fails try it again with a non-empty XML file.
20243bf3b463Smrghave_xmlto_text=no
20253bf3b463Smrgcat > conftest.xml << "EOF"
20263bf3b463SmrgEOF
20273bf3b463SmrgAS_IF([test "$have_xmlto" = yes],
20283bf3b463Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
20293bf3b463Smrg             [have_xmlto_text=yes],
20303bf3b463Smrg             [# Try it again with a non-empty XML file.
20313bf3b463Smrg              cat > conftest.xml << "EOF"
20323bf3b463Smrg<x></x>
20333bf3b463SmrgEOF
20343bf3b463Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
20353bf3b463Smrg                    [have_xmlto_text=yes],
20363bf3b463Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
20373bf3b463Smrgrm -f conftest.xml
20383bf3b463SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
20393bf3b463SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
20403bf3b463Smrg]) # XORG_WITH_XMLTO
2041266e564dSmrg
20423bf3b463Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
20433bf3b463Smrg# --------------------------------------------
20443bf3b463Smrg# Minimum version: 1.12.0
20453bf3b463Smrg# Minimum version for optional DEFAULT argument: 1.12.0
20463bf3b463Smrg#
20473bf3b463Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
20483bf3b463Smrg# XML-based language used for the transformation of XML documents.
20493bf3b463Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
20503bf3b463Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
20513bf3b463Smrg# The XSLT processor is often used as a standalone tool for transformations.
20523bf3b463Smrg# It should not be assumed that this tool is used only to work with documnetation.
20533bf3b463Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
20543bf3b463Smrg#
20553bf3b463Smrg# Interface to module:
20563bf3b463Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
20573bf3b463Smrg# XSLTPROC:	 returns the path of the xsltproc program found
20583bf3b463Smrg#		 returns the path set by the user in the environment
20593bf3b463Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
20603bf3b463Smrg#		  'no' user instructs the module not to use xsltproc
20613bf3b463Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
20623bf3b463Smrg#
20633bf3b463Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
20643bf3b463Smrg#
20653bf3b463SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
20663bf3b463SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
20673bf3b463Smrg# Preserves the interface, should it be implemented later
20683bf3b463Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
20693bf3b463Smrgm4_define([_defopt], m4_default([$2], [auto]))
20703bf3b463SmrgAC_ARG_WITH(xsltproc,
20713bf3b463Smrg	AS_HELP_STRING([--with-xsltproc],
20723bf3b463Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
20733bf3b463Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
20743bf3b463Smrgm4_undefine([_defopt])
2075266e564dSmrg
20763bf3b463Smrgif test "x$use_xsltproc" = x"auto"; then
20773bf3b463Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
20783bf3b463Smrg   if test "x$XSLTPROC" = "x"; then
20793bf3b463Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
20803bf3b463Smrg	have_xsltproc=no
20813bf3b463Smrg   else
20823bf3b463Smrg        have_xsltproc=yes
20833bf3b463Smrg   fi
20843bf3b463Smrgelif test "x$use_xsltproc" = x"yes" ; then
20853bf3b463Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
20863bf3b463Smrg   if test "x$XSLTPROC" = "x"; then
20873bf3b463Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
20883bf3b463Smrg   fi
20893bf3b463Smrg   have_xsltproc=yes
20903bf3b463Smrgelif test "x$use_xsltproc" = x"no" ; then
20913bf3b463Smrg   if test "x$XSLTPROC" != "x"; then
20923bf3b463Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
20933bf3b463Smrg   fi
20943bf3b463Smrg   have_xsltproc=no
20953bf3b463Smrgelse
20963bf3b463Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
20973bf3b463Smrgfi
2098266e564dSmrg
20993bf3b463SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
21003bf3b463Smrg]) # XORG_WITH_XSLTPROC
2101266e564dSmrg
21023bf3b463Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
21033bf3b463Smrg# ----------------------------------------
21043bf3b463Smrg# Minimum version: 1.15.0
21053bf3b463Smrg#
21063bf3b463Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
21073bf3b463Smrg# scanning arbitrary text files, extracting information from those text files,
21083bf3b463Smrg# and printing reports based on that information.
21093bf3b463Smrg#
21103bf3b463Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
21113bf3b463Smrg#
21123bf3b463Smrg# Interface to module:
21133bf3b463Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
21143bf3b463Smrg# PERL:	     returns the path of the perl program found
21153bf3b463Smrg#	     returns the path set by the user in the environment
21163bf3b463Smrg# --with-perl: 'yes' user instructs the module to use perl
21173bf3b463Smrg#	       'no' user instructs the module not to use perl
21183bf3b463Smrg# have_perl: returns yes if perl found in PATH or no
21193bf3b463Smrg#
21203bf3b463Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
21213bf3b463Smrg#
21223bf3b463SmrgAC_DEFUN([XORG_WITH_PERL],[
21233bf3b463SmrgAC_ARG_VAR([PERL], [Path to perl command])
21243bf3b463Smrg# Preserves the interface, should it be implemented later
21253bf3b463Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
21263bf3b463Smrgm4_define([_defopt], m4_default([$2], [auto]))
21273bf3b463SmrgAC_ARG_WITH(perl,
21283bf3b463Smrg	AS_HELP_STRING([--with-perl],
21293bf3b463Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
21303bf3b463Smrg	   [use_perl=$withval], [use_perl=]_defopt)
21313bf3b463Smrgm4_undefine([_defopt])
2132266e564dSmrg
21333bf3b463Smrgif test "x$use_perl" = x"auto"; then
21343bf3b463Smrg   AC_PATH_PROG([PERL], [perl])
21353bf3b463Smrg   if test "x$PERL" = "x"; then
21363bf3b463Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
21373bf3b463Smrg	have_perl=no
21383bf3b463Smrg   else
21393bf3b463Smrg        have_perl=yes
21403bf3b463Smrg   fi
21413bf3b463Smrgelif test "x$use_perl" = x"yes" ; then
21423bf3b463Smrg   AC_PATH_PROG([PERL], [perl])
21433bf3b463Smrg   if test "x$PERL" = "x"; then
21443bf3b463Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
21453bf3b463Smrg   fi
21463bf3b463Smrg   have_perl=yes
21473bf3b463Smrgelif test "x$use_perl" = x"no" ; then
21483bf3b463Smrg   if test "x$PERL" != "x"; then
21493bf3b463Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
21503bf3b463Smrg   fi
21513bf3b463Smrg   have_perl=no
21523bf3b463Smrgelse
21533bf3b463Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
21543bf3b463Smrgfi
2155c5629e66Smrg
21563bf3b463SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
21573bf3b463Smrg]) # XORG_WITH_PERL
2158266e564dSmrg
21593bf3b463Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
21603bf3b463Smrg# ----------------
21613bf3b463Smrg# Minimum version: 1.5.0
21623bf3b463Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21633bf3b463Smrg#
21643bf3b463Smrg# Documentation tools are not always available on all platforms and sometimes
21653bf3b463Smrg# not at the appropriate level. This macro enables a module to test for the
21663bf3b463Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21673bf3b463Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
21683bf3b463Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
21693bf3b463Smrg# --with-asciidoc assumes 'auto'.
21703bf3b463Smrg#
21713bf3b463Smrg# Interface to module:
21723bf3b463Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
21733bf3b463Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
21743bf3b463Smrg#		 returns the path set by the user in the environment
21753bf3b463Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
21763bf3b463Smrg#		  'no' user instructs the module not to use asciidoc
21773bf3b463Smrg#
21783bf3b463Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
21793bf3b463Smrg#
21803bf3b463SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
21813bf3b463SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
21823bf3b463Smrgm4_define([_defopt], m4_default([$2], [auto]))
21833bf3b463SmrgAC_ARG_WITH(asciidoc,
21843bf3b463Smrg	AS_HELP_STRING([--with-asciidoc],
21853bf3b463Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
21863bf3b463Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
21873bf3b463Smrgm4_undefine([_defopt])
2188266e564dSmrg
21893bf3b463Smrgif test "x$use_asciidoc" = x"auto"; then
21903bf3b463Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
21913bf3b463Smrg   if test "x$ASCIIDOC" = "x"; then
21923bf3b463Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
21933bf3b463Smrg	have_asciidoc=no
21943bf3b463Smrg   else
21953bf3b463Smrg        have_asciidoc=yes
21963bf3b463Smrg   fi
21973bf3b463Smrgelif test "x$use_asciidoc" = x"yes" ; then
21983bf3b463Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
21993bf3b463Smrg   if test "x$ASCIIDOC" = "x"; then
22003bf3b463Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
22013bf3b463Smrg   fi
22023bf3b463Smrg   have_asciidoc=yes
22033bf3b463Smrgelif test "x$use_asciidoc" = x"no" ; then
22043bf3b463Smrg   if test "x$ASCIIDOC" != "x"; then
22053bf3b463Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
22063bf3b463Smrg   fi
22073bf3b463Smrg   have_asciidoc=no
22089ef0b394Smrgelse
22093bf3b463Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
22109ef0b394Smrgfi
22113bf3b463Smrgm4_ifval([$1],
22123bf3b463Smrg[if test "$have_asciidoc" = yes; then
22133bf3b463Smrg    # scrape the asciidoc version
22143bf3b463Smrg    AC_MSG_CHECKING([the asciidoc version])
22153bf3b463Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
22163bf3b463Smrg    AC_MSG_RESULT([$asciidoc_version])
22173bf3b463Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
22183bf3b463Smrg        [if test "x$use_asciidoc" = xauto; then
22193bf3b463Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
22203bf3b463Smrg            have_asciidoc=no
22213bf3b463Smrg        else
22223bf3b463Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
22233bf3b463Smrg        fi])
22243bf3b463Smrgfi])
22253bf3b463SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
22263bf3b463Smrg]) # XORG_WITH_ASCIIDOC
2227c5629e66Smrg
22283bf3b463Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
22293bf3b463Smrg# -------------------------------------------
22303bf3b463Smrg# Minimum version: 1.5.0
22313bf3b463Smrg# Minimum version for optional DEFAULT argument: 1.11.0
22323bf3b463Smrg# Minimum version for optional DOT checking: 1.18.0
22333bf3b463Smrg#
22343bf3b463Smrg# Documentation tools are not always available on all platforms and sometimes
22353bf3b463Smrg# not at the appropriate level. This macro enables a module to test for the
22363bf3b463Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22373bf3b463Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
22383bf3b463Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
22393bf3b463Smrg# --with-doxygen assumes 'auto'.
22403bf3b463Smrg#
22413bf3b463Smrg# Interface to module:
22423bf3b463Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
22433bf3b463Smrg# DOXYGEN:	 returns the path of the doxygen program found
22443bf3b463Smrg#		 returns the path set by the user in the environment
22453bf3b463Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
22463bf3b463Smrg#		  'no' user instructs the module not to use doxygen
22473bf3b463Smrg#
22483bf3b463Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
22493bf3b463Smrg#
22503bf3b463SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
22513bf3b463SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
22523bf3b463SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
22533bf3b463Smrgm4_define([_defopt], m4_default([$2], [auto]))
22543bf3b463SmrgAC_ARG_WITH(doxygen,
22553bf3b463Smrg	AS_HELP_STRING([--with-doxygen],
22563bf3b463Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
22573bf3b463Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
22583bf3b463Smrgm4_undefine([_defopt])
2259c5629e66Smrg
22603bf3b463Smrgif test "x$use_doxygen" = x"auto"; then
22613bf3b463Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
22623bf3b463Smrg   if test "x$DOXYGEN" = "x"; then
22633bf3b463Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
22643bf3b463Smrg	have_doxygen=no
22653bf3b463Smrg   else
22663bf3b463Smrg        have_doxygen=yes
22673bf3b463Smrg   fi
22683bf3b463Smrgelif test "x$use_doxygen" = x"yes" ; then
22693bf3b463Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
22703bf3b463Smrg   if test "x$DOXYGEN" = "x"; then
22713bf3b463Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
22723bf3b463Smrg   fi
22733bf3b463Smrg   have_doxygen=yes
22743bf3b463Smrgelif test "x$use_doxygen" = x"no" ; then
22753bf3b463Smrg   if test "x$DOXYGEN" != "x"; then
22763bf3b463Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
22773bf3b463Smrg   fi
22783bf3b463Smrg   have_doxygen=no
22793bf3b463Smrgelse
22803bf3b463Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
22819ef0b394Smrgfi
22823bf3b463Smrgm4_ifval([$1],
22833bf3b463Smrg[if test "$have_doxygen" = yes; then
22843bf3b463Smrg    # scrape the doxygen version
22853bf3b463Smrg    AC_MSG_CHECKING([the doxygen version])
22863bf3b463Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
22873bf3b463Smrg    AC_MSG_RESULT([$doxygen_version])
22883bf3b463Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
22893bf3b463Smrg        [if test "x$use_doxygen" = xauto; then
22903bf3b463Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
22913bf3b463Smrg            have_doxygen=no
22923bf3b463Smrg        else
22933bf3b463Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
22943bf3b463Smrg        fi])
22953bf3b463Smrgfi])
2296698f425bSmrg
22973bf3b463Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
22983bf3b463Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
22993bf3b463Smrgdnl 	HAVE_DOT = @HAVE_DOT@
23003bf3b463SmrgHAVE_DOT=no
23013bf3b463Smrgif test "x$have_doxygen" = "xyes"; then
23023bf3b463Smrg  AC_PATH_PROG([DOT], [dot])
23033bf3b463Smrg    if test "x$DOT" != "x"; then
23043bf3b463Smrg      HAVE_DOT=yes
23053bf3b463Smrg    fi
23069ef0b394Smrgfi
2307698f425bSmrg
23083bf3b463SmrgAC_SUBST([HAVE_DOT])
23093bf3b463SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
23103bf3b463SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
23113bf3b463Smrg]) # XORG_WITH_DOXYGEN
2312fb5e8d76Smrg
23133bf3b463Smrg# XORG_WITH_GROFF([DEFAULT])
23143bf3b463Smrg# ----------------
23153bf3b463Smrg# Minimum version: 1.6.0
23163bf3b463Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23173bf3b463Smrg#
23183bf3b463Smrg# Documentation tools are not always available on all platforms and sometimes
23193bf3b463Smrg# not at the appropriate level. This macro enables a module to test for the
23203bf3b463Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
23213bf3b463Smrg# the --with-groff option, it allows maximum flexibility in making decisions
23223bf3b463Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
23233bf3b463Smrg# --with-groff assumes 'auto'.
23243bf3b463Smrg#
23253bf3b463Smrg# Interface to module:
23263bf3b463Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
23273bf3b463Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
23283bf3b463Smrg# HAVE_GROFF_MS: the -ms macros package
23293bf3b463Smrg# GROFF:	 returns the path of the groff program found
23303bf3b463Smrg#		 returns the path set by the user in the environment
23313bf3b463Smrg# --with-groff:	 'yes' user instructs the module to use groff
23323bf3b463Smrg#		 'no' user instructs the module not to use groff
23333bf3b463Smrg#
23343bf3b463Smrg# Added in version 1.9.0:
23353bf3b463Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
23363bf3b463Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
23373bf3b463Smrg#		   psselect from the psutils package.
23383bf3b463Smrg#		   the ghostcript package. Refer to the grohtml man pages
23393bf3b463Smrg#
23403bf3b463Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
23413bf3b463Smrg#
23423bf3b463Smrg# OS and distros often splits groff in a basic and full package, the former
23433bf3b463Smrg# having the groff program and the later having devices, fonts and macros
23443bf3b463Smrg# Checking for the groff executable is not enough.
23453bf3b463Smrg#
23463bf3b463Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
23473bf3b463Smrg# unset HAVE_GROFF or GROFF env variables.
23483bf3b463Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
23493bf3b463Smrg#
23503bf3b463SmrgAC_DEFUN([XORG_WITH_GROFF],[
23513bf3b463SmrgAC_ARG_VAR([GROFF], [Path to groff command])
23523bf3b463Smrgm4_define([_defopt], m4_default([$1], [auto]))
23533bf3b463SmrgAC_ARG_WITH(groff,
23543bf3b463Smrg	AS_HELP_STRING([--with-groff],
23553bf3b463Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
23563bf3b463Smrg	   [use_groff=$withval], [use_groff=]_defopt)
23573bf3b463Smrgm4_undefine([_defopt])
2358fb5e8d76Smrg
23593bf3b463Smrgif test "x$use_groff" = x"auto"; then
23603bf3b463Smrg   AC_PATH_PROG([GROFF], [groff])
23613bf3b463Smrg   if test "x$GROFF" = "x"; then
23623bf3b463Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
23633bf3b463Smrg	have_groff=no
23643bf3b463Smrg   else
23653bf3b463Smrg        have_groff=yes
23663bf3b463Smrg   fi
23673bf3b463Smrgelif test "x$use_groff" = x"yes" ; then
23683bf3b463Smrg   AC_PATH_PROG([GROFF], [groff])
23693bf3b463Smrg   if test "x$GROFF" = "x"; then
23703bf3b463Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
23713bf3b463Smrg   fi
23723bf3b463Smrg   have_groff=yes
23733bf3b463Smrgelif test "x$use_groff" = x"no" ; then
23743bf3b463Smrg   if test "x$GROFF" != "x"; then
23753bf3b463Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
23763bf3b463Smrg   fi
23773bf3b463Smrg   have_groff=no
23783bf3b463Smrgelse
23793bf3b463Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
23803bf3b463Smrgfi
2381fb5e8d76Smrg
23823bf3b463Smrg# We have groff, test for the presence of the macro packages
23833bf3b463Smrgif test "x$have_groff" = x"yes"; then
23843bf3b463Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
23853bf3b463Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
23863bf3b463Smrg        groff_ms_works=yes
23873bf3b463Smrg    else
23883bf3b463Smrg        groff_ms_works=no
23893bf3b463Smrg    fi
23903bf3b463Smrg    AC_MSG_RESULT([$groff_ms_works])
23913bf3b463Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
23923bf3b463Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
23933bf3b463Smrg        groff_mm_works=yes
23943bf3b463Smrg    else
23953bf3b463Smrg        groff_mm_works=no
23963bf3b463Smrg    fi
23973bf3b463Smrg    AC_MSG_RESULT([$groff_mm_works])
2398fb5e8d76Smrgfi
2399698f425bSmrg
24003bf3b463Smrg# We have groff, test for HTML dependencies, one command per package
24013bf3b463Smrgif test "x$have_groff" = x"yes"; then
24023bf3b463Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
24033bf3b463Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
24043bf3b463Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
24053bf3b463Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
24063bf3b463Smrg      have_groff_html=yes
24073bf3b463Smrg   else
24083bf3b463Smrg      have_groff_html=no
24093bf3b463Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
24103bf3b463Smrg   fi
24119ef0b394Smrgfi
2412698f425bSmrg
24133bf3b463Smrg# Set Automake conditionals for Makefiles
24143bf3b463SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
24153bf3b463SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
24163bf3b463SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
24173bf3b463SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
24183bf3b463Smrg]) # XORG_WITH_GROFF
2419698f425bSmrg
24203bf3b463Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
24213bf3b463Smrg# ---------------------------------------
24223bf3b463Smrg# Minimum version: 1.6.0
24233bf3b463Smrg# Minimum version for optional DEFAULT argument: 1.11.0
24243bf3b463Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
24253bf3b463Smrg#
24263bf3b463Smrg# Documentation tools are not always available on all platforms and sometimes
24273bf3b463Smrg# not at the appropriate level. This macro enables a module to test for the
24283bf3b463Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
24293bf3b463Smrg# the --with-fop option, it allows maximum flexibility in making decisions
24303bf3b463Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
24313bf3b463Smrg# --with-fop assumes 'auto'.
24323bf3b463Smrg#
24333bf3b463Smrg# Interface to module:
24343bf3b463Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
24353bf3b463Smrg# FOP:	 	returns the path of the fop program found
24363bf3b463Smrg#		returns the path set by the user in the environment
24373bf3b463Smrg# --with-fop: 	'yes' user instructs the module to use fop
24383bf3b463Smrg#		'no' user instructs the module not to use fop
24393bf3b463Smrg#
24403bf3b463Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
24413bf3b463Smrg#
24423bf3b463SmrgAC_DEFUN([XORG_WITH_FOP],[
24433bf3b463SmrgAC_ARG_VAR([FOP], [Path to fop command])
24443bf3b463Smrgm4_define([_defopt], m4_default([$2], [auto]))
24453bf3b463SmrgAC_ARG_WITH(fop,
24463bf3b463Smrg	AS_HELP_STRING([--with-fop],
24473bf3b463Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
24483bf3b463Smrg	   [use_fop=$withval], [use_fop=]_defopt)
24493bf3b463Smrgm4_undefine([_defopt])
2450698f425bSmrg
24513bf3b463Smrgif test "x$use_fop" = x"auto"; then
24523bf3b463Smrg   AC_PATH_PROG([FOP], [fop])
24533bf3b463Smrg   if test "x$FOP" = "x"; then
24543bf3b463Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
24553bf3b463Smrg	have_fop=no
24563bf3b463Smrg   else
24573bf3b463Smrg        have_fop=yes
24583bf3b463Smrg   fi
24593bf3b463Smrgelif test "x$use_fop" = x"yes" ; then
24603bf3b463Smrg   AC_PATH_PROG([FOP], [fop])
24613bf3b463Smrg   if test "x$FOP" = "x"; then
24623bf3b463Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
24633bf3b463Smrg   fi
24643bf3b463Smrg   have_fop=yes
24653bf3b463Smrgelif test "x$use_fop" = x"no" ; then
24663bf3b463Smrg   if test "x$FOP" != "x"; then
24673bf3b463Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
24683bf3b463Smrg   fi
24693bf3b463Smrg   have_fop=no
24703bf3b463Smrgelse
24713bf3b463Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
24729ef0b394Smrgfi
2473698f425bSmrg
24743bf3b463Smrg# Test for a minimum version of fop, if provided.
24753bf3b463Smrgm4_ifval([$1],
24763bf3b463Smrg[if test "$have_fop" = yes; then
24773bf3b463Smrg    # scrape the fop version
24783bf3b463Smrg    AC_MSG_CHECKING([for fop minimum version])
24793bf3b463Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
24803bf3b463Smrg    AC_MSG_RESULT([$fop_version])
24813bf3b463Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
24823bf3b463Smrg        [if test "x$use_fop" = xauto; then
24833bf3b463Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
24843bf3b463Smrg            have_fop=no
24853bf3b463Smrg        else
24863bf3b463Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
24873bf3b463Smrg        fi])
24883bf3b463Smrgfi])
24893bf3b463SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
24903bf3b463Smrg]) # XORG_WITH_FOP
2491c5629e66Smrg
24923bf3b463Smrg# XORG_WITH_M4([MIN-VERSION])
24933bf3b463Smrg# ---------------------------
24943bf3b463Smrg# Minimum version: 1.19.0
24953bf3b463Smrg#
24963bf3b463Smrg# This macro attempts to locate an m4 macro processor which supports
24973bf3b463Smrg# -I option and is only useful for modules relying on M4 in order to
24983bf3b463Smrg# expand macros in source code files.
24993bf3b463Smrg#
25003bf3b463Smrg# Interface to module:
25013bf3b463Smrg# M4:	 	returns the path of the m4 program found
25023bf3b463Smrg#		returns the path set by the user in the environment
25033bf3b463Smrg#
25043bf3b463SmrgAC_DEFUN([XORG_WITH_M4], [
25053bf3b463SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
25063bf3b463Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
25073bf3b463Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
25083bf3b463Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
25093bf3b463Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
25103bf3b463Smrg   [$PATH:/usr/gnu/bin])])
25119ef0b394Smrg
25123bf3b463SmrgAC_SUBST([M4], [$ac_cv_path_M4])
25133bf3b463Smrg]) # XORG_WITH_M4
2514c5629e66Smrg
25153bf3b463Smrg# XORG_WITH_PS2PDF([DEFAULT])
25161009a292Smrg# ----------------
25173bf3b463Smrg# Minimum version: 1.6.0
25183bf3b463Smrg# Minimum version for optional DEFAULT argument: 1.11.0
25193bf3b463Smrg#
25203bf3b463Smrg# Documentation tools are not always available on all platforms and sometimes
25213bf3b463Smrg# not at the appropriate level. This macro enables a module to test for the
25223bf3b463Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
25233bf3b463Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
25243bf3b463Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
25253bf3b463Smrg# --with-ps2pdf assumes 'auto'.
25263bf3b463Smrg#
25273bf3b463Smrg# Interface to module:
25283bf3b463Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
25293bf3b463Smrg# PS2PDF:	returns the path of the ps2pdf program found
25303bf3b463Smrg#		returns the path set by the user in the environment
25313bf3b463Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
25323bf3b463Smrg#		 'no' user instructs the module not to use ps2pdf
25333bf3b463Smrg#
25343bf3b463Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
25353bf3b463Smrg#
25363bf3b463SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
25373bf3b463SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
25383bf3b463Smrgm4_define([_defopt], m4_default([$1], [auto]))
25393bf3b463SmrgAC_ARG_WITH(ps2pdf,
25403bf3b463Smrg	AS_HELP_STRING([--with-ps2pdf],
25413bf3b463Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
25423bf3b463Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
25433bf3b463Smrgm4_undefine([_defopt])
2544698f425bSmrg
25453bf3b463Smrgif test "x$use_ps2pdf" = x"auto"; then
25463bf3b463Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
25473bf3b463Smrg   if test "x$PS2PDF" = "x"; then
25483bf3b463Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
25493bf3b463Smrg	have_ps2pdf=no
25503bf3b463Smrg   else
25513bf3b463Smrg        have_ps2pdf=yes
25523bf3b463Smrg   fi
25533bf3b463Smrgelif test "x$use_ps2pdf" = x"yes" ; then
25543bf3b463Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
25553bf3b463Smrg   if test "x$PS2PDF" = "x"; then
25563bf3b463Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
25573bf3b463Smrg   fi
25583bf3b463Smrg   have_ps2pdf=yes
25593bf3b463Smrgelif test "x$use_ps2pdf" = x"no" ; then
25603bf3b463Smrg   if test "x$PS2PDF" != "x"; then
25613bf3b463Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
25623bf3b463Smrg   fi
25633bf3b463Smrg   have_ps2pdf=no
25649ef0b394Smrgelse
25653bf3b463Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2566c5629e66Smrgfi
25673bf3b463SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
25683bf3b463Smrg]) # XORG_WITH_PS2PDF
25699ef0b394Smrg
25703bf3b463Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
25713bf3b463Smrg# ----------------
25723bf3b463Smrg# Minimum version: 1.6.0
25733bf3b463Smrg#
25743bf3b463Smrg# Documentation tools are not always available on all platforms and sometimes
25753bf3b463Smrg# not at the appropriate level. This macro enables a builder to skip all
25763bf3b463Smrg# documentation targets except traditional man pages.
25773bf3b463Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
25783bf3b463Smrg# maximum flexibility in controlling documentation building.
25793bf3b463Smrg# Refer to:
25803bf3b463Smrg# XORG_WITH_XMLTO         --with-xmlto
25813bf3b463Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
25823bf3b463Smrg# XORG_WITH_DOXYGEN       --with-doxygen
25833bf3b463Smrg# XORG_WITH_FOP           --with-fop
25843bf3b463Smrg# XORG_WITH_GROFF         --with-groff
25853bf3b463Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2586c5629e66Smrg#
25873bf3b463Smrg# Interface to module:
25883bf3b463Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
25893bf3b463Smrg# --enable-docs: 'yes' user instructs the module to generate docs
25903bf3b463Smrg#		 'no' user instructs the module not to generate docs
25913bf3b463Smrg# parm1:	specify the default value, yes or no.
2592c5629e66Smrg#
25933bf3b463SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
25943bf3b463Smrgm4_define([docs_default], m4_default([$1], [yes]))
25953bf3b463SmrgAC_ARG_ENABLE(docs,
25963bf3b463Smrg	AS_HELP_STRING([--enable-docs],
25973bf3b463Smrg	   [Enable building the documentation (default: ]docs_default[)]),
25983bf3b463Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
25993bf3b463Smrgm4_undefine([docs_default])
26003bf3b463SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
26013bf3b463SmrgAC_MSG_CHECKING([whether to build documentation])
26023bf3b463SmrgAC_MSG_RESULT([$build_docs])
26033bf3b463Smrg]) # XORG_ENABLE_DOCS
2604c5629e66Smrg
26053bf3b463Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
26063bf3b463Smrg# ----------------
26073bf3b463Smrg# Minimum version: 1.6.0
2608a3129944Smrg#
26093bf3b463Smrg# This macro enables a builder to skip all developer documentation.
26103bf3b463Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
26113bf3b463Smrg# maximum flexibility in controlling documentation building.
26123bf3b463Smrg# Refer to:
26133bf3b463Smrg# XORG_WITH_XMLTO         --with-xmlto
26143bf3b463Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
26153bf3b463Smrg# XORG_WITH_DOXYGEN       --with-doxygen
26163bf3b463Smrg# XORG_WITH_FOP           --with-fop
26173bf3b463Smrg# XORG_WITH_GROFF         --with-groff
26183bf3b463Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2619a3129944Smrg#
26203bf3b463Smrg# Interface to module:
26213bf3b463Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
26223bf3b463Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
26233bf3b463Smrg#			'no' user instructs the module not to generate developer docs
26243bf3b463Smrg# parm1:		specify the default value, yes or no.
2625a3129944Smrg#
26263bf3b463SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
26273bf3b463Smrgm4_define([devel_default], m4_default([$1], [yes]))
26283bf3b463SmrgAC_ARG_ENABLE(devel-docs,
26293bf3b463Smrg	AS_HELP_STRING([--enable-devel-docs],
26303bf3b463Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
26313bf3b463Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
26323bf3b463Smrgm4_undefine([devel_default])
26333bf3b463SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
26343bf3b463SmrgAC_MSG_CHECKING([whether to build developer documentation])
26353bf3b463SmrgAC_MSG_RESULT([$build_devel_docs])
26363bf3b463Smrg]) # XORG_ENABLE_DEVEL_DOCS
26373bf3b463Smrg
26383bf3b463Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
26393bf3b463Smrg# ----------------
26403bf3b463Smrg# Minimum version: 1.6.0
2641a3129944Smrg#
26423bf3b463Smrg# This macro enables a builder to skip all functional specification targets.
26433bf3b463Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
26443bf3b463Smrg# maximum flexibility in controlling documentation building.
26453bf3b463Smrg# Refer to:
26463bf3b463Smrg# XORG_WITH_XMLTO         --with-xmlto
26473bf3b463Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
26483bf3b463Smrg# XORG_WITH_DOXYGEN       --with-doxygen
26493bf3b463Smrg# XORG_WITH_FOP           --with-fop
26503bf3b463Smrg# XORG_WITH_GROFF         --with-groff
26513bf3b463Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2652a3129944Smrg#
26533bf3b463Smrg# Interface to module:
26543bf3b463Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
26553bf3b463Smrg# --enable-specs:	'yes' user instructs the module to generate specs
26563bf3b463Smrg#			'no' user instructs the module not to generate specs
26573bf3b463Smrg# parm1:		specify the default value, yes or no.
2658a3129944Smrg#
26593bf3b463SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
26603bf3b463Smrgm4_define([spec_default], m4_default([$1], [yes]))
26613bf3b463SmrgAC_ARG_ENABLE(specs,
26623bf3b463Smrg	AS_HELP_STRING([--enable-specs],
26633bf3b463Smrg	   [Enable building the specs (default: ]spec_default[)]),
26643bf3b463Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
26653bf3b463Smrgm4_undefine([spec_default])
26663bf3b463SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
26673bf3b463SmrgAC_MSG_CHECKING([whether to build functional specifications])
26683bf3b463SmrgAC_MSG_RESULT([$build_specs])
26693bf3b463Smrg]) # XORG_ENABLE_SPECS
2670a3129944Smrg
26713bf3b463Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
26723bf3b463Smrg# ----------------------------------------------
26733bf3b463Smrg# Minimum version: 1.13.0
2674a3129944Smrg#
26753bf3b463Smrg# This macro enables a builder to enable/disable unit testing
26763bf3b463Smrg# It makes no assumption about the test cases implementation
26773bf3b463Smrg# Test cases may or may not use Automake "Support for test suites"
26783bf3b463Smrg# They may or may not use the software utility library GLib
2679a3129944Smrg#
26803bf3b463Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
26813bf3b463Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
26823bf3b463Smrg# The variable enable_unit_tests is used by other macros in this file.
2683a3129944Smrg#
26843bf3b463Smrg# Interface to module:
26853bf3b463Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
26863bf3b463Smrg# enable_unit_tests:    used in configure.ac for additional configuration
26873bf3b463Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
26883bf3b463Smrg#			'no' user instructs the module not to build tests
26893bf3b463Smrg# parm1:		specify the default value, yes or no.
26903bf3b463Smrg#
26913bf3b463SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
26923bf3b463SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
26933bf3b463SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
26943bf3b463SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
26953bf3b463Smrgm4_define([_defopt], m4_default([$1], [auto]))
26963bf3b463SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
26973bf3b463Smrg	[Enable building unit test cases (default: ]_defopt[)]),
26983bf3b463Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
26993bf3b463Smrgm4_undefine([_defopt])
27003bf3b463SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
27013bf3b463SmrgAC_MSG_CHECKING([whether to build unit test cases])
27023bf3b463SmrgAC_MSG_RESULT([$enable_unit_tests])
27033bf3b463Smrg]) # XORG_ENABLE_UNIT_TESTS
2704a3129944Smrg
27053bf3b463Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
27063bf3b463Smrg# ------------------------------------------------------
27073bf3b463Smrg# Minimum version: 1.17.0
27083bf3b463Smrg#
27093bf3b463Smrg# This macro enables a builder to enable/disable integration testing
27103bf3b463Smrg# It makes no assumption about the test cases' implementation
27113bf3b463Smrg# Test cases may or may not use Automake "Support for test suites"
27123bf3b463Smrg#
27133bf3b463Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
27143bf3b463Smrg# usually requires less dependencies and may be built and run under less
27153bf3b463Smrg# stringent environments than integration tests.
27163bf3b463Smrg#
27173bf3b463Smrg# Interface to module:
27183bf3b463Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
27193bf3b463Smrg# enable_integration_tests:   used in configure.ac for additional configuration
27203bf3b463Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
27213bf3b463Smrg#                             'no' user instructs the module not to build tests
27223bf3b463Smrg# parm1:                      specify the default value, yes or no.
27233bf3b463Smrg#
27243bf3b463SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
27253bf3b463SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
27263bf3b463Smrgm4_define([_defopt], m4_default([$1], [auto]))
27273bf3b463SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
27283bf3b463Smrg	[Enable building integration test cases (default: ]_defopt[)]),
27293bf3b463Smrg	[enable_integration_tests=$enableval],
27303bf3b463Smrg	[enable_integration_tests=]_defopt)
27313bf3b463Smrgm4_undefine([_defopt])
27323bf3b463SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
27333bf3b463Smrg	[test "x$enable_integration_tests" != xno])
27343bf3b463SmrgAC_MSG_CHECKING([whether to build unit test cases])
27353bf3b463SmrgAC_MSG_RESULT([$enable_integration_tests])
27363bf3b463Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2737a3129944Smrg
27383bf3b463Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
27393bf3b463Smrg# ----------------------------------------
27403bf3b463Smrg# Minimum version: 1.13.0
27413bf3b463Smrg#
27423bf3b463Smrg# GLib is a library which provides advanced data structures and functions.
27433bf3b463Smrg# This macro enables a module to test for the presence of Glib.
27443bf3b463Smrg#
27453bf3b463Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
27463bf3b463Smrg# Otherwise the value of $enable_unit_tests is blank.
27473bf3b463Smrg#
27483bf3b463Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
27493bf3b463Smrg# test support usually requires less dependencies and may be built and run under
27503bf3b463Smrg# less stringent environments than integration tests.
27513bf3b463Smrg#
27523bf3b463Smrg# Interface to module:
27533bf3b463Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
27543bf3b463Smrg# with_glib: used in configure.ac to know if GLib has been found
27553bf3b463Smrg# --with-glib:	'yes' user instructs the module to use glib
27563bf3b463Smrg#		'no' user instructs the module not to use glib
27573bf3b463Smrg#
27583bf3b463SmrgAC_DEFUN([XORG_WITH_GLIB],[
27593bf3b463SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
27603bf3b463Smrgm4_define([_defopt], m4_default([$2], [auto]))
27613bf3b463SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
27623bf3b463Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
27633bf3b463Smrg	[with_glib=$withval], [with_glib=]_defopt)
27643bf3b463Smrgm4_undefine([_defopt])
2765a3129944Smrg
27663bf3b463Smrghave_glib=no
27673bf3b463Smrg# Do not probe GLib if user explicitly disabled unit testing
27683bf3b463Smrgif test "x$enable_unit_tests" != x"no"; then
27693bf3b463Smrg  # Do not probe GLib if user explicitly disabled it
27703bf3b463Smrg  if test "x$with_glib" != x"no"; then
27713bf3b463Smrg    m4_ifval(
27723bf3b463Smrg      [$1],
27733bf3b463Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
27743bf3b463Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
27753bf3b463Smrg    )
27763bf3b463Smrg  fi
27773bf3b463Smrgfi
2778a3129944Smrg
27793bf3b463Smrg# Not having GLib when unit testing has been explicitly requested is an error
27803bf3b463Smrgif test "x$enable_unit_tests" = x"yes"; then
27813bf3b463Smrg  if test "x$have_glib" = x"no"; then
27823bf3b463Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
27833bf3b463Smrg  fi
27843bf3b463Smrgfi
2785a3129944Smrg
27863bf3b463Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
27873bf3b463Smrgif test "x$enable_unit_tests" = x"no"; then
27883bf3b463Smrg  if test "x$with_glib" = x"yes"; then
27893bf3b463Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
27903bf3b463Smrg  fi
27913bf3b463Smrgfi
2792a3129944Smrg
27933bf3b463Smrg# Not having GLib when it has been explicitly requested is an error
27943bf3b463Smrgif test "x$with_glib" = x"yes"; then
27953bf3b463Smrg  if test "x$have_glib" = x"no"; then
27963bf3b463Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
27973bf3b463Smrg  fi
2798a3129944Smrgfi
2799a3129944Smrg
28003bf3b463SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
28013bf3b463Smrg]) # XORG_WITH_GLIB
2802a3129944Smrg
28033bf3b463Smrg# XORG_LD_WRAP([required|optional])
28043bf3b463Smrg# ---------------------------------
28053bf3b463Smrg# Minimum version: 1.13.0
2806a3129944Smrg#
28073bf3b463Smrg# Check if linker supports -wrap, passed via compiler flags
28083bf3b463Smrg#
28093bf3b463Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
28103bf3b463Smrg# Otherwise the value of $enable_unit_tests is blank.
28113bf3b463Smrg#
28123bf3b463Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
28133bf3b463Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
28143bf3b463Smrg# available, an argument of "optional" allows use when some unit tests require
28153bf3b463Smrg# ld -wrap and others do not.
28163bf3b463Smrg#
28173bf3b463SmrgAC_DEFUN([XORG_LD_WRAP],[
28183bf3b463SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
28193bf3b463Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
28203bf3b463Smrg                      void __wrap_exit(int status) { return; }],
28213bf3b463Smrg                     [exit(0);])])
28223bf3b463Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
28233bf3b463Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
28243bf3b463Smrg  if test "x$have_ld_wrap" = x"no"; then
28253bf3b463Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
28261009a292Smrg  fi
28273bf3b463Smrgfi
28283bf3b463SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
28293bf3b463Smrg#
28303bf3b463Smrg]) # XORG_LD_WRAP
2831a3129944Smrg
28323bf3b463Smrg# XORG_CHECK_LINKER_FLAGS
28333bf3b463Smrg# -----------------------
28343bf3b463Smrg# SYNOPSIS
28353bf3b463Smrg#
28363bf3b463Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
28373bf3b463Smrg#
28383bf3b463Smrg# DESCRIPTION
28393bf3b463Smrg#
28403bf3b463Smrg#   Check whether the given linker FLAGS work with the current language's
28413bf3b463Smrg#   linker, or whether they give an error.
28423bf3b463Smrg#
28433bf3b463Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
28443bf3b463Smrg#   success/failure.
28453bf3b463Smrg#
28463bf3b463Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
28473bf3b463Smrg#
28483bf3b463Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
28493bf3b463Smrg#
28503bf3b463Smrg# LICENSE
28513bf3b463Smrg#
28523bf3b463Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
28533bf3b463Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
28543bf3b463Smrg#   Copyright (c) 2009 Matteo Frigo
28553bf3b463Smrg#
28563bf3b463Smrg#   This program is free software: you can redistribute it and/or modify it
28573bf3b463Smrg#   under the terms of the GNU General Public License as published by the
28583bf3b463Smrg#   Free Software Foundation, either version 3 of the License, or (at your
28593bf3b463Smrg#   option) any later version.
28603bf3b463Smrg#
28613bf3b463Smrg#   This program is distributed in the hope that it will be useful, but
28623bf3b463Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
28633bf3b463Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
28643bf3b463Smrg#   Public License for more details.
28653bf3b463Smrg#
28663bf3b463Smrg#   You should have received a copy of the GNU General Public License along
28673bf3b463Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
28683bf3b463Smrg#
28693bf3b463Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
28703bf3b463Smrg#   gives unlimited permission to copy, distribute and modify the configure
28713bf3b463Smrg#   scripts that are the output of Autoconf when processing the Macro. You
28723bf3b463Smrg#   need not follow the terms of the GNU General Public License when using
28733bf3b463Smrg#   or distributing such scripts, even though portions of the text of the
28743bf3b463Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
28753bf3b463Smrg#   all other use of the material that constitutes the Autoconf Macro.
28763bf3b463Smrg#
28773bf3b463Smrg#   This special exception to the GPL applies to versions of the Autoconf
28783bf3b463Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
28793bf3b463Smrg#   modified version of the Autoconf Macro, you may extend this special
28803bf3b463Smrg#   exception to the GPL to apply to your modified version as well.#
28813bf3b463SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
28823bf3b463Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
28833bf3b463Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
28843bf3b463SmrgAS_LITERAL_IF([$1],
28853bf3b463Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
28863bf3b463Smrg      ax_save_FLAGS=$LDFLAGS
28873bf3b463Smrg      LDFLAGS="$1"
28883bf3b463Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
28893bf3b463Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
28903bf3b463Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
28913bf3b463Smrg      LDFLAGS=$ax_save_FLAGS])],
28923bf3b463Smrg  [ax_save_FLAGS=$LDFLAGS
28933bf3b463Smrg   LDFLAGS="$1"
28943bf3b463Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
28953bf3b463Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
28963bf3b463Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
28973bf3b463Smrg   LDFLAGS=$ax_save_FLAGS])
28983bf3b463Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
28993bf3b463SmrgAC_MSG_RESULT($xorg_check_linker_flags)
29003bf3b463Smrgif test "x$xorg_check_linker_flags" = xyes; then
29013bf3b463Smrg	m4_default([$2], :)
29023bf3b463Smrgelse
29033bf3b463Smrg	m4_default([$3], :)
29043bf3b463Smrgfi
29053bf3b463Smrg]) # XORG_CHECK_LINKER_FLAGS
2906a3129944Smrg
29073bf3b463Smrg# XORG_MEMORY_CHECK_FLAGS
29083bf3b463Smrg# -----------------------
29093bf3b463Smrg# Minimum version: 1.16.0
2910a3129944Smrg#
29113bf3b463Smrg# This macro attempts to find appropriate memory checking functionality
29123bf3b463Smrg# for various platforms which unit testing code may use to catch various
29133bf3b463Smrg# forms of memory allocation and access errors in testing.
2914a3129944Smrg#
29153bf3b463Smrg# Interface to module:
29163bf3b463Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
29173bf3b463Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
29183bf3b463Smrg#
29193bf3b463Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
29203bf3b463Smrg#
29213bf3b463SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2922a3129944Smrg
29233bf3b463SmrgAC_REQUIRE([AC_CANONICAL_HOST])
29243bf3b463SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
29253bf3b463Smrg           [Environment variables to enable memory checking in tests])
2926a3129944Smrg
29273bf3b463Smrg# Check for different types of support on different platforms
29283bf3b463Smrgcase $host_os in
29293bf3b463Smrg    solaris*)
29303bf3b463Smrg        AC_CHECK_LIB([umem], [umem_alloc],
29313bf3b463Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
29323bf3b463Smrg        ;;
29333bf3b463Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
29343bf3b463Smrg        # both directly and inverted, so should not be 0 or 255.
29353bf3b463Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
29363bf3b463Smrg        ;;
29373bf3b463Smrg    darwin*)
29383bf3b463Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
29393bf3b463Smrg        ;;
29403bf3b463Smrg    *bsd*)
29413bf3b463Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
29423bf3b463Smrg        ;;
29433bf3b463Smrgesac
2944a3129944Smrg
29453bf3b463Smrg# User supplied flags override default flags
29463bf3b463Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
29473bf3b463Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2948a3129944Smrgfi
2949a3129944Smrg
29503bf3b463SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
29513bf3b463Smrg]) # XORG_WITH_LINT
2952a3129944Smrg
29533bf3b463Smrg# XORG_CHECK_MALLOC_ZERO
29543bf3b463Smrg# ----------------------
29553bf3b463Smrg# Minimum version: 1.0.0
29563bf3b463Smrg#
29573bf3b463Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
29583bf3b463Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
29593bf3b463Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
29603bf3b463Smrg#
29613bf3b463Smrg# No longer actually tests since there is no guarantee applications will
29623bf3b463Smrg# run with the same malloc implementation we tested against, and the cost
29633bf3b463Smrg# of always ensuring the size passed to malloc is non-zero is minimal now.
29643bf3b463Smrg# Still allows builders to override when they have complete control over
29653bf3b463Smrg# which malloc implementation will be used.
29663bf3b463SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
29673bf3b463SmrgAC_ARG_ENABLE(malloc0returnsnull,
29683bf3b463Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
29693bf3b463Smrg		       [assume malloc(0) can return NULL (default: yes)]),
29703bf3b463Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
29713bf3b463Smrg	[MALLOC_ZERO_RETURNS_NULL=yes])
2972a3129944Smrg
29733bf3b463SmrgAC_MSG_CHECKING([whether to act as if malloc(0) can return NULL])
29743bf3b463SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2975a3129944Smrg
29763bf3b463Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
29773bf3b463Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
29783bf3b463Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
29793bf3b463Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
29803bf3b463Smrgelse
29813bf3b463Smrg	MALLOC_ZERO_CFLAGS=""
29823bf3b463Smrg	XMALLOC_ZERO_CFLAGS=""
29833bf3b463Smrg	XTMALLOC_ZERO_CFLAGS=""
29841009a292Smrgfi
29853bf3b463Smrg
29863bf3b463SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
29873bf3b463SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
29883bf3b463SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
29893bf3b463Smrg]) # XORG_CHECK_MALLOC_ZERO
29903bf3b463Smrg
29913bf3b463Smrg# XORG_WITH_LINT()
29923bf3b463Smrg# ----------------
29933bf3b463Smrg# Minimum version: 1.1.0
29943bf3b463Smrg#
29953bf3b463Smrg# This macro enables the use of a tool that flags some suspicious and
29963bf3b463Smrg# non-portable constructs (likely to be bugs) in C language source code.
29973bf3b463Smrg# It will attempt to locate the tool and use appropriate options.
29983bf3b463Smrg# There are various lint type tools on different platforms.
29993bf3b463Smrg#
30003bf3b463Smrg# Interface to module:
30013bf3b463Smrg# LINT:		returns the path to the tool found on the platform
30023bf3b463Smrg#		or the value set to LINT on the configure cmd line
30033bf3b463Smrg#		also an Automake conditional
30043bf3b463Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
30053bf3b463Smrg#
30063bf3b463Smrg# --with-lint:	'yes' user instructs the module to use lint
30073bf3b463Smrg#		'no' user instructs the module not to use lint (default)
30083bf3b463Smrg#
30093bf3b463Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
30103bf3b463Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
30113bf3b463Smrg#
30123bf3b463SmrgAC_DEFUN([XORG_WITH_LINT],[
30133bf3b463Smrg
30143bf3b463SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
30153bf3b463SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
30163bf3b463SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
30173bf3b463Smrg		[Use a lint-style source code checker (default: disabled)])],
30183bf3b463Smrg		[use_lint=$withval], [use_lint=no])
30193bf3b463Smrg
30203bf3b463Smrg# Obtain platform specific info like program name and options
30213bf3b463Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
30223bf3b463Smrgcase $host_os in
30233bf3b463Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
30243bf3b463Smrg	lint_name=splint
30253bf3b463Smrg	lint_options="-badflag"
30263bf3b463Smrg	;;
30273bf3b463Smrg  *freebsd* | *netbsd*)
30283bf3b463Smrg	lint_name=lint
30293bf3b463Smrg	lint_options="-u -b"
30303bf3b463Smrg	;;
30313bf3b463Smrg  *solaris*)
30323bf3b463Smrg	lint_name=lint
30333bf3b463Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
30343bf3b463Smrg	;;
30353bf3b463Smrgesac
30363bf3b463Smrg
30373bf3b463Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
30383bf3b463Smrgif test "x$use_lint" = x"yes" ; then
30393bf3b463Smrg   AC_PATH_PROG([LINT], [$lint_name])
30403bf3b463Smrg   if test "x$LINT" = "x"; then
30413bf3b463Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
30423bf3b463Smrg   fi
30433bf3b463Smrgelif test "x$use_lint" = x"no" ; then
30443bf3b463Smrg   if test "x$LINT" != "x"; then
30453bf3b463Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
30463bf3b463Smrg   fi
30473bf3b463Smrgelse
30483bf3b463Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
30491009a292Smrgfi
30501009a292Smrg
30513bf3b463Smrg# User supplied flags override default flags
30523bf3b463Smrgif test "x$LINT_FLAGS" != "x"; then
30533bf3b463Smrg   lint_options=$LINT_FLAGS
30543bf3b463Smrgfi
3055a3129944Smrg
30563bf3b463SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
30573bf3b463SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
3058a3129944Smrg
30593bf3b463Smrg]) # XORG_WITH_LINT
3060a3129944Smrg
30613bf3b463Smrg# XORG_LINT_LIBRARY(LIBNAME)
30623bf3b463Smrg# --------------------------
30633bf3b463Smrg# Minimum version: 1.1.0
30643bf3b463Smrg#
30653bf3b463Smrg# Sets up flags for building lint libraries for checking programs that call
30663bf3b463Smrg# functions in the library.
30673bf3b463Smrg#
30683bf3b463Smrg# Interface to module:
30693bf3b463Smrg# LINTLIB		- Automake variable with the name of lint library file to make
30703bf3b463Smrg# MAKE_LINT_LIB		- Automake conditional
30713bf3b463Smrg#
30723bf3b463Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
30733bf3b463Smrg#			  - 'no' user instructs the module not to create a lint library (default)
3074a3129944Smrg
30753bf3b463SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
30763bf3b463SmrgAC_REQUIRE([XORG_WITH_LINT])
30773bf3b463SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
30783bf3b463Smrg	[Create lint library (default: disabled)])],
30793bf3b463Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
3080a3129944Smrg
30813bf3b463Smrgif test "x$make_lint_lib" = x"yes" ; then
30823bf3b463Smrg   LINTLIB=llib-l$1.ln
30833bf3b463Smrg   if test "x$LINT" = "x"; then
30843bf3b463Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
30853bf3b463Smrg   fi
30863bf3b463Smrgelif test "x$make_lint_lib" != x"no" ; then
30873bf3b463Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
3088a3129944Smrgfi
3089a3129944Smrg
30903bf3b463SmrgAC_SUBST(LINTLIB)
30913bf3b463SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
3092a3129944Smrg
30933bf3b463Smrg]) # XORG_LINT_LIBRARY
3094a3129944Smrg
30953bf3b463Smrg# XORG_COMPILER_BRAND
30963bf3b463Smrg# -------------------
30973bf3b463Smrg# Minimum version: 1.14.0
30983bf3b463Smrg#
30993bf3b463Smrg# Checks for various brands of compilers and sets flags as appropriate:
31003bf3b463Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
31013bf3b463Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
31023bf3b463Smrg#   clang compiler - sets CLANGCC to "yes"
31033bf3b463Smrg#   Intel compiler - sets INTELCC to "yes"
31043bf3b463Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
31053bf3b463Smrg#
31063bf3b463SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
31073bf3b463SmrgAC_LANG_CASE(
31083bf3b463Smrg	[C], [
31093bf3b463Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
31103bf3b463Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
31113bf3b463Smrg		m4_version_prereq([2.70],
31123bf3b463Smrg			[AC_REQUIRE([AC_PROG_CC])],
31133bf3b463Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
31143bf3b463Smrg	],
31153bf3b463Smrg	[C++], [
31163bf3b463Smrg		AC_REQUIRE([AC_PROG_CXX])
31173bf3b463Smrg	]
31183bf3b463Smrg)
31193bf3b463SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
31203bf3b463SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
31213bf3b463SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
31223bf3b463Smrg]) # XORG_COMPILER_BRAND
3123a3129944Smrg
31243bf3b463Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
31253bf3b463Smrg# ---------------
31263bf3b463Smrg# Minimum version: 1.16.0
3127a3129944Smrg#
31283bf3b463Smrg# Test if the compiler works when passed the given flag as a command line argument.
31293bf3b463Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
31303bf3b463Smrg# next flag in the list until there are no more options.
31313bf3b463Smrg#
31323bf3b463Smrg# Note that this does not guarantee that the compiler supports the flag as some
31333bf3b463Smrg# compilers will simply ignore arguments that they do not understand, but we do
31343bf3b463Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
31353bf3b463Smrg# -Werror=unused-command-line-argument
31363bf3b463Smrg#
31373bf3b463SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
31383bf3b463Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
31393bf3b463Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3140a3129944Smrg
31413bf3b463SmrgAC_LANG_COMPILER_REQUIRE
3142a3129944Smrg
31433bf3b463SmrgAC_LANG_CASE(
31443bf3b463Smrg	[C], [
31453bf3b463Smrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
31463bf3b463Smrg		dnl and complains that AC_PROG_CC_C99 is obsolete
31473bf3b463Smrg		m4_version_prereq([2.70],
31483bf3b463Smrg			[AC_REQUIRE([AC_PROG_CC])],
31493bf3b463Smrg			[AC_REQUIRE([AC_PROG_CC_C99])])
31503bf3b463Smrg		define([PREFIX], [C])
31513bf3b463Smrg		define([CACHE_PREFIX], [cc])
31523bf3b463Smrg		define([COMPILER], [$CC])
31533bf3b463Smrg	],
31543bf3b463Smrg	[C++], [
31553bf3b463Smrg		define([PREFIX], [CXX])
31563bf3b463Smrg		define([CACHE_PREFIX], [cxx])
31573bf3b463Smrg		define([COMPILER], [$CXX])
31583bf3b463Smrg	]
31593bf3b463Smrg)
3160a3129944Smrg
31613bf3b463Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
31623bf3b463Smrg
31633bf3b463Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
31643bf3b463Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
31653bf3b463Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
31663bf3b463Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
31673bf3b463Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
31683bf3b463Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
31693bf3b463Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
31703bf3b463Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
31713bf3b463Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3172a3129944Smrgfi
3173a3129944Smrg
31743bf3b463Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
31753bf3b463Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
31763bf3b463Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
31773bf3b463Smrg	fi
31783bf3b463Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
31793bf3b463Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
31803bf3b463Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
31813bf3b463Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
31823bf3b463Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
31833bf3b463Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
31843bf3b463Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
31853bf3b463Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
31863bf3b463Smrgfi
3187a3129944Smrg
31883bf3b463Smrgfound="no"
31893bf3b463Smrgm4_foreach([flag], m4_cdr($@), [
31903bf3b463Smrg	if test $found = "no" ; then
31913bf3b463Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
31923bf3b463Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
31933bf3b463Smrg		fi
3194a3129944Smrg
31953bf3b463Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
31963bf3b463Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
31973bf3b463Smrg		fi
31983bf3b463Smrg
31993bf3b463Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
32003bf3b463Smrg
32013bf3b463Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
32023bf3b463Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
32033bf3b463Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
32043bf3b463Smrg		AC_CACHE_VAL($cacheid,
32053bf3b463Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
32063bf3b463Smrg					     [eval $cacheid=yes],
32073bf3b463Smrg					     [eval $cacheid=no])])
32083bf3b463Smrg
32093bf3b463Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3210a3129944Smrg
32113bf3b463Smrg		eval supported=\$$cacheid
32123bf3b463Smrg		AC_MSG_RESULT([$supported])
32133bf3b463Smrg		if test "$supported" = "yes" ; then
32143bf3b463Smrg			$1="$$1 ]flag["
32153bf3b463Smrg			found="yes"
32163bf3b463Smrg		fi
32173bf3b463Smrg	fi
32183bf3b463Smrg])
32193bf3b463Smrg]) # XORG_TESTSET_CFLAG
3220a3129944Smrg
32213bf3b463Smrg# XORG_COMPILER_FLAGS
32223bf3b463Smrg# ---------------
32233bf3b463Smrg# Minimum version: 1.16.0
3224a3129944Smrg#
32253bf3b463Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
32263bf3b463Smrg# arguments supported by the selected compiler which do NOT alter the generated
32273bf3b463Smrg# code.  These arguments will cause the compiler to print various warnings
32283bf3b463Smrg# during compilation AND turn a conservative set of warnings into errors.
32293bf3b463Smrg#
32303bf3b463Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
32313bf3b463Smrg# future versions of util-macros as options are added to new compilers.
32323bf3b463Smrg#
32333bf3b463SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
32343bf3b463SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3235a3129944Smrg
32363bf3b463SmrgAC_ARG_ENABLE(selective-werror,
32373bf3b463Smrg              AS_HELP_STRING([--disable-selective-werror],
32383bf3b463Smrg                             [Turn off selective compiler errors. (default: enabled)]),
32393bf3b463Smrg              [SELECTIVE_WERROR=$enableval],
32403bf3b463Smrg              [SELECTIVE_WERROR=yes])
3241a3129944Smrg
32423bf3b463SmrgAC_LANG_CASE(
32433bf3b463Smrg        [C], [
32443bf3b463Smrg                define([PREFIX], [C])
32453bf3b463Smrg        ],
32463bf3b463Smrg        [C++], [
32473bf3b463Smrg                define([PREFIX], [CXX])
32483bf3b463Smrg        ]
32493bf3b463Smrg)
32503bf3b463Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
32513bf3b463Smrgif test "x$SUNCC" = "xyes"; then
32523bf3b463Smrg    [BASE_]PREFIX[FLAGS]="-v"
3253a3129944Smrgelse
32543bf3b463Smrg    [BASE_]PREFIX[FLAGS]=""
3255a3129944Smrgfi
3256a3129944Smrg
32573bf3b463Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
32583bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
32593bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
32603bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
32613bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3262a3129944Smrg
32633bf3b463SmrgAC_LANG_CASE(
32643bf3b463Smrg	[C], [
32653bf3b463Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
32663bf3b463Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
32673bf3b463Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
32683bf3b463Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
32693bf3b463Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
32703bf3b463Smrg	]
32713bf3b463Smrg)
3272a3129944Smrg
32733bf3b463Smrg# This chunk adds additional warnings that could catch undesired effects.
32743bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
32753bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
32763bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
32773bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
32783bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
32793bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
32803bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3281a3129944Smrg
32823bf3b463Smrg# These are currently disabled because they are noisy.  They will be enabled
32833bf3b463Smrg# in the future once the codebase is sufficiently modernized to silence
32843bf3b463Smrg# them.  For now, I don't want them to drown out the other warnings.
32853bf3b463Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
32863bf3b463Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
32873bf3b463Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3288a3129944Smrg
32893bf3b463Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
32903bf3b463Smrg# when there are problems that should be fixed.
3291a3129944Smrg
32923bf3b463Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
32933bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
32943bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
32953bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
32963bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
32973bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
32983bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
32993bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
33003bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
33013bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
33023bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
33033bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
33043bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
33053bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
33063bf3b463Smrgelse
33073bf3b463SmrgAC_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])
33083bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
33093bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
33103bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
33113bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
33123bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
33133bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
33143bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
33153bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
33163bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
33173bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
33183bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
33193bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
33203bf3b463SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
33213bf3b463Smrgfi
3322a3129944Smrg
33233bf3b463SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
33243bf3b463Smrg]) # XORG_COMPILER_FLAGS
3325a3129944Smrg
33263bf3b463Smrg# XORG_CWARNFLAGS
3327a3129944Smrg# ---------------
33283bf3b463Smrg# Minimum version: 1.2.0
33293bf3b463Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
33303bf3b463Smrg#
33313bf3b463Smrg# Defines CWARNFLAGS to enable C compiler warnings.
33323bf3b463Smrg#
33333bf3b463Smrg# This function is deprecated because it defines -fno-strict-aliasing
33343bf3b463Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
33353bf3b463Smrg# is needed, then it should be added explicitly in the module when
33363bf3b463Smrg# it is updated to use BASE_CFLAGS.
33373bf3b463Smrg#
33383bf3b463SmrgAC_DEFUN([XORG_CWARNFLAGS], [
33393bf3b463SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
33403bf3b463SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
33413bf3b463SmrgAC_LANG_CASE(
33423bf3b463Smrg	[C], [
33433bf3b463Smrg		CWARNFLAGS="$BASE_CFLAGS"
33443bf3b463Smrg		if  test "x$GCC" = xyes ; then
33453bf3b463Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
33463bf3b463Smrg		fi
33473bf3b463Smrg		AC_SUBST(CWARNFLAGS)
33483bf3b463Smrg	]
33493bf3b463Smrg)
33503bf3b463Smrg]) # XORG_CWARNFLAGS
3351a3129944Smrg
33523bf3b463Smrg# XORG_STRICT_OPTION
33533bf3b463Smrg# -----------------------
33543bf3b463Smrg# Minimum version: 1.3.0
3355a3129944Smrg#
33563bf3b463Smrg# Add configure option to enable strict compilation flags, such as treating
33573bf3b463Smrg# warnings as fatal errors.
33583bf3b463Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
33593bf3b463Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
33603bf3b463Smrg#
33613bf3b463Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
33623bf3b463Smrg# when strict compilation is unconditionally desired.
33633bf3b463SmrgAC_DEFUN([XORG_STRICT_OPTION], [
33643bf3b463SmrgAC_REQUIRE([XORG_CWARNFLAGS])
33653bf3b463SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3366a3129944Smrg
33673bf3b463SmrgAC_ARG_ENABLE(strict-compilation,
33683bf3b463Smrg			  AS_HELP_STRING([--enable-strict-compilation],
33693bf3b463Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
33703bf3b463Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3371a3129944Smrg
33723bf3b463SmrgAC_LANG_CASE(
33733bf3b463Smrg        [C], [
33743bf3b463Smrg                define([PREFIX], [C])
33753bf3b463Smrg        ],
33763bf3b463Smrg        [C++], [
33773bf3b463Smrg                define([PREFIX], [CXX])
33783bf3b463Smrg        ]
33793bf3b463Smrg)
3380a3129944Smrg
33813bf3b463Smrg[STRICT_]PREFIX[FLAGS]=""
33823bf3b463SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
33833bf3b463SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3384a3129944Smrg
33853bf3b463Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
33863bf3b463Smrg# activate it with -Werror, so we add it here explicitly.
33873bf3b463SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3388a3129944Smrg
33893bf3b463Smrgif test "x$STRICT_COMPILE" = "xyes"; then
33903bf3b463Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
33913bf3b463Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3392a3129944Smrgfi
33933bf3b463SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
33943bf3b463SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
33953bf3b463SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
33963bf3b463Smrg]) # XORG_STRICT_OPTION
3397a3129944Smrg
33983bf3b463Smrg# XORG_DEFAULT_NOCODE_OPTIONS
33993bf3b463Smrg# ---------------------------
34003bf3b463Smrg# Minimum version: 1.20.0
3401a3129944Smrg#
34023bf3b463Smrg# Defines default options for X.Org modules which don't compile code,
34033bf3b463Smrg# such as fonts, bitmaps, cursors, and docs.
3404a3129944Smrg#
34053bf3b463SmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
34063bf3b463SmrgAC_REQUIRE([AC_PROG_INSTALL])
34073bf3b463SmrgXORG_RELEASE_VERSION
34083bf3b463SmrgXORG_CHANGELOG
34093bf3b463SmrgXORG_INSTALL
34103bf3b463SmrgXORG_MANPAGE_SECTIONS
34113bf3b463Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
34123bf3b463Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
34133bf3b463Smrg]) # XORG_DEFAULT_NOCODE_OPTIONS
3414a3129944Smrg
34153bf3b463Smrg# XORG_DEFAULT_OPTIONS
34163bf3b463Smrg# --------------------
34173bf3b463Smrg# Minimum version: 1.3.0
34183bf3b463Smrg#
34193bf3b463Smrg# Defines default options for X.Org modules which compile code.
34203bf3b463Smrg#
34213bf3b463SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
34223bf3b463SmrgAC_REQUIRE([AC_PROG_INSTALL])
34233bf3b463SmrgXORG_COMPILER_FLAGS
34243bf3b463SmrgXORG_CWARNFLAGS
34253bf3b463SmrgXORG_STRICT_OPTION
34263bf3b463SmrgXORG_DEFAULT_NOCODE_OPTIONS
34273bf3b463Smrg]) # XORG_DEFAULT_OPTIONS
3428a3129944Smrg
34293bf3b463Smrg# XORG_INSTALL()
34303bf3b463Smrg# ----------------
34313bf3b463Smrg# Minimum version: 1.4.0
3432a3129944Smrg#
34333bf3b463Smrg# Defines the variable INSTALL_CMD as the command to copy
34343bf3b463Smrg# INSTALL from $prefix/share/util-macros.
34353bf3b463Smrg#
34363bf3b463SmrgAC_DEFUN([XORG_INSTALL], [
34373bf3b463SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
34383bf3b463Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
34393bf3b463SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
34403bf3b463Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
34413bf3b463Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
34423bf3b463Smrgtouch \$(top_srcdir)/INSTALL; \
34433bf3b463Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
34443bf3b463SmrgAC_SUBST([INSTALL_CMD])
34453bf3b463Smrg]) # XORG_INSTALL
34463bf3b463Smrgdnl Copyright 2005 Red Hat, Inc
34473bf3b463Smrgdnl
34483bf3b463Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
34493bf3b463Smrgdnl documentation for any purpose is hereby granted without fee, provided that
34503bf3b463Smrgdnl the above copyright notice appear in all copies and that both that
34513bf3b463Smrgdnl copyright notice and this permission notice appear in supporting
34523bf3b463Smrgdnl documentation.
34533bf3b463Smrgdnl
34543bf3b463Smrgdnl The above copyright notice and this permission notice shall be included
34553bf3b463Smrgdnl in all copies or substantial portions of the Software.
34563bf3b463Smrgdnl
34573bf3b463Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
34583bf3b463Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34593bf3b463Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
34603bf3b463Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
34613bf3b463Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
34623bf3b463Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
34633bf3b463Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
34643bf3b463Smrgdnl
34653bf3b463Smrgdnl Except as contained in this notice, the name of the copyright holders shall
34663bf3b463Smrgdnl not be used in advertising or otherwise to promote the sale, use or
34673bf3b463Smrgdnl other dealings in this Software without prior written authorization
34683bf3b463Smrgdnl from the copyright holders.
34693bf3b463Smrgdnl
3470a3129944Smrg
34713bf3b463Smrg# XORG_RELEASE_VERSION
34723bf3b463Smrg# --------------------
34733bf3b463Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3474a3129944Smrg
34753bf3b463SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
34763bf3b463Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
34773bf3b463Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
34783bf3b463Smrg		[Major version of this package])
34793bf3b463Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
34803bf3b463Smrg	if test "x$PVM" = "x"; then
34813bf3b463Smrg		PVM="0"
34823bf3b463Smrg	fi
34833bf3b463Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
34843bf3b463Smrg		[$PVM],
34853bf3b463Smrg		[Minor version of this package])
34863bf3b463Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
34873bf3b463Smrg	if test "x$PVP" = "x"; then
34883bf3b463Smrg		PVP="0"
34893bf3b463Smrg	fi
34903bf3b463Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
34913bf3b463Smrg		[$PVP],
34923bf3b463Smrg		[Patch version of this package])
34933bf3b463Smrg])
3494a3129944Smrg
34953bf3b463Smrg# XORG_CHANGELOG()
34963bf3b463Smrg# ----------------
34973bf3b463Smrg# Minimum version: 1.2.0
34983bf3b463Smrg#
34993bf3b463Smrg# Defines the variable CHANGELOG_CMD as the command to generate
35003bf3b463Smrg# ChangeLog from git.
35013bf3b463Smrg#
35023bf3b463Smrg#
35033bf3b463SmrgAC_DEFUN([XORG_CHANGELOG], [
35043bf3b463SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
35053bf3b463Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
35063bf3b463Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
35073bf3b463Smrgtouch \$(top_srcdir)/ChangeLog; \
35083bf3b463Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
35093bf3b463SmrgAC_SUBST([CHANGELOG_CMD])
35103bf3b463Smrg]) # XORG_CHANGELOG
35113bf3b463Smrg
35123bf3b463Smrgdnl
35133bf3b463Smrgdnl Copyright (c) 2005, Oracle and/or its affiliates.
35143bf3b463Smrgdnl
35153bf3b463Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
35163bf3b463Smrgdnl copy of this software and associated documentation files (the "Software"),
35173bf3b463Smrgdnl to deal in the Software without restriction, including without limitation
35183bf3b463Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
35193bf3b463Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
35203bf3b463Smrgdnl Software is furnished to do so, subject to the following conditions:
35213bf3b463Smrgdnl
35223bf3b463Smrgdnl The above copyright notice and this permission notice (including the next
35233bf3b463Smrgdnl paragraph) shall be included in all copies or substantial portions of the
35243bf3b463Smrgdnl Software.
35253bf3b463Smrgdnl
35263bf3b463Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35273bf3b463Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35283bf3b463Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
35293bf3b463Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35303bf3b463Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
35313bf3b463Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
35323bf3b463Smrgdnl DEALINGS IN THE SOFTWARE.
35333bf3b463Smrgdnl
3534698f425bSmrg
35353bf3b463Smrg# XTRANS_TCP_FLAGS()
35363bf3b463Smrg# ------------------
35373bf3b463Smrg# Find needed libraries for TCP sockets, and check for IPv6 support
35383bf3b463SmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
35393bf3b463Smrg # SVR4 hides these in libraries other than libc
35403bf3b463Smrg AC_SEARCH_LIBS(socket, [socket])
35413bf3b463Smrg AC_SEARCH_LIBS(gethostbyname, [nsl])
35423bf3b463Smrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
35433bf3b463Smrg   AC_CHECK_LIB([ws2_32],[main])
35443bf3b463Smrg fi
3545698f425bSmrg
35463bf3b463Smrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
35473bf3b463Smrg AC_ARG_ENABLE(ipv6,
35483bf3b463Smrg	AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
35493bf3b463Smrg	[IPV6CONN=$enableval],
35503bf3b463Smrg	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
35513bf3b463Smrg AC_MSG_CHECKING([if IPv6 support should be built])
35523bf3b463Smrg if test "$IPV6CONN" = "yes"; then
35533bf3b463Smrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
35543bf3b463Smrg fi
35553bf3b463Smrg AC_MSG_RESULT($IPV6CONN)
3556698f425bSmrg
35573bf3b463Smrg # 4.3BSD-Reno added a new member to struct sockaddr_in
35583bf3b463Smrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
35593bf3b463Smrg	AC_DEFINE([BSD44SOCKETS],1,
35603bf3b463Smrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
35613bf3b463Smrg#include <sys/types.h>
35623bf3b463Smrg#include <sys/socket.h>
35633bf3b463Smrg#include <netinet/in.h>
35643bf3b463Smrg ])
3565698f425bSmrg
35663bf3b463Smrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
35673bf3b463Smrg AC_CHECK_TYPES([socklen_t], [], [], [
35683bf3b463SmrgAC_INCLUDES_DEFAULT
35693bf3b463Smrg#include <sys/socket.h>])
3570fb5e8d76Smrg
35713bf3b463Smrg # XPG4v2/UNIX95 added msg_control - check to see if we need to define
35723bf3b463Smrg # _XOPEN_SOURCE to get it (such as on Solaris)
35733bf3b463Smrg AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
35743bf3b463Smrg                 [
35753bf3b463SmrgAC_INCLUDES_DEFAULT
35763bf3b463Smrg#include <sys/socket.h>
35773bf3b463Smrg                 ])
35783bf3b463Smrg # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
35793bf3b463Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
35803bf3b463Smrg     unset ac_cv_member_struct_msghdr_msg_control
35813bf3b463Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
35823bf3b463Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
35833bf3b463Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [600],
35843bf3b463Smrg                       [Defined if needed to expose struct msghdr.msg_control])
35853bf3b463Smrg                     ], [], [
35863bf3b463Smrg#define _XOPEN_SOURCE 600
35873bf3b463SmrgAC_INCLUDES_DEFAULT
35883bf3b463Smrg#include <sys/socket.h>
35893bf3b463Smrg                     ])
35903bf3b463Smrg fi
35913bf3b463Smrg # If that didn't work, fall back to XPG5/UNIX98 with C89
35923bf3b463Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
35933bf3b463Smrg     unset ac_cv_member_struct_msghdr_msg_control
35943bf3b463Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
35953bf3b463Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
35963bf3b463Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [500],
35973bf3b463Smrg                       [Defined if needed to expose struct msghdr.msg_control])
35983bf3b463Smrg                     ], [], [
35993bf3b463Smrg#define _XOPEN_SOURCE 500
36003bf3b463SmrgAC_INCLUDES_DEFAULT
36013bf3b463Smrg#include <sys/socket.h>
36023bf3b463Smrg                     ])
36033bf3b463Smrg fi
3604fb5e8d76Smrg
3605698f425bSmrg
36063bf3b463Smrg]) # XTRANS_TCP_FLAGS
3607698f425bSmrg
36083bf3b463Smrg# XTRANS_CONNECTION_FLAGS()
36093bf3b463Smrg# -------------------------
36103bf3b463Smrg# Standard checks for which Xtrans transports to use by the Xorg packages
36113bf3b463Smrg# that use Xtrans functions
36123bf3b463SmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
36133bf3b463Smrg AC_REQUIRE([AC_CANONICAL_HOST])
36143bf3b463Smrg [case $host_os in
36153bf3b463Smrg	mingw*)	unixdef="no"   ;;
36163bf3b463Smrg	*)	unixdef="yes"  ;;
36173bf3b463Smrg esac]
36183bf3b463Smrg AC_ARG_ENABLE(unix-transport,
36193bf3b463Smrg	AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
36203bf3b463Smrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
36213bf3b463Smrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
36223bf3b463Smrg if test "$UNIXCONN" = "yes"; then
36233bf3b463Smrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
36243bf3b463Smrg fi
36253bf3b463Smrg AC_MSG_RESULT($UNIXCONN)
36263bf3b463Smrg AC_ARG_ENABLE(tcp-transport,
36273bf3b463Smrg	AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
36283bf3b463Smrg	[TCPCONN=$enableval], [TCPCONN=yes])
36293bf3b463Smrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
36303bf3b463Smrg AC_MSG_RESULT($TCPCONN)
36313bf3b463Smrg if test "$TCPCONN" = "yes"; then
36323bf3b463Smrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
36333bf3b463Smrg	XTRANS_TCP_FLAGS
36343bf3b463Smrg fi
36353bf3b463Smrg [case $host_os in
36363bf3b463Smrg	solaris*)		localdef="yes" ;;
36373bf3b463Smrg	*)			localdef="no"  ;;
36383bf3b463Smrg esac]
36393bf3b463Smrg AC_ARG_ENABLE(local-transport,
36403bf3b463Smrg	AS_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
36413bf3b463Smrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
36423bf3b463Smrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
36433bf3b463Smrg AC_MSG_RESULT($LOCALCONN)
36443bf3b463Smrg if test "$LOCALCONN" = "yes"; then
36453bf3b463Smrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
36463bf3b463Smrg fi
3647698f425bSmrg
36483bf3b463Smrg # Other functions Xtrans may need
36493bf3b463Smrg AC_CHECK_FUNCS([strcasecmp strlcpy])
3650698f425bSmrg
36513bf3b463Smrg]) # XTRANS_CONNECTION_FLAGS
3652698f425bSmrg
3653a3129944Smrg
36543bf3b463Smrg# XTRANS_SECURE_RPC_FLAGS()
36553bf3b463Smrg# -------------------------
36563bf3b463Smrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
36573bf3b463Smrg# so that any necessary networking libraries are already found
36583bf3b463SmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
36593bf3b463Smrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
36603bf3b463Smrg AC_ARG_ENABLE(secure-rpc,
36613bf3b463Smrg	AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
36623bf3b463Smrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
3663a3129944Smrg
36643bf3b463Smrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
36653bf3b463Smrg	FOUND_SECURE_RPC="no"
36663bf3b463Smrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
36673bf3b463Smrg			[FOUND_SECURE_RPC="yes"])
36683bf3b463Smrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
36693bf3b463Smrg		if test "x$SECURE_RPC" = "xyes" ; then
36703bf3b463Smrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
36713bf3b463Smrg		fi
36723bf3b463Smrg		SECURE_RPC="no"
36733bf3b463Smrg	else
36743bf3b463Smrg		dnl FreeBSD keeps getsecretkey in librpcsvc
36753bf3b463Smrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
36763bf3b463Smrg		SECURE_RPC="yes"
36773bf3b463Smrg	fi
36783bf3b463Smrg fi
36793bf3b463Smrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
36803bf3b463Smrg if test "x$SECURE_RPC" = "xyes" ; then
36813bf3b463Smrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
36823bf3b463Smrg fi
36833bf3b463Smrg AC_MSG_RESULT($SECURE_RPC)
36843bf3b463Smrg]) # XTRANS_SECURE_RPC_FLAGS
3685698f425bSmrg
3686698f425bSmrg
36873bf3b463Smrgm4_include([m4/libtool.m4])
36883bf3b463Smrgm4_include([m4/ltoptions.m4])
36893bf3b463Smrgm4_include([m4/ltsugar.m4])
36903bf3b463Smrgm4_include([m4/ltversion.m4])
36913bf3b463Smrgm4_include([m4/lt~obsolete.m4])
3692