aclocal.m4 revision f66e55a2
1f66e55a2Smrg# generated automatically by aclocal 1.13.2 -*- Autoconf -*-
2f66e55a2Smrg
3f66e55a2Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
429459361Smrg
529459361Smrg# This file is free software; the Free Software Foundation
629459361Smrg# gives unlimited permission to copy and/or distribute it,
729459361Smrg# with or without modifications, as long as this notice is preserved.
829459361Smrg
929459361Smrg# This program is distributed in the hope that it will be useful,
1029459361Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1129459361Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1229459361Smrg# PARTICULAR PURPOSE.
1329459361Smrg
14f66e55a2Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
155715adc0Smrgm4_ifndef([AC_AUTOCONF_VERSION],
165715adc0Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17c3c9b392Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
18c3c9b392Smrg[m4_warning([this file was generated for autoconf 2.68.
195715adc0SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
205715adc0SmrgIf you have problems, you may need to regenerate the build system entirely.
21f66e55a2SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
225715adc0Smrg
23f66e55a2Smrg# Copyright (C) 2002-2013 Free Software Foundation, Inc.
2429459361Smrg#
2529459361Smrg# This file is free software; the Free Software Foundation
2629459361Smrg# gives unlimited permission to copy and/or distribute it,
2729459361Smrg# with or without modifications, as long as this notice is preserved.
2829459361Smrg
2929459361Smrg# AM_AUTOMAKE_VERSION(VERSION)
3029459361Smrg# ----------------------------
3129459361Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3229459361Smrg# generated from the m4 files accompanying Automake X.Y.
335715adc0Smrg# (This private macro should not be called outside this file.)
345715adc0SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
35f66e55a2Smrg[am__api_version='1.13'
365715adc0Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
375715adc0Smrgdnl require some minimum version.  Point them to the right macro.
38f66e55a2Smrgm4_if([$1], [1.13.2], [],
395715adc0Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
405715adc0Smrg])
415715adc0Smrg
425715adc0Smrg# _AM_AUTOCONF_VERSION(VERSION)
435715adc0Smrg# -----------------------------
445715adc0Smrg# aclocal traces this macro to find the Autoconf version.
455715adc0Smrg# This is a private macro too.  Using m4_define simplifies
465715adc0Smrg# the logic in aclocal, which can simply ignore this definition.
475715adc0Smrgm4_define([_AM_AUTOCONF_VERSION], [])
4829459361Smrg
4929459361Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5029459361Smrg# -------------------------------
515715adc0Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
525715adc0Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5329459361SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54f66e55a2Smrg[AM_AUTOMAKE_VERSION([1.13.2])dnl
555715adc0Smrgm4_ifndef([AC_AUTOCONF_VERSION],
565715adc0Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
575715adc0Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5829459361Smrg
5929459361Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6029459361Smrg
61f66e55a2Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
6229459361Smrg#
6329459361Smrg# This file is free software; the Free Software Foundation
6429459361Smrg# gives unlimited permission to copy and/or distribute it,
6529459361Smrg# with or without modifications, as long as this notice is preserved.
6629459361Smrg
6729459361Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68f66e55a2Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69f66e55a2Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7029459361Smrg#
7129459361Smrg# Of course, Automake must honor this variable whenever it calls a
7229459361Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7329459361Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7429459361Smrg# depending on how configure is run.  This is pretty annoying, since
7529459361Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7629459361Smrg# source directory, any form will work fine, but in subdirectories a
7729459361Smrg# relative path needs to be adjusted first.
7829459361Smrg#
7929459361Smrg# $ac_aux_dir/missing
8029459361Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8129459361Smrg# $top_srcdir/$ac_aux_dir/missing
8229459361Smrg#    fails if $ac_aux_dir is absolute,
8329459361Smrg#    fails when called from a subdirectory in a VPATH build with
8429459361Smrg#          a relative $ac_aux_dir
8529459361Smrg#
8629459361Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8729459361Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
88f66e55a2Smrg# harmless because $srcdir is '.', but things will broke when you
8929459361Smrg# start a VPATH build or use an absolute $srcdir.
9029459361Smrg#
9129459361Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9229459361Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9329459361Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9429459361Smrg# and then we would define $MISSING as
9529459361Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9629459361Smrg# This will work as long as MISSING is not called from configure, because
9729459361Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9829459361Smrg# However there are other variables, like CC, which are often used in
9929459361Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10029459361Smrg#
10129459361Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10229459361Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10329459361Smrg# configured tree to be moved without reconfiguration.
10429459361Smrg
10529459361SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10629459361Smrg[dnl Rely on autoconf to set up CDPATH properly.
10729459361SmrgAC_PREREQ([2.50])dnl
10829459361Smrg# expand $ac_aux_dir to an absolute path
10929459361Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
11029459361Smrg])
11129459361Smrg
11229459361Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11329459361Smrg
114f66e55a2Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
11529459361Smrg#
11629459361Smrg# This file is free software; the Free Software Foundation
11729459361Smrg# gives unlimited permission to copy and/or distribute it,
11829459361Smrg# with or without modifications, as long as this notice is preserved.
11929459361Smrg
12029459361Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12129459361Smrg# -------------------------------------
12229459361Smrg# Define a conditional.
12329459361SmrgAC_DEFUN([AM_CONDITIONAL],
124f66e55a2Smrg[AC_PREREQ([2.52])dnl
125f66e55a2Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
126f66e55a2Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1275715adc0SmrgAC_SUBST([$1_TRUE])dnl
1285715adc0SmrgAC_SUBST([$1_FALSE])dnl
1295715adc0Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1305715adc0Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1315715adc0Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13229459361Smrgif $2; then
13329459361Smrg  $1_TRUE=
13429459361Smrg  $1_FALSE='#'
13529459361Smrgelse
13629459361Smrg  $1_TRUE='#'
13729459361Smrg  $1_FALSE=
13829459361Smrgfi
13929459361SmrgAC_CONFIG_COMMANDS_PRE(
14029459361Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14129459361Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14229459361SmrgUsually this means the macro was only invoked conditionally.]])
14329459361Smrgfi])])
14429459361Smrg
145f66e55a2Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
14629459361Smrg#
14729459361Smrg# This file is free software; the Free Software Foundation
14829459361Smrg# gives unlimited permission to copy and/or distribute it,
14929459361Smrg# with or without modifications, as long as this notice is preserved.
15029459361Smrg
15129459361Smrg
152f66e55a2Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15329459361Smrg# written in clear, in which case automake, when reading aclocal.m4,
15429459361Smrg# will think it sees a *use*, and therefore will trigger all it's
15529459361Smrg# C support machinery.  Also note that it means that autoscan, seeing
15629459361Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
15729459361Smrg
15829459361Smrg
15929459361Smrg# _AM_DEPENDENCIES(NAME)
16029459361Smrg# ----------------------
16129459361Smrg# See how the compiler implements dependency checking.
162f66e55a2Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16329459361Smrg# We try a few techniques and use that to set a single cache variable.
16429459361Smrg#
16529459361Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16629459361Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16729459361Smrg# dependency, and given that the user is not expected to run this macro,
16829459361Smrg# just rely on AC_PROG_CC.
16929459361SmrgAC_DEFUN([_AM_DEPENDENCIES],
17029459361Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17129459361SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17229459361SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17329459361SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17429459361Smrg
175f66e55a2Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
176f66e55a2Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
177f66e55a2Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
178f66e55a2Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
179f66e55a2Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
180f66e55a2Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
181f66e55a2Smrg                    [depcc="$$1"   am_compiler_list=])
18229459361Smrg
18329459361SmrgAC_CACHE_CHECK([dependency style of $depcc],
18429459361Smrg               [am_cv_$1_dependencies_compiler_type],
18529459361Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18629459361Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
18729459361Smrg  # making bogus files that we don't know about and never remove.  For
18829459361Smrg  # instance it was reported that on HP-UX the gcc test will end up
189f66e55a2Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
190f66e55a2Smrg  # in D".
191f66e55a2Smrg  rm -rf conftest.dir
19229459361Smrg  mkdir conftest.dir
19329459361Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19429459361Smrg  # using a relative directory.
19529459361Smrg  cp "$am_depcomp" conftest.dir
19629459361Smrg  cd conftest.dir
19729459361Smrg  # We will build objects and dependencies in a subdirectory because
19829459361Smrg  # it helps to detect inapplicable dependency modes.  For instance
19929459361Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
20029459361Smrg  # side effect of compilation, but ICC will put the dependencies in
20129459361Smrg  # the current directory while Tru64 will put them in the object
20229459361Smrg  # directory.
20329459361Smrg  mkdir sub
20429459361Smrg
20529459361Smrg  am_cv_$1_dependencies_compiler_type=none
20629459361Smrg  if test "$am_compiler_list" = ""; then
20729459361Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20829459361Smrg  fi
2095715adc0Smrg  am__universal=false
2105715adc0Smrg  m4_case([$1], [CC],
2115715adc0Smrg    [case " $depcc " in #(
2125715adc0Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2135715adc0Smrg     esac],
2145715adc0Smrg    [CXX],
2155715adc0Smrg    [case " $depcc " in #(
2165715adc0Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2175715adc0Smrg     esac])
2185715adc0Smrg
21929459361Smrg  for depmode in $am_compiler_list; do
22029459361Smrg    # Setup a source with many dependencies, because some compilers
22129459361Smrg    # like to wrap large dependency lists on column 80 (with \), and
22229459361Smrg    # we should not choose a depcomp mode which is confused by this.
22329459361Smrg    #
22429459361Smrg    # We need to recreate these files for each test, as the compiler may
22529459361Smrg    # overwrite some of them when testing with obscure command lines.
22629459361Smrg    # This happens at least with the AIX C compiler.
22729459361Smrg    : > sub/conftest.c
22829459361Smrg    for i in 1 2 3 4 5 6; do
22929459361Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
230f66e55a2Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
231f66e55a2Smrg      # Solaris 10 /bin/sh.
232f66e55a2Smrg      echo '/* dummy */' > sub/conftst$i.h
23329459361Smrg    done
23429459361Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23529459361Smrg
236f66e55a2Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2375715adc0Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
238f66e55a2Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
239f66e55a2Smrg    # versions had trouble with output in subdirs.
2405715adc0Smrg    am__obj=sub/conftest.${OBJEXT-o}
2415715adc0Smrg    am__minus_obj="-o $am__obj"
24229459361Smrg    case $depmode in
2435715adc0Smrg    gcc)
2445715adc0Smrg      # This depmode causes a compiler race in universal mode.
2455715adc0Smrg      test "$am__universal" = false || continue
2465715adc0Smrg      ;;
24729459361Smrg    nosideeffect)
248f66e55a2Smrg      # After this tag, mechanisms are not by side-effect, so they'll
249f66e55a2Smrg      # only be used when explicitly requested.
25029459361Smrg      if test "x$enable_dependency_tracking" = xyes; then
25129459361Smrg	continue
25229459361Smrg      else
25329459361Smrg	break
25429459361Smrg      fi
25529459361Smrg      ;;
256f66e55a2Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
257f66e55a2Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2585715adc0Smrg      # not run yet.  These depmodes are late enough in the game, and
2595715adc0Smrg      # so weak that their functioning should not be impacted.
2605715adc0Smrg      am__obj=conftest.${OBJEXT-o}
2615715adc0Smrg      am__minus_obj=
2625715adc0Smrg      ;;
26329459361Smrg    none) break ;;
26429459361Smrg    esac
26529459361Smrg    if depmode=$depmode \
2665715adc0Smrg       source=sub/conftest.c object=$am__obj \
26729459361Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2685715adc0Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26929459361Smrg         >/dev/null 2>conftest.err &&
2705715adc0Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27129459361Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2725715adc0Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27329459361Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27429459361Smrg      # icc doesn't choke on unknown options, it will just issue warnings
27529459361Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
27629459361Smrg      # that says an option was ignored or not supported.
27729459361Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27829459361Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27929459361Smrg      # The diagnosis changed in icc 8.0:
28029459361Smrg      #   icc: Command line remark: option '-MP' not supported
28129459361Smrg      if (grep 'ignoring option' conftest.err ||
28229459361Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28329459361Smrg        am_cv_$1_dependencies_compiler_type=$depmode
28429459361Smrg        break
28529459361Smrg      fi
28629459361Smrg    fi
28729459361Smrg  done
28829459361Smrg
28929459361Smrg  cd ..
29029459361Smrg  rm -rf conftest.dir
29129459361Smrgelse
29229459361Smrg  am_cv_$1_dependencies_compiler_type=none
29329459361Smrgfi
29429459361Smrg])
29529459361SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29629459361SmrgAM_CONDITIONAL([am__fastdep$1], [
29729459361Smrg  test "x$enable_dependency_tracking" != xno \
29829459361Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29929459361Smrg])
30029459361Smrg
30129459361Smrg
30229459361Smrg# AM_SET_DEPDIR
30329459361Smrg# -------------
30429459361Smrg# Choose a directory name for dependency files.
305f66e55a2Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30629459361SmrgAC_DEFUN([AM_SET_DEPDIR],
30729459361Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30829459361SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30929459361Smrg])
31029459361Smrg
31129459361Smrg
31229459361Smrg# AM_DEP_TRACK
31329459361Smrg# ------------
31429459361SmrgAC_DEFUN([AM_DEP_TRACK],
315f66e55a2Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
316f66e55a2SmrgAS_HELP_STRING(
317f66e55a2Smrg  [--enable-dependency-tracking],
318f66e55a2Smrg  [do not reject slow dependency extractors])
319f66e55a2SmrgAS_HELP_STRING(
320f66e55a2Smrg  [--disable-dependency-tracking],
321f66e55a2Smrg  [speeds up one-time build])])
32229459361Smrgif test "x$enable_dependency_tracking" != xno; then
32329459361Smrg  am_depcomp="$ac_aux_dir/depcomp"
32429459361Smrg  AMDEPBACKSLASH='\'
325f66e55a2Smrg  am__nodep='_no'
32629459361Smrgfi
32729459361SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3285715adc0SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3295715adc0Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
330f66e55a2SmrgAC_SUBST([am__nodep])dnl
331f66e55a2Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33229459361Smrg])
33329459361Smrg
33429459361Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33529459361Smrg
336f66e55a2Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
33729459361Smrg#
33829459361Smrg# This file is free software; the Free Software Foundation
33929459361Smrg# gives unlimited permission to copy and/or distribute it,
34029459361Smrg# with or without modifications, as long as this notice is preserved.
34129459361Smrg
34229459361Smrg
34329459361Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34429459361Smrg# ------------------------------
34529459361SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3465715adc0Smrg[{
347f66e55a2Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3485715adc0Smrg  # are listed without --file.  Let's play safe and only enable the eval
3495715adc0Smrg  # if we detect the quoting.
3505715adc0Smrg  case $CONFIG_FILES in
3515715adc0Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
3525715adc0Smrg  *)   set x $CONFIG_FILES ;;
3535715adc0Smrg  esac
3545715adc0Smrg  shift
3555715adc0Smrg  for mf
3565715adc0Smrg  do
3575715adc0Smrg    # Strip MF so we end up with the name of the file.
3585715adc0Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3595715adc0Smrg    # Check whether this is an Automake generated Makefile or not.
360f66e55a2Smrg    # We used to match only the files named 'Makefile.in', but
3615715adc0Smrg    # some people rename them; so instead we look at the file content.
3625715adc0Smrg    # Grep'ing the first line is not enough: some people post-process
3635715adc0Smrg    # each Makefile.in and add a new line on top of each file to say so.
3645715adc0Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
3655715adc0Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3665715adc0Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3675715adc0Smrg      dirpart=`AS_DIRNAME("$mf")`
3685715adc0Smrg    else
3695715adc0Smrg      continue
3705715adc0Smrg    fi
3715715adc0Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
372f66e55a2Smrg    # from the Makefile without running 'make'.
3735715adc0Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3745715adc0Smrg    test -z "$DEPDIR" && continue
3755715adc0Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
376f66e55a2Smrg    test -z "$am__include" && continue
3775715adc0Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3785715adc0Smrg    # Find all dependency output files, they are included files with
3795715adc0Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3805715adc0Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3815715adc0Smrg    # expansion.
3825715adc0Smrg    for file in `sed -n "
3835715adc0Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
384f66e55a2Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
3855715adc0Smrg      # Make sure the directory exists.
3865715adc0Smrg      test -f "$dirpart/$file" && continue
3875715adc0Smrg      fdir=`AS_DIRNAME(["$file"])`
3885715adc0Smrg      AS_MKDIR_P([$dirpart/$fdir])
3895715adc0Smrg      # echo "creating $dirpart/$file"
3905715adc0Smrg      echo '# dummy' > "$dirpart/$file"
3915715adc0Smrg    done
39229459361Smrg  done
3935715adc0Smrg}
39429459361Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
39529459361Smrg
39629459361Smrg
39729459361Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39829459361Smrg# -----------------------------
39929459361Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
40029459361Smrg#
40129459361Smrg# This code is only required when automatic dependency tracking
402f66e55a2Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
40329459361Smrg# need in order to bootstrap the dependency handling code.
40429459361SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
40529459361Smrg[AC_CONFIG_COMMANDS([depfiles],
40629459361Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
40729459361Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
40829459361Smrg])
40929459361Smrg
41029459361Smrg# Do all the work for Automake.                             -*- Autoconf -*-
41129459361Smrg
412f66e55a2Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
41329459361Smrg#
41429459361Smrg# This file is free software; the Free Software Foundation
41529459361Smrg# gives unlimited permission to copy and/or distribute it,
41629459361Smrg# with or without modifications, as long as this notice is preserved.
41729459361Smrg
41829459361Smrg# This macro actually does too much.  Some checks are only needed if
41929459361Smrg# your package does certain things.  But this isn't really a big deal.
42029459361Smrg
42129459361Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
42229459361Smrg# AM_INIT_AUTOMAKE([OPTIONS])
42329459361Smrg# -----------------------------------------------
42429459361Smrg# The call with PACKAGE and VERSION arguments is the old style
42529459361Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42629459361Smrg# and VERSION should now be passed to AC_INIT and removed from
42729459361Smrg# the call to AM_INIT_AUTOMAKE.
42829459361Smrg# We support both call styles for the transition.  After
42929459361Smrg# the next Automake release, Autoconf can make the AC_INIT
43029459361Smrg# arguments mandatory, and then we can depend on a new Autoconf
43129459361Smrg# release and drop the old call support.
43229459361SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
433f66e55a2Smrg[AC_PREREQ([2.65])dnl
43429459361Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43529459361Smrgdnl the ones we care about.
43629459361Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43729459361SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
43829459361SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4395715adc0Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4405715adc0Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4415715adc0Smrg  # is not polluted with repeated "-I."
4425715adc0Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4435715adc0Smrg  # test to see if srcdir already configured
4445715adc0Smrg  if test -f $srcdir/config.status; then
4455715adc0Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4465715adc0Smrg  fi
44729459361Smrgfi
44829459361Smrg
44929459361Smrg# test whether we have cygpath
45029459361Smrgif test -z "$CYGPATH_W"; then
45129459361Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45229459361Smrg    CYGPATH_W='cygpath -w'
45329459361Smrg  else
45429459361Smrg    CYGPATH_W=echo
45529459361Smrg  fi
45629459361Smrgfi
45729459361SmrgAC_SUBST([CYGPATH_W])
45829459361Smrg
45929459361Smrg# Define the identity of the package.
46029459361Smrgdnl Distinguish between old-style and new-style calls.
46129459361Smrgm4_ifval([$2],
462f66e55a2Smrg[AC_DIAGNOSE([obsolete],
463f66e55a2Smrg             [$0: two- and three-arguments forms are deprecated.])
464f66e55a2Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46529459361Smrg AC_SUBST([PACKAGE], [$1])dnl
46629459361Smrg AC_SUBST([VERSION], [$2])],
46729459361Smrg[_AM_SET_OPTIONS([$1])dnl
4685715adc0Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
469f66e55a2Smrgm4_if(
470f66e55a2Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
471f66e55a2Smrg  [ok:ok],,
4725715adc0Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47329459361Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47429459361Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
47529459361Smrg
47629459361Smrg_AM_IF_OPTION([no-define],,
477f66e55a2Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
478f66e55a2Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
47929459361Smrg
48029459361Smrg# Some tools Automake needs.
48129459361SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48229459361SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
483f66e55a2SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
484f66e55a2SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
485f66e55a2SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
486f66e55a2SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
487f66e55a2SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4885715adc0SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4895715adc0SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
490f66e55a2SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
491f66e55a2Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
492f66e55a2Smrg# dies out for good.  For more background, see:
493f66e55a2Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
494f66e55a2Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
495f66e55a2SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
49629459361Smrg# We need awk for the "check" target.  The system "awk" is bad on
49729459361Smrg# some platforms.
49829459361SmrgAC_REQUIRE([AC_PROG_AWK])dnl
49929459361SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50029459361SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50129459361Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5025715adc0Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5035715adc0Smrg			     [_AM_PROG_TAR([v7])])])
50429459361Smrg_AM_IF_OPTION([no-dependencies],,
50529459361Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
506f66e55a2Smrg		  [_AM_DEPENDENCIES([CC])],
507f66e55a2Smrg		  [m4_define([AC_PROG_CC],
508f66e55a2Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
50929459361SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
510f66e55a2Smrg		  [_AM_DEPENDENCIES([CXX])],
511f66e55a2Smrg		  [m4_define([AC_PROG_CXX],
512f66e55a2Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5135715adc0SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
514f66e55a2Smrg		  [_AM_DEPENDENCIES([OBJC])],
515f66e55a2Smrg		  [m4_define([AC_PROG_OBJC],
516f66e55a2Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
517f66e55a2SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
518f66e55a2Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
519f66e55a2Smrg		  [m4_define([AC_PROG_OBJCXX],
520f66e55a2Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52129459361Smrg])
522f66e55a2SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
523f66e55a2Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
524f66e55a2Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
525f66e55a2Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5265715adc0SmrgAC_CONFIG_COMMANDS_PRE(dnl
5275715adc0Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5285715adc0Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
52929459361Smrg])
53029459361Smrg
531f66e55a2Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5325715adc0Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5335715adc0Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5345715adc0Smrgm4_define([_AC_COMPILER_EXEEXT],
5355715adc0Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5365715adc0Smrg
53729459361Smrg
53829459361Smrg# When config.status generates a header, we must update the stamp-h file.
53929459361Smrg# This file resides in the same directory as the config header
54029459361Smrg# that is generated.  The stamp files are numbered to have different names.
54129459361Smrg
54229459361Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
54329459361Smrg# loop where config.status creates the headers, so we can generate
54429459361Smrg# our stamp files there.
54529459361SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
54629459361Smrg[# Compute $1's index in $config_headers.
5475715adc0Smrg_am_arg=$1
54829459361Smrg_am_stamp_count=1
54929459361Smrgfor _am_header in $config_headers :; do
55029459361Smrg  case $_am_header in
5515715adc0Smrg    $_am_arg | $_am_arg:* )
55229459361Smrg      break ;;
55329459361Smrg    * )
55429459361Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
55529459361Smrg  esac
55629459361Smrgdone
5575715adc0Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
55829459361Smrg
559f66e55a2Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
56029459361Smrg#
56129459361Smrg# This file is free software; the Free Software Foundation
56229459361Smrg# gives unlimited permission to copy and/or distribute it,
56329459361Smrg# with or without modifications, as long as this notice is preserved.
56429459361Smrg
56529459361Smrg# AM_PROG_INSTALL_SH
56629459361Smrg# ------------------
56729459361Smrg# Define $install_sh.
56829459361SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
56929459361Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5705715adc0Smrgif test x"${install_sh}" != xset; then
5715715adc0Smrg  case $am_aux_dir in
5725715adc0Smrg  *\ * | *\	*)
5735715adc0Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
5745715adc0Smrg  *)
5755715adc0Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
5765715adc0Smrg  esac
5775715adc0Smrgfi
578f66e55a2SmrgAC_SUBST([install_sh])])
57929459361Smrg
580f66e55a2Smrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
58129459361Smrg#
58229459361Smrg# This file is free software; the Free Software Foundation
58329459361Smrg# gives unlimited permission to copy and/or distribute it,
58429459361Smrg# with or without modifications, as long as this notice is preserved.
58529459361Smrg
58629459361Smrg# Check whether the underlying file-system supports filenames
58729459361Smrg# with a leading dot.  For instance MS-DOS doesn't.
58829459361SmrgAC_DEFUN([AM_SET_LEADING_DOT],
58929459361Smrg[rm -rf .tst 2>/dev/null
59029459361Smrgmkdir .tst 2>/dev/null
59129459361Smrgif test -d .tst; then
59229459361Smrg  am__leading_dot=.
59329459361Smrgelse
59429459361Smrg  am__leading_dot=_
59529459361Smrgfi
59629459361Smrgrmdir .tst 2>/dev/null
59729459361SmrgAC_SUBST([am__leading_dot])])
59829459361Smrg
59929459361Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
60029459361Smrg# From Jim Meyering
60129459361Smrg
602f66e55a2Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
60329459361Smrg#
60429459361Smrg# This file is free software; the Free Software Foundation
60529459361Smrg# gives unlimited permission to copy and/or distribute it,
60629459361Smrg# with or without modifications, as long as this notice is preserved.
60729459361Smrg
6085715adc0Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
6095715adc0Smrg# ----------------------------------
6105715adc0Smrg# Control maintainer-specific portions of Makefiles.
611f66e55a2Smrg# Default is to disable them, unless 'enable' is passed literally.
612f66e55a2Smrg# For symmetry, 'disable' may be passed as well.  Anyway, the user
6135715adc0Smrg# can override the default with the --enable/--disable switch.
61429459361SmrgAC_DEFUN([AM_MAINTAINER_MODE],
6155715adc0Smrg[m4_case(m4_default([$1], [disable]),
6165715adc0Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
6175715adc0Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
6185715adc0Smrg       [m4_define([am_maintainer_other], [enable])
6195715adc0Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
620f66e55a2SmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
6215715adc0Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
6225715adc0Smrg  AC_ARG_ENABLE([maintainer-mode],
623f66e55a2Smrg    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
624f66e55a2Smrg      am_maintainer_other[ make rules and dependencies not useful
625f66e55a2Smrg      (and sometimes confusing) to the casual installer])],
626f66e55a2Smrg    [USE_MAINTAINER_MODE=$enableval],
627f66e55a2Smrg    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
62829459361Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
6295715adc0Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
63029459361Smrg  MAINT=$MAINTAINER_MODE_TRUE
6315715adc0Smrg  AC_SUBST([MAINT])dnl
63229459361Smrg]
63329459361Smrg)
63429459361Smrg
63529459361Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
63629459361Smrg
637f66e55a2Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
63829459361Smrg#
63929459361Smrg# This file is free software; the Free Software Foundation
64029459361Smrg# gives unlimited permission to copy and/or distribute it,
64129459361Smrg# with or without modifications, as long as this notice is preserved.
64229459361Smrg
64329459361Smrg# AM_MAKE_INCLUDE()
64429459361Smrg# -----------------
64529459361Smrg# Check to see how make treats includes.
64629459361SmrgAC_DEFUN([AM_MAKE_INCLUDE],
64729459361Smrg[am_make=${MAKE-make}
64829459361Smrgcat > confinc << 'END'
64929459361Smrgam__doit:
6505715adc0Smrg	@echo this is the am__doit target
65129459361Smrg.PHONY: am__doit
65229459361SmrgEND
65329459361Smrg# If we don't find an include directive, just comment out the code.
65429459361SmrgAC_MSG_CHECKING([for style of include used by $am_make])
65529459361Smrgam__include="#"
65629459361Smrgam__quote=
65729459361Smrg_am_result=none
65829459361Smrg# First try GNU make style include.
65929459361Smrgecho "include confinc" > confmf
660f66e55a2Smrg# Ignore all kinds of additional output from 'make'.
6615715adc0Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
6625715adc0Smrg*the\ am__doit\ target*)
6635715adc0Smrg  am__include=include
6645715adc0Smrg  am__quote=
6655715adc0Smrg  _am_result=GNU
6665715adc0Smrg  ;;
6675715adc0Smrgesac
66829459361Smrg# Now try BSD make style include.
66929459361Smrgif test "$am__include" = "#"; then
67029459361Smrg   echo '.include "confinc"' > confmf
6715715adc0Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
6725715adc0Smrg   *the\ am__doit\ target*)
6735715adc0Smrg     am__include=.include
6745715adc0Smrg     am__quote="\""
6755715adc0Smrg     _am_result=BSD
6765715adc0Smrg     ;;
6775715adc0Smrg   esac
67829459361Smrgfi
67929459361SmrgAC_SUBST([am__include])
68029459361SmrgAC_SUBST([am__quote])
68129459361SmrgAC_MSG_RESULT([$_am_result])
68229459361Smrgrm -f confinc confmf
68329459361Smrg])
68429459361Smrg
68529459361Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
68629459361Smrg
687f66e55a2Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
68829459361Smrg#
68929459361Smrg# This file is free software; the Free Software Foundation
69029459361Smrg# gives unlimited permission to copy and/or distribute it,
69129459361Smrg# with or without modifications, as long as this notice is preserved.
69229459361Smrg
69329459361Smrg# AM_MISSING_PROG(NAME, PROGRAM)
69429459361Smrg# ------------------------------
69529459361SmrgAC_DEFUN([AM_MISSING_PROG],
69629459361Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
69729459361Smrg$1=${$1-"${am_missing_run}$2"}
69829459361SmrgAC_SUBST($1)])
69929459361Smrg
70029459361Smrg# AM_MISSING_HAS_RUN
70129459361Smrg# ------------------
702f66e55a2Smrg# Define MISSING if not defined so far and test if it is modern enough.
703f66e55a2Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
70429459361SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
70529459361Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7065715adc0SmrgAC_REQUIRE_AUX_FILE([missing])dnl
7075715adc0Smrgif test x"${MISSING+set}" != xset; then
7085715adc0Smrg  case $am_aux_dir in
7095715adc0Smrg  *\ * | *\	*)
7105715adc0Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7115715adc0Smrg  *)
7125715adc0Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7135715adc0Smrg  esac
7145715adc0Smrgfi
71529459361Smrg# Use eval to expand $SHELL
716f66e55a2Smrgif eval "$MISSING --is-lightweight"; then
717f66e55a2Smrg  am_missing_run="$MISSING "
71829459361Smrgelse
71929459361Smrg  am_missing_run=
720f66e55a2Smrg  AC_MSG_WARN(['missing' script is too old or missing])
72129459361Smrgfi
72229459361Smrg])
72329459361Smrg
72429459361Smrg# Helper functions for option handling.                     -*- Autoconf -*-
72529459361Smrg
726f66e55a2Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
72729459361Smrg#
72829459361Smrg# This file is free software; the Free Software Foundation
72929459361Smrg# gives unlimited permission to copy and/or distribute it,
73029459361Smrg# with or without modifications, as long as this notice is preserved.
73129459361Smrg
73229459361Smrg# _AM_MANGLE_OPTION(NAME)
73329459361Smrg# -----------------------
73429459361SmrgAC_DEFUN([_AM_MANGLE_OPTION],
73529459361Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
73629459361Smrg
73729459361Smrg# _AM_SET_OPTION(NAME)
738f66e55a2Smrg# --------------------
73929459361Smrg# Set option NAME.  Presently that only means defining a flag for this option.
74029459361SmrgAC_DEFUN([_AM_SET_OPTION],
741f66e55a2Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
74229459361Smrg
74329459361Smrg# _AM_SET_OPTIONS(OPTIONS)
744f66e55a2Smrg# ------------------------
74529459361Smrg# OPTIONS is a space-separated list of Automake options.
74629459361SmrgAC_DEFUN([_AM_SET_OPTIONS],
7475715adc0Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
74829459361Smrg
74929459361Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
75029459361Smrg# -------------------------------------------
75129459361Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
75229459361SmrgAC_DEFUN([_AM_IF_OPTION],
75329459361Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
75429459361Smrg
75529459361Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
75629459361Smrg
757f66e55a2Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
75829459361Smrg#
75929459361Smrg# This file is free software; the Free Software Foundation
76029459361Smrg# gives unlimited permission to copy and/or distribute it,
76129459361Smrg# with or without modifications, as long as this notice is preserved.
76229459361Smrg
76329459361Smrg# AM_SANITY_CHECK
76429459361Smrg# ---------------
76529459361SmrgAC_DEFUN([AM_SANITY_CHECK],
76629459361Smrg[AC_MSG_CHECKING([whether build environment is sane])
7675715adc0Smrg# Reject unsafe characters in $srcdir or the absolute working directory
7685715adc0Smrg# name.  Accept space and tab only in the latter.
7695715adc0Smrgam_lf='
7705715adc0Smrg'
7715715adc0Smrgcase `pwd` in
7725715adc0Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
7735715adc0Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
7745715adc0Smrgesac
7755715adc0Smrgcase $srcdir in
7765715adc0Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
777f66e55a2Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
7785715adc0Smrgesac
7795715adc0Smrg
780f66e55a2Smrg# Do 'set' in a subshell so we don't clobber the current shell's
78129459361Smrg# arguments.  Must try -L first in case configure is actually a
78229459361Smrg# symlink; some systems play weird games with the mod time of symlinks
78329459361Smrg# (eg FreeBSD returns the mod time of the symlink's containing
78429459361Smrg# directory).
78529459361Smrgif (
786f66e55a2Smrg   am_has_slept=no
787f66e55a2Smrg   for am_try in 1 2; do
788f66e55a2Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
789f66e55a2Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
790f66e55a2Smrg     if test "$[*]" = "X"; then
791f66e55a2Smrg	# -L didn't work.
792f66e55a2Smrg	set X `ls -t "$srcdir/configure" conftest.file`
793f66e55a2Smrg     fi
794f66e55a2Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
795f66e55a2Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
796f66e55a2Smrg
797f66e55a2Smrg	# If neither matched, then we have a broken ls.  This can happen
798f66e55a2Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
799f66e55a2Smrg	# broken ls alias from the environment.  This has actually
800f66e55a2Smrg	# happened.  Such a system could not be considered "sane".
801f66e55a2Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
802f66e55a2Smrg  alias in your environment])
803f66e55a2Smrg     fi
804f66e55a2Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
805f66e55a2Smrg       break
806f66e55a2Smrg     fi
807f66e55a2Smrg     # Just in case.
808f66e55a2Smrg     sleep 1
809f66e55a2Smrg     am_has_slept=yes
810f66e55a2Smrg   done
81129459361Smrg   test "$[2]" = conftest.file
81229459361Smrg   )
81329459361Smrgthen
81429459361Smrg   # Ok.
81529459361Smrg   :
81629459361Smrgelse
81729459361Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
81829459361SmrgCheck your system clock])
81929459361Smrgfi
820f66e55a2SmrgAC_MSG_RESULT([yes])
821f66e55a2Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
822f66e55a2Smrg# generated files are strictly newer.
823f66e55a2Smrgam_sleep_pid=
824f66e55a2Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
825f66e55a2Smrg  ( sleep 1 ) &
826f66e55a2Smrg  am_sleep_pid=$!
827f66e55a2Smrgfi
828f66e55a2SmrgAC_CONFIG_COMMANDS_PRE(
829f66e55a2Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
830f66e55a2Smrg   if test -n "$am_sleep_pid"; then
831f66e55a2Smrg     # Hide warnings about reused PIDs.
832f66e55a2Smrg     wait $am_sleep_pid 2>/dev/null
833f66e55a2Smrg   fi
834f66e55a2Smrg   AC_MSG_RESULT([done])])
835f66e55a2Smrgrm -f conftest.file
836f66e55a2Smrg])
83729459361Smrg
838f66e55a2Smrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
8395715adc0Smrg#
8405715adc0Smrg# This file is free software; the Free Software Foundation
8415715adc0Smrg# gives unlimited permission to copy and/or distribute it,
8425715adc0Smrg# with or without modifications, as long as this notice is preserved.
8435715adc0Smrg
8445715adc0Smrg# AM_SILENT_RULES([DEFAULT])
8455715adc0Smrg# --------------------------
8465715adc0Smrg# Enable less verbose build rules; with the default set to DEFAULT
847f66e55a2Smrg# ("yes" being less verbose, "no" or empty being verbose).
8485715adc0SmrgAC_DEFUN([AM_SILENT_RULES],
849f66e55a2Smrg[AC_ARG_ENABLE([silent-rules], [dnl
850f66e55a2SmrgAS_HELP_STRING(
851f66e55a2Smrg  [--enable-silent-rules],
852f66e55a2Smrg  [less verbose build output (undo: "make V=1")])
853f66e55a2SmrgAS_HELP_STRING(
854f66e55a2Smrg  [--disable-silent-rules],
855f66e55a2Smrg  [verbose build output (undo: "make V=0")])dnl
856f66e55a2Smrg])
857f66e55a2Smrgcase $enable_silent_rules in @%:@ (((
858f66e55a2Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
859f66e55a2Smrg   no) AM_DEFAULT_VERBOSITY=1;;
860f66e55a2Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
8615715adc0Smrgesac
862f66e55a2Smrgdnl
863f66e55a2Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
864f66e55a2Smrgdnl do not support nested variable expansions.
865f66e55a2Smrgdnl See automake bug#9928 and bug#10237.
866f66e55a2Smrgam_make=${MAKE-make}
867f66e55a2SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
868f66e55a2Smrg   [am_cv_make_support_nested_variables],
869f66e55a2Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
870f66e55a2SmrgBAR0=false
871f66e55a2SmrgBAR1=true
872f66e55a2SmrgV=1
873f66e55a2Smrgam__doit:
874f66e55a2Smrg	@$(TRUE)
875f66e55a2Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
876f66e55a2Smrg  am_cv_make_support_nested_variables=yes
877f66e55a2Smrgelse
878f66e55a2Smrg  am_cv_make_support_nested_variables=no
879f66e55a2Smrgfi])
880f66e55a2Smrgif test $am_cv_make_support_nested_variables = yes; then
881f66e55a2Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
882f66e55a2Smrg  AM_V='$(V)'
883f66e55a2Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
884f66e55a2Smrgelse
885f66e55a2Smrg  AM_V=$AM_DEFAULT_VERBOSITY
886f66e55a2Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
887f66e55a2Smrgfi
888f66e55a2SmrgAC_SUBST([AM_V])dnl
889f66e55a2SmrgAM_SUBST_NOTMAKE([AM_V])dnl
890f66e55a2SmrgAC_SUBST([AM_DEFAULT_V])dnl
891f66e55a2SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
8925715adc0SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
8935715adc0SmrgAM_BACKSLASH='\'
8945715adc0SmrgAC_SUBST([AM_BACKSLASH])dnl
8955715adc0Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
8965715adc0Smrg])
8975715adc0Smrg
898f66e55a2Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
89929459361Smrg#
90029459361Smrg# This file is free software; the Free Software Foundation
90129459361Smrg# gives unlimited permission to copy and/or distribute it,
90229459361Smrg# with or without modifications, as long as this notice is preserved.
90329459361Smrg
90429459361Smrg# AM_PROG_INSTALL_STRIP
90529459361Smrg# ---------------------
906f66e55a2Smrg# One issue with vendor 'install' (even GNU) is that you can't
90729459361Smrg# specify the program used to strip binaries.  This is especially
90829459361Smrg# annoying in cross-compiling environments, where the build's strip
90929459361Smrg# is unlikely to handle the host's binaries.
91029459361Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
911f66e55a2Smrg# always use install-sh in "make install-strip", and initialize
91229459361Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
91329459361SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
91429459361Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
915f66e55a2Smrg# Installed binaries are usually stripped using 'strip' when the user
916f66e55a2Smrg# run "make install-strip".  However 'strip' might not be the right
91729459361Smrg# tool to use in cross-compilation environments, therefore Automake
918f66e55a2Smrg# will honor the 'STRIP' environment variable to overrule this program.
919f66e55a2Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
92029459361Smrgif test "$cross_compiling" != no; then
92129459361Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
92229459361Smrgfi
9235715adc0SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
92429459361SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
92529459361Smrg
926f66e55a2Smrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
9275715adc0Smrg#
9285715adc0Smrg# This file is free software; the Free Software Foundation
9295715adc0Smrg# gives unlimited permission to copy and/or distribute it,
9305715adc0Smrg# with or without modifications, as long as this notice is preserved.
9315715adc0Smrg
9325715adc0Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
9335715adc0Smrg# ---------------------------
9345715adc0Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
9355715adc0Smrg# This macro is traced by Automake.
9365715adc0SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
9375715adc0Smrg
9385715adc0Smrg# AM_SUBST_NOTMAKE(VARIABLE)
939f66e55a2Smrg# --------------------------
9405715adc0Smrg# Public sister of _AM_SUBST_NOTMAKE.
9415715adc0SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
9425715adc0Smrg
94329459361Smrg# Check how to create a tarball.                            -*- Autoconf -*-
94429459361Smrg
945f66e55a2Smrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
94629459361Smrg#
94729459361Smrg# This file is free software; the Free Software Foundation
94829459361Smrg# gives unlimited permission to copy and/or distribute it,
94929459361Smrg# with or without modifications, as long as this notice is preserved.
95029459361Smrg
95129459361Smrg# _AM_PROG_TAR(FORMAT)
95229459361Smrg# --------------------
95329459361Smrg# Check how to create a tarball in format FORMAT.
954f66e55a2Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
95529459361Smrg#
95629459361Smrg# Substitute a variable $(am__tar) that is a command
95729459361Smrg# writing to stdout a FORMAT-tarball containing the directory
95829459361Smrg# $tardir.
95929459361Smrg#     tardir=directory && $(am__tar) > result.tar
96029459361Smrg#
96129459361Smrg# Substitute a variable $(am__untar) that extract such
96229459361Smrg# a tarball read from stdin.
96329459361Smrg#     $(am__untar) < result.tar
964f66e55a2Smrg#
96529459361SmrgAC_DEFUN([_AM_PROG_TAR],
966f66e55a2Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
967f66e55a2Smrg# in the wild :-(  We should find a proper way to deprecate it ...
968f66e55a2SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
969f66e55a2Smrg
970f66e55a2Smrg# We'll loop over all known methods to create a tar archive until one works.
97129459361Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
97229459361Smrg
973f66e55a2Smrgm4_if([$1], [v7],
974f66e55a2Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
975f66e55a2Smrg
976f66e55a2Smrg  [m4_case([$1],
977f66e55a2Smrg    [ustar],
978f66e55a2Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
979f66e55a2Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
980f66e55a2Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
981f66e55a2Smrg      # and bug#13588).
982f66e55a2Smrg      am_max_uid=2097151 # 2^21 - 1
983f66e55a2Smrg      am_max_gid=$am_max_uid
984f66e55a2Smrg      # The $UID and $GID variables are not portable, so we need to resort
985f66e55a2Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
986f66e55a2Smrg      # below are definitely unexpected, so allow the users to see them
987f66e55a2Smrg      # (that is, avoid stderr redirection).
988f66e55a2Smrg      am_uid=`id -u || echo unknown`
989f66e55a2Smrg      am_gid=`id -g || echo unknown`
990f66e55a2Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
991f66e55a2Smrg      if test $am_uid -le $am_max_uid; then
992f66e55a2Smrg         AC_MSG_RESULT([yes])
993f66e55a2Smrg      else
994f66e55a2Smrg         AC_MSG_RESULT([no])
995f66e55a2Smrg         _am_tools=none
996f66e55a2Smrg      fi
997f66e55a2Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
998f66e55a2Smrg      if test $am_gid -le $am_max_gid; then
999f66e55a2Smrg         AC_MSG_RESULT([yes])
1000f66e55a2Smrg      else
1001f66e55a2Smrg        AC_MSG_RESULT([no])
1002f66e55a2Smrg        _am_tools=none
1003f66e55a2Smrg      fi],
1004f66e55a2Smrg
1005f66e55a2Smrg  [pax],
1006f66e55a2Smrg    [],
1007f66e55a2Smrg
1008f66e55a2Smrg  [m4_fatal([Unknown tar format])])
1009f66e55a2Smrg
1010f66e55a2Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
1011f66e55a2Smrg
1012f66e55a2Smrg  # Go ahead even if we have the value already cached.  We do so because we
1013f66e55a2Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
1014f66e55a2Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1015f66e55a2Smrg
1016f66e55a2Smrg  for _am_tool in $_am_tools; do
1017f66e55a2Smrg    case $_am_tool in
1018f66e55a2Smrg    gnutar)
1019f66e55a2Smrg      for _am_tar in tar gnutar gtar; do
1020f66e55a2Smrg        AM_RUN_LOG([$_am_tar --version]) && break
1021f66e55a2Smrg      done
1022f66e55a2Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1023f66e55a2Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1024f66e55a2Smrg      am__untar="$_am_tar -xf -"
1025f66e55a2Smrg      ;;
1026f66e55a2Smrg    plaintar)
1027f66e55a2Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
1028f66e55a2Smrg      # ustar tarball either.
1029f66e55a2Smrg      (tar --version) >/dev/null 2>&1 && continue
1030f66e55a2Smrg      am__tar='tar chf - "$$tardir"'
1031f66e55a2Smrg      am__tar_='tar chf - "$tardir"'
1032f66e55a2Smrg      am__untar='tar xf -'
1033f66e55a2Smrg      ;;
1034f66e55a2Smrg    pax)
1035f66e55a2Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
1036f66e55a2Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
1037f66e55a2Smrg      am__untar='pax -r'
1038f66e55a2Smrg      ;;
1039f66e55a2Smrg    cpio)
1040f66e55a2Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1041f66e55a2Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1042f66e55a2Smrg      am__untar='cpio -i -H $1 -d'
1043f66e55a2Smrg      ;;
1044f66e55a2Smrg    none)
1045f66e55a2Smrg      am__tar=false
1046f66e55a2Smrg      am__tar_=false
1047f66e55a2Smrg      am__untar=false
1048f66e55a2Smrg      ;;
1049f66e55a2Smrg    esac
105029459361Smrg
1051f66e55a2Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
1052f66e55a2Smrg    # and am__untar set.
1053f66e55a2Smrg    test -n "${am_cv_prog_tar_$1}" && break
1054f66e55a2Smrg
1055f66e55a2Smrg    # tar/untar a dummy directory, and stop if the command works.
1056f66e55a2Smrg    rm -rf conftest.dir
1057f66e55a2Smrg    mkdir conftest.dir
1058f66e55a2Smrg    echo GrepMe > conftest.dir/file
1059f66e55a2Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1060f66e55a2Smrg    rm -rf conftest.dir
1061f66e55a2Smrg    if test -s conftest.tar; then
1062f66e55a2Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
1063f66e55a2Smrg      AM_RUN_LOG([cat conftest.dir/file])
1064f66e55a2Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1065f66e55a2Smrg    fi
1066f66e55a2Smrg  done
106729459361Smrg  rm -rf conftest.dir
106829459361Smrg
1069f66e55a2Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1070f66e55a2Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1071f66e55a2Smrg
107229459361SmrgAC_SUBST([am__tar])
107329459361SmrgAC_SUBST([am__untar])
107429459361Smrg]) # _AM_PROG_TAR
107529459361Smrg
1076f66e55a2Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1077f66e55a2Smrg# 
1078f66e55a2Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1079f66e55a2Smrg#
1080f66e55a2Smrg# This program is free software; you can redistribute it and/or modify
1081f66e55a2Smrg# it under the terms of the GNU General Public License as published by
1082f66e55a2Smrg# the Free Software Foundation; either version 2 of the License, or
1083f66e55a2Smrg# (at your option) any later version.
1084f66e55a2Smrg#
1085f66e55a2Smrg# This program is distributed in the hope that it will be useful, but
1086f66e55a2Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1087f66e55a2Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1088f66e55a2Smrg# General Public License for more details.
1089f66e55a2Smrg#
1090f66e55a2Smrg# You should have received a copy of the GNU General Public License
1091f66e55a2Smrg# along with this program; if not, write to the Free Software
1092f66e55a2Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1093f66e55a2Smrg#
1094f66e55a2Smrg# As a special exception to the GNU General Public License, if you
1095f66e55a2Smrg# distribute this file as part of a program that contains a
1096f66e55a2Smrg# configuration script generated by Autoconf, you may include it under
1097f66e55a2Smrg# the same distribution terms that you use for the rest of that program.
1098f66e55a2Smrg
1099f66e55a2Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1100f66e55a2Smrg# ----------------------------------
1101f66e55a2SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1102f66e55a2Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1103f66e55a2Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1104f66e55a2SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1105f66e55a2Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1106f66e55a2Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1107f66e55a2Smrgfi
1108f66e55a2Smrgif test -n "$PKG_CONFIG"; then
1109f66e55a2Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1110f66e55a2Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1111f66e55a2Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1112f66e55a2Smrg		AC_MSG_RESULT([yes])
1113f66e55a2Smrg	else
1114f66e55a2Smrg		AC_MSG_RESULT([no])
1115f66e55a2Smrg		PKG_CONFIG=""
1116f66e55a2Smrg	fi
1117f66e55a2Smrg		
1118f66e55a2Smrgfi[]dnl
1119f66e55a2Smrg])# PKG_PROG_PKG_CONFIG
1120f66e55a2Smrg
1121f66e55a2Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1122f66e55a2Smrg#
1123f66e55a2Smrg# Check to see whether a particular set of modules exists.  Similar
1124f66e55a2Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1125f66e55a2Smrg#
1126f66e55a2Smrg#
1127f66e55a2Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1128f66e55a2Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
1129f66e55a2Smrg# PKG_CHECK_EXISTS manually
1130f66e55a2Smrg# --------------------------------------------------------------
1131f66e55a2SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1132f66e55a2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1133f66e55a2Smrgif test -n "$PKG_CONFIG" && \
1134f66e55a2Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1135f66e55a2Smrg  m4_ifval([$2], [$2], [:])
1136f66e55a2Smrgm4_ifvaln([$3], [else
1137f66e55a2Smrg  $3])dnl
1138f66e55a2Smrgfi])
1139f66e55a2Smrg
1140f66e55a2Smrg
1141f66e55a2Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1142f66e55a2Smrg# ---------------------------------------------
1143f66e55a2Smrgm4_define([_PKG_CONFIG],
1144f66e55a2Smrg[if test -n "$$1"; then
1145f66e55a2Smrg    pkg_cv_[]$1="$$1"
1146f66e55a2Smrg elif test -n "$PKG_CONFIG"; then
1147f66e55a2Smrg    PKG_CHECK_EXISTS([$3],
1148f66e55a2Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1149f66e55a2Smrg		     [pkg_failed=yes])
1150f66e55a2Smrg else
1151f66e55a2Smrg    pkg_failed=untried
1152f66e55a2Smrgfi[]dnl
1153f66e55a2Smrg])# _PKG_CONFIG
1154f66e55a2Smrg
1155f66e55a2Smrg# _PKG_SHORT_ERRORS_SUPPORTED
1156f66e55a2Smrg# -----------------------------
1157f66e55a2SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1158f66e55a2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1159f66e55a2Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1160f66e55a2Smrg        _pkg_short_errors_supported=yes
1161f66e55a2Smrgelse
1162f66e55a2Smrg        _pkg_short_errors_supported=no
1163f66e55a2Smrgfi[]dnl
1164f66e55a2Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
1165f66e55a2Smrg
1166f66e55a2Smrg
1167f66e55a2Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1168f66e55a2Smrg# [ACTION-IF-NOT-FOUND])
1169f66e55a2Smrg#
1170f66e55a2Smrg#
1171f66e55a2Smrg# Note that if there is a possibility the first call to
1172f66e55a2Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1173f66e55a2Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1174f66e55a2Smrg#
1175f66e55a2Smrg#
1176f66e55a2Smrg# --------------------------------------------------------------
1177f66e55a2SmrgAC_DEFUN([PKG_CHECK_MODULES],
1178f66e55a2Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1179f66e55a2SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1180f66e55a2SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1181f66e55a2Smrg
1182f66e55a2Smrgpkg_failed=no
1183f66e55a2SmrgAC_MSG_CHECKING([for $1])
1184f66e55a2Smrg
1185f66e55a2Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1186f66e55a2Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1187f66e55a2Smrg
1188f66e55a2Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1189f66e55a2Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1190f66e55a2SmrgSee the pkg-config man page for more details.])
1191f66e55a2Smrg
1192f66e55a2Smrgif test $pkg_failed = yes; then
1193f66e55a2Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1194f66e55a2Smrg        if test $_pkg_short_errors_supported = yes; then
1195f66e55a2Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1196f66e55a2Smrg        else 
1197f66e55a2Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1198f66e55a2Smrg        fi
1199f66e55a2Smrg	# Put the nasty error message in config.log where it belongs
1200f66e55a2Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1201f66e55a2Smrg
1202f66e55a2Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1203f66e55a2Smrg[Package requirements ($2) were not met:
1204f66e55a2Smrg
1205f66e55a2Smrg$$1_PKG_ERRORS
1206f66e55a2Smrg
1207f66e55a2SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1208f66e55a2Smrginstalled software in a non-standard prefix.
1209f66e55a2Smrg
1210f66e55a2Smrg_PKG_TEXT
1211f66e55a2Smrg])],
1212f66e55a2Smrg		[AC_MSG_RESULT([no])
1213f66e55a2Smrg                $4])
1214f66e55a2Smrgelif test $pkg_failed = untried; then
1215f66e55a2Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1216f66e55a2Smrg[The pkg-config script could not be found or is too old.  Make sure it
1217f66e55a2Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1218f66e55a2Smrgpath to pkg-config.
1219f66e55a2Smrg
1220f66e55a2Smrg_PKG_TEXT
1221f66e55a2Smrg
1222f66e55a2SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1223f66e55a2Smrg		[$4])
1224f66e55a2Smrgelse
1225f66e55a2Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1226f66e55a2Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1227f66e55a2Smrg        AC_MSG_RESULT([yes])
1228f66e55a2Smrg	ifelse([$3], , :, [$3])
1229f66e55a2Smrgfi[]dnl
1230f66e55a2Smrg])# PKG_CHECK_MODULES
1231f66e55a2Smrg
12325715adc0Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
123329459361Smrgdnl
1234c3c9b392Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
123529459361Smrgdnl 
123629459361Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1237c3c9b392Smrgdnl copy of this software and associated documentation files (the "Software"),
1238c3c9b392Smrgdnl to deal in the Software without restriction, including without limitation
1239c3c9b392Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1240c3c9b392Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1241c3c9b392Smrgdnl Software is furnished to do so, subject to the following conditions:
124229459361Smrgdnl
1243c3c9b392Smrgdnl The above copyright notice and this permission notice (including the next
1244c3c9b392Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1245c3c9b392Smrgdnl Software.
124629459361Smrgdnl
1247c3c9b392Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1248c3c9b392Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1249c3c9b392Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1250c3c9b392Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1251c3c9b392Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1252c3c9b392Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1253c3c9b392Smrgdnl DEALINGS IN THE SOFTWARE.
125429459361Smrg
125529459361Smrg# XORG_MACROS_VERSION(required-version)
125629459361Smrg# -------------------------------------
125729459361Smrg# Minimum version: 1.1.0
125829459361Smrg#
125929459361Smrg# If you're using a macro added in Version 1.1 or newer, include this in
126029459361Smrg# your configure.ac with the minimum required version, such as:
126129459361Smrg# XORG_MACROS_VERSION(1.1)
126229459361Smrg#
12635715adc0Smrg# To ensure that this macro is defined, also add:
12645715adc0Smrg# m4_ifndef([XORG_MACROS_VERSION],
12655715adc0Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
126629459361Smrg#
126729459361Smrg#
126829459361Smrg# See the "minimum version" comment for each macro you use to see what 
126929459361Smrg# version you require.
12705715adc0Smrgm4_defun([XORG_MACROS_VERSION],[
1271f66e55a2Smrgm4_define([vers_have], [1.17])
12725715adc0Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
12735715adc0Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
12745715adc0Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
12755715adc0Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
12765715adc0Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
12775715adc0Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
12785715adc0Smrgm4_undefine([vers_have])
12795715adc0Smrgm4_undefine([maj_have])
12805715adc0Smrgm4_undefine([maj_needed])
128129459361Smrg]) # XORG_MACROS_VERSION
128229459361Smrg
128329459361Smrg# XORG_PROG_RAWCPP()
128429459361Smrg# ------------------
128529459361Smrg# Minimum version: 1.0.0
128629459361Smrg#
128729459361Smrg# Find cpp program and necessary flags for use in pre-processing text files
128829459361Smrg# such as man pages and config files
128929459361SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
129029459361SmrgAC_REQUIRE([AC_PROG_CPP])
129129459361SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
129229459361Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
129329459361Smrg
129429459361Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
129529459361Smrg# which is not the best choice for supporting other OS'es, but covers most
129629459361Smrg# of the ones we need for now.
129729459361SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1298f66e55a2SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
129929459361Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
130029459361Smrg	AC_MSG_RESULT([no])
130129459361Smrgelse
130229459361Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
130329459361Smrg		RAWCPPFLAGS=-undef
130429459361Smrg		AC_MSG_RESULT([yes])
13055715adc0Smrg	# under Cygwin unix is still defined even with -undef
13065715adc0Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
13075715adc0Smrg		RAWCPPFLAGS="-undef -ansi"
13085715adc0Smrg		AC_MSG_RESULT([yes, with -ansi])
130929459361Smrg	else
131029459361Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
131129459361Smrg	fi
131229459361Smrgfi
131329459361Smrgrm -f conftest.$ac_ext
131429459361Smrg
131529459361SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1316f66e55a2SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
131729459361Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
131829459361Smrg	AC_MSG_RESULT([no])
131929459361Smrgelse
132029459361Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
132129459361Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
132229459361Smrg		AC_MSG_RESULT([yes])
132329459361Smrg	else
132429459361Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
132529459361Smrg	fi
132629459361Smrgfi
132729459361Smrgrm -f conftest.$ac_ext
132829459361SmrgAC_SUBST(RAWCPPFLAGS)
132929459361Smrg]) # XORG_PROG_RAWCPP
133029459361Smrg
133129459361Smrg# XORG_MANPAGE_SECTIONS()
133229459361Smrg# -----------------------
133329459361Smrg# Minimum version: 1.0.0
133429459361Smrg#
133529459361Smrg# Determine which sections man pages go in for the different man page types
133629459361Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
133729459361Smrg# Not sure if there's any better way than just hardcoding by OS name.
133829459361Smrg# Override default settings by setting environment variables
1339c3c9b392Smrg# Added MAN_SUBSTS in version 1.8
1340c3c9b392Smrg# Added AC_PROG_SED in version 1.8
134129459361Smrg
134229459361SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
134329459361SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1344c3c9b392SmrgAC_REQUIRE([AC_PROG_SED])
134529459361Smrg
134629459361Smrgif test x$APP_MAN_SUFFIX = x    ; then
134729459361Smrg    APP_MAN_SUFFIX=1
134829459361Smrgfi
134929459361Smrgif test x$APP_MAN_DIR = x    ; then
135029459361Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
135129459361Smrgfi
135229459361Smrg
135329459361Smrgif test x$LIB_MAN_SUFFIX = x    ; then
135429459361Smrg    LIB_MAN_SUFFIX=3
135529459361Smrgfi
135629459361Smrgif test x$LIB_MAN_DIR = x    ; then
135729459361Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
135829459361Smrgfi
135929459361Smrg
136029459361Smrgif test x$FILE_MAN_SUFFIX = x    ; then
136129459361Smrg    case $host_os in
136229459361Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
136329459361Smrg	*)		FILE_MAN_SUFFIX=5  ;;
136429459361Smrg    esac
136529459361Smrgfi
136629459361Smrgif test x$FILE_MAN_DIR = x    ; then
136729459361Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
136829459361Smrgfi
136929459361Smrg
137029459361Smrgif test x$MISC_MAN_SUFFIX = x    ; then
137129459361Smrg    case $host_os in
137229459361Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
137329459361Smrg	*)		MISC_MAN_SUFFIX=7  ;;
137429459361Smrg    esac
137529459361Smrgfi
137629459361Smrgif test x$MISC_MAN_DIR = x    ; then
137729459361Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
137829459361Smrgfi
137929459361Smrg
138029459361Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
138129459361Smrg    case $host_os in
138229459361Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
138329459361Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
138429459361Smrg    esac
138529459361Smrgfi
138629459361Smrgif test x$DRIVER_MAN_DIR = x    ; then
138729459361Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
138829459361Smrgfi
138929459361Smrg
139029459361Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
139129459361Smrg    case $host_os in
139229459361Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
139329459361Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
139429459361Smrg    esac
139529459361Smrgfi
139629459361Smrgif test x$ADMIN_MAN_DIR = x    ; then
139729459361Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
139829459361Smrgfi
139929459361Smrg
140029459361Smrg
140129459361SmrgAC_SUBST([APP_MAN_SUFFIX])
140229459361SmrgAC_SUBST([LIB_MAN_SUFFIX])
140329459361SmrgAC_SUBST([FILE_MAN_SUFFIX])
140429459361SmrgAC_SUBST([MISC_MAN_SUFFIX])
140529459361SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
140629459361SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
140729459361SmrgAC_SUBST([APP_MAN_DIR])
140829459361SmrgAC_SUBST([LIB_MAN_DIR])
140929459361SmrgAC_SUBST([FILE_MAN_DIR])
141029459361SmrgAC_SUBST([MISC_MAN_DIR])
141129459361SmrgAC_SUBST([DRIVER_MAN_DIR])
141229459361SmrgAC_SUBST([ADMIN_MAN_DIR])
1413c3c9b392Smrg
1414c3c9b392SmrgXORG_MAN_PAGE="X Version 11"
1415c3c9b392SmrgAC_SUBST([XORG_MAN_PAGE])
1416c3c9b392SmrgMAN_SUBSTS="\
1417c3c9b392Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1418c3c9b392Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1419c3c9b392Smrg	-e 's|__xservername__|Xorg|g' \
1420c3c9b392Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1421c3c9b392Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1422c3c9b392Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1423c3c9b392Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1424c3c9b392Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1425c3c9b392Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1426c3c9b392Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1427c3c9b392Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1428c3c9b392Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1429c3c9b392SmrgAC_SUBST([MAN_SUBSTS])
1430c3c9b392Smrg
143129459361Smrg]) # XORG_MANPAGE_SECTIONS
143229459361Smrg
1433c3c9b392Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1434c3c9b392Smrg# ------------------------
1435c3c9b392Smrg# Minimum version: 1.7.0
1436c3c9b392Smrg#
1437c3c9b392Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1438c3c9b392Smrg# provided by xorg-sgml-doctools, if installed.
1439c3c9b392SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1440c3c9b392SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1441c3c9b392SmrgXORG_SGML_PATH=
1442c3c9b392SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1443c3c9b392Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1444c3c9b392Smrg    [m4_ifval([$1],[:],
1445c3c9b392Smrg        [if test x"$cross_compiling" != x"yes" ; then
1446c3c9b392Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1447c3c9b392Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1448c3c9b392Smrg         fi])
1449c3c9b392Smrg    ])
1450c3c9b392Smrg
1451c3c9b392Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1452c3c9b392Smrg# the path and the name of the doc stylesheet
1453c3c9b392Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1454c3c9b392Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1455c3c9b392Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1456c3c9b392Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1457c3c9b392Smrgelse
1458c3c9b392Smrg   AC_MSG_RESULT([no])
1459c3c9b392Smrgfi
1460c3c9b392Smrg
1461c3c9b392SmrgAC_SUBST(XORG_SGML_PATH)
1462c3c9b392SmrgAC_SUBST(STYLESHEET_SRCDIR)
1463c3c9b392SmrgAC_SUBST(XSL_STYLESHEET)
1464c3c9b392SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1465c3c9b392Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1466c3c9b392Smrg
146729459361Smrg# XORG_CHECK_LINUXDOC
146829459361Smrg# -------------------
146929459361Smrg# Minimum version: 1.0.0
147029459361Smrg#
147129459361Smrg# Defines the variable MAKE_TEXT if the necessary tools and
147229459361Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
147329459361Smrg# Whether or not the necessary tools and files are found can be checked
147429459361Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
147529459361SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1476c3c9b392SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1477c3c9b392SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
147829459361Smrg
147929459361SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
148029459361Smrg
1481c3c9b392SmrgAC_MSG_CHECKING([whether to build documentation])
148229459361Smrg
1483c3c9b392Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
148429459361Smrg   BUILDDOC=yes
148529459361Smrgelse
148629459361Smrg   BUILDDOC=no
148729459361Smrgfi
148829459361Smrg
148929459361SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
149029459361Smrg
149129459361SmrgAC_MSG_RESULT([$BUILDDOC])
149229459361Smrg
1493c3c9b392SmrgAC_MSG_CHECKING([whether to build pdf documentation])
149429459361Smrg
1495c3c9b392Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
149629459361Smrg   BUILDPDFDOC=yes
149729459361Smrgelse
149829459361Smrg   BUILDPDFDOC=no
149929459361Smrgfi
150029459361Smrg
150129459361SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
150229459361Smrg
150329459361SmrgAC_MSG_RESULT([$BUILDPDFDOC])
150429459361Smrg
1505c3c9b392SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
150629459361SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
150729459361SmrgMAKE_PDF="$PS2PDF"
150829459361SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
150929459361Smrg
151029459361SmrgAC_SUBST(MAKE_TEXT)
151129459361SmrgAC_SUBST(MAKE_PS)
151229459361SmrgAC_SUBST(MAKE_PDF)
151329459361SmrgAC_SUBST(MAKE_HTML)
151429459361Smrg]) # XORG_CHECK_LINUXDOC
151529459361Smrg
151629459361Smrg# XORG_CHECK_DOCBOOK
151729459361Smrg# -------------------
151829459361Smrg# Minimum version: 1.0.0
151929459361Smrg#
152029459361Smrg# Checks for the ability to build output formats from SGML DocBook source.
152129459361Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
152229459361Smrg# indicates whether the necessary tools and files are found and, if set,
152329459361Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
152429459361SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1525c3c9b392SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1526c3c9b392Smrg
152729459361SmrgBUILDTXTDOC=no
152829459361SmrgBUILDPDFDOC=no
152929459361SmrgBUILDPSDOC=no
153029459361SmrgBUILDHTMLDOC=no
153129459361Smrg
153229459361SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
153329459361SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
153429459361SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
153529459361SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
153629459361Smrg
1537c3c9b392SmrgAC_MSG_CHECKING([whether to build text documentation])
1538c3c9b392Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
153929459361Smrg   test x$BUILD_TXTDOC != xno; then
154029459361Smrg	BUILDTXTDOC=yes
154129459361Smrgfi
154229459361SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
154329459361SmrgAC_MSG_RESULT([$BUILDTXTDOC])
154429459361Smrg
1545c3c9b392SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1546c3c9b392Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
154729459361Smrg   test x$BUILD_PDFDOC != xno; then
154829459361Smrg	BUILDPDFDOC=yes
154929459361Smrgfi
155029459361SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
155129459361SmrgAC_MSG_RESULT([$BUILDPDFDOC])
155229459361Smrg
1553c3c9b392SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1554c3c9b392Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
155529459361Smrg   test x$BUILD_PSDOC != xno; then
155629459361Smrg	BUILDPSDOC=yes
155729459361Smrgfi
155829459361SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
155929459361SmrgAC_MSG_RESULT([$BUILDPSDOC])
156029459361Smrg
1561c3c9b392SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1562c3c9b392Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
156329459361Smrg   test x$BUILD_HTMLDOC != xno; then
156429459361Smrg	BUILDHTMLDOC=yes
156529459361Smrgfi
156629459361SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
156729459361SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
156829459361Smrg
156929459361SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
157029459361SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
157129459361SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
157229459361SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
157329459361Smrg
157429459361SmrgAC_SUBST(MAKE_TEXT)
157529459361SmrgAC_SUBST(MAKE_PS)
157629459361SmrgAC_SUBST(MAKE_PDF)
157729459361SmrgAC_SUBST(MAKE_HTML)
157829459361Smrg]) # XORG_CHECK_DOCBOOK
157929459361Smrg
1580c3c9b392Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1581c3c9b392Smrg# ----------------
1582c3c9b392Smrg# Minimum version: 1.5.0
1583c3c9b392Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1584c3c9b392Smrg#
1585c3c9b392Smrg# Documentation tools are not always available on all platforms and sometimes
1586c3c9b392Smrg# not at the appropriate level. This macro enables a module to test for the
1587c3c9b392Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1588c3c9b392Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1589c3c9b392Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1590c3c9b392Smrg# --with-xmlto assumes 'auto'.
1591c3c9b392Smrg#
1592c3c9b392Smrg# Interface to module:
1593c3c9b392Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1594c3c9b392Smrg# XMLTO:	returns the path of the xmlto program found
1595c3c9b392Smrg#		returns the path set by the user in the environment
1596c3c9b392Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1597c3c9b392Smrg#		'no' user instructs the module not to use xmlto
1598c3c9b392Smrg#
1599c3c9b392Smrg# Added in version 1.10.0
1600c3c9b392Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1601c3c9b392Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1602c3c9b392Smrg#
1603c3c9b392Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1604c3c9b392Smrg#
1605c3c9b392SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1606c3c9b392SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1607c3c9b392Smrgm4_define([_defopt], m4_default([$2], [auto]))
1608c3c9b392SmrgAC_ARG_WITH(xmlto,
1609c3c9b392Smrg	AS_HELP_STRING([--with-xmlto],
1610c3c9b392Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1611c3c9b392Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1612c3c9b392Smrgm4_undefine([_defopt])
1613c3c9b392Smrg
1614c3c9b392Smrgif test "x$use_xmlto" = x"auto"; then
1615c3c9b392Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1616c3c9b392Smrg   if test "x$XMLTO" = "x"; then
1617c3c9b392Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1618c3c9b392Smrg	have_xmlto=no
1619c3c9b392Smrg   else
1620c3c9b392Smrg        have_xmlto=yes
1621c3c9b392Smrg   fi
1622c3c9b392Smrgelif test "x$use_xmlto" = x"yes" ; then
1623c3c9b392Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1624c3c9b392Smrg   if test "x$XMLTO" = "x"; then
1625c3c9b392Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1626c3c9b392Smrg   fi
1627c3c9b392Smrg   have_xmlto=yes
1628c3c9b392Smrgelif test "x$use_xmlto" = x"no" ; then
1629c3c9b392Smrg   if test "x$XMLTO" != "x"; then
1630c3c9b392Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1631c3c9b392Smrg   fi
1632c3c9b392Smrg   have_xmlto=no
1633c3c9b392Smrgelse
1634c3c9b392Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1635c3c9b392Smrgfi
1636c3c9b392Smrg
1637c3c9b392Smrg# Test for a minimum version of xmlto, if provided.
1638c3c9b392Smrgm4_ifval([$1],
1639c3c9b392Smrg[if test "$have_xmlto" = yes; then
1640c3c9b392Smrg    # scrape the xmlto version
1641c3c9b392Smrg    AC_MSG_CHECKING([the xmlto version])
1642c3c9b392Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1643c3c9b392Smrg    AC_MSG_RESULT([$xmlto_version])
1644c3c9b392Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1645c3c9b392Smrg        [if test "x$use_xmlto" = xauto; then
1646c3c9b392Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1647c3c9b392Smrg            have_xmlto=no
1648c3c9b392Smrg        else
1649c3c9b392Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1650c3c9b392Smrg        fi])
1651c3c9b392Smrgfi])
1652c3c9b392Smrg
1653c3c9b392Smrg# Test for the ability of xmlto to generate a text target
1654c3c9b392Smrghave_xmlto_text=no
1655c3c9b392Smrgcat > conftest.xml << "EOF"
1656c3c9b392SmrgEOF
1657c3c9b392SmrgAS_IF([test "$have_xmlto" = yes],
1658c3c9b392Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1659c3c9b392Smrg             [have_xmlto_text=yes],
1660c3c9b392Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1661c3c9b392Smrgrm -f conftest.xml
1662c3c9b392SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1663c3c9b392SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1664c3c9b392Smrg]) # XORG_WITH_XMLTO
1665c3c9b392Smrg
1666f66e55a2Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1667f66e55a2Smrg# --------------------------------------------
1668f66e55a2Smrg# Minimum version: 1.12.0
1669f66e55a2Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1670f66e55a2Smrg#
1671f66e55a2Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1672f66e55a2Smrg# XML-based language used for the transformation of XML documents.
1673f66e55a2Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1674f66e55a2Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1675f66e55a2Smrg# The XSLT processor is often used as a standalone tool for transformations.
1676f66e55a2Smrg# It should not be assumed that this tool is used only to work with documnetation.
1677f66e55a2Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1678f66e55a2Smrg#
1679f66e55a2Smrg# Interface to module:
1680f66e55a2Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1681f66e55a2Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1682f66e55a2Smrg#		 returns the path set by the user in the environment
1683f66e55a2Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1684f66e55a2Smrg#		  'no' user instructs the module not to use xsltproc
1685f66e55a2Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1686f66e55a2Smrg#
1687f66e55a2Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1688f66e55a2Smrg#
1689f66e55a2SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1690f66e55a2SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1691f66e55a2Smrg# Preserves the interface, should it be implemented later
1692f66e55a2Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1693f66e55a2Smrgm4_define([_defopt], m4_default([$2], [auto]))
1694f66e55a2SmrgAC_ARG_WITH(xsltproc,
1695f66e55a2Smrg	AS_HELP_STRING([--with-xsltproc],
1696f66e55a2Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1697f66e55a2Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1698f66e55a2Smrgm4_undefine([_defopt])
1699f66e55a2Smrg
1700f66e55a2Smrgif test "x$use_xsltproc" = x"auto"; then
1701f66e55a2Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1702f66e55a2Smrg   if test "x$XSLTPROC" = "x"; then
1703f66e55a2Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1704f66e55a2Smrg	have_xsltproc=no
1705f66e55a2Smrg   else
1706f66e55a2Smrg        have_xsltproc=yes
1707f66e55a2Smrg   fi
1708f66e55a2Smrgelif test "x$use_xsltproc" = x"yes" ; then
1709f66e55a2Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1710f66e55a2Smrg   if test "x$XSLTPROC" = "x"; then
1711f66e55a2Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1712f66e55a2Smrg   fi
1713f66e55a2Smrg   have_xsltproc=yes
1714f66e55a2Smrgelif test "x$use_xsltproc" = x"no" ; then
1715f66e55a2Smrg   if test "x$XSLTPROC" != "x"; then
1716f66e55a2Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1717f66e55a2Smrg   fi
1718f66e55a2Smrg   have_xsltproc=no
1719f66e55a2Smrgelse
1720f66e55a2Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1721f66e55a2Smrgfi
1722f66e55a2Smrg
1723f66e55a2SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1724f66e55a2Smrg]) # XORG_WITH_XSLTPROC
1725f66e55a2Smrg
1726f66e55a2Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1727f66e55a2Smrg# ----------------------------------------
1728f66e55a2Smrg# Minimum version: 1.15.0
1729f66e55a2Smrg#
1730f66e55a2Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1731f66e55a2Smrg# scanning arbitrary text files, extracting information from those text files,
1732f66e55a2Smrg# and printing reports based on that information.
1733f66e55a2Smrg#
1734f66e55a2Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1735f66e55a2Smrg#
1736f66e55a2Smrg# Interface to module:
1737f66e55a2Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1738f66e55a2Smrg# PERL:	     returns the path of the perl program found
1739f66e55a2Smrg#	     returns the path set by the user in the environment
1740f66e55a2Smrg# --with-perl: 'yes' user instructs the module to use perl
1741f66e55a2Smrg#	       'no' user instructs the module not to use perl
1742f66e55a2Smrg# have_perl: returns yes if perl found in PATH or no
1743f66e55a2Smrg#
1744f66e55a2Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1745f66e55a2Smrg#
1746f66e55a2SmrgAC_DEFUN([XORG_WITH_PERL],[
1747f66e55a2SmrgAC_ARG_VAR([PERL], [Path to perl command])
1748f66e55a2Smrg# Preserves the interface, should it be implemented later
1749f66e55a2Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1750f66e55a2Smrgm4_define([_defopt], m4_default([$2], [auto]))
1751f66e55a2SmrgAC_ARG_WITH(perl,
1752f66e55a2Smrg	AS_HELP_STRING([--with-perl],
1753f66e55a2Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1754f66e55a2Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1755f66e55a2Smrgm4_undefine([_defopt])
1756f66e55a2Smrg
1757f66e55a2Smrgif test "x$use_perl" = x"auto"; then
1758f66e55a2Smrg   AC_PATH_PROG([PERL], [perl])
1759f66e55a2Smrg   if test "x$PERL" = "x"; then
1760f66e55a2Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1761f66e55a2Smrg	have_perl=no
1762f66e55a2Smrg   else
1763f66e55a2Smrg        have_perl=yes
1764f66e55a2Smrg   fi
1765f66e55a2Smrgelif test "x$use_perl" = x"yes" ; then
1766f66e55a2Smrg   AC_PATH_PROG([PERL], [perl])
1767f66e55a2Smrg   if test "x$PERL" = "x"; then
1768f66e55a2Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1769f66e55a2Smrg   fi
1770f66e55a2Smrg   have_perl=yes
1771f66e55a2Smrgelif test "x$use_perl" = x"no" ; then
1772f66e55a2Smrg   if test "x$PERL" != "x"; then
1773f66e55a2Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1774f66e55a2Smrg   fi
1775f66e55a2Smrg   have_perl=no
1776f66e55a2Smrgelse
1777f66e55a2Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1778f66e55a2Smrgfi
1779f66e55a2Smrg
1780f66e55a2SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1781f66e55a2Smrg]) # XORG_WITH_PERL
1782f66e55a2Smrg
1783c3c9b392Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1784c3c9b392Smrg# ----------------
1785c3c9b392Smrg# Minimum version: 1.5.0
1786c3c9b392Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1787c3c9b392Smrg#
1788c3c9b392Smrg# Documentation tools are not always available on all platforms and sometimes
1789c3c9b392Smrg# not at the appropriate level. This macro enables a module to test for the
1790c3c9b392Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1791c3c9b392Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1792c3c9b392Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1793c3c9b392Smrg# --with-asciidoc assumes 'auto'.
1794c3c9b392Smrg#
1795c3c9b392Smrg# Interface to module:
1796c3c9b392Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1797c3c9b392Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
1798c3c9b392Smrg#		 returns the path set by the user in the environment
1799c3c9b392Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1800c3c9b392Smrg#		  'no' user instructs the module not to use asciidoc
1801c3c9b392Smrg#
1802c3c9b392Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1803c3c9b392Smrg#
1804c3c9b392SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1805c3c9b392SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1806c3c9b392Smrgm4_define([_defopt], m4_default([$2], [auto]))
1807c3c9b392SmrgAC_ARG_WITH(asciidoc,
1808c3c9b392Smrg	AS_HELP_STRING([--with-asciidoc],
1809c3c9b392Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1810c3c9b392Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1811c3c9b392Smrgm4_undefine([_defopt])
1812c3c9b392Smrg
1813c3c9b392Smrgif test "x$use_asciidoc" = x"auto"; then
1814c3c9b392Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1815c3c9b392Smrg   if test "x$ASCIIDOC" = "x"; then
1816c3c9b392Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1817c3c9b392Smrg	have_asciidoc=no
1818c3c9b392Smrg   else
1819c3c9b392Smrg        have_asciidoc=yes
1820c3c9b392Smrg   fi
1821c3c9b392Smrgelif test "x$use_asciidoc" = x"yes" ; then
1822c3c9b392Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1823c3c9b392Smrg   if test "x$ASCIIDOC" = "x"; then
1824c3c9b392Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1825c3c9b392Smrg   fi
1826c3c9b392Smrg   have_asciidoc=yes
1827c3c9b392Smrgelif test "x$use_asciidoc" = x"no" ; then
1828c3c9b392Smrg   if test "x$ASCIIDOC" != "x"; then
1829c3c9b392Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1830c3c9b392Smrg   fi
1831c3c9b392Smrg   have_asciidoc=no
1832c3c9b392Smrgelse
1833c3c9b392Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1834c3c9b392Smrgfi
1835c3c9b392Smrgm4_ifval([$1],
1836c3c9b392Smrg[if test "$have_asciidoc" = yes; then
1837c3c9b392Smrg    # scrape the asciidoc version
1838c3c9b392Smrg    AC_MSG_CHECKING([the asciidoc version])
1839c3c9b392Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1840c3c9b392Smrg    AC_MSG_RESULT([$asciidoc_version])
1841c3c9b392Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1842c3c9b392Smrg        [if test "x$use_asciidoc" = xauto; then
1843c3c9b392Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1844c3c9b392Smrg            have_asciidoc=no
1845c3c9b392Smrg        else
1846c3c9b392Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1847c3c9b392Smrg        fi])
1848c3c9b392Smrgfi])
1849c3c9b392SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1850c3c9b392Smrg]) # XORG_WITH_ASCIIDOC
1851c3c9b392Smrg
1852c3c9b392Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1853c3c9b392Smrg# --------------------------------
1854c3c9b392Smrg# Minimum version: 1.5.0
1855c3c9b392Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1856c3c9b392Smrg#
1857c3c9b392Smrg# Documentation tools are not always available on all platforms and sometimes
1858c3c9b392Smrg# not at the appropriate level. This macro enables a module to test for the
1859c3c9b392Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1860c3c9b392Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1861c3c9b392Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1862c3c9b392Smrg# --with-doxygen assumes 'auto'.
1863c3c9b392Smrg#
1864c3c9b392Smrg# Interface to module:
1865c3c9b392Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1866c3c9b392Smrg# DOXYGEN:	 returns the path of the doxygen program found
1867c3c9b392Smrg#		 returns the path set by the user in the environment
1868c3c9b392Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1869c3c9b392Smrg#		  'no' user instructs the module not to use doxygen
1870c3c9b392Smrg#
1871c3c9b392Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1872c3c9b392Smrg#
1873c3c9b392SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1874c3c9b392SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1875c3c9b392Smrgm4_define([_defopt], m4_default([$2], [auto]))
1876c3c9b392SmrgAC_ARG_WITH(doxygen,
1877c3c9b392Smrg	AS_HELP_STRING([--with-doxygen],
1878c3c9b392Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1879c3c9b392Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1880c3c9b392Smrgm4_undefine([_defopt])
1881c3c9b392Smrg
1882c3c9b392Smrgif test "x$use_doxygen" = x"auto"; then
1883c3c9b392Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1884c3c9b392Smrg   if test "x$DOXYGEN" = "x"; then
1885c3c9b392Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1886c3c9b392Smrg	have_doxygen=no
1887c3c9b392Smrg   else
1888c3c9b392Smrg        have_doxygen=yes
1889c3c9b392Smrg   fi
1890c3c9b392Smrgelif test "x$use_doxygen" = x"yes" ; then
1891c3c9b392Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1892c3c9b392Smrg   if test "x$DOXYGEN" = "x"; then
1893c3c9b392Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1894c3c9b392Smrg   fi
1895c3c9b392Smrg   have_doxygen=yes
1896c3c9b392Smrgelif test "x$use_doxygen" = x"no" ; then
1897c3c9b392Smrg   if test "x$DOXYGEN" != "x"; then
1898c3c9b392Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1899c3c9b392Smrg   fi
1900c3c9b392Smrg   have_doxygen=no
1901c3c9b392Smrgelse
1902c3c9b392Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1903c3c9b392Smrgfi
1904c3c9b392Smrgm4_ifval([$1],
1905c3c9b392Smrg[if test "$have_doxygen" = yes; then
1906c3c9b392Smrg    # scrape the doxygen version
1907c3c9b392Smrg    AC_MSG_CHECKING([the doxygen version])
1908c3c9b392Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1909c3c9b392Smrg    AC_MSG_RESULT([$doxygen_version])
1910c3c9b392Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1911c3c9b392Smrg        [if test "x$use_doxygen" = xauto; then
1912c3c9b392Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1913c3c9b392Smrg            have_doxygen=no
1914c3c9b392Smrg        else
1915c3c9b392Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1916c3c9b392Smrg        fi])
1917c3c9b392Smrgfi])
1918c3c9b392SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1919c3c9b392Smrg]) # XORG_WITH_DOXYGEN
1920c3c9b392Smrg
1921c3c9b392Smrg# XORG_WITH_GROFF([DEFAULT])
1922c3c9b392Smrg# ----------------
1923c3c9b392Smrg# Minimum version: 1.6.0
1924c3c9b392Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1925c3c9b392Smrg#
1926c3c9b392Smrg# Documentation tools are not always available on all platforms and sometimes
1927c3c9b392Smrg# not at the appropriate level. This macro enables a module to test for the
1928c3c9b392Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1929c3c9b392Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
1930c3c9b392Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
1931c3c9b392Smrg# --with-groff assumes 'auto'.
1932c3c9b392Smrg#
1933c3c9b392Smrg# Interface to module:
1934c3c9b392Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1935c3c9b392Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1936c3c9b392Smrg# HAVE_GROFF_MS: the -ms macros package
1937c3c9b392Smrg# GROFF:	 returns the path of the groff program found
1938c3c9b392Smrg#		 returns the path set by the user in the environment
1939c3c9b392Smrg# --with-groff:	 'yes' user instructs the module to use groff
1940c3c9b392Smrg#		 'no' user instructs the module not to use groff
1941c3c9b392Smrg#
1942c3c9b392Smrg# Added in version 1.9.0:
1943c3c9b392Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1944c3c9b392Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1945c3c9b392Smrg#		   psselect from the psutils package.
1946c3c9b392Smrg#		   the ghostcript package. Refer to the grohtml man pages
1947c3c9b392Smrg#
1948c3c9b392Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1949c3c9b392Smrg#
1950c3c9b392Smrg# OS and distros often splits groff in a basic and full package, the former
1951c3c9b392Smrg# having the groff program and the later having devices, fonts and macros
1952c3c9b392Smrg# Checking for the groff executable is not enough.
1953c3c9b392Smrg#
1954c3c9b392Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
1955c3c9b392Smrg# unset HAVE_GROFF or GROFF env variables.
1956c3c9b392Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1957c3c9b392Smrg#
1958c3c9b392SmrgAC_DEFUN([XORG_WITH_GROFF],[
1959c3c9b392SmrgAC_ARG_VAR([GROFF], [Path to groff command])
1960c3c9b392Smrgm4_define([_defopt], m4_default([$1], [auto]))
1961c3c9b392SmrgAC_ARG_WITH(groff,
1962c3c9b392Smrg	AS_HELP_STRING([--with-groff],
1963c3c9b392Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1964c3c9b392Smrg	   [use_groff=$withval], [use_groff=]_defopt)
1965c3c9b392Smrgm4_undefine([_defopt])
1966c3c9b392Smrg
1967c3c9b392Smrgif test "x$use_groff" = x"auto"; then
1968c3c9b392Smrg   AC_PATH_PROG([GROFF], [groff])
1969c3c9b392Smrg   if test "x$GROFF" = "x"; then
1970c3c9b392Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1971c3c9b392Smrg	have_groff=no
1972c3c9b392Smrg   else
1973c3c9b392Smrg        have_groff=yes
1974c3c9b392Smrg   fi
1975c3c9b392Smrgelif test "x$use_groff" = x"yes" ; then
1976c3c9b392Smrg   AC_PATH_PROG([GROFF], [groff])
1977c3c9b392Smrg   if test "x$GROFF" = "x"; then
1978c3c9b392Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1979c3c9b392Smrg   fi
1980c3c9b392Smrg   have_groff=yes
1981c3c9b392Smrgelif test "x$use_groff" = x"no" ; then
1982c3c9b392Smrg   if test "x$GROFF" != "x"; then
1983c3c9b392Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1984c3c9b392Smrg   fi
1985c3c9b392Smrg   have_groff=no
1986c3c9b392Smrgelse
1987c3c9b392Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1988c3c9b392Smrgfi
1989c3c9b392Smrg
1990c3c9b392Smrg# We have groff, test for the presence of the macro packages
1991c3c9b392Smrgif test "x$have_groff" = x"yes"; then
1992c3c9b392Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1993c3c9b392Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1994c3c9b392Smrg        groff_ms_works=yes
1995c3c9b392Smrg    else
1996c3c9b392Smrg        groff_ms_works=no
1997c3c9b392Smrg    fi
1998c3c9b392Smrg    AC_MSG_RESULT([$groff_ms_works])
1999c3c9b392Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2000c3c9b392Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2001c3c9b392Smrg        groff_mm_works=yes
2002c3c9b392Smrg    else
2003c3c9b392Smrg        groff_mm_works=no
2004c3c9b392Smrg    fi
2005c3c9b392Smrg    AC_MSG_RESULT([$groff_mm_works])
2006c3c9b392Smrgfi
2007c3c9b392Smrg
2008c3c9b392Smrg# We have groff, test for HTML dependencies, one command per package
2009c3c9b392Smrgif test "x$have_groff" = x"yes"; then
2010c3c9b392Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2011c3c9b392Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2012c3c9b392Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2013c3c9b392Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2014c3c9b392Smrg      have_groff_html=yes
2015c3c9b392Smrg   else
2016c3c9b392Smrg      have_groff_html=no
2017c3c9b392Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2018c3c9b392Smrg   fi
2019c3c9b392Smrgfi
2020c3c9b392Smrg
2021c3c9b392Smrg# Set Automake conditionals for Makefiles
2022c3c9b392SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2023c3c9b392SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2024c3c9b392SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2025c3c9b392SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2026c3c9b392Smrg]) # XORG_WITH_GROFF
2027c3c9b392Smrg
2028f66e55a2Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2029f66e55a2Smrg# ---------------------------------------
2030c3c9b392Smrg# Minimum version: 1.6.0
2031c3c9b392Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2032f66e55a2Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2033c3c9b392Smrg#
2034c3c9b392Smrg# Documentation tools are not always available on all platforms and sometimes
2035c3c9b392Smrg# not at the appropriate level. This macro enables a module to test for the
2036c3c9b392Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2037c3c9b392Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
2038c3c9b392Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2039c3c9b392Smrg# --with-fop assumes 'auto'.
2040c3c9b392Smrg#
2041c3c9b392Smrg# Interface to module:
2042c3c9b392Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2043c3c9b392Smrg# FOP:	 	returns the path of the fop program found
2044c3c9b392Smrg#		returns the path set by the user in the environment
2045c3c9b392Smrg# --with-fop: 	'yes' user instructs the module to use fop
2046c3c9b392Smrg#		'no' user instructs the module not to use fop
2047c3c9b392Smrg#
2048c3c9b392Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2049c3c9b392Smrg#
2050c3c9b392SmrgAC_DEFUN([XORG_WITH_FOP],[
2051c3c9b392SmrgAC_ARG_VAR([FOP], [Path to fop command])
2052f66e55a2Smrgm4_define([_defopt], m4_default([$2], [auto]))
2053c3c9b392SmrgAC_ARG_WITH(fop,
2054c3c9b392Smrg	AS_HELP_STRING([--with-fop],
2055c3c9b392Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2056c3c9b392Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2057c3c9b392Smrgm4_undefine([_defopt])
2058c3c9b392Smrg
2059c3c9b392Smrgif test "x$use_fop" = x"auto"; then
2060c3c9b392Smrg   AC_PATH_PROG([FOP], [fop])
2061c3c9b392Smrg   if test "x$FOP" = "x"; then
2062c3c9b392Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2063c3c9b392Smrg	have_fop=no
2064c3c9b392Smrg   else
2065c3c9b392Smrg        have_fop=yes
2066c3c9b392Smrg   fi
2067c3c9b392Smrgelif test "x$use_fop" = x"yes" ; then
2068c3c9b392Smrg   AC_PATH_PROG([FOP], [fop])
2069c3c9b392Smrg   if test "x$FOP" = "x"; then
2070c3c9b392Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2071c3c9b392Smrg   fi
2072c3c9b392Smrg   have_fop=yes
2073c3c9b392Smrgelif test "x$use_fop" = x"no" ; then
2074c3c9b392Smrg   if test "x$FOP" != "x"; then
2075c3c9b392Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2076c3c9b392Smrg   fi
2077c3c9b392Smrg   have_fop=no
2078c3c9b392Smrgelse
2079c3c9b392Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2080c3c9b392Smrgfi
2081f66e55a2Smrg
2082f66e55a2Smrg# Test for a minimum version of fop, if provided.
2083f66e55a2Smrgm4_ifval([$1],
2084f66e55a2Smrg[if test "$have_fop" = yes; then
2085f66e55a2Smrg    # scrape the fop version
2086f66e55a2Smrg    AC_MSG_CHECKING([for fop minimum version])
2087f66e55a2Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2088f66e55a2Smrg    AC_MSG_RESULT([$fop_version])
2089f66e55a2Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2090f66e55a2Smrg        [if test "x$use_fop" = xauto; then
2091f66e55a2Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2092f66e55a2Smrg            have_fop=no
2093f66e55a2Smrg        else
2094f66e55a2Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2095f66e55a2Smrg        fi])
2096f66e55a2Smrgfi])
2097c3c9b392SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2098c3c9b392Smrg]) # XORG_WITH_FOP
2099c3c9b392Smrg
2100c3c9b392Smrg# XORG_WITH_PS2PDF([DEFAULT])
2101c3c9b392Smrg# ----------------
2102c3c9b392Smrg# Minimum version: 1.6.0
2103c3c9b392Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2104c3c9b392Smrg#
2105c3c9b392Smrg# Documentation tools are not always available on all platforms and sometimes
2106c3c9b392Smrg# not at the appropriate level. This macro enables a module to test for the
2107c3c9b392Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2108c3c9b392Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2109c3c9b392Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2110c3c9b392Smrg# --with-ps2pdf assumes 'auto'.
2111c3c9b392Smrg#
2112c3c9b392Smrg# Interface to module:
2113c3c9b392Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2114c3c9b392Smrg# PS2PDF:	returns the path of the ps2pdf program found
2115c3c9b392Smrg#		returns the path set by the user in the environment
2116c3c9b392Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2117c3c9b392Smrg#		 'no' user instructs the module not to use ps2pdf
2118c3c9b392Smrg#
2119c3c9b392Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2120c3c9b392Smrg#
2121c3c9b392SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2122c3c9b392SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2123c3c9b392Smrgm4_define([_defopt], m4_default([$1], [auto]))
2124c3c9b392SmrgAC_ARG_WITH(ps2pdf,
2125c3c9b392Smrg	AS_HELP_STRING([--with-ps2pdf],
2126c3c9b392Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2127c3c9b392Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2128c3c9b392Smrgm4_undefine([_defopt])
2129c3c9b392Smrg
2130c3c9b392Smrgif test "x$use_ps2pdf" = x"auto"; then
2131c3c9b392Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2132c3c9b392Smrg   if test "x$PS2PDF" = "x"; then
2133c3c9b392Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2134c3c9b392Smrg	have_ps2pdf=no
2135c3c9b392Smrg   else
2136c3c9b392Smrg        have_ps2pdf=yes
2137c3c9b392Smrg   fi
2138c3c9b392Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2139c3c9b392Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2140c3c9b392Smrg   if test "x$PS2PDF" = "x"; then
2141c3c9b392Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2142c3c9b392Smrg   fi
2143c3c9b392Smrg   have_ps2pdf=yes
2144c3c9b392Smrgelif test "x$use_ps2pdf" = x"no" ; then
2145c3c9b392Smrg   if test "x$PS2PDF" != "x"; then
2146c3c9b392Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2147c3c9b392Smrg   fi
2148c3c9b392Smrg   have_ps2pdf=no
2149c3c9b392Smrgelse
2150c3c9b392Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2151c3c9b392Smrgfi
2152c3c9b392SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2153c3c9b392Smrg]) # XORG_WITH_PS2PDF
2154c3c9b392Smrg
2155c3c9b392Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2156c3c9b392Smrg# ----------------
2157c3c9b392Smrg# Minimum version: 1.6.0
2158c3c9b392Smrg#
2159c3c9b392Smrg# Documentation tools are not always available on all platforms and sometimes
2160c3c9b392Smrg# not at the appropriate level. This macro enables a builder to skip all
2161c3c9b392Smrg# documentation targets except traditional man pages.
2162c3c9b392Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2163c3c9b392Smrg# maximum flexibilty in controlling documentation building.
2164c3c9b392Smrg# Refer to:
2165c3c9b392Smrg# XORG_WITH_XMLTO         --with-xmlto
2166c3c9b392Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2167c3c9b392Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2168c3c9b392Smrg# XORG_WITH_FOP           --with-fop
2169c3c9b392Smrg# XORG_WITH_GROFF         --with-groff
2170c3c9b392Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2171c3c9b392Smrg#
2172c3c9b392Smrg# Interface to module:
2173c3c9b392Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2174c3c9b392Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2175c3c9b392Smrg#		 'no' user instructs the module not to generate docs
2176c3c9b392Smrg# parm1:	specify the default value, yes or no.
2177c3c9b392Smrg#
2178c3c9b392SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2179f66e55a2Smrgm4_define([docs_default], m4_default([$1], [yes]))
2180c3c9b392SmrgAC_ARG_ENABLE(docs,
2181c3c9b392Smrg	AS_HELP_STRING([--enable-docs],
2182f66e55a2Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2183f66e55a2Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2184f66e55a2Smrgm4_undefine([docs_default])
2185c3c9b392SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2186c3c9b392SmrgAC_MSG_CHECKING([whether to build documentation])
2187c3c9b392SmrgAC_MSG_RESULT([$build_docs])
2188c3c9b392Smrg]) # XORG_ENABLE_DOCS
2189c3c9b392Smrg
2190c3c9b392Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2191c3c9b392Smrg# ----------------
2192c3c9b392Smrg# Minimum version: 1.6.0
2193c3c9b392Smrg#
2194c3c9b392Smrg# This macro enables a builder to skip all developer documentation.
2195c3c9b392Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2196c3c9b392Smrg# maximum flexibilty in controlling documentation building.
2197c3c9b392Smrg# Refer to:
2198c3c9b392Smrg# XORG_WITH_XMLTO         --with-xmlto
2199c3c9b392Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2200c3c9b392Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2201c3c9b392Smrg# XORG_WITH_FOP           --with-fop
2202c3c9b392Smrg# XORG_WITH_GROFF         --with-groff
2203c3c9b392Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2204c3c9b392Smrg#
2205c3c9b392Smrg# Interface to module:
2206c3c9b392Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2207c3c9b392Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2208c3c9b392Smrg#			'no' user instructs the module not to generate developer docs
2209c3c9b392Smrg# parm1:		specify the default value, yes or no.
2210c3c9b392Smrg#
2211c3c9b392SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2212c3c9b392Smrgm4_define([devel_default], m4_default([$1], [yes]))
2213c3c9b392SmrgAC_ARG_ENABLE(devel-docs,
2214c3c9b392Smrg	AS_HELP_STRING([--enable-devel-docs],
2215c3c9b392Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2216c3c9b392Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2217c3c9b392Smrgm4_undefine([devel_default])
2218c3c9b392SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2219c3c9b392SmrgAC_MSG_CHECKING([whether to build developer documentation])
2220c3c9b392SmrgAC_MSG_RESULT([$build_devel_docs])
2221c3c9b392Smrg]) # XORG_ENABLE_DEVEL_DOCS
2222c3c9b392Smrg
2223c3c9b392Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2224c3c9b392Smrg# ----------------
2225c3c9b392Smrg# Minimum version: 1.6.0
2226c3c9b392Smrg#
2227c3c9b392Smrg# This macro enables a builder to skip all functional specification targets.
2228c3c9b392Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2229c3c9b392Smrg# maximum flexibilty in controlling documentation building.
2230c3c9b392Smrg# Refer to:
2231c3c9b392Smrg# XORG_WITH_XMLTO         --with-xmlto
2232c3c9b392Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2233c3c9b392Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2234c3c9b392Smrg# XORG_WITH_FOP           --with-fop
2235c3c9b392Smrg# XORG_WITH_GROFF         --with-groff
2236c3c9b392Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2237c3c9b392Smrg#
2238c3c9b392Smrg# Interface to module:
2239c3c9b392Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2240c3c9b392Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2241c3c9b392Smrg#			'no' user instructs the module not to generate specs
2242c3c9b392Smrg# parm1:		specify the default value, yes or no.
2243c3c9b392Smrg#
2244c3c9b392SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2245c3c9b392Smrgm4_define([spec_default], m4_default([$1], [yes]))
2246c3c9b392SmrgAC_ARG_ENABLE(specs,
2247c3c9b392Smrg	AS_HELP_STRING([--enable-specs],
2248c3c9b392Smrg	   [Enable building the specs (default: ]spec_default[)]),
2249c3c9b392Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2250c3c9b392Smrgm4_undefine([spec_default])
2251c3c9b392SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2252c3c9b392SmrgAC_MSG_CHECKING([whether to build functional specifications])
2253c3c9b392SmrgAC_MSG_RESULT([$build_specs])
2254c3c9b392Smrg]) # XORG_ENABLE_SPECS
2255c3c9b392Smrg
2256f66e55a2Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2257f66e55a2Smrg# ----------------------------------------------
2258f66e55a2Smrg# Minimum version: 1.13.0
2259f66e55a2Smrg#
2260f66e55a2Smrg# This macro enables a builder to enable/disable unit testing
2261f66e55a2Smrg# It makes no assumption about the test cases implementation
2262f66e55a2Smrg# Test cases may or may not use Automake "Support for test suites"
2263f66e55a2Smrg# They may or may not use the software utility library GLib
2264f66e55a2Smrg#
2265f66e55a2Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2266f66e55a2Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2267f66e55a2Smrg# The variable enable_unit_tests is used by other macros in this file.
2268f66e55a2Smrg#
2269f66e55a2Smrg# Interface to module:
2270f66e55a2Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2271f66e55a2Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2272f66e55a2Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2273f66e55a2Smrg#			'no' user instructs the module not to build tests
2274f66e55a2Smrg# parm1:		specify the default value, yes or no.
2275f66e55a2Smrg#
2276f66e55a2SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2277f66e55a2SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2278f66e55a2SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2279f66e55a2SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2280f66e55a2Smrgm4_define([_defopt], m4_default([$1], [auto]))
2281f66e55a2SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2282f66e55a2Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2283f66e55a2Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2284f66e55a2Smrgm4_undefine([_defopt])
2285f66e55a2SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2286f66e55a2SmrgAC_MSG_CHECKING([whether to build unit test cases])
2287f66e55a2SmrgAC_MSG_RESULT([$enable_unit_tests])
2288f66e55a2Smrg]) # XORG_ENABLE_UNIT_TESTS
2289f66e55a2Smrg
2290f66e55a2Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2291f66e55a2Smrg# ------------------------------------------------------
2292f66e55a2Smrg# Minimum version: 1.17.0
2293f66e55a2Smrg#
2294f66e55a2Smrg# This macro enables a builder to enable/disable integration testing
2295f66e55a2Smrg# It makes no assumption about the test cases' implementation
2296f66e55a2Smrg# Test cases may or may not use Automake "Support for test suites"
2297f66e55a2Smrg#
2298f66e55a2Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2299f66e55a2Smrg# usually requires less dependencies and may be built and run under less
2300f66e55a2Smrg# stringent environments than integration tests.
2301f66e55a2Smrg#
2302f66e55a2Smrg# Interface to module:
2303f66e55a2Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2304f66e55a2Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2305f66e55a2Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2306f66e55a2Smrg#                             'no' user instructs the module not to build tests
2307f66e55a2Smrg# parm1:                      specify the default value, yes or no.
2308f66e55a2Smrg#
2309f66e55a2SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2310f66e55a2SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2311f66e55a2Smrgm4_define([_defopt], m4_default([$1], [auto]))
2312f66e55a2SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2313f66e55a2Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2314f66e55a2Smrg	[enable_integration_tests=$enableval],
2315f66e55a2Smrg	[enable_integration_tests=]_defopt)
2316f66e55a2Smrgm4_undefine([_defopt])
2317f66e55a2SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2318f66e55a2Smrg	[test "x$enable_integration_tests" != xno])
2319f66e55a2SmrgAC_MSG_CHECKING([whether to build unit test cases])
2320f66e55a2SmrgAC_MSG_RESULT([$enable_integration_tests])
2321f66e55a2Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2322f66e55a2Smrg
2323f66e55a2Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2324f66e55a2Smrg# ----------------------------------------
2325f66e55a2Smrg# Minimum version: 1.13.0
2326f66e55a2Smrg#
2327f66e55a2Smrg# GLib is a library which provides advanced data structures and functions.
2328f66e55a2Smrg# This macro enables a module to test for the presence of Glib.
2329f66e55a2Smrg#
2330f66e55a2Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2331f66e55a2Smrg# Otherwise the value of $enable_unit_tests is blank.
2332f66e55a2Smrg#
2333f66e55a2Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2334f66e55a2Smrg# test support usually requires less dependencies and may be built and run under
2335f66e55a2Smrg# less stringent environments than integration tests.
2336f66e55a2Smrg#
2337f66e55a2Smrg# Interface to module:
2338f66e55a2Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2339f66e55a2Smrg# with_glib: used in configure.ac to know if GLib has been found
2340f66e55a2Smrg# --with-glib:	'yes' user instructs the module to use glib
2341f66e55a2Smrg#		'no' user instructs the module not to use glib
2342f66e55a2Smrg#
2343f66e55a2SmrgAC_DEFUN([XORG_WITH_GLIB],[
2344f66e55a2SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2345f66e55a2Smrgm4_define([_defopt], m4_default([$2], [auto]))
2346f66e55a2SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2347f66e55a2Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2348f66e55a2Smrg	[with_glib=$withval], [with_glib=]_defopt)
2349f66e55a2Smrgm4_undefine([_defopt])
2350f66e55a2Smrg
2351f66e55a2Smrghave_glib=no
2352f66e55a2Smrg# Do not probe GLib if user explicitly disabled unit testing
2353f66e55a2Smrgif test "x$enable_unit_tests" != x"no"; then
2354f66e55a2Smrg  # Do not probe GLib if user explicitly disabled it
2355f66e55a2Smrg  if test "x$with_glib" != x"no"; then
2356f66e55a2Smrg    m4_ifval(
2357f66e55a2Smrg      [$1],
2358f66e55a2Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2359f66e55a2Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2360f66e55a2Smrg    )
2361f66e55a2Smrg  fi
2362f66e55a2Smrgfi
2363f66e55a2Smrg
2364f66e55a2Smrg# Not having GLib when unit testing has been explicitly requested is an error
2365f66e55a2Smrgif test "x$enable_unit_tests" = x"yes"; then
2366f66e55a2Smrg  if test "x$have_glib" = x"no"; then
2367f66e55a2Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2368f66e55a2Smrg  fi
2369f66e55a2Smrgfi
2370f66e55a2Smrg
2371f66e55a2Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2372f66e55a2Smrgif test "x$enable_unit_tests" = x"no"; then
2373f66e55a2Smrg  if test "x$with_glib" = x"yes"; then
2374f66e55a2Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2375f66e55a2Smrg  fi
2376f66e55a2Smrgfi
2377f66e55a2Smrg
2378f66e55a2Smrg# Not having GLib when it has been explicitly requested is an error
2379f66e55a2Smrgif test "x$with_glib" = x"yes"; then
2380f66e55a2Smrg  if test "x$have_glib" = x"no"; then
2381f66e55a2Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2382f66e55a2Smrg  fi
2383f66e55a2Smrgfi
2384f66e55a2Smrg
2385f66e55a2SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2386f66e55a2Smrg]) # XORG_WITH_GLIB
2387f66e55a2Smrg
2388f66e55a2Smrg# XORG_LD_WRAP([required|optional])
2389f66e55a2Smrg# ---------------------------------
2390f66e55a2Smrg# Minimum version: 1.13.0
2391f66e55a2Smrg#
2392f66e55a2Smrg# Check if linker supports -wrap, passed via compiler flags
2393f66e55a2Smrg#
2394f66e55a2Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2395f66e55a2Smrg# Otherwise the value of $enable_unit_tests is blank.
2396f66e55a2Smrg#
2397f66e55a2Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2398f66e55a2Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2399f66e55a2Smrg# available, an argument of "optional" allows use when some unit tests require
2400f66e55a2Smrg# ld -wrap and others do not.
2401f66e55a2Smrg#
2402f66e55a2SmrgAC_DEFUN([XORG_LD_WRAP],[
2403f66e55a2SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2404f66e55a2Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2405f66e55a2Smrg                      void __wrap_exit(int status) { return; }],
2406f66e55a2Smrg                     [exit(0);])])
2407f66e55a2Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2408f66e55a2Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2409f66e55a2Smrg  if test "x$have_ld_wrap" = x"no"; then
2410f66e55a2Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2411f66e55a2Smrg  fi
2412f66e55a2Smrgfi
2413f66e55a2SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2414f66e55a2Smrg#
2415f66e55a2Smrg]) # XORG_LD_WRAP
2416f66e55a2Smrg
2417f66e55a2Smrg# XORG_CHECK_LINKER_FLAGS
2418f66e55a2Smrg# -----------------------
2419f66e55a2Smrg# SYNOPSIS
2420f66e55a2Smrg#
2421f66e55a2Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2422f66e55a2Smrg#
2423f66e55a2Smrg# DESCRIPTION
2424f66e55a2Smrg#
2425f66e55a2Smrg#   Check whether the given linker FLAGS work with the current language's
2426f66e55a2Smrg#   linker, or whether they give an error.
2427f66e55a2Smrg#
2428f66e55a2Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2429f66e55a2Smrg#   success/failure.
2430f66e55a2Smrg#
2431f66e55a2Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2432f66e55a2Smrg#
2433f66e55a2Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2434f66e55a2Smrg#
2435f66e55a2Smrg# LICENSE
2436f66e55a2Smrg#
2437f66e55a2Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2438f66e55a2Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2439f66e55a2Smrg#   Copyright (c) 2009 Matteo Frigo
2440f66e55a2Smrg#
2441f66e55a2Smrg#   This program is free software: you can redistribute it and/or modify it
2442f66e55a2Smrg#   under the terms of the GNU General Public License as published by the
2443f66e55a2Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2444f66e55a2Smrg#   option) any later version.
2445f66e55a2Smrg#
2446f66e55a2Smrg#   This program is distributed in the hope that it will be useful, but
2447f66e55a2Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2448f66e55a2Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2449f66e55a2Smrg#   Public License for more details.
2450f66e55a2Smrg#
2451f66e55a2Smrg#   You should have received a copy of the GNU General Public License along
2452f66e55a2Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2453f66e55a2Smrg#
2454f66e55a2Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2455f66e55a2Smrg#   gives unlimited permission to copy, distribute and modify the configure
2456f66e55a2Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2457f66e55a2Smrg#   need not follow the terms of the GNU General Public License when using
2458f66e55a2Smrg#   or distributing such scripts, even though portions of the text of the
2459f66e55a2Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2460f66e55a2Smrg#   all other use of the material that constitutes the Autoconf Macro.
2461f66e55a2Smrg#
2462f66e55a2Smrg#   This special exception to the GPL applies to versions of the Autoconf
2463f66e55a2Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2464f66e55a2Smrg#   modified version of the Autoconf Macro, you may extend this special
2465f66e55a2Smrg#   exception to the GPL to apply to your modified version as well.#
2466f66e55a2SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2467f66e55a2Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2468f66e55a2Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2469f66e55a2SmrgAS_LITERAL_IF([$1],
2470f66e55a2Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2471f66e55a2Smrg      ax_save_FLAGS=$LDFLAGS
2472f66e55a2Smrg      LDFLAGS="$1"
2473f66e55a2Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2474f66e55a2Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2475f66e55a2Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2476f66e55a2Smrg      LDFLAGS=$ax_save_FLAGS])],
2477f66e55a2Smrg  [ax_save_FLAGS=$LDFLAGS
2478f66e55a2Smrg   LDFLAGS="$1"
2479f66e55a2Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2480f66e55a2Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2481f66e55a2Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2482f66e55a2Smrg   LDFLAGS=$ax_save_FLAGS])
2483f66e55a2Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2484f66e55a2SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2485f66e55a2Smrgif test "x$xorg_check_linker_flags" = xyes; then
2486f66e55a2Smrg	m4_default([$2], :)
2487f66e55a2Smrgelse
2488f66e55a2Smrg	m4_default([$3], :)
2489f66e55a2Smrgfi
2490f66e55a2Smrg]) # XORG_CHECK_LINKER_FLAGS
2491f66e55a2Smrg
2492f66e55a2Smrg# XORG_MEMORY_CHECK_FLAGS
2493f66e55a2Smrg# -----------------------
2494f66e55a2Smrg# Minimum version: 1.16.0
2495f66e55a2Smrg#
2496f66e55a2Smrg# This macro attempts to find appropriate memory checking functionality
2497f66e55a2Smrg# for various platforms which unit testing code may use to catch various
2498f66e55a2Smrg# forms of memory allocation and access errors in testing.
2499f66e55a2Smrg#
2500f66e55a2Smrg# Interface to module:
2501f66e55a2Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2502f66e55a2Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2503f66e55a2Smrg#
2504f66e55a2Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2505f66e55a2Smrg#
2506f66e55a2SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2507f66e55a2Smrg
2508f66e55a2SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2509f66e55a2SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2510f66e55a2Smrg           [Environment variables to enable memory checking in tests])
2511f66e55a2Smrg
2512f66e55a2Smrg# Check for different types of support on different platforms
2513f66e55a2Smrgcase $host_os in
2514f66e55a2Smrg    solaris*)
2515f66e55a2Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2516f66e55a2Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2517f66e55a2Smrg        ;;
2518f66e55a2Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2519f66e55a2Smrg        # both directly and inverted, so should not be 0 or 255.
2520f66e55a2Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2521f66e55a2Smrg        ;;
2522f66e55a2Smrg    darwin*)
2523f66e55a2Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2524f66e55a2Smrg        ;;
2525f66e55a2Smrg    *bsd*)
2526f66e55a2Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2527f66e55a2Smrg        ;;
2528f66e55a2Smrgesac
2529f66e55a2Smrg
2530f66e55a2Smrg# User supplied flags override default flags
2531f66e55a2Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2532f66e55a2Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2533f66e55a2Smrgfi
2534f66e55a2Smrg
2535f66e55a2SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2536f66e55a2Smrg]) # XORG_WITH_LINT
2537f66e55a2Smrg
253829459361Smrg# XORG_CHECK_MALLOC_ZERO
253929459361Smrg# ----------------------
254029459361Smrg# Minimum version: 1.0.0
254129459361Smrg#
254229459361Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
254329459361Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
254429459361Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
254529459361SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
254629459361SmrgAC_ARG_ENABLE(malloc0returnsnull,
25475715adc0Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
254829459361Smrg		       [malloc(0) returns NULL (default: auto)]),
254929459361Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
255029459361Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
255129459361Smrg
255229459361SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
255329459361Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2554f66e55a2Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2555f66e55a2Smrg#include <stdlib.h>
2556f66e55a2Smrg],[
255729459361Smrg    char *m0, *r0, *c0, *p;
255829459361Smrg    m0 = malloc(0);
255929459361Smrg    p = malloc(10);
256029459361Smrg    r0 = realloc(p,0);
2561f66e55a2Smrg    c0 = calloc(0,10);
2562f66e55a2Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2563f66e55a2Smrg])],
256429459361Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
2565c3c9b392Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
2566c3c9b392Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
256729459361Smrgfi
256829459361SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
256929459361Smrg
257029459361Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
257129459361Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
257229459361Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
257329459361Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
257429459361Smrgelse
257529459361Smrg	MALLOC_ZERO_CFLAGS=""
257629459361Smrg	XMALLOC_ZERO_CFLAGS=""
257729459361Smrg	XTMALLOC_ZERO_CFLAGS=""
257829459361Smrgfi
257929459361Smrg
258029459361SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
258129459361SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
258229459361SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
258329459361Smrg]) # XORG_CHECK_MALLOC_ZERO
258429459361Smrg
258529459361Smrg# XORG_WITH_LINT()
258629459361Smrg# ----------------
258729459361Smrg# Minimum version: 1.1.0
258829459361Smrg#
2589c3c9b392Smrg# This macro enables the use of a tool that flags some suspicious and
2590c3c9b392Smrg# non-portable constructs (likely to be bugs) in C language source code.
2591c3c9b392Smrg# It will attempt to locate the tool and use appropriate options.
2592c3c9b392Smrg# There are various lint type tools on different platforms.
2593c3c9b392Smrg#
2594c3c9b392Smrg# Interface to module:
2595c3c9b392Smrg# LINT:		returns the path to the tool found on the platform
2596c3c9b392Smrg#		or the value set to LINT on the configure cmd line
2597c3c9b392Smrg#		also an Automake conditional
2598c3c9b392Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2599c3c9b392Smrg#
2600c3c9b392Smrg# --with-lint:	'yes' user instructs the module to use lint
2601c3c9b392Smrg#		'no' user instructs the module not to use lint (default)
2602c3c9b392Smrg#
2603c3c9b392Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2604c3c9b392Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
260529459361Smrg#
260629459361SmrgAC_DEFUN([XORG_WITH_LINT],[
260729459361Smrg
2608c3c9b392SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2609c3c9b392SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
26105715adc0SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
261129459361Smrg		[Use a lint-style source code checker (default: disabled)])],
261229459361Smrg		[use_lint=$withval], [use_lint=no])
2613c3c9b392Smrg
2614c3c9b392Smrg# Obtain platform specific info like program name and options
2615c3c9b392Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2616c3c9b392Smrgcase $host_os in
2617c3c9b392Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2618c3c9b392Smrg	lint_name=splint
2619c3c9b392Smrg	lint_options="-badflag"
2620c3c9b392Smrg	;;
2621c3c9b392Smrg  *freebsd* | *netbsd*)
2622c3c9b392Smrg	lint_name=lint
2623c3c9b392Smrg	lint_options="-u -b"
2624c3c9b392Smrg	;;
2625c3c9b392Smrg  *solaris*)
2626c3c9b392Smrg	lint_name=lint
2627c3c9b392Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2628c3c9b392Smrg	;;
2629c3c9b392Smrgesac
2630c3c9b392Smrg
2631c3c9b392Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2632c3c9b392Smrgif test "x$use_lint" = x"yes" ; then
2633c3c9b392Smrg   AC_PATH_PROG([LINT], [$lint_name])
2634c3c9b392Smrg   if test "x$LINT" = "x"; then
2635c3c9b392Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2636c3c9b392Smrg   fi
2637c3c9b392Smrgelif test "x$use_lint" = x"no" ; then
2638c3c9b392Smrg   if test "x$LINT" != "x"; then
2639c3c9b392Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2640c3c9b392Smrg   fi
264129459361Smrgelse
2642c3c9b392Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
264329459361Smrgfi
2644c3c9b392Smrg
2645c3c9b392Smrg# User supplied flags override default flags
2646c3c9b392Smrgif test "x$LINT_FLAGS" != "x"; then
2647c3c9b392Smrg   lint_options=$LINT_FLAGS
264829459361Smrgfi
264929459361Smrg
2650c3c9b392SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2651c3c9b392SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
265229459361Smrg
265329459361Smrg]) # XORG_WITH_LINT
265429459361Smrg
265529459361Smrg# XORG_LINT_LIBRARY(LIBNAME)
265629459361Smrg# --------------------------
265729459361Smrg# Minimum version: 1.1.0
265829459361Smrg#
265929459361Smrg# Sets up flags for building lint libraries for checking programs that call
266029459361Smrg# functions in the library.
266129459361Smrg#
2662c3c9b392Smrg# Interface to module:
2663c3c9b392Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2664c3c9b392Smrg# MAKE_LINT_LIB		- Automake conditional
2665c3c9b392Smrg#
2666c3c9b392Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2667c3c9b392Smrg#			  - 'no' user instructs the module not to create a lint library (default)
266829459361Smrg
266929459361SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
267029459361SmrgAC_REQUIRE([XORG_WITH_LINT])
26715715adc0SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
267229459361Smrg	[Create lint library (default: disabled)])],
267329459361Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2674c3c9b392Smrg
2675c3c9b392Smrgif test "x$make_lint_lib" = x"yes" ; then
2676c3c9b392Smrg   LINTLIB=llib-l$1.ln
2677c3c9b392Smrg   if test "x$LINT" = "x"; then
2678c3c9b392Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2679c3c9b392Smrg   fi
2680c3c9b392Smrgelif test "x$make_lint_lib" != x"no" ; then
2681c3c9b392Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
268229459361Smrgfi
2683c3c9b392Smrg
268429459361SmrgAC_SUBST(LINTLIB)
268529459361SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
268629459361Smrg
268729459361Smrg]) # XORG_LINT_LIBRARY
268829459361Smrg
2689f66e55a2Smrg# XORG_COMPILER_BRAND
2690f66e55a2Smrg# -------------------
2691f66e55a2Smrg# Minimum version: 1.14.0
2692f66e55a2Smrg#
2693f66e55a2Smrg# Checks for various brands of compilers and sets flags as appropriate:
2694f66e55a2Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2695f66e55a2Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2696f66e55a2Smrg#   clang compiler - sets CLANGCC to "yes"
2697f66e55a2Smrg#   Intel compiler - sets INTELCC to "yes"
2698f66e55a2Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2699f66e55a2Smrg#
2700f66e55a2SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2701f66e55a2SmrgAC_LANG_CASE(
2702f66e55a2Smrg	[C], [
2703f66e55a2Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2704f66e55a2Smrg	],
2705f66e55a2Smrg	[C++], [
2706f66e55a2Smrg		AC_REQUIRE([AC_PROG_CXX])
2707f66e55a2Smrg	]
2708f66e55a2Smrg)
2709f66e55a2SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2710f66e55a2SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2711f66e55a2SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2712f66e55a2Smrg]) # XORG_COMPILER_BRAND
2713f66e55a2Smrg
2714f66e55a2Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2715f66e55a2Smrg# ---------------
2716f66e55a2Smrg# Minimum version: 1.16.0
2717f66e55a2Smrg#
2718f66e55a2Smrg# Test if the compiler works when passed the given flag as a command line argument.
2719f66e55a2Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2720f66e55a2Smrg# next flag in the list until there are no more options.
2721f66e55a2Smrg#
2722f66e55a2Smrg# Note that this does not guarantee that the compiler supports the flag as some
2723f66e55a2Smrg# compilers will simply ignore arguments that they do not understand, but we do
2724f66e55a2Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2725f66e55a2Smrg# -Werror=unused-command-line-argument
2726f66e55a2Smrg#
2727f66e55a2SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2728f66e55a2Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2729f66e55a2Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2730f66e55a2Smrg
2731f66e55a2SmrgAC_LANG_COMPILER_REQUIRE
2732f66e55a2Smrg
2733f66e55a2SmrgAC_LANG_CASE(
2734f66e55a2Smrg	[C], [
2735f66e55a2Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2736f66e55a2Smrg		define([PREFIX], [C])
2737f66e55a2Smrg		define([CACHE_PREFIX], [cc])
2738f66e55a2Smrg		define([COMPILER], [$CC])
2739f66e55a2Smrg	],
2740f66e55a2Smrg	[C++], [
2741f66e55a2Smrg		define([PREFIX], [CXX])
2742f66e55a2Smrg		define([CACHE_PREFIX], [cxx])
2743f66e55a2Smrg		define([COMPILER], [$CXX])
2744f66e55a2Smrg	]
2745f66e55a2Smrg)
2746f66e55a2Smrg
2747f66e55a2Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2748f66e55a2Smrg
2749f66e55a2Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2750f66e55a2Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2751f66e55a2Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2752f66e55a2Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2753f66e55a2Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2754f66e55a2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2755f66e55a2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2756f66e55a2Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2757f66e55a2Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2758f66e55a2Smrgfi
2759f66e55a2Smrg
2760f66e55a2Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2761f66e55a2Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2762f66e55a2Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2763f66e55a2Smrg	fi
2764f66e55a2Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2765f66e55a2Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2766f66e55a2Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2767f66e55a2Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2768f66e55a2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2769f66e55a2Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2770f66e55a2Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2771f66e55a2Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2772f66e55a2Smrgfi
2773f66e55a2Smrg
2774f66e55a2Smrgfound="no"
2775f66e55a2Smrgm4_foreach([flag], m4_cdr($@), [
2776f66e55a2Smrg	if test $found = "no" ; then
2777f66e55a2Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2778f66e55a2Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2779f66e55a2Smrg		fi
2780f66e55a2Smrg
2781f66e55a2Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2782f66e55a2Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2783f66e55a2Smrg		fi
2784f66e55a2Smrg
2785f66e55a2Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2786f66e55a2Smrg
2787f66e55a2Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2788f66e55a2Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2789f66e55a2Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2790f66e55a2Smrg		AC_CACHE_VAL($cacheid,
2791f66e55a2Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2792f66e55a2Smrg					     [eval $cacheid=yes],
2793f66e55a2Smrg					     [eval $cacheid=no])])
2794f66e55a2Smrg
2795f66e55a2Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2796f66e55a2Smrg
2797f66e55a2Smrg		eval supported=\$$cacheid
2798f66e55a2Smrg		AC_MSG_RESULT([$supported])
2799f66e55a2Smrg		if test "$supported" = "yes" ; then
2800f66e55a2Smrg			$1="$$1 ]flag["
2801f66e55a2Smrg			found="yes"
2802f66e55a2Smrg		fi
2803f66e55a2Smrg	fi
2804f66e55a2Smrg])
2805f66e55a2Smrg]) # XORG_TESTSET_CFLAG
2806f66e55a2Smrg
2807f66e55a2Smrg# XORG_COMPILER_FLAGS
2808f66e55a2Smrg# ---------------
2809f66e55a2Smrg# Minimum version: 1.16.0
2810f66e55a2Smrg#
2811f66e55a2Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2812f66e55a2Smrg# arguments supported by the selected compiler which do NOT alter the generated
2813f66e55a2Smrg# code.  These arguments will cause the compiler to print various warnings
2814f66e55a2Smrg# during compilation AND turn a conservative set of warnings into errors.
2815f66e55a2Smrg#
2816f66e55a2Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2817f66e55a2Smrg# future versions of util-macros as options are added to new compilers.
2818f66e55a2Smrg#
2819f66e55a2SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2820f66e55a2SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2821f66e55a2Smrg
2822f66e55a2SmrgAC_ARG_ENABLE(selective-werror,
2823f66e55a2Smrg              AS_HELP_STRING([--disable-selective-werror],
2824f66e55a2Smrg                             [Turn off selective compiler errors. (default: enabled)]),
2825f66e55a2Smrg              [SELECTIVE_WERROR=$enableval],
2826f66e55a2Smrg              [SELECTIVE_WERROR=yes])
2827f66e55a2Smrg
2828f66e55a2SmrgAC_LANG_CASE(
2829f66e55a2Smrg        [C], [
2830f66e55a2Smrg                define([PREFIX], [C])
2831f66e55a2Smrg        ],
2832f66e55a2Smrg        [C++], [
2833f66e55a2Smrg                define([PREFIX], [CXX])
2834f66e55a2Smrg        ]
2835f66e55a2Smrg)
2836f66e55a2Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2837f66e55a2Smrgif test "x$SUNCC" = "xyes"; then
2838f66e55a2Smrg    [BASE_]PREFIX[FLAGS]="-v"
2839f66e55a2Smrgelse
2840f66e55a2Smrg    [BASE_]PREFIX[FLAGS]=""
2841f66e55a2Smrgfi
2842f66e55a2Smrg
2843f66e55a2Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2844f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2845f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2846f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2847f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2848f66e55a2Smrg
2849f66e55a2SmrgAC_LANG_CASE(
2850f66e55a2Smrg	[C], [
2851f66e55a2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2852f66e55a2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2853f66e55a2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2854f66e55a2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2855f66e55a2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
2856f66e55a2Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2857f66e55a2Smrg	]
2858f66e55a2Smrg)
2859f66e55a2Smrg
2860f66e55a2Smrg# This chunk adds additional warnings that could catch undesired effects.
2861f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2862f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2863f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2864f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2865f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2866f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2867f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2868f66e55a2Smrg
2869f66e55a2Smrg# These are currently disabled because they are noisy.  They will be enabled
2870f66e55a2Smrg# in the future once the codebase is sufficiently modernized to silence
2871f66e55a2Smrg# them.  For now, I don't want them to drown out the other warnings.
2872f66e55a2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2873f66e55a2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2874f66e55a2Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2875f66e55a2Smrg
2876f66e55a2Smrg# Turn some warnings into errors, so we don't accidently get successful builds
2877f66e55a2Smrg# when there are problems that should be fixed.
2878f66e55a2Smrg
2879f66e55a2Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2880f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2881f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2882f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2883f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2884f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2885f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2886f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2887f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2888f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2889f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2890f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2891f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2892f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2893f66e55a2Smrgelse
2894f66e55a2SmrgAC_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])
2895f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2896f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2897f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2898f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2899f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2900f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2901f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2902f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2903f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2904f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2905f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2906f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2907f66e55a2SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2908f66e55a2Smrgfi
2909f66e55a2Smrg
2910f66e55a2SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2911f66e55a2Smrg]) # XORG_COMPILER_FLAGS
2912f66e55a2Smrg
29135715adc0Smrg# XORG_CWARNFLAGS
29145715adc0Smrg# ---------------
29155715adc0Smrg# Minimum version: 1.2.0
2916f66e55a2Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
29175715adc0Smrg#
29185715adc0Smrg# Defines CWARNFLAGS to enable C compiler warnings.
29195715adc0Smrg#
2920f66e55a2Smrg# This function is deprecated because it defines -fno-strict-aliasing
2921f66e55a2Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2922f66e55a2Smrg# is needed, then it should be added explicitly in the module when
2923f66e55a2Smrg# it is updated to use BASE_CFLAGS.
2924f66e55a2Smrg#
29255715adc0SmrgAC_DEFUN([XORG_CWARNFLAGS], [
2926f66e55a2SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2927f66e55a2SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2928f66e55a2SmrgAC_LANG_CASE(
2929f66e55a2Smrg	[C], [
2930f66e55a2Smrg		CWARNFLAGS="$BASE_CFLAGS"
2931f66e55a2Smrg		if  test "x$GCC" = xyes ; then
2932f66e55a2Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2933f66e55a2Smrg		fi
2934f66e55a2Smrg		AC_SUBST(CWARNFLAGS)
2935f66e55a2Smrg	]
2936f66e55a2Smrg)
29375715adc0Smrg]) # XORG_CWARNFLAGS
29385715adc0Smrg
29395715adc0Smrg# XORG_STRICT_OPTION
29405715adc0Smrg# -----------------------
29415715adc0Smrg# Minimum version: 1.3.0
29425715adc0Smrg#
2943f66e55a2Smrg# Add configure option to enable strict compilation flags, such as treating
2944f66e55a2Smrg# warnings as fatal errors.
2945f66e55a2Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
2946f66e55a2Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2947f66e55a2Smrg#
2948f66e55a2Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2949f66e55a2Smrg# when strict compilation is unconditionally desired.
29505715adc0SmrgAC_DEFUN([XORG_STRICT_OPTION], [
29515715adc0SmrgAC_REQUIRE([XORG_CWARNFLAGS])
2952f66e55a2SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
29535715adc0Smrg
29545715adc0SmrgAC_ARG_ENABLE(strict-compilation,
29555715adc0Smrg			  AS_HELP_STRING([--enable-strict-compilation],
29565715adc0Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
29575715adc0Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2958f66e55a2Smrg
2959f66e55a2SmrgAC_LANG_CASE(
2960f66e55a2Smrg        [C], [
2961f66e55a2Smrg                define([PREFIX], [C])
2962f66e55a2Smrg        ],
2963f66e55a2Smrg        [C++], [
2964f66e55a2Smrg                define([PREFIX], [CXX])
2965f66e55a2Smrg        ]
2966f66e55a2Smrg)
2967f66e55a2Smrg
2968f66e55a2Smrg[STRICT_]PREFIX[FLAGS]=""
2969f66e55a2SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2970f66e55a2SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2971f66e55a2Smrg
2972f66e55a2Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2973f66e55a2Smrg# activate it with -Werror, so we add it here explicitly.
2974f66e55a2SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2975f66e55a2Smrg
29765715adc0Smrgif test "x$STRICT_COMPILE" = "xyes"; then
2977f66e55a2Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2978f66e55a2Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
29795715adc0Smrgfi
2980f66e55a2SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
2981f66e55a2SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2982f66e55a2SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
29835715adc0Smrg]) # XORG_STRICT_OPTION
29845715adc0Smrg
29855715adc0Smrg# XORG_DEFAULT_OPTIONS
29865715adc0Smrg# --------------------
29875715adc0Smrg# Minimum version: 1.3.0
29885715adc0Smrg#
29895715adc0Smrg# Defines default options for X.Org modules.
29905715adc0Smrg#
29915715adc0SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2992c3c9b392SmrgAC_REQUIRE([AC_PROG_INSTALL])
2993f66e55a2SmrgXORG_COMPILER_FLAGS
29945715adc0SmrgXORG_CWARNFLAGS
29955715adc0SmrgXORG_STRICT_OPTION
29965715adc0SmrgXORG_RELEASE_VERSION
29975715adc0SmrgXORG_CHANGELOG
2998c3c9b392SmrgXORG_INSTALL
29995715adc0SmrgXORG_MANPAGE_SECTIONS
3000c3c9b392Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3001c3c9b392Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
30025715adc0Smrg]) # XORG_DEFAULT_OPTIONS
3003c3c9b392Smrg
3004c3c9b392Smrg# XORG_INSTALL()
3005c3c9b392Smrg# ----------------
3006c3c9b392Smrg# Minimum version: 1.4.0
3007c3c9b392Smrg#
3008c3c9b392Smrg# Defines the variable INSTALL_CMD as the command to copy
3009c3c9b392Smrg# INSTALL from $prefix/share/util-macros.
3010c3c9b392Smrg#
3011c3c9b392SmrgAC_DEFUN([XORG_INSTALL], [
3012c3c9b392SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3013c3c9b392Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3014c3c9b392SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3015c3c9b392Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3016c3c9b392Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3017c3c9b392Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3018c3c9b392SmrgAC_SUBST([INSTALL_CMD])
3019c3c9b392Smrg]) # XORG_INSTALL
302029459361Smrgdnl Copyright 2005 Red Hat, Inc
302129459361Smrgdnl
302229459361Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
302329459361Smrgdnl documentation for any purpose is hereby granted without fee, provided that
302429459361Smrgdnl the above copyright notice appear in all copies and that both that
302529459361Smrgdnl copyright notice and this permission notice appear in supporting
302629459361Smrgdnl documentation.
302729459361Smrgdnl
302829459361Smrgdnl The above copyright notice and this permission notice shall be included
302929459361Smrgdnl in all copies or substantial portions of the Software.
303029459361Smrgdnl
303129459361Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
303229459361Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
303329459361Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
303429459361Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
303529459361Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
303629459361Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
303729459361Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
303829459361Smrgdnl
303929459361Smrgdnl Except as contained in this notice, the name of the copyright holders shall
304029459361Smrgdnl not be used in advertising or otherwise to promote the sale, use or
304129459361Smrgdnl other dealings in this Software without prior written authorization
304229459361Smrgdnl from the copyright holders.
304329459361Smrgdnl
304429459361Smrg
304529459361Smrg# XORG_RELEASE_VERSION
304629459361Smrg# --------------------
3047c3c9b392Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
304829459361Smrg 
304929459361SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
305029459361Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
305129459361Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
305229459361Smrg		[Major version of this package])
30535715adc0Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
305429459361Smrg	if test "x$PVM" = "x"; then
305529459361Smrg		PVM="0"
305629459361Smrg	fi
305729459361Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
305829459361Smrg		[$PVM],
305929459361Smrg		[Minor version of this package])
30605715adc0Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
306129459361Smrg	if test "x$PVP" = "x"; then
306229459361Smrg		PVP="0"
306329459361Smrg	fi
306429459361Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
306529459361Smrg		[$PVP],
306629459361Smrg		[Patch version of this package])
306729459361Smrg])
306829459361Smrg
30695715adc0Smrg# XORG_CHANGELOG()
30705715adc0Smrg# ----------------
30715715adc0Smrg# Minimum version: 1.2.0
30725715adc0Smrg#
30735715adc0Smrg# Defines the variable CHANGELOG_CMD as the command to generate
30745715adc0Smrg# ChangeLog from git.
30755715adc0Smrg#
30765715adc0Smrg#
30775715adc0SmrgAC_DEFUN([XORG_CHANGELOG], [
3078c3c9b392SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3079c3c9b392Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3080c3c9b392Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
30815715adc0Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
30825715adc0SmrgAC_SUBST([CHANGELOG_CMD])
30835715adc0Smrg]) # XORG_CHANGELOG
30845715adc0Smrg
3085