aclocal.m4 revision 14bc0770
114bc0770Smrg# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
25dd5f640Smrg
314bc0770Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
4e9554658Smrg
5e9554658Smrg# This file is free software; the Free Software Foundation
6e9554658Smrg# gives unlimited permission to copy and/or distribute it,
7e9554658Smrg# with or without modifications, as long as this notice is preserved.
8e9554658Smrg
9e9554658Smrg# This program is distributed in the hope that it will be useful,
10e9554658Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11e9554658Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12e9554658Smrg# PARTICULAR PURPOSE.
13e9554658Smrg
145dd5f640Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15c2b339b4Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16c2b339b4Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1714bc0770Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
1814bc0770Smrg[m4_warning([this file was generated for autoconf 2.71.
19c2b339b4SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20c2b339b4SmrgIf you have problems, you may need to regenerate the build system entirely.
215dd5f640SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22e9554658Smrg
2314bc0770Smrg# Copyright (C) 2002-2021 Free Software Foundation, Inc.
2414bc0770Smrg#
2514bc0770Smrg# This file is free software; the Free Software Foundation
2614bc0770Smrg# gives unlimited permission to copy and/or distribute it,
2714bc0770Smrg# with or without modifications, as long as this notice is preserved.
28e9554658Smrg
2914bc0770Smrg# AM_AUTOMAKE_VERSION(VERSION)
3014bc0770Smrg# ----------------------------
3114bc0770Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3214bc0770Smrg# generated from the m4 files accompanying Automake X.Y.
3314bc0770Smrg# (This private macro should not be called outside this file.)
3414bc0770SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3514bc0770Smrg[am__api_version='1.16'
3614bc0770Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3714bc0770Smrgdnl require some minimum version.  Point them to the right macro.
3814bc0770Smrgm4_if([$1], [1.16.5], [],
3914bc0770Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4014bc0770Smrg])
41e9554658Smrg
4214bc0770Smrg# _AM_AUTOCONF_VERSION(VERSION)
4314bc0770Smrg# -----------------------------
4414bc0770Smrg# aclocal traces this macro to find the Autoconf version.
4514bc0770Smrg# This is a private macro too.  Using m4_define simplifies
4614bc0770Smrg# the logic in aclocal, which can simply ignore this definition.
4714bc0770Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48e9554658Smrg
4914bc0770Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5014bc0770Smrg# -------------------------------
5114bc0770Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5214bc0770Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5314bc0770SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5414bc0770Smrg[AM_AUTOMAKE_VERSION([1.16.5])dnl
5514bc0770Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5614bc0770Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5714bc0770Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5814bc0770Smrg
5914bc0770Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6014bc0770Smrg
6114bc0770Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
6214bc0770Smrg#
6314bc0770Smrg# This file is free software; the Free Software Foundation
6414bc0770Smrg# gives unlimited permission to copy and/or distribute it,
6514bc0770Smrg# with or without modifications, as long as this notice is preserved.
6614bc0770Smrg
6714bc0770Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6814bc0770Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6914bc0770Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7014bc0770Smrg#
7114bc0770Smrg# Of course, Automake must honor this variable whenever it calls a
7214bc0770Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7314bc0770Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7414bc0770Smrg# depending on how configure is run.  This is pretty annoying, since
7514bc0770Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7614bc0770Smrg# source directory, any form will work fine, but in subdirectories a
7714bc0770Smrg# relative path needs to be adjusted first.
7814bc0770Smrg#
7914bc0770Smrg# $ac_aux_dir/missing
8014bc0770Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8114bc0770Smrg# $top_srcdir/$ac_aux_dir/missing
8214bc0770Smrg#    fails if $ac_aux_dir is absolute,
8314bc0770Smrg#    fails when called from a subdirectory in a VPATH build with
8414bc0770Smrg#          a relative $ac_aux_dir
8514bc0770Smrg#
8614bc0770Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8714bc0770Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8814bc0770Smrg# harmless because $srcdir is '.', but things will broke when you
8914bc0770Smrg# start a VPATH build or use an absolute $srcdir.
9014bc0770Smrg#
9114bc0770Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9214bc0770Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9314bc0770Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9414bc0770Smrg# and then we would define $MISSING as
9514bc0770Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9614bc0770Smrg# This will work as long as MISSING is not called from configure, because
9714bc0770Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9814bc0770Smrg# However there are other variables, like CC, which are often used in
9914bc0770Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10014bc0770Smrg#
10114bc0770Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10214bc0770Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10314bc0770Smrg# configured tree to be moved without reconfiguration.
10414bc0770Smrg
10514bc0770SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10614bc0770Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10714bc0770Smrg# Expand $ac_aux_dir to an absolute path.
10814bc0770Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
109688b3aecSmrg])
110e9554658Smrg
11114bc0770Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112e9554658Smrg
11314bc0770Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
11414bc0770Smrg#
11514bc0770Smrg# This file is free software; the Free Software Foundation
11614bc0770Smrg# gives unlimited permission to copy and/or distribute it,
11714bc0770Smrg# with or without modifications, as long as this notice is preserved.
118e9554658Smrg
11914bc0770Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12014bc0770Smrg# -------------------------------------
12114bc0770Smrg# Define a conditional.
12214bc0770SmrgAC_DEFUN([AM_CONDITIONAL],
12314bc0770Smrg[AC_PREREQ([2.52])dnl
12414bc0770Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12514bc0770Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12614bc0770SmrgAC_SUBST([$1_TRUE])dnl
12714bc0770SmrgAC_SUBST([$1_FALSE])dnl
12814bc0770Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12914bc0770Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13014bc0770Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13114bc0770Smrgif $2; then
13214bc0770Smrg  $1_TRUE=
13314bc0770Smrg  $1_FALSE='#'
13414bc0770Smrgelse
13514bc0770Smrg  $1_TRUE='#'
13614bc0770Smrg  $1_FALSE=
13714bc0770Smrgfi
13814bc0770SmrgAC_CONFIG_COMMANDS_PRE(
13914bc0770Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14014bc0770Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14114bc0770SmrgUsually this means the macro was only invoked conditionally.]])
14214bc0770Smrgfi])])
143e9554658Smrg
14414bc0770Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
14514bc0770Smrg#
14614bc0770Smrg# This file is free software; the Free Software Foundation
14714bc0770Smrg# gives unlimited permission to copy and/or distribute it,
14814bc0770Smrg# with or without modifications, as long as this notice is preserved.
149e9554658Smrg
150e9554658Smrg
15114bc0770Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15214bc0770Smrg# written in clear, in which case automake, when reading aclocal.m4,
15314bc0770Smrg# will think it sees a *use*, and therefore will trigger all it's
15414bc0770Smrg# C support machinery.  Also note that it means that autoscan, seeing
15514bc0770Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156e9554658Smrg
157e9554658Smrg
15814bc0770Smrg# _AM_DEPENDENCIES(NAME)
15914bc0770Smrg# ----------------------
16014bc0770Smrg# See how the compiler implements dependency checking.
16114bc0770Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16214bc0770Smrg# We try a few techniques and use that to set a single cache variable.
16314bc0770Smrg#
16414bc0770Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16514bc0770Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16614bc0770Smrg# dependency, and given that the user is not expected to run this macro,
16714bc0770Smrg# just rely on AC_PROG_CC.
16814bc0770SmrgAC_DEFUN([_AM_DEPENDENCIES],
16914bc0770Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17014bc0770SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17114bc0770SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17214bc0770SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
173e9554658Smrg
17414bc0770Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17514bc0770Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17614bc0770Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17714bc0770Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17814bc0770Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17914bc0770Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18014bc0770Smrg                    [depcc="$$1"   am_compiler_list=])
181e9554658Smrg
18214bc0770SmrgAC_CACHE_CHECK([dependency style of $depcc],
18314bc0770Smrg               [am_cv_$1_dependencies_compiler_type],
18414bc0770Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18514bc0770Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
18614bc0770Smrg  # making bogus files that we don't know about and never remove.  For
18714bc0770Smrg  # instance it was reported that on HP-UX the gcc test will end up
18814bc0770Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18914bc0770Smrg  # in D".
19014bc0770Smrg  rm -rf conftest.dir
19114bc0770Smrg  mkdir conftest.dir
19214bc0770Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19314bc0770Smrg  # using a relative directory.
19414bc0770Smrg  cp "$am_depcomp" conftest.dir
19514bc0770Smrg  cd conftest.dir
19614bc0770Smrg  # We will build objects and dependencies in a subdirectory because
19714bc0770Smrg  # it helps to detect inapplicable dependency modes.  For instance
19814bc0770Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19914bc0770Smrg  # side effect of compilation, but ICC will put the dependencies in
20014bc0770Smrg  # the current directory while Tru64 will put them in the object
20114bc0770Smrg  # directory.
20214bc0770Smrg  mkdir sub
203e9554658Smrg
20414bc0770Smrg  am_cv_$1_dependencies_compiler_type=none
20514bc0770Smrg  if test "$am_compiler_list" = ""; then
20614bc0770Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20714bc0770Smrg  fi
20814bc0770Smrg  am__universal=false
20914bc0770Smrg  m4_case([$1], [CC],
21014bc0770Smrg    [case " $depcc " in #(
21114bc0770Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21214bc0770Smrg     esac],
21314bc0770Smrg    [CXX],
21414bc0770Smrg    [case " $depcc " in #(
21514bc0770Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21614bc0770Smrg     esac])
217e9554658Smrg
21814bc0770Smrg  for depmode in $am_compiler_list; do
21914bc0770Smrg    # Setup a source with many dependencies, because some compilers
22014bc0770Smrg    # like to wrap large dependency lists on column 80 (with \), and
22114bc0770Smrg    # we should not choose a depcomp mode which is confused by this.
22214bc0770Smrg    #
22314bc0770Smrg    # We need to recreate these files for each test, as the compiler may
22414bc0770Smrg    # overwrite some of them when testing with obscure command lines.
22514bc0770Smrg    # This happens at least with the AIX C compiler.
22614bc0770Smrg    : > sub/conftest.c
22714bc0770Smrg    for i in 1 2 3 4 5 6; do
22814bc0770Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22914bc0770Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23014bc0770Smrg      # Solaris 10 /bin/sh.
23114bc0770Smrg      echo '/* dummy */' > sub/conftst$i.h
23214bc0770Smrg    done
23314bc0770Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234e9554658Smrg
23514bc0770Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
23614bc0770Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23714bc0770Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23814bc0770Smrg    # versions had trouble with output in subdirs.
23914bc0770Smrg    am__obj=sub/conftest.${OBJEXT-o}
24014bc0770Smrg    am__minus_obj="-o $am__obj"
24114bc0770Smrg    case $depmode in
24214bc0770Smrg    gcc)
24314bc0770Smrg      # This depmode causes a compiler race in universal mode.
24414bc0770Smrg      test "$am__universal" = false || continue
245c2b339b4Smrg      ;;
24614bc0770Smrg    nosideeffect)
24714bc0770Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24814bc0770Smrg      # only be used when explicitly requested.
24914bc0770Smrg      if test "x$enable_dependency_tracking" = xyes; then
25014bc0770Smrg	continue
25114bc0770Smrg      else
25214bc0770Smrg	break
25314bc0770Smrg      fi
25414bc0770Smrg      ;;
25514bc0770Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25614bc0770Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
25714bc0770Smrg      # not run yet.  These depmodes are late enough in the game, and
25814bc0770Smrg      # so weak that their functioning should not be impacted.
25914bc0770Smrg      am__obj=conftest.${OBJEXT-o}
26014bc0770Smrg      am__minus_obj=
26114bc0770Smrg      ;;
26214bc0770Smrg    none) break ;;
26314bc0770Smrg    esac
26414bc0770Smrg    if depmode=$depmode \
26514bc0770Smrg       source=sub/conftest.c object=$am__obj \
26614bc0770Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
26714bc0770Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26814bc0770Smrg         >/dev/null 2>conftest.err &&
26914bc0770Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27014bc0770Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27114bc0770Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27214bc0770Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27314bc0770Smrg      # icc doesn't choke on unknown options, it will just issue warnings
27414bc0770Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
27514bc0770Smrg      # that says an option was ignored or not supported.
27614bc0770Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27714bc0770Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27814bc0770Smrg      # The diagnosis changed in icc 8.0:
27914bc0770Smrg      #   icc: Command line remark: option '-MP' not supported
28014bc0770Smrg      if (grep 'ignoring option' conftest.err ||
28114bc0770Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28214bc0770Smrg        am_cv_$1_dependencies_compiler_type=$depmode
28314bc0770Smrg        break
28414bc0770Smrg      fi
285e9554658Smrg    fi
286e9554658Smrg  done
28714bc0770Smrg
28814bc0770Smrg  cd ..
28914bc0770Smrg  rm -rf conftest.dir
290688b3aecSmrgelse
29114bc0770Smrg  am_cv_$1_dependencies_compiler_type=none
292e9554658Smrgfi
29314bc0770Smrg])
29414bc0770SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29514bc0770SmrgAM_CONDITIONAL([am__fastdep$1], [
29614bc0770Smrg  test "x$enable_dependency_tracking" != xno \
29714bc0770Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298e9554658Smrg])
299e9554658Smrg
300e9554658Smrg
30114bc0770Smrg# AM_SET_DEPDIR
30214bc0770Smrg# -------------
30314bc0770Smrg# Choose a directory name for dependency files.
30414bc0770Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30514bc0770SmrgAC_DEFUN([AM_SET_DEPDIR],
30614bc0770Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30714bc0770SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30814bc0770Smrg])
309e9554658Smrg
310e9554658Smrg
31114bc0770Smrg# AM_DEP_TRACK
31214bc0770Smrg# ------------
31314bc0770SmrgAC_DEFUN([AM_DEP_TRACK],
31414bc0770Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31514bc0770SmrgAS_HELP_STRING(
31614bc0770Smrg  [--enable-dependency-tracking],
31714bc0770Smrg  [do not reject slow dependency extractors])
31814bc0770SmrgAS_HELP_STRING(
31914bc0770Smrg  [--disable-dependency-tracking],
32014bc0770Smrg  [speeds up one-time build])])
32114bc0770Smrgif test "x$enable_dependency_tracking" != xno; then
32214bc0770Smrg  am_depcomp="$ac_aux_dir/depcomp"
32314bc0770Smrg  AMDEPBACKSLASH='\'
32414bc0770Smrg  am__nodep='_no'
32514bc0770Smrgfi
32614bc0770SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32714bc0770SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32814bc0770Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32914bc0770SmrgAC_SUBST([am__nodep])dnl
33014bc0770Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
331e9554658Smrg])
332e9554658Smrg
33314bc0770Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
334e9554658Smrg
33514bc0770Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
33614bc0770Smrg#
33714bc0770Smrg# This file is free software; the Free Software Foundation
33814bc0770Smrg# gives unlimited permission to copy and/or distribute it,
33914bc0770Smrg# with or without modifications, as long as this notice is preserved.
340e9554658Smrg
34114bc0770Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34214bc0770Smrg# ------------------------------
34314bc0770SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34414bc0770Smrg[{
34514bc0770Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
34614bc0770Smrg  # are listed without --file.  Let's play safe and only enable the eval
34714bc0770Smrg  # if we detect the quoting.
34814bc0770Smrg  # TODO: see whether this extra hack can be removed once we start
34914bc0770Smrg  # requiring Autoconf 2.70 or later.
35014bc0770Smrg  AS_CASE([$CONFIG_FILES],
35114bc0770Smrg          [*\'*], [eval set x "$CONFIG_FILES"],
35214bc0770Smrg          [*], [set x $CONFIG_FILES])
35314bc0770Smrg  shift
35414bc0770Smrg  # Used to flag and report bootstrapping failures.
35514bc0770Smrg  am_rc=0
35614bc0770Smrg  for am_mf
35714bc0770Smrg  do
35814bc0770Smrg    # Strip MF so we end up with the name of the file.
35914bc0770Smrg    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
36014bc0770Smrg    # Check whether this is an Automake generated Makefile which includes
36114bc0770Smrg    # dependency-tracking related rules and includes.
36214bc0770Smrg    # Grep'ing the whole file directly is not great: AIX grep has a line
36314bc0770Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
36414bc0770Smrg    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
36514bc0770Smrg      || continue
36614bc0770Smrg    am_dirpart=`AS_DIRNAME(["$am_mf"])`
36714bc0770Smrg    am_filepart=`AS_BASENAME(["$am_mf"])`
36814bc0770Smrg    AM_RUN_LOG([cd "$am_dirpart" \
36914bc0770Smrg      && sed -e '/# am--include-marker/d' "$am_filepart" \
37014bc0770Smrg        | $MAKE -f - am--depfiles]) || am_rc=$?
37114bc0770Smrg  done
37214bc0770Smrg  if test $am_rc -ne 0; then
37314bc0770Smrg    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
37414bc0770Smrg    for automatic dependency tracking.  If GNU make was not used, consider
37514bc0770Smrg    re-running the configure script with MAKE="gmake" (or whatever is
37614bc0770Smrg    necessary).  You can also try re-running configure with the
37714bc0770Smrg    '--disable-dependency-tracking' option to at least be able to build
37814bc0770Smrg    the package (albeit without support for automatic dependency tracking).])
379e9554658Smrg  fi
38014bc0770Smrg  AS_UNSET([am_dirpart])
38114bc0770Smrg  AS_UNSET([am_filepart])
38214bc0770Smrg  AS_UNSET([am_mf])
38314bc0770Smrg  AS_UNSET([am_rc])
38414bc0770Smrg  rm -f conftest-deps.mk
38514bc0770Smrg}
38614bc0770Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387e9554658Smrg
388e9554658Smrg
38914bc0770Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39014bc0770Smrg# -----------------------------
39114bc0770Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
39214bc0770Smrg#
39314bc0770Smrg# This code is only required when automatic dependency tracking is enabled.
39414bc0770Smrg# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
39514bc0770Smrg# order to bootstrap the dependency handling code.
39614bc0770SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
39714bc0770Smrg[AC_CONFIG_COMMANDS([depfiles],
39814bc0770Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
39914bc0770Smrg     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
40014bc0770Smrg
40114bc0770Smrg# Do all the work for Automake.                             -*- Autoconf -*-
40214bc0770Smrg
40314bc0770Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
40414bc0770Smrg#
40514bc0770Smrg# This file is free software; the Free Software Foundation
40614bc0770Smrg# gives unlimited permission to copy and/or distribute it,
40714bc0770Smrg# with or without modifications, as long as this notice is preserved.
40814bc0770Smrg
40914bc0770Smrg# This macro actually does too much.  Some checks are only needed if
41014bc0770Smrg# your package does certain things.  But this isn't really a big deal.
41114bc0770Smrg
41214bc0770Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
41314bc0770Smrgm4_define([AC_PROG_CC],
41414bc0770Smrgm4_defn([AC_PROG_CC])
41514bc0770Smrg[_AM_PROG_CC_C_O
416688b3aecSmrg])
417e9554658Smrg
41814bc0770Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
41914bc0770Smrg# AM_INIT_AUTOMAKE([OPTIONS])
42014bc0770Smrg# -----------------------------------------------
42114bc0770Smrg# The call with PACKAGE and VERSION arguments is the old style
42214bc0770Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42314bc0770Smrg# and VERSION should now be passed to AC_INIT and removed from
42414bc0770Smrg# the call to AM_INIT_AUTOMAKE.
42514bc0770Smrg# We support both call styles for the transition.  After
42614bc0770Smrg# the next Automake release, Autoconf can make the AC_INIT
42714bc0770Smrg# arguments mandatory, and then we can depend on a new Autoconf
42814bc0770Smrg# release and drop the old call support.
42914bc0770SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43014bc0770Smrg[AC_PREREQ([2.65])dnl
43114bc0770Smrgm4_ifdef([_$0_ALREADY_INIT],
43214bc0770Smrg  [m4_fatal([$0 expanded multiple times
43314bc0770Smrg]m4_defn([_$0_ALREADY_INIT]))],
43414bc0770Smrg  [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
43514bc0770Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43614bc0770Smrgdnl the ones we care about.
43714bc0770Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43814bc0770SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43914bc0770SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44014bc0770Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44114bc0770Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44214bc0770Smrg  # is not polluted with repeated "-I."
44314bc0770Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44414bc0770Smrg  # test to see if srcdir already configured
44514bc0770Smrg  if test -f $srcdir/config.status; then
44614bc0770Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44714bc0770Smrg  fi
44814bc0770Smrgfi
44914bc0770Smrg
45014bc0770Smrg# test whether we have cygpath
45114bc0770Smrgif test -z "$CYGPATH_W"; then
45214bc0770Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45314bc0770Smrg    CYGPATH_W='cygpath -w'
45414bc0770Smrg  else
45514bc0770Smrg    CYGPATH_W=echo
45614bc0770Smrg  fi
45714bc0770Smrgfi
45814bc0770SmrgAC_SUBST([CYGPATH_W])
45914bc0770Smrg
46014bc0770Smrg# Define the identity of the package.
46114bc0770Smrgdnl Distinguish between old-style and new-style calls.
46214bc0770Smrgm4_ifval([$2],
46314bc0770Smrg[AC_DIAGNOSE([obsolete],
46414bc0770Smrg             [$0: two- and three-arguments forms are deprecated.])
46514bc0770Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46614bc0770Smrg AC_SUBST([PACKAGE], [$1])dnl
46714bc0770Smrg AC_SUBST([VERSION], [$2])],
46814bc0770Smrg[_AM_SET_OPTIONS([$1])dnl
46914bc0770Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47014bc0770Smrgm4_if(
47114bc0770Smrg  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
47214bc0770Smrg  [ok:ok],,
47314bc0770Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47414bc0770Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47514bc0770Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
47614bc0770Smrg
47714bc0770Smrg_AM_IF_OPTION([no-define],,
47814bc0770Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
47914bc0770Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
48014bc0770Smrg
48114bc0770Smrg# Some tools Automake needs.
48214bc0770SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48314bc0770SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48414bc0770SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48514bc0770SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
48614bc0770SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
48714bc0770SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
48814bc0770SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
48914bc0770SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49014bc0770SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49114bc0770SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49214bc0770Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49314bc0770Smrg# dies out for good.  For more background, see:
49414bc0770Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49514bc0770Smrg# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
49614bc0770SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49714bc0770Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
49814bc0770Smrg# system "awk" is bad on some platforms.
49914bc0770SmrgAC_REQUIRE([AC_PROG_AWK])dnl
50014bc0770SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50114bc0770SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50214bc0770Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50314bc0770Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50414bc0770Smrg			     [_AM_PROG_TAR([v7])])])
50514bc0770Smrg_AM_IF_OPTION([no-dependencies],,
50614bc0770Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50714bc0770Smrg		  [_AM_DEPENDENCIES([CC])],
50814bc0770Smrg		  [m4_define([AC_PROG_CC],
50914bc0770Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51014bc0770SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51114bc0770Smrg		  [_AM_DEPENDENCIES([CXX])],
51214bc0770Smrg		  [m4_define([AC_PROG_CXX],
51314bc0770Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51414bc0770SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51514bc0770Smrg		  [_AM_DEPENDENCIES([OBJC])],
51614bc0770Smrg		  [m4_define([AC_PROG_OBJC],
51714bc0770Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
51814bc0770SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
51914bc0770Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52014bc0770Smrg		  [m4_define([AC_PROG_OBJCXX],
52114bc0770Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
522688b3aecSmrg])
52314bc0770Smrg# Variables for tags utilities; see am/tags.am
52414bc0770Smrgif test -z "$CTAGS"; then
52514bc0770Smrg  CTAGS=ctags
52614bc0770Smrgfi
52714bc0770SmrgAC_SUBST([CTAGS])
52814bc0770Smrgif test -z "$ETAGS"; then
52914bc0770Smrg  ETAGS=etags
53014bc0770Smrgfi
53114bc0770SmrgAC_SUBST([ETAGS])
53214bc0770Smrgif test -z "$CSCOPE"; then
53314bc0770Smrg  CSCOPE=cscope
53414bc0770Smrgfi
53514bc0770SmrgAC_SUBST([CSCOPE])
536688b3aecSmrg
53714bc0770SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
53814bc0770Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
53914bc0770Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
54014bc0770Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
54114bc0770SmrgAC_CONFIG_COMMANDS_PRE(dnl
54214bc0770Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
54314bc0770Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
544688b3aecSmrg
54514bc0770Smrg# POSIX will say in a future version that running "rm -f" with no argument
54614bc0770Smrg# is OK; and we want to be able to make that assumption in our Makefile
54714bc0770Smrg# recipes.  So use an aggressive probe to check that the usage we want is
54814bc0770Smrg# actually supported "in the wild" to an acceptable degree.
54914bc0770Smrg# See automake bug#10828.
55014bc0770Smrg# To make any issue more visible, cause the running configure to be aborted
55114bc0770Smrg# by default if the 'rm' program in use doesn't match our expectations; the
55214bc0770Smrg# user can still override this though.
55314bc0770Smrgif rm -f && rm -fr && rm -rf; then : OK; else
55414bc0770Smrg  cat >&2 <<'END'
55514bc0770SmrgOops!
556688b3aecSmrg
55714bc0770SmrgYour 'rm' program seems unable to run without file operands specified
55814bc0770Smrgon the command line, even when the '-f' option is present.  This is contrary
55914bc0770Smrgto the behaviour of most rm programs out there, and not conforming with
56014bc0770Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
561688b3aecSmrg
56214bc0770SmrgPlease tell bug-automake@gnu.org about your system, including the value
56314bc0770Smrgof your $PATH and any error possibly output before this message.  This
56414bc0770Smrgcan help us improve future automake versions.
56514bc0770Smrg
56614bc0770SmrgEND
56714bc0770Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
56814bc0770Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
56914bc0770Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
57014bc0770Smrg    echo >&2
57114bc0770Smrg  else
57214bc0770Smrg    cat >&2 <<'END'
57314bc0770SmrgAborting the configuration process, to ensure you take notice of the issue.
574688b3aecSmrg
57514bc0770SmrgYou can download and install GNU coreutils to get an 'rm' implementation
57614bc0770Smrgthat behaves properly: <https://www.gnu.org/software/coreutils/>.
577688b3aecSmrg
57814bc0770SmrgIf you want to complete the configuration process using your problematic
57914bc0770Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
58014bc0770Smrgto "yes", and re-run configure.
581688b3aecSmrg
58214bc0770SmrgEND
58314bc0770Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
58414bc0770Smrg  fi
585688b3aecSmrgfi
58614bc0770Smrgdnl The trailing newline in this macro's definition is deliberate, for
58714bc0770Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
58814bc0770Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
58914bc0770Smrg])
590688b3aecSmrg
59114bc0770Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
59214bc0770Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
59314bc0770Smrgdnl mangled by Autoconf and run in a shell conditional statement.
59414bc0770Smrgm4_define([_AC_COMPILER_EXEEXT],
59514bc0770Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
596688b3aecSmrg
59714bc0770Smrg# When config.status generates a header, we must update the stamp-h file.
59814bc0770Smrg# This file resides in the same directory as the config header
59914bc0770Smrg# that is generated.  The stamp files are numbered to have different names.
600688b3aecSmrg
60114bc0770Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
60214bc0770Smrg# loop where config.status creates the headers, so we can generate
60314bc0770Smrg# our stamp files there.
60414bc0770SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
60514bc0770Smrg[# Compute $1's index in $config_headers.
60614bc0770Smrg_am_arg=$1
60714bc0770Smrg_am_stamp_count=1
60814bc0770Smrgfor _am_header in $config_headers :; do
60914bc0770Smrg  case $_am_header in
61014bc0770Smrg    $_am_arg | $_am_arg:* )
61114bc0770Smrg      break ;;
61214bc0770Smrg    * )
61314bc0770Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
61414bc0770Smrg  esac
61514bc0770Smrgdone
61614bc0770Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
617688b3aecSmrg
61814bc0770Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
61914bc0770Smrg#
62014bc0770Smrg# This file is free software; the Free Software Foundation
62114bc0770Smrg# gives unlimited permission to copy and/or distribute it,
62214bc0770Smrg# with or without modifications, as long as this notice is preserved.
623688b3aecSmrg
62414bc0770Smrg# AM_PROG_INSTALL_SH
62514bc0770Smrg# ------------------
62614bc0770Smrg# Define $install_sh.
62714bc0770SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
62814bc0770Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
62914bc0770Smrgif test x"${install_sh+set}" != xset; then
63014bc0770Smrg  case $am_aux_dir in
63114bc0770Smrg  *\ * | *\	*)
63214bc0770Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
63314bc0770Smrg  *)
63414bc0770Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
63514bc0770Smrg  esac
63614bc0770Smrgfi
63714bc0770SmrgAC_SUBST([install_sh])])
638688b3aecSmrg
63914bc0770Smrg# Copyright (C) 2003-2021 Free Software Foundation, Inc.
64014bc0770Smrg#
64114bc0770Smrg# This file is free software; the Free Software Foundation
64214bc0770Smrg# gives unlimited permission to copy and/or distribute it,
64314bc0770Smrg# with or without modifications, as long as this notice is preserved.
644688b3aecSmrg
64514bc0770Smrg# Check whether the underlying file-system supports filenames
64614bc0770Smrg# with a leading dot.  For instance MS-DOS doesn't.
64714bc0770SmrgAC_DEFUN([AM_SET_LEADING_DOT],
64814bc0770Smrg[rm -rf .tst 2>/dev/null
64914bc0770Smrgmkdir .tst 2>/dev/null
65014bc0770Smrgif test -d .tst; then
65114bc0770Smrg  am__leading_dot=.
65214bc0770Smrgelse
65314bc0770Smrg  am__leading_dot=_
65414bc0770Smrgfi
65514bc0770Smrgrmdir .tst 2>/dev/null
65614bc0770SmrgAC_SUBST([am__leading_dot])])
657688b3aecSmrg
65814bc0770Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
659688b3aecSmrg
66014bc0770Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
66114bc0770Smrg#
66214bc0770Smrg# This file is free software; the Free Software Foundation
66314bc0770Smrg# gives unlimited permission to copy and/or distribute it,
66414bc0770Smrg# with or without modifications, as long as this notice is preserved.
665688b3aecSmrg
66614bc0770Smrg# AM_MAKE_INCLUDE()
66714bc0770Smrg# -----------------
66814bc0770Smrg# Check whether make has an 'include' directive that can support all
66914bc0770Smrg# the idioms we need for our automatic dependency tracking code.
67014bc0770SmrgAC_DEFUN([AM_MAKE_INCLUDE],
67114bc0770Smrg[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
67214bc0770Smrgcat > confinc.mk << 'END'
67314bc0770Smrgam__doit:
67414bc0770Smrg	@echo this is the am__doit target >confinc.out
67514bc0770Smrg.PHONY: am__doit
67614bc0770SmrgEND
67714bc0770Smrgam__include="#"
67814bc0770Smrgam__quote=
67914bc0770Smrg# BSD make does it like this.
68014bc0770Smrgecho '.include "confinc.mk" # ignored' > confmf.BSD
68114bc0770Smrg# Other make implementations (GNU, Solaris 10, AIX) do it like this.
68214bc0770Smrgecho 'include confinc.mk # ignored' > confmf.GNU
68314bc0770Smrg_am_result=no
68414bc0770Smrgfor s in GNU BSD; do
68514bc0770Smrg  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
68614bc0770Smrg  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
68714bc0770Smrg      ['0:this is the am__doit target'],
68814bc0770Smrg      [AS_CASE([$s],
68914bc0770Smrg          [BSD], [am__include='.include' am__quote='"'],
69014bc0770Smrg          [am__include='include' am__quote=''])])
69114bc0770Smrg  if test "$am__include" != "#"; then
69214bc0770Smrg    _am_result="yes ($s style)"
69314bc0770Smrg    break
69414bc0770Smrg  fi
69514bc0770Smrgdone
69614bc0770Smrgrm -f confinc.* confmf.*
69714bc0770SmrgAC_MSG_RESULT([${_am_result}])
69814bc0770SmrgAC_SUBST([am__include])])
69914bc0770SmrgAC_SUBST([am__quote])])
700688b3aecSmrg
70114bc0770Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
702688b3aecSmrg
70314bc0770Smrg# Copyright (C) 1997-2021 Free Software Foundation, Inc.
70414bc0770Smrg#
70514bc0770Smrg# This file is free software; the Free Software Foundation
70614bc0770Smrg# gives unlimited permission to copy and/or distribute it,
70714bc0770Smrg# with or without modifications, as long as this notice is preserved.
708688b3aecSmrg
70914bc0770Smrg# AM_MISSING_PROG(NAME, PROGRAM)
71014bc0770Smrg# ------------------------------
71114bc0770SmrgAC_DEFUN([AM_MISSING_PROG],
71214bc0770Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71314bc0770Smrg$1=${$1-"${am_missing_run}$2"}
71414bc0770SmrgAC_SUBST($1)])
715688b3aecSmrg
71614bc0770Smrg# AM_MISSING_HAS_RUN
71714bc0770Smrg# ------------------
71814bc0770Smrg# Define MISSING if not defined so far and test if it is modern enough.
71914bc0770Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
72014bc0770SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
72114bc0770Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
72214bc0770SmrgAC_REQUIRE_AUX_FILE([missing])dnl
72314bc0770Smrgif test x"${MISSING+set}" != xset; then
72414bc0770Smrg  MISSING="\${SHELL} '$am_aux_dir/missing'"
72514bc0770Smrgfi
72614bc0770Smrg# Use eval to expand $SHELL
72714bc0770Smrgif eval "$MISSING --is-lightweight"; then
72814bc0770Smrg  am_missing_run="$MISSING "
72914bc0770Smrgelse
73014bc0770Smrg  am_missing_run=
73114bc0770Smrg  AC_MSG_WARN(['missing' script is too old or missing])
73214bc0770Smrgfi
73314bc0770Smrg])
734688b3aecSmrg
73514bc0770Smrg# Helper functions for option handling.                     -*- Autoconf -*-
736688b3aecSmrg
73714bc0770Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
73814bc0770Smrg#
73914bc0770Smrg# This file is free software; the Free Software Foundation
74014bc0770Smrg# gives unlimited permission to copy and/or distribute it,
74114bc0770Smrg# with or without modifications, as long as this notice is preserved.
742688b3aecSmrg
74314bc0770Smrg# _AM_MANGLE_OPTION(NAME)
74414bc0770Smrg# -----------------------
74514bc0770SmrgAC_DEFUN([_AM_MANGLE_OPTION],
74614bc0770Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
747688b3aecSmrg
74814bc0770Smrg# _AM_SET_OPTION(NAME)
74914bc0770Smrg# --------------------
75014bc0770Smrg# Set option NAME.  Presently that only means defining a flag for this option.
75114bc0770SmrgAC_DEFUN([_AM_SET_OPTION],
75214bc0770Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
753688b3aecSmrg
75414bc0770Smrg# _AM_SET_OPTIONS(OPTIONS)
75514bc0770Smrg# ------------------------
75614bc0770Smrg# OPTIONS is a space-separated list of Automake options.
75714bc0770SmrgAC_DEFUN([_AM_SET_OPTIONS],
75814bc0770Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
759688b3aecSmrg
76014bc0770Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76114bc0770Smrg# -------------------------------------------
76214bc0770Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76314bc0770SmrgAC_DEFUN([_AM_IF_OPTION],
76414bc0770Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
765688b3aecSmrg
76614bc0770Smrg# Copyright (C) 1999-2021 Free Software Foundation, Inc.
76714bc0770Smrg#
76814bc0770Smrg# This file is free software; the Free Software Foundation
76914bc0770Smrg# gives unlimited permission to copy and/or distribute it,
77014bc0770Smrg# with or without modifications, as long as this notice is preserved.
771688b3aecSmrg
77214bc0770Smrg# _AM_PROG_CC_C_O
77314bc0770Smrg# ---------------
77414bc0770Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77514bc0770Smrg# to automatically call this.
77614bc0770SmrgAC_DEFUN([_AM_PROG_CC_C_O],
77714bc0770Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
77814bc0770SmrgAC_REQUIRE_AUX_FILE([compile])dnl
77914bc0770SmrgAC_LANG_PUSH([C])dnl
78014bc0770SmrgAC_CACHE_CHECK(
78114bc0770Smrg  [whether $CC understands -c and -o together],
78214bc0770Smrg  [am_cv_prog_cc_c_o],
78314bc0770Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78414bc0770Smrg  # Make sure it works both with $CC and with simple cc.
78514bc0770Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78614bc0770Smrg  # compilers refuse to overwrite an existing .o file with -o,
78714bc0770Smrg  # though they will create one.
78814bc0770Smrg  am_cv_prog_cc_c_o=yes
78914bc0770Smrg  for am_i in 1 2; do
79014bc0770Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79114bc0770Smrg         && test -f conftest2.$ac_objext; then
79214bc0770Smrg      : OK
79314bc0770Smrg    else
79414bc0770Smrg      am_cv_prog_cc_c_o=no
79514bc0770Smrg      break
79614bc0770Smrg    fi
79714bc0770Smrg  done
79814bc0770Smrg  rm -f core conftest*
79914bc0770Smrg  unset am_i])
80014bc0770Smrgif test "$am_cv_prog_cc_c_o" != yes; then
80114bc0770Smrg   # Losing compiler, so override with the script.
80214bc0770Smrg   # FIXME: It is wrong to rewrite CC.
80314bc0770Smrg   # But if we don't then we get into trouble of one sort or another.
80414bc0770Smrg   # A longer-term fix would be to have automake use am__CC in this case,
80514bc0770Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80614bc0770Smrg   CC="$am_aux_dir/compile $CC"
80714bc0770Smrgfi
80814bc0770SmrgAC_LANG_POP([C])])
809688b3aecSmrg
81014bc0770Smrg# For backward compatibility.
81114bc0770SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
812688b3aecSmrg
81314bc0770Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
81414bc0770Smrg#
81514bc0770Smrg# This file is free software; the Free Software Foundation
81614bc0770Smrg# gives unlimited permission to copy and/or distribute it,
81714bc0770Smrg# with or without modifications, as long as this notice is preserved.
818688b3aecSmrg
81914bc0770Smrg# AM_RUN_LOG(COMMAND)
82014bc0770Smrg# -------------------
82114bc0770Smrg# Run COMMAND, save the exit status in ac_status, and log it.
82214bc0770Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82314bc0770SmrgAC_DEFUN([AM_RUN_LOG],
82414bc0770Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82514bc0770Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82614bc0770Smrg   ac_status=$?
82714bc0770Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
82814bc0770Smrg   (exit $ac_status); }])
829688b3aecSmrg
83014bc0770Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
831688b3aecSmrg
83214bc0770Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc.
833688b3aecSmrg#
83414bc0770Smrg# This file is free software; the Free Software Foundation
83514bc0770Smrg# gives unlimited permission to copy and/or distribute it,
83614bc0770Smrg# with or without modifications, as long as this notice is preserved.
837688b3aecSmrg
83814bc0770Smrg# AM_SANITY_CHECK
83914bc0770Smrg# ---------------
84014bc0770SmrgAC_DEFUN([AM_SANITY_CHECK],
84114bc0770Smrg[AC_MSG_CHECKING([whether build environment is sane])
84214bc0770Smrg# Reject unsafe characters in $srcdir or the absolute working directory
84314bc0770Smrg# name.  Accept space and tab only in the latter.
84414bc0770Smrgam_lf='
84514bc0770Smrg'
84614bc0770Smrgcase `pwd` in
84714bc0770Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
84814bc0770Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
84914bc0770Smrgesac
85014bc0770Smrgcase $srcdir in
85114bc0770Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85214bc0770Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
85314bc0770Smrgesac
85414bc0770Smrg
85514bc0770Smrg# Do 'set' in a subshell so we don't clobber the current shell's
85614bc0770Smrg# arguments.  Must try -L first in case configure is actually a
85714bc0770Smrg# symlink; some systems play weird games with the mod time of symlinks
85814bc0770Smrg# (eg FreeBSD returns the mod time of the symlink's containing
85914bc0770Smrg# directory).
86014bc0770Smrgif (
86114bc0770Smrg   am_has_slept=no
86214bc0770Smrg   for am_try in 1 2; do
86314bc0770Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86414bc0770Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86514bc0770Smrg     if test "$[*]" = "X"; then
86614bc0770Smrg	# -L didn't work.
86714bc0770Smrg	set X `ls -t "$srcdir/configure" conftest.file`
86814bc0770Smrg     fi
86914bc0770Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
87014bc0770Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
871688b3aecSmrg
87214bc0770Smrg	# If neither matched, then we have a broken ls.  This can happen
87314bc0770Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87414bc0770Smrg	# broken ls alias from the environment.  This has actually
87514bc0770Smrg	# happened.  Such a system could not be considered "sane".
87614bc0770Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87714bc0770Smrg  alias in your environment])
87814bc0770Smrg     fi
87914bc0770Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
88014bc0770Smrg       break
88114bc0770Smrg     fi
88214bc0770Smrg     # Just in case.
88314bc0770Smrg     sleep 1
88414bc0770Smrg     am_has_slept=yes
88514bc0770Smrg   done
88614bc0770Smrg   test "$[2]" = conftest.file
88714bc0770Smrg   )
88814bc0770Smrgthen
88914bc0770Smrg   # Ok.
89014bc0770Smrg   :
891688b3aecSmrgelse
89214bc0770Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
89314bc0770SmrgCheck your system clock])
894688b3aecSmrgfi
89514bc0770SmrgAC_MSG_RESULT([yes])
89614bc0770Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89714bc0770Smrg# generated files are strictly newer.
89814bc0770Smrgam_sleep_pid=
89914bc0770Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
90014bc0770Smrg  ( sleep 1 ) &
90114bc0770Smrg  am_sleep_pid=$!
902688b3aecSmrgfi
90314bc0770SmrgAC_CONFIG_COMMANDS_PRE(
90414bc0770Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90514bc0770Smrg   if test -n "$am_sleep_pid"; then
90614bc0770Smrg     # Hide warnings about reused PIDs.
90714bc0770Smrg     wait $am_sleep_pid 2>/dev/null
90814bc0770Smrg   fi
90914bc0770Smrg   AC_MSG_RESULT([done])])
91014bc0770Smrgrm -f conftest.file
91114bc0770Smrg])
912688b3aecSmrg
91314bc0770Smrg# Copyright (C) 2009-2021 Free Software Foundation, Inc.
914688b3aecSmrg#
91514bc0770Smrg# This file is free software; the Free Software Foundation
91614bc0770Smrg# gives unlimited permission to copy and/or distribute it,
91714bc0770Smrg# with or without modifications, as long as this notice is preserved.
918688b3aecSmrg
91914bc0770Smrg# AM_SILENT_RULES([DEFAULT])
92014bc0770Smrg# --------------------------
92114bc0770Smrg# Enable less verbose build rules; with the default set to DEFAULT
92214bc0770Smrg# ("yes" being less verbose, "no" or empty being verbose).
92314bc0770SmrgAC_DEFUN([AM_SILENT_RULES],
92414bc0770Smrg[AC_ARG_ENABLE([silent-rules], [dnl
92514bc0770SmrgAS_HELP_STRING(
92614bc0770Smrg  [--enable-silent-rules],
92714bc0770Smrg  [less verbose build output (undo: "make V=1")])
92814bc0770SmrgAS_HELP_STRING(
92914bc0770Smrg  [--disable-silent-rules],
93014bc0770Smrg  [verbose build output (undo: "make V=0")])dnl
93114bc0770Smrg])
93214bc0770Smrgcase $enable_silent_rules in @%:@ (((
93314bc0770Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
93414bc0770Smrg   no) AM_DEFAULT_VERBOSITY=1;;
93514bc0770Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
93614bc0770Smrgesac
93714bc0770Smrgdnl
93814bc0770Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
93914bc0770Smrgdnl do not support nested variable expansions.
94014bc0770Smrgdnl See automake bug#9928 and bug#10237.
94114bc0770Smrgam_make=${MAKE-make}
94214bc0770SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94314bc0770Smrg   [am_cv_make_support_nested_variables],
94414bc0770Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94514bc0770SmrgBAR0=false
94614bc0770SmrgBAR1=true
94714bc0770SmrgV=1
94814bc0770Smrgam__doit:
94914bc0770Smrg	@$(TRUE)
95014bc0770Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95114bc0770Smrg  am_cv_make_support_nested_variables=yes
95214bc0770Smrgelse
95314bc0770Smrg  am_cv_make_support_nested_variables=no
95414bc0770Smrgfi])
95514bc0770Smrgif test $am_cv_make_support_nested_variables = yes; then
95614bc0770Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95714bc0770Smrg  AM_V='$(V)'
95814bc0770Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
95914bc0770Smrgelse
96014bc0770Smrg  AM_V=$AM_DEFAULT_VERBOSITY
96114bc0770Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
962688b3aecSmrgfi
96314bc0770SmrgAC_SUBST([AM_V])dnl
96414bc0770SmrgAM_SUBST_NOTMAKE([AM_V])dnl
96514bc0770SmrgAC_SUBST([AM_DEFAULT_V])dnl
96614bc0770SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
96714bc0770SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
96814bc0770SmrgAM_BACKSLASH='\'
96914bc0770SmrgAC_SUBST([AM_BACKSLASH])dnl
97014bc0770Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
97114bc0770Smrg])
972688b3aecSmrg
97314bc0770Smrg# Copyright (C) 2001-2021 Free Software Foundation, Inc.
97414bc0770Smrg#
97514bc0770Smrg# This file is free software; the Free Software Foundation
97614bc0770Smrg# gives unlimited permission to copy and/or distribute it,
97714bc0770Smrg# with or without modifications, as long as this notice is preserved.
978688b3aecSmrg
97914bc0770Smrg# AM_PROG_INSTALL_STRIP
98014bc0770Smrg# ---------------------
98114bc0770Smrg# One issue with vendor 'install' (even GNU) is that you can't
98214bc0770Smrg# specify the program used to strip binaries.  This is especially
98314bc0770Smrg# annoying in cross-compiling environments, where the build's strip
98414bc0770Smrg# is unlikely to handle the host's binaries.
98514bc0770Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98614bc0770Smrg# always use install-sh in "make install-strip", and initialize
98714bc0770Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
98814bc0770SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
98914bc0770Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
99014bc0770Smrg# Installed binaries are usually stripped using 'strip' when the user
99114bc0770Smrg# run "make install-strip".  However 'strip' might not be the right
99214bc0770Smrg# tool to use in cross-compilation environments, therefore Automake
99314bc0770Smrg# will honor the 'STRIP' environment variable to overrule this program.
99414bc0770Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99514bc0770Smrgif test "$cross_compiling" != no; then
99614bc0770Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
997688b3aecSmrgfi
99814bc0770SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
99914bc0770SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
1000688b3aecSmrg
100114bc0770Smrg# Copyright (C) 2006-2021 Free Software Foundation, Inc.
100214bc0770Smrg#
100314bc0770Smrg# This file is free software; the Free Software Foundation
100414bc0770Smrg# gives unlimited permission to copy and/or distribute it,
100514bc0770Smrg# with or without modifications, as long as this notice is preserved.
1006688b3aecSmrg
100714bc0770Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
100814bc0770Smrg# ---------------------------
100914bc0770Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101014bc0770Smrg# This macro is traced by Automake.
101114bc0770SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1012688b3aecSmrg
101314bc0770Smrg# AM_SUBST_NOTMAKE(VARIABLE)
101414bc0770Smrg# --------------------------
101514bc0770Smrg# Public sister of _AM_SUBST_NOTMAKE.
101614bc0770SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1017688b3aecSmrg
101814bc0770Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1019688b3aecSmrg
102014bc0770Smrg# Copyright (C) 2004-2021 Free Software Foundation, Inc.
102114bc0770Smrg#
102214bc0770Smrg# This file is free software; the Free Software Foundation
102314bc0770Smrg# gives unlimited permission to copy and/or distribute it,
102414bc0770Smrg# with or without modifications, as long as this notice is preserved.
1025688b3aecSmrg
102614bc0770Smrg# _AM_PROG_TAR(FORMAT)
102714bc0770Smrg# --------------------
102814bc0770Smrg# Check how to create a tarball in format FORMAT.
102914bc0770Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
103014bc0770Smrg#
103114bc0770Smrg# Substitute a variable $(am__tar) that is a command
103214bc0770Smrg# writing to stdout a FORMAT-tarball containing the directory
103314bc0770Smrg# $tardir.
103414bc0770Smrg#     tardir=directory && $(am__tar) > result.tar
103514bc0770Smrg#
103614bc0770Smrg# Substitute a variable $(am__untar) that extract such
103714bc0770Smrg# a tarball read from stdin.
103814bc0770Smrg#     $(am__untar) < result.tar
103914bc0770Smrg#
104014bc0770SmrgAC_DEFUN([_AM_PROG_TAR],
104114bc0770Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104214bc0770Smrg# in the wild :-(  We should find a proper way to deprecate it ...
104314bc0770SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
1044688b3aecSmrg
104514bc0770Smrg# We'll loop over all known methods to create a tar archive until one works.
104614bc0770Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1047688b3aecSmrg
104814bc0770Smrgm4_if([$1], [v7],
104914bc0770Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1050688b3aecSmrg
105114bc0770Smrg  [m4_case([$1],
105214bc0770Smrg    [ustar],
105314bc0770Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105414bc0770Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105514bc0770Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105614bc0770Smrg      # and bug#13588).
105714bc0770Smrg      am_max_uid=2097151 # 2^21 - 1
105814bc0770Smrg      am_max_gid=$am_max_uid
105914bc0770Smrg      # The $UID and $GID variables are not portable, so we need to resort
106014bc0770Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106114bc0770Smrg      # below are definitely unexpected, so allow the users to see them
106214bc0770Smrg      # (that is, avoid stderr redirection).
106314bc0770Smrg      am_uid=`id -u || echo unknown`
106414bc0770Smrg      am_gid=`id -g || echo unknown`
106514bc0770Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106614bc0770Smrg      if test $am_uid -le $am_max_uid; then
106714bc0770Smrg         AC_MSG_RESULT([yes])
106814bc0770Smrg      else
106914bc0770Smrg         AC_MSG_RESULT([no])
107014bc0770Smrg         _am_tools=none
107114bc0770Smrg      fi
107214bc0770Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107314bc0770Smrg      if test $am_gid -le $am_max_gid; then
107414bc0770Smrg         AC_MSG_RESULT([yes])
107514bc0770Smrg      else
107614bc0770Smrg        AC_MSG_RESULT([no])
107714bc0770Smrg        _am_tools=none
107814bc0770Smrg      fi],
1079688b3aecSmrg
108014bc0770Smrg  [pax],
108114bc0770Smrg    [],
1082688b3aecSmrg
108314bc0770Smrg  [m4_fatal([Unknown tar format])])
1084688b3aecSmrg
108514bc0770Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1086688b3aecSmrg
108714bc0770Smrg  # Go ahead even if we have the value already cached.  We do so because we
108814bc0770Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
108914bc0770Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1090688b3aecSmrg
109114bc0770Smrg  for _am_tool in $_am_tools; do
109214bc0770Smrg    case $_am_tool in
109314bc0770Smrg    gnutar)
109414bc0770Smrg      for _am_tar in tar gnutar gtar; do
109514bc0770Smrg        AM_RUN_LOG([$_am_tar --version]) && break
109614bc0770Smrg      done
109714bc0770Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
109814bc0770Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
109914bc0770Smrg      am__untar="$_am_tar -xf -"
110014bc0770Smrg      ;;
110114bc0770Smrg    plaintar)
110214bc0770Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110314bc0770Smrg      # ustar tarball either.
110414bc0770Smrg      (tar --version) >/dev/null 2>&1 && continue
110514bc0770Smrg      am__tar='tar chf - "$$tardir"'
110614bc0770Smrg      am__tar_='tar chf - "$tardir"'
110714bc0770Smrg      am__untar='tar xf -'
110814bc0770Smrg      ;;
110914bc0770Smrg    pax)
111014bc0770Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
111114bc0770Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
111214bc0770Smrg      am__untar='pax -r'
111314bc0770Smrg      ;;
111414bc0770Smrg    cpio)
111514bc0770Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111614bc0770Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111714bc0770Smrg      am__untar='cpio -i -H $1 -d'
111814bc0770Smrg      ;;
111914bc0770Smrg    none)
112014bc0770Smrg      am__tar=false
112114bc0770Smrg      am__tar_=false
112214bc0770Smrg      am__untar=false
112314bc0770Smrg      ;;
112414bc0770Smrg    esac
1125688b3aecSmrg
112614bc0770Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
112714bc0770Smrg    # and am__untar set.
112814bc0770Smrg    test -n "${am_cv_prog_tar_$1}" && break
1129688b3aecSmrg
113014bc0770Smrg    # tar/untar a dummy directory, and stop if the command works.
113114bc0770Smrg    rm -rf conftest.dir
113214bc0770Smrg    mkdir conftest.dir
113314bc0770Smrg    echo GrepMe > conftest.dir/file
113414bc0770Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113514bc0770Smrg    rm -rf conftest.dir
113614bc0770Smrg    if test -s conftest.tar; then
113714bc0770Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
113814bc0770Smrg      AM_RUN_LOG([cat conftest.dir/file])
113914bc0770Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
114014bc0770Smrg    fi
114114bc0770Smrg  done
114214bc0770Smrg  rm -rf conftest.dir
1143688b3aecSmrg
114414bc0770Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114514bc0770Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1146688b3aecSmrg
114714bc0770SmrgAC_SUBST([am__tar])
114814bc0770SmrgAC_SUBST([am__untar])
114914bc0770Smrg]) # _AM_PROG_TAR
1150688b3aecSmrg
115114bc0770Smrg# iconv.m4 serial 19 (gettext-0.18.2)
115214bc0770Smrgdnl Copyright (C) 2000-2002, 2007-2014, 2016 Free Software Foundation, Inc.
115314bc0770Smrgdnl This file is free software; the Free Software Foundation
115414bc0770Smrgdnl gives unlimited permission to copy and/or distribute it,
115514bc0770Smrgdnl with or without modifications, as long as this notice is preserved.
1156688b3aecSmrg
115714bc0770Smrgdnl From Bruno Haible.
1158688b3aecSmrg
115914bc0770SmrgAC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
116014bc0770Smrg[
116114bc0770Smrg  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
116214bc0770Smrg  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
116314bc0770Smrg  AC_REQUIRE([AC_LIB_RPATH])
1164688b3aecSmrg
116514bc0770Smrg  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
116614bc0770Smrg  dnl accordingly.
116714bc0770Smrg  AC_LIB_LINKFLAGS_BODY([iconv])
116814bc0770Smrg])
1169688b3aecSmrg
117014bc0770SmrgAC_DEFUN([AM_ICONV_LINK],
117114bc0770Smrg[
117214bc0770Smrg  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
117314bc0770Smrg  dnl those with the standalone portable GNU libiconv installed).
117414bc0770Smrg  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
1175688b3aecSmrg
117614bc0770Smrg  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
117714bc0770Smrg  dnl accordingly.
117814bc0770Smrg  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
117914bc0770Smrg
118014bc0770Smrg  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
118114bc0770Smrg  dnl because if the user has installed libiconv and not disabled its use
118214bc0770Smrg  dnl via --without-libiconv-prefix, he wants to use it. The first
118314bc0770Smrg  dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed.
118414bc0770Smrg  am_save_CPPFLAGS="$CPPFLAGS"
118514bc0770Smrg  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
118614bc0770Smrg
118714bc0770Smrg  AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
118814bc0770Smrg    am_cv_func_iconv="no, consider installing GNU libiconv"
118914bc0770Smrg    am_cv_lib_iconv=no
119014bc0770Smrg    AC_LINK_IFELSE(
119114bc0770Smrg      [AC_LANG_PROGRAM(
119214bc0770Smrg         [[
119314bc0770Smrg#include <stdlib.h>
119414bc0770Smrg#include <iconv.h>
119514bc0770Smrg         ]],
119614bc0770Smrg         [[iconv_t cd = iconv_open("","");
119714bc0770Smrg           iconv(cd,NULL,NULL,NULL,NULL);
119814bc0770Smrg           iconv_close(cd);]])],
119914bc0770Smrg      [am_cv_func_iconv=yes])
120014bc0770Smrg    if test "$am_cv_func_iconv" != yes; then
120114bc0770Smrg      am_save_LIBS="$LIBS"
120214bc0770Smrg      LIBS="$LIBS $LIBICONV"
120314bc0770Smrg      AC_LINK_IFELSE(
120414bc0770Smrg        [AC_LANG_PROGRAM(
120514bc0770Smrg           [[
120614bc0770Smrg#include <stdlib.h>
120714bc0770Smrg#include <iconv.h>
120814bc0770Smrg           ]],
120914bc0770Smrg           [[iconv_t cd = iconv_open("","");
121014bc0770Smrg             iconv(cd,NULL,NULL,NULL,NULL);
121114bc0770Smrg             iconv_close(cd);]])],
121214bc0770Smrg        [am_cv_lib_iconv=yes]
121314bc0770Smrg        [am_cv_func_iconv=yes])
121414bc0770Smrg      LIBS="$am_save_LIBS"
121514bc0770Smrg    fi
121614bc0770Smrg  ])
121714bc0770Smrg  if test "$am_cv_func_iconv" = yes; then
121814bc0770Smrg    AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
121914bc0770Smrg      dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11,
122014bc0770Smrg      dnl Solaris 10.
122114bc0770Smrg      am_save_LIBS="$LIBS"
122214bc0770Smrg      if test $am_cv_lib_iconv = yes; then
122314bc0770Smrg        LIBS="$LIBS $LIBICONV"
122414bc0770Smrg      fi
122514bc0770Smrg      am_cv_func_iconv_works=no
122614bc0770Smrg      for ac_iconv_const in '' 'const'; do
122714bc0770Smrg        AC_RUN_IFELSE(
122814bc0770Smrg          [AC_LANG_PROGRAM(
122914bc0770Smrg             [[
123014bc0770Smrg#include <iconv.h>
123114bc0770Smrg#include <string.h>
1232688b3aecSmrg
123314bc0770Smrg#ifndef ICONV_CONST
123414bc0770Smrg# define ICONV_CONST $ac_iconv_const
123514bc0770Smrg#endif
123614bc0770Smrg             ]],
123714bc0770Smrg             [[int result = 0;
123814bc0770Smrg  /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
123914bc0770Smrg     returns.  */
124014bc0770Smrg  {
124114bc0770Smrg    iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
124214bc0770Smrg    if (cd_utf8_to_88591 != (iconv_t)(-1))
124314bc0770Smrg      {
124414bc0770Smrg        static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */
124514bc0770Smrg        char buf[10];
124614bc0770Smrg        ICONV_CONST char *inptr = input;
124714bc0770Smrg        size_t inbytesleft = strlen (input);
124814bc0770Smrg        char *outptr = buf;
124914bc0770Smrg        size_t outbytesleft = sizeof (buf);
125014bc0770Smrg        size_t res = iconv (cd_utf8_to_88591,
125114bc0770Smrg                            &inptr, &inbytesleft,
125214bc0770Smrg                            &outptr, &outbytesleft);
125314bc0770Smrg        if (res == 0)
125414bc0770Smrg          result |= 1;
125514bc0770Smrg        iconv_close (cd_utf8_to_88591);
125614bc0770Smrg      }
125714bc0770Smrg  }
125814bc0770Smrg  /* Test against Solaris 10 bug: Failures are not distinguishable from
125914bc0770Smrg     successful returns.  */
126014bc0770Smrg  {
126114bc0770Smrg    iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
126214bc0770Smrg    if (cd_ascii_to_88591 != (iconv_t)(-1))
126314bc0770Smrg      {
126414bc0770Smrg        static ICONV_CONST char input[] = "\263";
126514bc0770Smrg        char buf[10];
126614bc0770Smrg        ICONV_CONST char *inptr = input;
126714bc0770Smrg        size_t inbytesleft = strlen (input);
126814bc0770Smrg        char *outptr = buf;
126914bc0770Smrg        size_t outbytesleft = sizeof (buf);
127014bc0770Smrg        size_t res = iconv (cd_ascii_to_88591,
127114bc0770Smrg                            &inptr, &inbytesleft,
127214bc0770Smrg                            &outptr, &outbytesleft);
127314bc0770Smrg        if (res == 0)
127414bc0770Smrg          result |= 2;
127514bc0770Smrg        iconv_close (cd_ascii_to_88591);
127614bc0770Smrg      }
127714bc0770Smrg  }
127814bc0770Smrg  /* Test against AIX 6.1..7.1 bug: Buffer overrun.  */
127914bc0770Smrg  {
128014bc0770Smrg    iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
128114bc0770Smrg    if (cd_88591_to_utf8 != (iconv_t)(-1))
128214bc0770Smrg      {
128314bc0770Smrg        static ICONV_CONST char input[] = "\304";
128414bc0770Smrg        static char buf[2] = { (char)0xDE, (char)0xAD };
128514bc0770Smrg        ICONV_CONST char *inptr = input;
128614bc0770Smrg        size_t inbytesleft = 1;
128714bc0770Smrg        char *outptr = buf;
128814bc0770Smrg        size_t outbytesleft = 1;
128914bc0770Smrg        size_t res = iconv (cd_88591_to_utf8,
129014bc0770Smrg                            &inptr, &inbytesleft,
129114bc0770Smrg                            &outptr, &outbytesleft);
129214bc0770Smrg        if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
129314bc0770Smrg          result |= 4;
129414bc0770Smrg        iconv_close (cd_88591_to_utf8);
129514bc0770Smrg      }
129614bc0770Smrg  }
129714bc0770Smrg#if 0 /* This bug could be worked around by the caller.  */
129814bc0770Smrg  /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
129914bc0770Smrg  {
130014bc0770Smrg    iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
130114bc0770Smrg    if (cd_88591_to_utf8 != (iconv_t)(-1))
130214bc0770Smrg      {
130314bc0770Smrg        static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
130414bc0770Smrg        char buf[50];
130514bc0770Smrg        ICONV_CONST char *inptr = input;
130614bc0770Smrg        size_t inbytesleft = strlen (input);
130714bc0770Smrg        char *outptr = buf;
130814bc0770Smrg        size_t outbytesleft = sizeof (buf);
130914bc0770Smrg        size_t res = iconv (cd_88591_to_utf8,
131014bc0770Smrg                            &inptr, &inbytesleft,
131114bc0770Smrg                            &outptr, &outbytesleft);
131214bc0770Smrg        if ((int)res > 0)
131314bc0770Smrg          result |= 8;
131414bc0770Smrg        iconv_close (cd_88591_to_utf8);
131514bc0770Smrg      }
131614bc0770Smrg  }
131714bc0770Smrg#endif
131814bc0770Smrg  /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
131914bc0770Smrg     provided.  */
132014bc0770Smrg  if (/* Try standardized names.  */
132114bc0770Smrg      iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
132214bc0770Smrg      /* Try IRIX, OSF/1 names.  */
132314bc0770Smrg      && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
132414bc0770Smrg      /* Try AIX names.  */
132514bc0770Smrg      && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
132614bc0770Smrg      /* Try HP-UX names.  */
132714bc0770Smrg      && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
132814bc0770Smrg    result |= 16;
132914bc0770Smrg  return result;
133014bc0770Smrg]])],
133114bc0770Smrg          [am_cv_func_iconv_works=yes], ,
133214bc0770Smrg          [case "$host_os" in
133314bc0770Smrg             aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
133414bc0770Smrg             *)            am_cv_func_iconv_works="guessing yes" ;;
133514bc0770Smrg           esac])
133614bc0770Smrg        test "$am_cv_func_iconv_works" = no || break
133714bc0770Smrg      done
133814bc0770Smrg      LIBS="$am_save_LIBS"
133914bc0770Smrg    ])
134014bc0770Smrg    case "$am_cv_func_iconv_works" in
134114bc0770Smrg      *no) am_func_iconv=no am_cv_lib_iconv=no ;;
134214bc0770Smrg      *)   am_func_iconv=yes ;;
134314bc0770Smrg    esac
134414bc0770Smrg  else
134514bc0770Smrg    am_func_iconv=no am_cv_lib_iconv=no
134614bc0770Smrg  fi
134714bc0770Smrg  if test "$am_func_iconv" = yes; then
134814bc0770Smrg    AC_DEFINE([HAVE_ICONV], [1],
134914bc0770Smrg      [Define if you have the iconv() function and it works.])
135014bc0770Smrg  fi
135114bc0770Smrg  if test "$am_cv_lib_iconv" = yes; then
135214bc0770Smrg    AC_MSG_CHECKING([how to link with libiconv])
135314bc0770Smrg    AC_MSG_RESULT([$LIBICONV])
135414bc0770Smrg  else
135514bc0770Smrg    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
135614bc0770Smrg    dnl either.
135714bc0770Smrg    CPPFLAGS="$am_save_CPPFLAGS"
135814bc0770Smrg    LIBICONV=
135914bc0770Smrg    LTLIBICONV=
136014bc0770Smrg  fi
136114bc0770Smrg  AC_SUBST([LIBICONV])
136214bc0770Smrg  AC_SUBST([LTLIBICONV])
136314bc0770Smrg])
1364688b3aecSmrg
136514bc0770Smrgdnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
136614bc0770Smrgdnl avoid warnings like
136714bc0770Smrgdnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
136814bc0770Smrgdnl This is tricky because of the way 'aclocal' is implemented:
136914bc0770Smrgdnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
137014bc0770Smrgdnl   Otherwise aclocal's initial scan pass would miss the macro definition.
137114bc0770Smrgdnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
137214bc0770Smrgdnl   Otherwise aclocal would emit many "Use of uninitialized value $1"
137314bc0770Smrgdnl   warnings.
137414bc0770Smrgm4_define([gl_iconv_AC_DEFUN],
137514bc0770Smrg  m4_version_prereq([2.64],
137614bc0770Smrg    [[AC_DEFUN_ONCE(
137714bc0770Smrg        [$1], [$2])]],
137814bc0770Smrg    [m4_ifdef([gl_00GNULIB],
137914bc0770Smrg       [[AC_DEFUN_ONCE(
138014bc0770Smrg           [$1], [$2])]],
138114bc0770Smrg       [[AC_DEFUN(
138214bc0770Smrg           [$1], [$2])]])]))
138314bc0770Smrggl_iconv_AC_DEFUN([AM_ICONV],
138414bc0770Smrg[
138514bc0770Smrg  AM_ICONV_LINK
138614bc0770Smrg  if test "$am_cv_func_iconv" = yes; then
138714bc0770Smrg    AC_MSG_CHECKING([for iconv declaration])
138814bc0770Smrg    AC_CACHE_VAL([am_cv_proto_iconv], [
138914bc0770Smrg      AC_COMPILE_IFELSE(
139014bc0770Smrg        [AC_LANG_PROGRAM(
139114bc0770Smrg           [[
139214bc0770Smrg#include <stdlib.h>
139314bc0770Smrg#include <iconv.h>
139414bc0770Smrgextern
139514bc0770Smrg#ifdef __cplusplus
139614bc0770Smrg"C"
139714bc0770Smrg#endif
139814bc0770Smrg#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
139914bc0770Smrgsize_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
140014bc0770Smrg#else
140114bc0770Smrgsize_t iconv();
140214bc0770Smrg#endif
140314bc0770Smrg           ]],
140414bc0770Smrg           [[]])],
140514bc0770Smrg        [am_cv_proto_iconv_arg1=""],
140614bc0770Smrg        [am_cv_proto_iconv_arg1="const"])
140714bc0770Smrg      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
140814bc0770Smrg    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
140914bc0770Smrg    AC_MSG_RESULT([
141014bc0770Smrg         $am_cv_proto_iconv])
141114bc0770Smrg    AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
141214bc0770Smrg      [Define as const if the declaration of iconv() needs const.])
141314bc0770Smrg    dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
141414bc0770Smrg    m4_ifdef([gl_ICONV_H_DEFAULTS],
141514bc0770Smrg      [AC_REQUIRE([gl_ICONV_H_DEFAULTS])
141614bc0770Smrg       if test -n "$am_cv_proto_iconv_arg1"; then
141714bc0770Smrg         ICONV_CONST="const"
141814bc0770Smrg       fi
141914bc0770Smrg      ])
142014bc0770Smrg  fi
142114bc0770Smrg])
1422688b3aecSmrg
142314bc0770Smrg# lib-ld.m4 serial 6
142414bc0770Smrgdnl Copyright (C) 1996-2003, 2009-2016 Free Software Foundation, Inc.
142514bc0770Smrgdnl This file is free software; the Free Software Foundation
142614bc0770Smrgdnl gives unlimited permission to copy and/or distribute it,
142714bc0770Smrgdnl with or without modifications, as long as this notice is preserved.
1428688b3aecSmrg
142914bc0770Smrgdnl Subroutines of libtool.m4,
143014bc0770Smrgdnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid
143114bc0770Smrgdnl collision with libtool.m4.
1432688b3aecSmrg
143314bc0770Smrgdnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no.
143414bc0770SmrgAC_DEFUN([AC_LIB_PROG_LD_GNU],
143514bc0770Smrg[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
143614bc0770Smrg[# I'd rather use --version here, but apparently some GNU lds only accept -v.
143714bc0770Smrgcase `$LD -v 2>&1 </dev/null` in
143814bc0770Smrg*GNU* | *'with BFD'*)
143914bc0770Smrg  acl_cv_prog_gnu_ld=yes
144014bc0770Smrg  ;;
144114bc0770Smrg*)
144214bc0770Smrg  acl_cv_prog_gnu_ld=no
144314bc0770Smrg  ;;
144414bc0770Smrgesac])
144514bc0770Smrgwith_gnu_ld=$acl_cv_prog_gnu_ld
144614bc0770Smrg])
1447688b3aecSmrg
144814bc0770Smrgdnl From libtool-2.4. Sets the variable LD.
144914bc0770SmrgAC_DEFUN([AC_LIB_PROG_LD],
145014bc0770Smrg[AC_REQUIRE([AC_PROG_CC])dnl
145114bc0770SmrgAC_REQUIRE([AC_CANONICAL_HOST])dnl
1452688b3aecSmrg
145314bc0770SmrgAC_ARG_WITH([gnu-ld],
145414bc0770Smrg    [AS_HELP_STRING([--with-gnu-ld],
145514bc0770Smrg        [assume the C compiler uses GNU ld [default=no]])],
145614bc0770Smrg    [test "$withval" = no || with_gnu_ld=yes],
145714bc0770Smrg    [with_gnu_ld=no])dnl
1458688b3aecSmrg
145914bc0770Smrg# Prepare PATH_SEPARATOR.
146014bc0770Smrg# The user is always right.
146114bc0770Smrgif test "${PATH_SEPARATOR+set}" != set; then
146214bc0770Smrg  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
146314bc0770Smrg  # contains only /bin. Note that ksh looks also at the FPATH variable,
146414bc0770Smrg  # so we have to set that as well for the test.
146514bc0770Smrg  PATH_SEPARATOR=:
146614bc0770Smrg  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
146714bc0770Smrg    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
146814bc0770Smrg           || PATH_SEPARATOR=';'
146914bc0770Smrg       }
147014bc0770Smrgfi
1471688b3aecSmrg
147214bc0770Smrgac_prog=ld
147314bc0770Smrgif test "$GCC" = yes; then
147414bc0770Smrg  # Check if gcc -print-prog-name=ld gives a path.
147514bc0770Smrg  AC_MSG_CHECKING([for ld used by $CC])
147614bc0770Smrg  case $host in
147714bc0770Smrg  *-*-mingw*)
147814bc0770Smrg    # gcc leaves a trailing carriage return which upsets mingw
147914bc0770Smrg    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
148014bc0770Smrg  *)
148114bc0770Smrg    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
148214bc0770Smrg  esac
148314bc0770Smrg  case $ac_prog in
148414bc0770Smrg    # Accept absolute paths.
148514bc0770Smrg    [[\\/]]* | ?:[[\\/]]*)
148614bc0770Smrg      re_direlt='/[[^/]][[^/]]*/\.\./'
148714bc0770Smrg      # Canonicalize the pathname of ld
148814bc0770Smrg      ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'`
148914bc0770Smrg      while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do
149014bc0770Smrg        ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
149114bc0770Smrg      done
149214bc0770Smrg      test -z "$LD" && LD="$ac_prog"
149314bc0770Smrg      ;;
149414bc0770Smrg  "")
149514bc0770Smrg    # If it fails, then pretend we aren't using GCC.
149614bc0770Smrg    ac_prog=ld
149714bc0770Smrg    ;;
149814bc0770Smrg  *)
149914bc0770Smrg    # If it is relative, then search for the first ld in PATH.
150014bc0770Smrg    with_gnu_ld=unknown
150114bc0770Smrg    ;;
150214bc0770Smrg  esac
150314bc0770Smrgelif test "$with_gnu_ld" = yes; then
150414bc0770Smrg  AC_MSG_CHECKING([for GNU ld])
1505688b3aecSmrgelse
150614bc0770Smrg  AC_MSG_CHECKING([for non-GNU ld])
1507688b3aecSmrgfi
150814bc0770SmrgAC_CACHE_VAL([acl_cv_path_LD],
150914bc0770Smrg[if test -z "$LD"; then
151014bc0770Smrg  acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
151114bc0770Smrg  for ac_dir in $PATH; do
151214bc0770Smrg    IFS="$acl_save_ifs"
151314bc0770Smrg    test -z "$ac_dir" && ac_dir=.
151414bc0770Smrg    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
151514bc0770Smrg      acl_cv_path_LD="$ac_dir/$ac_prog"
151614bc0770Smrg      # Check to see if the program is GNU ld.  I'd rather use --version,
151714bc0770Smrg      # but apparently some variants of GNU ld only accept -v.
151814bc0770Smrg      # Break only if it was the GNU/non-GNU ld that we prefer.
151914bc0770Smrg      case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
152014bc0770Smrg      *GNU* | *'with BFD'*)
152114bc0770Smrg        test "$with_gnu_ld" != no && break
152214bc0770Smrg        ;;
152314bc0770Smrg      *)
152414bc0770Smrg        test "$with_gnu_ld" != yes && break
152514bc0770Smrg        ;;
152614bc0770Smrg      esac
152714bc0770Smrg    fi
152814bc0770Smrg  done
152914bc0770Smrg  IFS="$acl_save_ifs"
153014bc0770Smrgelse
153114bc0770Smrg  acl_cv_path_LD="$LD" # Let the user override the test with a path.
1532688b3aecSmrgfi])
153314bc0770SmrgLD="$acl_cv_path_LD"
153414bc0770Smrgif test -n "$LD"; then
153514bc0770Smrg  AC_MSG_RESULT([$LD])
153614bc0770Smrgelse
153714bc0770Smrg  AC_MSG_RESULT([no])
153814bc0770Smrgfi
153914bc0770Smrgtest -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
154014bc0770SmrgAC_LIB_PROG_LD_GNU
154114bc0770Smrg])
1542688b3aecSmrg
154314bc0770Smrg# lib-link.m4 serial 26 (gettext-0.18.2)
154414bc0770Smrgdnl Copyright (C) 2001-2016 Free Software Foundation, Inc.
154514bc0770Smrgdnl This file is free software; the Free Software Foundation
154614bc0770Smrgdnl gives unlimited permission to copy and/or distribute it,
154714bc0770Smrgdnl with or without modifications, as long as this notice is preserved.
1548688b3aecSmrg
154914bc0770Smrgdnl From Bruno Haible.
1550688b3aecSmrg
155114bc0770SmrgAC_PREREQ([2.54])
155214bc0770Smrg
155314bc0770Smrgdnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
155414bc0770Smrgdnl the libraries corresponding to explicit and implicit dependencies.
155514bc0770Smrgdnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
155614bc0770Smrgdnl augments the CPPFLAGS variable.
155714bc0770Smrgdnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
155814bc0770Smrgdnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
155914bc0770SmrgAC_DEFUN([AC_LIB_LINKFLAGS],
156014bc0770Smrg[
156114bc0770Smrg  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
156214bc0770Smrg  AC_REQUIRE([AC_LIB_RPATH])
156314bc0770Smrg  pushdef([Name],[m4_translit([$1],[./+-], [____])])
156414bc0770Smrg  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
156514bc0770Smrg                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
156614bc0770Smrg  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
156714bc0770Smrg    AC_LIB_LINKFLAGS_BODY([$1], [$2])
156814bc0770Smrg    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
156914bc0770Smrg    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
157014bc0770Smrg    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
157114bc0770Smrg    ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
157214bc0770Smrg  ])
157314bc0770Smrg  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
157414bc0770Smrg  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
157514bc0770Smrg  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
157614bc0770Smrg  LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
157714bc0770Smrg  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
157814bc0770Smrg  AC_SUBST([LIB]NAME)
157914bc0770Smrg  AC_SUBST([LTLIB]NAME)
158014bc0770Smrg  AC_SUBST([LIB]NAME[_PREFIX])
158114bc0770Smrg  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
158214bc0770Smrg  dnl results of this search when this library appears as a dependency.
158314bc0770Smrg  HAVE_LIB[]NAME=yes
158414bc0770Smrg  popdef([NAME])
158514bc0770Smrg  popdef([Name])
158614bc0770Smrg])
1587688b3aecSmrg
158814bc0770Smrgdnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
158914bc0770Smrgdnl searches for libname and the libraries corresponding to explicit and
159014bc0770Smrgdnl implicit dependencies, together with the specified include files and
159114bc0770Smrgdnl the ability to compile and link the specified testcode. The missing-message
159214bc0770Smrgdnl defaults to 'no' and may contain additional hints for the user.
159314bc0770Smrgdnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
159414bc0770Smrgdnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
159514bc0770Smrgdnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
159614bc0770Smrgdnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
159714bc0770Smrgdnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
159814bc0770Smrgdnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
159914bc0770SmrgAC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
160014bc0770Smrg[
160114bc0770Smrg  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
160214bc0770Smrg  AC_REQUIRE([AC_LIB_RPATH])
160314bc0770Smrg  pushdef([Name],[m4_translit([$1],[./+-], [____])])
160414bc0770Smrg  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
160514bc0770Smrg                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
1606688b3aecSmrg
160714bc0770Smrg  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
160814bc0770Smrg  dnl accordingly.
160914bc0770Smrg  AC_LIB_LINKFLAGS_BODY([$1], [$2])
1610688b3aecSmrg
161114bc0770Smrg  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
161214bc0770Smrg  dnl because if the user has installed lib[]Name and not disabled its use
161314bc0770Smrg  dnl via --without-lib[]Name-prefix, he wants to use it.
161414bc0770Smrg  ac_save_CPPFLAGS="$CPPFLAGS"
161514bc0770Smrg  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1616688b3aecSmrg
161714bc0770Smrg  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
161814bc0770Smrg    ac_save_LIBS="$LIBS"
161914bc0770Smrg    dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
162014bc0770Smrg    dnl because these -l options might require -L options that are present in
162114bc0770Smrg    dnl LIBS. -l options benefit only from the -L options listed before it.
162214bc0770Smrg    dnl Otherwise, add it to the front of LIBS, because it may be a static
162314bc0770Smrg    dnl library that depends on another static library that is present in LIBS.
162414bc0770Smrg    dnl Static libraries benefit only from the static libraries listed after
162514bc0770Smrg    dnl it.
162614bc0770Smrg    case " $LIB[]NAME" in
162714bc0770Smrg      *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
162814bc0770Smrg      *)       LIBS="$LIB[]NAME $LIBS" ;;
162914bc0770Smrg    esac
163014bc0770Smrg    AC_LINK_IFELSE(
163114bc0770Smrg      [AC_LANG_PROGRAM([[$3]], [[$4]])],
163214bc0770Smrg      [ac_cv_lib[]Name=yes],
163314bc0770Smrg      [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
163414bc0770Smrg    LIBS="$ac_save_LIBS"
163514bc0770Smrg  ])
163614bc0770Smrg  if test "$ac_cv_lib[]Name" = yes; then
163714bc0770Smrg    HAVE_LIB[]NAME=yes
163814bc0770Smrg    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
163914bc0770Smrg    AC_MSG_CHECKING([how to link with lib[]$1])
164014bc0770Smrg    AC_MSG_RESULT([$LIB[]NAME])
164114bc0770Smrg  else
164214bc0770Smrg    HAVE_LIB[]NAME=no
164314bc0770Smrg    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
164414bc0770Smrg    dnl $INC[]NAME either.
164514bc0770Smrg    CPPFLAGS="$ac_save_CPPFLAGS"
164614bc0770Smrg    LIB[]NAME=
164714bc0770Smrg    LTLIB[]NAME=
164814bc0770Smrg    LIB[]NAME[]_PREFIX=
164914bc0770Smrg  fi
165014bc0770Smrg  AC_SUBST([HAVE_LIB]NAME)
165114bc0770Smrg  AC_SUBST([LIB]NAME)
165214bc0770Smrg  AC_SUBST([LTLIB]NAME)
165314bc0770Smrg  AC_SUBST([LIB]NAME[_PREFIX])
165414bc0770Smrg  popdef([NAME])
165514bc0770Smrg  popdef([Name])
165614bc0770Smrg])
1657688b3aecSmrg
165814bc0770Smrgdnl Determine the platform dependent parameters needed to use rpath:
165914bc0770Smrgdnl   acl_libext,
166014bc0770Smrgdnl   acl_shlibext,
166114bc0770Smrgdnl   acl_libname_spec,
166214bc0770Smrgdnl   acl_library_names_spec,
166314bc0770Smrgdnl   acl_hardcode_libdir_flag_spec,
166414bc0770Smrgdnl   acl_hardcode_libdir_separator,
166514bc0770Smrgdnl   acl_hardcode_direct,
166614bc0770Smrgdnl   acl_hardcode_minus_L.
166714bc0770SmrgAC_DEFUN([AC_LIB_RPATH],
166814bc0770Smrg[
166914bc0770Smrg  dnl Tell automake >= 1.10 to complain if config.rpath is missing.
167014bc0770Smrg  m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
167114bc0770Smrg  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
167214bc0770Smrg  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
167314bc0770Smrg  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
167414bc0770Smrg  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
167514bc0770Smrg  AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
167614bc0770Smrg    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
167714bc0770Smrg    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
167814bc0770Smrg    . ./conftest.sh
167914bc0770Smrg    rm -f ./conftest.sh
168014bc0770Smrg    acl_cv_rpath=done
168114bc0770Smrg  ])
168214bc0770Smrg  wl="$acl_cv_wl"
168314bc0770Smrg  acl_libext="$acl_cv_libext"
168414bc0770Smrg  acl_shlibext="$acl_cv_shlibext"
168514bc0770Smrg  acl_libname_spec="$acl_cv_libname_spec"
168614bc0770Smrg  acl_library_names_spec="$acl_cv_library_names_spec"
168714bc0770Smrg  acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
168814bc0770Smrg  acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
168914bc0770Smrg  acl_hardcode_direct="$acl_cv_hardcode_direct"
169014bc0770Smrg  acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
169114bc0770Smrg  dnl Determine whether the user wants rpath handling at all.
169214bc0770Smrg  AC_ARG_ENABLE([rpath],
169314bc0770Smrg    [  --disable-rpath         do not hardcode runtime library paths],
169414bc0770Smrg    :, enable_rpath=yes)
169514bc0770Smrg])
1696688b3aecSmrg
169714bc0770Smrgdnl AC_LIB_FROMPACKAGE(name, package)
169814bc0770Smrgdnl declares that libname comes from the given package. The configure file
169914bc0770Smrgdnl will then not have a --with-libname-prefix option but a
170014bc0770Smrgdnl --with-package-prefix option. Several libraries can come from the same
170114bc0770Smrgdnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
170214bc0770Smrgdnl macro call that searches for libname.
170314bc0770SmrgAC_DEFUN([AC_LIB_FROMPACKAGE],
170414bc0770Smrg[
170514bc0770Smrg  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
170614bc0770Smrg                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
170714bc0770Smrg  define([acl_frompackage_]NAME, [$2])
170814bc0770Smrg  popdef([NAME])
170914bc0770Smrg  pushdef([PACK],[$2])
171014bc0770Smrg  pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
171114bc0770Smrg                                     [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
171214bc0770Smrg  define([acl_libsinpackage_]PACKUP,
171314bc0770Smrg    m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
171414bc0770Smrg  popdef([PACKUP])
171514bc0770Smrg  popdef([PACK])
171614bc0770Smrg])
171714bc0770Smrg
171814bc0770Smrgdnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
171914bc0770Smrgdnl the libraries corresponding to explicit and implicit dependencies.
172014bc0770Smrgdnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
172114bc0770Smrgdnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
172214bc0770Smrgdnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
172314bc0770SmrgAC_DEFUN([AC_LIB_LINKFLAGS_BODY],
172414bc0770Smrg[
172514bc0770Smrg  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
172614bc0770Smrg  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
172714bc0770Smrg                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
172814bc0770Smrg  pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
172914bc0770Smrg  pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
173014bc0770Smrg                                     [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
173114bc0770Smrg  pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
173214bc0770Smrg  dnl Autoconf >= 2.61 supports dots in --with options.
173314bc0770Smrg  pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)])
173414bc0770Smrg  dnl By default, look in $includedir and $libdir.
173514bc0770Smrg  use_additional=yes
173614bc0770Smrg  AC_LIB_WITH_FINAL_PREFIX([
173714bc0770Smrg    eval additional_includedir=\"$includedir\"
173814bc0770Smrg    eval additional_libdir=\"$libdir\"
173914bc0770Smrg  ])
174014bc0770Smrg  AC_ARG_WITH(P_A_C_K[-prefix],
174114bc0770Smrg[[  --with-]]P_A_C_K[[-prefix[=DIR]  search for ]PACKLIBS[ in DIR/include and DIR/lib
174214bc0770Smrg  --without-]]P_A_C_K[[-prefix     don't search for ]PACKLIBS[ in includedir and libdir]],
174314bc0770Smrg[
174414bc0770Smrg    if test "X$withval" = "Xno"; then
174514bc0770Smrg      use_additional=no
174614bc0770Smrg    else
174714bc0770Smrg      if test "X$withval" = "X"; then
174814bc0770Smrg        AC_LIB_WITH_FINAL_PREFIX([
174914bc0770Smrg          eval additional_includedir=\"$includedir\"
175014bc0770Smrg          eval additional_libdir=\"$libdir\"
175114bc0770Smrg        ])
175214bc0770Smrg      else
175314bc0770Smrg        additional_includedir="$withval/include"
175414bc0770Smrg        additional_libdir="$withval/$acl_libdirstem"
175514bc0770Smrg        if test "$acl_libdirstem2" != "$acl_libdirstem" \
175614bc0770Smrg           && ! test -d "$withval/$acl_libdirstem"; then
175714bc0770Smrg          additional_libdir="$withval/$acl_libdirstem2"
175814bc0770Smrg        fi
175914bc0770Smrg      fi
176014bc0770Smrg    fi
176114bc0770Smrg])
176214bc0770Smrg  dnl Search the library and its dependencies in $additional_libdir and
176314bc0770Smrg  dnl $LDFLAGS. Using breadth-first-seach.
176414bc0770Smrg  LIB[]NAME=
176514bc0770Smrg  LTLIB[]NAME=
176614bc0770Smrg  INC[]NAME=
176714bc0770Smrg  LIB[]NAME[]_PREFIX=
176814bc0770Smrg  dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
176914bc0770Smrg  dnl computed. So it has to be reset here.
177014bc0770Smrg  HAVE_LIB[]NAME=
177114bc0770Smrg  rpathdirs=
177214bc0770Smrg  ltrpathdirs=
177314bc0770Smrg  names_already_handled=
177414bc0770Smrg  names_next_round='$1 $2'
177514bc0770Smrg  while test -n "$names_next_round"; do
177614bc0770Smrg    names_this_round="$names_next_round"
177714bc0770Smrg    names_next_round=
177814bc0770Smrg    for name in $names_this_round; do
177914bc0770Smrg      already_handled=
178014bc0770Smrg      for n in $names_already_handled; do
178114bc0770Smrg        if test "$n" = "$name"; then
178214bc0770Smrg          already_handled=yes
178314bc0770Smrg          break
178414bc0770Smrg        fi
178514bc0770Smrg      done
178614bc0770Smrg      if test -z "$already_handled"; then
178714bc0770Smrg        names_already_handled="$names_already_handled $name"
178814bc0770Smrg        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
178914bc0770Smrg        dnl or AC_LIB_HAVE_LINKFLAGS call.
179014bc0770Smrg        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
179114bc0770Smrg        eval value=\"\$HAVE_LIB$uppername\"
179214bc0770Smrg        if test -n "$value"; then
179314bc0770Smrg          if test "$value" = yes; then
179414bc0770Smrg            eval value=\"\$LIB$uppername\"
179514bc0770Smrg            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
179614bc0770Smrg            eval value=\"\$LTLIB$uppername\"
179714bc0770Smrg            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
179814bc0770Smrg          else
179914bc0770Smrg            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
180014bc0770Smrg            dnl that this library doesn't exist. So just drop it.
180114bc0770Smrg            :
180214bc0770Smrg          fi
1803688b3aecSmrg        else
180414bc0770Smrg          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
180514bc0770Smrg          dnl and the already constructed $LIBNAME/$LTLIBNAME.
180614bc0770Smrg          found_dir=
180714bc0770Smrg          found_la=
180814bc0770Smrg          found_so=
180914bc0770Smrg          found_a=
181014bc0770Smrg          eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
181114bc0770Smrg          if test -n "$acl_shlibext"; then
181214bc0770Smrg            shrext=".$acl_shlibext"             # typically: shrext=.so
181314bc0770Smrg          else
181414bc0770Smrg            shrext=
181514bc0770Smrg          fi
181614bc0770Smrg          if test $use_additional = yes; then
181714bc0770Smrg            dir="$additional_libdir"
181814bc0770Smrg            dnl The same code as in the loop below:
181914bc0770Smrg            dnl First look for a shared library.
182014bc0770Smrg            if test -n "$acl_shlibext"; then
182114bc0770Smrg              if test -f "$dir/$libname$shrext"; then
182214bc0770Smrg                found_dir="$dir"
182314bc0770Smrg                found_so="$dir/$libname$shrext"
182414bc0770Smrg              else
182514bc0770Smrg                if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
182614bc0770Smrg                  ver=`(cd "$dir" && \
182714bc0770Smrg                        for f in "$libname$shrext".*; do echo "$f"; done \
182814bc0770Smrg                        | sed -e "s,^$libname$shrext\\\\.,," \
182914bc0770Smrg                        | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
183014bc0770Smrg                        | sed 1q ) 2>/dev/null`
183114bc0770Smrg                  if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
183214bc0770Smrg                    found_dir="$dir"
183314bc0770Smrg                    found_so="$dir/$libname$shrext.$ver"
183414bc0770Smrg                  fi
183514bc0770Smrg                else
183614bc0770Smrg                  eval library_names=\"$acl_library_names_spec\"
183714bc0770Smrg                  for f in $library_names; do
183814bc0770Smrg                    if test -f "$dir/$f"; then
183914bc0770Smrg                      found_dir="$dir"
184014bc0770Smrg                      found_so="$dir/$f"
184114bc0770Smrg                      break
184214bc0770Smrg                    fi
184314bc0770Smrg                  done
184414bc0770Smrg                fi
184514bc0770Smrg              fi
184614bc0770Smrg            fi
184714bc0770Smrg            dnl Then look for a static library.
184814bc0770Smrg            if test "X$found_dir" = "X"; then
184914bc0770Smrg              if test -f "$dir/$libname.$acl_libext"; then
185014bc0770Smrg                found_dir="$dir"
185114bc0770Smrg                found_a="$dir/$libname.$acl_libext"
185214bc0770Smrg              fi
185314bc0770Smrg            fi
185414bc0770Smrg            if test "X$found_dir" != "X"; then
185514bc0770Smrg              if test -f "$dir/$libname.la"; then
185614bc0770Smrg                found_la="$dir/$libname.la"
185714bc0770Smrg              fi
185814bc0770Smrg            fi
185914bc0770Smrg          fi
186014bc0770Smrg          if test "X$found_dir" = "X"; then
186114bc0770Smrg            for x in $LDFLAGS $LTLIB[]NAME; do
186214bc0770Smrg              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
186314bc0770Smrg              case "$x" in
186414bc0770Smrg                -L*)
186514bc0770Smrg                  dir=`echo "X$x" | sed -e 's/^X-L//'`
186614bc0770Smrg                  dnl First look for a shared library.
186714bc0770Smrg                  if test -n "$acl_shlibext"; then
186814bc0770Smrg                    if test -f "$dir/$libname$shrext"; then
186914bc0770Smrg                      found_dir="$dir"
187014bc0770Smrg                      found_so="$dir/$libname$shrext"
187114bc0770Smrg                    else
187214bc0770Smrg                      if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
187314bc0770Smrg                        ver=`(cd "$dir" && \
187414bc0770Smrg                              for f in "$libname$shrext".*; do echo "$f"; done \
187514bc0770Smrg                              | sed -e "s,^$libname$shrext\\\\.,," \
187614bc0770Smrg                              | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
187714bc0770Smrg                              | sed 1q ) 2>/dev/null`
187814bc0770Smrg                        if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
187914bc0770Smrg                          found_dir="$dir"
188014bc0770Smrg                          found_so="$dir/$libname$shrext.$ver"
188114bc0770Smrg                        fi
188214bc0770Smrg                      else
188314bc0770Smrg                        eval library_names=\"$acl_library_names_spec\"
188414bc0770Smrg                        for f in $library_names; do
188514bc0770Smrg                          if test -f "$dir/$f"; then
188614bc0770Smrg                            found_dir="$dir"
188714bc0770Smrg                            found_so="$dir/$f"
188814bc0770Smrg                            break
188914bc0770Smrg                          fi
189014bc0770Smrg                        done
189114bc0770Smrg                      fi
189214bc0770Smrg                    fi
189314bc0770Smrg                  fi
189414bc0770Smrg                  dnl Then look for a static library.
189514bc0770Smrg                  if test "X$found_dir" = "X"; then
189614bc0770Smrg                    if test -f "$dir/$libname.$acl_libext"; then
189714bc0770Smrg                      found_dir="$dir"
189814bc0770Smrg                      found_a="$dir/$libname.$acl_libext"
189914bc0770Smrg                    fi
190014bc0770Smrg                  fi
190114bc0770Smrg                  if test "X$found_dir" != "X"; then
190214bc0770Smrg                    if test -f "$dir/$libname.la"; then
190314bc0770Smrg                      found_la="$dir/$libname.la"
190414bc0770Smrg                    fi
190514bc0770Smrg                  fi
190614bc0770Smrg                  ;;
190714bc0770Smrg              esac
190814bc0770Smrg              if test "X$found_dir" != "X"; then
190914bc0770Smrg                break
191014bc0770Smrg              fi
191114bc0770Smrg            done
191214bc0770Smrg          fi
191314bc0770Smrg          if test "X$found_dir" != "X"; then
191414bc0770Smrg            dnl Found the library.
191514bc0770Smrg            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
191614bc0770Smrg            if test "X$found_so" != "X"; then
191714bc0770Smrg              dnl Linking with a shared library. We attempt to hardcode its
191814bc0770Smrg              dnl directory into the executable's runpath, unless it's the
191914bc0770Smrg              dnl standard /usr/lib.
192014bc0770Smrg              if test "$enable_rpath" = no \
192114bc0770Smrg                 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
192214bc0770Smrg                 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
192314bc0770Smrg                dnl No hardcoding is needed.
192414bc0770Smrg                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
192514bc0770Smrg              else
192614bc0770Smrg                dnl Use an explicit option to hardcode DIR into the resulting
192714bc0770Smrg                dnl binary.
192814bc0770Smrg                dnl Potentially add DIR to ltrpathdirs.
192914bc0770Smrg                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
193014bc0770Smrg                haveit=
193114bc0770Smrg                for x in $ltrpathdirs; do
193214bc0770Smrg                  if test "X$x" = "X$found_dir"; then
193314bc0770Smrg                    haveit=yes
193414bc0770Smrg                    break
193514bc0770Smrg                  fi
193614bc0770Smrg                done
193714bc0770Smrg                if test -z "$haveit"; then
193814bc0770Smrg                  ltrpathdirs="$ltrpathdirs $found_dir"
193914bc0770Smrg                fi
194014bc0770Smrg                dnl The hardcoding into $LIBNAME is system dependent.
194114bc0770Smrg                if test "$acl_hardcode_direct" = yes; then
194214bc0770Smrg                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
194314bc0770Smrg                  dnl resulting binary.
194414bc0770Smrg                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
194514bc0770Smrg                else
194614bc0770Smrg                  if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
194714bc0770Smrg                    dnl Use an explicit option to hardcode DIR into the resulting
194814bc0770Smrg                    dnl binary.
194914bc0770Smrg                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
195014bc0770Smrg                    dnl Potentially add DIR to rpathdirs.
195114bc0770Smrg                    dnl The rpathdirs will be appended to $LIBNAME at the end.
195214bc0770Smrg                    haveit=
195314bc0770Smrg                    for x in $rpathdirs; do
195414bc0770Smrg                      if test "X$x" = "X$found_dir"; then
195514bc0770Smrg                        haveit=yes
195614bc0770Smrg                        break
195714bc0770Smrg                      fi
195814bc0770Smrg                    done
195914bc0770Smrg                    if test -z "$haveit"; then
196014bc0770Smrg                      rpathdirs="$rpathdirs $found_dir"
196114bc0770Smrg                    fi
196214bc0770Smrg                  else
196314bc0770Smrg                    dnl Rely on "-L$found_dir".
196414bc0770Smrg                    dnl But don't add it if it's already contained in the LDFLAGS
196514bc0770Smrg                    dnl or the already constructed $LIBNAME
196614bc0770Smrg                    haveit=
196714bc0770Smrg                    for x in $LDFLAGS $LIB[]NAME; do
196814bc0770Smrg                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
196914bc0770Smrg                      if test "X$x" = "X-L$found_dir"; then
197014bc0770Smrg                        haveit=yes
197114bc0770Smrg                        break
197214bc0770Smrg                      fi
197314bc0770Smrg                    done
197414bc0770Smrg                    if test -z "$haveit"; then
197514bc0770Smrg                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
197614bc0770Smrg                    fi
197714bc0770Smrg                    if test "$acl_hardcode_minus_L" != no; then
197814bc0770Smrg                      dnl FIXME: Not sure whether we should use
197914bc0770Smrg                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
198014bc0770Smrg                      dnl here.
198114bc0770Smrg                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
198214bc0770Smrg                    else
198314bc0770Smrg                      dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
198414bc0770Smrg                      dnl here, because this doesn't fit in flags passed to the
198514bc0770Smrg                      dnl compiler. So give up. No hardcoding. This affects only
198614bc0770Smrg                      dnl very old systems.
198714bc0770Smrg                      dnl FIXME: Not sure whether we should use
198814bc0770Smrg                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
198914bc0770Smrg                      dnl here.
199014bc0770Smrg                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
199114bc0770Smrg                    fi
199214bc0770Smrg                  fi
199314bc0770Smrg                fi
199414bc0770Smrg              fi
199514bc0770Smrg            else
199614bc0770Smrg              if test "X$found_a" != "X"; then
199714bc0770Smrg                dnl Linking with a static library.
199814bc0770Smrg                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
199914bc0770Smrg              else
200014bc0770Smrg                dnl We shouldn't come here, but anyway it's good to have a
200114bc0770Smrg                dnl fallback.
200214bc0770Smrg                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
200314bc0770Smrg              fi
200414bc0770Smrg            fi
200514bc0770Smrg            dnl Assume the include files are nearby.
200614bc0770Smrg            additional_includedir=
200714bc0770Smrg            case "$found_dir" in
200814bc0770Smrg              */$acl_libdirstem | */$acl_libdirstem/)
200914bc0770Smrg                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
201014bc0770Smrg                if test "$name" = '$1'; then
201114bc0770Smrg                  LIB[]NAME[]_PREFIX="$basedir"
201214bc0770Smrg                fi
201314bc0770Smrg                additional_includedir="$basedir/include"
201414bc0770Smrg                ;;
201514bc0770Smrg              */$acl_libdirstem2 | */$acl_libdirstem2/)
201614bc0770Smrg                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
201714bc0770Smrg                if test "$name" = '$1'; then
201814bc0770Smrg                  LIB[]NAME[]_PREFIX="$basedir"
201914bc0770Smrg                fi
202014bc0770Smrg                additional_includedir="$basedir/include"
202114bc0770Smrg                ;;
202214bc0770Smrg            esac
202314bc0770Smrg            if test "X$additional_includedir" != "X"; then
202414bc0770Smrg              dnl Potentially add $additional_includedir to $INCNAME.
202514bc0770Smrg              dnl But don't add it
202614bc0770Smrg              dnl   1. if it's the standard /usr/include,
202714bc0770Smrg              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
202814bc0770Smrg              dnl   3. if it's already present in $CPPFLAGS or the already
202914bc0770Smrg              dnl      constructed $INCNAME,
203014bc0770Smrg              dnl   4. if it doesn't exist as a directory.
203114bc0770Smrg              if test "X$additional_includedir" != "X/usr/include"; then
203214bc0770Smrg                haveit=
203314bc0770Smrg                if test "X$additional_includedir" = "X/usr/local/include"; then
203414bc0770Smrg                  if test -n "$GCC"; then
203514bc0770Smrg                    case $host_os in
203614bc0770Smrg                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
203714bc0770Smrg                    esac
203814bc0770Smrg                  fi
203914bc0770Smrg                fi
204014bc0770Smrg                if test -z "$haveit"; then
204114bc0770Smrg                  for x in $CPPFLAGS $INC[]NAME; do
204214bc0770Smrg                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
204314bc0770Smrg                    if test "X$x" = "X-I$additional_includedir"; then
204414bc0770Smrg                      haveit=yes
204514bc0770Smrg                      break
204614bc0770Smrg                    fi
204714bc0770Smrg                  done
204814bc0770Smrg                  if test -z "$haveit"; then
204914bc0770Smrg                    if test -d "$additional_includedir"; then
205014bc0770Smrg                      dnl Really add $additional_includedir to $INCNAME.
205114bc0770Smrg                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
205214bc0770Smrg                    fi
205314bc0770Smrg                  fi
205414bc0770Smrg                fi
205514bc0770Smrg              fi
205614bc0770Smrg            fi
205714bc0770Smrg            dnl Look for dependencies.
205814bc0770Smrg            if test -n "$found_la"; then
205914bc0770Smrg              dnl Read the .la file. It defines the variables
206014bc0770Smrg              dnl dlname, library_names, old_library, dependency_libs, current,
206114bc0770Smrg              dnl age, revision, installed, dlopen, dlpreopen, libdir.
206214bc0770Smrg              save_libdir="$libdir"
206314bc0770Smrg              case "$found_la" in
206414bc0770Smrg                */* | *\\*) . "$found_la" ;;
206514bc0770Smrg                *) . "./$found_la" ;;
206614bc0770Smrg              esac
206714bc0770Smrg              libdir="$save_libdir"
206814bc0770Smrg              dnl We use only dependency_libs.
206914bc0770Smrg              for dep in $dependency_libs; do
207014bc0770Smrg                case "$dep" in
207114bc0770Smrg                  -L*)
207214bc0770Smrg                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
207314bc0770Smrg                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
207414bc0770Smrg                    dnl But don't add it
207514bc0770Smrg                    dnl   1. if it's the standard /usr/lib,
207614bc0770Smrg                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
207714bc0770Smrg                    dnl   3. if it's already present in $LDFLAGS or the already
207814bc0770Smrg                    dnl      constructed $LIBNAME,
207914bc0770Smrg                    dnl   4. if it doesn't exist as a directory.
208014bc0770Smrg                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
208114bc0770Smrg                       && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
208214bc0770Smrg                      haveit=
208314bc0770Smrg                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
208414bc0770Smrg                         || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
208514bc0770Smrg                        if test -n "$GCC"; then
208614bc0770Smrg                          case $host_os in
208714bc0770Smrg                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
208814bc0770Smrg                          esac
208914bc0770Smrg                        fi
209014bc0770Smrg                      fi
209114bc0770Smrg                      if test -z "$haveit"; then
209214bc0770Smrg                        haveit=
209314bc0770Smrg                        for x in $LDFLAGS $LIB[]NAME; do
209414bc0770Smrg                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
209514bc0770Smrg                          if test "X$x" = "X-L$additional_libdir"; then
209614bc0770Smrg                            haveit=yes
209714bc0770Smrg                            break
209814bc0770Smrg                          fi
209914bc0770Smrg                        done
210014bc0770Smrg                        if test -z "$haveit"; then
210114bc0770Smrg                          if test -d "$additional_libdir"; then
210214bc0770Smrg                            dnl Really add $additional_libdir to $LIBNAME.
210314bc0770Smrg                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
210414bc0770Smrg                          fi
210514bc0770Smrg                        fi
210614bc0770Smrg                        haveit=
210714bc0770Smrg                        for x in $LDFLAGS $LTLIB[]NAME; do
210814bc0770Smrg                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
210914bc0770Smrg                          if test "X$x" = "X-L$additional_libdir"; then
211014bc0770Smrg                            haveit=yes
211114bc0770Smrg                            break
211214bc0770Smrg                          fi
211314bc0770Smrg                        done
211414bc0770Smrg                        if test -z "$haveit"; then
211514bc0770Smrg                          if test -d "$additional_libdir"; then
211614bc0770Smrg                            dnl Really add $additional_libdir to $LTLIBNAME.
211714bc0770Smrg                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
211814bc0770Smrg                          fi
211914bc0770Smrg                        fi
212014bc0770Smrg                      fi
212114bc0770Smrg                    fi
212214bc0770Smrg                    ;;
212314bc0770Smrg                  -R*)
212414bc0770Smrg                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
212514bc0770Smrg                    if test "$enable_rpath" != no; then
212614bc0770Smrg                      dnl Potentially add DIR to rpathdirs.
212714bc0770Smrg                      dnl The rpathdirs will be appended to $LIBNAME at the end.
212814bc0770Smrg                      haveit=
212914bc0770Smrg                      for x in $rpathdirs; do
213014bc0770Smrg                        if test "X$x" = "X$dir"; then
213114bc0770Smrg                          haveit=yes
213214bc0770Smrg                          break
213314bc0770Smrg                        fi
213414bc0770Smrg                      done
213514bc0770Smrg                      if test -z "$haveit"; then
213614bc0770Smrg                        rpathdirs="$rpathdirs $dir"
213714bc0770Smrg                      fi
213814bc0770Smrg                      dnl Potentially add DIR to ltrpathdirs.
213914bc0770Smrg                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
214014bc0770Smrg                      haveit=
214114bc0770Smrg                      for x in $ltrpathdirs; do
214214bc0770Smrg                        if test "X$x" = "X$dir"; then
214314bc0770Smrg                          haveit=yes
214414bc0770Smrg                          break
214514bc0770Smrg                        fi
214614bc0770Smrg                      done
214714bc0770Smrg                      if test -z "$haveit"; then
214814bc0770Smrg                        ltrpathdirs="$ltrpathdirs $dir"
214914bc0770Smrg                      fi
215014bc0770Smrg                    fi
215114bc0770Smrg                    ;;
215214bc0770Smrg                  -l*)
215314bc0770Smrg                    dnl Handle this in the next round.
215414bc0770Smrg                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
215514bc0770Smrg                    ;;
215614bc0770Smrg                  *.la)
215714bc0770Smrg                    dnl Handle this in the next round. Throw away the .la's
215814bc0770Smrg                    dnl directory; it is already contained in a preceding -L
215914bc0770Smrg                    dnl option.
216014bc0770Smrg                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
216114bc0770Smrg                    ;;
216214bc0770Smrg                  *)
216314bc0770Smrg                    dnl Most likely an immediate library name.
216414bc0770Smrg                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
216514bc0770Smrg                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
216614bc0770Smrg                    ;;
216714bc0770Smrg                esac
216814bc0770Smrg              done
216914bc0770Smrg            fi
217014bc0770Smrg          else
217114bc0770Smrg            dnl Didn't find the library; assume it is in the system directories
217214bc0770Smrg            dnl known to the linker and runtime loader. (All the system
217314bc0770Smrg            dnl directories known to the linker should also be known to the
217414bc0770Smrg            dnl runtime loader, otherwise the system is severely misconfigured.)
217514bc0770Smrg            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
217614bc0770Smrg            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
217714bc0770Smrg          fi
217814bc0770Smrg        fi
217914bc0770Smrg      fi
218014bc0770Smrg    done
218114bc0770Smrg  done
218214bc0770Smrg  if test "X$rpathdirs" != "X"; then
218314bc0770Smrg    if test -n "$acl_hardcode_libdir_separator"; then
218414bc0770Smrg      dnl Weird platform: only the last -rpath option counts, the user must
218514bc0770Smrg      dnl pass all path elements in one option. We can arrange that for a
218614bc0770Smrg      dnl single library, but not when more than one $LIBNAMEs are used.
218714bc0770Smrg      alldirs=
218814bc0770Smrg      for found_dir in $rpathdirs; do
218914bc0770Smrg        alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
219014bc0770Smrg      done
219114bc0770Smrg      dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
219214bc0770Smrg      acl_save_libdir="$libdir"
219314bc0770Smrg      libdir="$alldirs"
219414bc0770Smrg      eval flag=\"$acl_hardcode_libdir_flag_spec\"
219514bc0770Smrg      libdir="$acl_save_libdir"
219614bc0770Smrg      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
219714bc0770Smrg    else
219814bc0770Smrg      dnl The -rpath options are cumulative.
219914bc0770Smrg      for found_dir in $rpathdirs; do
220014bc0770Smrg        acl_save_libdir="$libdir"
220114bc0770Smrg        libdir="$found_dir"
220214bc0770Smrg        eval flag=\"$acl_hardcode_libdir_flag_spec\"
220314bc0770Smrg        libdir="$acl_save_libdir"
220414bc0770Smrg        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
220514bc0770Smrg      done
220614bc0770Smrg    fi
220714bc0770Smrg  fi
220814bc0770Smrg  if test "X$ltrpathdirs" != "X"; then
220914bc0770Smrg    dnl When using libtool, the option that works for both libraries and
221014bc0770Smrg    dnl executables is -R. The -R options are cumulative.
221114bc0770Smrg    for found_dir in $ltrpathdirs; do
221214bc0770Smrg      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
221314bc0770Smrg    done
221414bc0770Smrg  fi
221514bc0770Smrg  popdef([P_A_C_K])
221614bc0770Smrg  popdef([PACKLIBS])
221714bc0770Smrg  popdef([PACKUP])
221814bc0770Smrg  popdef([PACK])
221914bc0770Smrg  popdef([NAME])
222014bc0770Smrg])
2221688b3aecSmrg
222214bc0770Smrgdnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
222314bc0770Smrgdnl unless already present in VAR.
222414bc0770Smrgdnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
222514bc0770Smrgdnl contains two or three consecutive elements that belong together.
222614bc0770SmrgAC_DEFUN([AC_LIB_APPENDTOVAR],
222714bc0770Smrg[
222814bc0770Smrg  for element in [$2]; do
222914bc0770Smrg    haveit=
223014bc0770Smrg    for x in $[$1]; do
223114bc0770Smrg      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
223214bc0770Smrg      if test "X$x" = "X$element"; then
223314bc0770Smrg        haveit=yes
223414bc0770Smrg        break
223514bc0770Smrg      fi
223614bc0770Smrg    done
223714bc0770Smrg    if test -z "$haveit"; then
223814bc0770Smrg      [$1]="${[$1]}${[$1]:+ }$element"
223914bc0770Smrg    fi
224014bc0770Smrg  done
224114bc0770Smrg])
2242688b3aecSmrg
224314bc0770Smrgdnl For those cases where a variable contains several -L and -l options
224414bc0770Smrgdnl referring to unknown libraries and directories, this macro determines the
224514bc0770Smrgdnl necessary additional linker options for the runtime path.
224614bc0770Smrgdnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
224714bc0770Smrgdnl sets LDADDVAR to linker options needed together with LIBSVALUE.
224814bc0770Smrgdnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
224914bc0770Smrgdnl otherwise linking without libtool is assumed.
225014bc0770SmrgAC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
225114bc0770Smrg[
225214bc0770Smrg  AC_REQUIRE([AC_LIB_RPATH])
225314bc0770Smrg  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
225414bc0770Smrg  $1=
225514bc0770Smrg  if test "$enable_rpath" != no; then
225614bc0770Smrg    if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
225714bc0770Smrg      dnl Use an explicit option to hardcode directories into the resulting
225814bc0770Smrg      dnl binary.
225914bc0770Smrg      rpathdirs=
226014bc0770Smrg      next=
226114bc0770Smrg      for opt in $2; do
226214bc0770Smrg        if test -n "$next"; then
226314bc0770Smrg          dir="$next"
226414bc0770Smrg          dnl No need to hardcode the standard /usr/lib.
226514bc0770Smrg          if test "X$dir" != "X/usr/$acl_libdirstem" \
226614bc0770Smrg             && test "X$dir" != "X/usr/$acl_libdirstem2"; then
226714bc0770Smrg            rpathdirs="$rpathdirs $dir"
226814bc0770Smrg          fi
226914bc0770Smrg          next=
2270688b3aecSmrg        else
227114bc0770Smrg          case $opt in
227214bc0770Smrg            -L) next=yes ;;
227314bc0770Smrg            -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
227414bc0770Smrg                 dnl No need to hardcode the standard /usr/lib.
227514bc0770Smrg                 if test "X$dir" != "X/usr/$acl_libdirstem" \
227614bc0770Smrg                    && test "X$dir" != "X/usr/$acl_libdirstem2"; then
227714bc0770Smrg                   rpathdirs="$rpathdirs $dir"
227814bc0770Smrg                 fi
227914bc0770Smrg                 next= ;;
228014bc0770Smrg            *) next= ;;
228114bc0770Smrg          esac
228214bc0770Smrg        fi
228314bc0770Smrg      done
228414bc0770Smrg      if test "X$rpathdirs" != "X"; then
228514bc0770Smrg        if test -n ""$3""; then
228614bc0770Smrg          dnl libtool is used for linking. Use -R options.
228714bc0770Smrg          for dir in $rpathdirs; do
228814bc0770Smrg            $1="${$1}${$1:+ }-R$dir"
228914bc0770Smrg          done
229014bc0770Smrg        else
229114bc0770Smrg          dnl The linker is used for linking directly.
229214bc0770Smrg          if test -n "$acl_hardcode_libdir_separator"; then
229314bc0770Smrg            dnl Weird platform: only the last -rpath option counts, the user
229414bc0770Smrg            dnl must pass all path elements in one option.
229514bc0770Smrg            alldirs=
229614bc0770Smrg            for dir in $rpathdirs; do
229714bc0770Smrg              alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
229814bc0770Smrg            done
229914bc0770Smrg            acl_save_libdir="$libdir"
230014bc0770Smrg            libdir="$alldirs"
230114bc0770Smrg            eval flag=\"$acl_hardcode_libdir_flag_spec\"
230214bc0770Smrg            libdir="$acl_save_libdir"
230314bc0770Smrg            $1="$flag"
230414bc0770Smrg          else
230514bc0770Smrg            dnl The -rpath options are cumulative.
230614bc0770Smrg            for dir in $rpathdirs; do
230714bc0770Smrg              acl_save_libdir="$libdir"
230814bc0770Smrg              libdir="$dir"
230914bc0770Smrg              eval flag=\"$acl_hardcode_libdir_flag_spec\"
231014bc0770Smrg              libdir="$acl_save_libdir"
231114bc0770Smrg              $1="${$1}${$1:+ }$flag"
231214bc0770Smrg            done
231314bc0770Smrg          fi
231414bc0770Smrg        fi
231514bc0770Smrg      fi
231614bc0770Smrg    fi
231714bc0770Smrg  fi
231814bc0770Smrg  AC_SUBST([$1])
231914bc0770Smrg])
2320688b3aecSmrg
232114bc0770Smrg# lib-prefix.m4 serial 7 (gettext-0.18)
232214bc0770Smrgdnl Copyright (C) 2001-2005, 2008-2016 Free Software Foundation, Inc.
232314bc0770Smrgdnl This file is free software; the Free Software Foundation
232414bc0770Smrgdnl gives unlimited permission to copy and/or distribute it,
232514bc0770Smrgdnl with or without modifications, as long as this notice is preserved.
232614bc0770Smrg
232714bc0770Smrgdnl From Bruno Haible.
232814bc0770Smrg
232914bc0770Smrgdnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
233014bc0770Smrgdnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
233114bc0770Smrgdnl require excessive bracketing.
233214bc0770Smrgifdef([AC_HELP_STRING],
233314bc0770Smrg[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
233414bc0770Smrg[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
233514bc0770Smrg
233614bc0770Smrgdnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
233714bc0770Smrgdnl to access previously installed libraries. The basic assumption is that
233814bc0770Smrgdnl a user will want packages to use other packages he previously installed
233914bc0770Smrgdnl with the same --prefix option.
234014bc0770Smrgdnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
234114bc0770Smrgdnl libraries, but is otherwise very convenient.
234214bc0770SmrgAC_DEFUN([AC_LIB_PREFIX],
234314bc0770Smrg[
234414bc0770Smrg  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
234514bc0770Smrg  AC_REQUIRE([AC_PROG_CC])
234614bc0770Smrg  AC_REQUIRE([AC_CANONICAL_HOST])
234714bc0770Smrg  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
234814bc0770Smrg  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
234914bc0770Smrg  dnl By default, look in $includedir and $libdir.
235014bc0770Smrg  use_additional=yes
235114bc0770Smrg  AC_LIB_WITH_FINAL_PREFIX([
235214bc0770Smrg    eval additional_includedir=\"$includedir\"
235314bc0770Smrg    eval additional_libdir=\"$libdir\"
235414bc0770Smrg  ])
235514bc0770Smrg  AC_LIB_ARG_WITH([lib-prefix],
235614bc0770Smrg[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
235714bc0770Smrg  --without-lib-prefix    don't search for libraries in includedir and libdir],
235814bc0770Smrg[
235914bc0770Smrg    if test "X$withval" = "Xno"; then
236014bc0770Smrg      use_additional=no
236114bc0770Smrg    else
236214bc0770Smrg      if test "X$withval" = "X"; then
236314bc0770Smrg        AC_LIB_WITH_FINAL_PREFIX([
236414bc0770Smrg          eval additional_includedir=\"$includedir\"
236514bc0770Smrg          eval additional_libdir=\"$libdir\"
236614bc0770Smrg        ])
236714bc0770Smrg      else
236814bc0770Smrg        additional_includedir="$withval/include"
236914bc0770Smrg        additional_libdir="$withval/$acl_libdirstem"
237014bc0770Smrg      fi
237114bc0770Smrg    fi
237214bc0770Smrg])
237314bc0770Smrg  if test $use_additional = yes; then
237414bc0770Smrg    dnl Potentially add $additional_includedir to $CPPFLAGS.
237514bc0770Smrg    dnl But don't add it
237614bc0770Smrg    dnl   1. if it's the standard /usr/include,
237714bc0770Smrg    dnl   2. if it's already present in $CPPFLAGS,
237814bc0770Smrg    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
237914bc0770Smrg    dnl   4. if it doesn't exist as a directory.
238014bc0770Smrg    if test "X$additional_includedir" != "X/usr/include"; then
238114bc0770Smrg      haveit=
238214bc0770Smrg      for x in $CPPFLAGS; do
238314bc0770Smrg        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
238414bc0770Smrg        if test "X$x" = "X-I$additional_includedir"; then
238514bc0770Smrg          haveit=yes
238614bc0770Smrg          break
238714bc0770Smrg        fi
238814bc0770Smrg      done
238914bc0770Smrg      if test -z "$haveit"; then
239014bc0770Smrg        if test "X$additional_includedir" = "X/usr/local/include"; then
239114bc0770Smrg          if test -n "$GCC"; then
239214bc0770Smrg            case $host_os in
239314bc0770Smrg              linux* | gnu* | k*bsd*-gnu) haveit=yes;;
239414bc0770Smrg            esac
239514bc0770Smrg          fi
239614bc0770Smrg        fi
239714bc0770Smrg        if test -z "$haveit"; then
239814bc0770Smrg          if test -d "$additional_includedir"; then
239914bc0770Smrg            dnl Really add $additional_includedir to $CPPFLAGS.
240014bc0770Smrg            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
240114bc0770Smrg          fi
240214bc0770Smrg        fi
240314bc0770Smrg      fi
2404688b3aecSmrg    fi
240514bc0770Smrg    dnl Potentially add $additional_libdir to $LDFLAGS.
240614bc0770Smrg    dnl But don't add it
240714bc0770Smrg    dnl   1. if it's the standard /usr/lib,
240814bc0770Smrg    dnl   2. if it's already present in $LDFLAGS,
240914bc0770Smrg    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
241014bc0770Smrg    dnl   4. if it doesn't exist as a directory.
241114bc0770Smrg    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
241214bc0770Smrg      haveit=
241314bc0770Smrg      for x in $LDFLAGS; do
241414bc0770Smrg        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
241514bc0770Smrg        if test "X$x" = "X-L$additional_libdir"; then
241614bc0770Smrg          haveit=yes
241714bc0770Smrg          break
241814bc0770Smrg        fi
241914bc0770Smrg      done
242014bc0770Smrg      if test -z "$haveit"; then
242114bc0770Smrg        if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
242214bc0770Smrg          if test -n "$GCC"; then
242314bc0770Smrg            case $host_os in
242414bc0770Smrg              linux*) haveit=yes;;
242514bc0770Smrg            esac
242614bc0770Smrg          fi
242714bc0770Smrg        fi
242814bc0770Smrg        if test -z "$haveit"; then
242914bc0770Smrg          if test -d "$additional_libdir"; then
243014bc0770Smrg            dnl Really add $additional_libdir to $LDFLAGS.
243114bc0770Smrg            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
243214bc0770Smrg          fi
243314bc0770Smrg        fi
243414bc0770Smrg      fi
243514bc0770Smrg    fi
243614bc0770Smrg  fi
243714bc0770Smrg])
2438688b3aecSmrg
243914bc0770Smrgdnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
244014bc0770Smrgdnl acl_final_exec_prefix, containing the values to which $prefix and
244114bc0770Smrgdnl $exec_prefix will expand at the end of the configure script.
244214bc0770SmrgAC_DEFUN([AC_LIB_PREPARE_PREFIX],
244314bc0770Smrg[
244414bc0770Smrg  dnl Unfortunately, prefix and exec_prefix get only finally determined
244514bc0770Smrg  dnl at the end of configure.
244614bc0770Smrg  if test "X$prefix" = "XNONE"; then
244714bc0770Smrg    acl_final_prefix="$ac_default_prefix"
244814bc0770Smrg  else
244914bc0770Smrg    acl_final_prefix="$prefix"
245014bc0770Smrg  fi
245114bc0770Smrg  if test "X$exec_prefix" = "XNONE"; then
245214bc0770Smrg    acl_final_exec_prefix='${prefix}'
245314bc0770Smrg  else
245414bc0770Smrg    acl_final_exec_prefix="$exec_prefix"
245514bc0770Smrg  fi
245614bc0770Smrg  acl_save_prefix="$prefix"
245714bc0770Smrg  prefix="$acl_final_prefix"
245814bc0770Smrg  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
245914bc0770Smrg  prefix="$acl_save_prefix"
246014bc0770Smrg])
2461688b3aecSmrg
246214bc0770Smrgdnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
246314bc0770Smrgdnl variables prefix and exec_prefix bound to the values they will have
246414bc0770Smrgdnl at the end of the configure script.
246514bc0770SmrgAC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
246614bc0770Smrg[
246714bc0770Smrg  acl_save_prefix="$prefix"
246814bc0770Smrg  prefix="$acl_final_prefix"
246914bc0770Smrg  acl_save_exec_prefix="$exec_prefix"
247014bc0770Smrg  exec_prefix="$acl_final_exec_prefix"
247114bc0770Smrg  $1
247214bc0770Smrg  exec_prefix="$acl_save_exec_prefix"
247314bc0770Smrg  prefix="$acl_save_prefix"
247414bc0770Smrg])
2475688b3aecSmrg
247614bc0770Smrgdnl AC_LIB_PREPARE_MULTILIB creates
247714bc0770Smrgdnl - a variable acl_libdirstem, containing the basename of the libdir, either
247814bc0770Smrgdnl   "lib" or "lib64" or "lib/64",
247914bc0770Smrgdnl - a variable acl_libdirstem2, as a secondary possible value for
248014bc0770Smrgdnl   acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
248114bc0770Smrgdnl   "lib/amd64".
248214bc0770SmrgAC_DEFUN([AC_LIB_PREPARE_MULTILIB],
248314bc0770Smrg[
248414bc0770Smrg  dnl There is no formal standard regarding lib and lib64.
248514bc0770Smrg  dnl On glibc systems, the current practice is that on a system supporting
248614bc0770Smrg  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
248714bc0770Smrg  dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
248814bc0770Smrg  dnl the compiler's default mode by looking at the compiler's library search
248914bc0770Smrg  dnl path. If at least one of its elements ends in /lib64 or points to a
249014bc0770Smrg  dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
249114bc0770Smrg  dnl Otherwise we use the default, namely "lib".
249214bc0770Smrg  dnl On Solaris systems, the current practice is that on a system supporting
249314bc0770Smrg  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
249414bc0770Smrg  dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
249514bc0770Smrg  dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
249614bc0770Smrg  AC_REQUIRE([AC_CANONICAL_HOST])
249714bc0770Smrg  acl_libdirstem=lib
249814bc0770Smrg  acl_libdirstem2=
249914bc0770Smrg  case "$host_os" in
250014bc0770Smrg    solaris*)
250114bc0770Smrg      dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
250214bc0770Smrg      dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>.
250314bc0770Smrg      dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
250414bc0770Smrg      dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
250514bc0770Smrg      dnl symlink is missing, so we set acl_libdirstem2 too.
250614bc0770Smrg      AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
250714bc0770Smrg        [AC_EGREP_CPP([sixtyfour bits], [
250814bc0770Smrg#ifdef _LP64
250914bc0770Smrgsixtyfour bits
251014bc0770Smrg#endif
251114bc0770Smrg           ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
251214bc0770Smrg        ])
251314bc0770Smrg      if test $gl_cv_solaris_64bit = yes; then
251414bc0770Smrg        acl_libdirstem=lib/64
251514bc0770Smrg        case "$host_cpu" in
251614bc0770Smrg          sparc*)        acl_libdirstem2=lib/sparcv9 ;;
251714bc0770Smrg          i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
251814bc0770Smrg        esac
251914bc0770Smrg      fi
252014bc0770Smrg      ;;
252114bc0770Smrg    *)
252214bc0770Smrg      searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
252314bc0770Smrg      if test -n "$searchpath"; then
252414bc0770Smrg        acl_save_IFS="${IFS= 	}"; IFS=":"
252514bc0770Smrg        for searchdir in $searchpath; do
252614bc0770Smrg          if test -d "$searchdir"; then
252714bc0770Smrg            case "$searchdir" in
252814bc0770Smrg              */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
252914bc0770Smrg              */../ | */.. )
253014bc0770Smrg                # Better ignore directories of this form. They are misleading.
253114bc0770Smrg                ;;
253214bc0770Smrg              *) searchdir=`cd "$searchdir" && pwd`
253314bc0770Smrg                 case "$searchdir" in
253414bc0770Smrg                   */lib64 ) acl_libdirstem=lib64 ;;
253514bc0770Smrg                 esac ;;
253614bc0770Smrg            esac
253714bc0770Smrg          fi
253814bc0770Smrg        done
253914bc0770Smrg        IFS="$acl_save_IFS"
254014bc0770Smrg      fi
254114bc0770Smrg      ;;
254214bc0770Smrg  esac
254314bc0770Smrg  test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
254414bc0770Smrg])
254514bc0770Smrg
254614bc0770Smrgdnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
254714bc0770Smrgdnl serial 11 (pkg-config-0.29)
254814bc0770Smrgdnl
254914bc0770Smrgdnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
255014bc0770Smrgdnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
255114bc0770Smrgdnl
255214bc0770Smrgdnl This program is free software; you can redistribute it and/or modify
255314bc0770Smrgdnl it under the terms of the GNU General Public License as published by
255414bc0770Smrgdnl the Free Software Foundation; either version 2 of the License, or
255514bc0770Smrgdnl (at your option) any later version.
255614bc0770Smrgdnl
255714bc0770Smrgdnl This program is distributed in the hope that it will be useful, but
255814bc0770Smrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of
255914bc0770Smrgdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
256014bc0770Smrgdnl General Public License for more details.
256114bc0770Smrgdnl
256214bc0770Smrgdnl You should have received a copy of the GNU General Public License
256314bc0770Smrgdnl along with this program; if not, write to the Free Software
256414bc0770Smrgdnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
256514bc0770Smrgdnl 02111-1307, USA.
256614bc0770Smrgdnl
256714bc0770Smrgdnl As a special exception to the GNU General Public License, if you
256814bc0770Smrgdnl distribute this file as part of a program that contains a
256914bc0770Smrgdnl configuration script generated by Autoconf, you may include it under
257014bc0770Smrgdnl the same distribution terms that you use for the rest of that
257114bc0770Smrgdnl program.
257214bc0770Smrg
257314bc0770Smrgdnl PKG_PREREQ(MIN-VERSION)
257414bc0770Smrgdnl -----------------------
257514bc0770Smrgdnl Since: 0.29
257614bc0770Smrgdnl
257714bc0770Smrgdnl Verify that the version of the pkg-config macros are at least
257814bc0770Smrgdnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
257914bc0770Smrgdnl installed version of pkg-config, this checks the developer's version
258014bc0770Smrgdnl of pkg.m4 when generating configure.
258114bc0770Smrgdnl
258214bc0770Smrgdnl To ensure that this macro is defined, also add:
258314bc0770Smrgdnl m4_ifndef([PKG_PREREQ],
258414bc0770Smrgdnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
258514bc0770Smrgdnl
258614bc0770Smrgdnl See the "Since" comment for each macro you use to see what version
258714bc0770Smrgdnl of the macros you require.
258814bc0770Smrgm4_defun([PKG_PREREQ],
258914bc0770Smrg[m4_define([PKG_MACROS_VERSION], [0.29])
259014bc0770Smrgm4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
259114bc0770Smrg    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
259214bc0770Smrg])dnl PKG_PREREQ
2593688b3aecSmrg
259414bc0770Smrgdnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
259514bc0770Smrgdnl ----------------------------------
259614bc0770Smrgdnl Since: 0.16
259714bc0770Smrgdnl
259814bc0770Smrgdnl Search for the pkg-config tool and set the PKG_CONFIG variable to
259914bc0770Smrgdnl first found in the path. Checks that the version of pkg-config found
260014bc0770Smrgdnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
260114bc0770Smrgdnl used since that's the first version where most current features of
260214bc0770Smrgdnl pkg-config existed.
260314bc0770SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
260414bc0770Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
260514bc0770Smrgm4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
260614bc0770Smrgm4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
260714bc0770SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
260814bc0770SmrgAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
260914bc0770SmrgAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
2610688b3aecSmrg
261114bc0770Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
261214bc0770Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2613688b3aecSmrgfi
261414bc0770Smrgif test -n "$PKG_CONFIG"; then
261514bc0770Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
261614bc0770Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
261714bc0770Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
261814bc0770Smrg		AC_MSG_RESULT([yes])
261914bc0770Smrg	else
262014bc0770Smrg		AC_MSG_RESULT([no])
262114bc0770Smrg		PKG_CONFIG=""
262214bc0770Smrg	fi
262314bc0770Smrgfi[]dnl
262414bc0770Smrg])dnl PKG_PROG_PKG_CONFIG
2625688b3aecSmrg
262614bc0770Smrgdnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
262714bc0770Smrgdnl -------------------------------------------------------------------
262814bc0770Smrgdnl Since: 0.18
262914bc0770Smrgdnl
263014bc0770Smrgdnl Check to see whether a particular set of modules exists. Similar to
263114bc0770Smrgdnl PKG_CHECK_MODULES(), but does not set variables or print errors.
263214bc0770Smrgdnl
263314bc0770Smrgdnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
263414bc0770Smrgdnl only at the first occurence in configure.ac, so if the first place
263514bc0770Smrgdnl it's called might be skipped (such as if it is within an "if", you
263614bc0770Smrgdnl have to call PKG_CHECK_EXISTS manually
263714bc0770SmrgAC_DEFUN([PKG_CHECK_EXISTS],
263814bc0770Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
263914bc0770Smrgif test -n "$PKG_CONFIG" && \
264014bc0770Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
264114bc0770Smrg  m4_default([$2], [:])
264214bc0770Smrgm4_ifvaln([$3], [else
264314bc0770Smrg  $3])dnl
264414bc0770Smrgfi])
2645688b3aecSmrg
264614bc0770Smrgdnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
264714bc0770Smrgdnl ---------------------------------------------
264814bc0770Smrgdnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
264914bc0770Smrgdnl pkg_failed based on the result.
265014bc0770Smrgm4_define([_PKG_CONFIG],
265114bc0770Smrg[if test -n "$$1"; then
265214bc0770Smrg    pkg_cv_[]$1="$$1"
265314bc0770Smrg elif test -n "$PKG_CONFIG"; then
265414bc0770Smrg    PKG_CHECK_EXISTS([$3],
265514bc0770Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
265614bc0770Smrg		      test "x$?" != "x0" && pkg_failed=yes ],
265714bc0770Smrg		     [pkg_failed=yes])
265814bc0770Smrg else
265914bc0770Smrg    pkg_failed=untried
266014bc0770Smrgfi[]dnl
266114bc0770Smrg])dnl _PKG_CONFIG
2662688b3aecSmrg
266314bc0770Smrgdnl _PKG_SHORT_ERRORS_SUPPORTED
266414bc0770Smrgdnl ---------------------------
266514bc0770Smrgdnl Internal check to see if pkg-config supports short errors.
266614bc0770SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
266714bc0770Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
266814bc0770Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
266914bc0770Smrg        _pkg_short_errors_supported=yes
2670688b3aecSmrgelse
267114bc0770Smrg        _pkg_short_errors_supported=no
267214bc0770Smrgfi[]dnl
267314bc0770Smrg])dnl _PKG_SHORT_ERRORS_SUPPORTED
2674688b3aecSmrg
2675688b3aecSmrg
267614bc0770Smrgdnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
267714bc0770Smrgdnl   [ACTION-IF-NOT-FOUND])
267814bc0770Smrgdnl --------------------------------------------------------------
267914bc0770Smrgdnl Since: 0.4.0
268014bc0770Smrgdnl
268114bc0770Smrgdnl Note that if there is a possibility the first call to
268214bc0770Smrgdnl PKG_CHECK_MODULES might not happen, you should be sure to include an
268314bc0770Smrgdnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
268414bc0770SmrgAC_DEFUN([PKG_CHECK_MODULES],
268514bc0770Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
268614bc0770SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
268714bc0770SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
2688688b3aecSmrg
268914bc0770Smrgpkg_failed=no
269014bc0770SmrgAC_MSG_CHECKING([for $1])
2691688b3aecSmrg
269214bc0770Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
269314bc0770Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
269414bc0770Smrg
269514bc0770Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
269614bc0770Smrgand $1[]_LIBS to avoid the need to call pkg-config.
269714bc0770SmrgSee the pkg-config man page for more details.])
269814bc0770Smrg
269914bc0770Smrgif test $pkg_failed = yes; then
270014bc0770Smrg   	AC_MSG_RESULT([no])
270114bc0770Smrg        _PKG_SHORT_ERRORS_SUPPORTED
270214bc0770Smrg        if test $_pkg_short_errors_supported = yes; then
270314bc0770Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
270414bc0770Smrg        else 
270514bc0770Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
270614bc0770Smrg        fi
270714bc0770Smrg	# Put the nasty error message in config.log where it belongs
270814bc0770Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
27098903d43aSmrg
271014bc0770Smrg	m4_default([$4], [AC_MSG_ERROR(
271114bc0770Smrg[Package requirements ($2) were not met:
27128903d43aSmrg
271314bc0770Smrg$$1_PKG_ERRORS
2714e9554658Smrg
271514bc0770SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
271614bc0770Smrginstalled software in a non-standard prefix.
2717688b3aecSmrg
271814bc0770Smrg_PKG_TEXT])[]dnl
271914bc0770Smrg        ])
272014bc0770Smrgelif test $pkg_failed = untried; then
272114bc0770Smrg     	AC_MSG_RESULT([no])
272214bc0770Smrg	m4_default([$4], [AC_MSG_FAILURE(
272314bc0770Smrg[The pkg-config script could not be found or is too old.  Make sure it
272414bc0770Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
272514bc0770Smrgpath to pkg-config.
2726688b3aecSmrg
272714bc0770Smrg_PKG_TEXT
2728309c398aSmrg
272914bc0770SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
273014bc0770Smrg        ])
273114bc0770Smrgelse
273214bc0770Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
273314bc0770Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
273414bc0770Smrg        AC_MSG_RESULT([yes])
273514bc0770Smrg	$3
273614bc0770Smrgfi[]dnl
273714bc0770Smrg])dnl PKG_CHECK_MODULES
273814bc0770Smrg
273914bc0770Smrg
274014bc0770Smrgdnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
274114bc0770Smrgdnl   [ACTION-IF-NOT-FOUND])
274214bc0770Smrgdnl ---------------------------------------------------------------------
274314bc0770Smrgdnl Since: 0.29
274414bc0770Smrgdnl
274514bc0770Smrgdnl Checks for existence of MODULES and gathers its build flags with
274614bc0770Smrgdnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
274714bc0770Smrgdnl and VARIABLE-PREFIX_LIBS from --libs.
274814bc0770Smrgdnl
274914bc0770Smrgdnl Note that if there is a possibility the first call to
275014bc0770Smrgdnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
275114bc0770Smrgdnl include an explicit call to PKG_PROG_PKG_CONFIG in your
275214bc0770Smrgdnl configure.ac.
275314bc0770SmrgAC_DEFUN([PKG_CHECK_MODULES_STATIC],
275414bc0770Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
275514bc0770Smrg_save_PKG_CONFIG=$PKG_CONFIG
275614bc0770SmrgPKG_CONFIG="$PKG_CONFIG --static"
275714bc0770SmrgPKG_CHECK_MODULES($@)
275814bc0770SmrgPKG_CONFIG=$_save_PKG_CONFIG[]dnl
275914bc0770Smrg])dnl PKG_CHECK_MODULES_STATIC
276014bc0770Smrg
276114bc0770Smrg
276214bc0770Smrgdnl PKG_INSTALLDIR([DIRECTORY])
276314bc0770Smrgdnl -------------------------
276414bc0770Smrgdnl Since: 0.27
276514bc0770Smrgdnl
276614bc0770Smrgdnl Substitutes the variable pkgconfigdir as the location where a module
276714bc0770Smrgdnl should install pkg-config .pc files. By default the directory is
276814bc0770Smrgdnl $libdir/pkgconfig, but the default can be changed by passing
276914bc0770Smrgdnl DIRECTORY. The user can override through the --with-pkgconfigdir
277014bc0770Smrgdnl parameter.
277114bc0770SmrgAC_DEFUN([PKG_INSTALLDIR],
277214bc0770Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
277314bc0770Smrgm4_pushdef([pkg_description],
277414bc0770Smrg    [pkg-config installation directory @<:@]pkg_default[@:>@])
277514bc0770SmrgAC_ARG_WITH([pkgconfigdir],
277614bc0770Smrg    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
277714bc0770Smrg    [with_pkgconfigdir=]pkg_default)
277814bc0770SmrgAC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
277914bc0770Smrgm4_popdef([pkg_default])
278014bc0770Smrgm4_popdef([pkg_description])
278114bc0770Smrg])dnl PKG_INSTALLDIR
2782309c398aSmrg
2783309c398aSmrg
278414bc0770Smrgdnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
278514bc0770Smrgdnl --------------------------------
278614bc0770Smrgdnl Since: 0.27
278714bc0770Smrgdnl
278814bc0770Smrgdnl Substitutes the variable noarch_pkgconfigdir as the location where a
278914bc0770Smrgdnl module should install arch-independent pkg-config .pc files. By
279014bc0770Smrgdnl default the directory is $datadir/pkgconfig, but the default can be
279114bc0770Smrgdnl changed by passing DIRECTORY. The user can override through the
279214bc0770Smrgdnl --with-noarch-pkgconfigdir parameter.
279314bc0770SmrgAC_DEFUN([PKG_NOARCH_INSTALLDIR],
279414bc0770Smrg[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
279514bc0770Smrgm4_pushdef([pkg_description],
279614bc0770Smrg    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
279714bc0770SmrgAC_ARG_WITH([noarch-pkgconfigdir],
279814bc0770Smrg    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
279914bc0770Smrg    [with_noarch_pkgconfigdir=]pkg_default)
280014bc0770SmrgAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
280114bc0770Smrgm4_popdef([pkg_default])
280214bc0770Smrgm4_popdef([pkg_description])
280314bc0770Smrg])dnl PKG_NOARCH_INSTALLDIR
2804309c398aSmrg
2805309c398aSmrg
280614bc0770Smrgdnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
280714bc0770Smrgdnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
280814bc0770Smrgdnl -------------------------------------------
280914bc0770Smrgdnl Since: 0.28
281014bc0770Smrgdnl
281114bc0770Smrgdnl Retrieves the value of the pkg-config variable for the given module.
281214bc0770SmrgAC_DEFUN([PKG_CHECK_VAR],
281314bc0770Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
281414bc0770SmrgAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
2815309c398aSmrg
281614bc0770Smrg_PKG_CONFIG([$1], [variable="][$3]["], [$2])
281714bc0770SmrgAS_VAR_COPY([$1], [pkg_cv_][$1])
2818688b3aecSmrg
281914bc0770SmrgAS_VAR_IF([$1], [""], [$5], [$4])dnl
282014bc0770Smrg])dnl PKG_CHECK_VAR
2821309c398aSmrg
282214bc0770Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
282314bc0770Smrgdnl
282414bc0770Smrgdnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
282514bc0770Smrgdnl
282614bc0770Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
282714bc0770Smrgdnl copy of this software and associated documentation files (the "Software"),
282814bc0770Smrgdnl to deal in the Software without restriction, including without limitation
282914bc0770Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
283014bc0770Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
283114bc0770Smrgdnl Software is furnished to do so, subject to the following conditions:
283214bc0770Smrgdnl
283314bc0770Smrgdnl The above copyright notice and this permission notice (including the next
283414bc0770Smrgdnl paragraph) shall be included in all copies or substantial portions of the
283514bc0770Smrgdnl Software.
283614bc0770Smrgdnl
283714bc0770Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
283814bc0770Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
283914bc0770Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
284014bc0770Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
284114bc0770Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
284214bc0770Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
284314bc0770Smrgdnl DEALINGS IN THE SOFTWARE.
2844309c398aSmrg
284514bc0770Smrg# XORG_MACROS_VERSION(required-version)
284614bc0770Smrg# -------------------------------------
284714bc0770Smrg# Minimum version: 1.1.0
2848309c398aSmrg#
284914bc0770Smrg# If you're using a macro added in Version 1.1 or newer, include this in
285014bc0770Smrg# your configure.ac with the minimum required version, such as:
285114bc0770Smrg# XORG_MACROS_VERSION(1.1)
2852309c398aSmrg#
285314bc0770Smrg# To ensure that this macro is defined, also add:
285414bc0770Smrg# m4_ifndef([XORG_MACROS_VERSION],
285514bc0770Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
2856309c398aSmrg#
2857309c398aSmrg#
285814bc0770Smrg# See the "minimum version" comment for each macro you use to see what
285914bc0770Smrg# version you require.
286014bc0770Smrgm4_defun([XORG_MACROS_VERSION],[
286114bc0770Smrgm4_define([vers_have], [1.19.3])
286214bc0770Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
286314bc0770Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
286414bc0770Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
286514bc0770Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
286614bc0770Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
286714bc0770Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
286814bc0770Smrgm4_undefine([vers_have])
286914bc0770Smrgm4_undefine([maj_have])
287014bc0770Smrgm4_undefine([maj_needed])
287114bc0770Smrg]) # XORG_MACROS_VERSION
287214bc0770Smrg
287314bc0770Smrg# XORG_PROG_RAWCPP()
287414bc0770Smrg# ------------------
287514bc0770Smrg# Minimum version: 1.0.0
2876688b3aecSmrg#
287714bc0770Smrg# Find cpp program and necessary flags for use in pre-processing text files
287814bc0770Smrg# such as man pages and config files
287914bc0770SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
288014bc0770SmrgAC_REQUIRE([AC_PROG_CPP])
288114bc0770SmrgAC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
288214bc0770Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
288314bc0770Smrg
288414bc0770Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
288514bc0770Smrg# which is not the best choice for supporting other OS'es, but covers most
288614bc0770Smrg# of the ones we need for now.
288714bc0770SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
288814bc0770SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
288914bc0770Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
289014bc0770Smrg	AC_MSG_RESULT([no])
289114bc0770Smrgelse
289214bc0770Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
289314bc0770Smrg		RAWCPPFLAGS=-undef
289414bc0770Smrg		AC_MSG_RESULT([yes])
289514bc0770Smrg	# under Cygwin unix is still defined even with -undef
289614bc0770Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
289714bc0770Smrg		RAWCPPFLAGS="-undef -ansi"
289814bc0770Smrg		AC_MSG_RESULT([yes, with -ansi])
289914bc0770Smrg	else
290014bc0770Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
290114bc0770Smrg	fi
290214bc0770Smrgfi
290314bc0770Smrgrm -f conftest.$ac_ext
290414bc0770Smrg
290514bc0770SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
290614bc0770SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
290714bc0770Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
290814bc0770Smrg	AC_MSG_RESULT([no])
2909688b3aecSmrgelse
291014bc0770Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
291114bc0770Smrg		TRADITIONALCPPFLAGS="-traditional"
291214bc0770Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
291314bc0770Smrg		AC_MSG_RESULT([yes])
291414bc0770Smrg	else
291514bc0770Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
291614bc0770Smrg	fi
2917309c398aSmrgfi
291814bc0770Smrgrm -f conftest.$ac_ext
291914bc0770SmrgAC_SUBST(RAWCPPFLAGS)
292014bc0770SmrgAC_SUBST(TRADITIONALCPPFLAGS)
292114bc0770Smrg]) # XORG_PROG_RAWCPP
2922309c398aSmrg
292314bc0770Smrg# XORG_MANPAGE_SECTIONS()
2924309c398aSmrg# -----------------------
292514bc0770Smrg# Minimum version: 1.0.0
2926688b3aecSmrg#
292714bc0770Smrg# Determine which sections man pages go in for the different man page types
292814bc0770Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
292914bc0770Smrg# Not sure if there's any better way than just hardcoding by OS name.
293014bc0770Smrg# Override default settings by setting environment variables
293114bc0770Smrg# Added MAN_SUBSTS in version 1.8
293214bc0770Smrg# Added AC_PROG_SED in version 1.8
2933309c398aSmrg
293414bc0770SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
2935309c398aSmrgAC_REQUIRE([AC_CANONICAL_HOST])
293614bc0770SmrgAC_REQUIRE([AC_PROG_SED])
2937309c398aSmrg
2938688b3aecSmrgcase $host_os in
2939688b3aecSmrg    solaris*)
294014bc0770Smrg        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
294114bc0770Smrg        # check for a man page file found in later versions that use
294214bc0770Smrg        # traditional section numbers instead
294314bc0770Smrg        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
294414bc0770Smrg                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
2945688b3aecSmrg        ;;
294614bc0770Smrg    *) SYSV_MAN_SECTIONS=false ;;
2947688b3aecSmrgesac
2948309c398aSmrg
294914bc0770Smrgif test x$APP_MAN_SUFFIX = x    ; then
295014bc0770Smrg    APP_MAN_SUFFIX=1
2951309c398aSmrgfi
295214bc0770Smrgif test x$APP_MAN_DIR = x    ; then
295314bc0770Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
2954309c398aSmrgfi
2955309c398aSmrg
295614bc0770Smrgif test x$LIB_MAN_SUFFIX = x    ; then
295714bc0770Smrg    LIB_MAN_SUFFIX=3
29588903d43aSmrgfi
295914bc0770Smrgif test x$LIB_MAN_DIR = x    ; then
296014bc0770Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
2961e9554658Smrgfi
2962e9554658Smrg
296314bc0770Smrgif test x$FILE_MAN_SUFFIX = x    ; then
296414bc0770Smrg    case $SYSV_MAN_SECTIONS in
296514bc0770Smrg	true)				FILE_MAN_SUFFIX=4  ;;
296614bc0770Smrg	*)				FILE_MAN_SUFFIX=5  ;;
296714bc0770Smrg    esac
296814bc0770Smrgfi
296914bc0770Smrgif test x$FILE_MAN_DIR = x    ; then
297014bc0770Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
2971688b3aecSmrgfi
2972e9554658Smrg
297314bc0770Smrgif test x$MISC_MAN_SUFFIX = x    ; then
297414bc0770Smrg    case $SYSV_MAN_SECTIONS in
297514bc0770Smrg	true)				MISC_MAN_SUFFIX=5  ;;
297614bc0770Smrg	*)				MISC_MAN_SUFFIX=7  ;;
297714bc0770Smrg    esac
297814bc0770Smrgfi
297914bc0770Smrgif test x$MISC_MAN_DIR = x    ; then
298014bc0770Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
298114bc0770Smrgfi
2982e9554658Smrg
298314bc0770Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
298414bc0770Smrg    case $SYSV_MAN_SECTIONS in
298514bc0770Smrg	true)				DRIVER_MAN_SUFFIX=7  ;;
298614bc0770Smrg	*)				DRIVER_MAN_SUFFIX=4  ;;
298714bc0770Smrg    esac
298814bc0770Smrgfi
298914bc0770Smrgif test x$DRIVER_MAN_DIR = x    ; then
299014bc0770Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
299114bc0770Smrgfi
2992e9554658Smrg
299314bc0770Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
299414bc0770Smrg    case $SYSV_MAN_SECTIONS in
299514bc0770Smrg	true)				ADMIN_MAN_SUFFIX=1m ;;
299614bc0770Smrg	*)				ADMIN_MAN_SUFFIX=8  ;;
299714bc0770Smrg    esac
299814bc0770Smrgfi
299914bc0770Smrgif test x$ADMIN_MAN_DIR = x    ; then
300014bc0770Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
300114bc0770Smrgfi
3002e9554658Smrg
3003e9554658Smrg
300414bc0770SmrgAC_SUBST([APP_MAN_SUFFIX])
300514bc0770SmrgAC_SUBST([LIB_MAN_SUFFIX])
300614bc0770SmrgAC_SUBST([FILE_MAN_SUFFIX])
300714bc0770SmrgAC_SUBST([MISC_MAN_SUFFIX])
300814bc0770SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
300914bc0770SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
301014bc0770SmrgAC_SUBST([APP_MAN_DIR])
301114bc0770SmrgAC_SUBST([LIB_MAN_DIR])
301214bc0770SmrgAC_SUBST([FILE_MAN_DIR])
301314bc0770SmrgAC_SUBST([MISC_MAN_DIR])
301414bc0770SmrgAC_SUBST([DRIVER_MAN_DIR])
301514bc0770SmrgAC_SUBST([ADMIN_MAN_DIR])
3016e9554658Smrg
301714bc0770SmrgXORG_MAN_PAGE="X Version 11"
301814bc0770SmrgAC_SUBST([XORG_MAN_PAGE])
301914bc0770SmrgMAN_SUBSTS="\
302014bc0770Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
302114bc0770Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
302214bc0770Smrg	-e 's|__xservername__|Xorg|g' \
302314bc0770Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
302414bc0770Smrg	-e 's|__projectroot__|\$(prefix)|g' \
302514bc0770Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
302614bc0770Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
302714bc0770Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
302814bc0770Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
302914bc0770Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
303014bc0770Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
303114bc0770Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
303214bc0770SmrgAC_SUBST([MAN_SUBSTS])
3033e9554658Smrg
303414bc0770Smrg]) # XORG_MANPAGE_SECTIONS
3035e9554658Smrg
303614bc0770Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
303714bc0770Smrg# ------------------------
303814bc0770Smrg# Minimum version: 1.7.0
3039688b3aecSmrg#
304014bc0770Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
304114bc0770Smrg# provided by xorg-sgml-doctools, if installed.
304214bc0770SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
304314bc0770SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
304414bc0770SmrgXORG_SGML_PATH=
304514bc0770SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
304614bc0770Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
304714bc0770Smrg    [m4_ifval([$1],[:],
304814bc0770Smrg        [if test x"$cross_compiling" != x"yes" ; then
304914bc0770Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
305014bc0770Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
305114bc0770Smrg         fi])
305214bc0770Smrg    ])
30538903d43aSmrg
305414bc0770Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
305514bc0770Smrg# the path and the name of the doc stylesheet
305614bc0770Smrgif test "x$XORG_SGML_PATH" != "x" ; then
305714bc0770Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
305814bc0770Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
305914bc0770Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
306014bc0770Smrgelse
306114bc0770Smrg   AC_MSG_RESULT([no])
306214bc0770Smrgfi
3063e9554658Smrg
306414bc0770SmrgAC_SUBST(XORG_SGML_PATH)
306514bc0770SmrgAC_SUBST(STYLESHEET_SRCDIR)
306614bc0770SmrgAC_SUBST(XSL_STYLESHEET)
306714bc0770SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
306814bc0770Smrg]) # XORG_CHECK_SGML_DOCTOOLS
3069e9554658Smrg
307014bc0770Smrg# XORG_CHECK_LINUXDOC
307114bc0770Smrg# -------------------
307214bc0770Smrg# Minimum version: 1.0.0
307314bc0770Smrg#
307414bc0770Smrg# Defines the variable MAKE_TEXT if the necessary tools and
307514bc0770Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
307614bc0770Smrg# Whether or not the necessary tools and files are found can be checked
307714bc0770Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
307814bc0770SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
307914bc0770SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
308014bc0770SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
3081e9554658Smrg
308214bc0770SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
3083e9554658Smrg
308414bc0770SmrgAC_MSG_CHECKING([whether to build documentation])
3085e9554658Smrg
308614bc0770Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
308714bc0770Smrg   BUILDDOC=yes
308814bc0770Smrgelse
308914bc0770Smrg   BUILDDOC=no
3090e9554658Smrgfi
3091e9554658Smrg
309214bc0770SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
3093e9554658Smrg
309414bc0770SmrgAC_MSG_RESULT([$BUILDDOC])
3095e9554658Smrg
309614bc0770SmrgAC_MSG_CHECKING([whether to build pdf documentation])
3097688b3aecSmrg
309814bc0770Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
309914bc0770Smrg   BUILDPDFDOC=yes
310014bc0770Smrgelse
310114bc0770Smrg   BUILDPDFDOC=no
310214bc0770Smrgfi
3103688b3aecSmrg
310414bc0770SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
3105688b3aecSmrg
310614bc0770SmrgAC_MSG_RESULT([$BUILDPDFDOC])
3107688b3aecSmrg
310814bc0770SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
310914bc0770SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
311014bc0770SmrgMAKE_PDF="$PS2PDF"
311114bc0770SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
31128903d43aSmrg
311314bc0770SmrgAC_SUBST(MAKE_TEXT)
311414bc0770SmrgAC_SUBST(MAKE_PS)
311514bc0770SmrgAC_SUBST(MAKE_PDF)
311614bc0770SmrgAC_SUBST(MAKE_HTML)
311714bc0770Smrg]) # XORG_CHECK_LINUXDOC
3118688b3aecSmrg
311914bc0770Smrg# XORG_CHECK_DOCBOOK
312014bc0770Smrg# -------------------
312114bc0770Smrg# Minimum version: 1.0.0
312214bc0770Smrg#
312314bc0770Smrg# Checks for the ability to build output formats from SGML DocBook source.
312414bc0770Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
312514bc0770Smrg# indicates whether the necessary tools and files are found and, if set,
312614bc0770Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
312714bc0770SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
312814bc0770SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
31298903d43aSmrg
313014bc0770SmrgBUILDTXTDOC=no
313114bc0770SmrgBUILDPDFDOC=no
313214bc0770SmrgBUILDPSDOC=no
313314bc0770SmrgBUILDHTMLDOC=no
31348903d43aSmrg
313514bc0770SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
313614bc0770SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
313714bc0770SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
313814bc0770SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
31398903d43aSmrg
314014bc0770SmrgAC_MSG_CHECKING([whether to build text documentation])
314114bc0770Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
314214bc0770Smrg   test x$BUILD_TXTDOC != xno; then
314314bc0770Smrg	BUILDTXTDOC=yes
314414bc0770Smrgfi
314514bc0770SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
314614bc0770SmrgAC_MSG_RESULT([$BUILDTXTDOC])
3147309c398aSmrg
314814bc0770SmrgAC_MSG_CHECKING([whether to build PDF documentation])
314914bc0770Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
315014bc0770Smrg   test x$BUILD_PDFDOC != xno; then
315114bc0770Smrg	BUILDPDFDOC=yes
315214bc0770Smrgfi
315314bc0770SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
315414bc0770SmrgAC_MSG_RESULT([$BUILDPDFDOC])
3155688b3aecSmrg
315614bc0770SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
315714bc0770Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
315814bc0770Smrg   test x$BUILD_PSDOC != xno; then
315914bc0770Smrg	BUILDPSDOC=yes
316014bc0770Smrgfi
316114bc0770SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
316214bc0770SmrgAC_MSG_RESULT([$BUILDPSDOC])
3163688b3aecSmrg
316414bc0770SmrgAC_MSG_CHECKING([whether to build HTML documentation])
316514bc0770Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
316614bc0770Smrg   test x$BUILD_HTMLDOC != xno; then
316714bc0770Smrg	BUILDHTMLDOC=yes
3168309c398aSmrgfi
316914bc0770SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
317014bc0770SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
3171309c398aSmrg
317214bc0770SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
317314bc0770SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
317414bc0770SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
317514bc0770SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
3176309c398aSmrg
317714bc0770SmrgAC_SUBST(MAKE_TEXT)
317814bc0770SmrgAC_SUBST(MAKE_PS)
317914bc0770SmrgAC_SUBST(MAKE_PDF)
318014bc0770SmrgAC_SUBST(MAKE_HTML)
318114bc0770Smrg]) # XORG_CHECK_DOCBOOK
318214bc0770Smrg
318314bc0770Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
318414bc0770Smrg# ----------------
318514bc0770Smrg# Minimum version: 1.5.0
318614bc0770Smrg# Minimum version for optional DEFAULT argument: 1.11.0
3187309c398aSmrg#
318814bc0770Smrg# Documentation tools are not always available on all platforms and sometimes
318914bc0770Smrg# not at the appropriate level. This macro enables a module to test for the
319014bc0770Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
319114bc0770Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
319214bc0770Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
319314bc0770Smrg# --with-xmlto assumes 'auto'.
3194309c398aSmrg#
319514bc0770Smrg# Interface to module:
319614bc0770Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
319714bc0770Smrg# XMLTO:	returns the path of the xmlto program found
319814bc0770Smrg#		returns the path set by the user in the environment
319914bc0770Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
320014bc0770Smrg#		'no' user instructs the module not to use xmlto
3201309c398aSmrg#
320214bc0770Smrg# Added in version 1.10.0
320314bc0770Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
320414bc0770Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
3205309c398aSmrg#
320614bc0770Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
3207309c398aSmrg#
320814bc0770SmrgAC_DEFUN([XORG_WITH_XMLTO],[
320914bc0770SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
321014bc0770Smrgm4_define([_defopt], m4_default([$2], [auto]))
321114bc0770SmrgAC_ARG_WITH(xmlto,
321214bc0770Smrg	AS_HELP_STRING([--with-xmlto],
321314bc0770Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
321414bc0770Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
321514bc0770Smrgm4_undefine([_defopt])
3216688b3aecSmrg
321714bc0770Smrgif test "x$use_xmlto" = x"auto"; then
321814bc0770Smrg   AC_PATH_PROG([XMLTO], [xmlto])
321914bc0770Smrg   if test "x$XMLTO" = "x"; then
322014bc0770Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
322114bc0770Smrg	have_xmlto=no
322214bc0770Smrg   else
322314bc0770Smrg        have_xmlto=yes
322414bc0770Smrg   fi
322514bc0770Smrgelif test "x$use_xmlto" = x"yes" ; then
322614bc0770Smrg   AC_PATH_PROG([XMLTO], [xmlto])
322714bc0770Smrg   if test "x$XMLTO" = "x"; then
322814bc0770Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
322914bc0770Smrg   fi
323014bc0770Smrg   have_xmlto=yes
323114bc0770Smrgelif test "x$use_xmlto" = x"no" ; then
323214bc0770Smrg   if test "x$XMLTO" != "x"; then
323314bc0770Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
323414bc0770Smrg   fi
323514bc0770Smrg   have_xmlto=no
323614bc0770Smrgelse
323714bc0770Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
323814bc0770Smrgfi
3239688b3aecSmrg
324014bc0770Smrg# Test for a minimum version of xmlto, if provided.
324114bc0770Smrgm4_ifval([$1],
324214bc0770Smrg[if test "$have_xmlto" = yes; then
324314bc0770Smrg    # scrape the xmlto version
324414bc0770Smrg    AC_MSG_CHECKING([the xmlto version])
324514bc0770Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
324614bc0770Smrg    AC_MSG_RESULT([$xmlto_version])
324714bc0770Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
324814bc0770Smrg        [if test "x$use_xmlto" = xauto; then
324914bc0770Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
325014bc0770Smrg            have_xmlto=no
325114bc0770Smrg        else
325214bc0770Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
325314bc0770Smrg        fi])
325414bc0770Smrgfi])
3255688b3aecSmrg
325614bc0770Smrg# Test for the ability of xmlto to generate a text target
325714bc0770Smrg#
325814bc0770Smrg# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
325914bc0770Smrg# following test for empty XML docbook files.
326014bc0770Smrg# For compatibility reasons use the following empty XML docbook file and if
326114bc0770Smrg# it fails try it again with a non-empty XML file.
326214bc0770Smrghave_xmlto_text=no
326314bc0770Smrgcat > conftest.xml << "EOF"
326414bc0770SmrgEOF
326514bc0770SmrgAS_IF([test "$have_xmlto" = yes],
326614bc0770Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
326714bc0770Smrg             [have_xmlto_text=yes],
326814bc0770Smrg             [# Try it again with a non-empty XML file.
326914bc0770Smrg              cat > conftest.xml << "EOF"
327014bc0770Smrg<x></x>
327114bc0770SmrgEOF
327214bc0770Smrg              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
327314bc0770Smrg                    [have_xmlto_text=yes],
327414bc0770Smrg                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
327514bc0770Smrgrm -f conftest.xml
327614bc0770SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
327714bc0770SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
327814bc0770Smrg]) # XORG_WITH_XMLTO
3279309c398aSmrg
328014bc0770Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
328114bc0770Smrg# --------------------------------------------
328214bc0770Smrg# Minimum version: 1.12.0
328314bc0770Smrg# Minimum version for optional DEFAULT argument: 1.12.0
328414bc0770Smrg#
328514bc0770Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
328614bc0770Smrg# XML-based language used for the transformation of XML documents.
328714bc0770Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
328814bc0770Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
328914bc0770Smrg# The XSLT processor is often used as a standalone tool for transformations.
329014bc0770Smrg# It should not be assumed that this tool is used only to work with documnetation.
329114bc0770Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
329214bc0770Smrg#
329314bc0770Smrg# Interface to module:
329414bc0770Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
329514bc0770Smrg# XSLTPROC:	 returns the path of the xsltproc program found
329614bc0770Smrg#		 returns the path set by the user in the environment
329714bc0770Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
329814bc0770Smrg#		  'no' user instructs the module not to use xsltproc
329914bc0770Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
330014bc0770Smrg#
330114bc0770Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
330214bc0770Smrg#
330314bc0770SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
330414bc0770SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
330514bc0770Smrg# Preserves the interface, should it be implemented later
330614bc0770Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
330714bc0770Smrgm4_define([_defopt], m4_default([$2], [auto]))
330814bc0770SmrgAC_ARG_WITH(xsltproc,
330914bc0770Smrg	AS_HELP_STRING([--with-xsltproc],
331014bc0770Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
331114bc0770Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
331214bc0770Smrgm4_undefine([_defopt])
3313309c398aSmrg
331414bc0770Smrgif test "x$use_xsltproc" = x"auto"; then
331514bc0770Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
331614bc0770Smrg   if test "x$XSLTPROC" = "x"; then
331714bc0770Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
331814bc0770Smrg	have_xsltproc=no
331914bc0770Smrg   else
332014bc0770Smrg        have_xsltproc=yes
332114bc0770Smrg   fi
332214bc0770Smrgelif test "x$use_xsltproc" = x"yes" ; then
332314bc0770Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
332414bc0770Smrg   if test "x$XSLTPROC" = "x"; then
332514bc0770Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
332614bc0770Smrg   fi
332714bc0770Smrg   have_xsltproc=yes
332814bc0770Smrgelif test "x$use_xsltproc" = x"no" ; then
332914bc0770Smrg   if test "x$XSLTPROC" != "x"; then
333014bc0770Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
333114bc0770Smrg   fi
333214bc0770Smrg   have_xsltproc=no
333314bc0770Smrgelse
333414bc0770Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
3335688b3aecSmrgfi
3336309c398aSmrg
333714bc0770SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
333814bc0770Smrg]) # XORG_WITH_XSLTPROC
333914bc0770Smrg
334014bc0770Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
334114bc0770Smrg# ----------------------------------------
334214bc0770Smrg# Minimum version: 1.15.0
33438903d43aSmrg#
334414bc0770Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
334514bc0770Smrg# scanning arbitrary text files, extracting information from those text files,
334614bc0770Smrg# and printing reports based on that information.
33478903d43aSmrg#
334814bc0770Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
33498903d43aSmrg#
335014bc0770Smrg# Interface to module:
335114bc0770Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
335214bc0770Smrg# PERL:	     returns the path of the perl program found
335314bc0770Smrg#	     returns the path set by the user in the environment
335414bc0770Smrg# --with-perl: 'yes' user instructs the module to use perl
335514bc0770Smrg#	       'no' user instructs the module not to use perl
335614bc0770Smrg# have_perl: returns yes if perl found in PATH or no
33578903d43aSmrg#
335814bc0770Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
335914bc0770Smrg#
336014bc0770SmrgAC_DEFUN([XORG_WITH_PERL],[
336114bc0770SmrgAC_ARG_VAR([PERL], [Path to perl command])
336214bc0770Smrg# Preserves the interface, should it be implemented later
336314bc0770Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
336414bc0770Smrgm4_define([_defopt], m4_default([$2], [auto]))
336514bc0770SmrgAC_ARG_WITH(perl,
336614bc0770Smrg	AS_HELP_STRING([--with-perl],
336714bc0770Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
336814bc0770Smrg	   [use_perl=$withval], [use_perl=]_defopt)
336914bc0770Smrgm4_undefine([_defopt])
33708903d43aSmrg
337114bc0770Smrgif test "x$use_perl" = x"auto"; then
337214bc0770Smrg   AC_PATH_PROG([PERL], [perl])
337314bc0770Smrg   if test "x$PERL" = "x"; then
337414bc0770Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
337514bc0770Smrg	have_perl=no
337614bc0770Smrg   else
337714bc0770Smrg        have_perl=yes
337814bc0770Smrg   fi
337914bc0770Smrgelif test "x$use_perl" = x"yes" ; then
338014bc0770Smrg   AC_PATH_PROG([PERL], [perl])
338114bc0770Smrg   if test "x$PERL" = "x"; then
338214bc0770Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
338314bc0770Smrg   fi
338414bc0770Smrg   have_perl=yes
338514bc0770Smrgelif test "x$use_perl" = x"no" ; then
338614bc0770Smrg   if test "x$PERL" != "x"; then
338714bc0770Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
338814bc0770Smrg   fi
338914bc0770Smrg   have_perl=no
339014bc0770Smrgelse
339114bc0770Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
339214bc0770Smrgfi
33938903d43aSmrg
339414bc0770SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
339514bc0770Smrg]) # XORG_WITH_PERL
3396688b3aecSmrg
339714bc0770Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
3398688b3aecSmrg# ----------------
339914bc0770Smrg# Minimum version: 1.5.0
340014bc0770Smrg# Minimum version for optional DEFAULT argument: 1.11.0
34018903d43aSmrg#
340214bc0770Smrg# Documentation tools are not always available on all platforms and sometimes
340314bc0770Smrg# not at the appropriate level. This macro enables a module to test for the
340414bc0770Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
340514bc0770Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
340614bc0770Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
340714bc0770Smrg# --with-asciidoc assumes 'auto'.
34088903d43aSmrg#
340914bc0770Smrg# Interface to module:
341014bc0770Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
341114bc0770Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
341214bc0770Smrg#		 returns the path set by the user in the environment
341314bc0770Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
341414bc0770Smrg#		  'no' user instructs the module not to use asciidoc
34158903d43aSmrg#
341614bc0770Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
3417688b3aecSmrg#
341814bc0770SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
341914bc0770SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
342014bc0770Smrgm4_define([_defopt], m4_default([$2], [auto]))
342114bc0770SmrgAC_ARG_WITH(asciidoc,
342214bc0770Smrg	AS_HELP_STRING([--with-asciidoc],
342314bc0770Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
342414bc0770Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
342514bc0770Smrgm4_undefine([_defopt])
3426688b3aecSmrg
342714bc0770Smrgif test "x$use_asciidoc" = x"auto"; then
342814bc0770Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
342914bc0770Smrg   if test "x$ASCIIDOC" = "x"; then
343014bc0770Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
343114bc0770Smrg	have_asciidoc=no
343214bc0770Smrg   else
343314bc0770Smrg        have_asciidoc=yes
343414bc0770Smrg   fi
343514bc0770Smrgelif test "x$use_asciidoc" = x"yes" ; then
343614bc0770Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
343714bc0770Smrg   if test "x$ASCIIDOC" = "x"; then
343814bc0770Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
343914bc0770Smrg   fi
344014bc0770Smrg   have_asciidoc=yes
344114bc0770Smrgelif test "x$use_asciidoc" = x"no" ; then
344214bc0770Smrg   if test "x$ASCIIDOC" != "x"; then
344314bc0770Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
344414bc0770Smrg   fi
344514bc0770Smrg   have_asciidoc=no
344614bc0770Smrgelse
344714bc0770Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
344814bc0770Smrgfi
344914bc0770Smrgm4_ifval([$1],
345014bc0770Smrg[if test "$have_asciidoc" = yes; then
345114bc0770Smrg    # scrape the asciidoc version
345214bc0770Smrg    AC_MSG_CHECKING([the asciidoc version])
345314bc0770Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
345414bc0770Smrg    AC_MSG_RESULT([$asciidoc_version])
345514bc0770Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
345614bc0770Smrg        [if test "x$use_asciidoc" = xauto; then
345714bc0770Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
345814bc0770Smrg            have_asciidoc=no
345914bc0770Smrg        else
346014bc0770Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
346114bc0770Smrg        fi])
346214bc0770Smrgfi])
346314bc0770SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
346414bc0770Smrg]) # XORG_WITH_ASCIIDOC
3465688b3aecSmrg
346614bc0770Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
346714bc0770Smrg# -------------------------------------------
346814bc0770Smrg# Minimum version: 1.5.0
346914bc0770Smrg# Minimum version for optional DEFAULT argument: 1.11.0
347014bc0770Smrg# Minimum version for optional DOT checking: 1.18.0
34718903d43aSmrg#
347214bc0770Smrg# Documentation tools are not always available on all platforms and sometimes
347314bc0770Smrg# not at the appropriate level. This macro enables a module to test for the
347414bc0770Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
347514bc0770Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
347614bc0770Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
347714bc0770Smrg# --with-doxygen assumes 'auto'.
34788903d43aSmrg#
347914bc0770Smrg# Interface to module:
348014bc0770Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
348114bc0770Smrg# DOXYGEN:	 returns the path of the doxygen program found
348214bc0770Smrg#		 returns the path set by the user in the environment
348314bc0770Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
348414bc0770Smrg#		  'no' user instructs the module not to use doxygen
34858903d43aSmrg#
348614bc0770Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
34878903d43aSmrg#
348814bc0770SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
348914bc0770SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
349014bc0770SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
349114bc0770Smrgm4_define([_defopt], m4_default([$2], [auto]))
349214bc0770SmrgAC_ARG_WITH(doxygen,
349314bc0770Smrg	AS_HELP_STRING([--with-doxygen],
349414bc0770Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
349514bc0770Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
349614bc0770Smrgm4_undefine([_defopt])
34978903d43aSmrg
349814bc0770Smrgif test "x$use_doxygen" = x"auto"; then
349914bc0770Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
350014bc0770Smrg   if test "x$DOXYGEN" = "x"; then
350114bc0770Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
350214bc0770Smrg	have_doxygen=no
350314bc0770Smrg   else
350414bc0770Smrg        have_doxygen=yes
350514bc0770Smrg   fi
350614bc0770Smrgelif test "x$use_doxygen" = x"yes" ; then
350714bc0770Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
350814bc0770Smrg   if test "x$DOXYGEN" = "x"; then
350914bc0770Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
351014bc0770Smrg   fi
351114bc0770Smrg   have_doxygen=yes
351214bc0770Smrgelif test "x$use_doxygen" = x"no" ; then
351314bc0770Smrg   if test "x$DOXYGEN" != "x"; then
351414bc0770Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
351514bc0770Smrg   fi
351614bc0770Smrg   have_doxygen=no
35178903d43aSmrgelse
351814bc0770Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
35198903d43aSmrgfi
352014bc0770Smrgm4_ifval([$1],
352114bc0770Smrg[if test "$have_doxygen" = yes; then
352214bc0770Smrg    # scrape the doxygen version
352314bc0770Smrg    AC_MSG_CHECKING([the doxygen version])
352414bc0770Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
352514bc0770Smrg    AC_MSG_RESULT([$doxygen_version])
352614bc0770Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
352714bc0770Smrg        [if test "x$use_doxygen" = xauto; then
352814bc0770Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
352914bc0770Smrg            have_doxygen=no
353014bc0770Smrg        else
353114bc0770Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
353214bc0770Smrg        fi])
353314bc0770Smrgfi])
35348903d43aSmrg
353514bc0770Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
353614bc0770Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
353714bc0770Smrgdnl 	HAVE_DOT = @HAVE_DOT@
353814bc0770SmrgHAVE_DOT=no
353914bc0770Smrgif test "x$have_doxygen" = "xyes"; then
354014bc0770Smrg  AC_PATH_PROG([DOT], [dot])
354114bc0770Smrg    if test "x$DOT" != "x"; then
354214bc0770Smrg      HAVE_DOT=yes
354314bc0770Smrg    fi
354414bc0770Smrgfi
3545688b3aecSmrg
354614bc0770SmrgAC_SUBST([HAVE_DOT])
354714bc0770SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
354814bc0770SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
354914bc0770Smrg]) # XORG_WITH_DOXYGEN
3550688b3aecSmrg
355114bc0770Smrg# XORG_WITH_GROFF([DEFAULT])
355214bc0770Smrg# ----------------
355314bc0770Smrg# Minimum version: 1.6.0
355414bc0770Smrg# Minimum version for optional DEFAULT argument: 1.11.0
3555688b3aecSmrg#
355614bc0770Smrg# Documentation tools are not always available on all platforms and sometimes
355714bc0770Smrg# not at the appropriate level. This macro enables a module to test for the
355814bc0770Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
355914bc0770Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
356014bc0770Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
356114bc0770Smrg# --with-groff assumes 'auto'.
356214bc0770Smrg#
356314bc0770Smrg# Interface to module:
356414bc0770Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
356514bc0770Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
356614bc0770Smrg# HAVE_GROFF_MS: the -ms macros package
356714bc0770Smrg# GROFF:	 returns the path of the groff program found
356814bc0770Smrg#		 returns the path set by the user in the environment
356914bc0770Smrg# --with-groff:	 'yes' user instructs the module to use groff
357014bc0770Smrg#		 'no' user instructs the module not to use groff
357114bc0770Smrg#
357214bc0770Smrg# Added in version 1.9.0:
357314bc0770Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
357414bc0770Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
357514bc0770Smrg#		   psselect from the psutils package.
357614bc0770Smrg#		   the ghostcript package. Refer to the grohtml man pages
357714bc0770Smrg#
357814bc0770Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
357914bc0770Smrg#
358014bc0770Smrg# OS and distros often splits groff in a basic and full package, the former
358114bc0770Smrg# having the groff program and the later having devices, fonts and macros
358214bc0770Smrg# Checking for the groff executable is not enough.
358314bc0770Smrg#
358414bc0770Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
358514bc0770Smrg# unset HAVE_GROFF or GROFF env variables.
358614bc0770Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
358714bc0770Smrg#
358814bc0770SmrgAC_DEFUN([XORG_WITH_GROFF],[
358914bc0770SmrgAC_ARG_VAR([GROFF], [Path to groff command])
359014bc0770Smrgm4_define([_defopt], m4_default([$1], [auto]))
359114bc0770SmrgAC_ARG_WITH(groff,
359214bc0770Smrg	AS_HELP_STRING([--with-groff],
359314bc0770Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
359414bc0770Smrg	   [use_groff=$withval], [use_groff=]_defopt)
359514bc0770Smrgm4_undefine([_defopt])
3596688b3aecSmrg
359714bc0770Smrgif test "x$use_groff" = x"auto"; then
359814bc0770Smrg   AC_PATH_PROG([GROFF], [groff])
359914bc0770Smrg   if test "x$GROFF" = "x"; then
360014bc0770Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
360114bc0770Smrg	have_groff=no
360214bc0770Smrg   else
360314bc0770Smrg        have_groff=yes
360414bc0770Smrg   fi
360514bc0770Smrgelif test "x$use_groff" = x"yes" ; then
360614bc0770Smrg   AC_PATH_PROG([GROFF], [groff])
360714bc0770Smrg   if test "x$GROFF" = "x"; then
360814bc0770Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
360914bc0770Smrg   fi
361014bc0770Smrg   have_groff=yes
361114bc0770Smrgelif test "x$use_groff" = x"no" ; then
361214bc0770Smrg   if test "x$GROFF" != "x"; then
361314bc0770Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
361414bc0770Smrg   fi
361514bc0770Smrg   have_groff=no
361614bc0770Smrgelse
361714bc0770Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
361814bc0770Smrgfi
36198903d43aSmrg
362014bc0770Smrg# We have groff, test for the presence of the macro packages
362114bc0770Smrgif test "x$have_groff" = x"yes"; then
362214bc0770Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
362314bc0770Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
362414bc0770Smrg        groff_ms_works=yes
362514bc0770Smrg    else
362614bc0770Smrg        groff_ms_works=no
3627688b3aecSmrg    fi
362814bc0770Smrg    AC_MSG_RESULT([$groff_ms_works])
362914bc0770Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
363014bc0770Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
363114bc0770Smrg        groff_mm_works=yes
363214bc0770Smrg    else
363314bc0770Smrg        groff_mm_works=no
363414bc0770Smrg    fi
363514bc0770Smrg    AC_MSG_RESULT([$groff_mm_works])
363614bc0770Smrgfi
36378903d43aSmrg
363814bc0770Smrg# We have groff, test for HTML dependencies, one command per package
363914bc0770Smrgif test "x$have_groff" = x"yes"; then
364014bc0770Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
364114bc0770Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
364214bc0770Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
364314bc0770Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
364414bc0770Smrg      have_groff_html=yes
364514bc0770Smrg   else
364614bc0770Smrg      have_groff_html=no
364714bc0770Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
364814bc0770Smrg   fi
364914bc0770Smrgfi
365014bc0770Smrg
365114bc0770Smrg# Set Automake conditionals for Makefiles
365214bc0770SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
365314bc0770SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
365414bc0770SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
365514bc0770SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
365614bc0770Smrg]) # XORG_WITH_GROFF
365714bc0770Smrg
365814bc0770Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
365914bc0770Smrg# ---------------------------------------
366014bc0770Smrg# Minimum version: 1.6.0
366114bc0770Smrg# Minimum version for optional DEFAULT argument: 1.11.0
366214bc0770Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
366314bc0770Smrg#
366414bc0770Smrg# Documentation tools are not always available on all platforms and sometimes
366514bc0770Smrg# not at the appropriate level. This macro enables a module to test for the
366614bc0770Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
366714bc0770Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
366814bc0770Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
366914bc0770Smrg# --with-fop assumes 'auto'.
367014bc0770Smrg#
367114bc0770Smrg# Interface to module:
367214bc0770Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
367314bc0770Smrg# FOP:	 	returns the path of the fop program found
367414bc0770Smrg#		returns the path set by the user in the environment
367514bc0770Smrg# --with-fop: 	'yes' user instructs the module to use fop
367614bc0770Smrg#		'no' user instructs the module not to use fop
367714bc0770Smrg#
367814bc0770Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
367914bc0770Smrg#
368014bc0770SmrgAC_DEFUN([XORG_WITH_FOP],[
368114bc0770SmrgAC_ARG_VAR([FOP], [Path to fop command])
368214bc0770Smrgm4_define([_defopt], m4_default([$2], [auto]))
368314bc0770SmrgAC_ARG_WITH(fop,
368414bc0770Smrg	AS_HELP_STRING([--with-fop],
368514bc0770Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
368614bc0770Smrg	   [use_fop=$withval], [use_fop=]_defopt)
368714bc0770Smrgm4_undefine([_defopt])
368814bc0770Smrg
368914bc0770Smrgif test "x$use_fop" = x"auto"; then
369014bc0770Smrg   AC_PATH_PROG([FOP], [fop])
369114bc0770Smrg   if test "x$FOP" = "x"; then
369214bc0770Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
369314bc0770Smrg	have_fop=no
369414bc0770Smrg   else
369514bc0770Smrg        have_fop=yes
369614bc0770Smrg   fi
369714bc0770Smrgelif test "x$use_fop" = x"yes" ; then
369814bc0770Smrg   AC_PATH_PROG([FOP], [fop])
369914bc0770Smrg   if test "x$FOP" = "x"; then
370014bc0770Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
370114bc0770Smrg   fi
370214bc0770Smrg   have_fop=yes
370314bc0770Smrgelif test "x$use_fop" = x"no" ; then
370414bc0770Smrg   if test "x$FOP" != "x"; then
370514bc0770Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
370614bc0770Smrg   fi
370714bc0770Smrg   have_fop=no
37088903d43aSmrgelse
370914bc0770Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
37108903d43aSmrgfi
3711309c398aSmrg
371214bc0770Smrg# Test for a minimum version of fop, if provided.
371314bc0770Smrgm4_ifval([$1],
371414bc0770Smrg[if test "$have_fop" = yes; then
371514bc0770Smrg    # scrape the fop version
371614bc0770Smrg    AC_MSG_CHECKING([for fop minimum version])
371714bc0770Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
371814bc0770Smrg    AC_MSG_RESULT([$fop_version])
371914bc0770Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
372014bc0770Smrg        [if test "x$use_fop" = xauto; then
372114bc0770Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
372214bc0770Smrg            have_fop=no
372314bc0770Smrg        else
372414bc0770Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
372514bc0770Smrg        fi])
372614bc0770Smrgfi])
372714bc0770SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
372814bc0770Smrg]) # XORG_WITH_FOP
372914bc0770Smrg
373014bc0770Smrg# XORG_WITH_M4([MIN-VERSION])
373114bc0770Smrg# ---------------------------
373214bc0770Smrg# Minimum version: 1.19.0
373314bc0770Smrg#
373414bc0770Smrg# This macro attempts to locate an m4 macro processor which supports
373514bc0770Smrg# -I option and is only useful for modules relying on M4 in order to
373614bc0770Smrg# expand macros in source code files.
373714bc0770Smrg#
373814bc0770Smrg# Interface to module:
373914bc0770Smrg# M4:	 	returns the path of the m4 program found
374014bc0770Smrg#		returns the path set by the user in the environment
374114bc0770Smrg#
374214bc0770SmrgAC_DEFUN([XORG_WITH_M4], [
374314bc0770SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
374414bc0770Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
374514bc0770Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
374614bc0770Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
374714bc0770Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
374814bc0770Smrg   [$PATH:/usr/gnu/bin])])
37498903d43aSmrg
375014bc0770SmrgAC_SUBST([M4], [$ac_cv_path_M4])
375114bc0770Smrg]) # XORG_WITH_M4
37528903d43aSmrg
375314bc0770Smrg# XORG_WITH_PS2PDF([DEFAULT])
375414bc0770Smrg# ----------------
375514bc0770Smrg# Minimum version: 1.6.0
375614bc0770Smrg# Minimum version for optional DEFAULT argument: 1.11.0
375714bc0770Smrg#
375814bc0770Smrg# Documentation tools are not always available on all platforms and sometimes
375914bc0770Smrg# not at the appropriate level. This macro enables a module to test for the
376014bc0770Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
376114bc0770Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
376214bc0770Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
376314bc0770Smrg# --with-ps2pdf assumes 'auto'.
376414bc0770Smrg#
376514bc0770Smrg# Interface to module:
376614bc0770Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
376714bc0770Smrg# PS2PDF:	returns the path of the ps2pdf program found
376814bc0770Smrg#		returns the path set by the user in the environment
376914bc0770Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
377014bc0770Smrg#		 'no' user instructs the module not to use ps2pdf
377114bc0770Smrg#
377214bc0770Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
377314bc0770Smrg#
377414bc0770SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
377514bc0770SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
377614bc0770Smrgm4_define([_defopt], m4_default([$1], [auto]))
377714bc0770SmrgAC_ARG_WITH(ps2pdf,
377814bc0770Smrg	AS_HELP_STRING([--with-ps2pdf],
377914bc0770Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
378014bc0770Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
378114bc0770Smrgm4_undefine([_defopt])
37828903d43aSmrg
378314bc0770Smrgif test "x$use_ps2pdf" = x"auto"; then
378414bc0770Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
378514bc0770Smrg   if test "x$PS2PDF" = "x"; then
378614bc0770Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
378714bc0770Smrg	have_ps2pdf=no
378814bc0770Smrg   else
378914bc0770Smrg        have_ps2pdf=yes
379014bc0770Smrg   fi
379114bc0770Smrgelif test "x$use_ps2pdf" = x"yes" ; then
379214bc0770Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
379314bc0770Smrg   if test "x$PS2PDF" = "x"; then
379414bc0770Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
379514bc0770Smrg   fi
379614bc0770Smrg   have_ps2pdf=yes
379714bc0770Smrgelif test "x$use_ps2pdf" = x"no" ; then
379814bc0770Smrg   if test "x$PS2PDF" != "x"; then
379914bc0770Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
380014bc0770Smrg   fi
380114bc0770Smrg   have_ps2pdf=no
380214bc0770Smrgelse
380314bc0770Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
3804688b3aecSmrgfi
380514bc0770SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
380614bc0770Smrg]) # XORG_WITH_PS2PDF
38078903d43aSmrg
380814bc0770Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
380914bc0770Smrg# ----------------
381014bc0770Smrg# Minimum version: 1.6.0
38118903d43aSmrg#
381214bc0770Smrg# Documentation tools are not always available on all platforms and sometimes
381314bc0770Smrg# not at the appropriate level. This macro enables a builder to skip all
381414bc0770Smrg# documentation targets except traditional man pages.
381514bc0770Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
381614bc0770Smrg# maximum flexibilty in controlling documentation building.
381714bc0770Smrg# Refer to:
381814bc0770Smrg# XORG_WITH_XMLTO         --with-xmlto
381914bc0770Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
382014bc0770Smrg# XORG_WITH_DOXYGEN       --with-doxygen
382114bc0770Smrg# XORG_WITH_FOP           --with-fop
382214bc0770Smrg# XORG_WITH_GROFF         --with-groff
382314bc0770Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
382414bc0770Smrg#
382514bc0770Smrg# Interface to module:
382614bc0770Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
382714bc0770Smrg# --enable-docs: 'yes' user instructs the module to generate docs
382814bc0770Smrg#		 'no' user instructs the module not to generate docs
382914bc0770Smrg# parm1:	specify the default value, yes or no.
383014bc0770Smrg#
383114bc0770SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
383214bc0770Smrgm4_define([docs_default], m4_default([$1], [yes]))
383314bc0770SmrgAC_ARG_ENABLE(docs,
383414bc0770Smrg	AS_HELP_STRING([--enable-docs],
383514bc0770Smrg	   [Enable building the documentation (default: ]docs_default[)]),
383614bc0770Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
383714bc0770Smrgm4_undefine([docs_default])
383814bc0770SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
383914bc0770SmrgAC_MSG_CHECKING([whether to build documentation])
384014bc0770SmrgAC_MSG_RESULT([$build_docs])
384114bc0770Smrg]) # XORG_ENABLE_DOCS
3842309c398aSmrg
384314bc0770Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
384414bc0770Smrg# ----------------
384514bc0770Smrg# Minimum version: 1.6.0
384614bc0770Smrg#
384714bc0770Smrg# This macro enables a builder to skip all developer documentation.
384814bc0770Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
384914bc0770Smrg# maximum flexibilty in controlling documentation building.
385014bc0770Smrg# Refer to:
385114bc0770Smrg# XORG_WITH_XMLTO         --with-xmlto
385214bc0770Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
385314bc0770Smrg# XORG_WITH_DOXYGEN       --with-doxygen
385414bc0770Smrg# XORG_WITH_FOP           --with-fop
385514bc0770Smrg# XORG_WITH_GROFF         --with-groff
385614bc0770Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
385714bc0770Smrg#
385814bc0770Smrg# Interface to module:
385914bc0770Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
386014bc0770Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
386114bc0770Smrg#			'no' user instructs the module not to generate developer docs
386214bc0770Smrg# parm1:		specify the default value, yes or no.
386314bc0770Smrg#
386414bc0770SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
386514bc0770Smrgm4_define([devel_default], m4_default([$1], [yes]))
386614bc0770SmrgAC_ARG_ENABLE(devel-docs,
386714bc0770Smrg	AS_HELP_STRING([--enable-devel-docs],
386814bc0770Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
386914bc0770Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
387014bc0770Smrgm4_undefine([devel_default])
387114bc0770SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
387214bc0770SmrgAC_MSG_CHECKING([whether to build developer documentation])
387314bc0770SmrgAC_MSG_RESULT([$build_devel_docs])
387414bc0770Smrg]) # XORG_ENABLE_DEVEL_DOCS
38755dd5f640Smrg
387614bc0770Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
387714bc0770Smrg# ----------------
387814bc0770Smrg# Minimum version: 1.6.0
387914bc0770Smrg#
388014bc0770Smrg# This macro enables a builder to skip all functional specification targets.
388114bc0770Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
388214bc0770Smrg# maximum flexibilty in controlling documentation building.
388314bc0770Smrg# Refer to:
388414bc0770Smrg# XORG_WITH_XMLTO         --with-xmlto
388514bc0770Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
388614bc0770Smrg# XORG_WITH_DOXYGEN       --with-doxygen
388714bc0770Smrg# XORG_WITH_FOP           --with-fop
388814bc0770Smrg# XORG_WITH_GROFF         --with-groff
388914bc0770Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
389014bc0770Smrg#
389114bc0770Smrg# Interface to module:
389214bc0770Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
389314bc0770Smrg# --enable-specs:	'yes' user instructs the module to generate specs
389414bc0770Smrg#			'no' user instructs the module not to generate specs
389514bc0770Smrg# parm1:		specify the default value, yes or no.
389614bc0770Smrg#
389714bc0770SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
389814bc0770Smrgm4_define([spec_default], m4_default([$1], [yes]))
389914bc0770SmrgAC_ARG_ENABLE(specs,
390014bc0770Smrg	AS_HELP_STRING([--enable-specs],
390114bc0770Smrg	   [Enable building the specs (default: ]spec_default[)]),
390214bc0770Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
390314bc0770Smrgm4_undefine([spec_default])
390414bc0770SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
390514bc0770SmrgAC_MSG_CHECKING([whether to build functional specifications])
390614bc0770SmrgAC_MSG_RESULT([$build_specs])
390714bc0770Smrg]) # XORG_ENABLE_SPECS
3908688b3aecSmrg
390914bc0770Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
391014bc0770Smrg# ----------------------------------------------
391114bc0770Smrg# Minimum version: 1.13.0
3912309c398aSmrg#
391314bc0770Smrg# This macro enables a builder to enable/disable unit testing
391414bc0770Smrg# It makes no assumption about the test cases implementation
391514bc0770Smrg# Test cases may or may not use Automake "Support for test suites"
391614bc0770Smrg# They may or may not use the software utility library GLib
391714bc0770Smrg#
391814bc0770Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
391914bc0770Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
392014bc0770Smrg# The variable enable_unit_tests is used by other macros in this file.
392114bc0770Smrg#
392214bc0770Smrg# Interface to module:
392314bc0770Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
392414bc0770Smrg# enable_unit_tests:    used in configure.ac for additional configuration
392514bc0770Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
392614bc0770Smrg#			'no' user instructs the module not to build tests
392714bc0770Smrg# parm1:		specify the default value, yes or no.
392814bc0770Smrg#
392914bc0770SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
393014bc0770SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
393114bc0770SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
393214bc0770SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
393314bc0770Smrgm4_define([_defopt], m4_default([$1], [auto]))
393414bc0770SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
393514bc0770Smrg	[Enable building unit test cases (default: ]_defopt[)]),
393614bc0770Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
393714bc0770Smrgm4_undefine([_defopt])
393814bc0770SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
393914bc0770SmrgAC_MSG_CHECKING([whether to build unit test cases])
394014bc0770SmrgAC_MSG_RESULT([$enable_unit_tests])
394114bc0770Smrg]) # XORG_ENABLE_UNIT_TESTS
3942309c398aSmrg
394314bc0770Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
394414bc0770Smrg# ------------------------------------------------------
394514bc0770Smrg# Minimum version: 1.17.0
394614bc0770Smrg#
394714bc0770Smrg# This macro enables a builder to enable/disable integration testing
394814bc0770Smrg# It makes no assumption about the test cases' implementation
394914bc0770Smrg# Test cases may or may not use Automake "Support for test suites"
395014bc0770Smrg#
395114bc0770Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
395214bc0770Smrg# usually requires less dependencies and may be built and run under less
395314bc0770Smrg# stringent environments than integration tests.
395414bc0770Smrg#
395514bc0770Smrg# Interface to module:
395614bc0770Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
395714bc0770Smrg# enable_integration_tests:   used in configure.ac for additional configuration
395814bc0770Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
395914bc0770Smrg#                             'no' user instructs the module not to build tests
396014bc0770Smrg# parm1:                      specify the default value, yes or no.
396114bc0770Smrg#
396214bc0770SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
396314bc0770SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
396414bc0770Smrgm4_define([_defopt], m4_default([$1], [auto]))
396514bc0770SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
396614bc0770Smrg	[Enable building integration test cases (default: ]_defopt[)]),
396714bc0770Smrg	[enable_integration_tests=$enableval],
396814bc0770Smrg	[enable_integration_tests=]_defopt)
396914bc0770Smrgm4_undefine([_defopt])
397014bc0770SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
397114bc0770Smrg	[test "x$enable_integration_tests" != xno])
397214bc0770SmrgAC_MSG_CHECKING([whether to build unit test cases])
397314bc0770SmrgAC_MSG_RESULT([$enable_integration_tests])
397414bc0770Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
3975309c398aSmrg
397614bc0770Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
397714bc0770Smrg# ----------------------------------------
397814bc0770Smrg# Minimum version: 1.13.0
397914bc0770Smrg#
398014bc0770Smrg# GLib is a library which provides advanced data structures and functions.
398114bc0770Smrg# This macro enables a module to test for the presence of Glib.
398214bc0770Smrg#
398314bc0770Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
398414bc0770Smrg# Otherwise the value of $enable_unit_tests is blank.
398514bc0770Smrg#
398614bc0770Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
398714bc0770Smrg# test support usually requires less dependencies and may be built and run under
398814bc0770Smrg# less stringent environments than integration tests.
398914bc0770Smrg#
399014bc0770Smrg# Interface to module:
399114bc0770Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
399214bc0770Smrg# with_glib: used in configure.ac to know if GLib has been found
399314bc0770Smrg# --with-glib:	'yes' user instructs the module to use glib
399414bc0770Smrg#		'no' user instructs the module not to use glib
3995688b3aecSmrg#
399614bc0770SmrgAC_DEFUN([XORG_WITH_GLIB],[
399714bc0770SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
399814bc0770Smrgm4_define([_defopt], m4_default([$2], [auto]))
399914bc0770SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
400014bc0770Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
400114bc0770Smrg	[with_glib=$withval], [with_glib=]_defopt)
400214bc0770Smrgm4_undefine([_defopt])
4003309c398aSmrg
400414bc0770Smrghave_glib=no
400514bc0770Smrg# Do not probe GLib if user explicitly disabled unit testing
400614bc0770Smrgif test "x$enable_unit_tests" != x"no"; then
400714bc0770Smrg  # Do not probe GLib if user explicitly disabled it
400814bc0770Smrg  if test "x$with_glib" != x"no"; then
400914bc0770Smrg    m4_ifval(
401014bc0770Smrg      [$1],
401114bc0770Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
401214bc0770Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
401314bc0770Smrg    )
4014309c398aSmrg  fi
4015309c398aSmrgfi
4016309c398aSmrg
401714bc0770Smrg# Not having GLib when unit testing has been explicitly requested is an error
401814bc0770Smrgif test "x$enable_unit_tests" = x"yes"; then
401914bc0770Smrg  if test "x$have_glib" = x"no"; then
402014bc0770Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
4021309c398aSmrg  fi
4022309c398aSmrgfi
4023309c398aSmrg
402414bc0770Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
402514bc0770Smrgif test "x$enable_unit_tests" = x"no"; then
402614bc0770Smrg  if test "x$with_glib" = x"yes"; then
402714bc0770Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
402814bc0770Smrg  fi
402914bc0770Smrgfi
4030309c398aSmrg
403114bc0770Smrg# Not having GLib when it has been explicitly requested is an error
403214bc0770Smrgif test "x$with_glib" = x"yes"; then
403314bc0770Smrg  if test "x$have_glib" = x"no"; then
403414bc0770Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
403514bc0770Smrg  fi
403614bc0770Smrgfi
4037309c398aSmrg
403814bc0770SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
403914bc0770Smrg]) # XORG_WITH_GLIB
4040309c398aSmrg
404114bc0770Smrg# XORG_LD_WRAP([required|optional])
404214bc0770Smrg# ---------------------------------
404314bc0770Smrg# Minimum version: 1.13.0
404414bc0770Smrg#
404514bc0770Smrg# Check if linker supports -wrap, passed via compiler flags
404614bc0770Smrg#
404714bc0770Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
404814bc0770Smrg# Otherwise the value of $enable_unit_tests is blank.
404914bc0770Smrg#
405014bc0770Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
405114bc0770Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
405214bc0770Smrg# available, an argument of "optional" allows use when some unit tests require
405314bc0770Smrg# ld -wrap and others do not.
405414bc0770Smrg#
405514bc0770SmrgAC_DEFUN([XORG_LD_WRAP],[
405614bc0770SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
405714bc0770Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
405814bc0770Smrg                      void __wrap_exit(int status) { return; }],
405914bc0770Smrg                     [exit(0);])])
406014bc0770Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
406114bc0770Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
406214bc0770Smrg  if test "x$have_ld_wrap" = x"no"; then
406314bc0770Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
406414bc0770Smrg  fi
406514bc0770Smrgfi
406614bc0770SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
406714bc0770Smrg#
406814bc0770Smrg]) # XORG_LD_WRAP
4069309c398aSmrg
407014bc0770Smrg# XORG_CHECK_LINKER_FLAGS
407114bc0770Smrg# -----------------------
407214bc0770Smrg# SYNOPSIS
407314bc0770Smrg#
407414bc0770Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
407514bc0770Smrg#
407614bc0770Smrg# DESCRIPTION
407714bc0770Smrg#
407814bc0770Smrg#   Check whether the given linker FLAGS work with the current language's
407914bc0770Smrg#   linker, or whether they give an error.
408014bc0770Smrg#
408114bc0770Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
408214bc0770Smrg#   success/failure.
408314bc0770Smrg#
408414bc0770Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
408514bc0770Smrg#
408614bc0770Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
408714bc0770Smrg#
408814bc0770Smrg# LICENSE
408914bc0770Smrg#
409014bc0770Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
409114bc0770Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
409214bc0770Smrg#   Copyright (c) 2009 Matteo Frigo
409314bc0770Smrg#
409414bc0770Smrg#   This program is free software: you can redistribute it and/or modify it
409514bc0770Smrg#   under the terms of the GNU General Public License as published by the
409614bc0770Smrg#   Free Software Foundation, either version 3 of the License, or (at your
409714bc0770Smrg#   option) any later version.
409814bc0770Smrg#
409914bc0770Smrg#   This program is distributed in the hope that it will be useful, but
410014bc0770Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
410114bc0770Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
410214bc0770Smrg#   Public License for more details.
410314bc0770Smrg#
410414bc0770Smrg#   You should have received a copy of the GNU General Public License along
410514bc0770Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
410614bc0770Smrg#
410714bc0770Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
410814bc0770Smrg#   gives unlimited permission to copy, distribute and modify the configure
410914bc0770Smrg#   scripts that are the output of Autoconf when processing the Macro. You
411014bc0770Smrg#   need not follow the terms of the GNU General Public License when using
411114bc0770Smrg#   or distributing such scripts, even though portions of the text of the
411214bc0770Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
411314bc0770Smrg#   all other use of the material that constitutes the Autoconf Macro.
411414bc0770Smrg#
411514bc0770Smrg#   This special exception to the GPL applies to versions of the Autoconf
411614bc0770Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
411714bc0770Smrg#   modified version of the Autoconf Macro, you may extend this special
411814bc0770Smrg#   exception to the GPL to apply to your modified version as well.#
411914bc0770SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
412014bc0770Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
412114bc0770Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
412214bc0770SmrgAS_LITERAL_IF([$1],
412314bc0770Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
412414bc0770Smrg      ax_save_FLAGS=$LDFLAGS
412514bc0770Smrg      LDFLAGS="$1"
412614bc0770Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
412714bc0770Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
412814bc0770Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
412914bc0770Smrg      LDFLAGS=$ax_save_FLAGS])],
413014bc0770Smrg  [ax_save_FLAGS=$LDFLAGS
413114bc0770Smrg   LDFLAGS="$1"
413214bc0770Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
413314bc0770Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
413414bc0770Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
413514bc0770Smrg   LDFLAGS=$ax_save_FLAGS])
413614bc0770Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
413714bc0770SmrgAC_MSG_RESULT($xorg_check_linker_flags)
413814bc0770Smrgif test "x$xorg_check_linker_flags" = xyes; then
413914bc0770Smrg	m4_default([$2], :)
414014bc0770Smrgelse
414114bc0770Smrg	m4_default([$3], :)
414214bc0770Smrgfi
414314bc0770Smrg]) # XORG_CHECK_LINKER_FLAGS
4144309c398aSmrg
414514bc0770Smrg# XORG_MEMORY_CHECK_FLAGS
414614bc0770Smrg# -----------------------
414714bc0770Smrg# Minimum version: 1.16.0
414814bc0770Smrg#
414914bc0770Smrg# This macro attempts to find appropriate memory checking functionality
415014bc0770Smrg# for various platforms which unit testing code may use to catch various
415114bc0770Smrg# forms of memory allocation and access errors in testing.
415214bc0770Smrg#
415314bc0770Smrg# Interface to module:
415414bc0770Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
415514bc0770Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
415614bc0770Smrg#
415714bc0770Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
415814bc0770Smrg#
415914bc0770SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
4160e9554658Smrg
416114bc0770SmrgAC_REQUIRE([AC_CANONICAL_HOST])
416214bc0770SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
416314bc0770Smrg           [Environment variables to enable memory checking in tests])
4164e9554658Smrg
416514bc0770Smrg# Check for different types of support on different platforms
416614bc0770Smrgcase $host_os in
416714bc0770Smrg    solaris*)
416814bc0770Smrg        AC_CHECK_LIB([umem], [umem_alloc],
416914bc0770Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
417014bc0770Smrg        ;;
417114bc0770Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
417214bc0770Smrg        # both directly and inverted, so should not be 0 or 255.
417314bc0770Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
417414bc0770Smrg        ;;
417514bc0770Smrg    darwin*)
417614bc0770Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
417714bc0770Smrg        ;;
417814bc0770Smrg    *bsd*)
417914bc0770Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
418014bc0770Smrg        ;;
418114bc0770Smrgesac
4182688b3aecSmrg
418314bc0770Smrg# User supplied flags override default flags
418414bc0770Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
418514bc0770Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
4186e9554658Smrgfi
4187e9554658Smrg
418814bc0770SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
418914bc0770Smrg]) # XORG_WITH_LINT
41908903d43aSmrg
419114bc0770Smrg# XORG_CHECK_MALLOC_ZERO
419214bc0770Smrg# ----------------------
419314bc0770Smrg# Minimum version: 1.0.0
4194688b3aecSmrg#
419514bc0770Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
419614bc0770Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
419714bc0770Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
419814bc0770SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
419914bc0770SmrgAC_ARG_ENABLE(malloc0returnsnull,
420014bc0770Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
420114bc0770Smrg		       [malloc(0) returns NULL (default: auto)]),
420214bc0770Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
420314bc0770Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
42048903d43aSmrg
420514bc0770SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
420614bc0770Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
420714bc0770SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
420814bc0770Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
420914bc0770Smrg#include <stdlib.h>
421014bc0770Smrg],[
421114bc0770Smrg    char *m0, *r0, *c0, *p;
421214bc0770Smrg    m0 = malloc(0);
421314bc0770Smrg    p = malloc(10);
421414bc0770Smrg    r0 = realloc(p,0);
421514bc0770Smrg    c0 = calloc(0,10);
421614bc0770Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
421714bc0770Smrg])],
421814bc0770Smrg		[xorg_cv_malloc0_returns_null=yes],
421914bc0770Smrg		[xorg_cv_malloc0_returns_null=no])])
422014bc0770SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
4221e9554658Smrgfi
422214bc0770SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
4223e9554658Smrg
422414bc0770Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
422514bc0770Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
422614bc0770Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
422714bc0770Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
4228688b3aecSmrgelse
422914bc0770Smrg	MALLOC_ZERO_CFLAGS=""
423014bc0770Smrg	XMALLOC_ZERO_CFLAGS=""
423114bc0770Smrg	XTMALLOC_ZERO_CFLAGS=""
4232688b3aecSmrgfi
4233e9554658Smrg
423414bc0770SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
423514bc0770SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
423614bc0770SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
423714bc0770Smrg]) # XORG_CHECK_MALLOC_ZERO
4238e9554658Smrg
423914bc0770Smrg# XORG_WITH_LINT()
424014bc0770Smrg# ----------------
424114bc0770Smrg# Minimum version: 1.1.0
42428903d43aSmrg#
424314bc0770Smrg# This macro enables the use of a tool that flags some suspicious and
424414bc0770Smrg# non-portable constructs (likely to be bugs) in C language source code.
424514bc0770Smrg# It will attempt to locate the tool and use appropriate options.
424614bc0770Smrg# There are various lint type tools on different platforms.
4247309c398aSmrg#
424814bc0770Smrg# Interface to module:
424914bc0770Smrg# LINT:		returns the path to the tool found on the platform
425014bc0770Smrg#		or the value set to LINT on the configure cmd line
425114bc0770Smrg#		also an Automake conditional
425214bc0770Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
425314bc0770Smrg#
425414bc0770Smrg# --with-lint:	'yes' user instructs the module to use lint
425514bc0770Smrg#		'no' user instructs the module not to use lint (default)
425614bc0770Smrg#
425714bc0770Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
425814bc0770Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
425914bc0770Smrg#
426014bc0770SmrgAC_DEFUN([XORG_WITH_LINT],[
42615dd5f640Smrg
426214bc0770SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
426314bc0770SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
426414bc0770SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
426514bc0770Smrg		[Use a lint-style source code checker (default: disabled)])],
426614bc0770Smrg		[use_lint=$withval], [use_lint=no])
4267309c398aSmrg
426814bc0770Smrg# Obtain platform specific info like program name and options
426914bc0770Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
427014bc0770Smrgcase $host_os in
427114bc0770Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
427214bc0770Smrg	lint_name=splint
427314bc0770Smrg	lint_options="-badflag"
427414bc0770Smrg	;;
427514bc0770Smrg  *freebsd* | *netbsd*)
427614bc0770Smrg	lint_name=lint
427714bc0770Smrg	lint_options="-u -b"
427814bc0770Smrg	;;
427914bc0770Smrg  *solaris*)
428014bc0770Smrg	lint_name=lint
428114bc0770Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
428214bc0770Smrg	;;
428314bc0770Smrgesac
428414bc0770Smrg
428514bc0770Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
428614bc0770Smrgif test "x$use_lint" = x"yes" ; then
428714bc0770Smrg   AC_PATH_PROG([LINT], [$lint_name])
428814bc0770Smrg   if test "x$LINT" = "x"; then
428914bc0770Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
429014bc0770Smrg   fi
429114bc0770Smrgelif test "x$use_lint" = x"no" ; then
429214bc0770Smrg   if test "x$LINT" != "x"; then
429314bc0770Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
429414bc0770Smrg   fi
4295688b3aecSmrgelse
429614bc0770Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
4297309c398aSmrgfi
4298309c398aSmrg
429914bc0770Smrg# User supplied flags override default flags
430014bc0770Smrgif test "x$LINT_FLAGS" != "x"; then
430114bc0770Smrg   lint_options=$LINT_FLAGS
430214bc0770Smrgfi
4303309c398aSmrg
430414bc0770SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
430514bc0770SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
4306309c398aSmrg
430714bc0770Smrg]) # XORG_WITH_LINT
4308309c398aSmrg
430914bc0770Smrg# XORG_LINT_LIBRARY(LIBNAME)
431014bc0770Smrg# --------------------------
431114bc0770Smrg# Minimum version: 1.1.0
4312309c398aSmrg#
431314bc0770Smrg# Sets up flags for building lint libraries for checking programs that call
431414bc0770Smrg# functions in the library.
431514bc0770Smrg#
431614bc0770Smrg# Interface to module:
431714bc0770Smrg# LINTLIB		- Automake variable with the name of lint library file to make
431814bc0770Smrg# MAKE_LINT_LIB		- Automake conditional
431914bc0770Smrg#
432014bc0770Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
432114bc0770Smrg#			  - 'no' user instructs the module not to create a lint library (default)
4322309c398aSmrg
432314bc0770SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
432414bc0770SmrgAC_REQUIRE([XORG_WITH_LINT])
432514bc0770SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
432614bc0770Smrg	[Create lint library (default: disabled)])],
432714bc0770Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
432814bc0770Smrg
432914bc0770Smrgif test "x$make_lint_lib" = x"yes" ; then
433014bc0770Smrg   LINTLIB=llib-l$1.ln
433114bc0770Smrg   if test "x$LINT" = "x"; then
433214bc0770Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
433314bc0770Smrg   fi
433414bc0770Smrgelif test "x$make_lint_lib" != x"no" ; then
433514bc0770Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
4336309c398aSmrgfi
4337309c398aSmrg
433814bc0770SmrgAC_SUBST(LINTLIB)
433914bc0770SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
4340688b3aecSmrg
434114bc0770Smrg]) # XORG_LINT_LIBRARY
43425dd5f640Smrg
434314bc0770Smrg# XORG_COMPILER_BRAND
4344688b3aecSmrg# -------------------
434514bc0770Smrg# Minimum version: 1.14.0
4346688b3aecSmrg#
434714bc0770Smrg# Checks for various brands of compilers and sets flags as appropriate:
434814bc0770Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
434914bc0770Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
435014bc0770Smrg#   clang compiler - sets CLANGCC to "yes"
435114bc0770Smrg#   Intel compiler - sets INTELCC to "yes"
435214bc0770Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
435314bc0770Smrg#
435414bc0770SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
435514bc0770SmrgAC_LANG_CASE(
435614bc0770Smrg	[C], [
435714bc0770Smrg		AC_REQUIRE([AC_PROG_CC_C99])
435814bc0770Smrg	],
435914bc0770Smrg	[C++], [
436014bc0770Smrg		AC_REQUIRE([AC_PROG_CXX])
436114bc0770Smrg	]
436214bc0770Smrg)
436314bc0770SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
436414bc0770SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
436514bc0770SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
436614bc0770Smrg]) # XORG_COMPILER_BRAND
4367309c398aSmrg
436814bc0770Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
4369688b3aecSmrg# ---------------
437014bc0770Smrg# Minimum version: 1.16.0
437114bc0770Smrg#
437214bc0770Smrg# Test if the compiler works when passed the given flag as a command line argument.
437314bc0770Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
437414bc0770Smrg# next flag in the list until there are no more options.
437514bc0770Smrg#
437614bc0770Smrg# Note that this does not guarantee that the compiler supports the flag as some
437714bc0770Smrg# compilers will simply ignore arguments that they do not understand, but we do
437814bc0770Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
437914bc0770Smrg# -Werror=unused-command-line-argument
438014bc0770Smrg#
438114bc0770SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
438214bc0770Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
438314bc0770Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
4384309c398aSmrg
438514bc0770SmrgAC_LANG_COMPILER_REQUIRE
4386688b3aecSmrg
438714bc0770SmrgAC_LANG_CASE(
438814bc0770Smrg	[C], [
438914bc0770Smrg		AC_REQUIRE([AC_PROG_CC_C99])
439014bc0770Smrg		define([PREFIX], [C])
439114bc0770Smrg		define([CACHE_PREFIX], [cc])
439214bc0770Smrg		define([COMPILER], [$CC])
439314bc0770Smrg	],
439414bc0770Smrg	[C++], [
439514bc0770Smrg		define([PREFIX], [CXX])
439614bc0770Smrg		define([CACHE_PREFIX], [cxx])
439714bc0770Smrg		define([COMPILER], [$CXX])
439814bc0770Smrg	]
439914bc0770Smrg)
440014bc0770Smrg
440114bc0770Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
440214bc0770Smrg
440314bc0770Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
440414bc0770Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
440514bc0770Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
440614bc0770Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
440714bc0770Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
440814bc0770Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
440914bc0770Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
441014bc0770Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
441114bc0770Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
4412688b3aecSmrgfi
441314bc0770Smrg
441414bc0770Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
441514bc0770Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
441614bc0770Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
441714bc0770Smrg	fi
441814bc0770Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
441914bc0770Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
442014bc0770Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
442114bc0770Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
442214bc0770Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
442314bc0770Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
442414bc0770Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
442514bc0770Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
442614bc0770Smrgfi
442714bc0770Smrg
442814bc0770Smrgfound="no"
442914bc0770Smrgm4_foreach([flag], m4_cdr($@), [
443014bc0770Smrg	if test $found = "no" ; then
443114bc0770Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
443214bc0770Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
443314bc0770Smrg		fi
443414bc0770Smrg
443514bc0770Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
443614bc0770Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
443714bc0770Smrg		fi
443814bc0770Smrg
443914bc0770Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
444014bc0770Smrg
444114bc0770Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
444214bc0770Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
444314bc0770Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
444414bc0770Smrg		AC_CACHE_VAL($cacheid,
444514bc0770Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
444614bc0770Smrg					     [eval $cacheid=yes],
444714bc0770Smrg					     [eval $cacheid=no])])
444814bc0770Smrg
444914bc0770Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
445014bc0770Smrg
445114bc0770Smrg		eval supported=\$$cacheid
445214bc0770Smrg		AC_MSG_RESULT([$supported])
445314bc0770Smrg		if test "$supported" = "yes" ; then
445414bc0770Smrg			$1="$$1 ]flag["
445514bc0770Smrg			found="yes"
445614bc0770Smrg		fi
445714bc0770Smrg	fi
4458688b3aecSmrg])
445914bc0770Smrg]) # XORG_TESTSET_CFLAG
44605dd5f640Smrg
446114bc0770Smrg# XORG_COMPILER_FLAGS
446214bc0770Smrg# ---------------
446314bc0770Smrg# Minimum version: 1.16.0
4464c2b339b4Smrg#
446514bc0770Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
446614bc0770Smrg# arguments supported by the selected compiler which do NOT alter the generated
446714bc0770Smrg# code.  These arguments will cause the compiler to print various warnings
446814bc0770Smrg# during compilation AND turn a conservative set of warnings into errors.
446914bc0770Smrg#
447014bc0770Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
447114bc0770Smrg# future versions of util-macros as options are added to new compilers.
447214bc0770Smrg#
447314bc0770SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
447414bc0770SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
4475c2b339b4Smrg
447614bc0770SmrgAC_ARG_ENABLE(selective-werror,
447714bc0770Smrg              AS_HELP_STRING([--disable-selective-werror],
447814bc0770Smrg                             [Turn off selective compiler errors. (default: enabled)]),
447914bc0770Smrg              [SELECTIVE_WERROR=$enableval],
448014bc0770Smrg              [SELECTIVE_WERROR=yes])
448114bc0770Smrg
448214bc0770SmrgAC_LANG_CASE(
448314bc0770Smrg        [C], [
448414bc0770Smrg                define([PREFIX], [C])
448514bc0770Smrg        ],
448614bc0770Smrg        [C++], [
448714bc0770Smrg                define([PREFIX], [CXX])
448814bc0770Smrg        ]
448914bc0770Smrg)
449014bc0770Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
449114bc0770Smrgif test "x$SUNCC" = "xyes"; then
449214bc0770Smrg    [BASE_]PREFIX[FLAGS]="-v"
4493688b3aecSmrgelse
449414bc0770Smrg    [BASE_]PREFIX[FLAGS]=""
4495688b3aecSmrgfi
4496688b3aecSmrg
449714bc0770Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
449814bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
449914bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
450014bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
450114bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
4502688b3aecSmrg
450314bc0770SmrgAC_LANG_CASE(
450414bc0770Smrg	[C], [
450514bc0770Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
450614bc0770Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
450714bc0770Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
450814bc0770Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
450914bc0770Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
451014bc0770Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
451114bc0770Smrg	]
451214bc0770Smrg)
4513c2b339b4Smrg
451414bc0770Smrg# This chunk adds additional warnings that could catch undesired effects.
451514bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
451614bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
451714bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
451814bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
451914bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
452014bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
452114bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
4522309c398aSmrg
452314bc0770Smrg# These are currently disabled because they are noisy.  They will be enabled
452414bc0770Smrg# in the future once the codebase is sufficiently modernized to silence
452514bc0770Smrg# them.  For now, I don't want them to drown out the other warnings.
452614bc0770Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
452714bc0770Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
452814bc0770Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
45295dd5f640Smrg
453014bc0770Smrg# Turn some warnings into errors, so we don't accidently get successful builds
453114bc0770Smrg# when there are problems that should be fixed.
4532309c398aSmrg
453314bc0770Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
453414bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
453514bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
453614bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
453714bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
453814bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
453914bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
454014bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
454114bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
454214bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
454314bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
454414bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
454514bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
454614bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
454714bc0770Smrgelse
454814bc0770SmrgAC_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])
454914bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
455014bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
455114bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
455214bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
455314bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
455414bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
455514bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
455614bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
455714bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
455814bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
455914bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
456014bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
456114bc0770SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
456214bc0770Smrgfi
4563309c398aSmrg
456414bc0770SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
456514bc0770Smrg]) # XORG_COMPILER_FLAGS
4566c2b339b4Smrg
456714bc0770Smrg# XORG_CWARNFLAGS
456814bc0770Smrg# ---------------
456914bc0770Smrg# Minimum version: 1.2.0
457014bc0770Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
4571c2b339b4Smrg#
457214bc0770Smrg# Defines CWARNFLAGS to enable C compiler warnings.
45738903d43aSmrg#
457414bc0770Smrg# This function is deprecated because it defines -fno-strict-aliasing
457514bc0770Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
457614bc0770Smrg# is needed, then it should be added explicitly in the module when
457714bc0770Smrg# it is updated to use BASE_CFLAGS.
45788903d43aSmrg#
457914bc0770SmrgAC_DEFUN([XORG_CWARNFLAGS], [
458014bc0770SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
458114bc0770SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
458214bc0770SmrgAC_LANG_CASE(
458314bc0770Smrg	[C], [
458414bc0770Smrg		CWARNFLAGS="$BASE_CFLAGS"
458514bc0770Smrg		if  test "x$GCC" = xyes ; then
458614bc0770Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
458714bc0770Smrg		fi
458814bc0770Smrg		AC_SUBST(CWARNFLAGS)
458914bc0770Smrg	]
459014bc0770Smrg)
459114bc0770Smrg]) # XORG_CWARNFLAGS
45925dd5f640Smrg
459314bc0770Smrg# XORG_STRICT_OPTION
459414bc0770Smrg# -----------------------
459514bc0770Smrg# Minimum version: 1.3.0
459614bc0770Smrg#
459714bc0770Smrg# Add configure option to enable strict compilation flags, such as treating
459814bc0770Smrg# warnings as fatal errors.
459914bc0770Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
460014bc0770Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
460114bc0770Smrg#
460214bc0770Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
460314bc0770Smrg# when strict compilation is unconditionally desired.
460414bc0770SmrgAC_DEFUN([XORG_STRICT_OPTION], [
460514bc0770SmrgAC_REQUIRE([XORG_CWARNFLAGS])
460614bc0770SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
4607e9554658Smrg
460814bc0770SmrgAC_ARG_ENABLE(strict-compilation,
460914bc0770Smrg			  AS_HELP_STRING([--enable-strict-compilation],
461014bc0770Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
461114bc0770Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
4612688b3aecSmrg
461314bc0770SmrgAC_LANG_CASE(
461414bc0770Smrg        [C], [
461514bc0770Smrg                define([PREFIX], [C])
461614bc0770Smrg        ],
461714bc0770Smrg        [C++], [
461814bc0770Smrg                define([PREFIX], [CXX])
461914bc0770Smrg        ]
462014bc0770Smrg)
4621688b3aecSmrg
462214bc0770Smrg[STRICT_]PREFIX[FLAGS]=""
462314bc0770SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
462414bc0770SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
4625688b3aecSmrg
462614bc0770Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
462714bc0770Smrg# activate it with -Werror, so we add it here explicitly.
462814bc0770SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
4629688b3aecSmrg
463014bc0770Smrgif test "x$STRICT_COMPILE" = "xyes"; then
463114bc0770Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
463214bc0770Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
463314bc0770Smrgfi
463414bc0770SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
463514bc0770SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
463614bc0770SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
463714bc0770Smrg]) # XORG_STRICT_OPTION
4638688b3aecSmrg
463914bc0770Smrg# XORG_DEFAULT_OPTIONS
464014bc0770Smrg# --------------------
464114bc0770Smrg# Minimum version: 1.3.0
464214bc0770Smrg#
464314bc0770Smrg# Defines default options for X.Org modules.
464414bc0770Smrg#
464514bc0770SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
464614bc0770SmrgAC_REQUIRE([AC_PROG_INSTALL])
464714bc0770SmrgXORG_COMPILER_FLAGS
464814bc0770SmrgXORG_CWARNFLAGS
464914bc0770SmrgXORG_STRICT_OPTION
465014bc0770SmrgXORG_RELEASE_VERSION
465114bc0770SmrgXORG_CHANGELOG
465214bc0770SmrgXORG_INSTALL
465314bc0770SmrgXORG_MANPAGE_SECTIONS
465414bc0770Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
465514bc0770Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
465614bc0770Smrg]) # XORG_DEFAULT_OPTIONS
4657688b3aecSmrg
465814bc0770Smrg# XORG_INSTALL()
465914bc0770Smrg# ----------------
466014bc0770Smrg# Minimum version: 1.4.0
466114bc0770Smrg#
466214bc0770Smrg# Defines the variable INSTALL_CMD as the command to copy
466314bc0770Smrg# INSTALL from $prefix/share/util-macros.
466414bc0770Smrg#
466514bc0770SmrgAC_DEFUN([XORG_INSTALL], [
466614bc0770SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
466714bc0770Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
466814bc0770SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
466914bc0770Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
467014bc0770Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
467114bc0770Smrgtouch \$(top_srcdir)/INSTALL; \
467214bc0770Smrgecho 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
467314bc0770SmrgAC_SUBST([INSTALL_CMD])
467414bc0770Smrg]) # XORG_INSTALL
467514bc0770Smrgdnl Copyright 2005 Red Hat, Inc
467614bc0770Smrgdnl
467714bc0770Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
467814bc0770Smrgdnl documentation for any purpose is hereby granted without fee, provided that
467914bc0770Smrgdnl the above copyright notice appear in all copies and that both that
468014bc0770Smrgdnl copyright notice and this permission notice appear in supporting
468114bc0770Smrgdnl documentation.
468214bc0770Smrgdnl
468314bc0770Smrgdnl The above copyright notice and this permission notice shall be included
468414bc0770Smrgdnl in all copies or substantial portions of the Software.
468514bc0770Smrgdnl
468614bc0770Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
468714bc0770Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
468814bc0770Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
468914bc0770Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
469014bc0770Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
469114bc0770Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
469214bc0770Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
469314bc0770Smrgdnl
469414bc0770Smrgdnl Except as contained in this notice, the name of the copyright holders shall
469514bc0770Smrgdnl not be used in advertising or otherwise to promote the sale, use or
469614bc0770Smrgdnl other dealings in this Software without prior written authorization
469714bc0770Smrgdnl from the copyright holders.
469814bc0770Smrgdnl
4699688b3aecSmrg
470014bc0770Smrg# XORG_RELEASE_VERSION
470114bc0770Smrg# --------------------
470214bc0770Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
4703688b3aecSmrg
470414bc0770SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
470514bc0770Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
470614bc0770Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
470714bc0770Smrg		[Major version of this package])
470814bc0770Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
470914bc0770Smrg	if test "x$PVM" = "x"; then
471014bc0770Smrg		PVM="0"
471114bc0770Smrg	fi
471214bc0770Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
471314bc0770Smrg		[$PVM],
471414bc0770Smrg		[Minor version of this package])
471514bc0770Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
471614bc0770Smrg	if test "x$PVP" = "x"; then
471714bc0770Smrg		PVP="0"
471814bc0770Smrg	fi
471914bc0770Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
472014bc0770Smrg		[$PVP],
472114bc0770Smrg		[Patch version of this package])
472214bc0770Smrg])
4723688b3aecSmrg
472414bc0770Smrg# XORG_CHANGELOG()
472514bc0770Smrg# ----------------
472614bc0770Smrg# Minimum version: 1.2.0
472714bc0770Smrg#
472814bc0770Smrg# Defines the variable CHANGELOG_CMD as the command to generate
472914bc0770Smrg# ChangeLog from git.
473014bc0770Smrg#
473114bc0770Smrg#
473214bc0770SmrgAC_DEFUN([XORG_CHANGELOG], [
473314bc0770SmrgCHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
473414bc0770Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
473514bc0770Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
473614bc0770Smrgtouch \$(top_srcdir)/ChangeLog; \
473714bc0770Smrgecho 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
473814bc0770SmrgAC_SUBST([CHANGELOG_CMD])
473914bc0770Smrg]) # XORG_CHANGELOG
4740c2b339b4Smrg
4741