aclocal.m4 revision 33dddc75
133dddc75Smrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
233dddc75Smrg
333dddc75Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
472b4363aSmrg
572b4363aSmrg# This file is free software; the Free Software Foundation
672b4363aSmrg# gives unlimited permission to copy and/or distribute it,
772b4363aSmrg# with or without modifications, as long as this notice is preserved.
872b4363aSmrg
972b4363aSmrg# This program is distributed in the hope that it will be useful,
1072b4363aSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1172b4363aSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1272b4363aSmrg# PARTICULAR PURPOSE.
1372b4363aSmrg
1433dddc75Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15dd77ae96Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16dd77ae96Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1733dddc75Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
1833dddc75Smrg[m4_warning([this file was generated for autoconf 2.69.
19dd77ae96SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20dd77ae96SmrgIf you have problems, you may need to regenerate the build system entirely.
2133dddc75SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2272b4363aSmrg
2333dddc75Smrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
2472b4363aSmrg#
2572b4363aSmrg# This file is free software; the Free Software Foundation
2672b4363aSmrg# gives unlimited permission to copy and/or distribute it,
2772b4363aSmrg# with or without modifications, as long as this notice is preserved.
2872b4363aSmrg
2972b4363aSmrg# AM_AUTOMAKE_VERSION(VERSION)
3072b4363aSmrg# ----------------------------
3172b4363aSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3272b4363aSmrg# generated from the m4 files accompanying Automake X.Y.
3372b4363aSmrg# (This private macro should not be called outside this file.)
3472b4363aSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3533dddc75Smrg[am__api_version='1.15'
3672b4363aSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3772b4363aSmrgdnl require some minimum version.  Point them to the right macro.
3833dddc75Smrgm4_if([$1], [1.15], [],
3972b4363aSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4072b4363aSmrg])
4172b4363aSmrg
4272b4363aSmrg# _AM_AUTOCONF_VERSION(VERSION)
4372b4363aSmrg# -----------------------------
4472b4363aSmrg# aclocal traces this macro to find the Autoconf version.
4572b4363aSmrg# This is a private macro too.  Using m4_define simplifies
4672b4363aSmrg# the logic in aclocal, which can simply ignore this definition.
4772b4363aSmrgm4_define([_AM_AUTOCONF_VERSION], [])
4872b4363aSmrg
4972b4363aSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5072b4363aSmrg# -------------------------------
5172b4363aSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52dd77ae96Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5372b4363aSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5433dddc75Smrg[AM_AUTOMAKE_VERSION([1.15])dnl
55dd77ae96Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56dd77ae96Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57dd77ae96Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5872b4363aSmrg
5972b4363aSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6072b4363aSmrg
6133dddc75Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
6272b4363aSmrg#
6372b4363aSmrg# This file is free software; the Free Software Foundation
6472b4363aSmrg# gives unlimited permission to copy and/or distribute it,
6572b4363aSmrg# with or without modifications, as long as this notice is preserved.
6672b4363aSmrg
6772b4363aSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6833dddc75Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6933dddc75Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7072b4363aSmrg#
7172b4363aSmrg# Of course, Automake must honor this variable whenever it calls a
7272b4363aSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7372b4363aSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7472b4363aSmrg# depending on how configure is run.  This is pretty annoying, since
7572b4363aSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7672b4363aSmrg# source directory, any form will work fine, but in subdirectories a
7772b4363aSmrg# relative path needs to be adjusted first.
7872b4363aSmrg#
7972b4363aSmrg# $ac_aux_dir/missing
8072b4363aSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8172b4363aSmrg# $top_srcdir/$ac_aux_dir/missing
8272b4363aSmrg#    fails if $ac_aux_dir is absolute,
8372b4363aSmrg#    fails when called from a subdirectory in a VPATH build with
8472b4363aSmrg#          a relative $ac_aux_dir
8572b4363aSmrg#
8672b4363aSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8772b4363aSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
8833dddc75Smrg# harmless because $srcdir is '.', but things will broke when you
8972b4363aSmrg# start a VPATH build or use an absolute $srcdir.
9072b4363aSmrg#
9172b4363aSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9272b4363aSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9372b4363aSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9472b4363aSmrg# and then we would define $MISSING as
9572b4363aSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9672b4363aSmrg# This will work as long as MISSING is not called from configure, because
9772b4363aSmrg# unfortunately $(top_srcdir) has no meaning in configure.
9872b4363aSmrg# However there are other variables, like CC, which are often used in
9972b4363aSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10072b4363aSmrg#
10172b4363aSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
10272b4363aSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
10372b4363aSmrg# configured tree to be moved without reconfiguration.
10472b4363aSmrg
10572b4363aSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10633dddc75Smrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10733dddc75Smrg# Expand $ac_aux_dir to an absolute path.
10833dddc75Smrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10972b4363aSmrg])
11072b4363aSmrg
11172b4363aSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11272b4363aSmrg
11333dddc75Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
11472b4363aSmrg#
11572b4363aSmrg# This file is free software; the Free Software Foundation
11672b4363aSmrg# gives unlimited permission to copy and/or distribute it,
11772b4363aSmrg# with or without modifications, as long as this notice is preserved.
11872b4363aSmrg
11972b4363aSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12072b4363aSmrg# -------------------------------------
12172b4363aSmrg# Define a conditional.
12272b4363aSmrgAC_DEFUN([AM_CONDITIONAL],
12333dddc75Smrg[AC_PREREQ([2.52])dnl
12433dddc75Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12533dddc75Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12672b4363aSmrgAC_SUBST([$1_TRUE])dnl
12772b4363aSmrgAC_SUBST([$1_FALSE])dnl
12872b4363aSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12972b4363aSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130dd77ae96Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13172b4363aSmrgif $2; then
13272b4363aSmrg  $1_TRUE=
13372b4363aSmrg  $1_FALSE='#'
13472b4363aSmrgelse
13572b4363aSmrg  $1_TRUE='#'
13672b4363aSmrg  $1_FALSE=
13772b4363aSmrgfi
13872b4363aSmrgAC_CONFIG_COMMANDS_PRE(
13972b4363aSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14072b4363aSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14172b4363aSmrgUsually this means the macro was only invoked conditionally.]])
14272b4363aSmrgfi])])
14372b4363aSmrg
14433dddc75Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
14572b4363aSmrg#
14672b4363aSmrg# This file is free software; the Free Software Foundation
14772b4363aSmrg# gives unlimited permission to copy and/or distribute it,
14872b4363aSmrg# with or without modifications, as long as this notice is preserved.
14972b4363aSmrg
15072b4363aSmrg
15133dddc75Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15272b4363aSmrg# written in clear, in which case automake, when reading aclocal.m4,
15372b4363aSmrg# will think it sees a *use*, and therefore will trigger all it's
15472b4363aSmrg# C support machinery.  Also note that it means that autoscan, seeing
15572b4363aSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
15672b4363aSmrg
15772b4363aSmrg
15872b4363aSmrg# _AM_DEPENDENCIES(NAME)
15972b4363aSmrg# ----------------------
16072b4363aSmrg# See how the compiler implements dependency checking.
16133dddc75Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16272b4363aSmrg# We try a few techniques and use that to set a single cache variable.
16372b4363aSmrg#
16472b4363aSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16572b4363aSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16672b4363aSmrg# dependency, and given that the user is not expected to run this macro,
16772b4363aSmrg# just rely on AC_PROG_CC.
16872b4363aSmrgAC_DEFUN([_AM_DEPENDENCIES],
16972b4363aSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17072b4363aSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17172b4363aSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17272b4363aSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17372b4363aSmrg
17433dddc75Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17533dddc75Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17633dddc75Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17733dddc75Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17833dddc75Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17933dddc75Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18033dddc75Smrg                    [depcc="$$1"   am_compiler_list=])
18172b4363aSmrg
18272b4363aSmrgAC_CACHE_CHECK([dependency style of $depcc],
18372b4363aSmrg               [am_cv_$1_dependencies_compiler_type],
18472b4363aSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18572b4363aSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
18672b4363aSmrg  # making bogus files that we don't know about and never remove.  For
18772b4363aSmrg  # instance it was reported that on HP-UX the gcc test will end up
18833dddc75Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18933dddc75Smrg  # in D".
19033dddc75Smrg  rm -rf conftest.dir
19172b4363aSmrg  mkdir conftest.dir
19272b4363aSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19372b4363aSmrg  # using a relative directory.
19472b4363aSmrg  cp "$am_depcomp" conftest.dir
19572b4363aSmrg  cd conftest.dir
19672b4363aSmrg  # We will build objects and dependencies in a subdirectory because
19772b4363aSmrg  # it helps to detect inapplicable dependency modes.  For instance
19872b4363aSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19972b4363aSmrg  # side effect of compilation, but ICC will put the dependencies in
20072b4363aSmrg  # the current directory while Tru64 will put them in the object
20172b4363aSmrg  # directory.
20272b4363aSmrg  mkdir sub
20372b4363aSmrg
20472b4363aSmrg  am_cv_$1_dependencies_compiler_type=none
20572b4363aSmrg  if test "$am_compiler_list" = ""; then
20672b4363aSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20772b4363aSmrg  fi
208dd77ae96Smrg  am__universal=false
209dd77ae96Smrg  m4_case([$1], [CC],
210dd77ae96Smrg    [case " $depcc " in #(
211dd77ae96Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212dd77ae96Smrg     esac],
213dd77ae96Smrg    [CXX],
214dd77ae96Smrg    [case " $depcc " in #(
215dd77ae96Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216dd77ae96Smrg     esac])
217dd77ae96Smrg
21872b4363aSmrg  for depmode in $am_compiler_list; do
21972b4363aSmrg    # Setup a source with many dependencies, because some compilers
22072b4363aSmrg    # like to wrap large dependency lists on column 80 (with \), and
22172b4363aSmrg    # we should not choose a depcomp mode which is confused by this.
22272b4363aSmrg    #
22372b4363aSmrg    # We need to recreate these files for each test, as the compiler may
22472b4363aSmrg    # overwrite some of them when testing with obscure command lines.
22572b4363aSmrg    # This happens at least with the AIX C compiler.
22672b4363aSmrg    : > sub/conftest.c
22772b4363aSmrg    for i in 1 2 3 4 5 6; do
22872b4363aSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22933dddc75Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23033dddc75Smrg      # Solaris 10 /bin/sh.
23133dddc75Smrg      echo '/* dummy */' > sub/conftst$i.h
23272b4363aSmrg    done
23372b4363aSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23472b4363aSmrg
23533dddc75Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236dd77ae96Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23733dddc75Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23833dddc75Smrg    # versions had trouble with output in subdirs.
239dd77ae96Smrg    am__obj=sub/conftest.${OBJEXT-o}
240dd77ae96Smrg    am__minus_obj="-o $am__obj"
24172b4363aSmrg    case $depmode in
242dd77ae96Smrg    gcc)
243dd77ae96Smrg      # This depmode causes a compiler race in universal mode.
244dd77ae96Smrg      test "$am__universal" = false || continue
245dd77ae96Smrg      ;;
24672b4363aSmrg    nosideeffect)
24733dddc75Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24833dddc75Smrg      # only be used when explicitly requested.
24972b4363aSmrg      if test "x$enable_dependency_tracking" = xyes; then
25072b4363aSmrg	continue
25172b4363aSmrg      else
25272b4363aSmrg	break
25372b4363aSmrg      fi
25472b4363aSmrg      ;;
25533dddc75Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25633dddc75Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257dd77ae96Smrg      # not run yet.  These depmodes are late enough in the game, and
258dd77ae96Smrg      # so weak that their functioning should not be impacted.
259dd77ae96Smrg      am__obj=conftest.${OBJEXT-o}
260dd77ae96Smrg      am__minus_obj=
261dd77ae96Smrg      ;;
26272b4363aSmrg    none) break ;;
26372b4363aSmrg    esac
26472b4363aSmrg    if depmode=$depmode \
265dd77ae96Smrg       source=sub/conftest.c object=$am__obj \
26672b4363aSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267dd77ae96Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26872b4363aSmrg         >/dev/null 2>conftest.err &&
26972b4363aSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27072b4363aSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271dd77ae96Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27272b4363aSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27372b4363aSmrg      # icc doesn't choke on unknown options, it will just issue warnings
27472b4363aSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
27572b4363aSmrg      # that says an option was ignored or not supported.
27672b4363aSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27772b4363aSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27872b4363aSmrg      # The diagnosis changed in icc 8.0:
27972b4363aSmrg      #   icc: Command line remark: option '-MP' not supported
28072b4363aSmrg      if (grep 'ignoring option' conftest.err ||
28172b4363aSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28272b4363aSmrg        am_cv_$1_dependencies_compiler_type=$depmode
28372b4363aSmrg        break
28472b4363aSmrg      fi
28572b4363aSmrg    fi
28672b4363aSmrg  done
28772b4363aSmrg
28872b4363aSmrg  cd ..
28972b4363aSmrg  rm -rf conftest.dir
29072b4363aSmrgelse
29172b4363aSmrg  am_cv_$1_dependencies_compiler_type=none
29272b4363aSmrgfi
29372b4363aSmrg])
29472b4363aSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29572b4363aSmrgAM_CONDITIONAL([am__fastdep$1], [
29672b4363aSmrg  test "x$enable_dependency_tracking" != xno \
29772b4363aSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29872b4363aSmrg])
29972b4363aSmrg
30072b4363aSmrg
30172b4363aSmrg# AM_SET_DEPDIR
30272b4363aSmrg# -------------
30372b4363aSmrg# Choose a directory name for dependency files.
30433dddc75Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30572b4363aSmrgAC_DEFUN([AM_SET_DEPDIR],
30672b4363aSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30772b4363aSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30872b4363aSmrg])
30972b4363aSmrg
31072b4363aSmrg
31172b4363aSmrg# AM_DEP_TRACK
31272b4363aSmrg# ------------
31372b4363aSmrgAC_DEFUN([AM_DEP_TRACK],
31433dddc75Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31533dddc75SmrgAS_HELP_STRING(
31633dddc75Smrg  [--enable-dependency-tracking],
31733dddc75Smrg  [do not reject slow dependency extractors])
31833dddc75SmrgAS_HELP_STRING(
31933dddc75Smrg  [--disable-dependency-tracking],
32033dddc75Smrg  [speeds up one-time build])])
32172b4363aSmrgif test "x$enable_dependency_tracking" != xno; then
32272b4363aSmrg  am_depcomp="$ac_aux_dir/depcomp"
32372b4363aSmrg  AMDEPBACKSLASH='\'
32433dddc75Smrg  am__nodep='_no'
32572b4363aSmrgfi
32672b4363aSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32772b4363aSmrgAC_SUBST([AMDEPBACKSLASH])dnl
32872b4363aSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32933dddc75SmrgAC_SUBST([am__nodep])dnl
33033dddc75Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33172b4363aSmrg])
33272b4363aSmrg
33372b4363aSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33472b4363aSmrg
33533dddc75Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
33672b4363aSmrg#
33772b4363aSmrg# This file is free software; the Free Software Foundation
33872b4363aSmrg# gives unlimited permission to copy and/or distribute it,
33972b4363aSmrg# with or without modifications, as long as this notice is preserved.
34072b4363aSmrg
34172b4363aSmrg
34272b4363aSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34372b4363aSmrg# ------------------------------
34472b4363aSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
345dd77ae96Smrg[{
34633dddc75Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
347dd77ae96Smrg  # are listed without --file.  Let's play safe and only enable the eval
348dd77ae96Smrg  # if we detect the quoting.
349dd77ae96Smrg  case $CONFIG_FILES in
350dd77ae96Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
351dd77ae96Smrg  *)   set x $CONFIG_FILES ;;
352dd77ae96Smrg  esac
353dd77ae96Smrg  shift
354dd77ae96Smrg  for mf
355dd77ae96Smrg  do
356dd77ae96Smrg    # Strip MF so we end up with the name of the file.
357dd77ae96Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
358dd77ae96Smrg    # Check whether this is an Automake generated Makefile or not.
35933dddc75Smrg    # We used to match only the files named 'Makefile.in', but
360dd77ae96Smrg    # some people rename them; so instead we look at the file content.
361dd77ae96Smrg    # Grep'ing the first line is not enough: some people post-process
362dd77ae96Smrg    # each Makefile.in and add a new line on top of each file to say so.
363dd77ae96Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
364dd77ae96Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
365dd77ae96Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
366dd77ae96Smrg      dirpart=`AS_DIRNAME("$mf")`
367dd77ae96Smrg    else
368dd77ae96Smrg      continue
369dd77ae96Smrg    fi
370dd77ae96Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
37133dddc75Smrg    # from the Makefile without running 'make'.
372dd77ae96Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
373dd77ae96Smrg    test -z "$DEPDIR" && continue
374dd77ae96Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
37533dddc75Smrg    test -z "$am__include" && continue
376dd77ae96Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
377dd77ae96Smrg    # Find all dependency output files, they are included files with
378dd77ae96Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379dd77ae96Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380dd77ae96Smrg    # expansion.
381dd77ae96Smrg    for file in `sed -n "
382dd77ae96Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
38333dddc75Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
384dd77ae96Smrg      # Make sure the directory exists.
385dd77ae96Smrg      test -f "$dirpart/$file" && continue
386dd77ae96Smrg      fdir=`AS_DIRNAME(["$file"])`
387dd77ae96Smrg      AS_MKDIR_P([$dirpart/$fdir])
388dd77ae96Smrg      # echo "creating $dirpart/$file"
389dd77ae96Smrg      echo '# dummy' > "$dirpart/$file"
390dd77ae96Smrg    done
39172b4363aSmrg  done
392dd77ae96Smrg}
39372b4363aSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
39472b4363aSmrg
39572b4363aSmrg
39672b4363aSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39772b4363aSmrg# -----------------------------
39872b4363aSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
39972b4363aSmrg#
40072b4363aSmrg# This code is only required when automatic dependency tracking
40133dddc75Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
40272b4363aSmrg# need in order to bootstrap the dependency handling code.
40372b4363aSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
40472b4363aSmrg[AC_CONFIG_COMMANDS([depfiles],
40572b4363aSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
40672b4363aSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
40772b4363aSmrg])
40872b4363aSmrg
40972b4363aSmrg# Do all the work for Automake.                             -*- Autoconf -*-
41072b4363aSmrg
41133dddc75Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
41272b4363aSmrg#
41372b4363aSmrg# This file is free software; the Free Software Foundation
41472b4363aSmrg# gives unlimited permission to copy and/or distribute it,
41572b4363aSmrg# with or without modifications, as long as this notice is preserved.
41672b4363aSmrg
41772b4363aSmrg# This macro actually does too much.  Some checks are only needed if
41872b4363aSmrg# your package does certain things.  But this isn't really a big deal.
41972b4363aSmrg
42033dddc75Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
42133dddc75Smrgm4_define([AC_PROG_CC],
42233dddc75Smrgm4_defn([AC_PROG_CC])
42333dddc75Smrg[_AM_PROG_CC_C_O
42433dddc75Smrg])
42533dddc75Smrg
42672b4363aSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
42772b4363aSmrg# AM_INIT_AUTOMAKE([OPTIONS])
42872b4363aSmrg# -----------------------------------------------
42972b4363aSmrg# The call with PACKAGE and VERSION arguments is the old style
43072b4363aSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
43172b4363aSmrg# and VERSION should now be passed to AC_INIT and removed from
43272b4363aSmrg# the call to AM_INIT_AUTOMAKE.
43372b4363aSmrg# We support both call styles for the transition.  After
43472b4363aSmrg# the next Automake release, Autoconf can make the AC_INIT
43572b4363aSmrg# arguments mandatory, and then we can depend on a new Autoconf
43672b4363aSmrg# release and drop the old call support.
43772b4363aSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43833dddc75Smrg[AC_PREREQ([2.65])dnl
43972b4363aSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
44072b4363aSmrgdnl the ones we care about.
44172b4363aSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
44272b4363aSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
44372b4363aSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44472b4363aSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44572b4363aSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44672b4363aSmrg  # is not polluted with repeated "-I."
44772b4363aSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44872b4363aSmrg  # test to see if srcdir already configured
44972b4363aSmrg  if test -f $srcdir/config.status; then
45072b4363aSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
45172b4363aSmrg  fi
45272b4363aSmrgfi
45372b4363aSmrg
45472b4363aSmrg# test whether we have cygpath
45572b4363aSmrgif test -z "$CYGPATH_W"; then
45672b4363aSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45772b4363aSmrg    CYGPATH_W='cygpath -w'
45872b4363aSmrg  else
45972b4363aSmrg    CYGPATH_W=echo
46072b4363aSmrg  fi
46172b4363aSmrgfi
46272b4363aSmrgAC_SUBST([CYGPATH_W])
46372b4363aSmrg
46472b4363aSmrg# Define the identity of the package.
46572b4363aSmrgdnl Distinguish between old-style and new-style calls.
46672b4363aSmrgm4_ifval([$2],
46733dddc75Smrg[AC_DIAGNOSE([obsolete],
46833dddc75Smrg             [$0: two- and three-arguments forms are deprecated.])
46933dddc75Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
47072b4363aSmrg AC_SUBST([PACKAGE], [$1])dnl
47172b4363aSmrg AC_SUBST([VERSION], [$2])],
47272b4363aSmrg[_AM_SET_OPTIONS([$1])dnl
47372b4363aSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47433dddc75Smrgm4_if(
47533dddc75Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
47633dddc75Smrg  [ok:ok],,
47772b4363aSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47872b4363aSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47972b4363aSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
48072b4363aSmrg
48172b4363aSmrg_AM_IF_OPTION([no-define],,
48233dddc75Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
48333dddc75Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
48472b4363aSmrg
48572b4363aSmrg# Some tools Automake needs.
48672b4363aSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48772b4363aSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48833dddc75SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48933dddc75SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
49033dddc75SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
49133dddc75SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
49233dddc75SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
493dd77ae96SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
494dd77ae96SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49533dddc75SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49633dddc75Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49733dddc75Smrg# dies out for good.  For more background, see:
49833dddc75Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49933dddc75Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
50033dddc75SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
50133dddc75Smrg# We need awk for the "check" target (and possibly the TAP driver).  The
50233dddc75Smrg# system "awk" is bad on some platforms.
50372b4363aSmrgAC_REQUIRE([AC_PROG_AWK])dnl
50472b4363aSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50572b4363aSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50672b4363aSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
507dd77ae96Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
508dd77ae96Smrg			     [_AM_PROG_TAR([v7])])])
50972b4363aSmrg_AM_IF_OPTION([no-dependencies],,
51072b4363aSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
51133dddc75Smrg		  [_AM_DEPENDENCIES([CC])],
51233dddc75Smrg		  [m4_define([AC_PROG_CC],
51333dddc75Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51472b4363aSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51533dddc75Smrg		  [_AM_DEPENDENCIES([CXX])],
51633dddc75Smrg		  [m4_define([AC_PROG_CXX],
51733dddc75Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51872b4363aSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51933dddc75Smrg		  [_AM_DEPENDENCIES([OBJC])],
52033dddc75Smrg		  [m4_define([AC_PROG_OBJC],
52133dddc75Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
52233dddc75SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
52333dddc75Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52433dddc75Smrg		  [m4_define([AC_PROG_OBJCXX],
52533dddc75Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52672b4363aSmrg])
52733dddc75SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
52833dddc75Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
52933dddc75Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
53033dddc75Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
531dd77ae96SmrgAC_CONFIG_COMMANDS_PRE(dnl
532dd77ae96Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
533dd77ae96Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
53433dddc75Smrg
53533dddc75Smrg# POSIX will say in a future version that running "rm -f" with no argument
53633dddc75Smrg# is OK; and we want to be able to make that assumption in our Makefile
53733dddc75Smrg# recipes.  So use an aggressive probe to check that the usage we want is
53833dddc75Smrg# actually supported "in the wild" to an acceptable degree.
53933dddc75Smrg# See automake bug#10828.
54033dddc75Smrg# To make any issue more visible, cause the running configure to be aborted
54133dddc75Smrg# by default if the 'rm' program in use doesn't match our expectations; the
54233dddc75Smrg# user can still override this though.
54333dddc75Smrgif rm -f && rm -fr && rm -rf; then : OK; else
54433dddc75Smrg  cat >&2 <<'END'
54533dddc75SmrgOops!
54633dddc75Smrg
54733dddc75SmrgYour 'rm' program seems unable to run without file operands specified
54833dddc75Smrgon the command line, even when the '-f' option is present.  This is contrary
54933dddc75Smrgto the behaviour of most rm programs out there, and not conforming with
55033dddc75Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
55133dddc75Smrg
55233dddc75SmrgPlease tell bug-automake@gnu.org about your system, including the value
55333dddc75Smrgof your $PATH and any error possibly output before this message.  This
55433dddc75Smrgcan help us improve future automake versions.
55533dddc75Smrg
55633dddc75SmrgEND
55733dddc75Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
55833dddc75Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
55933dddc75Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
56033dddc75Smrg    echo >&2
56133dddc75Smrg  else
56233dddc75Smrg    cat >&2 <<'END'
56333dddc75SmrgAborting the configuration process, to ensure you take notice of the issue.
56433dddc75Smrg
56533dddc75SmrgYou can download and install GNU coreutils to get an 'rm' implementation
56633dddc75Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
56733dddc75Smrg
56833dddc75SmrgIf you want to complete the configuration process using your problematic
56933dddc75Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
57033dddc75Smrgto "yes", and re-run configure.
57133dddc75Smrg
57233dddc75SmrgEND
57333dddc75Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
57433dddc75Smrg  fi
57533dddc75Smrgfi
57633dddc75Smrgdnl The trailing newline in this macro's definition is deliberate, for
57733dddc75Smrgdnl backward compatibility and to allow trailing 'dnl'-style comments
57833dddc75Smrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
57972b4363aSmrg])
58072b4363aSmrg
58133dddc75Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
582dd77ae96Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
583dd77ae96Smrgdnl mangled by Autoconf and run in a shell conditional statement.
584dd77ae96Smrgm4_define([_AC_COMPILER_EXEEXT],
585dd77ae96Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
586dd77ae96Smrg
58772b4363aSmrg# When config.status generates a header, we must update the stamp-h file.
58872b4363aSmrg# This file resides in the same directory as the config header
58972b4363aSmrg# that is generated.  The stamp files are numbered to have different names.
59072b4363aSmrg
59172b4363aSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
59272b4363aSmrg# loop where config.status creates the headers, so we can generate
59372b4363aSmrg# our stamp files there.
59472b4363aSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
59572b4363aSmrg[# Compute $1's index in $config_headers.
596dd77ae96Smrg_am_arg=$1
59772b4363aSmrg_am_stamp_count=1
59872b4363aSmrgfor _am_header in $config_headers :; do
59972b4363aSmrg  case $_am_header in
600dd77ae96Smrg    $_am_arg | $_am_arg:* )
60172b4363aSmrg      break ;;
60272b4363aSmrg    * )
60372b4363aSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
60472b4363aSmrg  esac
60572b4363aSmrgdone
606dd77ae96Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
60772b4363aSmrg
60833dddc75Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
60972b4363aSmrg#
61072b4363aSmrg# This file is free software; the Free Software Foundation
61172b4363aSmrg# gives unlimited permission to copy and/or distribute it,
61272b4363aSmrg# with or without modifications, as long as this notice is preserved.
61372b4363aSmrg
61472b4363aSmrg# AM_PROG_INSTALL_SH
61572b4363aSmrg# ------------------
61672b4363aSmrg# Define $install_sh.
61772b4363aSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
61872b4363aSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
61933dddc75Smrgif test x"${install_sh+set}" != xset; then
620dd77ae96Smrg  case $am_aux_dir in
621dd77ae96Smrg  *\ * | *\	*)
622dd77ae96Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
623dd77ae96Smrg  *)
624dd77ae96Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
625dd77ae96Smrg  esac
626dd77ae96Smrgfi
62733dddc75SmrgAC_SUBST([install_sh])])
62872b4363aSmrg
62933dddc75Smrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
63072b4363aSmrg#
63172b4363aSmrg# This file is free software; the Free Software Foundation
63272b4363aSmrg# gives unlimited permission to copy and/or distribute it,
63372b4363aSmrg# with or without modifications, as long as this notice is preserved.
63472b4363aSmrg
63572b4363aSmrg# Check whether the underlying file-system supports filenames
63672b4363aSmrg# with a leading dot.  For instance MS-DOS doesn't.
63772b4363aSmrgAC_DEFUN([AM_SET_LEADING_DOT],
63872b4363aSmrg[rm -rf .tst 2>/dev/null
63972b4363aSmrgmkdir .tst 2>/dev/null
64072b4363aSmrgif test -d .tst; then
64172b4363aSmrg  am__leading_dot=.
64272b4363aSmrgelse
64372b4363aSmrg  am__leading_dot=_
64472b4363aSmrgfi
64572b4363aSmrgrmdir .tst 2>/dev/null
64672b4363aSmrgAC_SUBST([am__leading_dot])])
64772b4363aSmrg
64872b4363aSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
64972b4363aSmrg
65033dddc75Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
65172b4363aSmrg#
65272b4363aSmrg# This file is free software; the Free Software Foundation
65372b4363aSmrg# gives unlimited permission to copy and/or distribute it,
65472b4363aSmrg# with or without modifications, as long as this notice is preserved.
65572b4363aSmrg
65672b4363aSmrg# AM_MAKE_INCLUDE()
65772b4363aSmrg# -----------------
65872b4363aSmrg# Check to see how make treats includes.
65972b4363aSmrgAC_DEFUN([AM_MAKE_INCLUDE],
66072b4363aSmrg[am_make=${MAKE-make}
66172b4363aSmrgcat > confinc << 'END'
66272b4363aSmrgam__doit:
663dd77ae96Smrg	@echo this is the am__doit target
66472b4363aSmrg.PHONY: am__doit
66572b4363aSmrgEND
66672b4363aSmrg# If we don't find an include directive, just comment out the code.
66772b4363aSmrgAC_MSG_CHECKING([for style of include used by $am_make])
66872b4363aSmrgam__include="#"
66972b4363aSmrgam__quote=
67072b4363aSmrg_am_result=none
67172b4363aSmrg# First try GNU make style include.
67272b4363aSmrgecho "include confinc" > confmf
67333dddc75Smrg# Ignore all kinds of additional output from 'make'.
674dd77ae96Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
675dd77ae96Smrg*the\ am__doit\ target*)
676dd77ae96Smrg  am__include=include
677dd77ae96Smrg  am__quote=
678dd77ae96Smrg  _am_result=GNU
679dd77ae96Smrg  ;;
680dd77ae96Smrgesac
68172b4363aSmrg# Now try BSD make style include.
68272b4363aSmrgif test "$am__include" = "#"; then
68372b4363aSmrg   echo '.include "confinc"' > confmf
684dd77ae96Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
685dd77ae96Smrg   *the\ am__doit\ target*)
686dd77ae96Smrg     am__include=.include
687dd77ae96Smrg     am__quote="\""
688dd77ae96Smrg     _am_result=BSD
689dd77ae96Smrg     ;;
690dd77ae96Smrg   esac
69172b4363aSmrgfi
69272b4363aSmrgAC_SUBST([am__include])
69372b4363aSmrgAC_SUBST([am__quote])
69472b4363aSmrgAC_MSG_RESULT([$_am_result])
69572b4363aSmrgrm -f confinc confmf
69672b4363aSmrg])
69772b4363aSmrg
69872b4363aSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
69972b4363aSmrg
70033dddc75Smrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
70172b4363aSmrg#
70272b4363aSmrg# This file is free software; the Free Software Foundation
70372b4363aSmrg# gives unlimited permission to copy and/or distribute it,
70472b4363aSmrg# with or without modifications, as long as this notice is preserved.
70572b4363aSmrg
70672b4363aSmrg# AM_MISSING_PROG(NAME, PROGRAM)
70772b4363aSmrg# ------------------------------
70872b4363aSmrgAC_DEFUN([AM_MISSING_PROG],
70972b4363aSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71072b4363aSmrg$1=${$1-"${am_missing_run}$2"}
71172b4363aSmrgAC_SUBST($1)])
71272b4363aSmrg
71372b4363aSmrg# AM_MISSING_HAS_RUN
71472b4363aSmrg# ------------------
71533dddc75Smrg# Define MISSING if not defined so far and test if it is modern enough.
71633dddc75Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
71772b4363aSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
71872b4363aSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
71972b4363aSmrgAC_REQUIRE_AUX_FILE([missing])dnl
720dd77ae96Smrgif test x"${MISSING+set}" != xset; then
721dd77ae96Smrg  case $am_aux_dir in
722dd77ae96Smrg  *\ * | *\	*)
723dd77ae96Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
724dd77ae96Smrg  *)
725dd77ae96Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
726dd77ae96Smrg  esac
727dd77ae96Smrgfi
72872b4363aSmrg# Use eval to expand $SHELL
72933dddc75Smrgif eval "$MISSING --is-lightweight"; then
73033dddc75Smrg  am_missing_run="$MISSING "
73172b4363aSmrgelse
73272b4363aSmrg  am_missing_run=
73333dddc75Smrg  AC_MSG_WARN(['missing' script is too old or missing])
73472b4363aSmrgfi
73572b4363aSmrg])
73672b4363aSmrg
73772b4363aSmrg# Helper functions for option handling.                     -*- Autoconf -*-
73872b4363aSmrg
73933dddc75Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
74072b4363aSmrg#
74172b4363aSmrg# This file is free software; the Free Software Foundation
74272b4363aSmrg# gives unlimited permission to copy and/or distribute it,
74372b4363aSmrg# with or without modifications, as long as this notice is preserved.
74472b4363aSmrg
74572b4363aSmrg# _AM_MANGLE_OPTION(NAME)
74672b4363aSmrg# -----------------------
74772b4363aSmrgAC_DEFUN([_AM_MANGLE_OPTION],
74872b4363aSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
74972b4363aSmrg
75072b4363aSmrg# _AM_SET_OPTION(NAME)
75133dddc75Smrg# --------------------
75272b4363aSmrg# Set option NAME.  Presently that only means defining a flag for this option.
75372b4363aSmrgAC_DEFUN([_AM_SET_OPTION],
75433dddc75Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
75572b4363aSmrg
75672b4363aSmrg# _AM_SET_OPTIONS(OPTIONS)
75733dddc75Smrg# ------------------------
75872b4363aSmrg# OPTIONS is a space-separated list of Automake options.
75972b4363aSmrgAC_DEFUN([_AM_SET_OPTIONS],
760dd77ae96Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
76172b4363aSmrg
76272b4363aSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76372b4363aSmrg# -------------------------------------------
76472b4363aSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76572b4363aSmrgAC_DEFUN([_AM_IF_OPTION],
76672b4363aSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76772b4363aSmrg
76833dddc75Smrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
76933dddc75Smrg#
77033dddc75Smrg# This file is free software; the Free Software Foundation
77133dddc75Smrg# gives unlimited permission to copy and/or distribute it,
77233dddc75Smrg# with or without modifications, as long as this notice is preserved.
77372b4363aSmrg
77433dddc75Smrg# _AM_PROG_CC_C_O
77533dddc75Smrg# ---------------
77633dddc75Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77733dddc75Smrg# to automatically call this.
77833dddc75SmrgAC_DEFUN([_AM_PROG_CC_C_O],
77933dddc75Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
78033dddc75SmrgAC_REQUIRE_AUX_FILE([compile])dnl
78133dddc75SmrgAC_LANG_PUSH([C])dnl
78233dddc75SmrgAC_CACHE_CHECK(
78333dddc75Smrg  [whether $CC understands -c and -o together],
78433dddc75Smrg  [am_cv_prog_cc_c_o],
78533dddc75Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78633dddc75Smrg  # Make sure it works both with $CC and with simple cc.
78733dddc75Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78833dddc75Smrg  # compilers refuse to overwrite an existing .o file with -o,
78933dddc75Smrg  # though they will create one.
79033dddc75Smrg  am_cv_prog_cc_c_o=yes
79133dddc75Smrg  for am_i in 1 2; do
79233dddc75Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79333dddc75Smrg         && test -f conftest2.$ac_objext; then
79433dddc75Smrg      : OK
79533dddc75Smrg    else
79633dddc75Smrg      am_cv_prog_cc_c_o=no
79733dddc75Smrg      break
79833dddc75Smrg    fi
79933dddc75Smrg  done
80033dddc75Smrg  rm -f core conftest*
80133dddc75Smrg  unset am_i])
80233dddc75Smrgif test "$am_cv_prog_cc_c_o" != yes; then
80333dddc75Smrg   # Losing compiler, so override with the script.
80433dddc75Smrg   # FIXME: It is wrong to rewrite CC.
80533dddc75Smrg   # But if we don't then we get into trouble of one sort or another.
80633dddc75Smrg   # A longer-term fix would be to have automake use am__CC in this case,
80733dddc75Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80833dddc75Smrg   CC="$am_aux_dir/compile $CC"
80933dddc75Smrgfi
81033dddc75SmrgAC_LANG_POP([C])])
81133dddc75Smrg
81233dddc75Smrg# For backward compatibility.
81333dddc75SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
81433dddc75Smrg
81533dddc75Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
81672b4363aSmrg#
81772b4363aSmrg# This file is free software; the Free Software Foundation
81872b4363aSmrg# gives unlimited permission to copy and/or distribute it,
81972b4363aSmrg# with or without modifications, as long as this notice is preserved.
82072b4363aSmrg
82133dddc75Smrg# AM_RUN_LOG(COMMAND)
82233dddc75Smrg# -------------------
82333dddc75Smrg# Run COMMAND, save the exit status in ac_status, and log it.
82433dddc75Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82533dddc75SmrgAC_DEFUN([AM_RUN_LOG],
82633dddc75Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82733dddc75Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82833dddc75Smrg   ac_status=$?
82933dddc75Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
83033dddc75Smrg   (exit $ac_status); }])
83133dddc75Smrg
83233dddc75Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
83333dddc75Smrg
83433dddc75Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
83533dddc75Smrg#
83633dddc75Smrg# This file is free software; the Free Software Foundation
83733dddc75Smrg# gives unlimited permission to copy and/or distribute it,
83833dddc75Smrg# with or without modifications, as long as this notice is preserved.
83972b4363aSmrg
84072b4363aSmrg# AM_SANITY_CHECK
84172b4363aSmrg# ---------------
84272b4363aSmrgAC_DEFUN([AM_SANITY_CHECK],
84372b4363aSmrg[AC_MSG_CHECKING([whether build environment is sane])
844dd77ae96Smrg# Reject unsafe characters in $srcdir or the absolute working directory
845dd77ae96Smrg# name.  Accept space and tab only in the latter.
846dd77ae96Smrgam_lf='
847dd77ae96Smrg'
848dd77ae96Smrgcase `pwd` in
849dd77ae96Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
850dd77ae96Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
851dd77ae96Smrgesac
852dd77ae96Smrgcase $srcdir in
853dd77ae96Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85433dddc75Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
855dd77ae96Smrgesac
856dd77ae96Smrg
85733dddc75Smrg# Do 'set' in a subshell so we don't clobber the current shell's
85872b4363aSmrg# arguments.  Must try -L first in case configure is actually a
85972b4363aSmrg# symlink; some systems play weird games with the mod time of symlinks
86072b4363aSmrg# (eg FreeBSD returns the mod time of the symlink's containing
86172b4363aSmrg# directory).
86272b4363aSmrgif (
86333dddc75Smrg   am_has_slept=no
86433dddc75Smrg   for am_try in 1 2; do
86533dddc75Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86633dddc75Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86733dddc75Smrg     if test "$[*]" = "X"; then
86833dddc75Smrg	# -L didn't work.
86933dddc75Smrg	set X `ls -t "$srcdir/configure" conftest.file`
87033dddc75Smrg     fi
87133dddc75Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
87233dddc75Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
87333dddc75Smrg
87433dddc75Smrg	# If neither matched, then we have a broken ls.  This can happen
87533dddc75Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87633dddc75Smrg	# broken ls alias from the environment.  This has actually
87733dddc75Smrg	# happened.  Such a system could not be considered "sane".
87833dddc75Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87933dddc75Smrg  alias in your environment])
88033dddc75Smrg     fi
88133dddc75Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
88233dddc75Smrg       break
88333dddc75Smrg     fi
88433dddc75Smrg     # Just in case.
88533dddc75Smrg     sleep 1
88633dddc75Smrg     am_has_slept=yes
88733dddc75Smrg   done
88872b4363aSmrg   test "$[2]" = conftest.file
88972b4363aSmrg   )
89072b4363aSmrgthen
89172b4363aSmrg   # Ok.
89272b4363aSmrg   :
89372b4363aSmrgelse
89472b4363aSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
89572b4363aSmrgCheck your system clock])
89672b4363aSmrgfi
89733dddc75SmrgAC_MSG_RESULT([yes])
89833dddc75Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89933dddc75Smrg# generated files are strictly newer.
90033dddc75Smrgam_sleep_pid=
90133dddc75Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
90233dddc75Smrg  ( sleep 1 ) &
90333dddc75Smrg  am_sleep_pid=$!
90433dddc75Smrgfi
90533dddc75SmrgAC_CONFIG_COMMANDS_PRE(
90633dddc75Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90733dddc75Smrg   if test -n "$am_sleep_pid"; then
90833dddc75Smrg     # Hide warnings about reused PIDs.
90933dddc75Smrg     wait $am_sleep_pid 2>/dev/null
91033dddc75Smrg   fi
91133dddc75Smrg   AC_MSG_RESULT([done])])
91233dddc75Smrgrm -f conftest.file
91333dddc75Smrg])
91472b4363aSmrg
91533dddc75Smrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
916dd77ae96Smrg#
917dd77ae96Smrg# This file is free software; the Free Software Foundation
918dd77ae96Smrg# gives unlimited permission to copy and/or distribute it,
919dd77ae96Smrg# with or without modifications, as long as this notice is preserved.
920dd77ae96Smrg
921dd77ae96Smrg# AM_SILENT_RULES([DEFAULT])
922dd77ae96Smrg# --------------------------
923dd77ae96Smrg# Enable less verbose build rules; with the default set to DEFAULT
92433dddc75Smrg# ("yes" being less verbose, "no" or empty being verbose).
925dd77ae96SmrgAC_DEFUN([AM_SILENT_RULES],
92633dddc75Smrg[AC_ARG_ENABLE([silent-rules], [dnl
92733dddc75SmrgAS_HELP_STRING(
92833dddc75Smrg  [--enable-silent-rules],
92933dddc75Smrg  [less verbose build output (undo: "make V=1")])
93033dddc75SmrgAS_HELP_STRING(
93133dddc75Smrg  [--disable-silent-rules],
93233dddc75Smrg  [verbose build output (undo: "make V=0")])dnl
93333dddc75Smrg])
93433dddc75Smrgcase $enable_silent_rules in @%:@ (((
93533dddc75Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
93633dddc75Smrg   no) AM_DEFAULT_VERBOSITY=1;;
93733dddc75Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
938dd77ae96Smrgesac
93933dddc75Smrgdnl
94033dddc75Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
94133dddc75Smrgdnl do not support nested variable expansions.
94233dddc75Smrgdnl See automake bug#9928 and bug#10237.
94333dddc75Smrgam_make=${MAKE-make}
94433dddc75SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94533dddc75Smrg   [am_cv_make_support_nested_variables],
94633dddc75Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94733dddc75SmrgBAR0=false
94833dddc75SmrgBAR1=true
94933dddc75SmrgV=1
95033dddc75Smrgam__doit:
95133dddc75Smrg	@$(TRUE)
95233dddc75Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95333dddc75Smrg  am_cv_make_support_nested_variables=yes
95433dddc75Smrgelse
95533dddc75Smrg  am_cv_make_support_nested_variables=no
95633dddc75Smrgfi])
95733dddc75Smrgif test $am_cv_make_support_nested_variables = yes; then
95833dddc75Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95933dddc75Smrg  AM_V='$(V)'
96033dddc75Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
96133dddc75Smrgelse
96233dddc75Smrg  AM_V=$AM_DEFAULT_VERBOSITY
96333dddc75Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
96433dddc75Smrgfi
96533dddc75SmrgAC_SUBST([AM_V])dnl
96633dddc75SmrgAM_SUBST_NOTMAKE([AM_V])dnl
96733dddc75SmrgAC_SUBST([AM_DEFAULT_V])dnl
96833dddc75SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
969dd77ae96SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
970dd77ae96SmrgAM_BACKSLASH='\'
971dd77ae96SmrgAC_SUBST([AM_BACKSLASH])dnl
972dd77ae96Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
973dd77ae96Smrg])
974dd77ae96Smrg
97533dddc75Smrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
97672b4363aSmrg#
97772b4363aSmrg# This file is free software; the Free Software Foundation
97872b4363aSmrg# gives unlimited permission to copy and/or distribute it,
97972b4363aSmrg# with or without modifications, as long as this notice is preserved.
98072b4363aSmrg
98172b4363aSmrg# AM_PROG_INSTALL_STRIP
98272b4363aSmrg# ---------------------
98333dddc75Smrg# One issue with vendor 'install' (even GNU) is that you can't
98472b4363aSmrg# specify the program used to strip binaries.  This is especially
98572b4363aSmrg# annoying in cross-compiling environments, where the build's strip
98672b4363aSmrg# is unlikely to handle the host's binaries.
98772b4363aSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98833dddc75Smrg# always use install-sh in "make install-strip", and initialize
98972b4363aSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
99072b4363aSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
99172b4363aSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
99233dddc75Smrg# Installed binaries are usually stripped using 'strip' when the user
99333dddc75Smrg# run "make install-strip".  However 'strip' might not be the right
99472b4363aSmrg# tool to use in cross-compilation environments, therefore Automake
99533dddc75Smrg# will honor the 'STRIP' environment variable to overrule this program.
99633dddc75Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99772b4363aSmrgif test "$cross_compiling" != no; then
99872b4363aSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
99972b4363aSmrgfi
100072b4363aSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
100172b4363aSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
100272b4363aSmrg
100333dddc75Smrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
100472b4363aSmrg#
100572b4363aSmrg# This file is free software; the Free Software Foundation
100672b4363aSmrg# gives unlimited permission to copy and/or distribute it,
100772b4363aSmrg# with or without modifications, as long as this notice is preserved.
100872b4363aSmrg
100972b4363aSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
101072b4363aSmrg# ---------------------------
1011dd77ae96Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101272b4363aSmrg# This macro is traced by Automake.
101372b4363aSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101472b4363aSmrg
1015dd77ae96Smrg# AM_SUBST_NOTMAKE(VARIABLE)
101633dddc75Smrg# --------------------------
1017dd77ae96Smrg# Public sister of _AM_SUBST_NOTMAKE.
1018dd77ae96SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1019dd77ae96Smrg
102072b4363aSmrg# Check how to create a tarball.                            -*- Autoconf -*-
102172b4363aSmrg
102233dddc75Smrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
102372b4363aSmrg#
102472b4363aSmrg# This file is free software; the Free Software Foundation
102572b4363aSmrg# gives unlimited permission to copy and/or distribute it,
102672b4363aSmrg# with or without modifications, as long as this notice is preserved.
102772b4363aSmrg
102872b4363aSmrg# _AM_PROG_TAR(FORMAT)
102972b4363aSmrg# --------------------
103072b4363aSmrg# Check how to create a tarball in format FORMAT.
103133dddc75Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
103272b4363aSmrg#
103372b4363aSmrg# Substitute a variable $(am__tar) that is a command
103472b4363aSmrg# writing to stdout a FORMAT-tarball containing the directory
103572b4363aSmrg# $tardir.
103672b4363aSmrg#     tardir=directory && $(am__tar) > result.tar
103772b4363aSmrg#
103872b4363aSmrg# Substitute a variable $(am__untar) that extract such
103972b4363aSmrg# a tarball read from stdin.
104072b4363aSmrg#     $(am__untar) < result.tar
104133dddc75Smrg#
104272b4363aSmrgAC_DEFUN([_AM_PROG_TAR],
104333dddc75Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104433dddc75Smrg# in the wild :-(  We should find a proper way to deprecate it ...
104533dddc75SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
104633dddc75Smrg
104733dddc75Smrg# We'll loop over all known methods to create a tar archive until one works.
104872b4363aSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
104972b4363aSmrg
105033dddc75Smrgm4_if([$1], [v7],
105133dddc75Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
105233dddc75Smrg
105333dddc75Smrg  [m4_case([$1],
105433dddc75Smrg    [ustar],
105533dddc75Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105633dddc75Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105733dddc75Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105833dddc75Smrg      # and bug#13588).
105933dddc75Smrg      am_max_uid=2097151 # 2^21 - 1
106033dddc75Smrg      am_max_gid=$am_max_uid
106133dddc75Smrg      # The $UID and $GID variables are not portable, so we need to resort
106233dddc75Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106333dddc75Smrg      # below are definitely unexpected, so allow the users to see them
106433dddc75Smrg      # (that is, avoid stderr redirection).
106533dddc75Smrg      am_uid=`id -u || echo unknown`
106633dddc75Smrg      am_gid=`id -g || echo unknown`
106733dddc75Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106833dddc75Smrg      if test $am_uid -le $am_max_uid; then
106933dddc75Smrg         AC_MSG_RESULT([yes])
107033dddc75Smrg      else
107133dddc75Smrg         AC_MSG_RESULT([no])
107233dddc75Smrg         _am_tools=none
107333dddc75Smrg      fi
107433dddc75Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107533dddc75Smrg      if test $am_gid -le $am_max_gid; then
107633dddc75Smrg         AC_MSG_RESULT([yes])
107733dddc75Smrg      else
107833dddc75Smrg        AC_MSG_RESULT([no])
107933dddc75Smrg        _am_tools=none
108033dddc75Smrg      fi],
108133dddc75Smrg
108233dddc75Smrg  [pax],
108333dddc75Smrg    [],
108433dddc75Smrg
108533dddc75Smrg  [m4_fatal([Unknown tar format])])
108633dddc75Smrg
108733dddc75Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
108833dddc75Smrg
108933dddc75Smrg  # Go ahead even if we have the value already cached.  We do so because we
109033dddc75Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
109133dddc75Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
109233dddc75Smrg
109333dddc75Smrg  for _am_tool in $_am_tools; do
109433dddc75Smrg    case $_am_tool in
109533dddc75Smrg    gnutar)
109633dddc75Smrg      for _am_tar in tar gnutar gtar; do
109733dddc75Smrg        AM_RUN_LOG([$_am_tar --version]) && break
109833dddc75Smrg      done
109933dddc75Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
110033dddc75Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
110133dddc75Smrg      am__untar="$_am_tar -xf -"
110233dddc75Smrg      ;;
110333dddc75Smrg    plaintar)
110433dddc75Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110533dddc75Smrg      # ustar tarball either.
110633dddc75Smrg      (tar --version) >/dev/null 2>&1 && continue
110733dddc75Smrg      am__tar='tar chf - "$$tardir"'
110833dddc75Smrg      am__tar_='tar chf - "$tardir"'
110933dddc75Smrg      am__untar='tar xf -'
111033dddc75Smrg      ;;
111133dddc75Smrg    pax)
111233dddc75Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
111333dddc75Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
111433dddc75Smrg      am__untar='pax -r'
111533dddc75Smrg      ;;
111633dddc75Smrg    cpio)
111733dddc75Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111833dddc75Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111933dddc75Smrg      am__untar='cpio -i -H $1 -d'
112033dddc75Smrg      ;;
112133dddc75Smrg    none)
112233dddc75Smrg      am__tar=false
112333dddc75Smrg      am__tar_=false
112433dddc75Smrg      am__untar=false
112533dddc75Smrg      ;;
112633dddc75Smrg    esac
112772b4363aSmrg
112833dddc75Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
112933dddc75Smrg    # and am__untar set.
113033dddc75Smrg    test -n "${am_cv_prog_tar_$1}" && break
113133dddc75Smrg
113233dddc75Smrg    # tar/untar a dummy directory, and stop if the command works.
113333dddc75Smrg    rm -rf conftest.dir
113433dddc75Smrg    mkdir conftest.dir
113533dddc75Smrg    echo GrepMe > conftest.dir/file
113633dddc75Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113733dddc75Smrg    rm -rf conftest.dir
113833dddc75Smrg    if test -s conftest.tar; then
113933dddc75Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
114033dddc75Smrg      AM_RUN_LOG([cat conftest.dir/file])
114133dddc75Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
114233dddc75Smrg    fi
114333dddc75Smrg  done
114472b4363aSmrg  rm -rf conftest.dir
114572b4363aSmrg
114633dddc75Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114733dddc75Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
114833dddc75Smrg
114972b4363aSmrgAC_SUBST([am__tar])
115072b4363aSmrgAC_SUBST([am__untar])
115172b4363aSmrg]) # _AM_PROG_TAR
115272b4363aSmrg
1153eea2e341Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1154eea2e341Smrg# 
1155eea2e341Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1156eea2e341Smrg#
1157eea2e341Smrg# This program is free software; you can redistribute it and/or modify
1158eea2e341Smrg# it under the terms of the GNU General Public License as published by
1159eea2e341Smrg# the Free Software Foundation; either version 2 of the License, or
1160eea2e341Smrg# (at your option) any later version.
1161eea2e341Smrg#
1162eea2e341Smrg# This program is distributed in the hope that it will be useful, but
1163eea2e341Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1164eea2e341Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1165eea2e341Smrg# General Public License for more details.
1166eea2e341Smrg#
1167eea2e341Smrg# You should have received a copy of the GNU General Public License
1168eea2e341Smrg# along with this program; if not, write to the Free Software
1169eea2e341Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1170eea2e341Smrg#
1171eea2e341Smrg# As a special exception to the GNU General Public License, if you
1172eea2e341Smrg# distribute this file as part of a program that contains a
1173eea2e341Smrg# configuration script generated by Autoconf, you may include it under
1174eea2e341Smrg# the same distribution terms that you use for the rest of that program.
1175eea2e341Smrg
1176eea2e341Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1177eea2e341Smrg# ----------------------------------
1178eea2e341SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1179eea2e341Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1180eea2e341Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1181eea2e341SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1182eea2e341Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1183eea2e341Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1184eea2e341Smrgfi
1185eea2e341Smrgif test -n "$PKG_CONFIG"; then
1186eea2e341Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1187eea2e341Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1188eea2e341Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1189eea2e341Smrg		AC_MSG_RESULT([yes])
1190eea2e341Smrg	else
1191eea2e341Smrg		AC_MSG_RESULT([no])
1192eea2e341Smrg		PKG_CONFIG=""
1193eea2e341Smrg	fi
1194eea2e341Smrg		
1195eea2e341Smrgfi[]dnl
1196eea2e341Smrg])# PKG_PROG_PKG_CONFIG
1197eea2e341Smrg
1198eea2e341Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1199eea2e341Smrg#
1200eea2e341Smrg# Check to see whether a particular set of modules exists.  Similar
1201eea2e341Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1202eea2e341Smrg#
1203eea2e341Smrg#
1204eea2e341Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1205eea2e341Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
1206eea2e341Smrg# PKG_CHECK_EXISTS manually
1207eea2e341Smrg# --------------------------------------------------------------
1208eea2e341SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1209eea2e341Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1210eea2e341Smrgif test -n "$PKG_CONFIG" && \
1211eea2e341Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1212eea2e341Smrg  m4_ifval([$2], [$2], [:])
1213eea2e341Smrgm4_ifvaln([$3], [else
1214eea2e341Smrg  $3])dnl
1215eea2e341Smrgfi])
1216eea2e341Smrg
1217eea2e341Smrg
1218eea2e341Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1219eea2e341Smrg# ---------------------------------------------
1220eea2e341Smrgm4_define([_PKG_CONFIG],
1221eea2e341Smrg[if test -n "$$1"; then
1222eea2e341Smrg    pkg_cv_[]$1="$$1"
1223eea2e341Smrg elif test -n "$PKG_CONFIG"; then
1224eea2e341Smrg    PKG_CHECK_EXISTS([$3],
1225eea2e341Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1226eea2e341Smrg		     [pkg_failed=yes])
1227eea2e341Smrg else
1228eea2e341Smrg    pkg_failed=untried
1229eea2e341Smrgfi[]dnl
1230eea2e341Smrg])# _PKG_CONFIG
1231eea2e341Smrg
1232eea2e341Smrg# _PKG_SHORT_ERRORS_SUPPORTED
1233eea2e341Smrg# -----------------------------
1234eea2e341SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1235eea2e341Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1236eea2e341Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1237eea2e341Smrg        _pkg_short_errors_supported=yes
1238eea2e341Smrgelse
1239eea2e341Smrg        _pkg_short_errors_supported=no
1240eea2e341Smrgfi[]dnl
1241eea2e341Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
1242eea2e341Smrg
1243eea2e341Smrg
1244eea2e341Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1245eea2e341Smrg# [ACTION-IF-NOT-FOUND])
1246eea2e341Smrg#
1247eea2e341Smrg#
1248eea2e341Smrg# Note that if there is a possibility the first call to
1249eea2e341Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1250eea2e341Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1251eea2e341Smrg#
1252eea2e341Smrg#
1253eea2e341Smrg# --------------------------------------------------------------
1254eea2e341SmrgAC_DEFUN([PKG_CHECK_MODULES],
1255eea2e341Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1256eea2e341SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1257eea2e341SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1258eea2e341Smrg
1259eea2e341Smrgpkg_failed=no
1260eea2e341SmrgAC_MSG_CHECKING([for $1])
1261eea2e341Smrg
1262eea2e341Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1263eea2e341Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1264eea2e341Smrg
1265eea2e341Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1266eea2e341Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1267eea2e341SmrgSee the pkg-config man page for more details.])
1268eea2e341Smrg
1269eea2e341Smrgif test $pkg_failed = yes; then
1270eea2e341Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1271eea2e341Smrg        if test $_pkg_short_errors_supported = yes; then
1272eea2e341Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1273eea2e341Smrg        else 
1274eea2e341Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1275eea2e341Smrg        fi
1276eea2e341Smrg	# Put the nasty error message in config.log where it belongs
1277eea2e341Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1278eea2e341Smrg
1279eea2e341Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1280eea2e341Smrg[Package requirements ($2) were not met:
1281eea2e341Smrg
1282eea2e341Smrg$$1_PKG_ERRORS
1283eea2e341Smrg
1284eea2e341SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1285eea2e341Smrginstalled software in a non-standard prefix.
1286eea2e341Smrg
1287eea2e341Smrg_PKG_TEXT
1288eea2e341Smrg])],
1289eea2e341Smrg		[AC_MSG_RESULT([no])
1290eea2e341Smrg                $4])
1291eea2e341Smrgelif test $pkg_failed = untried; then
1292eea2e341Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1293eea2e341Smrg[The pkg-config script could not be found or is too old.  Make sure it
1294eea2e341Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1295eea2e341Smrgpath to pkg-config.
1296eea2e341Smrg
1297eea2e341Smrg_PKG_TEXT
1298eea2e341Smrg
1299eea2e341SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1300eea2e341Smrg		[$4])
1301eea2e341Smrgelse
1302eea2e341Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1303eea2e341Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1304eea2e341Smrg        AC_MSG_RESULT([yes])
1305eea2e341Smrg	ifelse([$3], , :, [$3])
1306eea2e341Smrgfi[]dnl
1307eea2e341Smrg])# PKG_CHECK_MODULES
1308eea2e341Smrg
1309dd77ae96Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
131072b4363aSmrgdnl
131108e312fdSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
131233dddc75Smrgdnl
131372b4363aSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
131408e312fdSmrgdnl copy of this software and associated documentation files (the "Software"),
131508e312fdSmrgdnl to deal in the Software without restriction, including without limitation
131608e312fdSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
131708e312fdSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
131808e312fdSmrgdnl Software is furnished to do so, subject to the following conditions:
131972b4363aSmrgdnl
132008e312fdSmrgdnl The above copyright notice and this permission notice (including the next
132108e312fdSmrgdnl paragraph) shall be included in all copies or substantial portions of the
132208e312fdSmrgdnl Software.
132372b4363aSmrgdnl
132408e312fdSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
132508e312fdSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
132608e312fdSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
132708e312fdSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
132808e312fdSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
132908e312fdSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
133008e312fdSmrgdnl DEALINGS IN THE SOFTWARE.
133172b4363aSmrg
133272b4363aSmrg# XORG_MACROS_VERSION(required-version)
133372b4363aSmrg# -------------------------------------
133472b4363aSmrg# Minimum version: 1.1.0
133572b4363aSmrg#
133672b4363aSmrg# If you're using a macro added in Version 1.1 or newer, include this in
133772b4363aSmrg# your configure.ac with the minimum required version, such as:
133872b4363aSmrg# XORG_MACROS_VERSION(1.1)
133972b4363aSmrg#
1340dd77ae96Smrg# To ensure that this macro is defined, also add:
1341dd77ae96Smrg# m4_ifndef([XORG_MACROS_VERSION],
1342dd77ae96Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
134372b4363aSmrg#
134472b4363aSmrg#
134533dddc75Smrg# See the "minimum version" comment for each macro you use to see what
134672b4363aSmrg# version you require.
1347dd77ae96Smrgm4_defun([XORG_MACROS_VERSION],[
134833dddc75Smrgm4_define([vers_have], [1.19.0])
1349dd77ae96Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1350dd77ae96Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1351dd77ae96Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1352dd77ae96Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1353dd77ae96Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1354dd77ae96Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1355dd77ae96Smrgm4_undefine([vers_have])
1356dd77ae96Smrgm4_undefine([maj_have])
1357dd77ae96Smrgm4_undefine([maj_needed])
135872b4363aSmrg]) # XORG_MACROS_VERSION
135972b4363aSmrg
136072b4363aSmrg# XORG_PROG_RAWCPP()
136172b4363aSmrg# ------------------
136272b4363aSmrg# Minimum version: 1.0.0
136372b4363aSmrg#
136472b4363aSmrg# Find cpp program and necessary flags for use in pre-processing text files
136572b4363aSmrg# such as man pages and config files
136672b4363aSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
136772b4363aSmrgAC_REQUIRE([AC_PROG_CPP])
136833dddc75SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
136972b4363aSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
137072b4363aSmrg
137172b4363aSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
137272b4363aSmrg# which is not the best choice for supporting other OS'es, but covers most
137372b4363aSmrg# of the ones we need for now.
137472b4363aSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1375eea2e341SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
137672b4363aSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
137772b4363aSmrg	AC_MSG_RESULT([no])
137872b4363aSmrgelse
137972b4363aSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
138072b4363aSmrg		RAWCPPFLAGS=-undef
138172b4363aSmrg		AC_MSG_RESULT([yes])
1382dd77ae96Smrg	# under Cygwin unix is still defined even with -undef
1383dd77ae96Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1384dd77ae96Smrg		RAWCPPFLAGS="-undef -ansi"
1385dd77ae96Smrg		AC_MSG_RESULT([yes, with -ansi])
138672b4363aSmrg	else
138772b4363aSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
138872b4363aSmrg	fi
138972b4363aSmrgfi
139072b4363aSmrgrm -f conftest.$ac_ext
139172b4363aSmrg
139272b4363aSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1393eea2e341SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
139472b4363aSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
139572b4363aSmrg	AC_MSG_RESULT([no])
139672b4363aSmrgelse
139772b4363aSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
139833dddc75Smrg		TRADITIONALCPPFLAGS="-traditional"
139972b4363aSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
140072b4363aSmrg		AC_MSG_RESULT([yes])
140172b4363aSmrg	else
140272b4363aSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
140372b4363aSmrg	fi
140472b4363aSmrgfi
140572b4363aSmrgrm -f conftest.$ac_ext
140672b4363aSmrgAC_SUBST(RAWCPPFLAGS)
140733dddc75SmrgAC_SUBST(TRADITIONALCPPFLAGS)
140872b4363aSmrg]) # XORG_PROG_RAWCPP
140972b4363aSmrg
141072b4363aSmrg# XORG_MANPAGE_SECTIONS()
141172b4363aSmrg# -----------------------
141272b4363aSmrg# Minimum version: 1.0.0
141372b4363aSmrg#
141472b4363aSmrg# Determine which sections man pages go in for the different man page types
141572b4363aSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
141672b4363aSmrg# Not sure if there's any better way than just hardcoding by OS name.
141772b4363aSmrg# Override default settings by setting environment variables
141808e312fdSmrg# Added MAN_SUBSTS in version 1.8
141908e312fdSmrg# Added AC_PROG_SED in version 1.8
142072b4363aSmrg
142172b4363aSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
142272b4363aSmrgAC_REQUIRE([AC_CANONICAL_HOST])
142308e312fdSmrgAC_REQUIRE([AC_PROG_SED])
142472b4363aSmrg
142572b4363aSmrgif test x$APP_MAN_SUFFIX = x    ; then
142672b4363aSmrg    APP_MAN_SUFFIX=1
142772b4363aSmrgfi
142872b4363aSmrgif test x$APP_MAN_DIR = x    ; then
142972b4363aSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
143072b4363aSmrgfi
143172b4363aSmrg
143272b4363aSmrgif test x$LIB_MAN_SUFFIX = x    ; then
143372b4363aSmrg    LIB_MAN_SUFFIX=3
143472b4363aSmrgfi
143572b4363aSmrgif test x$LIB_MAN_DIR = x    ; then
143672b4363aSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
143772b4363aSmrgfi
143872b4363aSmrg
143972b4363aSmrgif test x$FILE_MAN_SUFFIX = x    ; then
144072b4363aSmrg    case $host_os in
144172b4363aSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
144272b4363aSmrg	*)		FILE_MAN_SUFFIX=5  ;;
144372b4363aSmrg    esac
144472b4363aSmrgfi
144572b4363aSmrgif test x$FILE_MAN_DIR = x    ; then
144672b4363aSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
144772b4363aSmrgfi
144872b4363aSmrg
144972b4363aSmrgif test x$MISC_MAN_SUFFIX = x    ; then
145072b4363aSmrg    case $host_os in
145172b4363aSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
145272b4363aSmrg	*)		MISC_MAN_SUFFIX=7  ;;
145372b4363aSmrg    esac
145472b4363aSmrgfi
145572b4363aSmrgif test x$MISC_MAN_DIR = x    ; then
145672b4363aSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
145772b4363aSmrgfi
145872b4363aSmrg
145972b4363aSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
146072b4363aSmrg    case $host_os in
146172b4363aSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
146272b4363aSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
146372b4363aSmrg    esac
146472b4363aSmrgfi
146572b4363aSmrgif test x$DRIVER_MAN_DIR = x    ; then
146672b4363aSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
146772b4363aSmrgfi
146872b4363aSmrg
146972b4363aSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
147072b4363aSmrg    case $host_os in
147172b4363aSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
147272b4363aSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
147372b4363aSmrg    esac
147472b4363aSmrgfi
147572b4363aSmrgif test x$ADMIN_MAN_DIR = x    ; then
147672b4363aSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
147772b4363aSmrgfi
147872b4363aSmrg
147972b4363aSmrg
148072b4363aSmrgAC_SUBST([APP_MAN_SUFFIX])
148172b4363aSmrgAC_SUBST([LIB_MAN_SUFFIX])
148272b4363aSmrgAC_SUBST([FILE_MAN_SUFFIX])
148372b4363aSmrgAC_SUBST([MISC_MAN_SUFFIX])
148472b4363aSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
148572b4363aSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
148672b4363aSmrgAC_SUBST([APP_MAN_DIR])
148772b4363aSmrgAC_SUBST([LIB_MAN_DIR])
148872b4363aSmrgAC_SUBST([FILE_MAN_DIR])
148972b4363aSmrgAC_SUBST([MISC_MAN_DIR])
149072b4363aSmrgAC_SUBST([DRIVER_MAN_DIR])
149172b4363aSmrgAC_SUBST([ADMIN_MAN_DIR])
149208e312fdSmrg
149308e312fdSmrgXORG_MAN_PAGE="X Version 11"
149408e312fdSmrgAC_SUBST([XORG_MAN_PAGE])
149508e312fdSmrgMAN_SUBSTS="\
149608e312fdSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
149708e312fdSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
149808e312fdSmrg	-e 's|__xservername__|Xorg|g' \
149908e312fdSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
150008e312fdSmrg	-e 's|__projectroot__|\$(prefix)|g' \
150108e312fdSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
150208e312fdSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
150308e312fdSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
150408e312fdSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
150508e312fdSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
150608e312fdSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
150708e312fdSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
150808e312fdSmrgAC_SUBST([MAN_SUBSTS])
150908e312fdSmrg
151072b4363aSmrg]) # XORG_MANPAGE_SECTIONS
151172b4363aSmrg
151208e312fdSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
151308e312fdSmrg# ------------------------
151408e312fdSmrg# Minimum version: 1.7.0
151508e312fdSmrg#
151608e312fdSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
151708e312fdSmrg# provided by xorg-sgml-doctools, if installed.
151808e312fdSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
151908e312fdSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
152008e312fdSmrgXORG_SGML_PATH=
152108e312fdSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
152208e312fdSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
152308e312fdSmrg    [m4_ifval([$1],[:],
152408e312fdSmrg        [if test x"$cross_compiling" != x"yes" ; then
152508e312fdSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
152608e312fdSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
152708e312fdSmrg         fi])
152808e312fdSmrg    ])
152908e312fdSmrg
153008e312fdSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
153108e312fdSmrg# the path and the name of the doc stylesheet
153208e312fdSmrgif test "x$XORG_SGML_PATH" != "x" ; then
153308e312fdSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
153408e312fdSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
153508e312fdSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
153608e312fdSmrgelse
153708e312fdSmrg   AC_MSG_RESULT([no])
153808e312fdSmrgfi
153908e312fdSmrg
154008e312fdSmrgAC_SUBST(XORG_SGML_PATH)
154108e312fdSmrgAC_SUBST(STYLESHEET_SRCDIR)
154208e312fdSmrgAC_SUBST(XSL_STYLESHEET)
154308e312fdSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
154408e312fdSmrg]) # XORG_CHECK_SGML_DOCTOOLS
154508e312fdSmrg
154672b4363aSmrg# XORG_CHECK_LINUXDOC
154772b4363aSmrg# -------------------
154872b4363aSmrg# Minimum version: 1.0.0
154972b4363aSmrg#
155072b4363aSmrg# Defines the variable MAKE_TEXT if the necessary tools and
155172b4363aSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
155272b4363aSmrg# Whether or not the necessary tools and files are found can be checked
155372b4363aSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
155472b4363aSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
155508e312fdSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
155608e312fdSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
155772b4363aSmrg
155872b4363aSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
155972b4363aSmrg
156008e312fdSmrgAC_MSG_CHECKING([whether to build documentation])
156172b4363aSmrg
156208e312fdSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
156372b4363aSmrg   BUILDDOC=yes
156472b4363aSmrgelse
156572b4363aSmrg   BUILDDOC=no
156672b4363aSmrgfi
156772b4363aSmrg
156872b4363aSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
156972b4363aSmrg
157072b4363aSmrgAC_MSG_RESULT([$BUILDDOC])
157172b4363aSmrg
157208e312fdSmrgAC_MSG_CHECKING([whether to build pdf documentation])
157372b4363aSmrg
157408e312fdSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
157572b4363aSmrg   BUILDPDFDOC=yes
157672b4363aSmrgelse
157772b4363aSmrg   BUILDPDFDOC=no
157872b4363aSmrgfi
157972b4363aSmrg
158072b4363aSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
158172b4363aSmrg
158272b4363aSmrgAC_MSG_RESULT([$BUILDPDFDOC])
158372b4363aSmrg
158408e312fdSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
158572b4363aSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
158672b4363aSmrgMAKE_PDF="$PS2PDF"
158772b4363aSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
158872b4363aSmrg
158972b4363aSmrgAC_SUBST(MAKE_TEXT)
159072b4363aSmrgAC_SUBST(MAKE_PS)
159172b4363aSmrgAC_SUBST(MAKE_PDF)
159272b4363aSmrgAC_SUBST(MAKE_HTML)
159372b4363aSmrg]) # XORG_CHECK_LINUXDOC
159472b4363aSmrg
159572b4363aSmrg# XORG_CHECK_DOCBOOK
159672b4363aSmrg# -------------------
159772b4363aSmrg# Minimum version: 1.0.0
159872b4363aSmrg#
159972b4363aSmrg# Checks for the ability to build output formats from SGML DocBook source.
160072b4363aSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
160172b4363aSmrg# indicates whether the necessary tools and files are found and, if set,
160272b4363aSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
160372b4363aSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
160408e312fdSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
160508e312fdSmrg
160672b4363aSmrgBUILDTXTDOC=no
160772b4363aSmrgBUILDPDFDOC=no
160872b4363aSmrgBUILDPSDOC=no
160972b4363aSmrgBUILDHTMLDOC=no
161072b4363aSmrg
161172b4363aSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
161272b4363aSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
161372b4363aSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
161472b4363aSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
161572b4363aSmrg
161608e312fdSmrgAC_MSG_CHECKING([whether to build text documentation])
161708e312fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
161872b4363aSmrg   test x$BUILD_TXTDOC != xno; then
161972b4363aSmrg	BUILDTXTDOC=yes
162072b4363aSmrgfi
162172b4363aSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
162272b4363aSmrgAC_MSG_RESULT([$BUILDTXTDOC])
162372b4363aSmrg
162408e312fdSmrgAC_MSG_CHECKING([whether to build PDF documentation])
162508e312fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
162672b4363aSmrg   test x$BUILD_PDFDOC != xno; then
162772b4363aSmrg	BUILDPDFDOC=yes
162872b4363aSmrgfi
162972b4363aSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
163072b4363aSmrgAC_MSG_RESULT([$BUILDPDFDOC])
163172b4363aSmrg
163208e312fdSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
163308e312fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
163472b4363aSmrg   test x$BUILD_PSDOC != xno; then
163572b4363aSmrg	BUILDPSDOC=yes
163672b4363aSmrgfi
163772b4363aSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
163872b4363aSmrgAC_MSG_RESULT([$BUILDPSDOC])
163972b4363aSmrg
164008e312fdSmrgAC_MSG_CHECKING([whether to build HTML documentation])
164108e312fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
164272b4363aSmrg   test x$BUILD_HTMLDOC != xno; then
164372b4363aSmrg	BUILDHTMLDOC=yes
164472b4363aSmrgfi
164572b4363aSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
164672b4363aSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
164772b4363aSmrg
164872b4363aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
164972b4363aSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
165072b4363aSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
165172b4363aSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
165272b4363aSmrg
165372b4363aSmrgAC_SUBST(MAKE_TEXT)
165472b4363aSmrgAC_SUBST(MAKE_PS)
165572b4363aSmrgAC_SUBST(MAKE_PDF)
165672b4363aSmrgAC_SUBST(MAKE_HTML)
165772b4363aSmrg]) # XORG_CHECK_DOCBOOK
165872b4363aSmrg
165908e312fdSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
166008e312fdSmrg# ----------------
166108e312fdSmrg# Minimum version: 1.5.0
166208e312fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
166308e312fdSmrg#
166408e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
166508e312fdSmrg# not at the appropriate level. This macro enables a module to test for the
166608e312fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
166708e312fdSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
166808e312fdSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
166908e312fdSmrg# --with-xmlto assumes 'auto'.
167008e312fdSmrg#
167108e312fdSmrg# Interface to module:
167208e312fdSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
167308e312fdSmrg# XMLTO:	returns the path of the xmlto program found
167408e312fdSmrg#		returns the path set by the user in the environment
167508e312fdSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
167608e312fdSmrg#		'no' user instructs the module not to use xmlto
167708e312fdSmrg#
167808e312fdSmrg# Added in version 1.10.0
167908e312fdSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
168008e312fdSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
168108e312fdSmrg#
168208e312fdSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
168308e312fdSmrg#
168408e312fdSmrgAC_DEFUN([XORG_WITH_XMLTO],[
168508e312fdSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
168608e312fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
168708e312fdSmrgAC_ARG_WITH(xmlto,
168808e312fdSmrg	AS_HELP_STRING([--with-xmlto],
168908e312fdSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
169008e312fdSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
169108e312fdSmrgm4_undefine([_defopt])
169208e312fdSmrg
169308e312fdSmrgif test "x$use_xmlto" = x"auto"; then
169408e312fdSmrg   AC_PATH_PROG([XMLTO], [xmlto])
169508e312fdSmrg   if test "x$XMLTO" = "x"; then
169608e312fdSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
169708e312fdSmrg	have_xmlto=no
169808e312fdSmrg   else
169908e312fdSmrg        have_xmlto=yes
170008e312fdSmrg   fi
170108e312fdSmrgelif test "x$use_xmlto" = x"yes" ; then
170208e312fdSmrg   AC_PATH_PROG([XMLTO], [xmlto])
170308e312fdSmrg   if test "x$XMLTO" = "x"; then
170408e312fdSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
170508e312fdSmrg   fi
170608e312fdSmrg   have_xmlto=yes
170708e312fdSmrgelif test "x$use_xmlto" = x"no" ; then
170808e312fdSmrg   if test "x$XMLTO" != "x"; then
170908e312fdSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
171008e312fdSmrg   fi
171108e312fdSmrg   have_xmlto=no
171208e312fdSmrgelse
171308e312fdSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
171408e312fdSmrgfi
171508e312fdSmrg
171608e312fdSmrg# Test for a minimum version of xmlto, if provided.
171708e312fdSmrgm4_ifval([$1],
171808e312fdSmrg[if test "$have_xmlto" = yes; then
171908e312fdSmrg    # scrape the xmlto version
172008e312fdSmrg    AC_MSG_CHECKING([the xmlto version])
172108e312fdSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
172208e312fdSmrg    AC_MSG_RESULT([$xmlto_version])
172308e312fdSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
172408e312fdSmrg        [if test "x$use_xmlto" = xauto; then
172508e312fdSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
172608e312fdSmrg            have_xmlto=no
172708e312fdSmrg        else
172808e312fdSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
172908e312fdSmrg        fi])
173008e312fdSmrgfi])
173108e312fdSmrg
173208e312fdSmrg# Test for the ability of xmlto to generate a text target
173308e312fdSmrghave_xmlto_text=no
173408e312fdSmrgcat > conftest.xml << "EOF"
173508e312fdSmrgEOF
173608e312fdSmrgAS_IF([test "$have_xmlto" = yes],
173708e312fdSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
173808e312fdSmrg             [have_xmlto_text=yes],
173908e312fdSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
174008e312fdSmrgrm -f conftest.xml
174108e312fdSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
174208e312fdSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
174308e312fdSmrg]) # XORG_WITH_XMLTO
174408e312fdSmrg
1745eea2e341Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1746eea2e341Smrg# --------------------------------------------
1747eea2e341Smrg# Minimum version: 1.12.0
1748eea2e341Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1749eea2e341Smrg#
1750eea2e341Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1751eea2e341Smrg# XML-based language used for the transformation of XML documents.
1752eea2e341Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1753eea2e341Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1754eea2e341Smrg# The XSLT processor is often used as a standalone tool for transformations.
1755eea2e341Smrg# It should not be assumed that this tool is used only to work with documnetation.
1756eea2e341Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1757eea2e341Smrg#
1758eea2e341Smrg# Interface to module:
1759eea2e341Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1760eea2e341Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1761eea2e341Smrg#		 returns the path set by the user in the environment
1762eea2e341Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1763eea2e341Smrg#		  'no' user instructs the module not to use xsltproc
1764eea2e341Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1765eea2e341Smrg#
1766eea2e341Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1767eea2e341Smrg#
1768eea2e341SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1769eea2e341SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1770eea2e341Smrg# Preserves the interface, should it be implemented later
1771eea2e341Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1772eea2e341Smrgm4_define([_defopt], m4_default([$2], [auto]))
1773eea2e341SmrgAC_ARG_WITH(xsltproc,
1774eea2e341Smrg	AS_HELP_STRING([--with-xsltproc],
1775eea2e341Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1776eea2e341Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1777eea2e341Smrgm4_undefine([_defopt])
1778eea2e341Smrg
1779eea2e341Smrgif test "x$use_xsltproc" = x"auto"; then
1780eea2e341Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1781eea2e341Smrg   if test "x$XSLTPROC" = "x"; then
1782eea2e341Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1783eea2e341Smrg	have_xsltproc=no
1784eea2e341Smrg   else
1785eea2e341Smrg        have_xsltproc=yes
1786eea2e341Smrg   fi
1787eea2e341Smrgelif test "x$use_xsltproc" = x"yes" ; then
1788eea2e341Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1789eea2e341Smrg   if test "x$XSLTPROC" = "x"; then
1790eea2e341Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1791eea2e341Smrg   fi
1792eea2e341Smrg   have_xsltproc=yes
1793eea2e341Smrgelif test "x$use_xsltproc" = x"no" ; then
1794eea2e341Smrg   if test "x$XSLTPROC" != "x"; then
1795eea2e341Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1796eea2e341Smrg   fi
1797eea2e341Smrg   have_xsltproc=no
1798eea2e341Smrgelse
1799eea2e341Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1800eea2e341Smrgfi
1801eea2e341Smrg
1802eea2e341SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1803eea2e341Smrg]) # XORG_WITH_XSLTPROC
1804eea2e341Smrg
1805eea2e341Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1806eea2e341Smrg# ----------------------------------------
1807eea2e341Smrg# Minimum version: 1.15.0
1808eea2e341Smrg#
1809eea2e341Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1810eea2e341Smrg# scanning arbitrary text files, extracting information from those text files,
1811eea2e341Smrg# and printing reports based on that information.
1812eea2e341Smrg#
1813eea2e341Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1814eea2e341Smrg#
1815eea2e341Smrg# Interface to module:
1816eea2e341Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1817eea2e341Smrg# PERL:	     returns the path of the perl program found
1818eea2e341Smrg#	     returns the path set by the user in the environment
1819eea2e341Smrg# --with-perl: 'yes' user instructs the module to use perl
1820eea2e341Smrg#	       'no' user instructs the module not to use perl
1821eea2e341Smrg# have_perl: returns yes if perl found in PATH or no
1822eea2e341Smrg#
1823eea2e341Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1824eea2e341Smrg#
1825eea2e341SmrgAC_DEFUN([XORG_WITH_PERL],[
1826eea2e341SmrgAC_ARG_VAR([PERL], [Path to perl command])
1827eea2e341Smrg# Preserves the interface, should it be implemented later
1828eea2e341Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1829eea2e341Smrgm4_define([_defopt], m4_default([$2], [auto]))
1830eea2e341SmrgAC_ARG_WITH(perl,
1831eea2e341Smrg	AS_HELP_STRING([--with-perl],
1832eea2e341Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1833eea2e341Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1834eea2e341Smrgm4_undefine([_defopt])
1835eea2e341Smrg
1836eea2e341Smrgif test "x$use_perl" = x"auto"; then
1837eea2e341Smrg   AC_PATH_PROG([PERL], [perl])
1838eea2e341Smrg   if test "x$PERL" = "x"; then
1839eea2e341Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1840eea2e341Smrg	have_perl=no
1841eea2e341Smrg   else
1842eea2e341Smrg        have_perl=yes
1843eea2e341Smrg   fi
1844eea2e341Smrgelif test "x$use_perl" = x"yes" ; then
1845eea2e341Smrg   AC_PATH_PROG([PERL], [perl])
1846eea2e341Smrg   if test "x$PERL" = "x"; then
1847eea2e341Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1848eea2e341Smrg   fi
1849eea2e341Smrg   have_perl=yes
1850eea2e341Smrgelif test "x$use_perl" = x"no" ; then
1851eea2e341Smrg   if test "x$PERL" != "x"; then
1852eea2e341Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1853eea2e341Smrg   fi
1854eea2e341Smrg   have_perl=no
1855eea2e341Smrgelse
1856eea2e341Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1857eea2e341Smrgfi
1858eea2e341Smrg
1859eea2e341SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1860eea2e341Smrg]) # XORG_WITH_PERL
1861eea2e341Smrg
186208e312fdSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
186308e312fdSmrg# ----------------
186408e312fdSmrg# Minimum version: 1.5.0
186508e312fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
186608e312fdSmrg#
186708e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
186808e312fdSmrg# not at the appropriate level. This macro enables a module to test for the
186908e312fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
187008e312fdSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
187108e312fdSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
187208e312fdSmrg# --with-asciidoc assumes 'auto'.
187308e312fdSmrg#
187408e312fdSmrg# Interface to module:
187508e312fdSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
187608e312fdSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
187708e312fdSmrg#		 returns the path set by the user in the environment
187808e312fdSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
187908e312fdSmrg#		  'no' user instructs the module not to use asciidoc
188008e312fdSmrg#
188108e312fdSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
188208e312fdSmrg#
188308e312fdSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
188408e312fdSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
188508e312fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
188608e312fdSmrgAC_ARG_WITH(asciidoc,
188708e312fdSmrg	AS_HELP_STRING([--with-asciidoc],
188808e312fdSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
188908e312fdSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
189008e312fdSmrgm4_undefine([_defopt])
189108e312fdSmrg
189208e312fdSmrgif test "x$use_asciidoc" = x"auto"; then
189308e312fdSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
189408e312fdSmrg   if test "x$ASCIIDOC" = "x"; then
189508e312fdSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
189608e312fdSmrg	have_asciidoc=no
189708e312fdSmrg   else
189808e312fdSmrg        have_asciidoc=yes
189908e312fdSmrg   fi
190008e312fdSmrgelif test "x$use_asciidoc" = x"yes" ; then
190108e312fdSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
190208e312fdSmrg   if test "x$ASCIIDOC" = "x"; then
190308e312fdSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
190408e312fdSmrg   fi
190508e312fdSmrg   have_asciidoc=yes
190608e312fdSmrgelif test "x$use_asciidoc" = x"no" ; then
190708e312fdSmrg   if test "x$ASCIIDOC" != "x"; then
190808e312fdSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
190908e312fdSmrg   fi
191008e312fdSmrg   have_asciidoc=no
191108e312fdSmrgelse
191208e312fdSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
191308e312fdSmrgfi
191408e312fdSmrgm4_ifval([$1],
191508e312fdSmrg[if test "$have_asciidoc" = yes; then
191608e312fdSmrg    # scrape the asciidoc version
191708e312fdSmrg    AC_MSG_CHECKING([the asciidoc version])
191808e312fdSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
191908e312fdSmrg    AC_MSG_RESULT([$asciidoc_version])
192008e312fdSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
192108e312fdSmrg        [if test "x$use_asciidoc" = xauto; then
192208e312fdSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
192308e312fdSmrg            have_asciidoc=no
192408e312fdSmrg        else
192508e312fdSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
192608e312fdSmrg        fi])
192708e312fdSmrgfi])
192808e312fdSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
192908e312fdSmrg]) # XORG_WITH_ASCIIDOC
193008e312fdSmrg
193108e312fdSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
193233dddc75Smrg# -------------------------------------------
193308e312fdSmrg# Minimum version: 1.5.0
193408e312fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
193533dddc75Smrg# Minimum version for optional DOT checking: 1.18.0
193608e312fdSmrg#
193708e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
193808e312fdSmrg# not at the appropriate level. This macro enables a module to test for the
193908e312fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
194008e312fdSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
194108e312fdSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
194208e312fdSmrg# --with-doxygen assumes 'auto'.
194308e312fdSmrg#
194408e312fdSmrg# Interface to module:
194508e312fdSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
194608e312fdSmrg# DOXYGEN:	 returns the path of the doxygen program found
194708e312fdSmrg#		 returns the path set by the user in the environment
194808e312fdSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
194908e312fdSmrg#		  'no' user instructs the module not to use doxygen
195008e312fdSmrg#
195108e312fdSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
195208e312fdSmrg#
195308e312fdSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
195408e312fdSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
195533dddc75SmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
195608e312fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
195708e312fdSmrgAC_ARG_WITH(doxygen,
195808e312fdSmrg	AS_HELP_STRING([--with-doxygen],
195908e312fdSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
196008e312fdSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
196108e312fdSmrgm4_undefine([_defopt])
196208e312fdSmrg
196308e312fdSmrgif test "x$use_doxygen" = x"auto"; then
196408e312fdSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
196508e312fdSmrg   if test "x$DOXYGEN" = "x"; then
196608e312fdSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
196708e312fdSmrg	have_doxygen=no
196808e312fdSmrg   else
196908e312fdSmrg        have_doxygen=yes
197008e312fdSmrg   fi
197108e312fdSmrgelif test "x$use_doxygen" = x"yes" ; then
197208e312fdSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
197308e312fdSmrg   if test "x$DOXYGEN" = "x"; then
197408e312fdSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
197508e312fdSmrg   fi
197608e312fdSmrg   have_doxygen=yes
197708e312fdSmrgelif test "x$use_doxygen" = x"no" ; then
197808e312fdSmrg   if test "x$DOXYGEN" != "x"; then
197908e312fdSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
198008e312fdSmrg   fi
198108e312fdSmrg   have_doxygen=no
198208e312fdSmrgelse
198308e312fdSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
198408e312fdSmrgfi
198508e312fdSmrgm4_ifval([$1],
198608e312fdSmrg[if test "$have_doxygen" = yes; then
198708e312fdSmrg    # scrape the doxygen version
198808e312fdSmrg    AC_MSG_CHECKING([the doxygen version])
198908e312fdSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
199008e312fdSmrg    AC_MSG_RESULT([$doxygen_version])
199108e312fdSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
199208e312fdSmrg        [if test "x$use_doxygen" = xauto; then
199308e312fdSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
199408e312fdSmrg            have_doxygen=no
199508e312fdSmrg        else
199608e312fdSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
199708e312fdSmrg        fi])
199808e312fdSmrgfi])
199933dddc75Smrg
200033dddc75Smrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
200133dddc75Smrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
200233dddc75Smrgdnl 	HAVE_DOT = @HAVE_DOT@
200333dddc75SmrgHAVE_DOT=no
200433dddc75Smrgif test "x$have_doxygen" = "xyes"; then
200533dddc75Smrg  AC_PATH_PROG([DOT], [dot])
200633dddc75Smrg    if test "x$DOT" != "x"; then
200733dddc75Smrg      HAVE_DOT=yes
200833dddc75Smrg    fi
200933dddc75Smrgfi
201033dddc75Smrg
201133dddc75SmrgAC_SUBST([HAVE_DOT])
201233dddc75SmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
201308e312fdSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
201408e312fdSmrg]) # XORG_WITH_DOXYGEN
201508e312fdSmrg
201608e312fdSmrg# XORG_WITH_GROFF([DEFAULT])
201708e312fdSmrg# ----------------
201808e312fdSmrg# Minimum version: 1.6.0
201908e312fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
202008e312fdSmrg#
202108e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
202208e312fdSmrg# not at the appropriate level. This macro enables a module to test for the
202308e312fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
202408e312fdSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
202508e312fdSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
202608e312fdSmrg# --with-groff assumes 'auto'.
202708e312fdSmrg#
202808e312fdSmrg# Interface to module:
202908e312fdSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
203008e312fdSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
203108e312fdSmrg# HAVE_GROFF_MS: the -ms macros package
203208e312fdSmrg# GROFF:	 returns the path of the groff program found
203308e312fdSmrg#		 returns the path set by the user in the environment
203408e312fdSmrg# --with-groff:	 'yes' user instructs the module to use groff
203508e312fdSmrg#		 'no' user instructs the module not to use groff
203608e312fdSmrg#
203708e312fdSmrg# Added in version 1.9.0:
203808e312fdSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
203908e312fdSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
204008e312fdSmrg#		   psselect from the psutils package.
204108e312fdSmrg#		   the ghostcript package. Refer to the grohtml man pages
204208e312fdSmrg#
204308e312fdSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
204408e312fdSmrg#
204508e312fdSmrg# OS and distros often splits groff in a basic and full package, the former
204608e312fdSmrg# having the groff program and the later having devices, fonts and macros
204708e312fdSmrg# Checking for the groff executable is not enough.
204808e312fdSmrg#
204908e312fdSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
205008e312fdSmrg# unset HAVE_GROFF or GROFF env variables.
205108e312fdSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
205208e312fdSmrg#
205308e312fdSmrgAC_DEFUN([XORG_WITH_GROFF],[
205408e312fdSmrgAC_ARG_VAR([GROFF], [Path to groff command])
205508e312fdSmrgm4_define([_defopt], m4_default([$1], [auto]))
205608e312fdSmrgAC_ARG_WITH(groff,
205708e312fdSmrg	AS_HELP_STRING([--with-groff],
205808e312fdSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
205908e312fdSmrg	   [use_groff=$withval], [use_groff=]_defopt)
206008e312fdSmrgm4_undefine([_defopt])
206108e312fdSmrg
206208e312fdSmrgif test "x$use_groff" = x"auto"; then
206308e312fdSmrg   AC_PATH_PROG([GROFF], [groff])
206408e312fdSmrg   if test "x$GROFF" = "x"; then
206508e312fdSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
206608e312fdSmrg	have_groff=no
206708e312fdSmrg   else
206808e312fdSmrg        have_groff=yes
206908e312fdSmrg   fi
207008e312fdSmrgelif test "x$use_groff" = x"yes" ; then
207108e312fdSmrg   AC_PATH_PROG([GROFF], [groff])
207208e312fdSmrg   if test "x$GROFF" = "x"; then
207308e312fdSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
207408e312fdSmrg   fi
207508e312fdSmrg   have_groff=yes
207608e312fdSmrgelif test "x$use_groff" = x"no" ; then
207708e312fdSmrg   if test "x$GROFF" != "x"; then
207808e312fdSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
207908e312fdSmrg   fi
208008e312fdSmrg   have_groff=no
208108e312fdSmrgelse
208208e312fdSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
208308e312fdSmrgfi
208408e312fdSmrg
208508e312fdSmrg# We have groff, test for the presence of the macro packages
208608e312fdSmrgif test "x$have_groff" = x"yes"; then
208708e312fdSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
208808e312fdSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
208908e312fdSmrg        groff_ms_works=yes
209008e312fdSmrg    else
209108e312fdSmrg        groff_ms_works=no
209208e312fdSmrg    fi
209308e312fdSmrg    AC_MSG_RESULT([$groff_ms_works])
209408e312fdSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
209508e312fdSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
209608e312fdSmrg        groff_mm_works=yes
209708e312fdSmrg    else
209808e312fdSmrg        groff_mm_works=no
209908e312fdSmrg    fi
210008e312fdSmrg    AC_MSG_RESULT([$groff_mm_works])
210108e312fdSmrgfi
210208e312fdSmrg
210308e312fdSmrg# We have groff, test for HTML dependencies, one command per package
210408e312fdSmrgif test "x$have_groff" = x"yes"; then
210508e312fdSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
210608e312fdSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
210708e312fdSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
210808e312fdSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
210908e312fdSmrg      have_groff_html=yes
211008e312fdSmrg   else
211108e312fdSmrg      have_groff_html=no
211208e312fdSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
211308e312fdSmrg   fi
211408e312fdSmrgfi
211508e312fdSmrg
211608e312fdSmrg# Set Automake conditionals for Makefiles
211708e312fdSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
211808e312fdSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
211908e312fdSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
212008e312fdSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
212108e312fdSmrg]) # XORG_WITH_GROFF
212208e312fdSmrg
2123eea2e341Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2124eea2e341Smrg# ---------------------------------------
212508e312fdSmrg# Minimum version: 1.6.0
212608e312fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
2127eea2e341Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
212808e312fdSmrg#
212908e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
213008e312fdSmrg# not at the appropriate level. This macro enables a module to test for the
213108e312fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
213208e312fdSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
213308e312fdSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
213408e312fdSmrg# --with-fop assumes 'auto'.
213508e312fdSmrg#
213608e312fdSmrg# Interface to module:
213708e312fdSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
213808e312fdSmrg# FOP:	 	returns the path of the fop program found
213908e312fdSmrg#		returns the path set by the user in the environment
214008e312fdSmrg# --with-fop: 	'yes' user instructs the module to use fop
214108e312fdSmrg#		'no' user instructs the module not to use fop
214208e312fdSmrg#
214308e312fdSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
214408e312fdSmrg#
214508e312fdSmrgAC_DEFUN([XORG_WITH_FOP],[
214608e312fdSmrgAC_ARG_VAR([FOP], [Path to fop command])
2147eea2e341Smrgm4_define([_defopt], m4_default([$2], [auto]))
214808e312fdSmrgAC_ARG_WITH(fop,
214908e312fdSmrg	AS_HELP_STRING([--with-fop],
215008e312fdSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
215108e312fdSmrg	   [use_fop=$withval], [use_fop=]_defopt)
215208e312fdSmrgm4_undefine([_defopt])
215308e312fdSmrg
215408e312fdSmrgif test "x$use_fop" = x"auto"; then
215508e312fdSmrg   AC_PATH_PROG([FOP], [fop])
215608e312fdSmrg   if test "x$FOP" = "x"; then
215708e312fdSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
215808e312fdSmrg	have_fop=no
215908e312fdSmrg   else
216008e312fdSmrg        have_fop=yes
216108e312fdSmrg   fi
216208e312fdSmrgelif test "x$use_fop" = x"yes" ; then
216308e312fdSmrg   AC_PATH_PROG([FOP], [fop])
216408e312fdSmrg   if test "x$FOP" = "x"; then
216508e312fdSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
216608e312fdSmrg   fi
216708e312fdSmrg   have_fop=yes
216808e312fdSmrgelif test "x$use_fop" = x"no" ; then
216908e312fdSmrg   if test "x$FOP" != "x"; then
217008e312fdSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
217108e312fdSmrg   fi
217208e312fdSmrg   have_fop=no
217308e312fdSmrgelse
217408e312fdSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
217508e312fdSmrgfi
2176eea2e341Smrg
2177eea2e341Smrg# Test for a minimum version of fop, if provided.
2178eea2e341Smrgm4_ifval([$1],
2179eea2e341Smrg[if test "$have_fop" = yes; then
2180eea2e341Smrg    # scrape the fop version
2181eea2e341Smrg    AC_MSG_CHECKING([for fop minimum version])
2182eea2e341Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2183eea2e341Smrg    AC_MSG_RESULT([$fop_version])
2184eea2e341Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2185eea2e341Smrg        [if test "x$use_fop" = xauto; then
2186eea2e341Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2187eea2e341Smrg            have_fop=no
2188eea2e341Smrg        else
2189eea2e341Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2190eea2e341Smrg        fi])
2191eea2e341Smrgfi])
219208e312fdSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
219308e312fdSmrg]) # XORG_WITH_FOP
219408e312fdSmrg
219533dddc75Smrg# XORG_WITH_M4([MIN-VERSION])
219633dddc75Smrg# ---------------------------
219733dddc75Smrg# Minimum version: 1.19.0
219833dddc75Smrg#
219933dddc75Smrg# This macro attempts to locate an m4 macro processor which supports
220033dddc75Smrg# -I option and is only useful for modules relying on M4 in order to
220133dddc75Smrg# expand macros in source code files.
220233dddc75Smrg#
220333dddc75Smrg# Interface to module:
220433dddc75Smrg# M4:	 	returns the path of the m4 program found
220533dddc75Smrg#		returns the path set by the user in the environment
220633dddc75Smrg#
220733dddc75SmrgAC_DEFUN([XORG_WITH_M4], [
220833dddc75SmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
220933dddc75Smrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
221033dddc75Smrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
221133dddc75Smrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
221233dddc75Smrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
221333dddc75Smrg   [$PATH:/usr/gnu/bin])])
221433dddc75Smrg
221533dddc75SmrgAC_SUBST([M4], [$ac_cv_path_M4])
221633dddc75Smrg]) # XORG_WITH_M4
221733dddc75Smrg
221808e312fdSmrg# XORG_WITH_PS2PDF([DEFAULT])
221908e312fdSmrg# ----------------
222008e312fdSmrg# Minimum version: 1.6.0
222108e312fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
222208e312fdSmrg#
222308e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
222408e312fdSmrg# not at the appropriate level. This macro enables a module to test for the
222508e312fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
222608e312fdSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
222708e312fdSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
222808e312fdSmrg# --with-ps2pdf assumes 'auto'.
222908e312fdSmrg#
223008e312fdSmrg# Interface to module:
223108e312fdSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
223208e312fdSmrg# PS2PDF:	returns the path of the ps2pdf program found
223308e312fdSmrg#		returns the path set by the user in the environment
223408e312fdSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
223508e312fdSmrg#		 'no' user instructs the module not to use ps2pdf
223608e312fdSmrg#
223708e312fdSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
223808e312fdSmrg#
223908e312fdSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
224008e312fdSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
224108e312fdSmrgm4_define([_defopt], m4_default([$1], [auto]))
224208e312fdSmrgAC_ARG_WITH(ps2pdf,
224308e312fdSmrg	AS_HELP_STRING([--with-ps2pdf],
224408e312fdSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
224508e312fdSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
224608e312fdSmrgm4_undefine([_defopt])
224708e312fdSmrg
224808e312fdSmrgif test "x$use_ps2pdf" = x"auto"; then
224908e312fdSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
225008e312fdSmrg   if test "x$PS2PDF" = "x"; then
225108e312fdSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
225208e312fdSmrg	have_ps2pdf=no
225308e312fdSmrg   else
225408e312fdSmrg        have_ps2pdf=yes
225508e312fdSmrg   fi
225608e312fdSmrgelif test "x$use_ps2pdf" = x"yes" ; then
225708e312fdSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
225808e312fdSmrg   if test "x$PS2PDF" = "x"; then
225908e312fdSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
226008e312fdSmrg   fi
226108e312fdSmrg   have_ps2pdf=yes
226208e312fdSmrgelif test "x$use_ps2pdf" = x"no" ; then
226308e312fdSmrg   if test "x$PS2PDF" != "x"; then
226408e312fdSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
226508e312fdSmrg   fi
226608e312fdSmrg   have_ps2pdf=no
226708e312fdSmrgelse
226808e312fdSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
226908e312fdSmrgfi
227008e312fdSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
227108e312fdSmrg]) # XORG_WITH_PS2PDF
227208e312fdSmrg
227308e312fdSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
227408e312fdSmrg# ----------------
227508e312fdSmrg# Minimum version: 1.6.0
227608e312fdSmrg#
227708e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
227808e312fdSmrg# not at the appropriate level. This macro enables a builder to skip all
227908e312fdSmrg# documentation targets except traditional man pages.
228008e312fdSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
228108e312fdSmrg# maximum flexibilty in controlling documentation building.
228208e312fdSmrg# Refer to:
228308e312fdSmrg# XORG_WITH_XMLTO         --with-xmlto
228408e312fdSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
228508e312fdSmrg# XORG_WITH_DOXYGEN       --with-doxygen
228608e312fdSmrg# XORG_WITH_FOP           --with-fop
228708e312fdSmrg# XORG_WITH_GROFF         --with-groff
228808e312fdSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
228908e312fdSmrg#
229008e312fdSmrg# Interface to module:
229108e312fdSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
229208e312fdSmrg# --enable-docs: 'yes' user instructs the module to generate docs
229308e312fdSmrg#		 'no' user instructs the module not to generate docs
229408e312fdSmrg# parm1:	specify the default value, yes or no.
229508e312fdSmrg#
229608e312fdSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2297eea2e341Smrgm4_define([docs_default], m4_default([$1], [yes]))
229808e312fdSmrgAC_ARG_ENABLE(docs,
229908e312fdSmrg	AS_HELP_STRING([--enable-docs],
2300eea2e341Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2301eea2e341Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2302eea2e341Smrgm4_undefine([docs_default])
230308e312fdSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
230408e312fdSmrgAC_MSG_CHECKING([whether to build documentation])
230508e312fdSmrgAC_MSG_RESULT([$build_docs])
230608e312fdSmrg]) # XORG_ENABLE_DOCS
230708e312fdSmrg
230808e312fdSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
230908e312fdSmrg# ----------------
231008e312fdSmrg# Minimum version: 1.6.0
231108e312fdSmrg#
231208e312fdSmrg# This macro enables a builder to skip all developer documentation.
231308e312fdSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
231408e312fdSmrg# maximum flexibilty in controlling documentation building.
231508e312fdSmrg# Refer to:
231608e312fdSmrg# XORG_WITH_XMLTO         --with-xmlto
231708e312fdSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
231808e312fdSmrg# XORG_WITH_DOXYGEN       --with-doxygen
231908e312fdSmrg# XORG_WITH_FOP           --with-fop
232008e312fdSmrg# XORG_WITH_GROFF         --with-groff
232108e312fdSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
232208e312fdSmrg#
232308e312fdSmrg# Interface to module:
232408e312fdSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
232508e312fdSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
232608e312fdSmrg#			'no' user instructs the module not to generate developer docs
232708e312fdSmrg# parm1:		specify the default value, yes or no.
232808e312fdSmrg#
232908e312fdSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
233008e312fdSmrgm4_define([devel_default], m4_default([$1], [yes]))
233108e312fdSmrgAC_ARG_ENABLE(devel-docs,
233208e312fdSmrg	AS_HELP_STRING([--enable-devel-docs],
233308e312fdSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
233408e312fdSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
233508e312fdSmrgm4_undefine([devel_default])
233608e312fdSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
233708e312fdSmrgAC_MSG_CHECKING([whether to build developer documentation])
233808e312fdSmrgAC_MSG_RESULT([$build_devel_docs])
233908e312fdSmrg]) # XORG_ENABLE_DEVEL_DOCS
234008e312fdSmrg
234108e312fdSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
234208e312fdSmrg# ----------------
234308e312fdSmrg# Minimum version: 1.6.0
234408e312fdSmrg#
234508e312fdSmrg# This macro enables a builder to skip all functional specification targets.
234608e312fdSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
234708e312fdSmrg# maximum flexibilty in controlling documentation building.
234808e312fdSmrg# Refer to:
234908e312fdSmrg# XORG_WITH_XMLTO         --with-xmlto
235008e312fdSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
235108e312fdSmrg# XORG_WITH_DOXYGEN       --with-doxygen
235208e312fdSmrg# XORG_WITH_FOP           --with-fop
235308e312fdSmrg# XORG_WITH_GROFF         --with-groff
235408e312fdSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
235508e312fdSmrg#
235608e312fdSmrg# Interface to module:
235708e312fdSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
235808e312fdSmrg# --enable-specs:	'yes' user instructs the module to generate specs
235908e312fdSmrg#			'no' user instructs the module not to generate specs
236008e312fdSmrg# parm1:		specify the default value, yes or no.
236108e312fdSmrg#
236208e312fdSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
236308e312fdSmrgm4_define([spec_default], m4_default([$1], [yes]))
236408e312fdSmrgAC_ARG_ENABLE(specs,
236508e312fdSmrg	AS_HELP_STRING([--enable-specs],
236608e312fdSmrg	   [Enable building the specs (default: ]spec_default[)]),
236708e312fdSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
236808e312fdSmrgm4_undefine([spec_default])
236908e312fdSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
237008e312fdSmrgAC_MSG_CHECKING([whether to build functional specifications])
237108e312fdSmrgAC_MSG_RESULT([$build_specs])
237208e312fdSmrg]) # XORG_ENABLE_SPECS
237308e312fdSmrg
2374eea2e341Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2375eea2e341Smrg# ----------------------------------------------
2376eea2e341Smrg# Minimum version: 1.13.0
2377eea2e341Smrg#
2378eea2e341Smrg# This macro enables a builder to enable/disable unit testing
2379eea2e341Smrg# It makes no assumption about the test cases implementation
2380eea2e341Smrg# Test cases may or may not use Automake "Support for test suites"
2381eea2e341Smrg# They may or may not use the software utility library GLib
2382eea2e341Smrg#
2383eea2e341Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2384eea2e341Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2385eea2e341Smrg# The variable enable_unit_tests is used by other macros in this file.
2386eea2e341Smrg#
2387eea2e341Smrg# Interface to module:
2388eea2e341Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2389eea2e341Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2390eea2e341Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2391eea2e341Smrg#			'no' user instructs the module not to build tests
2392eea2e341Smrg# parm1:		specify the default value, yes or no.
2393eea2e341Smrg#
2394eea2e341SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2395eea2e341SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2396eea2e341SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2397eea2e341SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2398eea2e341Smrgm4_define([_defopt], m4_default([$1], [auto]))
2399eea2e341SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2400eea2e341Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2401eea2e341Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2402eea2e341Smrgm4_undefine([_defopt])
2403eea2e341SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2404eea2e341SmrgAC_MSG_CHECKING([whether to build unit test cases])
2405eea2e341SmrgAC_MSG_RESULT([$enable_unit_tests])
2406eea2e341Smrg]) # XORG_ENABLE_UNIT_TESTS
2407eea2e341Smrg
2408eea2e341Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2409eea2e341Smrg# ------------------------------------------------------
2410eea2e341Smrg# Minimum version: 1.17.0
2411eea2e341Smrg#
2412eea2e341Smrg# This macro enables a builder to enable/disable integration testing
2413eea2e341Smrg# It makes no assumption about the test cases' implementation
2414eea2e341Smrg# Test cases may or may not use Automake "Support for test suites"
2415eea2e341Smrg#
2416eea2e341Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2417eea2e341Smrg# usually requires less dependencies and may be built and run under less
2418eea2e341Smrg# stringent environments than integration tests.
2419eea2e341Smrg#
2420eea2e341Smrg# Interface to module:
2421eea2e341Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2422eea2e341Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2423eea2e341Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2424eea2e341Smrg#                             'no' user instructs the module not to build tests
2425eea2e341Smrg# parm1:                      specify the default value, yes or no.
2426eea2e341Smrg#
2427eea2e341SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2428eea2e341SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2429eea2e341Smrgm4_define([_defopt], m4_default([$1], [auto]))
2430eea2e341SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2431eea2e341Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2432eea2e341Smrg	[enable_integration_tests=$enableval],
2433eea2e341Smrg	[enable_integration_tests=]_defopt)
2434eea2e341Smrgm4_undefine([_defopt])
2435eea2e341SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2436eea2e341Smrg	[test "x$enable_integration_tests" != xno])
2437eea2e341SmrgAC_MSG_CHECKING([whether to build unit test cases])
2438eea2e341SmrgAC_MSG_RESULT([$enable_integration_tests])
2439eea2e341Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2440eea2e341Smrg
2441eea2e341Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2442eea2e341Smrg# ----------------------------------------
2443eea2e341Smrg# Minimum version: 1.13.0
2444eea2e341Smrg#
2445eea2e341Smrg# GLib is a library which provides advanced data structures and functions.
2446eea2e341Smrg# This macro enables a module to test for the presence of Glib.
2447eea2e341Smrg#
2448eea2e341Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2449eea2e341Smrg# Otherwise the value of $enable_unit_tests is blank.
2450eea2e341Smrg#
2451eea2e341Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2452eea2e341Smrg# test support usually requires less dependencies and may be built and run under
2453eea2e341Smrg# less stringent environments than integration tests.
2454eea2e341Smrg#
2455eea2e341Smrg# Interface to module:
2456eea2e341Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2457eea2e341Smrg# with_glib: used in configure.ac to know if GLib has been found
2458eea2e341Smrg# --with-glib:	'yes' user instructs the module to use glib
2459eea2e341Smrg#		'no' user instructs the module not to use glib
2460eea2e341Smrg#
2461eea2e341SmrgAC_DEFUN([XORG_WITH_GLIB],[
2462eea2e341SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2463eea2e341Smrgm4_define([_defopt], m4_default([$2], [auto]))
2464eea2e341SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2465eea2e341Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2466eea2e341Smrg	[with_glib=$withval], [with_glib=]_defopt)
2467eea2e341Smrgm4_undefine([_defopt])
2468eea2e341Smrg
2469eea2e341Smrghave_glib=no
2470eea2e341Smrg# Do not probe GLib if user explicitly disabled unit testing
2471eea2e341Smrgif test "x$enable_unit_tests" != x"no"; then
2472eea2e341Smrg  # Do not probe GLib if user explicitly disabled it
2473eea2e341Smrg  if test "x$with_glib" != x"no"; then
2474eea2e341Smrg    m4_ifval(
2475eea2e341Smrg      [$1],
2476eea2e341Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2477eea2e341Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2478eea2e341Smrg    )
2479eea2e341Smrg  fi
2480eea2e341Smrgfi
2481eea2e341Smrg
2482eea2e341Smrg# Not having GLib when unit testing has been explicitly requested is an error
2483eea2e341Smrgif test "x$enable_unit_tests" = x"yes"; then
2484eea2e341Smrg  if test "x$have_glib" = x"no"; then
2485eea2e341Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2486eea2e341Smrg  fi
2487eea2e341Smrgfi
2488eea2e341Smrg
2489eea2e341Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2490eea2e341Smrgif test "x$enable_unit_tests" = x"no"; then
2491eea2e341Smrg  if test "x$with_glib" = x"yes"; then
2492eea2e341Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2493eea2e341Smrg  fi
2494eea2e341Smrgfi
2495eea2e341Smrg
2496eea2e341Smrg# Not having GLib when it has been explicitly requested is an error
2497eea2e341Smrgif test "x$with_glib" = x"yes"; then
2498eea2e341Smrg  if test "x$have_glib" = x"no"; then
2499eea2e341Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2500eea2e341Smrg  fi
2501eea2e341Smrgfi
2502eea2e341Smrg
2503eea2e341SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2504eea2e341Smrg]) # XORG_WITH_GLIB
2505eea2e341Smrg
2506eea2e341Smrg# XORG_LD_WRAP([required|optional])
2507eea2e341Smrg# ---------------------------------
2508eea2e341Smrg# Minimum version: 1.13.0
2509eea2e341Smrg#
2510eea2e341Smrg# Check if linker supports -wrap, passed via compiler flags
2511eea2e341Smrg#
2512eea2e341Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2513eea2e341Smrg# Otherwise the value of $enable_unit_tests is blank.
2514eea2e341Smrg#
2515eea2e341Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2516eea2e341Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2517eea2e341Smrg# available, an argument of "optional" allows use when some unit tests require
2518eea2e341Smrg# ld -wrap and others do not.
2519eea2e341Smrg#
2520eea2e341SmrgAC_DEFUN([XORG_LD_WRAP],[
2521eea2e341SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2522eea2e341Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2523eea2e341Smrg                      void __wrap_exit(int status) { return; }],
2524eea2e341Smrg                     [exit(0);])])
2525eea2e341Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2526eea2e341Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2527eea2e341Smrg  if test "x$have_ld_wrap" = x"no"; then
2528eea2e341Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2529eea2e341Smrg  fi
2530eea2e341Smrgfi
2531eea2e341SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2532eea2e341Smrg#
2533eea2e341Smrg]) # XORG_LD_WRAP
2534eea2e341Smrg
2535eea2e341Smrg# XORG_CHECK_LINKER_FLAGS
2536eea2e341Smrg# -----------------------
2537eea2e341Smrg# SYNOPSIS
2538eea2e341Smrg#
2539eea2e341Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2540eea2e341Smrg#
2541eea2e341Smrg# DESCRIPTION
2542eea2e341Smrg#
2543eea2e341Smrg#   Check whether the given linker FLAGS work with the current language's
2544eea2e341Smrg#   linker, or whether they give an error.
2545eea2e341Smrg#
2546eea2e341Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2547eea2e341Smrg#   success/failure.
2548eea2e341Smrg#
2549eea2e341Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2550eea2e341Smrg#
2551eea2e341Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2552eea2e341Smrg#
2553eea2e341Smrg# LICENSE
2554eea2e341Smrg#
2555eea2e341Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2556eea2e341Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2557eea2e341Smrg#   Copyright (c) 2009 Matteo Frigo
2558eea2e341Smrg#
2559eea2e341Smrg#   This program is free software: you can redistribute it and/or modify it
2560eea2e341Smrg#   under the terms of the GNU General Public License as published by the
2561eea2e341Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2562eea2e341Smrg#   option) any later version.
2563eea2e341Smrg#
2564eea2e341Smrg#   This program is distributed in the hope that it will be useful, but
2565eea2e341Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2566eea2e341Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2567eea2e341Smrg#   Public License for more details.
2568eea2e341Smrg#
2569eea2e341Smrg#   You should have received a copy of the GNU General Public License along
2570eea2e341Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2571eea2e341Smrg#
2572eea2e341Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2573eea2e341Smrg#   gives unlimited permission to copy, distribute and modify the configure
2574eea2e341Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2575eea2e341Smrg#   need not follow the terms of the GNU General Public License when using
2576eea2e341Smrg#   or distributing such scripts, even though portions of the text of the
2577eea2e341Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2578eea2e341Smrg#   all other use of the material that constitutes the Autoconf Macro.
2579eea2e341Smrg#
2580eea2e341Smrg#   This special exception to the GPL applies to versions of the Autoconf
2581eea2e341Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2582eea2e341Smrg#   modified version of the Autoconf Macro, you may extend this special
2583eea2e341Smrg#   exception to the GPL to apply to your modified version as well.#
2584eea2e341SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2585eea2e341Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2586eea2e341Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2587eea2e341SmrgAS_LITERAL_IF([$1],
2588eea2e341Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2589eea2e341Smrg      ax_save_FLAGS=$LDFLAGS
2590eea2e341Smrg      LDFLAGS="$1"
2591eea2e341Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2592eea2e341Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2593eea2e341Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2594eea2e341Smrg      LDFLAGS=$ax_save_FLAGS])],
2595eea2e341Smrg  [ax_save_FLAGS=$LDFLAGS
2596eea2e341Smrg   LDFLAGS="$1"
2597eea2e341Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2598eea2e341Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2599eea2e341Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2600eea2e341Smrg   LDFLAGS=$ax_save_FLAGS])
2601eea2e341Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2602eea2e341SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2603eea2e341Smrgif test "x$xorg_check_linker_flags" = xyes; then
2604eea2e341Smrg	m4_default([$2], :)
2605eea2e341Smrgelse
2606eea2e341Smrg	m4_default([$3], :)
2607eea2e341Smrgfi
2608eea2e341Smrg]) # XORG_CHECK_LINKER_FLAGS
2609eea2e341Smrg
2610eea2e341Smrg# XORG_MEMORY_CHECK_FLAGS
2611eea2e341Smrg# -----------------------
2612eea2e341Smrg# Minimum version: 1.16.0
2613eea2e341Smrg#
2614eea2e341Smrg# This macro attempts to find appropriate memory checking functionality
2615eea2e341Smrg# for various platforms which unit testing code may use to catch various
2616eea2e341Smrg# forms of memory allocation and access errors in testing.
2617eea2e341Smrg#
2618eea2e341Smrg# Interface to module:
2619eea2e341Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2620eea2e341Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2621eea2e341Smrg#
2622eea2e341Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2623eea2e341Smrg#
2624eea2e341SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2625eea2e341Smrg
2626eea2e341SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2627eea2e341SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2628eea2e341Smrg           [Environment variables to enable memory checking in tests])
2629eea2e341Smrg
2630eea2e341Smrg# Check for different types of support on different platforms
2631eea2e341Smrgcase $host_os in
2632eea2e341Smrg    solaris*)
2633eea2e341Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2634eea2e341Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2635eea2e341Smrg        ;;
2636eea2e341Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2637eea2e341Smrg        # both directly and inverted, so should not be 0 or 255.
2638eea2e341Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2639eea2e341Smrg        ;;
2640eea2e341Smrg    darwin*)
2641eea2e341Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2642eea2e341Smrg        ;;
2643eea2e341Smrg    *bsd*)
2644eea2e341Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2645eea2e341Smrg        ;;
2646eea2e341Smrgesac
2647eea2e341Smrg
2648eea2e341Smrg# User supplied flags override default flags
2649eea2e341Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2650eea2e341Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2651eea2e341Smrgfi
2652eea2e341Smrg
2653eea2e341SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2654eea2e341Smrg]) # XORG_WITH_LINT
2655eea2e341Smrg
265672b4363aSmrg# XORG_CHECK_MALLOC_ZERO
265772b4363aSmrg# ----------------------
265872b4363aSmrg# Minimum version: 1.0.0
265972b4363aSmrg#
266072b4363aSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
266172b4363aSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
266272b4363aSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
266372b4363aSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
266472b4363aSmrgAC_ARG_ENABLE(malloc0returnsnull,
2665dd77ae96Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
266672b4363aSmrg		       [malloc(0) returns NULL (default: auto)]),
266772b4363aSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
266872b4363aSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
266972b4363aSmrg
267072b4363aSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
267172b4363aSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
267233dddc75SmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
267333dddc75Smrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2674eea2e341Smrg#include <stdlib.h>
2675eea2e341Smrg],[
267672b4363aSmrg    char *m0, *r0, *c0, *p;
267772b4363aSmrg    m0 = malloc(0);
267872b4363aSmrg    p = malloc(10);
267972b4363aSmrg    r0 = realloc(p,0);
2680eea2e341Smrg    c0 = calloc(0,10);
2681eea2e341Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2682eea2e341Smrg])],
268333dddc75Smrg		[xorg_cv_malloc0_returns_null=yes],
268433dddc75Smrg		[xorg_cv_malloc0_returns_null=no])])
268533dddc75SmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
268672b4363aSmrgfi
268772b4363aSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
268872b4363aSmrg
268972b4363aSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
269072b4363aSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
269172b4363aSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
269272b4363aSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
269372b4363aSmrgelse
269472b4363aSmrg	MALLOC_ZERO_CFLAGS=""
269572b4363aSmrg	XMALLOC_ZERO_CFLAGS=""
269672b4363aSmrg	XTMALLOC_ZERO_CFLAGS=""
269772b4363aSmrgfi
269872b4363aSmrg
269972b4363aSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
270072b4363aSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
270172b4363aSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
270272b4363aSmrg]) # XORG_CHECK_MALLOC_ZERO
270372b4363aSmrg
270472b4363aSmrg# XORG_WITH_LINT()
270572b4363aSmrg# ----------------
270672b4363aSmrg# Minimum version: 1.1.0
270772b4363aSmrg#
270808e312fdSmrg# This macro enables the use of a tool that flags some suspicious and
270908e312fdSmrg# non-portable constructs (likely to be bugs) in C language source code.
271008e312fdSmrg# It will attempt to locate the tool and use appropriate options.
271108e312fdSmrg# There are various lint type tools on different platforms.
271208e312fdSmrg#
271308e312fdSmrg# Interface to module:
271408e312fdSmrg# LINT:		returns the path to the tool found on the platform
271508e312fdSmrg#		or the value set to LINT on the configure cmd line
271608e312fdSmrg#		also an Automake conditional
271708e312fdSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
271808e312fdSmrg#
271908e312fdSmrg# --with-lint:	'yes' user instructs the module to use lint
272008e312fdSmrg#		'no' user instructs the module not to use lint (default)
272108e312fdSmrg#
272208e312fdSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
272308e312fdSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
272472b4363aSmrg#
272572b4363aSmrgAC_DEFUN([XORG_WITH_LINT],[
272672b4363aSmrg
272708e312fdSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
272808e312fdSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2729dd77ae96SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
273072b4363aSmrg		[Use a lint-style source code checker (default: disabled)])],
273172b4363aSmrg		[use_lint=$withval], [use_lint=no])
273208e312fdSmrg
273308e312fdSmrg# Obtain platform specific info like program name and options
273408e312fdSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
273508e312fdSmrgcase $host_os in
273608e312fdSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
273708e312fdSmrg	lint_name=splint
273808e312fdSmrg	lint_options="-badflag"
273908e312fdSmrg	;;
274008e312fdSmrg  *freebsd* | *netbsd*)
274108e312fdSmrg	lint_name=lint
274208e312fdSmrg	lint_options="-u -b"
274308e312fdSmrg	;;
274408e312fdSmrg  *solaris*)
274508e312fdSmrg	lint_name=lint
274608e312fdSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
274708e312fdSmrg	;;
274808e312fdSmrgesac
274908e312fdSmrg
275008e312fdSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
275108e312fdSmrgif test "x$use_lint" = x"yes" ; then
275208e312fdSmrg   AC_PATH_PROG([LINT], [$lint_name])
275308e312fdSmrg   if test "x$LINT" = "x"; then
275408e312fdSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
275508e312fdSmrg   fi
275608e312fdSmrgelif test "x$use_lint" = x"no" ; then
275708e312fdSmrg   if test "x$LINT" != "x"; then
275808e312fdSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
275908e312fdSmrg   fi
276072b4363aSmrgelse
276108e312fdSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
276272b4363aSmrgfi
276308e312fdSmrg
276408e312fdSmrg# User supplied flags override default flags
276508e312fdSmrgif test "x$LINT_FLAGS" != "x"; then
276608e312fdSmrg   lint_options=$LINT_FLAGS
276772b4363aSmrgfi
276872b4363aSmrg
276908e312fdSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
277008e312fdSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
277172b4363aSmrg
277272b4363aSmrg]) # XORG_WITH_LINT
277372b4363aSmrg
277472b4363aSmrg# XORG_LINT_LIBRARY(LIBNAME)
277572b4363aSmrg# --------------------------
277672b4363aSmrg# Minimum version: 1.1.0
277772b4363aSmrg#
277872b4363aSmrg# Sets up flags for building lint libraries for checking programs that call
277972b4363aSmrg# functions in the library.
278072b4363aSmrg#
278108e312fdSmrg# Interface to module:
278208e312fdSmrg# LINTLIB		- Automake variable with the name of lint library file to make
278308e312fdSmrg# MAKE_LINT_LIB		- Automake conditional
278408e312fdSmrg#
278508e312fdSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
278608e312fdSmrg#			  - 'no' user instructs the module not to create a lint library (default)
278772b4363aSmrg
278872b4363aSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
278972b4363aSmrgAC_REQUIRE([XORG_WITH_LINT])
2790dd77ae96SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
279172b4363aSmrg	[Create lint library (default: disabled)])],
279272b4363aSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
279308e312fdSmrg
279408e312fdSmrgif test "x$make_lint_lib" = x"yes" ; then
279508e312fdSmrg   LINTLIB=llib-l$1.ln
279608e312fdSmrg   if test "x$LINT" = "x"; then
279708e312fdSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
279808e312fdSmrg   fi
279908e312fdSmrgelif test "x$make_lint_lib" != x"no" ; then
280008e312fdSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
280172b4363aSmrgfi
280208e312fdSmrg
280372b4363aSmrgAC_SUBST(LINTLIB)
280472b4363aSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
280572b4363aSmrg
280672b4363aSmrg]) # XORG_LINT_LIBRARY
280772b4363aSmrg
2808eea2e341Smrg# XORG_COMPILER_BRAND
2809eea2e341Smrg# -------------------
2810eea2e341Smrg# Minimum version: 1.14.0
2811eea2e341Smrg#
2812eea2e341Smrg# Checks for various brands of compilers and sets flags as appropriate:
2813eea2e341Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2814eea2e341Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2815eea2e341Smrg#   clang compiler - sets CLANGCC to "yes"
2816eea2e341Smrg#   Intel compiler - sets INTELCC to "yes"
2817eea2e341Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2818eea2e341Smrg#
2819eea2e341SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2820eea2e341SmrgAC_LANG_CASE(
2821eea2e341Smrg	[C], [
2822eea2e341Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2823eea2e341Smrg	],
2824eea2e341Smrg	[C++], [
2825eea2e341Smrg		AC_REQUIRE([AC_PROG_CXX])
2826eea2e341Smrg	]
2827eea2e341Smrg)
2828eea2e341SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2829eea2e341SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2830eea2e341SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2831eea2e341Smrg]) # XORG_COMPILER_BRAND
2832eea2e341Smrg
2833eea2e341Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2834eea2e341Smrg# ---------------
2835eea2e341Smrg# Minimum version: 1.16.0
2836eea2e341Smrg#
2837eea2e341Smrg# Test if the compiler works when passed the given flag as a command line argument.
2838eea2e341Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2839eea2e341Smrg# next flag in the list until there are no more options.
2840eea2e341Smrg#
2841eea2e341Smrg# Note that this does not guarantee that the compiler supports the flag as some
2842eea2e341Smrg# compilers will simply ignore arguments that they do not understand, but we do
2843eea2e341Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2844eea2e341Smrg# -Werror=unused-command-line-argument
2845eea2e341Smrg#
2846eea2e341SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2847eea2e341Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2848eea2e341Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2849eea2e341Smrg
2850eea2e341SmrgAC_LANG_COMPILER_REQUIRE
2851eea2e341Smrg
2852eea2e341SmrgAC_LANG_CASE(
2853eea2e341Smrg	[C], [
2854eea2e341Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2855eea2e341Smrg		define([PREFIX], [C])
2856eea2e341Smrg		define([CACHE_PREFIX], [cc])
2857eea2e341Smrg		define([COMPILER], [$CC])
2858eea2e341Smrg	],
2859eea2e341Smrg	[C++], [
2860eea2e341Smrg		define([PREFIX], [CXX])
2861eea2e341Smrg		define([CACHE_PREFIX], [cxx])
2862eea2e341Smrg		define([COMPILER], [$CXX])
2863eea2e341Smrg	]
2864eea2e341Smrg)
2865eea2e341Smrg
2866eea2e341Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2867eea2e341Smrg
2868eea2e341Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2869eea2e341Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2870eea2e341Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2871eea2e341Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2872eea2e341Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2873eea2e341Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2874eea2e341Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2875eea2e341Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2876eea2e341Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2877eea2e341Smrgfi
2878eea2e341Smrg
2879eea2e341Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2880eea2e341Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2881eea2e341Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2882eea2e341Smrg	fi
2883eea2e341Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2884eea2e341Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2885eea2e341Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2886eea2e341Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2887eea2e341Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2888eea2e341Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2889eea2e341Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2890eea2e341Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2891eea2e341Smrgfi
2892eea2e341Smrg
2893eea2e341Smrgfound="no"
2894eea2e341Smrgm4_foreach([flag], m4_cdr($@), [
2895eea2e341Smrg	if test $found = "no" ; then
289633dddc75Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
2897eea2e341Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2898eea2e341Smrg		fi
2899eea2e341Smrg
290033dddc75Smrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
2901eea2e341Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2902eea2e341Smrg		fi
2903eea2e341Smrg
2904eea2e341Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2905eea2e341Smrg
2906eea2e341Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
290733dddc75Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2908eea2e341Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2909eea2e341Smrg		AC_CACHE_VAL($cacheid,
2910eea2e341Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2911eea2e341Smrg					     [eval $cacheid=yes],
2912eea2e341Smrg					     [eval $cacheid=no])])
2913eea2e341Smrg
2914eea2e341Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2915eea2e341Smrg
2916eea2e341Smrg		eval supported=\$$cacheid
2917eea2e341Smrg		AC_MSG_RESULT([$supported])
2918eea2e341Smrg		if test "$supported" = "yes" ; then
2919eea2e341Smrg			$1="$$1 ]flag["
2920eea2e341Smrg			found="yes"
2921eea2e341Smrg		fi
2922eea2e341Smrg	fi
2923eea2e341Smrg])
2924eea2e341Smrg]) # XORG_TESTSET_CFLAG
2925eea2e341Smrg
2926eea2e341Smrg# XORG_COMPILER_FLAGS
2927eea2e341Smrg# ---------------
2928eea2e341Smrg# Minimum version: 1.16.0
2929eea2e341Smrg#
2930eea2e341Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2931eea2e341Smrg# arguments supported by the selected compiler which do NOT alter the generated
2932eea2e341Smrg# code.  These arguments will cause the compiler to print various warnings
2933eea2e341Smrg# during compilation AND turn a conservative set of warnings into errors.
2934eea2e341Smrg#
2935eea2e341Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2936eea2e341Smrg# future versions of util-macros as options are added to new compilers.
2937eea2e341Smrg#
2938eea2e341SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2939eea2e341SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2940eea2e341Smrg
2941eea2e341SmrgAC_ARG_ENABLE(selective-werror,
2942eea2e341Smrg              AS_HELP_STRING([--disable-selective-werror],
2943eea2e341Smrg                             [Turn off selective compiler errors. (default: enabled)]),
2944eea2e341Smrg              [SELECTIVE_WERROR=$enableval],
2945eea2e341Smrg              [SELECTIVE_WERROR=yes])
2946eea2e341Smrg
2947eea2e341SmrgAC_LANG_CASE(
2948eea2e341Smrg        [C], [
2949eea2e341Smrg                define([PREFIX], [C])
2950eea2e341Smrg        ],
2951eea2e341Smrg        [C++], [
2952eea2e341Smrg                define([PREFIX], [CXX])
2953eea2e341Smrg        ]
2954eea2e341Smrg)
2955eea2e341Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2956eea2e341Smrgif test "x$SUNCC" = "xyes"; then
2957eea2e341Smrg    [BASE_]PREFIX[FLAGS]="-v"
2958eea2e341Smrgelse
2959eea2e341Smrg    [BASE_]PREFIX[FLAGS]=""
2960eea2e341Smrgfi
2961eea2e341Smrg
2962eea2e341Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2963eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2964eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2965eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2966eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2967eea2e341Smrg
2968eea2e341SmrgAC_LANG_CASE(
2969eea2e341Smrg	[C], [
2970eea2e341Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2971eea2e341Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2972eea2e341Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2973eea2e341Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
297433dddc75Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
2975eea2e341Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2976eea2e341Smrg	]
2977eea2e341Smrg)
2978eea2e341Smrg
2979eea2e341Smrg# This chunk adds additional warnings that could catch undesired effects.
2980eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2981eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2982eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2983eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2984eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2985eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
298633dddc75SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2987eea2e341Smrg
2988eea2e341Smrg# These are currently disabled because they are noisy.  They will be enabled
2989eea2e341Smrg# in the future once the codebase is sufficiently modernized to silence
2990eea2e341Smrg# them.  For now, I don't want them to drown out the other warnings.
2991eea2e341Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2992eea2e341Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
299333dddc75Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2994eea2e341Smrg
2995eea2e341Smrg# Turn some warnings into errors, so we don't accidently get successful builds
2996eea2e341Smrg# when there are problems that should be fixed.
2997eea2e341Smrg
2998eea2e341Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2999eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3000eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3001eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3002eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3003eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3004eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3005eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3006eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3007eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3008eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3009eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3010eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3011eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3012eea2e341Smrgelse
3013eea2e341SmrgAC_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])
3014eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3015eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3016eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3017eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3018eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3019eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3020eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3021eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3022eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3023eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3024eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3025eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3026eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3027eea2e341Smrgfi
3028eea2e341Smrg
3029eea2e341SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3030eea2e341Smrg]) # XORG_COMPILER_FLAGS
3031eea2e341Smrg
3032dd77ae96Smrg# XORG_CWARNFLAGS
3033dd77ae96Smrg# ---------------
3034dd77ae96Smrg# Minimum version: 1.2.0
3035eea2e341Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3036dd77ae96Smrg#
3037dd77ae96Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3038dd77ae96Smrg#
3039eea2e341Smrg# This function is deprecated because it defines -fno-strict-aliasing
3040eea2e341Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
3041eea2e341Smrg# is needed, then it should be added explicitly in the module when
3042eea2e341Smrg# it is updated to use BASE_CFLAGS.
3043eea2e341Smrg#
3044dd77ae96SmrgAC_DEFUN([XORG_CWARNFLAGS], [
3045eea2e341SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3046eea2e341SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
3047eea2e341SmrgAC_LANG_CASE(
3048eea2e341Smrg	[C], [
3049eea2e341Smrg		CWARNFLAGS="$BASE_CFLAGS"
3050eea2e341Smrg		if  test "x$GCC" = xyes ; then
3051eea2e341Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3052eea2e341Smrg		fi
3053eea2e341Smrg		AC_SUBST(CWARNFLAGS)
3054eea2e341Smrg	]
3055eea2e341Smrg)
3056dd77ae96Smrg]) # XORG_CWARNFLAGS
3057dd77ae96Smrg
3058dd77ae96Smrg# XORG_STRICT_OPTION
3059dd77ae96Smrg# -----------------------
3060dd77ae96Smrg# Minimum version: 1.3.0
3061dd77ae96Smrg#
3062eea2e341Smrg# Add configure option to enable strict compilation flags, such as treating
3063eea2e341Smrg# warnings as fatal errors.
3064eea2e341Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
3065eea2e341Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3066eea2e341Smrg#
3067eea2e341Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3068eea2e341Smrg# when strict compilation is unconditionally desired.
3069dd77ae96SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3070dd77ae96SmrgAC_REQUIRE([XORG_CWARNFLAGS])
3071eea2e341SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3072dd77ae96Smrg
3073dd77ae96SmrgAC_ARG_ENABLE(strict-compilation,
3074dd77ae96Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3075dd77ae96Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3076dd77ae96Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3077eea2e341Smrg
3078eea2e341SmrgAC_LANG_CASE(
3079eea2e341Smrg        [C], [
3080eea2e341Smrg                define([PREFIX], [C])
3081eea2e341Smrg        ],
3082eea2e341Smrg        [C++], [
3083eea2e341Smrg                define([PREFIX], [CXX])
3084eea2e341Smrg        ]
3085eea2e341Smrg)
3086eea2e341Smrg
3087eea2e341Smrg[STRICT_]PREFIX[FLAGS]=""
3088eea2e341SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3089eea2e341SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3090eea2e341Smrg
3091eea2e341Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3092eea2e341Smrg# activate it with -Werror, so we add it here explicitly.
3093eea2e341SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3094eea2e341Smrg
3095dd77ae96Smrgif test "x$STRICT_COMPILE" = "xyes"; then
3096eea2e341Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3097eea2e341Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3098dd77ae96Smrgfi
3099eea2e341SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
3100eea2e341SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
3101eea2e341SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3102dd77ae96Smrg]) # XORG_STRICT_OPTION
3103dd77ae96Smrg
3104dd77ae96Smrg# XORG_DEFAULT_OPTIONS
3105dd77ae96Smrg# --------------------
3106dd77ae96Smrg# Minimum version: 1.3.0
3107dd77ae96Smrg#
3108dd77ae96Smrg# Defines default options for X.Org modules.
3109dd77ae96Smrg#
3110dd77ae96SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
311108e312fdSmrgAC_REQUIRE([AC_PROG_INSTALL])
3112eea2e341SmrgXORG_COMPILER_FLAGS
3113dd77ae96SmrgXORG_CWARNFLAGS
3114dd77ae96SmrgXORG_STRICT_OPTION
3115dd77ae96SmrgXORG_RELEASE_VERSION
3116dd77ae96SmrgXORG_CHANGELOG
311708e312fdSmrgXORG_INSTALL
3118dd77ae96SmrgXORG_MANPAGE_SECTIONS
311908e312fdSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
312008e312fdSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3121dd77ae96Smrg]) # XORG_DEFAULT_OPTIONS
312208e312fdSmrg
312308e312fdSmrg# XORG_INSTALL()
312408e312fdSmrg# ----------------
312508e312fdSmrg# Minimum version: 1.4.0
312608e312fdSmrg#
312708e312fdSmrg# Defines the variable INSTALL_CMD as the command to copy
312808e312fdSmrg# INSTALL from $prefix/share/util-macros.
312908e312fdSmrg#
313008e312fdSmrgAC_DEFUN([XORG_INSTALL], [
313108e312fdSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
313208e312fdSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
313308e312fdSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
313408e312fdSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
313508e312fdSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
313608e312fdSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
313708e312fdSmrgAC_SUBST([INSTALL_CMD])
313808e312fdSmrg]) # XORG_INSTALL
313972b4363aSmrgdnl Copyright 2005 Red Hat, Inc
314072b4363aSmrgdnl
314172b4363aSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
314272b4363aSmrgdnl documentation for any purpose is hereby granted without fee, provided that
314372b4363aSmrgdnl the above copyright notice appear in all copies and that both that
314472b4363aSmrgdnl copyright notice and this permission notice appear in supporting
314572b4363aSmrgdnl documentation.
314672b4363aSmrgdnl
314772b4363aSmrgdnl The above copyright notice and this permission notice shall be included
314872b4363aSmrgdnl in all copies or substantial portions of the Software.
314972b4363aSmrgdnl
315072b4363aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
315172b4363aSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
315272b4363aSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
315372b4363aSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
315472b4363aSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
315572b4363aSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
315672b4363aSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
315772b4363aSmrgdnl
315872b4363aSmrgdnl Except as contained in this notice, the name of the copyright holders shall
315972b4363aSmrgdnl not be used in advertising or otherwise to promote the sale, use or
316072b4363aSmrgdnl other dealings in this Software without prior written authorization
316172b4363aSmrgdnl from the copyright holders.
316272b4363aSmrgdnl
316372b4363aSmrg
316472b4363aSmrg# XORG_RELEASE_VERSION
316572b4363aSmrg# --------------------
316608e312fdSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
316733dddc75Smrg
316872b4363aSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
316972b4363aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
317072b4363aSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
317172b4363aSmrg		[Major version of this package])
3172dd77ae96Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
317372b4363aSmrg	if test "x$PVM" = "x"; then
317472b4363aSmrg		PVM="0"
317572b4363aSmrg	fi
317672b4363aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
317772b4363aSmrg		[$PVM],
317872b4363aSmrg		[Minor version of this package])
3179dd77ae96Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
318072b4363aSmrg	if test "x$PVP" = "x"; then
318172b4363aSmrg		PVP="0"
318272b4363aSmrg	fi
318372b4363aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
318472b4363aSmrg		[$PVP],
318572b4363aSmrg		[Patch version of this package])
318672b4363aSmrg])
318772b4363aSmrg
3188dd77ae96Smrg# XORG_CHANGELOG()
3189dd77ae96Smrg# ----------------
3190dd77ae96Smrg# Minimum version: 1.2.0
3191dd77ae96Smrg#
3192dd77ae96Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3193dd77ae96Smrg# ChangeLog from git.
3194dd77ae96Smrg#
3195dd77ae96Smrg#
3196dd77ae96SmrgAC_DEFUN([XORG_CHANGELOG], [
319708e312fdSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
319808e312fdSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
319908e312fdSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3200dd77ae96Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3201dd77ae96SmrgAC_SUBST([CHANGELOG_CMD])
3202dd77ae96Smrg]) # XORG_CHANGELOG
3203dd77ae96Smrg
3204