aclocal.m4 revision 6bea0e4f
16bea0e4fSmrg# generated automatically by aclocal 1.17 -*- Autoconf -*-
20a6b08f8Smrg
36bea0e4fSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
4126a8a12Smrg
5126a8a12Smrg# This file is free software; the Free Software Foundation
6126a8a12Smrg# gives unlimited permission to copy and/or distribute it,
7126a8a12Smrg# with or without modifications, as long as this notice is preserved.
8126a8a12Smrg
9126a8a12Smrg# This program is distributed in the hope that it will be useful,
10126a8a12Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11126a8a12Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12126a8a12Smrg# PARTICULAR PURPOSE.
13126a8a12Smrg
140a6b08f8Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15d656433aSmrgm4_ifndef([AC_AUTOCONF_VERSION],
16d656433aSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
176bea0e4fSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
186bea0e4fSmrg[m4_warning([this file was generated for autoconf 2.72.
19d656433aSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20d656433aSmrgIf you have problems, you may need to regenerate the build system entirely.
210a6b08f8SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22126a8a12Smrg
236bea0e4fSmrg# Copyright (C) 2002-2024 Free Software Foundation, Inc.
24300346aeSmrg#
253fb97780Smrg# This file is free software; the Free Software Foundation
263fb97780Smrg# gives unlimited permission to copy and/or distribute it,
273fb97780Smrg# with or without modifications, as long as this notice is preserved.
28555991fdSmrg
293fb97780Smrg# AM_AUTOMAKE_VERSION(VERSION)
303fb97780Smrg# ----------------------------
313fb97780Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
323fb97780Smrg# generated from the m4 files accompanying Automake X.Y.
333fb97780Smrg# (This private macro should not be called outside this file.)
343fb97780SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
356bea0e4fSmrg[am__api_version='1.17'
363fb97780Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
373fb97780Smrgdnl require some minimum version.  Point them to the right macro.
386bea0e4fSmrgm4_if([$1], [1.17], [],
393fb97780Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40300346aeSmrg])
41555991fdSmrg
423fb97780Smrg# _AM_AUTOCONF_VERSION(VERSION)
433fb97780Smrg# -----------------------------
443fb97780Smrg# aclocal traces this macro to find the Autoconf version.
453fb97780Smrg# This is a private macro too.  Using m4_define simplifies
463fb97780Smrg# the logic in aclocal, which can simply ignore this definition.
473fb97780Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48555991fdSmrg
493fb97780Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
503fb97780Smrg# -------------------------------
513fb97780Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
523fb97780Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
533fb97780SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
546bea0e4fSmrg[AM_AUTOMAKE_VERSION([1.17])dnl
553fb97780Smrgm4_ifndef([AC_AUTOCONF_VERSION],
563fb97780Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
573fb97780Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58555991fdSmrg
593fb97780Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60d656433aSmrg
616bea0e4fSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
623fb97780Smrg#
633fb97780Smrg# This file is free software; the Free Software Foundation
643fb97780Smrg# gives unlimited permission to copy and/or distribute it,
653fb97780Smrg# with or without modifications, as long as this notice is preserved.
66126a8a12Smrg
673fb97780Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
683fb97780Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
693fb97780Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
703fb97780Smrg#
713fb97780Smrg# Of course, Automake must honor this variable whenever it calls a
723fb97780Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
733fb97780Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
743fb97780Smrg# depending on how configure is run.  This is pretty annoying, since
753fb97780Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
763fb97780Smrg# source directory, any form will work fine, but in subdirectories a
773fb97780Smrg# relative path needs to be adjusted first.
783fb97780Smrg#
793fb97780Smrg# $ac_aux_dir/missing
803fb97780Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
813fb97780Smrg# $top_srcdir/$ac_aux_dir/missing
823fb97780Smrg#    fails if $ac_aux_dir is absolute,
833fb97780Smrg#    fails when called from a subdirectory in a VPATH build with
843fb97780Smrg#          a relative $ac_aux_dir
853fb97780Smrg#
863fb97780Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
873fb97780Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
883fb97780Smrg# harmless because $srcdir is '.', but things will broke when you
893fb97780Smrg# start a VPATH build or use an absolute $srcdir.
903fb97780Smrg#
913fb97780Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
923fb97780Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
933fb97780Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
943fb97780Smrg# and then we would define $MISSING as
953fb97780Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
963fb97780Smrg# This will work as long as MISSING is not called from configure, because
973fb97780Smrg# unfortunately $(top_srcdir) has no meaning in configure.
983fb97780Smrg# However there are other variables, like CC, which are often used in
993fb97780Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
1003fb97780Smrg#
1013fb97780Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
1023fb97780Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
1033fb97780Smrg# configured tree to be moved without reconfiguration.
1043fb97780Smrg
1053fb97780SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1063fb97780Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
1073fb97780Smrg# Expand $ac_aux_dir to an absolute path.
1083fb97780Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109d656433aSmrg])
110d656433aSmrg
1113fb97780Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112d656433aSmrg
1136bea0e4fSmrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
1143fb97780Smrg#
1153fb97780Smrg# This file is free software; the Free Software Foundation
1163fb97780Smrg# gives unlimited permission to copy and/or distribute it,
1173fb97780Smrg# with or without modifications, as long as this notice is preserved.
118126a8a12Smrg
1193fb97780Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1203fb97780Smrg# -------------------------------------
1213fb97780Smrg# Define a conditional.
1223fb97780SmrgAC_DEFUN([AM_CONDITIONAL],
1233fb97780Smrg[AC_PREREQ([2.52])dnl
1243fb97780Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1253fb97780Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1263fb97780SmrgAC_SUBST([$1_TRUE])dnl
1273fb97780SmrgAC_SUBST([$1_FALSE])dnl
1283fb97780Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1293fb97780Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1303fb97780Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1313fb97780Smrgif $2; then
1323fb97780Smrg  $1_TRUE=
1333fb97780Smrg  $1_FALSE='#'
1343fb97780Smrgelse
1353fb97780Smrg  $1_TRUE='#'
1363fb97780Smrg  $1_FALSE=
1373fb97780Smrgfi
1383fb97780SmrgAC_CONFIG_COMMANDS_PRE(
1393fb97780Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1403fb97780Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1413fb97780SmrgUsually this means the macro was only invoked conditionally.]])
1423fb97780Smrgfi])])
143126a8a12Smrg
1446bea0e4fSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
1453fb97780Smrg#
1463fb97780Smrg# This file is free software; the Free Software Foundation
1473fb97780Smrg# gives unlimited permission to copy and/or distribute it,
1483fb97780Smrg# with or without modifications, as long as this notice is preserved.
149d656433aSmrg
150d656433aSmrg
1513fb97780Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
1523fb97780Smrg# written in clear, in which case automake, when reading aclocal.m4,
1533fb97780Smrg# will think it sees a *use*, and therefore will trigger all it's
1543fb97780Smrg# C support machinery.  Also note that it means that autoscan, seeing
1553fb97780Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156d656433aSmrg
157d656433aSmrg
1583fb97780Smrg# _AM_DEPENDENCIES(NAME)
1593fb97780Smrg# ----------------------
1603fb97780Smrg# See how the compiler implements dependency checking.
1613fb97780Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
1623fb97780Smrg# We try a few techniques and use that to set a single cache variable.
1633fb97780Smrg#
1643fb97780Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1653fb97780Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1663fb97780Smrg# dependency, and given that the user is not expected to run this macro,
1673fb97780Smrg# just rely on AC_PROG_CC.
1683fb97780SmrgAC_DEFUN([_AM_DEPENDENCIES],
1693fb97780Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
1703fb97780SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1713fb97780SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
1723fb97780SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173d656433aSmrg
1743fb97780Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1753fb97780Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1763fb97780Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1773fb97780Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1783fb97780Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1793fb97780Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1803fb97780Smrg                    [depcc="$$1"   am_compiler_list=])
181d656433aSmrg
1823fb97780SmrgAC_CACHE_CHECK([dependency style of $depcc],
1833fb97780Smrg               [am_cv_$1_dependencies_compiler_type],
1843fb97780Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1853fb97780Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
1863fb97780Smrg  # making bogus files that we don't know about and never remove.  For
1873fb97780Smrg  # instance it was reported that on HP-UX the gcc test will end up
1883fb97780Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1893fb97780Smrg  # in D".
1903fb97780Smrg  rm -rf conftest.dir
1913fb97780Smrg  mkdir conftest.dir
1923fb97780Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
1933fb97780Smrg  # using a relative directory.
1943fb97780Smrg  cp "$am_depcomp" conftest.dir
1953fb97780Smrg  cd conftest.dir
1963fb97780Smrg  # We will build objects and dependencies in a subdirectory because
1973fb97780Smrg  # it helps to detect inapplicable dependency modes.  For instance
1983fb97780Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
1993fb97780Smrg  # side effect of compilation, but ICC will put the dependencies in
2003fb97780Smrg  # the current directory while Tru64 will put them in the object
2013fb97780Smrg  # directory.
2023fb97780Smrg  mkdir sub
203126a8a12Smrg
2043fb97780Smrg  am_cv_$1_dependencies_compiler_type=none
2053fb97780Smrg  if test "$am_compiler_list" = ""; then
2063fb97780Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2073fb97780Smrg  fi
2083fb97780Smrg  am__universal=false
2093fb97780Smrg  m4_case([$1], [CC],
2103fb97780Smrg    [case " $depcc " in #(
2113fb97780Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2123fb97780Smrg     esac],
2133fb97780Smrg    [CXX],
2143fb97780Smrg    [case " $depcc " in #(
2153fb97780Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2163fb97780Smrg     esac])
217126a8a12Smrg
2183fb97780Smrg  for depmode in $am_compiler_list; do
2193fb97780Smrg    # Setup a source with many dependencies, because some compilers
2203fb97780Smrg    # like to wrap large dependency lists on column 80 (with \), and
2213fb97780Smrg    # we should not choose a depcomp mode which is confused by this.
2223fb97780Smrg    #
2233fb97780Smrg    # We need to recreate these files for each test, as the compiler may
2243fb97780Smrg    # overwrite some of them when testing with obscure command lines.
2253fb97780Smrg    # This happens at least with the AIX C compiler.
2263fb97780Smrg    : > sub/conftest.c
2273fb97780Smrg    for i in 1 2 3 4 5 6; do
2283fb97780Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2293fb97780Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2303fb97780Smrg      # Solaris 10 /bin/sh.
2313fb97780Smrg      echo '/* dummy */' > sub/conftst$i.h
232555991fdSmrg    done
2333fb97780Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234126a8a12Smrg
2353fb97780Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2363fb97780Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2373fb97780Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2383fb97780Smrg    # versions had trouble with output in subdirs.
2393fb97780Smrg    am__obj=sub/conftest.${OBJEXT-o}
2403fb97780Smrg    am__minus_obj="-o $am__obj"
2413fb97780Smrg    case $depmode in
2423fb97780Smrg    gcc)
2433fb97780Smrg      # This depmode causes a compiler race in universal mode.
2443fb97780Smrg      test "$am__universal" = false || continue
2453fb97780Smrg      ;;
2463fb97780Smrg    nosideeffect)
2473fb97780Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2483fb97780Smrg      # only be used when explicitly requested.
2493fb97780Smrg      if test "x$enable_dependency_tracking" = xyes; then
2503fb97780Smrg	continue
2513fb97780Smrg      else
2523fb97780Smrg	break
2533fb97780Smrg      fi
2543fb97780Smrg      ;;
2553fb97780Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2563fb97780Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2573fb97780Smrg      # not run yet.  These depmodes are late enough in the game, and
2583fb97780Smrg      # so weak that their functioning should not be impacted.
2593fb97780Smrg      am__obj=conftest.${OBJEXT-o}
2603fb97780Smrg      am__minus_obj=
2613fb97780Smrg      ;;
2623fb97780Smrg    none) break ;;
2633fb97780Smrg    esac
2643fb97780Smrg    if depmode=$depmode \
2653fb97780Smrg       source=sub/conftest.c object=$am__obj \
2663fb97780Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2673fb97780Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
2683fb97780Smrg         >/dev/null 2>conftest.err &&
2693fb97780Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
2703fb97780Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2713fb97780Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
2723fb97780Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2733fb97780Smrg      # icc doesn't choke on unknown options, it will just issue warnings
2743fb97780Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2753fb97780Smrg      # that says an option was ignored or not supported.
2766bea0e4fSmrg      # When given -MP, icc 7.0 and 7.1 complain thus:
2773fb97780Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2783fb97780Smrg      # The diagnosis changed in icc 8.0:
2793fb97780Smrg      #   icc: Command line remark: option '-MP' not supported
2803fb97780Smrg      if (grep 'ignoring option' conftest.err ||
2813fb97780Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2823fb97780Smrg        am_cv_$1_dependencies_compiler_type=$depmode
2833fb97780Smrg        break
2843fb97780Smrg      fi
2853fb97780Smrg    fi
2863fb97780Smrg  done
287126a8a12Smrg
2883fb97780Smrg  cd ..
2893fb97780Smrg  rm -rf conftest.dir
2903fb97780Smrgelse
2913fb97780Smrg  am_cv_$1_dependencies_compiler_type=none
2923fb97780Smrgfi
2933fb97780Smrg])
2943fb97780SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2953fb97780SmrgAM_CONDITIONAL([am__fastdep$1], [
2963fb97780Smrg  test "x$enable_dependency_tracking" != xno \
2973fb97780Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298555991fdSmrg])
299126a8a12Smrg
300126a8a12Smrg
3013fb97780Smrg# AM_SET_DEPDIR
3023fb97780Smrg# -------------
3033fb97780Smrg# Choose a directory name for dependency files.
3043fb97780Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
3053fb97780SmrgAC_DEFUN([AM_SET_DEPDIR],
3063fb97780Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
3073fb97780SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
3083fb97780Smrg])
309300346aeSmrg
310300346aeSmrg
3113fb97780Smrg# AM_DEP_TRACK
3123fb97780Smrg# ------------
3133fb97780SmrgAC_DEFUN([AM_DEP_TRACK],
3143fb97780Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3153fb97780SmrgAS_HELP_STRING(
3163fb97780Smrg  [--enable-dependency-tracking],
3173fb97780Smrg  [do not reject slow dependency extractors])
3183fb97780SmrgAS_HELP_STRING(
3193fb97780Smrg  [--disable-dependency-tracking],
3203fb97780Smrg  [speeds up one-time build])])
3213fb97780Smrgif test "x$enable_dependency_tracking" != xno; then
3223fb97780Smrg  am_depcomp="$ac_aux_dir/depcomp"
3233fb97780Smrg  AMDEPBACKSLASH='\'
3243fb97780Smrg  am__nodep='_no'
325555991fdSmrgfi
3263fb97780SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3273fb97780SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3283fb97780Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3293fb97780SmrgAC_SUBST([am__nodep])dnl
3303fb97780Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331555991fdSmrg])
332126a8a12Smrg
3333fb97780Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334126a8a12Smrg
3356bea0e4fSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
3363fb97780Smrg#
3373fb97780Smrg# This file is free software; the Free Software Foundation
3383fb97780Smrg# gives unlimited permission to copy and/or distribute it,
3393fb97780Smrg# with or without modifications, as long as this notice is preserved.
340126a8a12Smrg
3413fb97780Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
3423fb97780Smrg# ------------------------------
3433fb97780SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3443fb97780Smrg[{
3453fb97780Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3463fb97780Smrg  # are listed without --file.  Let's play safe and only enable the eval
3473fb97780Smrg  # if we detect the quoting.
3483fb97780Smrg  # TODO: see whether this extra hack can be removed once we start
3493fb97780Smrg  # requiring Autoconf 2.70 or later.
3503fb97780Smrg  AS_CASE([$CONFIG_FILES],
3513fb97780Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
3523fb97780Smrg          [*], [set x $CONFIG_FILES])
3533fb97780Smrg  shift
3543fb97780Smrg  # Used to flag and report bootstrapping failures.
3553fb97780Smrg  am_rc=0
3563fb97780Smrg  for am_mf
3573fb97780Smrg  do
3583fb97780Smrg    # Strip MF so we end up with the name of the file.
3593fb97780Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
3603fb97780Smrg    # Check whether this is an Automake generated Makefile which includes
3613fb97780Smrg    # dependency-tracking related rules and includes.
3623fb97780Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
3633fb97780Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3643fb97780Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
3653fb97780Smrg      || continue
3663fb97780Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
3673fb97780Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
3683fb97780Smrg    AM_RUN_LOG([cd "$am_dirpart" \
3693fb97780Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
3703fb97780Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
3713fb97780Smrg  done
3723fb97780Smrg  if test $am_rc -ne 0; then
3733fb97780Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
3743fb97780Smrg    for automatic dependency tracking.  If GNU make was not used, consider
3753fb97780Smrg    re-running the configure script with MAKE="gmake" (or whatever is
3763fb97780Smrg    necessary).  You can also try re-running configure with the
3773fb97780Smrg    '--disable-dependency-tracking' option to at least be able to build
3783fb97780Smrg    the package (albeit without support for automatic dependency tracking).])
379300346aeSmrg  fi
3803fb97780Smrg  AS_UNSET([am_dirpart])
3813fb97780Smrg  AS_UNSET([am_filepart])
3823fb97780Smrg  AS_UNSET([am_mf])
3833fb97780Smrg  AS_UNSET([am_rc])
3843fb97780Smrg  rm -f conftest-deps.mk
3853fb97780Smrg}
3863fb97780Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387d656433aSmrg
388126a8a12Smrg
3893fb97780Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
3903fb97780Smrg# -----------------------------
3913fb97780Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
3923fb97780Smrg#
3933fb97780Smrg# This code is only required when automatic dependency tracking is enabled.
3943fb97780Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
3953fb97780Smrg# order to bootstrap the dependency handling code.
3963fb97780SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
3973fb97780Smrg[AC_CONFIG_COMMANDS([depfiles],
3983fb97780Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
3993fb97780Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400d656433aSmrg
4013fb97780Smrg# Do all the work for Automake.                             -*- Autoconf -*-
402d656433aSmrg
4036bea0e4fSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
4043fb97780Smrg#
4053fb97780Smrg# This file is free software; the Free Software Foundation
4063fb97780Smrg# gives unlimited permission to copy and/or distribute it,
4073fb97780Smrg# with or without modifications, as long as this notice is preserved.
408126a8a12Smrg
4093fb97780Smrg# This macro actually does too much.  Some checks are only needed if
4103fb97780Smrg# your package does certain things.  But this isn't really a big deal.
4110a6b08f8Smrg
4123fb97780Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4133fb97780Smrgm4_define([AC_PROG_CC],
4143fb97780Smrgm4_defn([AC_PROG_CC])
4153fb97780Smrg[_AM_PROG_CC_C_O
4163fb97780Smrg])
417126a8a12Smrg
4183fb97780Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4193fb97780Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4203fb97780Smrg# -----------------------------------------------
4213fb97780Smrg# The call with PACKAGE and VERSION arguments is the old style
4223fb97780Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4233fb97780Smrg# and VERSION should now be passed to AC_INIT and removed from
4243fb97780Smrg# the call to AM_INIT_AUTOMAKE.
4253fb97780Smrg# We support both call styles for the transition.  After
4263fb97780Smrg# the next Automake release, Autoconf can make the AC_INIT
4273fb97780Smrg# arguments mandatory, and then we can depend on a new Autoconf
4283fb97780Smrg# release and drop the old call support.
4293fb97780SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4303fb97780Smrg[AC_PREREQ([2.65])dnl
4313fb97780Smrgm4_ifdef([_$0_ALREADY_INIT],
4323fb97780Smrg  [m4_fatal([$0 expanded multiple times
4333fb97780Smrg]m4_defn([_$0_ALREADY_INIT]))],
4343fb97780Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
4353fb97780Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4363fb97780Smrgdnl the ones we care about.
4373fb97780Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4383fb97780SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4393fb97780SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4403fb97780Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4413fb97780Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4423fb97780Smrg  # is not polluted with repeated "-I."
4433fb97780Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4443fb97780Smrg  # test to see if srcdir already configured
4453fb97780Smrg  if test -f $srcdir/config.status; then
4463fb97780Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4473fb97780Smrg  fi
4483fb97780Smrgfi
449126a8a12Smrg
4503fb97780Smrg# test whether we have cygpath
4513fb97780Smrgif test -z "$CYGPATH_W"; then
4523fb97780Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4533fb97780Smrg    CYGPATH_W='cygpath -w'
4543fb97780Smrg  else
4553fb97780Smrg    CYGPATH_W=echo
4563fb97780Smrg  fi
4573fb97780Smrgfi
4583fb97780SmrgAC_SUBST([CYGPATH_W])
4590a6b08f8Smrg
4603fb97780Smrg# Define the identity of the package.
4613fb97780Smrgdnl Distinguish between old-style and new-style calls.
4623fb97780Smrgm4_ifval([$2],
4633fb97780Smrg[AC_DIAGNOSE([obsolete],
4643fb97780Smrg             [$0: two- and three-arguments forms are deprecated.])
4653fb97780Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4663fb97780Smrg AC_SUBST([PACKAGE], [$1])dnl
4673fb97780Smrg AC_SUBST([VERSION], [$2])],
4683fb97780Smrg[_AM_SET_OPTIONS([$1])dnl
4693fb97780Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4703fb97780Smrgm4_if(
4713fb97780Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
4723fb97780Smrg  [ok:ok],,
4733fb97780Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4743fb97780Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4753fb97780Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4760a6b08f8Smrg
4773fb97780Smrg_AM_IF_OPTION([no-define],,
4783fb97780Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4793fb97780Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4800a6b08f8Smrg
4813fb97780Smrg# Some tools Automake needs.
4823fb97780SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4833fb97780SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4843fb97780SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4853fb97780SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4863fb97780SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4873fb97780SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4883fb97780SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4893fb97780SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4903fb97780SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4913fb97780SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4923fb97780Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4933fb97780Smrg# dies out for good.  For more background, see:
4943fb97780Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
4953fb97780Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
4963fb97780SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
4973fb97780Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
4983fb97780Smrg# system "awk" is bad on some platforms.
4993fb97780SmrgAC_REQUIRE([AC_PROG_AWK])dnl
5003fb97780SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5013fb97780SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5023fb97780Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5033fb97780Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5043fb97780Smrg			     [_AM_PROG_TAR([v7])])])
5053fb97780Smrg_AM_IF_OPTION([no-dependencies],,
5063fb97780Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5073fb97780Smrg		  [_AM_DEPENDENCIES([CC])],
5083fb97780Smrg		  [m4_define([AC_PROG_CC],
5093fb97780Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5103fb97780SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5113fb97780Smrg		  [_AM_DEPENDENCIES([CXX])],
5123fb97780Smrg		  [m4_define([AC_PROG_CXX],
5133fb97780Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5143fb97780SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5153fb97780Smrg		  [_AM_DEPENDENCIES([OBJC])],
5163fb97780Smrg		  [m4_define([AC_PROG_OBJC],
5173fb97780Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5183fb97780SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5193fb97780Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5203fb97780Smrg		  [m4_define([AC_PROG_OBJCXX],
5213fb97780Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522300346aeSmrg])
5233fb97780Smrg# Variables for tags utilities; see am/tags.am
5243fb97780Smrgif test -z "$CTAGS"; then
5253fb97780Smrg  CTAGS=ctags
5263fb97780Smrgfi
5273fb97780SmrgAC_SUBST([CTAGS])
5283fb97780Smrgif test -z "$ETAGS"; then
5293fb97780Smrg  ETAGS=etags
5303fb97780Smrgfi
5313fb97780SmrgAC_SUBST([ETAGS])
5323fb97780Smrgif test -z "$CSCOPE"; then
5333fb97780Smrg  CSCOPE=cscope
5343fb97780Smrgfi
5353fb97780SmrgAC_SUBST([CSCOPE])
5360a6b08f8Smrg
5376bea0e4fSmrgAC_REQUIRE([_AM_SILENT_RULES])dnl
5383fb97780Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5393fb97780Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5403fb97780Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5413fb97780SmrgAC_CONFIG_COMMANDS_PRE(dnl
5423fb97780Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5433fb97780Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544126a8a12Smrg
5456bea0e4fSmrgAC_REQUIRE([_AM_PROG_RM_F])
5466bea0e4fSmrgAC_REQUIRE([_AM_PROG_XARGS_N])
547126a8a12Smrg
5483fb97780Smrgdnl The trailing newline in this macro's definition is deliberate, for
5493fb97780Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
5503fb97780Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
551555991fdSmrg])
552d656433aSmrg
5533fb97780Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5543fb97780Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5553fb97780Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5563fb97780Smrgm4_define([_AC_COMPILER_EXEEXT],
5573fb97780Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
558d656433aSmrg
5593fb97780Smrg# When config.status generates a header, we must update the stamp-h file.
5603fb97780Smrg# This file resides in the same directory as the config header
5613fb97780Smrg# that is generated.  The stamp files are numbered to have different names.
562300346aeSmrg
5633fb97780Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5643fb97780Smrg# loop where config.status creates the headers, so we can generate
5653fb97780Smrg# our stamp files there.
5663fb97780SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5673fb97780Smrg[# Compute $1's index in $config_headers.
5683fb97780Smrg_am_arg=$1
5693fb97780Smrg_am_stamp_count=1
5703fb97780Smrgfor _am_header in $config_headers :; do
5713fb97780Smrg  case $_am_header in
5723fb97780Smrg    $_am_arg | $_am_arg:* )
5733fb97780Smrg      break ;;
5743fb97780Smrg    * )
5753fb97780Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
5763fb97780Smrg  esac
5773fb97780Smrgdone
5783fb97780Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
579300346aeSmrg
5806bea0e4fSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
5813fb97780Smrg#
5823fb97780Smrg# This file is free software; the Free Software Foundation
5833fb97780Smrg# gives unlimited permission to copy and/or distribute it,
5843fb97780Smrg# with or without modifications, as long as this notice is preserved.
585300346aeSmrg
5863fb97780Smrg# AM_PROG_INSTALL_SH
5873fb97780Smrg# ------------------
5883fb97780Smrg# Define $install_sh.
5893fb97780SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
5903fb97780Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5913fb97780Smrgif test x"${install_sh+set}" != xset; then
5923fb97780Smrg  case $am_aux_dir in
5933fb97780Smrg  *\ * | *\	*)
5943fb97780Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
5953fb97780Smrg  *)
5963fb97780Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
5973fb97780Smrg  esac
5983fb97780Smrgfi
5993fb97780SmrgAC_SUBST([install_sh])])
600d656433aSmrg
6016bea0e4fSmrg# Copyright (C) 2003-2024 Free Software Foundation, Inc.
6023fb97780Smrg#
6033fb97780Smrg# This file is free software; the Free Software Foundation
6043fb97780Smrg# gives unlimited permission to copy and/or distribute it,
6053fb97780Smrg# with or without modifications, as long as this notice is preserved.
606126a8a12Smrg
6073fb97780Smrg# Check whether the underlying file-system supports filenames
6083fb97780Smrg# with a leading dot.  For instance MS-DOS doesn't.
6093fb97780SmrgAC_DEFUN([AM_SET_LEADING_DOT],
6103fb97780Smrg[rm -rf .tst 2>/dev/null
6113fb97780Smrgmkdir .tst 2>/dev/null
6123fb97780Smrgif test -d .tst; then
6133fb97780Smrg  am__leading_dot=.
6143fb97780Smrgelse
6153fb97780Smrg  am__leading_dot=_
6163fb97780Smrgfi
6173fb97780Smrgrmdir .tst 2>/dev/null
6183fb97780SmrgAC_SUBST([am__leading_dot])])
619d656433aSmrg
6203fb97780Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
621126a8a12Smrg
6226bea0e4fSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
6233fb97780Smrg#
6243fb97780Smrg# This file is free software; the Free Software Foundation
6253fb97780Smrg# gives unlimited permission to copy and/or distribute it,
6263fb97780Smrg# with or without modifications, as long as this notice is preserved.
627126a8a12Smrg
6283fb97780Smrg# AM_MAKE_INCLUDE()
6293fb97780Smrg# -----------------
6303fb97780Smrg# Check whether make has an 'include' directive that can support all
6313fb97780Smrg# the idioms we need for our automatic dependency tracking code.
6323fb97780SmrgAC_DEFUN([AM_MAKE_INCLUDE],
6333fb97780Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
6343fb97780Smrgcat > confinc.mk << 'END'
6353fb97780Smrgam__doit:
6363fb97780Smrg	@echo this is the am__doit target >confinc.out
6373fb97780Smrg.PHONY: am__doit
6383fb97780SmrgEND
6393fb97780Smrgam__include="#"
6403fb97780Smrgam__quote=
6413fb97780Smrg# BSD make does it like this.
6423fb97780Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
6433fb97780Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
6443fb97780Smrgecho 'include confinc.mk # ignored' > confmf.GNU
6453fb97780Smrg_am_result=no
6463fb97780Smrgfor s in GNU BSD; do
6473fb97780Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
6483fb97780Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
6493fb97780Smrg      ['0:this is the am__doit target'],
6503fb97780Smrg      [AS_CASE([$s],
6513fb97780Smrg          [BSD], [am__include='.include' am__quote='"'],
6523fb97780Smrg          [am__include='include' am__quote=''])])
6533fb97780Smrg  if test "$am__include" != "#"; then
6543fb97780Smrg    _am_result="yes ($s style)"
6553fb97780Smrg    break
6563fb97780Smrg  fi
6573fb97780Smrgdone
6583fb97780Smrgrm -f confinc.* confmf.*
6593fb97780SmrgAC_MSG_RESULT([${_am_result}])
6603fb97780SmrgAC_SUBST([am__include])])
6613fb97780SmrgAC_SUBST([am__quote])])
662126a8a12Smrg
6633fb97780Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
664126a8a12Smrg
6656bea0e4fSmrg# Copyright (C) 1997-2024 Free Software Foundation, Inc.
6663fb97780Smrg#
6673fb97780Smrg# This file is free software; the Free Software Foundation
6683fb97780Smrg# gives unlimited permission to copy and/or distribute it,
6693fb97780Smrg# with or without modifications, as long as this notice is preserved.
6700a6b08f8Smrg
6713fb97780Smrg# AM_MISSING_PROG(NAME, PROGRAM)
6723fb97780Smrg# ------------------------------
6733fb97780SmrgAC_DEFUN([AM_MISSING_PROG],
6743fb97780Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
6753fb97780Smrg$1=${$1-"${am_missing_run}$2"}
6763fb97780SmrgAC_SUBST($1)])
6773fb97780Smrg
6783fb97780Smrg# AM_MISSING_HAS_RUN
6793fb97780Smrg# ------------------
6803fb97780Smrg# Define MISSING if not defined so far and test if it is modern enough.
6813fb97780Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
6823fb97780SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
6833fb97780Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6843fb97780SmrgAC_REQUIRE_AUX_FILE([missing])dnl
6853fb97780Smrgif test x"${MISSING+set}" != xset; then
6863fb97780Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
6873fb97780Smrgfi
6883fb97780Smrg# Use eval to expand $SHELL
6893fb97780Smrgif eval "$MISSING --is-lightweight"; then
6903fb97780Smrg  am_missing_run="$MISSING "
6913fb97780Smrgelse
6923fb97780Smrg  am_missing_run=
6933fb97780Smrg  AC_MSG_WARN(['missing' script is too old or missing])
6943fb97780Smrgfi
6953fb97780Smrg])
6960a6b08f8Smrg
6973fb97780Smrg# Helper functions for option handling.                     -*- Autoconf -*-
698126a8a12Smrg
6996bea0e4fSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
7003fb97780Smrg#
7013fb97780Smrg# This file is free software; the Free Software Foundation
7023fb97780Smrg# gives unlimited permission to copy and/or distribute it,
7033fb97780Smrg# with or without modifications, as long as this notice is preserved.
704126a8a12Smrg
7053fb97780Smrg# _AM_MANGLE_OPTION(NAME)
7063fb97780Smrg# -----------------------
7073fb97780SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7083fb97780Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
7090a6b08f8Smrg
7103fb97780Smrg# _AM_SET_OPTION(NAME)
7113fb97780Smrg# --------------------
7123fb97780Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7133fb97780SmrgAC_DEFUN([_AM_SET_OPTION],
7143fb97780Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
7150a6b08f8Smrg
7163fb97780Smrg# _AM_SET_OPTIONS(OPTIONS)
7173fb97780Smrg# ------------------------
7183fb97780Smrg# OPTIONS is a space-separated list of Automake options.
7193fb97780SmrgAC_DEFUN([_AM_SET_OPTIONS],
7203fb97780Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
721126a8a12Smrg
7223fb97780Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7233fb97780Smrg# -------------------------------------------
7243fb97780Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7253fb97780SmrgAC_DEFUN([_AM_IF_OPTION],
7263fb97780Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
727d656433aSmrg
7286bea0e4fSmrg# Copyright (C) 1999-2024 Free Software Foundation, Inc.
7293fb97780Smrg#
7303fb97780Smrg# This file is free software; the Free Software Foundation
7313fb97780Smrg# gives unlimited permission to copy and/or distribute it,
7323fb97780Smrg# with or without modifications, as long as this notice is preserved.
7330a6b08f8Smrg
7343fb97780Smrg# _AM_PROG_CC_C_O
7353fb97780Smrg# ---------------
7363fb97780Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
7373fb97780Smrg# to automatically call this.
7383fb97780SmrgAC_DEFUN([_AM_PROG_CC_C_O],
7393fb97780Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7403fb97780SmrgAC_REQUIRE_AUX_FILE([compile])dnl
7413fb97780SmrgAC_LANG_PUSH([C])dnl
7423fb97780SmrgAC_CACHE_CHECK(
7433fb97780Smrg  [whether $CC understands -c and -o together],
7443fb97780Smrg  [am_cv_prog_cc_c_o],
7453fb97780Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
7463fb97780Smrg  # Make sure it works both with $CC and with simple cc.
7473fb97780Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
7483fb97780Smrg  # compilers refuse to overwrite an existing .o file with -o,
7493fb97780Smrg  # though they will create one.
7503fb97780Smrg  am_cv_prog_cc_c_o=yes
7513fb97780Smrg  for am_i in 1 2; do
7523fb97780Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
7533fb97780Smrg         && test -f conftest2.$ac_objext; then
7543fb97780Smrg      : OK
7553fb97780Smrg    else
7563fb97780Smrg      am_cv_prog_cc_c_o=no
7573fb97780Smrg      break
7583fb97780Smrg    fi
7593fb97780Smrg  done
7603fb97780Smrg  rm -f core conftest*
7613fb97780Smrg  unset am_i])
7623fb97780Smrgif test "$am_cv_prog_cc_c_o" != yes; then
7633fb97780Smrg   # Losing compiler, so override with the script.
7643fb97780Smrg   # FIXME: It is wrong to rewrite CC.
7653fb97780Smrg   # But if we don't then we get into trouble of one sort or another.
7663fb97780Smrg   # A longer-term fix would be to have automake use am__CC in this case,
7673fb97780Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
7683fb97780Smrg   CC="$am_aux_dir/compile $CC"
7693fb97780Smrgfi
7703fb97780SmrgAC_LANG_POP([C])])
771300346aeSmrg
7723fb97780Smrg# For backward compatibility.
7733fb97780SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
774d656433aSmrg
7756bea0e4fSmrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
7766bea0e4fSmrg#
7776bea0e4fSmrg# This file is free software; the Free Software Foundation
7786bea0e4fSmrg# gives unlimited permission to copy and/or distribute it,
7796bea0e4fSmrg# with or without modifications, as long as this notice is preserved.
7806bea0e4fSmrg
7816bea0e4fSmrg# _AM_PROG_RM_F
7826bea0e4fSmrg# ---------------
7836bea0e4fSmrg# Check whether 'rm -f' without any arguments works.
7846bea0e4fSmrg# https://bugs.gnu.org/10828
7856bea0e4fSmrgAC_DEFUN([_AM_PROG_RM_F],
7866bea0e4fSmrg[am__rm_f_notfound=
7876bea0e4fSmrgAS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
7886bea0e4fSmrgAC_SUBST(am__rm_f_notfound)
7896bea0e4fSmrg])
7906bea0e4fSmrg
7916bea0e4fSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
792555991fdSmrg#
7933fb97780Smrg# This file is free software; the Free Software Foundation
7943fb97780Smrg# gives unlimited permission to copy and/or distribute it,
7953fb97780Smrg# with or without modifications, as long as this notice is preserved.
796300346aeSmrg
7973fb97780Smrg# AM_RUN_LOG(COMMAND)
7983fb97780Smrg# -------------------
7993fb97780Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8003fb97780Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8013fb97780SmrgAC_DEFUN([AM_RUN_LOG],
8023fb97780Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8033fb97780Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8043fb97780Smrg   ac_status=$?
8053fb97780Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8063fb97780Smrg   (exit $ac_status); }])
807126a8a12Smrg
8083fb97780Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
809300346aeSmrg
8106bea0e4fSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc.
811555991fdSmrg#
8123fb97780Smrg# This file is free software; the Free Software Foundation
8133fb97780Smrg# gives unlimited permission to copy and/or distribute it,
8143fb97780Smrg# with or without modifications, as long as this notice is preserved.
815126a8a12Smrg
8166bea0e4fSmrg# _AM_SLEEP_FRACTIONAL_SECONDS
8176bea0e4fSmrg# ----------------------------
8186bea0e4fSmrgAC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
8196bea0e4fSmrgAC_CACHE_CHECK([whether sleep supports fractional seconds],
8206bea0e4fSmrg               am_cv_sleep_fractional_seconds, [dnl
8216bea0e4fSmrgAS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
8226bea0e4fSmrg                                 [am_cv_sleep_fractional_seconds=no])
8236bea0e4fSmrg])])
8246bea0e4fSmrg
8256bea0e4fSmrg# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
8266bea0e4fSmrg# -----------------------------------
8276bea0e4fSmrg# Determine the filesystem's resolution for file modification
8286bea0e4fSmrg# timestamps.  The coarsest we know of is FAT, with a resolution
8296bea0e4fSmrg# of only two seconds, even with the most recent "exFAT" extensions.
8306bea0e4fSmrg# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
8316bea0e4fSmrg# nanosecond, matching clock_gettime.  However, it is probably not
8326bea0e4fSmrg# possible to delay execution of a shell script for less than one
8336bea0e4fSmrg# millisecond, due to process creation overhead and scheduling
8346bea0e4fSmrg# granularity, so we don't check for anything finer than that. (See below.)
8356bea0e4fSmrgAC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
8366bea0e4fSmrgAC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
8376bea0e4fSmrgAC_CACHE_CHECK([filesystem timestamp resolution],
8386bea0e4fSmrg               am_cv_filesystem_timestamp_resolution, [dnl
8396bea0e4fSmrg# Default to the worst case.
8406bea0e4fSmrgam_cv_filesystem_timestamp_resolution=2
8416bea0e4fSmrg
8426bea0e4fSmrg# Only try to go finer than 1 sec if sleep can do it.
8436bea0e4fSmrg# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
8446bea0e4fSmrg# - 1 sec is not much of a win compared to 2 sec, and
8456bea0e4fSmrg# - it takes 2 seconds to perform the test whether 1 sec works.
8466bea0e4fSmrg# 
8476bea0e4fSmrg# Instead, just use the default 2s on platforms that have 1s resolution,
8486bea0e4fSmrg# accept the extra 1s delay when using $sleep in the Automake tests, in
8496bea0e4fSmrg# exchange for not incurring the 2s delay for running the test for all
8506bea0e4fSmrg# packages.
8516bea0e4fSmrg#
8526bea0e4fSmrgam_try_resolutions=
8536bea0e4fSmrgif test "$am_cv_sleep_fractional_seconds" = yes; then
8546bea0e4fSmrg  # Even a millisecond often causes a bunch of false positives,
8556bea0e4fSmrg  # so just try a hundredth of a second. The time saved between .001 and
8566bea0e4fSmrg  # .01 is not terribly consequential.
8576bea0e4fSmrg  am_try_resolutions="0.01 0.1 $am_try_resolutions"
8586bea0e4fSmrgfi
8596bea0e4fSmrg
8606bea0e4fSmrg# In order to catch current-generation FAT out, we must *modify* files
8616bea0e4fSmrg# that already exist; the *creation* timestamp is finer.  Use names
8626bea0e4fSmrg# that make ls -t sort them differently when they have equal
8636bea0e4fSmrg# timestamps than when they have distinct timestamps, keeping
8646bea0e4fSmrg# in mind that ls -t prints the *newest* file first.
8656bea0e4fSmrgrm -f conftest.ts?
8666bea0e4fSmrg: > conftest.ts1
8676bea0e4fSmrg: > conftest.ts2
8686bea0e4fSmrg: > conftest.ts3
8696bea0e4fSmrg
8706bea0e4fSmrg# Make sure ls -t actually works.  Do 'set' in a subshell so we don't
8716bea0e4fSmrg# clobber the current shell's arguments. (Outer-level square brackets
8726bea0e4fSmrg# are removed by m4; they're present so that m4 does not expand
8736bea0e4fSmrg# <dollar><star>; be careful, easy to get confused.)
8746bea0e4fSmrgif (
8756bea0e4fSmrg     set X `[ls -t conftest.ts[12]]` &&
8766bea0e4fSmrg     {
8776bea0e4fSmrg       test "$[]*" != "X conftest.ts1 conftest.ts2" ||
8786bea0e4fSmrg       test "$[]*" != "X conftest.ts2 conftest.ts1";
8796bea0e4fSmrg     }
8806bea0e4fSmrg); then :; else
8816bea0e4fSmrg  # If neither matched, then we have a broken ls.  This can happen
8826bea0e4fSmrg  # if, for instance, CONFIG_SHELL is bash and it inherits a
8836bea0e4fSmrg  # broken ls alias from the environment.  This has actually
8846bea0e4fSmrg  # happened.  Such a system could not be considered "sane".
8856bea0e4fSmrg  _AS_ECHO_UNQUOTED(
8866bea0e4fSmrg    ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
8876bea0e4fSmrg    [AS_MESSAGE_LOG_FD])
8886bea0e4fSmrg  AC_MSG_FAILURE([ls -t produces unexpected output.
8896bea0e4fSmrgMake sure there is not a broken ls alias in your environment.])
8906bea0e4fSmrgfi
8916bea0e4fSmrg
8926bea0e4fSmrgfor am_try_res in $am_try_resolutions; do
8936bea0e4fSmrg  # Any one fine-grained sleep might happen to cross the boundary
8946bea0e4fSmrg  # between two values of a coarser actual resolution, but if we do
8956bea0e4fSmrg  # two fine-grained sleeps in a row, at least one of them will fall
8966bea0e4fSmrg  # entirely within a coarse interval.
8976bea0e4fSmrg  echo alpha > conftest.ts1
8986bea0e4fSmrg  sleep $am_try_res
8996bea0e4fSmrg  echo beta > conftest.ts2
9006bea0e4fSmrg  sleep $am_try_res
9016bea0e4fSmrg  echo gamma > conftest.ts3
9026bea0e4fSmrg
9036bea0e4fSmrg  # We assume that 'ls -t' will make use of high-resolution
9046bea0e4fSmrg  # timestamps if the operating system supports them at all.
9056bea0e4fSmrg  if (set X `ls -t conftest.ts?` &&
9066bea0e4fSmrg      test "$[]2" = conftest.ts3 &&
9076bea0e4fSmrg      test "$[]3" = conftest.ts2 &&
9086bea0e4fSmrg      test "$[]4" = conftest.ts1); then
9096bea0e4fSmrg    #
9106bea0e4fSmrg    # Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
9116bea0e4fSmrg    # because we don't need to test make.
9126bea0e4fSmrg    make_ok=true
9136bea0e4fSmrg    if test $am_try_res != 1; then
9146bea0e4fSmrg      # But if we've succeeded so far with a subsecond resolution, we
9156bea0e4fSmrg      # have one more thing to check: make. It can happen that
9166bea0e4fSmrg      # everything else supports the subsecond mtimes, but make doesn't;
9176bea0e4fSmrg      # notably on macOS, which ships make 3.81 from 2006 (the last one
9186bea0e4fSmrg      # released under GPLv2). https://bugs.gnu.org/68808
9196bea0e4fSmrg      # 
9206bea0e4fSmrg      # We test $MAKE if it is defined in the environment, else "make".
9216bea0e4fSmrg      # It might get overridden later, but our hope is that in practice
9226bea0e4fSmrg      # it does not matter: it is the system "make" which is (by far)
9236bea0e4fSmrg      # the most likely to be broken, whereas if the user overrides it,
9246bea0e4fSmrg      # probably they did so with a better, or at least not worse, make.
9256bea0e4fSmrg      # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
9266bea0e4fSmrg      #
9276bea0e4fSmrg      # Create a Makefile (real tab character here):
9286bea0e4fSmrg      rm -f conftest.mk
9296bea0e4fSmrg      echo 'conftest.ts1: conftest.ts2' >conftest.mk
9306bea0e4fSmrg      echo '	touch conftest.ts2' >>conftest.mk
9316bea0e4fSmrg      #
9326bea0e4fSmrg      # Now, running
9336bea0e4fSmrg      #   touch conftest.ts1; touch conftest.ts2; make
9346bea0e4fSmrg      # should touch ts1 because ts2 is newer. This could happen by luck,
9356bea0e4fSmrg      # but most often, it will fail if make's support is insufficient. So
9366bea0e4fSmrg      # test for several consecutive successes.
9376bea0e4fSmrg      #
9386bea0e4fSmrg      # (We reuse conftest.ts[12] because we still want to modify existing
9396bea0e4fSmrg      # files, not create new ones, per above.)
9406bea0e4fSmrg      n=0
9416bea0e4fSmrg      make=${MAKE-make}
9426bea0e4fSmrg      until test $n -eq 3; do
9436bea0e4fSmrg        echo one > conftest.ts1
9446bea0e4fSmrg        sleep $am_try_res
9456bea0e4fSmrg        echo two > conftest.ts2 # ts2 should now be newer than ts1
9466bea0e4fSmrg        if $make -f conftest.mk | grep 'up to date' >/dev/null; then
9476bea0e4fSmrg          make_ok=false
9486bea0e4fSmrg          break # out of $n loop
9496bea0e4fSmrg        fi
9506bea0e4fSmrg        n=`expr $n + 1`
9516bea0e4fSmrg      done
9526bea0e4fSmrg    fi
9536bea0e4fSmrg    #
9546bea0e4fSmrg    if $make_ok; then
9556bea0e4fSmrg      # Everything we know to check worked out, so call this resolution good.
9566bea0e4fSmrg      am_cv_filesystem_timestamp_resolution=$am_try_res
9576bea0e4fSmrg      break # out of $am_try_res loop
9586bea0e4fSmrg    fi
9596bea0e4fSmrg    # Otherwise, we'll go on to check the next resolution.
9606bea0e4fSmrg  fi
9616bea0e4fSmrgdone
9626bea0e4fSmrgrm -f conftest.ts?
9636bea0e4fSmrg# (end _am_filesystem_timestamp_resolution)
9646bea0e4fSmrg])])
9656bea0e4fSmrg
9663fb97780Smrg# AM_SANITY_CHECK
9673fb97780Smrg# ---------------
9683fb97780SmrgAC_DEFUN([AM_SANITY_CHECK],
9696bea0e4fSmrg[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
9706bea0e4fSmrg# This check should not be cached, as it may vary across builds of
9716bea0e4fSmrg# different projects.
9726bea0e4fSmrgAC_MSG_CHECKING([whether build environment is sane])
9733fb97780Smrg# Reject unsafe characters in $srcdir or the absolute working directory
9743fb97780Smrg# name.  Accept space and tab only in the latter.
9753fb97780Smrgam_lf='
9763fb97780Smrg'
9773fb97780Smrgcase `pwd` in
9783fb97780Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
9793fb97780Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
9803fb97780Smrgesac
9813fb97780Smrgcase $srcdir in
9823fb97780Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
9833fb97780Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
9843fb97780Smrgesac
985126a8a12Smrg
9863fb97780Smrg# Do 'set' in a subshell so we don't clobber the current shell's
9873fb97780Smrg# arguments.  Must try -L first in case configure is actually a
9883fb97780Smrg# symlink; some systems play weird games with the mod time of symlinks
9893fb97780Smrg# (eg FreeBSD returns the mod time of the symlink's containing
9903fb97780Smrg# directory).
9916bea0e4fSmrgam_build_env_is_sane=no
9926bea0e4fSmrgam_has_slept=no
9936bea0e4fSmrgrm -f conftest.file
9946bea0e4fSmrgfor am_try in 1 2; do
9956bea0e4fSmrg  echo "timestamp, slept: $am_has_slept" > conftest.file
9966bea0e4fSmrg  if (
9976bea0e4fSmrg    set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
9986bea0e4fSmrg    if test "$[]*" = "X"; then
9996bea0e4fSmrg      # -L didn't work.
10006bea0e4fSmrg      set X `ls -t "$srcdir/configure" conftest.file`
10016bea0e4fSmrg    fi
10026bea0e4fSmrg    test "$[]2" = conftest.file
10036bea0e4fSmrg  ); then
10046bea0e4fSmrg    am_build_env_is_sane=yes
10056bea0e4fSmrg    break
10066bea0e4fSmrg  fi
10076bea0e4fSmrg  # Just in case.
10086bea0e4fSmrg  sleep "$am_cv_filesystem_timestamp_resolution"
10096bea0e4fSmrg  am_has_slept=yes
10106bea0e4fSmrgdone
10116bea0e4fSmrg
10126bea0e4fSmrgAC_MSG_RESULT([$am_build_env_is_sane])
10136bea0e4fSmrgif test "$am_build_env_is_sane" = no; then
10146bea0e4fSmrg  AC_MSG_ERROR([newly created file is older than distributed files!
10153fb97780SmrgCheck your system clock])
10163fb97780Smrgfi
10176bea0e4fSmrg
10183fb97780Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
10193fb97780Smrg# generated files are strictly newer.
10203fb97780Smrgam_sleep_pid=
10216bea0e4fSmrgAS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
10226bea0e4fSmrg  ( sleep "$am_cv_filesystem_timestamp_resolution" ) &
10233fb97780Smrg  am_sleep_pid=$!
10246bea0e4fSmrg])
10253fb97780SmrgAC_CONFIG_COMMANDS_PRE(
10263fb97780Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
10273fb97780Smrg   if test -n "$am_sleep_pid"; then
10283fb97780Smrg     # Hide warnings about reused PIDs.
10293fb97780Smrg     wait $am_sleep_pid 2>/dev/null
10303fb97780Smrg   fi
10313fb97780Smrg   AC_MSG_RESULT([done])])
10323fb97780Smrgrm -f conftest.file
10333fb97780Smrg])
1034126a8a12Smrg
10356bea0e4fSmrg# Copyright (C) 2009-2024 Free Software Foundation, Inc.
10363fb97780Smrg#
10373fb97780Smrg# This file is free software; the Free Software Foundation
10383fb97780Smrg# gives unlimited permission to copy and/or distribute it,
10393fb97780Smrg# with or without modifications, as long as this notice is preserved.
1040126a8a12Smrg
10416bea0e4fSmrg# _AM_SILENT_RULES
10426bea0e4fSmrg# ----------------
10436bea0e4fSmrg# Enable less verbose build rules support.
10446bea0e4fSmrgAC_DEFUN([_AM_SILENT_RULES],
10456bea0e4fSmrg[AM_DEFAULT_VERBOSITY=1
10466bea0e4fSmrgAC_ARG_ENABLE([silent-rules], [dnl
10473fb97780SmrgAS_HELP_STRING(
10483fb97780Smrg  [--enable-silent-rules],
10493fb97780Smrg  [less verbose build output (undo: "make V=1")])
10503fb97780SmrgAS_HELP_STRING(
10513fb97780Smrg  [--disable-silent-rules],
10523fb97780Smrg  [verbose build output (undo: "make V=0")])dnl
10533fb97780Smrg])
10543fb97780Smrgdnl
10553fb97780Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
10563fb97780Smrgdnl do not support nested variable expansions.
10573fb97780Smrgdnl See automake bug#9928 and bug#10237.
10583fb97780Smrgam_make=${MAKE-make}
10593fb97780SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
10603fb97780Smrg   [am_cv_make_support_nested_variables],
10613fb97780Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
10623fb97780SmrgBAR0=false
10633fb97780SmrgBAR1=true
10643fb97780SmrgV=1
10653fb97780Smrgam__doit:
10663fb97780Smrg	@$(TRUE)
10673fb97780Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
10683fb97780Smrg  am_cv_make_support_nested_variables=yes
10693fb97780Smrgelse
10703fb97780Smrg  am_cv_make_support_nested_variables=no
10713fb97780Smrgfi])
10723fb97780SmrgAC_SUBST([AM_V])dnl
10733fb97780SmrgAM_SUBST_NOTMAKE([AM_V])dnl
10743fb97780SmrgAC_SUBST([AM_DEFAULT_V])dnl
10753fb97780SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
10763fb97780SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
10773fb97780SmrgAM_BACKSLASH='\'
10783fb97780SmrgAC_SUBST([AM_BACKSLASH])dnl
10793fb97780Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
10806bea0e4fSmrgdnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
10816bea0e4fSmrgdnl to AM_SILENT_RULES to change the default value.
10826bea0e4fSmrgAC_CONFIG_COMMANDS_PRE([dnl
10836bea0e4fSmrgcase $enable_silent_rules in @%:@ (((
10846bea0e4fSmrg  yes) AM_DEFAULT_VERBOSITY=0;;
10856bea0e4fSmrg   no) AM_DEFAULT_VERBOSITY=1;;
10866bea0e4fSmrgesac
10876bea0e4fSmrgif test $am_cv_make_support_nested_variables = yes; then
10886bea0e4fSmrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
10896bea0e4fSmrg  AM_V='$(V)'
10906bea0e4fSmrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
10916bea0e4fSmrgelse
10926bea0e4fSmrg  AM_V=$AM_DEFAULT_VERBOSITY
10936bea0e4fSmrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
10946bea0e4fSmrgfi
10956bea0e4fSmrg])dnl
10963fb97780Smrg])
1097d656433aSmrg
10986bea0e4fSmrg# AM_SILENT_RULES([DEFAULT])
10996bea0e4fSmrg# --------------------------
11006bea0e4fSmrg# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
11016bea0e4fSmrg# empty being verbose).
11026bea0e4fSmrgAC_DEFUN([AM_SILENT_RULES],
11036bea0e4fSmrg[AC_REQUIRE([_AM_SILENT_RULES])
11046bea0e4fSmrgAM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
11056bea0e4fSmrg
11066bea0e4fSmrg# Copyright (C) 2001-2024 Free Software Foundation, Inc.
11073fb97780Smrg#
11083fb97780Smrg# This file is free software; the Free Software Foundation
11093fb97780Smrg# gives unlimited permission to copy and/or distribute it,
11103fb97780Smrg# with or without modifications, as long as this notice is preserved.
1111d656433aSmrg
11123fb97780Smrg# AM_PROG_INSTALL_STRIP
11133fb97780Smrg# ---------------------
11143fb97780Smrg# One issue with vendor 'install' (even GNU) is that you can't
11153fb97780Smrg# specify the program used to strip binaries.  This is especially
11163fb97780Smrg# annoying in cross-compiling environments, where the build's strip
11173fb97780Smrg# is unlikely to handle the host's binaries.
11183fb97780Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
11193fb97780Smrg# always use install-sh in "make install-strip", and initialize
11203fb97780Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
11213fb97780SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
11223fb97780Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
11233fb97780Smrg# Installed binaries are usually stripped using 'strip' when the user
11243fb97780Smrg# run "make install-strip".  However 'strip' might not be the right
11253fb97780Smrg# tool to use in cross-compilation environments, therefore Automake
11263fb97780Smrg# will honor the 'STRIP' environment variable to overrule this program.
11273fb97780Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
11283fb97780Smrgif test "$cross_compiling" != no; then
11293fb97780Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
11303fb97780Smrgfi
11313fb97780SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
11323fb97780SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
11330a6b08f8Smrg
11346bea0e4fSmrg# Copyright (C) 2006-2024 Free Software Foundation, Inc.
11353fb97780Smrg#
11363fb97780Smrg# This file is free software; the Free Software Foundation
11373fb97780Smrg# gives unlimited permission to copy and/or distribute it,
11383fb97780Smrg# with or without modifications, as long as this notice is preserved.
1139d656433aSmrg
11403fb97780Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
11413fb97780Smrg# ---------------------------
11423fb97780Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
11433fb97780Smrg# This macro is traced by Automake.
11443fb97780SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1145126a8a12Smrg
11463fb97780Smrg# AM_SUBST_NOTMAKE(VARIABLE)
11473fb97780Smrg# --------------------------
11483fb97780Smrg# Public sister of _AM_SUBST_NOTMAKE.
11493fb97780SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1150126a8a12Smrg
11513fb97780Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1152126a8a12Smrg
11536bea0e4fSmrg# Copyright (C) 2004-2024 Free Software Foundation, Inc.
11543fb97780Smrg#
11553fb97780Smrg# This file is free software; the Free Software Foundation
11563fb97780Smrg# gives unlimited permission to copy and/or distribute it,
11573fb97780Smrg# with or without modifications, as long as this notice is preserved.
1158300346aeSmrg
11593fb97780Smrg# _AM_PROG_TAR(FORMAT)
11603fb97780Smrg# --------------------
11613fb97780Smrg# Check how to create a tarball in format FORMAT.
11623fb97780Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
11633fb97780Smrg#
11643fb97780Smrg# Substitute a variable $(am__tar) that is a command
11653fb97780Smrg# writing to stdout a FORMAT-tarball containing the directory
11663fb97780Smrg# $tardir.
11673fb97780Smrg#     tardir=directory && $(am__tar) > result.tar
11683fb97780Smrg#
11693fb97780Smrg# Substitute a variable $(am__untar) that extract such
11703fb97780Smrg# a tarball read from stdin.
11713fb97780Smrg#     $(am__untar) < result.tar
11723fb97780Smrg#
11733fb97780SmrgAC_DEFUN([_AM_PROG_TAR],
11743fb97780Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
11753fb97780Smrg# in the wild :-(  We should find a proper way to deprecate it ...
11763fb97780SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
11773c15da26Smrg
11783fb97780Smrg# We'll loop over all known methods to create a tar archive until one works.
11793fb97780Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1180126a8a12Smrg
11813fb97780Smrgm4_if([$1], [v7],
11823fb97780Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1183126a8a12Smrg
11843fb97780Smrg  [m4_case([$1],
11853fb97780Smrg    [ustar],
11863fb97780Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
11873fb97780Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
11883fb97780Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
11893fb97780Smrg      # and bug#13588).
11903fb97780Smrg      am_max_uid=2097151 # 2^21 - 1
11913fb97780Smrg      am_max_gid=$am_max_uid
11923fb97780Smrg      # The $UID and $GID variables are not portable, so we need to resort
11933fb97780Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
11943fb97780Smrg      # below are definitely unexpected, so allow the users to see them
11953fb97780Smrg      # (that is, avoid stderr redirection).
11963fb97780Smrg      am_uid=`id -u || echo unknown`
11973fb97780Smrg      am_gid=`id -g || echo unknown`
11983fb97780Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
11996bea0e4fSmrg      if test x$am_uid = xunknown; then
12006bea0e4fSmrg        AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
12016bea0e4fSmrg      elif test $am_uid -le $am_max_uid; then
12026bea0e4fSmrg        AC_MSG_RESULT([yes])
12033fb97780Smrg      else
12046bea0e4fSmrg        AC_MSG_RESULT([no])
12056bea0e4fSmrg        _am_tools=none
12063fb97780Smrg      fi
12073fb97780Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
12086bea0e4fSmrg      if test x$gm_gid = xunknown; then
12096bea0e4fSmrg        AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
12106bea0e4fSmrg      elif test $am_gid -le $am_max_gid; then
12116bea0e4fSmrg        AC_MSG_RESULT([yes])
12123fb97780Smrg      else
12133fb97780Smrg        AC_MSG_RESULT([no])
12143fb97780Smrg        _am_tools=none
12153fb97780Smrg      fi],
1216126a8a12Smrg
12173fb97780Smrg  [pax],
12183fb97780Smrg    [],
1219126a8a12Smrg
12203fb97780Smrg  [m4_fatal([Unknown tar format])])
1221126a8a12Smrg
12223fb97780Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1223d656433aSmrg
12243fb97780Smrg  # Go ahead even if we have the value already cached.  We do so because we
12253fb97780Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
12263fb97780Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1227126a8a12Smrg
12283fb97780Smrg  for _am_tool in $_am_tools; do
12293fb97780Smrg    case $_am_tool in
12303fb97780Smrg    gnutar)
12313fb97780Smrg      for _am_tar in tar gnutar gtar; do
12323fb97780Smrg        AM_RUN_LOG([$_am_tar --version]) && break
12333fb97780Smrg      done
12343fb97780Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
12353fb97780Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
12363fb97780Smrg      am__untar="$_am_tar -xf -"
12373fb97780Smrg      ;;
12383fb97780Smrg    plaintar)
12393fb97780Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
12403fb97780Smrg      # ustar tarball either.
12413fb97780Smrg      (tar --version) >/dev/null 2>&1 && continue
12423fb97780Smrg      am__tar='tar chf - "$$tardir"'
12433fb97780Smrg      am__tar_='tar chf - "$tardir"'
12443fb97780Smrg      am__untar='tar xf -'
12453fb97780Smrg      ;;
12463fb97780Smrg    pax)
12473fb97780Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
12483fb97780Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
12493fb97780Smrg      am__untar='pax -r'
12503fb97780Smrg      ;;
12513fb97780Smrg    cpio)
12523fb97780Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
12533fb97780Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
12543fb97780Smrg      am__untar='cpio -i -H $1 -d'
12553fb97780Smrg      ;;
12563fb97780Smrg    none)
12573fb97780Smrg      am__tar=false
12583fb97780Smrg      am__tar_=false
12593fb97780Smrg      am__untar=false
12603fb97780Smrg      ;;
12613fb97780Smrg    esac
1262126a8a12Smrg
12633fb97780Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
12643fb97780Smrg    # and am__untar set.
12653fb97780Smrg    test -n "${am_cv_prog_tar_$1}" && break
1266126a8a12Smrg
12673fb97780Smrg    # tar/untar a dummy directory, and stop if the command works.
12683fb97780Smrg    rm -rf conftest.dir
12693fb97780Smrg    mkdir conftest.dir
12703fb97780Smrg    echo GrepMe > conftest.dir/file
12713fb97780Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
12723fb97780Smrg    rm -rf conftest.dir
12733fb97780Smrg    if test -s conftest.tar; then
12743fb97780Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
12753fb97780Smrg      AM_RUN_LOG([cat conftest.dir/file])
12763fb97780Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
12773fb97780Smrg    fi
12783fb97780Smrg  done
12793fb97780Smrg  rm -rf conftest.dir
1280555991fdSmrg
12813fb97780Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
12823fb97780Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1283126a8a12Smrg
12843fb97780SmrgAC_SUBST([am__tar])
12853fb97780SmrgAC_SUBST([am__untar])
12863fb97780Smrg]) # _AM_PROG_TAR
1287126a8a12Smrg
12886bea0e4fSmrg# Copyright (C) 2022-2024 Free Software Foundation, Inc.
12896bea0e4fSmrg#
12906bea0e4fSmrg# This file is free software; the Free Software Foundation
12916bea0e4fSmrg# gives unlimited permission to copy and/or distribute it,
12926bea0e4fSmrg# with or without modifications, as long as this notice is preserved.
12936bea0e4fSmrg
12946bea0e4fSmrg# _AM_PROG_XARGS_N
12956bea0e4fSmrg# ----------------
12966bea0e4fSmrg# Check whether 'xargs -n' works.  It should work everywhere, so the fallback
12976bea0e4fSmrg# is not optimized at all as we never expect to use it.
12986bea0e4fSmrgAC_DEFUN([_AM_PROG_XARGS_N],
12996bea0e4fSmrg[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
13006bea0e4fSmrgAS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
13016bea0e4fSmrg3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
13026bea0e4fSmrgAS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
13036bea0e4fSmrg  am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
13046bea0e4fSmrg])dnl
13056bea0e4fSmrgAC_SUBST(am__xargs_n)
13066bea0e4fSmrg])
13076bea0e4fSmrg
13083fb97780Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
13093fb97780Smrgdnl serial 11 (pkg-config-0.29)
13103fb97780Smrgdnl
13113fb97780Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
13123fb97780Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
13133fb97780Smrgdnl
13143fb97780Smrgdnl This program is free software; you can redistribute it and/or modify
13153fb97780Smrgdnl it under the terms of the GNU General Public License as published by
13163fb97780Smrgdnl the Free Software Foundation; either version 2 of the License, or
13173fb97780Smrgdnl (at your option) any later version.
13183fb97780Smrgdnl
13193fb97780Smrgdnl This program is distributed in the hope that it will be useful, but
13203fb97780Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
13213fb97780Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13223fb97780Smrgdnl General Public License for more details.
13233fb97780Smrgdnl
13243fb97780Smrgdnl You should have received a copy of the GNU General Public License
13253fb97780Smrgdnl along with this program; if not, write to the Free Software
13263fb97780Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
13273fb97780Smrgdnl 02111-1307, USA.
13283fb97780Smrgdnl
13293fb97780Smrgdnl As a special exception to the GNU General Public License, if you
13303fb97780Smrgdnl distribute this file as part of a program that contains a
13313fb97780Smrgdnl configuration script generated by Autoconf, you may include it under
13323fb97780Smrgdnl the same distribution terms that you use for the rest of that
13333fb97780Smrgdnl program.
1334555991fdSmrg
13353fb97780Smrgdnl PKG_PREREQ(MIN-VERSION)
13363fb97780Smrgdnl -----------------------
13373fb97780Smrgdnl Since: 0.29
13383fb97780Smrgdnl
13393fb97780Smrgdnl Verify that the version of the pkg-config macros are at least
13403fb97780Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
13413fb97780Smrgdnl installed version of pkg-config, this checks the developer's version
13423fb97780Smrgdnl of pkg.m4 when generating configure.
13433fb97780Smrgdnl
13443fb97780Smrgdnl To ensure that this macro is defined, also add:
13453fb97780Smrgdnl m4_ifndef([PKG_PREREQ],
13463fb97780Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
13473fb97780Smrgdnl
13483fb97780Smrgdnl See the "Since" comment for each macro you use to see what version
13493fb97780Smrgdnl of the macros you require.
13503fb97780Smrgm4_defun([PKG_PREREQ],
13513fb97780Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
13523fb97780Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
13533fb97780Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
13543fb97780Smrg])dnl PKG_PREREQ
1355555991fdSmrg
13563fb97780Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
13573fb97780Smrgdnl ----------------------------------
13583fb97780Smrgdnl Since: 0.16
13593fb97780Smrgdnl
13603fb97780Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
13613fb97780Smrgdnl first found in the path. Checks that the version of pkg-config found
13623fb97780Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
13633fb97780Smrgdnl used since that's the first version where most current features of
13643fb97780Smrgdnl pkg-config existed.
13653fb97780SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
13663fb97780Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
13673fb97780Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
13683fb97780Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
13693fb97780SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
13703fb97780SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
13713fb97780SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1372126a8a12Smrg
13733fb97780Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
13743fb97780Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
13753fb97780Smrgfi
13763fb97780Smrgif test -n "$PKG_CONFIG"; then
13773fb97780Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
13783fb97780Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
13793fb97780Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
13803fb97780Smrg		AC_MSG_RESULT([yes])
13813fb97780Smrg	else
13823fb97780Smrg		AC_MSG_RESULT([no])
13833fb97780Smrg		PKG_CONFIG=""
13843fb97780Smrg	fi
13853fb97780Smrgfi[]dnl
13863fb97780Smrg])dnl PKG_PROG_PKG_CONFIG
1387126a8a12Smrg
13883fb97780Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
13893fb97780Smrgdnl -------------------------------------------------------------------
13903fb97780Smrgdnl Since: 0.18
13913fb97780Smrgdnl
13923fb97780Smrgdnl Check to see whether a particular set of modules exists. Similar to
13933fb97780Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
13943fb97780Smrgdnl
13953fb97780Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
13963fb97780Smrgdnl only at the first occurence in configure.ac, so if the first place
13973fb97780Smrgdnl it's called might be skipped (such as if it is within an "if", you
13983fb97780Smrgdnl have to call PKG_CHECK_EXISTS manually
13993fb97780SmrgAC_DEFUN([PKG_CHECK_EXISTS],
14003fb97780Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14013fb97780Smrgif test -n "$PKG_CONFIG" && \
14023fb97780Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
14033fb97780Smrg  m4_default([$2], [:])
14043fb97780Smrgm4_ifvaln([$3], [else
14053fb97780Smrg  $3])dnl
14063fb97780Smrgfi])
1407126a8a12Smrg
14083fb97780Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
14093fb97780Smrgdnl ---------------------------------------------
14103fb97780Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
14113fb97780Smrgdnl pkg_failed based on the result.
14123fb97780Smrgm4_define([_PKG_CONFIG],
14133fb97780Smrg[if test -n "$$1"; then
14143fb97780Smrg    pkg_cv_[]$1="$$1"
14153fb97780Smrg elif test -n "$PKG_CONFIG"; then
14163fb97780Smrg    PKG_CHECK_EXISTS([$3],
14173fb97780Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
14183fb97780Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
14193fb97780Smrg		     [pkg_failed=yes])
14203fb97780Smrg else
14213fb97780Smrg    pkg_failed=untried
14223fb97780Smrgfi[]dnl
14233fb97780Smrg])dnl _PKG_CONFIG
1424126a8a12Smrg
14253fb97780Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
14263fb97780Smrgdnl ---------------------------
14273fb97780Smrgdnl Internal check to see if pkg-config supports short errors.
14283fb97780SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
14293fb97780Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
14303fb97780Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
14313fb97780Smrg        _pkg_short_errors_supported=yes
14323fb97780Smrgelse
14333fb97780Smrg        _pkg_short_errors_supported=no
14343fb97780Smrgfi[]dnl
14353fb97780Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
1436555991fdSmrg
14373c15da26Smrg
14383fb97780Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
14393fb97780Smrgdnl   [ACTION-IF-NOT-FOUND])
14403fb97780Smrgdnl --------------------------------------------------------------
14413fb97780Smrgdnl Since: 0.4.0
14423fb97780Smrgdnl
14433fb97780Smrgdnl Note that if there is a possibility the first call to
14443fb97780Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
14453fb97780Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
14463fb97780SmrgAC_DEFUN([PKG_CHECK_MODULES],
14473fb97780Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
14483fb97780SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
14493fb97780SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1450126a8a12Smrg
14513fb97780Smrgpkg_failed=no
14523fb97780SmrgAC_MSG_CHECKING([for $1])
1453126a8a12Smrg
14543fb97780Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
14553fb97780Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1456555991fdSmrg
14573fb97780Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
14583fb97780Smrgand $1[]_LIBS to avoid the need to call pkg-config.
14593fb97780SmrgSee the pkg-config man page for more details.])
1460555991fdSmrg
14613fb97780Smrgif test $pkg_failed = yes; then
14623fb97780Smrg   	AC_MSG_RESULT([no])
14633fb97780Smrg        _PKG_SHORT_ERRORS_SUPPORTED
14643fb97780Smrg        if test $_pkg_short_errors_supported = yes; then
14653fb97780Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
14663fb97780Smrg        else 
14673fb97780Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
14683fb97780Smrg        fi
14693fb97780Smrg	# Put the nasty error message in config.log where it belongs
14703fb97780Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1471126a8a12Smrg
14723fb97780Smrg	m4_default([$4], [AC_MSG_ERROR(
14733fb97780Smrg[Package requirements ($2) were not met:
1474555991fdSmrg
14753fb97780Smrg$$1_PKG_ERRORS
1476555991fdSmrg
14773fb97780SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
14783fb97780Smrginstalled software in a non-standard prefix.
1479d656433aSmrg
14803fb97780Smrg_PKG_TEXT])[]dnl
14813fb97780Smrg        ])
14823fb97780Smrgelif test $pkg_failed = untried; then
14833fb97780Smrg     	AC_MSG_RESULT([no])
14843fb97780Smrg	m4_default([$4], [AC_MSG_FAILURE(
14853fb97780Smrg[The pkg-config script could not be found or is too old.  Make sure it
14863fb97780Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
14873fb97780Smrgpath to pkg-config.
1488126a8a12Smrg
14893fb97780Smrg_PKG_TEXT
1490126a8a12Smrg
14913fb97780SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
14923fb97780Smrg        ])
14933fb97780Smrgelse
14943fb97780Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
14953fb97780Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
14963fb97780Smrg        AC_MSG_RESULT([yes])
14973fb97780Smrg	$3
14983fb97780Smrgfi[]dnl
14993fb97780Smrg])dnl PKG_CHECK_MODULES
1500126a8a12Smrg
1501555991fdSmrg
15023fb97780Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
15033fb97780Smrgdnl   [ACTION-IF-NOT-FOUND])
15043fb97780Smrgdnl ---------------------------------------------------------------------
15053fb97780Smrgdnl Since: 0.29
15063fb97780Smrgdnl
15073fb97780Smrgdnl Checks for existence of MODULES and gathers its build flags with
15083fb97780Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
15093fb97780Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
15103fb97780Smrgdnl
15113fb97780Smrgdnl Note that if there is a possibility the first call to
15123fb97780Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
15133fb97780Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
15143fb97780Smrgdnl configure.ac.
15153fb97780SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
15163fb97780Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
15173fb97780Smrg_save_PKG_CONFIG=$PKG_CONFIG
15183fb97780SmrgPKG_CONFIG="$PKG_CONFIG --static"
15193fb97780SmrgPKG_CHECK_MODULES($@)
15203fb97780SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
15213fb97780Smrg])dnl PKG_CHECK_MODULES_STATIC
1522126a8a12Smrg
1523555991fdSmrg
15243fb97780Smrgdnl PKG_INSTALLDIR([DIRECTORY])
15253fb97780Smrgdnl -------------------------
15263fb97780Smrgdnl Since: 0.27
15273fb97780Smrgdnl
15283fb97780Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
15293fb97780Smrgdnl should install pkg-config .pc files. By default the directory is
15303fb97780Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
15313fb97780Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
15323fb97780Smrgdnl parameter.
15333fb97780SmrgAC_DEFUN([PKG_INSTALLDIR],
15343fb97780Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
15353fb97780Smrgm4_pushdef([pkg_description],
15363fb97780Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
15373fb97780SmrgAC_ARG_WITH([pkgconfigdir],
15383fb97780Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
15393fb97780Smrg    [with_pkgconfigdir=]pkg_default)
15403fb97780SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
15413fb97780Smrgm4_popdef([pkg_default])
15423fb97780Smrgm4_popdef([pkg_description])
15433fb97780Smrg])dnl PKG_INSTALLDIR
1544126a8a12Smrg
1545555991fdSmrg
15463fb97780Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
15473fb97780Smrgdnl --------------------------------
15483fb97780Smrgdnl Since: 0.27
15493fb97780Smrgdnl
15503fb97780Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
15513fb97780Smrgdnl module should install arch-independent pkg-config .pc files. By
15523fb97780Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
15533fb97780Smrgdnl changed by passing DIRECTORY. The user can override through the
15543fb97780Smrgdnl --with-noarch-pkgconfigdir parameter.
15553fb97780SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
15563fb97780Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
15573fb97780Smrgm4_pushdef([pkg_description],
15583fb97780Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
15593fb97780SmrgAC_ARG_WITH([noarch-pkgconfigdir],
15603fb97780Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
15613fb97780Smrg    [with_noarch_pkgconfigdir=]pkg_default)
15623fb97780SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
15633fb97780Smrgm4_popdef([pkg_default])
15643fb97780Smrgm4_popdef([pkg_description])
15653fb97780Smrg])dnl PKG_NOARCH_INSTALLDIR
1566555991fdSmrg
1567d656433aSmrg
15683fb97780Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
15693fb97780Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
15703fb97780Smrgdnl -------------------------------------------
15713fb97780Smrgdnl Since: 0.28
15723fb97780Smrgdnl
15733fb97780Smrgdnl Retrieves the value of the pkg-config variable for the given module.
15743fb97780SmrgAC_DEFUN([PKG_CHECK_VAR],
15753fb97780Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
15763fb97780SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1577d656433aSmrg
15783fb97780Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
15793fb97780SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
1580d656433aSmrg
15813fb97780SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
15823fb97780Smrg])dnl PKG_CHECK_VAR
1583d656433aSmrg
15843fb97780Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
15853fb97780Smrgdnl
15866bea0e4fSmrgdnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
15873fb97780Smrgdnl
15883fb97780Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
15893fb97780Smrgdnl copy of this software and associated documentation files (the "Software"),
15903fb97780Smrgdnl to deal in the Software without restriction, including without limitation
15913fb97780Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
15923fb97780Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
15933fb97780Smrgdnl Software is furnished to do so, subject to the following conditions:
15943fb97780Smrgdnl
15953fb97780Smrgdnl The above copyright notice and this permission notice (including the next
15963fb97780Smrgdnl paragraph) shall be included in all copies or substantial portions of the
15973fb97780Smrgdnl Software.
15983fb97780Smrgdnl
15993fb97780Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16003fb97780Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16013fb97780Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
16023fb97780Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16033fb97780Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
16043fb97780Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
16053fb97780Smrgdnl DEALINGS IN THE SOFTWARE.
1606d656433aSmrg
16073fb97780Smrg# XORG_MACROS_VERSION(required-version)
16083fb97780Smrg# -------------------------------------
16093fb97780Smrg# Minimum version: 1.1.0
16103fb97780Smrg#
16113fb97780Smrg# If you're using a macro added in Version 1.1 or newer, include this in
16123fb97780Smrg# your configure.ac with the minimum required version, such as:
16133fb97780Smrg# XORG_MACROS_VERSION(1.1)
16143fb97780Smrg#
16153fb97780Smrg# To ensure that this macro is defined, also add:
16163fb97780Smrg# m4_ifndef([XORG_MACROS_VERSION],
16173fb97780Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
16183fb97780Smrg#
16193fb97780Smrg#
16203fb97780Smrg# See the "minimum version" comment for each macro you use to see what
16213fb97780Smrg# version you require.
16223fb97780Smrgm4_defun([XORG_MACROS_VERSION],[
16236bea0e4fSmrgm4_define([vers_have], [1.20.2])
16243fb97780Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
16253fb97780Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
16263fb97780Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
16273fb97780Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
16283fb97780Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
16293fb97780Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
16303fb97780Smrgm4_undefine([vers_have])
16313fb97780Smrgm4_undefine([maj_have])
16323fb97780Smrgm4_undefine([maj_needed])
16333fb97780Smrg]) # XORG_MACROS_VERSION
1634126a8a12Smrg
16353fb97780Smrg# XORG_PROG_RAWCPP()
16363fb97780Smrg# ------------------
16373fb97780Smrg# Minimum version: 1.0.0
16383fb97780Smrg#
16393fb97780Smrg# Find cpp program and necessary flags for use in pre-processing text files
16403fb97780Smrg# such as man pages and config files
16413fb97780SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
16423fb97780SmrgAC_REQUIRE([AC_PROG_CPP])
16433fb97780SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
16443fb97780Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1645126a8a12Smrg
16463fb97780Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
16473fb97780Smrg# which is not the best choice for supporting other OS'es, but covers most
16483fb97780Smrg# of the ones we need for now.
16493fb97780SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
16503fb97780SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
16513fb97780Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
16523fb97780Smrg	AC_MSG_RESULT([no])
16533fb97780Smrgelse
16543fb97780Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
16553fb97780Smrg		RAWCPPFLAGS=-undef
16563fb97780Smrg		AC_MSG_RESULT([yes])
16573fb97780Smrg	# under Cygwin unix is still defined even with -undef
16583fb97780Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
16593fb97780Smrg		RAWCPPFLAGS="-undef -ansi"
16603fb97780Smrg		AC_MSG_RESULT([yes, with -ansi])
16613fb97780Smrg	else
16623fb97780Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
16633fb97780Smrg	fi
16643fb97780Smrgfi
16653fb97780Smrgrm -f conftest.$ac_ext
1666126a8a12Smrg
16673fb97780SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
16683fb97780SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
16696bea0e4fSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
16703fb97780Smrg	AC_MSG_RESULT([no])
16713fb97780Smrgelse
16726bea0e4fSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   "'` -eq 1 ; then
16733fb97780Smrg		TRADITIONALCPPFLAGS="-traditional"
16743fb97780Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
16753fb97780Smrg		AC_MSG_RESULT([yes])
16763fb97780Smrg	else
16773fb97780Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
16783fb97780Smrg	fi
16793fb97780Smrgfi
16803fb97780Smrgrm -f conftest.$ac_ext
16813fb97780SmrgAC_SUBST(RAWCPPFLAGS)
16823fb97780SmrgAC_SUBST(TRADITIONALCPPFLAGS)
16833fb97780Smrg]) # XORG_PROG_RAWCPP
1684126a8a12Smrg
16853fb97780Smrg# XORG_MANPAGE_SECTIONS()
16863fb97780Smrg# -----------------------
16873fb97780Smrg# Minimum version: 1.0.0
16883fb97780Smrg#
16893fb97780Smrg# Determine which sections man pages go in for the different man page types
16903fb97780Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
16913fb97780Smrg# Not sure if there's any better way than just hardcoding by OS name.
16923fb97780Smrg# Override default settings by setting environment variables
16933fb97780Smrg# Added MAN_SUBSTS in version 1.8
16943fb97780Smrg# Added AC_PROG_SED in version 1.8
1695126a8a12Smrg
16963fb97780SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
16973fb97780SmrgAC_REQUIRE([AC_CANONICAL_HOST])
16983fb97780SmrgAC_REQUIRE([AC_PROG_SED])
1699555991fdSmrg
17003fb97780Smrgcase $host_os in
17013fb97780Smrg    solaris*)
17023fb97780Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
17033fb97780Smrg        # check for a man page file found in later versions that use
17043fb97780Smrg        # traditional section numbers instead
17053fb97780Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
17063fb97780Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
17073fb97780Smrg        ;;
17083fb97780Smrg    *) SYSV_MAN_SECTIONS=false ;;
17093fb97780Smrgesac
1710126a8a12Smrg
17113fb97780Smrgif test x$APP_MAN_SUFFIX = x    ; then
17123fb97780Smrg    APP_MAN_SUFFIX=1
17133fb97780Smrgfi
17143fb97780Smrgif test x$APP_MAN_DIR = x    ; then
17153fb97780Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
17163fb97780Smrgfi
1717555991fdSmrg
17183fb97780Smrgif test x$LIB_MAN_SUFFIX = x    ; then
17193fb97780Smrg    LIB_MAN_SUFFIX=3
17203fb97780Smrgfi
17213fb97780Smrgif test x$LIB_MAN_DIR = x    ; then
17223fb97780Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
17233fb97780Smrgfi
1724126a8a12Smrg
17253fb97780Smrgif test x$FILE_MAN_SUFFIX = x    ; then
17263fb97780Smrg    case $SYSV_MAN_SECTIONS in
17273fb97780Smrg	true)				FILE_MAN_SUFFIX=4  ;;
17283fb97780Smrg	*)				FILE_MAN_SUFFIX=5  ;;
17293fb97780Smrg    esac
17303fb97780Smrgfi
17313fb97780Smrgif test x$FILE_MAN_DIR = x    ; then
17323fb97780Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
17333fb97780Smrgfi
17343c15da26Smrg
17353fb97780Smrgif test x$MISC_MAN_SUFFIX = x    ; then
17363fb97780Smrg    case $SYSV_MAN_SECTIONS in
17373fb97780Smrg	true)				MISC_MAN_SUFFIX=5  ;;
17383fb97780Smrg	*)				MISC_MAN_SUFFIX=7  ;;
17393fb97780Smrg    esac
17403fb97780Smrgfi
17413fb97780Smrgif test x$MISC_MAN_DIR = x    ; then
17423fb97780Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
17433fb97780Smrgfi
17443c15da26Smrg
17453fb97780Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
17463fb97780Smrg    case $SYSV_MAN_SECTIONS in
17473fb97780Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
17483fb97780Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
17493fb97780Smrg    esac
17503fb97780Smrgfi
17513fb97780Smrgif test x$DRIVER_MAN_DIR = x    ; then
17523fb97780Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
17533fb97780Smrgfi
17543c15da26Smrg
17553fb97780Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
17563fb97780Smrg    case $SYSV_MAN_SECTIONS in
17573fb97780Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
17583fb97780Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
17593fb97780Smrg    esac
17603fb97780Smrgfi
17613fb97780Smrgif test x$ADMIN_MAN_DIR = x    ; then
17623fb97780Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
17633fb97780Smrgfi
1764126a8a12Smrg
1765126a8a12Smrg
17663fb97780SmrgAC_SUBST([APP_MAN_SUFFIX])
17673fb97780SmrgAC_SUBST([LIB_MAN_SUFFIX])
17683fb97780SmrgAC_SUBST([FILE_MAN_SUFFIX])
17693fb97780SmrgAC_SUBST([MISC_MAN_SUFFIX])
17703fb97780SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
17713fb97780SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
17723fb97780SmrgAC_SUBST([APP_MAN_DIR])
17733fb97780SmrgAC_SUBST([LIB_MAN_DIR])
17743fb97780SmrgAC_SUBST([FILE_MAN_DIR])
17753fb97780SmrgAC_SUBST([MISC_MAN_DIR])
17763fb97780SmrgAC_SUBST([DRIVER_MAN_DIR])
17773fb97780SmrgAC_SUBST([ADMIN_MAN_DIR])
1778126a8a12Smrg
17793fb97780SmrgXORG_MAN_PAGE="X Version 11"
17803fb97780SmrgAC_SUBST([XORG_MAN_PAGE])
17813fb97780SmrgMAN_SUBSTS="\
17823fb97780Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
17833fb97780Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
17843fb97780Smrg	-e 's|__xservername__|Xorg|g' \
17853fb97780Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
17863fb97780Smrg	-e 's|__projectroot__|\$(prefix)|g' \
17873fb97780Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
17883fb97780Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
17893fb97780Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
17903fb97780Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
17913fb97780Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
17923fb97780Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
17933fb97780Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
17943fb97780SmrgAC_SUBST([MAN_SUBSTS])
1795126a8a12Smrg
17963fb97780Smrg]) # XORG_MANPAGE_SECTIONS
1797126a8a12Smrg
17983fb97780Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
17993fb97780Smrg# ------------------------
18003fb97780Smrg# Minimum version: 1.7.0
18013fb97780Smrg#
18023fb97780Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
18033fb97780Smrg# provided by xorg-sgml-doctools, if installed.
18043fb97780SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
18053fb97780SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
18063fb97780SmrgXORG_SGML_PATH=
18073fb97780SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
18083fb97780Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
18093fb97780Smrg    [m4_ifval([$1],[:],
18103fb97780Smrg        [if test x"$cross_compiling" != x"yes" ; then
18113fb97780Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
18123fb97780Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
18133fb97780Smrg         fi])
1814300346aeSmrg    ])
1815d656433aSmrg
18163fb97780Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
18173fb97780Smrg# the path and the name of the doc stylesheet
18183fb97780Smrgif test "x$XORG_SGML_PATH" != "x" ; then
18193fb97780Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
18203fb97780Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
18213fb97780Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
18223fb97780Smrgelse
18233fb97780Smrg   AC_MSG_RESULT([no])
18243fb97780Smrgfi
1825126a8a12Smrg
18263fb97780SmrgAC_SUBST(XORG_SGML_PATH)
18273fb97780SmrgAC_SUBST(STYLESHEET_SRCDIR)
18283fb97780SmrgAC_SUBST(XSL_STYLESHEET)
18293fb97780SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
18303fb97780Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1831126a8a12Smrg
18323fb97780Smrg# XORG_CHECK_LINUXDOC
18333fb97780Smrg# -------------------
18343fb97780Smrg# Minimum version: 1.0.0
18353fb97780Smrg#
18363fb97780Smrg# Defines the variable MAKE_TEXT if the necessary tools and
18373fb97780Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
18383fb97780Smrg# Whether or not the necessary tools and files are found can be checked
18393fb97780Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
18403fb97780SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
18413fb97780SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
18423fb97780SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1843126a8a12Smrg
18443fb97780SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1845126a8a12Smrg
18463fb97780SmrgAC_MSG_CHECKING([whether to build documentation])
1847126a8a12Smrg
18483fb97780Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
18493fb97780Smrg   BUILDDOC=yes
18503fb97780Smrgelse
18513fb97780Smrg   BUILDDOC=no
18523fb97780Smrgfi
1853126a8a12Smrg
18543fb97780SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1855126a8a12Smrg
18563fb97780SmrgAC_MSG_RESULT([$BUILDDOC])
1857126a8a12Smrg
18583fb97780SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1859126a8a12Smrg
18603fb97780Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
18613fb97780Smrg   BUILDPDFDOC=yes
1862300346aeSmrgelse
18633fb97780Smrg   BUILDPDFDOC=no
1864300346aeSmrgfi
1865126a8a12Smrg
18663fb97780SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1867126a8a12Smrg
18683fb97780SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1869126a8a12Smrg
18703fb97780SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
18713fb97780SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
18723fb97780SmrgMAKE_PDF="$PS2PDF"
18733fb97780SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1874126a8a12Smrg
18753fb97780SmrgAC_SUBST(MAKE_TEXT)
18763fb97780SmrgAC_SUBST(MAKE_PS)
18773fb97780SmrgAC_SUBST(MAKE_PDF)
18783fb97780SmrgAC_SUBST(MAKE_HTML)
18793fb97780Smrg]) # XORG_CHECK_LINUXDOC
1880126a8a12Smrg
18813fb97780Smrg# XORG_CHECK_DOCBOOK
18823fb97780Smrg# -------------------
18833fb97780Smrg# Minimum version: 1.0.0
18843fb97780Smrg#
18853fb97780Smrg# Checks for the ability to build output formats from SGML DocBook source.
18863fb97780Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
18873fb97780Smrg# indicates whether the necessary tools and files are found and, if set,
18883fb97780Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
18893fb97780SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
18903fb97780SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1891555991fdSmrg
18923fb97780SmrgBUILDTXTDOC=no
18933fb97780SmrgBUILDPDFDOC=no
18943fb97780SmrgBUILDPSDOC=no
18953fb97780SmrgBUILDHTMLDOC=no
1896555991fdSmrg
18973fb97780SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
18983fb97780SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
18993fb97780SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
19003fb97780SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1901555991fdSmrg
19023fb97780SmrgAC_MSG_CHECKING([whether to build text documentation])
19033fb97780Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
19043fb97780Smrg   test x$BUILD_TXTDOC != xno; then
19053fb97780Smrg	BUILDTXTDOC=yes
19063fb97780Smrgfi
19073fb97780SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
19083fb97780SmrgAC_MSG_RESULT([$BUILDTXTDOC])
1909126a8a12Smrg
19103fb97780SmrgAC_MSG_CHECKING([whether to build PDF documentation])
19113fb97780Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
19123fb97780Smrg   test x$BUILD_PDFDOC != xno; then
19133fb97780Smrg	BUILDPDFDOC=yes
19143fb97780Smrgfi
19153fb97780SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
19163fb97780SmrgAC_MSG_RESULT([$BUILDPDFDOC])
1917126a8a12Smrg
19183fb97780SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
19193fb97780Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
19203fb97780Smrg   test x$BUILD_PSDOC != xno; then
19213fb97780Smrg	BUILDPSDOC=yes
19223fb97780Smrgfi
19233fb97780SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
19243fb97780SmrgAC_MSG_RESULT([$BUILDPSDOC])
1925126a8a12Smrg
19263fb97780SmrgAC_MSG_CHECKING([whether to build HTML documentation])
19273fb97780Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
19283fb97780Smrg   test x$BUILD_HTMLDOC != xno; then
19293fb97780Smrg	BUILDHTMLDOC=yes
19303fb97780Smrgfi
19313fb97780SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
19323fb97780SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
1933126a8a12Smrg
19343fb97780SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
19353fb97780SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
19363fb97780SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
19373fb97780SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1938126a8a12Smrg
19393fb97780SmrgAC_SUBST(MAKE_TEXT)
19403fb97780SmrgAC_SUBST(MAKE_PS)
19413fb97780SmrgAC_SUBST(MAKE_PDF)
19423fb97780SmrgAC_SUBST(MAKE_HTML)
19433fb97780Smrg]) # XORG_CHECK_DOCBOOK
1944126a8a12Smrg
19453fb97780Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
19463fb97780Smrg# ----------------
19473fb97780Smrg# Minimum version: 1.5.0
19483fb97780Smrg# Minimum version for optional DEFAULT argument: 1.11.0
19493fb97780Smrg#
19503fb97780Smrg# Documentation tools are not always available on all platforms and sometimes
19513fb97780Smrg# not at the appropriate level. This macro enables a module to test for the
19523fb97780Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
19533fb97780Smrg# the --with-xmlto option, it allows maximum flexibility in making decisions
19543fb97780Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
19553fb97780Smrg# --with-xmlto assumes 'auto'.
19563fb97780Smrg#
19573fb97780Smrg# Interface to module:
19583fb97780Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
19593fb97780Smrg# XMLTO:	returns the path of the xmlto program found
19603fb97780Smrg#		returns the path set by the user in the environment
19613fb97780Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
19623fb97780Smrg#		'no' user instructs the module not to use xmlto
19633fb97780Smrg#
19643fb97780Smrg# Added in version 1.10.0
19653fb97780Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
19663fb97780Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
19673fb97780Smrg#
19683fb97780Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
19693fb97780Smrg#
19703fb97780SmrgAC_DEFUN([XORG_WITH_XMLTO],[
19713fb97780SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
19723fb97780Smrgm4_define([_defopt], m4_default([$2], [auto]))
19733fb97780SmrgAC_ARG_WITH(xmlto,
19743fb97780Smrg	AS_HELP_STRING([--with-xmlto],
19753fb97780Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
19763fb97780Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
19773fb97780Smrgm4_undefine([_defopt])
1978126a8a12Smrg
19793fb97780Smrgif test "x$use_xmlto" = x"auto"; then
19803fb97780Smrg   AC_PATH_PROG([XMLTO], [xmlto])
19813fb97780Smrg   if test "x$XMLTO" = "x"; then
19823fb97780Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
19833fb97780Smrg	have_xmlto=no
19843fb97780Smrg   else
19853fb97780Smrg        have_xmlto=yes
19863fb97780Smrg   fi
19873fb97780Smrgelif test "x$use_xmlto" = x"yes" ; then
19883fb97780Smrg   AC_PATH_PROG([XMLTO], [xmlto])
19893fb97780Smrg   if test "x$XMLTO" = "x"; then
19903fb97780Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
19913fb97780Smrg   fi
19923fb97780Smrg   have_xmlto=yes
19933fb97780Smrgelif test "x$use_xmlto" = x"no" ; then
19943fb97780Smrg   if test "x$XMLTO" != "x"; then
19953fb97780Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
19963fb97780Smrg   fi
19973fb97780Smrg   have_xmlto=no
1998300346aeSmrgelse
19993fb97780Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
2000300346aeSmrgfi
2001126a8a12Smrg
20023fb97780Smrg# Test for a minimum version of xmlto, if provided.
20033fb97780Smrgm4_ifval([$1],
20043fb97780Smrg[if test "$have_xmlto" = yes; then
20053fb97780Smrg    # scrape the xmlto version
20063fb97780Smrg    AC_MSG_CHECKING([the xmlto version])
20073fb97780Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
20083fb97780Smrg    AC_MSG_RESULT([$xmlto_version])
20093fb97780Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
20103fb97780Smrg        [if test "x$use_xmlto" = xauto; then
20113fb97780Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
20123fb97780Smrg            have_xmlto=no
20133fb97780Smrg        else
20143fb97780Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
20153fb97780Smrg        fi])
20163fb97780Smrgfi])
2017126a8a12Smrg
20183fb97780Smrg# Test for the ability of xmlto to generate a text target
20193fb97780Smrg#
20203fb97780Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
20213fb97780Smrg# following test for empty XML docbook files.
20223fb97780Smrg# For compatibility reasons use the following empty XML docbook file and if
20233fb97780Smrg# it fails try it again with a non-empty XML file.
20243fb97780Smrghave_xmlto_text=no
20253fb97780Smrgcat > conftest.xml << "EOF"
20263fb97780SmrgEOF
20273fb97780SmrgAS_IF([test "$have_xmlto" = yes],
20283fb97780Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
20293fb97780Smrg             [have_xmlto_text=yes],
20303fb97780Smrg             [# Try it again with a non-empty XML file.
20313fb97780Smrg              cat > conftest.xml << "EOF"
20323fb97780Smrg<x></x>
20333fb97780SmrgEOF
20343fb97780Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
20353fb97780Smrg                    [have_xmlto_text=yes],
20363fb97780Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
20373fb97780Smrgrm -f conftest.xml
20383fb97780SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
20393fb97780SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
20403fb97780Smrg]) # XORG_WITH_XMLTO
2041126a8a12Smrg
20423fb97780Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
20433fb97780Smrg# --------------------------------------------
20443fb97780Smrg# Minimum version: 1.12.0
20453fb97780Smrg# Minimum version for optional DEFAULT argument: 1.12.0
20463fb97780Smrg#
20473fb97780Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
20483fb97780Smrg# XML-based language used for the transformation of XML documents.
20493fb97780Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
20503fb97780Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
20513fb97780Smrg# The XSLT processor is often used as a standalone tool for transformations.
20523fb97780Smrg# It should not be assumed that this tool is used only to work with documnetation.
20533fb97780Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
20543fb97780Smrg#
20553fb97780Smrg# Interface to module:
20563fb97780Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
20573fb97780Smrg# XSLTPROC:	 returns the path of the xsltproc program found
20583fb97780Smrg#		 returns the path set by the user in the environment
20593fb97780Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
20603fb97780Smrg#		  'no' user instructs the module not to use xsltproc
20613fb97780Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
20623fb97780Smrg#
20633fb97780Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
20643fb97780Smrg#
20653fb97780SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
20663fb97780SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
20673fb97780Smrg# Preserves the interface, should it be implemented later
20683fb97780Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
20693fb97780Smrgm4_define([_defopt], m4_default([$2], [auto]))
20703fb97780SmrgAC_ARG_WITH(xsltproc,
20713fb97780Smrg	AS_HELP_STRING([--with-xsltproc],
20723fb97780Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
20733fb97780Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
20743fb97780Smrgm4_undefine([_defopt])
2075126a8a12Smrg
20763fb97780Smrgif test "x$use_xsltproc" = x"auto"; then
20773fb97780Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
20783fb97780Smrg   if test "x$XSLTPROC" = "x"; then
20793fb97780Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
20803fb97780Smrg	have_xsltproc=no
20813fb97780Smrg   else
20823fb97780Smrg        have_xsltproc=yes
2083300346aeSmrg   fi
20843fb97780Smrgelif test "x$use_xsltproc" = x"yes" ; then
20853fb97780Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
20863fb97780Smrg   if test "x$XSLTPROC" = "x"; then
20873fb97780Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
20883fb97780Smrg   fi
20893fb97780Smrg   have_xsltproc=yes
20903fb97780Smrgelif test "x$use_xsltproc" = x"no" ; then
20913fb97780Smrg   if test "x$XSLTPROC" != "x"; then
20923fb97780Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
20933fb97780Smrg   fi
20943fb97780Smrg   have_xsltproc=no
2095300346aeSmrgelse
20963fb97780Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
2097300346aeSmrgfi
2098d656433aSmrg
20993fb97780SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
21003fb97780Smrg]) # XORG_WITH_XSLTPROC
2101d656433aSmrg
21023fb97780Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
21033fb97780Smrg# ----------------------------------------
21043fb97780Smrg# Minimum version: 1.15.0
21053fb97780Smrg#
21063fb97780Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
21073fb97780Smrg# scanning arbitrary text files, extracting information from those text files,
21083fb97780Smrg# and printing reports based on that information.
21093fb97780Smrg#
21103fb97780Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
21113fb97780Smrg#
21123fb97780Smrg# Interface to module:
21133fb97780Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
21143fb97780Smrg# PERL:	     returns the path of the perl program found
21153fb97780Smrg#	     returns the path set by the user in the environment
21163fb97780Smrg# --with-perl: 'yes' user instructs the module to use perl
21173fb97780Smrg#	       'no' user instructs the module not to use perl
21183fb97780Smrg# have_perl: returns yes if perl found in PATH or no
21193fb97780Smrg#
21203fb97780Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
21213fb97780Smrg#
21223fb97780SmrgAC_DEFUN([XORG_WITH_PERL],[
21233fb97780SmrgAC_ARG_VAR([PERL], [Path to perl command])
21243fb97780Smrg# Preserves the interface, should it be implemented later
21253fb97780Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
21263fb97780Smrgm4_define([_defopt], m4_default([$2], [auto]))
21273fb97780SmrgAC_ARG_WITH(perl,
21283fb97780Smrg	AS_HELP_STRING([--with-perl],
21293fb97780Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
21303fb97780Smrg	   [use_perl=$withval], [use_perl=]_defopt)
21313fb97780Smrgm4_undefine([_defopt])
2132126a8a12Smrg
21333fb97780Smrgif test "x$use_perl" = x"auto"; then
21343fb97780Smrg   AC_PATH_PROG([PERL], [perl])
21353fb97780Smrg   if test "x$PERL" = "x"; then
21363fb97780Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
21373fb97780Smrg	have_perl=no
21383fb97780Smrg   else
21393fb97780Smrg        have_perl=yes
2140300346aeSmrg   fi
21413fb97780Smrgelif test "x$use_perl" = x"yes" ; then
21423fb97780Smrg   AC_PATH_PROG([PERL], [perl])
21433fb97780Smrg   if test "x$PERL" = "x"; then
21443fb97780Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
21453fb97780Smrg   fi
21463fb97780Smrg   have_perl=yes
21473fb97780Smrgelif test "x$use_perl" = x"no" ; then
21483fb97780Smrg   if test "x$PERL" != "x"; then
21493fb97780Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
21503fb97780Smrg   fi
21513fb97780Smrg   have_perl=no
2152300346aeSmrgelse
21533fb97780Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
21543c15da26Smrgfi
2155126a8a12Smrg
21563fb97780SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
21573fb97780Smrg]) # XORG_WITH_PERL
2158d656433aSmrg
21593fb97780Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
21603fb97780Smrg# ----------------
21613fb97780Smrg# Minimum version: 1.5.0
21623fb97780Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21633fb97780Smrg#
21643fb97780Smrg# Documentation tools are not always available on all platforms and sometimes
21653fb97780Smrg# not at the appropriate level. This macro enables a module to test for the
21663fb97780Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21673fb97780Smrg# the --with-asciidoc option, it allows maximum flexibility in making decisions
21683fb97780Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
21693fb97780Smrg# --with-asciidoc assumes 'auto'.
21703fb97780Smrg#
21713fb97780Smrg# Interface to module:
21723fb97780Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
21733fb97780Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
21743fb97780Smrg#		 returns the path set by the user in the environment
21753fb97780Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
21763fb97780Smrg#		  'no' user instructs the module not to use asciidoc
21773fb97780Smrg#
21783fb97780Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
21793fb97780Smrg#
21803fb97780SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
21813fb97780SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
21823fb97780Smrgm4_define([_defopt], m4_default([$2], [auto]))
21833fb97780SmrgAC_ARG_WITH(asciidoc,
21843fb97780Smrg	AS_HELP_STRING([--with-asciidoc],
21853fb97780Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
21863fb97780Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
21873fb97780Smrgm4_undefine([_defopt])
2188126a8a12Smrg
21893fb97780Smrgif test "x$use_asciidoc" = x"auto"; then
21903fb97780Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
21913fb97780Smrg   if test "x$ASCIIDOC" = "x"; then
21923fb97780Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
21933fb97780Smrg	have_asciidoc=no
21943fb97780Smrg   else
21953fb97780Smrg        have_asciidoc=yes
21963fb97780Smrg   fi
21973fb97780Smrgelif test "x$use_asciidoc" = x"yes" ; then
21983fb97780Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
21993fb97780Smrg   if test "x$ASCIIDOC" = "x"; then
22003fb97780Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
22013fb97780Smrg   fi
22023fb97780Smrg   have_asciidoc=yes
22033fb97780Smrgelif test "x$use_asciidoc" = x"no" ; then
22043fb97780Smrg   if test "x$ASCIIDOC" != "x"; then
22053fb97780Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
22063fb97780Smrg   fi
22073fb97780Smrg   have_asciidoc=no
22083fb97780Smrgelse
22093fb97780Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
22103fb97780Smrgfi
22113fb97780Smrgm4_ifval([$1],
22123fb97780Smrg[if test "$have_asciidoc" = yes; then
22133fb97780Smrg    # scrape the asciidoc version
22143fb97780Smrg    AC_MSG_CHECKING([the asciidoc version])
22153fb97780Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
22163fb97780Smrg    AC_MSG_RESULT([$asciidoc_version])
22173fb97780Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
22183fb97780Smrg        [if test "x$use_asciidoc" = xauto; then
22193fb97780Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
22203fb97780Smrg            have_asciidoc=no
22213fb97780Smrg        else
22223fb97780Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
22233fb97780Smrg        fi])
22243fb97780Smrgfi])
22253fb97780SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
22263fb97780Smrg]) # XORG_WITH_ASCIIDOC
2227d656433aSmrg
22283fb97780Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
22293fb97780Smrg# -------------------------------------------
22303fb97780Smrg# Minimum version: 1.5.0
22313fb97780Smrg# Minimum version for optional DEFAULT argument: 1.11.0
22323fb97780Smrg# Minimum version for optional DOT checking: 1.18.0
22333fb97780Smrg#
22343fb97780Smrg# Documentation tools are not always available on all platforms and sometimes
22353fb97780Smrg# not at the appropriate level. This macro enables a module to test for the
22363fb97780Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22373fb97780Smrg# the --with-doxygen option, it allows maximum flexibility in making decisions
22383fb97780Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
22393fb97780Smrg# --with-doxygen assumes 'auto'.
22403fb97780Smrg#
22413fb97780Smrg# Interface to module:
22423fb97780Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
22433fb97780Smrg# DOXYGEN:	 returns the path of the doxygen program found
22443fb97780Smrg#		 returns the path set by the user in the environment
22453fb97780Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
22463fb97780Smrg#		  'no' user instructs the module not to use doxygen
22473fb97780Smrg#
22483fb97780Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
22493fb97780Smrg#
22503fb97780SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
22513fb97780SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
22523fb97780SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
22533fb97780Smrgm4_define([_defopt], m4_default([$2], [auto]))
22543fb97780SmrgAC_ARG_WITH(doxygen,
22553fb97780Smrg	AS_HELP_STRING([--with-doxygen],
22563fb97780Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
22573fb97780Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
22583fb97780Smrgm4_undefine([_defopt])
2259d656433aSmrg
22603fb97780Smrgif test "x$use_doxygen" = x"auto"; then
22613fb97780Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
22623fb97780Smrg   if test "x$DOXYGEN" = "x"; then
22633fb97780Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
22643fb97780Smrg	have_doxygen=no
22653fb97780Smrg   else
22663fb97780Smrg        have_doxygen=yes
22673fb97780Smrg   fi
22683fb97780Smrgelif test "x$use_doxygen" = x"yes" ; then
22693fb97780Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
22703fb97780Smrg   if test "x$DOXYGEN" = "x"; then
22713fb97780Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
22723fb97780Smrg   fi
22733fb97780Smrg   have_doxygen=yes
22743fb97780Smrgelif test "x$use_doxygen" = x"no" ; then
22753fb97780Smrg   if test "x$DOXYGEN" != "x"; then
22763fb97780Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
22773fb97780Smrg   fi
22783fb97780Smrg   have_doxygen=no
22793fb97780Smrgelse
22803fb97780Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
22813fb97780Smrgfi
22823fb97780Smrgm4_ifval([$1],
22833fb97780Smrg[if test "$have_doxygen" = yes; then
22843fb97780Smrg    # scrape the doxygen version
22853fb97780Smrg    AC_MSG_CHECKING([the doxygen version])
22863fb97780Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
22873fb97780Smrg    AC_MSG_RESULT([$doxygen_version])
22883fb97780Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
22893fb97780Smrg        [if test "x$use_doxygen" = xauto; then
22903fb97780Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
22913fb97780Smrg            have_doxygen=no
22923fb97780Smrg        else
22933fb97780Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
22943fb97780Smrg        fi])
22953fb97780Smrgfi])
2296d656433aSmrg
22973fb97780Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
22983fb97780Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
22993fb97780Smrgdnl 	HAVE_DOT = @HAVE_DOT@
23003fb97780SmrgHAVE_DOT=no
23013fb97780Smrgif test "x$have_doxygen" = "xyes"; then
23023fb97780Smrg  AC_PATH_PROG([DOT], [dot])
23033fb97780Smrg    if test "x$DOT" != "x"; then
23043fb97780Smrg      HAVE_DOT=yes
2305300346aeSmrg    fi
23063fb97780Smrgfi
2307126a8a12Smrg
23083fb97780SmrgAC_SUBST([HAVE_DOT])
23093fb97780SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
23103fb97780SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
23113fb97780Smrg]) # XORG_WITH_DOXYGEN
2312126a8a12Smrg
23133fb97780Smrg# XORG_WITH_GROFF([DEFAULT])
23143fb97780Smrg# ----------------
23153fb97780Smrg# Minimum version: 1.6.0
23163fb97780Smrg# Minimum version for optional DEFAULT argument: 1.11.0
23173fb97780Smrg#
23183fb97780Smrg# Documentation tools are not always available on all platforms and sometimes
23193fb97780Smrg# not at the appropriate level. This macro enables a module to test for the
23203fb97780Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
23213fb97780Smrg# the --with-groff option, it allows maximum flexibility in making decisions
23223fb97780Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
23233fb97780Smrg# --with-groff assumes 'auto'.
23243fb97780Smrg#
23253fb97780Smrg# Interface to module:
23263fb97780Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
23273fb97780Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
23283fb97780Smrg# HAVE_GROFF_MS: the -ms macros package
23293fb97780Smrg# GROFF:	 returns the path of the groff program found
23303fb97780Smrg#		 returns the path set by the user in the environment
23313fb97780Smrg# --with-groff:	 'yes' user instructs the module to use groff
23323fb97780Smrg#		 'no' user instructs the module not to use groff
23333fb97780Smrg#
23343fb97780Smrg# Added in version 1.9.0:
23353fb97780Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
23363fb97780Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
23373fb97780Smrg#		   psselect from the psutils package.
23383fb97780Smrg#		   the ghostcript package. Refer to the grohtml man pages
23393fb97780Smrg#
23403fb97780Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
23413fb97780Smrg#
23423fb97780Smrg# OS and distros often splits groff in a basic and full package, the former
23433fb97780Smrg# having the groff program and the later having devices, fonts and macros
23443fb97780Smrg# Checking for the groff executable is not enough.
23453fb97780Smrg#
23463fb97780Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
23473fb97780Smrg# unset HAVE_GROFF or GROFF env variables.
23483fb97780Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
23493fb97780Smrg#
23503fb97780SmrgAC_DEFUN([XORG_WITH_GROFF],[
23513fb97780SmrgAC_ARG_VAR([GROFF], [Path to groff command])
23523fb97780Smrgm4_define([_defopt], m4_default([$1], [auto]))
23533fb97780SmrgAC_ARG_WITH(groff,
23543fb97780Smrg	AS_HELP_STRING([--with-groff],
23553fb97780Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
23563fb97780Smrg	   [use_groff=$withval], [use_groff=]_defopt)
23573fb97780Smrgm4_undefine([_defopt])
23583fb97780Smrg
23593fb97780Smrgif test "x$use_groff" = x"auto"; then
23603fb97780Smrg   AC_PATH_PROG([GROFF], [groff])
23613fb97780Smrg   if test "x$GROFF" = "x"; then
23623fb97780Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
23633fb97780Smrg	have_groff=no
23643fb97780Smrg   else
23653fb97780Smrg        have_groff=yes
23663fb97780Smrg   fi
23673fb97780Smrgelif test "x$use_groff" = x"yes" ; then
23683fb97780Smrg   AC_PATH_PROG([GROFF], [groff])
23693fb97780Smrg   if test "x$GROFF" = "x"; then
23703fb97780Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
23713fb97780Smrg   fi
23723fb97780Smrg   have_groff=yes
23733fb97780Smrgelif test "x$use_groff" = x"no" ; then
23743fb97780Smrg   if test "x$GROFF" != "x"; then
23753fb97780Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
23763fb97780Smrg   fi
23773fb97780Smrg   have_groff=no
2378300346aeSmrgelse
23793fb97780Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
23800a6b08f8Smrgfi
23810a6b08f8Smrg
23823fb97780Smrg# We have groff, test for the presence of the macro packages
23833fb97780Smrgif test "x$have_groff" = x"yes"; then
23843fb97780Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
23853fb97780Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
23863fb97780Smrg        groff_ms_works=yes
23873fb97780Smrg    else
23883fb97780Smrg        groff_ms_works=no
23893fb97780Smrg    fi
23903fb97780Smrg    AC_MSG_RESULT([$groff_ms_works])
23913fb97780Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
23923fb97780Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
23933fb97780Smrg        groff_mm_works=yes
23943fb97780Smrg    else
23953fb97780Smrg        groff_mm_works=no
23963fb97780Smrg    fi
23973fb97780Smrg    AC_MSG_RESULT([$groff_mm_works])
23983fb97780Smrgfi
23990a6b08f8Smrg
24003fb97780Smrg# We have groff, test for HTML dependencies, one command per package
24013fb97780Smrgif test "x$have_groff" = x"yes"; then
24023fb97780Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
24033fb97780Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
24043fb97780Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
24053fb97780Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
24063fb97780Smrg      have_groff_html=yes
24073fb97780Smrg   else
24083fb97780Smrg      have_groff_html=no
24093fb97780Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
24103fb97780Smrg   fi
24113fb97780Smrgfi
2412126a8a12Smrg
24133fb97780Smrg# Set Automake conditionals for Makefiles
24143fb97780SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
24153fb97780SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
24163fb97780SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
24173fb97780SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
24183fb97780Smrg]) # XORG_WITH_GROFF
2419d656433aSmrg
24203fb97780Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
24213fb97780Smrg# ---------------------------------------
24223fb97780Smrg# Minimum version: 1.6.0
24233fb97780Smrg# Minimum version for optional DEFAULT argument: 1.11.0
24243fb97780Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
24253fb97780Smrg#
24263fb97780Smrg# Documentation tools are not always available on all platforms and sometimes
24273fb97780Smrg# not at the appropriate level. This macro enables a module to test for the
24283fb97780Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
24293fb97780Smrg# the --with-fop option, it allows maximum flexibility in making decisions
24303fb97780Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
24313fb97780Smrg# --with-fop assumes 'auto'.
24323fb97780Smrg#
24333fb97780Smrg# Interface to module:
24343fb97780Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
24353fb97780Smrg# FOP:	 	returns the path of the fop program found
24363fb97780Smrg#		returns the path set by the user in the environment
24373fb97780Smrg# --with-fop: 	'yes' user instructs the module to use fop
24383fb97780Smrg#		'no' user instructs the module not to use fop
24393fb97780Smrg#
24403fb97780Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
24413fb97780Smrg#
24423fb97780SmrgAC_DEFUN([XORG_WITH_FOP],[
24433fb97780SmrgAC_ARG_VAR([FOP], [Path to fop command])
24443fb97780Smrgm4_define([_defopt], m4_default([$2], [auto]))
24453fb97780SmrgAC_ARG_WITH(fop,
24463fb97780Smrg	AS_HELP_STRING([--with-fop],
24473fb97780Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
24483fb97780Smrg	   [use_fop=$withval], [use_fop=]_defopt)
24493fb97780Smrgm4_undefine([_defopt])
2450d656433aSmrg
24513fb97780Smrgif test "x$use_fop" = x"auto"; then
24523fb97780Smrg   AC_PATH_PROG([FOP], [fop])
24533fb97780Smrg   if test "x$FOP" = "x"; then
24543fb97780Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
24553fb97780Smrg	have_fop=no
24563fb97780Smrg   else
24573fb97780Smrg        have_fop=yes
24583fb97780Smrg   fi
24593fb97780Smrgelif test "x$use_fop" = x"yes" ; then
24603fb97780Smrg   AC_PATH_PROG([FOP], [fop])
24613fb97780Smrg   if test "x$FOP" = "x"; then
24623fb97780Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
24633fb97780Smrg   fi
24643fb97780Smrg   have_fop=yes
24653fb97780Smrgelif test "x$use_fop" = x"no" ; then
24663fb97780Smrg   if test "x$FOP" != "x"; then
24673fb97780Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
24683fb97780Smrg   fi
24693fb97780Smrg   have_fop=no
2470300346aeSmrgelse
24713fb97780Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
24723fb97780Smrgfi
2473126a8a12Smrg
24743fb97780Smrg# Test for a minimum version of fop, if provided.
24753fb97780Smrgm4_ifval([$1],
24763fb97780Smrg[if test "$have_fop" = yes; then
24773fb97780Smrg    # scrape the fop version
24783fb97780Smrg    AC_MSG_CHECKING([for fop minimum version])
24793fb97780Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
24803fb97780Smrg    AC_MSG_RESULT([$fop_version])
24813fb97780Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
24823fb97780Smrg        [if test "x$use_fop" = xauto; then
24833fb97780Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
24843fb97780Smrg            have_fop=no
24853fb97780Smrg        else
24863fb97780Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
24873fb97780Smrg        fi])
24883fb97780Smrgfi])
24893fb97780SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
24903fb97780Smrg]) # XORG_WITH_FOP
24910a6b08f8Smrg
24923fb97780Smrg# XORG_WITH_M4([MIN-VERSION])
24933fb97780Smrg# ---------------------------
24943fb97780Smrg# Minimum version: 1.19.0
24953fb97780Smrg#
24963fb97780Smrg# This macro attempts to locate an m4 macro processor which supports
24973fb97780Smrg# -I option and is only useful for modules relying on M4 in order to
24983fb97780Smrg# expand macros in source code files.
24993fb97780Smrg#
25003fb97780Smrg# Interface to module:
25013fb97780Smrg# M4:	 	returns the path of the m4 program found
25023fb97780Smrg#		returns the path set by the user in the environment
25033fb97780Smrg#
25043fb97780SmrgAC_DEFUN([XORG_WITH_M4], [
25053fb97780SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
25063fb97780Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
25073fb97780Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
25083fb97780Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
25093fb97780Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
25103fb97780Smrg   [$PATH:/usr/gnu/bin])])
2511126a8a12Smrg
25123fb97780SmrgAC_SUBST([M4], [$ac_cv_path_M4])
25133fb97780Smrg]) # XORG_WITH_M4
2514126a8a12Smrg
25153fb97780Smrg# XORG_WITH_PS2PDF([DEFAULT])
25163fb97780Smrg# ----------------
25173fb97780Smrg# Minimum version: 1.6.0
25183fb97780Smrg# Minimum version for optional DEFAULT argument: 1.11.0
25193fb97780Smrg#
25203fb97780Smrg# Documentation tools are not always available on all platforms and sometimes
25213fb97780Smrg# not at the appropriate level. This macro enables a module to test for the
25223fb97780Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
25233fb97780Smrg# the --with-ps2pdf option, it allows maximum flexibility in making decisions
25243fb97780Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
25253fb97780Smrg# --with-ps2pdf assumes 'auto'.
25263fb97780Smrg#
25273fb97780Smrg# Interface to module:
25283fb97780Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
25293fb97780Smrg# PS2PDF:	returns the path of the ps2pdf program found
25303fb97780Smrg#		returns the path set by the user in the environment
25313fb97780Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
25323fb97780Smrg#		 'no' user instructs the module not to use ps2pdf
25333fb97780Smrg#
25343fb97780Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
25353fb97780Smrg#
25363fb97780SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
25373fb97780SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
25383fb97780Smrgm4_define([_defopt], m4_default([$1], [auto]))
25393fb97780SmrgAC_ARG_WITH(ps2pdf,
25403fb97780Smrg	AS_HELP_STRING([--with-ps2pdf],
25413fb97780Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
25423fb97780Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
25433fb97780Smrgm4_undefine([_defopt])
2544126a8a12Smrg
25453fb97780Smrgif test "x$use_ps2pdf" = x"auto"; then
25463fb97780Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
25473fb97780Smrg   if test "x$PS2PDF" = "x"; then
25483fb97780Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
25493fb97780Smrg	have_ps2pdf=no
25503fb97780Smrg   else
25513fb97780Smrg        have_ps2pdf=yes
25523fb97780Smrg   fi
25533fb97780Smrgelif test "x$use_ps2pdf" = x"yes" ; then
25543fb97780Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
25553fb97780Smrg   if test "x$PS2PDF" = "x"; then
25563fb97780Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
25573fb97780Smrg   fi
25583fb97780Smrg   have_ps2pdf=yes
25593fb97780Smrgelif test "x$use_ps2pdf" = x"no" ; then
25603fb97780Smrg   if test "x$PS2PDF" != "x"; then
25613fb97780Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
25623fb97780Smrg   fi
25633fb97780Smrg   have_ps2pdf=no
25643fb97780Smrgelse
25653fb97780Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2566300346aeSmrgfi
25673fb97780SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
25683fb97780Smrg]) # XORG_WITH_PS2PDF
2569126a8a12Smrg
25703fb97780Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
25713fb97780Smrg# ----------------
25723fb97780Smrg# Minimum version: 1.6.0
25733fb97780Smrg#
25743fb97780Smrg# Documentation tools are not always available on all platforms and sometimes
25753fb97780Smrg# not at the appropriate level. This macro enables a builder to skip all
25763fb97780Smrg# documentation targets except traditional man pages.
25773fb97780Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
25783fb97780Smrg# maximum flexibility in controlling documentation building.
25793fb97780Smrg# Refer to:
25803fb97780Smrg# XORG_WITH_XMLTO         --with-xmlto
25813fb97780Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
25823fb97780Smrg# XORG_WITH_DOXYGEN       --with-doxygen
25833fb97780Smrg# XORG_WITH_FOP           --with-fop
25843fb97780Smrg# XORG_WITH_GROFF         --with-groff
25853fb97780Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
25863fb97780Smrg#
25873fb97780Smrg# Interface to module:
25883fb97780Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
25893fb97780Smrg# --enable-docs: 'yes' user instructs the module to generate docs
25903fb97780Smrg#		 'no' user instructs the module not to generate docs
25913fb97780Smrg# parm1:	specify the default value, yes or no.
25923fb97780Smrg#
25933fb97780SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
25943fb97780Smrgm4_define([docs_default], m4_default([$1], [yes]))
25953fb97780SmrgAC_ARG_ENABLE(docs,
25963fb97780Smrg	AS_HELP_STRING([--enable-docs],
25973fb97780Smrg	   [Enable building the documentation (default: ]docs_default[)]),
25983fb97780Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
25993fb97780Smrgm4_undefine([docs_default])
26003fb97780SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
26013fb97780SmrgAC_MSG_CHECKING([whether to build documentation])
26023fb97780SmrgAC_MSG_RESULT([$build_docs])
26033fb97780Smrg]) # XORG_ENABLE_DOCS
2604126a8a12Smrg
26053fb97780Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
26063fb97780Smrg# ----------------
26073fb97780Smrg# Minimum version: 1.6.0
26083fb97780Smrg#
26093fb97780Smrg# This macro enables a builder to skip all developer documentation.
26103fb97780Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
26113fb97780Smrg# maximum flexibility in controlling documentation building.
26123fb97780Smrg# Refer to:
26133fb97780Smrg# XORG_WITH_XMLTO         --with-xmlto
26143fb97780Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
26153fb97780Smrg# XORG_WITH_DOXYGEN       --with-doxygen
26163fb97780Smrg# XORG_WITH_FOP           --with-fop
26173fb97780Smrg# XORG_WITH_GROFF         --with-groff
26183fb97780Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
26193fb97780Smrg#
26203fb97780Smrg# Interface to module:
26213fb97780Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
26223fb97780Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
26233fb97780Smrg#			'no' user instructs the module not to generate developer docs
26243fb97780Smrg# parm1:		specify the default value, yes or no.
26253fb97780Smrg#
26263fb97780SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
26273fb97780Smrgm4_define([devel_default], m4_default([$1], [yes]))
26283fb97780SmrgAC_ARG_ENABLE(devel-docs,
26293fb97780Smrg	AS_HELP_STRING([--enable-devel-docs],
26303fb97780Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
26313fb97780Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
26323fb97780Smrgm4_undefine([devel_default])
26333fb97780SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
26343fb97780SmrgAC_MSG_CHECKING([whether to build developer documentation])
26353fb97780SmrgAC_MSG_RESULT([$build_devel_docs])
26363fb97780Smrg]) # XORG_ENABLE_DEVEL_DOCS
2637126a8a12Smrg
26383fb97780Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
26393fb97780Smrg# ----------------
26403fb97780Smrg# Minimum version: 1.6.0
26413fb97780Smrg#
26423fb97780Smrg# This macro enables a builder to skip all functional specification targets.
26433fb97780Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
26443fb97780Smrg# maximum flexibility in controlling documentation building.
26453fb97780Smrg# Refer to:
26463fb97780Smrg# XORG_WITH_XMLTO         --with-xmlto
26473fb97780Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
26483fb97780Smrg# XORG_WITH_DOXYGEN       --with-doxygen
26493fb97780Smrg# XORG_WITH_FOP           --with-fop
26503fb97780Smrg# XORG_WITH_GROFF         --with-groff
26513fb97780Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
26523fb97780Smrg#
26533fb97780Smrg# Interface to module:
26543fb97780Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
26553fb97780Smrg# --enable-specs:	'yes' user instructs the module to generate specs
26563fb97780Smrg#			'no' user instructs the module not to generate specs
26573fb97780Smrg# parm1:		specify the default value, yes or no.
26583fb97780Smrg#
26593fb97780SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
26603fb97780Smrgm4_define([spec_default], m4_default([$1], [yes]))
26613fb97780SmrgAC_ARG_ENABLE(specs,
26623fb97780Smrg	AS_HELP_STRING([--enable-specs],
26633fb97780Smrg	   [Enable building the specs (default: ]spec_default[)]),
26643fb97780Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
26653fb97780Smrgm4_undefine([spec_default])
26663fb97780SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
26673fb97780SmrgAC_MSG_CHECKING([whether to build functional specifications])
26683fb97780SmrgAC_MSG_RESULT([$build_specs])
26693fb97780Smrg]) # XORG_ENABLE_SPECS
2670126a8a12Smrg
26713fb97780Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
26723fb97780Smrg# ----------------------------------------------
26733fb97780Smrg# Minimum version: 1.13.0
26743fb97780Smrg#
26753fb97780Smrg# This macro enables a builder to enable/disable unit testing
26763fb97780Smrg# It makes no assumption about the test cases implementation
26773fb97780Smrg# Test cases may or may not use Automake "Support for test suites"
26783fb97780Smrg# They may or may not use the software utility library GLib
26793fb97780Smrg#
26803fb97780Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
26813fb97780Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
26823fb97780Smrg# The variable enable_unit_tests is used by other macros in this file.
26833fb97780Smrg#
26843fb97780Smrg# Interface to module:
26853fb97780Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
26863fb97780Smrg# enable_unit_tests:    used in configure.ac for additional configuration
26873fb97780Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
26883fb97780Smrg#			'no' user instructs the module not to build tests
26893fb97780Smrg# parm1:		specify the default value, yes or no.
26903fb97780Smrg#
26913fb97780SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
26923fb97780SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
26933fb97780SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
26943fb97780SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
26953fb97780Smrgm4_define([_defopt], m4_default([$1], [auto]))
26963fb97780SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
26973fb97780Smrg	[Enable building unit test cases (default: ]_defopt[)]),
26983fb97780Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
26993fb97780Smrgm4_undefine([_defopt])
27003fb97780SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
27013fb97780SmrgAC_MSG_CHECKING([whether to build unit test cases])
27023fb97780SmrgAC_MSG_RESULT([$enable_unit_tests])
27033fb97780Smrg]) # XORG_ENABLE_UNIT_TESTS
27040a6b08f8Smrg
27053fb97780Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
27063fb97780Smrg# ------------------------------------------------------
27073fb97780Smrg# Minimum version: 1.17.0
27083fb97780Smrg#
27093fb97780Smrg# This macro enables a builder to enable/disable integration testing
27103fb97780Smrg# It makes no assumption about the test cases' implementation
27113fb97780Smrg# Test cases may or may not use Automake "Support for test suites"
27123fb97780Smrg#
27133fb97780Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
27143fb97780Smrg# usually requires less dependencies and may be built and run under less
27153fb97780Smrg# stringent environments than integration tests.
27163fb97780Smrg#
27173fb97780Smrg# Interface to module:
27183fb97780Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
27193fb97780Smrg# enable_integration_tests:   used in configure.ac for additional configuration
27203fb97780Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
27213fb97780Smrg#                             'no' user instructs the module not to build tests
27223fb97780Smrg# parm1:                      specify the default value, yes or no.
27233fb97780Smrg#
27243fb97780SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
27253fb97780SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
27263fb97780Smrgm4_define([_defopt], m4_default([$1], [auto]))
27273fb97780SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
27283fb97780Smrg	[Enable building integration test cases (default: ]_defopt[)]),
27293fb97780Smrg	[enable_integration_tests=$enableval],
27303fb97780Smrg	[enable_integration_tests=]_defopt)
27313fb97780Smrgm4_undefine([_defopt])
27323fb97780SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
27333fb97780Smrg	[test "x$enable_integration_tests" != xno])
27343fb97780SmrgAC_MSG_CHECKING([whether to build unit test cases])
27353fb97780SmrgAC_MSG_RESULT([$enable_integration_tests])
27363fb97780Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2737126a8a12Smrg
27383fb97780Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
27393fb97780Smrg# ----------------------------------------
27403fb97780Smrg# Minimum version: 1.13.0
27413fb97780Smrg#
27423fb97780Smrg# GLib is a library which provides advanced data structures and functions.
27433fb97780Smrg# This macro enables a module to test for the presence of Glib.
27443fb97780Smrg#
27453fb97780Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
27463fb97780Smrg# Otherwise the value of $enable_unit_tests is blank.
27473fb97780Smrg#
27483fb97780Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
27493fb97780Smrg# test support usually requires less dependencies and may be built and run under
27503fb97780Smrg# less stringent environments than integration tests.
27513fb97780Smrg#
27523fb97780Smrg# Interface to module:
27533fb97780Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
27543fb97780Smrg# with_glib: used in configure.ac to know if GLib has been found
27553fb97780Smrg# --with-glib:	'yes' user instructs the module to use glib
27563fb97780Smrg#		'no' user instructs the module not to use glib
27573fb97780Smrg#
27583fb97780SmrgAC_DEFUN([XORG_WITH_GLIB],[
27593fb97780SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
27603fb97780Smrgm4_define([_defopt], m4_default([$2], [auto]))
27613fb97780SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
27623fb97780Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
27633fb97780Smrg	[with_glib=$withval], [with_glib=]_defopt)
27643fb97780Smrgm4_undefine([_defopt])
2765126a8a12Smrg
27663fb97780Smrghave_glib=no
27673fb97780Smrg# Do not probe GLib if user explicitly disabled unit testing
27683fb97780Smrgif test "x$enable_unit_tests" != x"no"; then
27693fb97780Smrg  # Do not probe GLib if user explicitly disabled it
27703fb97780Smrg  if test "x$with_glib" != x"no"; then
27713fb97780Smrg    m4_ifval(
27723fb97780Smrg      [$1],
27733fb97780Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
27743fb97780Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
27753fb97780Smrg    )
27763c15da26Smrg  fi
27773fb97780Smrgfi
2778126a8a12Smrg
27793fb97780Smrg# Not having GLib when unit testing has been explicitly requested is an error
27803fb97780Smrgif test "x$enable_unit_tests" = x"yes"; then
27813fb97780Smrg  if test "x$have_glib" = x"no"; then
27823fb97780Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
27833fb97780Smrg  fi
27843fb97780Smrgfi
2785126a8a12Smrg
27863fb97780Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
27873fb97780Smrgif test "x$enable_unit_tests" = x"no"; then
27883fb97780Smrg  if test "x$with_glib" = x"yes"; then
27893fb97780Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
27903fb97780Smrg  fi
2791300346aeSmrgfi
2792126a8a12Smrg
27933fb97780Smrg# Not having GLib when it has been explicitly requested is an error
27943fb97780Smrgif test "x$with_glib" = x"yes"; then
27953fb97780Smrg  if test "x$have_glib" = x"no"; then
27963fb97780Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
27973fb97780Smrg  fi
27983fb97780Smrgfi
2799126a8a12Smrg
28003fb97780SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
28013fb97780Smrg]) # XORG_WITH_GLIB
2802126a8a12Smrg
28033fb97780Smrg# XORG_LD_WRAP([required|optional])
28043fb97780Smrg# ---------------------------------
28053fb97780Smrg# Minimum version: 1.13.0
28063fb97780Smrg#
28073fb97780Smrg# Check if linker supports -wrap, passed via compiler flags
28083fb97780Smrg#
28093fb97780Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
28103fb97780Smrg# Otherwise the value of $enable_unit_tests is blank.
28113fb97780Smrg#
28123fb97780Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
28133fb97780Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
28143fb97780Smrg# available, an argument of "optional" allows use when some unit tests require
28153fb97780Smrg# ld -wrap and others do not.
28163fb97780Smrg#
28173fb97780SmrgAC_DEFUN([XORG_LD_WRAP],[
28183fb97780SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
28193fb97780Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
28203fb97780Smrg                      void __wrap_exit(int status) { return; }],
28213fb97780Smrg                     [exit(0);])])
28223fb97780Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
28233fb97780Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
28243fb97780Smrg  if test "x$have_ld_wrap" = x"no"; then
28253fb97780Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
28263fb97780Smrg  fi
28273fb97780Smrgfi
28283fb97780SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
28293fb97780Smrg#
28303fb97780Smrg]) # XORG_LD_WRAP
28313c15da26Smrg
28323fb97780Smrg# XORG_CHECK_LINKER_FLAGS
28333fb97780Smrg# -----------------------
28343fb97780Smrg# SYNOPSIS
28353fb97780Smrg#
28363fb97780Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
28373fb97780Smrg#
28383fb97780Smrg# DESCRIPTION
28393fb97780Smrg#
28403fb97780Smrg#   Check whether the given linker FLAGS work with the current language's
28413fb97780Smrg#   linker, or whether they give an error.
28423fb97780Smrg#
28433fb97780Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
28443fb97780Smrg#   success/failure.
28453fb97780Smrg#
28463fb97780Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
28473fb97780Smrg#
28483fb97780Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
28493fb97780Smrg#
28503fb97780Smrg# LICENSE
28513fb97780Smrg#
28523fb97780Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
28533fb97780Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
28543fb97780Smrg#   Copyright (c) 2009 Matteo Frigo
28553fb97780Smrg#
28563fb97780Smrg#   This program is free software: you can redistribute it and/or modify it
28573fb97780Smrg#   under the terms of the GNU General Public License as published by the
28583fb97780Smrg#   Free Software Foundation, either version 3 of the License, or (at your
28593fb97780Smrg#   option) any later version.
28603fb97780Smrg#
28613fb97780Smrg#   This program is distributed in the hope that it will be useful, but
28623fb97780Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
28633fb97780Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
28643fb97780Smrg#   Public License for more details.
28653fb97780Smrg#
28663fb97780Smrg#   You should have received a copy of the GNU General Public License along
28673fb97780Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
28683fb97780Smrg#
28693fb97780Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
28703fb97780Smrg#   gives unlimited permission to copy, distribute and modify the configure
28713fb97780Smrg#   scripts that are the output of Autoconf when processing the Macro. You
28723fb97780Smrg#   need not follow the terms of the GNU General Public License when using
28733fb97780Smrg#   or distributing such scripts, even though portions of the text of the
28743fb97780Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
28753fb97780Smrg#   all other use of the material that constitutes the Autoconf Macro.
28763fb97780Smrg#
28773fb97780Smrg#   This special exception to the GPL applies to versions of the Autoconf
28783fb97780Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
28793fb97780Smrg#   modified version of the Autoconf Macro, you may extend this special
28803fb97780Smrg#   exception to the GPL to apply to your modified version as well.#
28813fb97780SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
28823fb97780Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
28833fb97780Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
28843fb97780SmrgAS_LITERAL_IF([$1],
28853fb97780Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
28863fb97780Smrg      ax_save_FLAGS=$LDFLAGS
28873fb97780Smrg      LDFLAGS="$1"
28883fb97780Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
28893fb97780Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
28903fb97780Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
28913fb97780Smrg      LDFLAGS=$ax_save_FLAGS])],
28923fb97780Smrg  [ax_save_FLAGS=$LDFLAGS
28933fb97780Smrg   LDFLAGS="$1"
28943fb97780Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
28953fb97780Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
28963fb97780Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
28973fb97780Smrg   LDFLAGS=$ax_save_FLAGS])
28983fb97780Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
28993fb97780SmrgAC_MSG_RESULT($xorg_check_linker_flags)
29003fb97780Smrgif test "x$xorg_check_linker_flags" = xyes; then
29013fb97780Smrg	m4_default([$2], :)
2902300346aeSmrgelse
29033fb97780Smrg	m4_default([$3], :)
2904300346aeSmrgfi
29053fb97780Smrg]) # XORG_CHECK_LINKER_FLAGS
29063c15da26Smrg
29073fb97780Smrg# XORG_MEMORY_CHECK_FLAGS
29083fb97780Smrg# -----------------------
29093fb97780Smrg# Minimum version: 1.16.0
29103fb97780Smrg#
29113fb97780Smrg# This macro attempts to find appropriate memory checking functionality
29123fb97780Smrg# for various platforms which unit testing code may use to catch various
29133fb97780Smrg# forms of memory allocation and access errors in testing.
29143fb97780Smrg#
29153fb97780Smrg# Interface to module:
29163fb97780Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
29173fb97780Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
29183fb97780Smrg#
29193fb97780Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
29203fb97780Smrg#
29213fb97780SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2922126a8a12Smrg
29233fb97780SmrgAC_REQUIRE([AC_CANONICAL_HOST])
29243fb97780SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
29253fb97780Smrg           [Environment variables to enable memory checking in tests])
29263fb97780Smrg
29273fb97780Smrg# Check for different types of support on different platforms
29283fb97780Smrgcase $host_os in
29293fb97780Smrg    solaris*)
29303fb97780Smrg        AC_CHECK_LIB([umem], [umem_alloc],
29313fb97780Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
29323fb97780Smrg        ;;
29333fb97780Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
29343fb97780Smrg        # both directly and inverted, so should not be 0 or 255.
29353fb97780Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
29363fb97780Smrg        ;;
29373fb97780Smrg    darwin*)
29383fb97780Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
29393fb97780Smrg        ;;
29403fb97780Smrg    *bsd*)
29413fb97780Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
29423fb97780Smrg        ;;
29433fb97780Smrgesac
29443fb97780Smrg
29453fb97780Smrg# User supplied flags override default flags
29463fb97780Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
29473fb97780Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2948555991fdSmrgfi
2949126a8a12Smrg
29503fb97780SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
29513fb97780Smrg]) # XORG_WITH_LINT
2952126a8a12Smrg
29533fb97780Smrg# XORG_CHECK_MALLOC_ZERO
29543fb97780Smrg# ----------------------
29553fb97780Smrg# Minimum version: 1.0.0
29563fb97780Smrg#
29573fb97780Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
29583fb97780Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
29593fb97780Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
29606bea0e4fSmrg#
29616bea0e4fSmrg# No longer actually tests since there is no guarantee applications will
29626bea0e4fSmrg# run with the same malloc implementation we tested against, and the cost
29636bea0e4fSmrg# of always ensuring the size passed to malloc is non-zero is minimal now.
29646bea0e4fSmrg# Still allows builders to override when they have complete control over
29656bea0e4fSmrg# which malloc implementation will be used.
29663fb97780SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
29673fb97780SmrgAC_ARG_ENABLE(malloc0returnsnull,
29683fb97780Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
29696bea0e4fSmrg		       [assume malloc(0) can return NULL (default: yes)]),
29703fb97780Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
29716bea0e4fSmrg	[MALLOC_ZERO_RETURNS_NULL=yes])
29726bea0e4fSmrg
29736bea0e4fSmrgAC_MSG_CHECKING([whether to act as if malloc(0) can return NULL])
29743fb97780SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2975126a8a12Smrg
29763fb97780Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
29773fb97780Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
29783fb97780Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
29793fb97780Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
29803fb97780Smrgelse
29813fb97780Smrg	MALLOC_ZERO_CFLAGS=""
29823fb97780Smrg	XMALLOC_ZERO_CFLAGS=""
29833fb97780Smrg	XTMALLOC_ZERO_CFLAGS=""
2984300346aeSmrgfi
2985126a8a12Smrg
29863fb97780SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
29873fb97780SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
29883fb97780SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
29893fb97780Smrg]) # XORG_CHECK_MALLOC_ZERO
2990126a8a12Smrg
29913fb97780Smrg# XORG_WITH_LINT()
2992300346aeSmrg# ----------------
29933fb97780Smrg# Minimum version: 1.1.0
29943fb97780Smrg#
29953fb97780Smrg# This macro enables the use of a tool that flags some suspicious and
29963fb97780Smrg# non-portable constructs (likely to be bugs) in C language source code.
29973fb97780Smrg# It will attempt to locate the tool and use appropriate options.
29983fb97780Smrg# There are various lint type tools on different platforms.
29993fb97780Smrg#
30003fb97780Smrg# Interface to module:
30013fb97780Smrg# LINT:		returns the path to the tool found on the platform
30023fb97780Smrg#		or the value set to LINT on the configure cmd line
30033fb97780Smrg#		also an Automake conditional
30043fb97780Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
30053fb97780Smrg#
30063fb97780Smrg# --with-lint:	'yes' user instructs the module to use lint
30073fb97780Smrg#		'no' user instructs the module not to use lint (default)
30083fb97780Smrg#
30093fb97780Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
30103fb97780Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
30113fb97780Smrg#
30123fb97780SmrgAC_DEFUN([XORG_WITH_LINT],[
30133fb97780Smrg
30143fb97780SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
30153fb97780SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
30163fb97780SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
30173fb97780Smrg		[Use a lint-style source code checker (default: disabled)])],
30183fb97780Smrg		[use_lint=$withval], [use_lint=no])
30193fb97780Smrg
30203fb97780Smrg# Obtain platform specific info like program name and options
30213fb97780Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
30223fb97780Smrgcase $host_os in
30233fb97780Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
30243fb97780Smrg	lint_name=splint
30253fb97780Smrg	lint_options="-badflag"
30263fb97780Smrg	;;
30273fb97780Smrg  *freebsd* | *netbsd*)
30283fb97780Smrg	lint_name=lint
30293fb97780Smrg	lint_options="-u -b"
30303fb97780Smrg	;;
30313fb97780Smrg  *solaris*)
30323fb97780Smrg	lint_name=lint
30333fb97780Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
30343fb97780Smrg	;;
30353fb97780Smrgesac
30363fb97780Smrg
30373fb97780Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
30383fb97780Smrgif test "x$use_lint" = x"yes" ; then
30393fb97780Smrg   AC_PATH_PROG([LINT], [$lint_name])
30403fb97780Smrg   if test "x$LINT" = "x"; then
30413fb97780Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
30423fb97780Smrg   fi
30433fb97780Smrgelif test "x$use_lint" = x"no" ; then
30443fb97780Smrg   if test "x$LINT" != "x"; then
30453fb97780Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
30463fb97780Smrg   fi
3047300346aeSmrgelse
30483fb97780Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
30493c15da26Smrgfi
3050126a8a12Smrg
30513fb97780Smrg# User supplied flags override default flags
30523fb97780Smrgif test "x$LINT_FLAGS" != "x"; then
30533fb97780Smrg   lint_options=$LINT_FLAGS
30543fb97780Smrgfi
3055126a8a12Smrg
30563fb97780SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
30573fb97780SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
3058126a8a12Smrg
30593fb97780Smrg]) # XORG_WITH_LINT
3060126a8a12Smrg
30613fb97780Smrg# XORG_LINT_LIBRARY(LIBNAME)
30623fb97780Smrg# --------------------------
30633fb97780Smrg# Minimum version: 1.1.0
30643fb97780Smrg#
30653fb97780Smrg# Sets up flags for building lint libraries for checking programs that call
30663fb97780Smrg# functions in the library.
30673fb97780Smrg#
30683fb97780Smrg# Interface to module:
30693fb97780Smrg# LINTLIB		- Automake variable with the name of lint library file to make
30703fb97780Smrg# MAKE_LINT_LIB		- Automake conditional
30713fb97780Smrg#
30723fb97780Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
30733fb97780Smrg#			  - 'no' user instructs the module not to create a lint library (default)
3074126a8a12Smrg
30753fb97780SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
30763fb97780SmrgAC_REQUIRE([XORG_WITH_LINT])
30773fb97780SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
30783fb97780Smrg	[Create lint library (default: disabled)])],
30793fb97780Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
3080126a8a12Smrg
30813fb97780Smrgif test "x$make_lint_lib" = x"yes" ; then
30823fb97780Smrg   LINTLIB=llib-l$1.ln
30833fb97780Smrg   if test "x$LINT" = "x"; then
30843fb97780Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
30853fb97780Smrg   fi
30863fb97780Smrgelif test "x$make_lint_lib" != x"no" ; then
30873fb97780Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
30883fb97780Smrgfi
3089126a8a12Smrg
30903fb97780SmrgAC_SUBST(LINTLIB)
30913fb97780SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
3092126a8a12Smrg
30933fb97780Smrg]) # XORG_LINT_LIBRARY
3094126a8a12Smrg
30953fb97780Smrg# XORG_COMPILER_BRAND
30963fb97780Smrg# -------------------
30973fb97780Smrg# Minimum version: 1.14.0
30983fb97780Smrg#
30993fb97780Smrg# Checks for various brands of compilers and sets flags as appropriate:
31003fb97780Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
31013fb97780Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
31023fb97780Smrg#   clang compiler - sets CLANGCC to "yes"
31033fb97780Smrg#   Intel compiler - sets INTELCC to "yes"
31043fb97780Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
31053fb97780Smrg#
31063fb97780SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
31073fb97780SmrgAC_LANG_CASE(
31083fb97780Smrg	[C], [
31096bea0e4fSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
31106bea0e4fSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
31116bea0e4fSmrg		m4_version_prereq([2.70],
31126bea0e4fSmrg			[AC_REQUIRE([AC_PROG_CC])],
31136bea0e4fSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
31143fb97780Smrg	],
31153fb97780Smrg	[C++], [
31163fb97780Smrg		AC_REQUIRE([AC_PROG_CXX])
31173fb97780Smrg	]
31183fb97780Smrg)
31193fb97780SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
31203fb97780SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
31213fb97780SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
31223fb97780Smrg]) # XORG_COMPILER_BRAND
3123300346aeSmrg
31243fb97780Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
31253fb97780Smrg# ---------------
31263fb97780Smrg# Minimum version: 1.16.0
31273fb97780Smrg#
31283fb97780Smrg# Test if the compiler works when passed the given flag as a command line argument.
31293fb97780Smrg# If it succeeds, the flag is appended to the given variable.  If not, it tries the
31303fb97780Smrg# next flag in the list until there are no more options.
31313fb97780Smrg#
31323fb97780Smrg# Note that this does not guarantee that the compiler supports the flag as some
31333fb97780Smrg# compilers will simply ignore arguments that they do not understand, but we do
31343fb97780Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
31353fb97780Smrg# -Werror=unused-command-line-argument
31363fb97780Smrg#
31373fb97780SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
31383fb97780Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
31393fb97780Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3140126a8a12Smrg
31413fb97780SmrgAC_LANG_COMPILER_REQUIRE
3142126a8a12Smrg
31433fb97780SmrgAC_LANG_CASE(
31443fb97780Smrg	[C], [
31456bea0e4fSmrg		dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
31466bea0e4fSmrg		dnl and complains that AC_PROG_CC_C99 is obsolete
31476bea0e4fSmrg		m4_version_prereq([2.70],
31486bea0e4fSmrg			[AC_REQUIRE([AC_PROG_CC])],
31496bea0e4fSmrg			[AC_REQUIRE([AC_PROG_CC_C99])])
31503fb97780Smrg		define([PREFIX], [C])
31513fb97780Smrg		define([CACHE_PREFIX], [cc])
31523fb97780Smrg		define([COMPILER], [$CC])
31533fb97780Smrg	],
31543fb97780Smrg	[C++], [
31553fb97780Smrg		define([PREFIX], [CXX])
31563fb97780Smrg		define([CACHE_PREFIX], [cxx])
31573fb97780Smrg		define([COMPILER], [$CXX])
31583fb97780Smrg	]
31593fb97780Smrg)
3160126a8a12Smrg
31613fb97780Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3162126a8a12Smrg
31633fb97780Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
31643fb97780Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
31653fb97780Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
31663fb97780Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
31673fb97780Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
31683fb97780Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
31693fb97780Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
31703fb97780Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
31713fb97780Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
31723fb97780Smrgfi
3173126a8a12Smrg
31743fb97780Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
31753fb97780Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
31763fb97780Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
31773fb97780Smrg	fi
31783fb97780Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
31793fb97780Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
31803fb97780Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
31813fb97780Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
31823fb97780Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
31833fb97780Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
31843fb97780Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
31853fb97780Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
31863fb97780Smrgfi
3187126a8a12Smrg
31883fb97780Smrgfound="no"
31893fb97780Smrgm4_foreach([flag], m4_cdr($@), [
31903fb97780Smrg	if test $found = "no" ; then
31913fb97780Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
31923fb97780Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
31933fb97780Smrg		fi
3194126a8a12Smrg
31953fb97780Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
31963fb97780Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
31973fb97780Smrg		fi
3198126a8a12Smrg
31993fb97780Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3200126a8a12Smrg
32013fb97780Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
32023fb97780Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
32033fb97780Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
32043fb97780Smrg		AC_CACHE_VAL($cacheid,
32053fb97780Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
32063fb97780Smrg					     [eval $cacheid=yes],
32073fb97780Smrg					     [eval $cacheid=no])])
32080a6b08f8Smrg
32093fb97780Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3210126a8a12Smrg
32113fb97780Smrg		eval supported=\$$cacheid
32123fb97780Smrg		AC_MSG_RESULT([$supported])
32133fb97780Smrg		if test "$supported" = "yes" ; then
32143fb97780Smrg			$1="$$1 ]flag["
32153fb97780Smrg			found="yes"
32163fb97780Smrg		fi
32173fb97780Smrg	fi
32183fb97780Smrg])
32193fb97780Smrg]) # XORG_TESTSET_CFLAG
3220555991fdSmrg
32213fb97780Smrg# XORG_COMPILER_FLAGS
32223fb97780Smrg# ---------------
32233fb97780Smrg# Minimum version: 1.16.0
32243fb97780Smrg#
32253fb97780Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
32263fb97780Smrg# arguments supported by the selected compiler which do NOT alter the generated
32273fb97780Smrg# code.  These arguments will cause the compiler to print various warnings
32283fb97780Smrg# during compilation AND turn a conservative set of warnings into errors.
32293fb97780Smrg#
32303fb97780Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
32313fb97780Smrg# future versions of util-macros as options are added to new compilers.
32323fb97780Smrg#
32333fb97780SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
32343fb97780SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3235555991fdSmrg
32363fb97780SmrgAC_ARG_ENABLE(selective-werror,
32373fb97780Smrg              AS_HELP_STRING([--disable-selective-werror],
32383fb97780Smrg                             [Turn off selective compiler errors. (default: enabled)]),
32393fb97780Smrg              [SELECTIVE_WERROR=$enableval],
32403fb97780Smrg              [SELECTIVE_WERROR=yes])
3241555991fdSmrg
32423fb97780SmrgAC_LANG_CASE(
32433fb97780Smrg        [C], [
32443fb97780Smrg                define([PREFIX], [C])
32453fb97780Smrg        ],
32463fb97780Smrg        [C++], [
32473fb97780Smrg                define([PREFIX], [CXX])
32483fb97780Smrg        ]
32493fb97780Smrg)
32503fb97780Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
32513fb97780Smrgif test "x$SUNCC" = "xyes"; then
32523fb97780Smrg    [BASE_]PREFIX[FLAGS]="-v"
32533fb97780Smrgelse
32543fb97780Smrg    [BASE_]PREFIX[FLAGS]=""
32553fb97780Smrgfi
3256555991fdSmrg
32573fb97780Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
32583fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
32593fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
32603fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
32613fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3262555991fdSmrg
32633fb97780SmrgAC_LANG_CASE(
32643fb97780Smrg	[C], [
32653fb97780Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
32663fb97780Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
32673fb97780Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
32683fb97780Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
32693fb97780Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
32703fb97780Smrg	]
32713fb97780Smrg)
3272126a8a12Smrg
32733fb97780Smrg# This chunk adds additional warnings that could catch undesired effects.
32743fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
32753fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
32763fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
32773fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
32783fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
32793fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
32803fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3281126a8a12Smrg
32823fb97780Smrg# These are currently disabled because they are noisy.  They will be enabled
32833fb97780Smrg# in the future once the codebase is sufficiently modernized to silence
32843fb97780Smrg# them.  For now, I don't want them to drown out the other warnings.
32853fb97780Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
32863fb97780Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
32873fb97780Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3288126a8a12Smrg
32893fb97780Smrg# Turn some warnings into errors, so we don't accidentally get successful builds
32903fb97780Smrg# when there are problems that should be fixed.
32913c15da26Smrg
32923fb97780Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
32933fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
32943fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
32953fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
32963fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
32973fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
32983fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
32993fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
33003fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
33013fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
33023fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
33033fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
33043fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
33053fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
33063fb97780Smrgelse
33073fb97780SmrgAC_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])
33083fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
33093fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
33103fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
33113fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
33123fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
33133fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
33143fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
33153fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
33163fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
33173fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
33183fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
33193fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
33203fb97780SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
33213fb97780Smrgfi
3322126a8a12Smrg
33233fb97780SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
33243fb97780Smrg]) # XORG_COMPILER_FLAGS
3325126a8a12Smrg
33263fb97780Smrg# XORG_CWARNFLAGS
33273fb97780Smrg# ---------------
33283fb97780Smrg# Minimum version: 1.2.0
33293fb97780Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
33303fb97780Smrg#
33313fb97780Smrg# Defines CWARNFLAGS to enable C compiler warnings.
33323fb97780Smrg#
33333fb97780Smrg# This function is deprecated because it defines -fno-strict-aliasing
33343fb97780Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
33353fb97780Smrg# is needed, then it should be added explicitly in the module when
33363fb97780Smrg# it is updated to use BASE_CFLAGS.
33373fb97780Smrg#
33383fb97780SmrgAC_DEFUN([XORG_CWARNFLAGS], [
33393fb97780SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
33403fb97780SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
33413fb97780SmrgAC_LANG_CASE(
33423fb97780Smrg	[C], [
33433fb97780Smrg		CWARNFLAGS="$BASE_CFLAGS"
33443fb97780Smrg		if  test "x$GCC" = xyes ; then
33453fb97780Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
33463fb97780Smrg		fi
33473fb97780Smrg		AC_SUBST(CWARNFLAGS)
33483fb97780Smrg	]
33493fb97780Smrg)
33503fb97780Smrg]) # XORG_CWARNFLAGS
3351126a8a12Smrg
33523fb97780Smrg# XORG_STRICT_OPTION
33533fb97780Smrg# -----------------------
33543fb97780Smrg# Minimum version: 1.3.0
33553fb97780Smrg#
33563fb97780Smrg# Add configure option to enable strict compilation flags, such as treating
33573fb97780Smrg# warnings as fatal errors.
33583fb97780Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
33593fb97780Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
33603fb97780Smrg#
33613fb97780Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
33623fb97780Smrg# when strict compilation is unconditionally desired.
33633fb97780SmrgAC_DEFUN([XORG_STRICT_OPTION], [
33643fb97780SmrgAC_REQUIRE([XORG_CWARNFLAGS])
33653fb97780SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3366300346aeSmrg
33673fb97780SmrgAC_ARG_ENABLE(strict-compilation,
33683fb97780Smrg			  AS_HELP_STRING([--enable-strict-compilation],
33693fb97780Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
33703fb97780Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3371126a8a12Smrg
33723fb97780SmrgAC_LANG_CASE(
33733fb97780Smrg        [C], [
33743fb97780Smrg                define([PREFIX], [C])
33753fb97780Smrg        ],
33763fb97780Smrg        [C++], [
33773fb97780Smrg                define([PREFIX], [CXX])
33783fb97780Smrg        ]
33793fb97780Smrg)
3380126a8a12Smrg
33813fb97780Smrg[STRICT_]PREFIX[FLAGS]=""
33823fb97780SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
33833fb97780SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3384126a8a12Smrg
33853fb97780Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
33863fb97780Smrg# activate it with -Werror, so we add it here explicitly.
33873fb97780SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3388126a8a12Smrg
33893fb97780Smrgif test "x$STRICT_COMPILE" = "xyes"; then
33903fb97780Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
33913fb97780Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
33923fb97780Smrgfi
33933fb97780SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
33943fb97780SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
33953fb97780SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
33963fb97780Smrg]) # XORG_STRICT_OPTION
3397126a8a12Smrg
33986bea0e4fSmrg# XORG_DEFAULT_NOCODE_OPTIONS
33996bea0e4fSmrg# ---------------------------
34006bea0e4fSmrg# Minimum version: 1.20.0
34016bea0e4fSmrg#
34026bea0e4fSmrg# Defines default options for X.Org modules which don't compile code,
34036bea0e4fSmrg# such as fonts, bitmaps, cursors, and docs.
34046bea0e4fSmrg#
34056bea0e4fSmrgAC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
34066bea0e4fSmrgAC_REQUIRE([AC_PROG_INSTALL])
34076bea0e4fSmrgXORG_RELEASE_VERSION
34086bea0e4fSmrgXORG_CHANGELOG
34096bea0e4fSmrgXORG_INSTALL
34106bea0e4fSmrgXORG_MANPAGE_SECTIONS
34116bea0e4fSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
34126bea0e4fSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
34136bea0e4fSmrg]) # XORG_DEFAULT_NOCODE_OPTIONS
34146bea0e4fSmrg
34153fb97780Smrg# XORG_DEFAULT_OPTIONS
34163fb97780Smrg# --------------------
34173fb97780Smrg# Minimum version: 1.3.0
34183fb97780Smrg#
34196bea0e4fSmrg# Defines default options for X.Org modules which compile code.
34203fb97780Smrg#
34213fb97780SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
34223fb97780SmrgAC_REQUIRE([AC_PROG_INSTALL])
34233fb97780SmrgXORG_COMPILER_FLAGS
34243fb97780SmrgXORG_CWARNFLAGS
34253fb97780SmrgXORG_STRICT_OPTION
34266bea0e4fSmrgXORG_DEFAULT_NOCODE_OPTIONS
34273fb97780Smrg]) # XORG_DEFAULT_OPTIONS
3428300346aeSmrg
34293fb97780Smrg# XORG_INSTALL()
34303fb97780Smrg# ----------------
34313fb97780Smrg# Minimum version: 1.4.0
34323fb97780Smrg#
34333fb97780Smrg# Defines the variable INSTALL_CMD as the command to copy
34343fb97780Smrg# INSTALL from $prefix/share/util-macros.
34353fb97780Smrg#
34363fb97780SmrgAC_DEFUN([XORG_INSTALL], [
34373fb97780SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
34383fb97780Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
34393fb97780SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
34403fb97780Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
34413fb97780Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
34423fb97780Smrgtouch \$(top_srcdir)/INSTALL; \
34433fb97780Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
34443fb97780SmrgAC_SUBST([INSTALL_CMD])
34453fb97780Smrg]) # XORG_INSTALL
34463fb97780Smrgdnl Copyright 2005 Red Hat, Inc
34473fb97780Smrgdnl
34483fb97780Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
34493fb97780Smrgdnl documentation for any purpose is hereby granted without fee, provided that
34503fb97780Smrgdnl the above copyright notice appear in all copies and that both that
34513fb97780Smrgdnl copyright notice and this permission notice appear in supporting
34523fb97780Smrgdnl documentation.
34533fb97780Smrgdnl
34543fb97780Smrgdnl The above copyright notice and this permission notice shall be included
34553fb97780Smrgdnl in all copies or substantial portions of the Software.
34563fb97780Smrgdnl
34573fb97780Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
34583fb97780Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34593fb97780Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
34603fb97780Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
34613fb97780Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
34623fb97780Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
34633fb97780Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
34643fb97780Smrgdnl
34653fb97780Smrgdnl Except as contained in this notice, the name of the copyright holders shall
34663fb97780Smrgdnl not be used in advertising or otherwise to promote the sale, use or
34673fb97780Smrgdnl other dealings in this Software without prior written authorization
34683fb97780Smrgdnl from the copyright holders.
34693fb97780Smrgdnl
3470126a8a12Smrg
34713fb97780Smrg# XORG_RELEASE_VERSION
34723fb97780Smrg# --------------------
34733fb97780Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3474126a8a12Smrg
34753fb97780SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
34763fb97780Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
34773fb97780Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
34783fb97780Smrg		[Major version of this package])
34793fb97780Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
34803fb97780Smrg	if test "x$PVM" = "x"; then
34813fb97780Smrg		PVM="0"
34823fb97780Smrg	fi
34833fb97780Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
34843fb97780Smrg		[$PVM],
34853fb97780Smrg		[Minor version of this package])
34863fb97780Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
34873fb97780Smrg	if test "x$PVP" = "x"; then
34883fb97780Smrg		PVP="0"
34893fb97780Smrg	fi
34903fb97780Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
34913fb97780Smrg		[$PVP],
34923fb97780Smrg		[Patch version of this package])
34933fb97780Smrg])
3494d656433aSmrg
34953fb97780Smrg# XORG_CHANGELOG()
34963fb97780Smrg# ----------------
34973fb97780Smrg# Minimum version: 1.2.0
34983fb97780Smrg#
34993fb97780Smrg# Defines the variable CHANGELOG_CMD as the command to generate
35003fb97780Smrg# ChangeLog from git.
35013fb97780Smrg#
35023fb97780Smrg#
35033fb97780SmrgAC_DEFUN([XORG_CHANGELOG], [
35043fb97780SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
35053fb97780Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
35063fb97780Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
35073fb97780Smrgtouch \$(top_srcdir)/ChangeLog; \
35083fb97780Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
35093fb97780SmrgAC_SUBST([CHANGELOG_CMD])
35103fb97780Smrg]) # XORG_CHANGELOG
35113c15da26Smrg
35123fb97780Smrgdnl
35136bea0e4fSmrgdnl Copyright (c) 2005, 2025, Oracle and/or its affiliates.
35143fb97780Smrgdnl
35153fb97780Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
35163fb97780Smrgdnl copy of this software and associated documentation files (the "Software"),
35173fb97780Smrgdnl to deal in the Software without restriction, including without limitation
35183fb97780Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
35193fb97780Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
35203fb97780Smrgdnl Software is furnished to do so, subject to the following conditions:
35213fb97780Smrgdnl
35223fb97780Smrgdnl The above copyright notice and this permission notice (including the next
35233fb97780Smrgdnl paragraph) shall be included in all copies or substantial portions of the
35243fb97780Smrgdnl Software.
35253fb97780Smrgdnl
35263fb97780Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35273fb97780Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35283fb97780Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
35293fb97780Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35303fb97780Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
35313fb97780Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
35323fb97780Smrgdnl DEALINGS IN THE SOFTWARE.
35333fb97780Smrgdnl
3534126a8a12Smrg
35353fb97780Smrg# XTRANS_TCP_FLAGS()
35363fb97780Smrg# ------------------
35373fb97780Smrg# Find needed libraries for TCP sockets, and check for IPv6 support
35383fb97780SmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
35393fb97780Smrg # SVR4 hides these in libraries other than libc
35403fb97780Smrg AC_SEARCH_LIBS(socket, [socket])
35413fb97780Smrg AC_SEARCH_LIBS(gethostbyname, [nsl])
35423fb97780Smrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
35433fb97780Smrg   AC_CHECK_LIB([ws2_32],[main])
35443fb97780Smrg fi
3545126a8a12Smrg
35463fb97780Smrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
35476bea0e4fSmrg AC_CHECK_FUNCS([getaddrinfo inet_ntop])
35486bea0e4fSmrg
35493fb97780Smrg AC_ARG_ENABLE(ipv6,
35503fb97780Smrg	AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
35513fb97780Smrg	[IPV6CONN=$enableval],
35526bea0e4fSmrg	[IPV6CONN=$ac_cv_func_getaddrinfo])
35533fb97780Smrg AC_MSG_CHECKING([if IPv6 support should be built])
35543fb97780Smrg if test "$IPV6CONN" = "yes"; then
35553fb97780Smrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
35563fb97780Smrg fi
35573fb97780Smrg AC_MSG_RESULT($IPV6CONN)
3558126a8a12Smrg
35593fb97780Smrg # 4.3BSD-Reno added a new member to struct sockaddr_in
35603fb97780Smrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
35613fb97780Smrg	AC_DEFINE([BSD44SOCKETS],1,
35623fb97780Smrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
35633fb97780Smrg#include <sys/types.h>
35643fb97780Smrg#include <sys/socket.h>
35653fb97780Smrg#include <netinet/in.h>
35663fb97780Smrg ])
3567126a8a12Smrg
35683fb97780Smrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
35696bea0e4fSmrg # and added a type defined to be large enough to hold any sockaddr format.
35706bea0e4fSmrg AC_CHECK_TYPES([socklen_t, struct sockaddr_storage], [], [], [
35713fb97780SmrgAC_INCLUDES_DEFAULT
35726bea0e4fSmrg#include <sys/socket.h>
35736bea0e4fSmrg ])
3574126a8a12Smrg
35753fb97780Smrg # XPG4v2/UNIX95 added msg_control - check to see if we need to define
35763fb97780Smrg # _XOPEN_SOURCE to get it (such as on Solaris)
35773fb97780Smrg AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
35783fb97780Smrg                 [
35793fb97780SmrgAC_INCLUDES_DEFAULT
35803fb97780Smrg#include <sys/socket.h>
35813fb97780Smrg                 ])
35823fb97780Smrg # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
35833fb97780Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
35843fb97780Smrg     unset ac_cv_member_struct_msghdr_msg_control
35853fb97780Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
35863fb97780Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
35873fb97780Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [600],
35883fb97780Smrg                       [Defined if needed to expose struct msghdr.msg_control])
35893fb97780Smrg                     ], [], [
35903fb97780Smrg#define _XOPEN_SOURCE 600
35913fb97780SmrgAC_INCLUDES_DEFAULT
35923fb97780Smrg#include <sys/socket.h>
35933fb97780Smrg                     ])
35943fb97780Smrg fi
35953fb97780Smrg # If that didn't work, fall back to XPG5/UNIX98 with C89
35963fb97780Smrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
35973fb97780Smrg     unset ac_cv_member_struct_msghdr_msg_control
35983fb97780Smrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
35993fb97780Smrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
36003fb97780Smrg                     [AC_DEFINE([_XOPEN_SOURCE], [500],
36013fb97780Smrg                       [Defined if needed to expose struct msghdr.msg_control])
36023fb97780Smrg                     ], [], [
36033fb97780Smrg#define _XOPEN_SOURCE 500
36043fb97780SmrgAC_INCLUDES_DEFAULT
36053fb97780Smrg#include <sys/socket.h>
36063fb97780Smrg                     ])
36073fb97780Smrg fi
3608126a8a12Smrg
36093c15da26Smrg
36103fb97780Smrg]) # XTRANS_TCP_FLAGS
3611126a8a12Smrg
36123fb97780Smrg# XTRANS_CONNECTION_FLAGS()
36133fb97780Smrg# -------------------------
36143fb97780Smrg# Standard checks for which Xtrans transports to use by the Xorg packages
36153fb97780Smrg# that use Xtrans functions
36163fb97780SmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
36173fb97780Smrg AC_REQUIRE([AC_CANONICAL_HOST])
36183fb97780Smrg [case $host_os in
36193fb97780Smrg	mingw*)	unixdef="no"   ;;
36203fb97780Smrg	*)	unixdef="yes"  ;;
36213fb97780Smrg esac]
36223fb97780Smrg AC_ARG_ENABLE(unix-transport,
36233fb97780Smrg	AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
36243fb97780Smrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
36253fb97780Smrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
36263fb97780Smrg if test "$UNIXCONN" = "yes"; then
36273fb97780Smrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
36283fb97780Smrg fi
36293fb97780Smrg AC_MSG_RESULT($UNIXCONN)
36303fb97780Smrg AC_ARG_ENABLE(tcp-transport,
36313fb97780Smrg	AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
36323fb97780Smrg	[TCPCONN=$enableval], [TCPCONN=yes])
36333fb97780Smrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
36343fb97780Smrg AC_MSG_RESULT($TCPCONN)
36353fb97780Smrg if test "$TCPCONN" = "yes"; then
36363fb97780Smrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
36373fb97780Smrg	XTRANS_TCP_FLAGS
36383fb97780Smrg fi
36393fb97780Smrg [case $host_os in
36403fb97780Smrg	solaris*)		localdef="yes" ;;
36413fb97780Smrg	*)			localdef="no"  ;;
36423fb97780Smrg esac]
36433fb97780Smrg AC_ARG_ENABLE(local-transport,
36443fb97780Smrg	AS_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
36453fb97780Smrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
36463fb97780Smrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
36473fb97780Smrg AC_MSG_RESULT($LOCALCONN)
36483fb97780Smrg if test "$LOCALCONN" = "yes"; then
36493fb97780Smrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
36503fb97780Smrg fi
36513c15da26Smrg
36523fb97780Smrg # Other functions Xtrans may need
36533fb97780Smrg AC_CHECK_FUNCS([strcasecmp strlcpy])
36543c15da26Smrg
36553fb97780Smrg]) # XTRANS_CONNECTION_FLAGS
3656126a8a12Smrg
3657126a8a12Smrg
36583fb97780Smrg# XTRANS_SECURE_RPC_FLAGS()
36593fb97780Smrg# -------------------------
36603fb97780Smrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
36613fb97780Smrg# so that any necessary networking libraries are already found
36623fb97780SmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
36633fb97780Smrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
36643fb97780Smrg AC_ARG_ENABLE(secure-rpc,
36653fb97780Smrg	AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
36663fb97780Smrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
3667300346aeSmrg
36683fb97780Smrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
36693fb97780Smrg	FOUND_SECURE_RPC="no"
36703fb97780Smrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
36713fb97780Smrg			[FOUND_SECURE_RPC="yes"])
36723fb97780Smrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
36733fb97780Smrg		if test "x$SECURE_RPC" = "xyes" ; then
36743fb97780Smrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
36753fb97780Smrg		fi
36763fb97780Smrg		SECURE_RPC="no"
36773fb97780Smrg	else
36783fb97780Smrg		dnl FreeBSD keeps getsecretkey in librpcsvc
36793fb97780Smrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
36803fb97780Smrg		SECURE_RPC="yes"
36813fb97780Smrg	fi
36823fb97780Smrg fi
36833fb97780Smrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
36843fb97780Smrg if test "x$SECURE_RPC" = "xyes" ; then
36853fb97780Smrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
36863fb97780Smrg fi
36873fb97780Smrg AC_MSG_RESULT($SECURE_RPC)
36883fb97780Smrg]) # XTRANS_SECURE_RPC_FLAGS
3689300346aeSmrg
3690300346aeSmrg
36916bea0e4fSmrgm4_include([m4/libtool.m4])
36926bea0e4fSmrgm4_include([m4/ltoptions.m4])
36936bea0e4fSmrgm4_include([m4/ltsugar.m4])
36946bea0e4fSmrgm4_include([m4/ltversion.m4])
36956bea0e4fSmrgm4_include([m4/lt~obsolete.m4])
3696