aclocal.m4 revision 94a251fd
194a251fdSmrg# generated automatically by aclocal 1.11.2 -*- Autoconf -*-
2e6232409Smrg
3e6232409Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
494a251fdSmrg# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
594a251fdSmrg# Inc.
6e6232409Smrg# This file is free software; the Free Software Foundation
7e6232409Smrg# gives unlimited permission to copy and/or distribute it,
8e6232409Smrg# with or without modifications, as long as this notice is preserved.
9e6232409Smrg
10e6232409Smrg# This program is distributed in the hope that it will be useful,
11e6232409Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12e6232409Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13e6232409Smrg# PARTICULAR PURPOSE.
14e6232409Smrg
158fff3f40Smrgm4_ifndef([AC_AUTOCONF_VERSION],
168fff3f40Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1794a251fdSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
1894a251fdSmrg[m4_warning([this file was generated for autoconf 2.68.
198fff3f40SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
208fff3f40SmrgIf you have problems, you may need to regenerate the build system entirely.
218fff3f40SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
22e6232409Smrg
2394a251fdSmrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
2494a251fdSmrg# Foundation, Inc.
258fff3f40Smrg#
2694a251fdSmrg# This file is free software; the Free Software Foundation
2794a251fdSmrg# gives unlimited permission to copy and/or distribute it,
2894a251fdSmrg# with or without modifications, as long as this notice is preserved.
29e6232409Smrg
3094a251fdSmrg# serial 1
31e6232409Smrg
3294a251fdSmrg# AM_AUTOMAKE_VERSION(VERSION)
3394a251fdSmrg# ----------------------------
3494a251fdSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3594a251fdSmrg# generated from the m4 files accompanying Automake X.Y.
3694a251fdSmrg# (This private macro should not be called outside this file.)
3794a251fdSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3894a251fdSmrg[am__api_version='1.11'
3994a251fdSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
4094a251fdSmrgdnl require some minimum version.  Point them to the right macro.
4194a251fdSmrgm4_if([$1], [1.11.2], [],
4294a251fdSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4394a251fdSmrg])
44e6232409Smrg
4594a251fdSmrg# _AM_AUTOCONF_VERSION(VERSION)
4694a251fdSmrg# -----------------------------
4794a251fdSmrg# aclocal traces this macro to find the Autoconf version.
4894a251fdSmrg# This is a private macro too.  Using m4_define simplifies
4994a251fdSmrg# the logic in aclocal, which can simply ignore this definition.
5094a251fdSmrgm4_define([_AM_AUTOCONF_VERSION], [])
518fff3f40Smrg
5294a251fdSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5394a251fdSmrg# -------------------------------
5494a251fdSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5594a251fdSmrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5694a251fdSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5794a251fdSmrg[AM_AUTOMAKE_VERSION([1.11.2])dnl
5894a251fdSmrgm4_ifndef([AC_AUTOCONF_VERSION],
5994a251fdSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
6094a251fdSmrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
618fff3f40Smrg
6294a251fdSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
638fff3f40Smrg
6494a251fdSmrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
6594a251fdSmrg#
6694a251fdSmrg# This file is free software; the Free Software Foundation
6794a251fdSmrg# gives unlimited permission to copy and/or distribute it,
6894a251fdSmrg# with or without modifications, as long as this notice is preserved.
698fff3f40Smrg
7094a251fdSmrg# serial 1
7194a251fdSmrg
7294a251fdSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
7394a251fdSmrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
7494a251fdSmrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
75e6232409Smrg#
7694a251fdSmrg# Of course, Automake must honor this variable whenever it calls a
7794a251fdSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7894a251fdSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7994a251fdSmrg# depending on how configure is run.  This is pretty annoying, since
8094a251fdSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
8194a251fdSmrg# source directory, any form will work fine, but in subdirectories a
8294a251fdSmrg# relative path needs to be adjusted first.
83e6232409Smrg#
8494a251fdSmrg# $ac_aux_dir/missing
8594a251fdSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8694a251fdSmrg# $top_srcdir/$ac_aux_dir/missing
8794a251fdSmrg#    fails if $ac_aux_dir is absolute,
8894a251fdSmrg#    fails when called from a subdirectory in a VPATH build with
8994a251fdSmrg#          a relative $ac_aux_dir
90e6232409Smrg#
9194a251fdSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
9294a251fdSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
9394a251fdSmrg# harmless because $srcdir is `.', but things will broke when you
9494a251fdSmrg# start a VPATH build or use an absolute $srcdir.
95e6232409Smrg#
9694a251fdSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9794a251fdSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9894a251fdSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9994a251fdSmrg# and then we would define $MISSING as
10094a251fdSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
10194a251fdSmrg# This will work as long as MISSING is not called from configure, because
10294a251fdSmrg# unfortunately $(top_srcdir) has no meaning in configure.
10394a251fdSmrg# However there are other variables, like CC, which are often used in
10494a251fdSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10594a251fdSmrg#
10694a251fdSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
10794a251fdSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
10894a251fdSmrg# configured tree to be moved without reconfiguration.
109e6232409Smrg
11094a251fdSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
11194a251fdSmrg[dnl Rely on autoconf to set up CDPATH properly.
11294a251fdSmrgAC_PREREQ([2.50])dnl
11394a251fdSmrg# expand $ac_aux_dir to an absolute path
11494a251fdSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
11594a251fdSmrg])
116e6232409Smrg
11794a251fdSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
118e6232409Smrg
11994a251fdSmrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
12094a251fdSmrg# Free Software Foundation, Inc.
12194a251fdSmrg#
12294a251fdSmrg# This file is free software; the Free Software Foundation
12394a251fdSmrg# gives unlimited permission to copy and/or distribute it,
12494a251fdSmrg# with or without modifications, as long as this notice is preserved.
125e6232409Smrg
12694a251fdSmrg# serial 9
127e6232409Smrg
12894a251fdSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12994a251fdSmrg# -------------------------------------
13094a251fdSmrg# Define a conditional.
13194a251fdSmrgAC_DEFUN([AM_CONDITIONAL],
13294a251fdSmrg[AC_PREREQ(2.52)dnl
13394a251fdSmrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
13494a251fdSmrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
13594a251fdSmrgAC_SUBST([$1_TRUE])dnl
13694a251fdSmrgAC_SUBST([$1_FALSE])dnl
13794a251fdSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
13894a251fdSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13994a251fdSmrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
14094a251fdSmrgif $2; then
14194a251fdSmrg  $1_TRUE=
14294a251fdSmrg  $1_FALSE='#'
14394a251fdSmrgelse
14494a251fdSmrg  $1_TRUE='#'
14594a251fdSmrg  $1_FALSE=
14694a251fdSmrgfi
14794a251fdSmrgAC_CONFIG_COMMANDS_PRE(
14894a251fdSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14994a251fdSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
15094a251fdSmrgUsually this means the macro was only invoked conditionally.]])
15194a251fdSmrgfi])])
152e6232409Smrg
15394a251fdSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
15494a251fdSmrg# 2010, 2011 Free Software Foundation, Inc.
15594a251fdSmrg#
15694a251fdSmrg# This file is free software; the Free Software Foundation
15794a251fdSmrg# gives unlimited permission to copy and/or distribute it,
15894a251fdSmrg# with or without modifications, as long as this notice is preserved.
159e6232409Smrg
16094a251fdSmrg# serial 12
161e6232409Smrg
16294a251fdSmrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
16394a251fdSmrg# written in clear, in which case automake, when reading aclocal.m4,
16494a251fdSmrg# will think it sees a *use*, and therefore will trigger all it's
16594a251fdSmrg# C support machinery.  Also note that it means that autoscan, seeing
16694a251fdSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
167e6232409Smrg
168e6232409Smrg
16994a251fdSmrg# _AM_DEPENDENCIES(NAME)
17094a251fdSmrg# ----------------------
17194a251fdSmrg# See how the compiler implements dependency checking.
17294a251fdSmrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
17394a251fdSmrg# We try a few techniques and use that to set a single cache variable.
17494a251fdSmrg#
17594a251fdSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
17694a251fdSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
17794a251fdSmrg# dependency, and given that the user is not expected to run this macro,
17894a251fdSmrg# just rely on AC_PROG_CC.
17994a251fdSmrgAC_DEFUN([_AM_DEPENDENCIES],
18094a251fdSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
18194a251fdSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
18294a251fdSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
18394a251fdSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
184e6232409Smrg
18594a251fdSmrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
18694a251fdSmrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
18794a251fdSmrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
18894a251fdSmrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
18994a251fdSmrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
19094a251fdSmrg                   [depcc="$$1"   am_compiler_list=])
191e6232409Smrg
19294a251fdSmrgAC_CACHE_CHECK([dependency style of $depcc],
19394a251fdSmrg               [am_cv_$1_dependencies_compiler_type],
19494a251fdSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
19594a251fdSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
19694a251fdSmrg  # making bogus files that we don't know about and never remove.  For
19794a251fdSmrg  # instance it was reported that on HP-UX the gcc test will end up
19894a251fdSmrg  # making a dummy file named `D' -- because `-MD' means `put the output
19994a251fdSmrg  # in D'.
20094a251fdSmrg  rm -rf conftest.dir
20194a251fdSmrg  mkdir conftest.dir
20294a251fdSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
20394a251fdSmrg  # using a relative directory.
20494a251fdSmrg  cp "$am_depcomp" conftest.dir
20594a251fdSmrg  cd conftest.dir
20694a251fdSmrg  # We will build objects and dependencies in a subdirectory because
20794a251fdSmrg  # it helps to detect inapplicable dependency modes.  For instance
20894a251fdSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
20994a251fdSmrg  # side effect of compilation, but ICC will put the dependencies in
21094a251fdSmrg  # the current directory while Tru64 will put them in the object
21194a251fdSmrg  # directory.
21294a251fdSmrg  mkdir sub
213e6232409Smrg
21494a251fdSmrg  am_cv_$1_dependencies_compiler_type=none
21594a251fdSmrg  if test "$am_compiler_list" = ""; then
21694a251fdSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
21794a251fdSmrg  fi
21894a251fdSmrg  am__universal=false
21994a251fdSmrg  m4_case([$1], [CC],
22094a251fdSmrg    [case " $depcc " in #(
22194a251fdSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
22294a251fdSmrg     esac],
22394a251fdSmrg    [CXX],
22494a251fdSmrg    [case " $depcc " in #(
22594a251fdSmrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
22694a251fdSmrg     esac])
227e6232409Smrg
22894a251fdSmrg  for depmode in $am_compiler_list; do
22994a251fdSmrg    # Setup a source with many dependencies, because some compilers
23094a251fdSmrg    # like to wrap large dependency lists on column 80 (with \), and
23194a251fdSmrg    # we should not choose a depcomp mode which is confused by this.
23294a251fdSmrg    #
23394a251fdSmrg    # We need to recreate these files for each test, as the compiler may
23494a251fdSmrg    # overwrite some of them when testing with obscure command lines.
23594a251fdSmrg    # This happens at least with the AIX C compiler.
23694a251fdSmrg    : > sub/conftest.c
23794a251fdSmrg    for i in 1 2 3 4 5 6; do
23894a251fdSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
23994a251fdSmrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
24094a251fdSmrg      # Solaris 8's {/usr,}/bin/sh.
24194a251fdSmrg      touch sub/conftst$i.h
24294a251fdSmrg    done
24394a251fdSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
244e6232409Smrg
24594a251fdSmrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
24694a251fdSmrg    # mode.  It turns out that the SunPro C++ compiler does not properly
24794a251fdSmrg    # handle `-M -o', and we need to detect this.  Also, some Intel
24894a251fdSmrg    # versions had trouble with output in subdirs
24994a251fdSmrg    am__obj=sub/conftest.${OBJEXT-o}
25094a251fdSmrg    am__minus_obj="-o $am__obj"
25194a251fdSmrg    case $depmode in
25294a251fdSmrg    gcc)
25394a251fdSmrg      # This depmode causes a compiler race in universal mode.
25494a251fdSmrg      test "$am__universal" = false || continue
25594a251fdSmrg      ;;
25694a251fdSmrg    nosideeffect)
25794a251fdSmrg      # after this tag, mechanisms are not by side-effect, so they'll
25894a251fdSmrg      # only be used when explicitly requested
25994a251fdSmrg      if test "x$enable_dependency_tracking" = xyes; then
26094a251fdSmrg	continue
26194a251fdSmrg      else
26294a251fdSmrg	break
26394a251fdSmrg      fi
26494a251fdSmrg      ;;
26594a251fdSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
26694a251fdSmrg      # This compiler won't grok `-c -o', but also, the minuso test has
26794a251fdSmrg      # not run yet.  These depmodes are late enough in the game, and
26894a251fdSmrg      # so weak that their functioning should not be impacted.
26994a251fdSmrg      am__obj=conftest.${OBJEXT-o}
27094a251fdSmrg      am__minus_obj=
27194a251fdSmrg      ;;
27294a251fdSmrg    none) break ;;
27394a251fdSmrg    esac
27494a251fdSmrg    if depmode=$depmode \
27594a251fdSmrg       source=sub/conftest.c object=$am__obj \
27694a251fdSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
27794a251fdSmrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
27894a251fdSmrg         >/dev/null 2>conftest.err &&
27994a251fdSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
28094a251fdSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
28194a251fdSmrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
28294a251fdSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
28394a251fdSmrg      # icc doesn't choke on unknown options, it will just issue warnings
28494a251fdSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
28594a251fdSmrg      # that says an option was ignored or not supported.
28694a251fdSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
28794a251fdSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
28894a251fdSmrg      # The diagnosis changed in icc 8.0:
28994a251fdSmrg      #   icc: Command line remark: option '-MP' not supported
29094a251fdSmrg      if (grep 'ignoring option' conftest.err ||
29194a251fdSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
29294a251fdSmrg        am_cv_$1_dependencies_compiler_type=$depmode
29394a251fdSmrg        break
29494a251fdSmrg      fi
29594a251fdSmrg    fi
29694a251fdSmrg  done
29794a251fdSmrg
29894a251fdSmrg  cd ..
29994a251fdSmrg  rm -rf conftest.dir
300e6232409Smrgelse
30194a251fdSmrg  am_cv_$1_dependencies_compiler_type=none
302e6232409Smrgfi
30394a251fdSmrg])
30494a251fdSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
30594a251fdSmrgAM_CONDITIONAL([am__fastdep$1], [
30694a251fdSmrg  test "x$enable_dependency_tracking" != xno \
30794a251fdSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
30894a251fdSmrg])
309e6232409Smrg
310e6232409Smrg
31194a251fdSmrg# AM_SET_DEPDIR
31294a251fdSmrg# -------------
31394a251fdSmrg# Choose a directory name for dependency files.
31494a251fdSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
31594a251fdSmrgAC_DEFUN([AM_SET_DEPDIR],
31694a251fdSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
31794a251fdSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
31894a251fdSmrg])
319e6232409Smrg
320e6232409Smrg
32194a251fdSmrg# AM_DEP_TRACK
32294a251fdSmrg# ------------
32394a251fdSmrgAC_DEFUN([AM_DEP_TRACK],
32494a251fdSmrg[AC_ARG_ENABLE(dependency-tracking,
32594a251fdSmrg[  --disable-dependency-tracking  speeds up one-time build
32694a251fdSmrg  --enable-dependency-tracking   do not reject slow dependency extractors])
32794a251fdSmrgif test "x$enable_dependency_tracking" != xno; then
32894a251fdSmrg  am_depcomp="$ac_aux_dir/depcomp"
32994a251fdSmrg  AMDEPBACKSLASH='\'
33094a251fdSmrg  am__nodep='_no'
331e6232409Smrgfi
33294a251fdSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
33394a251fdSmrgAC_SUBST([AMDEPBACKSLASH])dnl
33494a251fdSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
33594a251fdSmrgAC_SUBST([am__nodep])dnl
33694a251fdSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33794a251fdSmrg])
338e6232409Smrg
33994a251fdSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
340e6232409Smrg
34194a251fdSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
34294a251fdSmrg# Free Software Foundation, Inc.
34394a251fdSmrg#
34494a251fdSmrg# This file is free software; the Free Software Foundation
34594a251fdSmrg# gives unlimited permission to copy and/or distribute it,
34694a251fdSmrg# with or without modifications, as long as this notice is preserved.
347e6232409Smrg
34894a251fdSmrg#serial 5
349e6232409Smrg
35094a251fdSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
35194a251fdSmrg# ------------------------------
35294a251fdSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
35394a251fdSmrg[{
35494a251fdSmrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
35594a251fdSmrg  # are listed without --file.  Let's play safe and only enable the eval
35694a251fdSmrg  # if we detect the quoting.
35794a251fdSmrg  case $CONFIG_FILES in
35894a251fdSmrg  *\'*) eval set x "$CONFIG_FILES" ;;
35994a251fdSmrg  *)   set x $CONFIG_FILES ;;
36094a251fdSmrg  esac
36194a251fdSmrg  shift
36294a251fdSmrg  for mf
36394a251fdSmrg  do
36494a251fdSmrg    # Strip MF so we end up with the name of the file.
36594a251fdSmrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
36694a251fdSmrg    # Check whether this is an Automake generated Makefile or not.
36794a251fdSmrg    # We used to match only the files named `Makefile.in', but
36894a251fdSmrg    # some people rename them; so instead we look at the file content.
36994a251fdSmrg    # Grep'ing the first line is not enough: some people post-process
37094a251fdSmrg    # each Makefile.in and add a new line on top of each file to say so.
37194a251fdSmrg    # Grep'ing the whole file is not good either: AIX grep has a line
37294a251fdSmrg    # limit of 2048, but all sed's we know have understand at least 4000.
37394a251fdSmrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
37494a251fdSmrg      dirpart=`AS_DIRNAME("$mf")`
37594a251fdSmrg    else
37694a251fdSmrg      continue
37794a251fdSmrg    fi
37894a251fdSmrg    # Extract the definition of DEPDIR, am__include, and am__quote
37994a251fdSmrg    # from the Makefile without running `make'.
38094a251fdSmrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
38194a251fdSmrg    test -z "$DEPDIR" && continue
38294a251fdSmrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
38394a251fdSmrg    test -z "am__include" && continue
38494a251fdSmrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
38594a251fdSmrg    # When using ansi2knr, U may be empty or an underscore; expand it
38694a251fdSmrg    U=`sed -n 's/^U = //p' < "$mf"`
38794a251fdSmrg    # Find all dependency output files, they are included files with
38894a251fdSmrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
38994a251fdSmrg    # simplest approach to changing $(DEPDIR) to its actual value in the
39094a251fdSmrg    # expansion.
39194a251fdSmrg    for file in `sed -n "
39294a251fdSmrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
39394a251fdSmrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
39494a251fdSmrg      # Make sure the directory exists.
39594a251fdSmrg      test -f "$dirpart/$file" && continue
39694a251fdSmrg      fdir=`AS_DIRNAME(["$file"])`
39794a251fdSmrg      AS_MKDIR_P([$dirpart/$fdir])
39894a251fdSmrg      # echo "creating $dirpart/$file"
39994a251fdSmrg      echo '# dummy' > "$dirpart/$file"
40094a251fdSmrg    done
40194a251fdSmrg  done
40294a251fdSmrg}
40394a251fdSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
404e6232409Smrg
405e6232409Smrg
40694a251fdSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
40794a251fdSmrg# -----------------------------
40894a251fdSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
409e6232409Smrg#
41094a251fdSmrg# This code is only required when automatic dependency tracking
41194a251fdSmrg# is enabled.  FIXME.  This creates each `.P' file that we will
41294a251fdSmrg# need in order to bootstrap the dependency handling code.
41394a251fdSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
41494a251fdSmrg[AC_CONFIG_COMMANDS([depfiles],
41594a251fdSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
41694a251fdSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
41794a251fdSmrg])
418e6232409Smrg
41994a251fdSmrg# Do all the work for Automake.                             -*- Autoconf -*-
420e6232409Smrg
42194a251fdSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
42294a251fdSmrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
423e6232409Smrg#
42494a251fdSmrg# This file is free software; the Free Software Foundation
42594a251fdSmrg# gives unlimited permission to copy and/or distribute it,
42694a251fdSmrg# with or without modifications, as long as this notice is preserved.
427e6232409Smrg
42894a251fdSmrg# serial 16
429e6232409Smrg
43094a251fdSmrg# This macro actually does too much.  Some checks are only needed if
43194a251fdSmrg# your package does certain things.  But this isn't really a big deal.
432e6232409Smrg
43394a251fdSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
43494a251fdSmrg# AM_INIT_AUTOMAKE([OPTIONS])
43594a251fdSmrg# -----------------------------------------------
43694a251fdSmrg# The call with PACKAGE and VERSION arguments is the old style
43794a251fdSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
43894a251fdSmrg# and VERSION should now be passed to AC_INIT and removed from
43994a251fdSmrg# the call to AM_INIT_AUTOMAKE.
44094a251fdSmrg# We support both call styles for the transition.  After
44194a251fdSmrg# the next Automake release, Autoconf can make the AC_INIT
44294a251fdSmrg# arguments mandatory, and then we can depend on a new Autoconf
44394a251fdSmrg# release and drop the old call support.
44494a251fdSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
44594a251fdSmrg[AC_PREREQ([2.62])dnl
44694a251fdSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
44794a251fdSmrgdnl the ones we care about.
44894a251fdSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
44994a251fdSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
45094a251fdSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
45194a251fdSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
45294a251fdSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
45394a251fdSmrg  # is not polluted with repeated "-I."
45494a251fdSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
45594a251fdSmrg  # test to see if srcdir already configured
45694a251fdSmrg  if test -f $srcdir/config.status; then
45794a251fdSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
45894a251fdSmrg  fi
459e6232409Smrgfi
460e6232409Smrg
46194a251fdSmrg# test whether we have cygpath
46294a251fdSmrgif test -z "$CYGPATH_W"; then
46394a251fdSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
46494a251fdSmrg    CYGPATH_W='cygpath -w'
46594a251fdSmrg  else
46694a251fdSmrg    CYGPATH_W=echo
46794a251fdSmrg  fi
46894a251fdSmrgfi
46994a251fdSmrgAC_SUBST([CYGPATH_W])
470e6232409Smrg
47194a251fdSmrg# Define the identity of the package.
47294a251fdSmrgdnl Distinguish between old-style and new-style calls.
47394a251fdSmrgm4_ifval([$2],
47494a251fdSmrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
47594a251fdSmrg AC_SUBST([PACKAGE], [$1])dnl
47694a251fdSmrg AC_SUBST([VERSION], [$2])],
47794a251fdSmrg[_AM_SET_OPTIONS([$1])dnl
47894a251fdSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47994a251fdSmrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
48094a251fdSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
48194a251fdSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
48294a251fdSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
483e6232409Smrg
48494a251fdSmrg_AM_IF_OPTION([no-define],,
48594a251fdSmrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
48694a251fdSmrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
487e6232409Smrg
48894a251fdSmrg# Some tools Automake needs.
48994a251fdSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
49094a251fdSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
49194a251fdSmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
49294a251fdSmrgAM_MISSING_PROG(AUTOCONF, autoconf)
49394a251fdSmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
49494a251fdSmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
49594a251fdSmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
49694a251fdSmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49794a251fdSmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49894a251fdSmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
49994a251fdSmrg# We need awk for the "check" target.  The system "awk" is bad on
50094a251fdSmrg# some platforms.
50194a251fdSmrgAC_REQUIRE([AC_PROG_AWK])dnl
50294a251fdSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50394a251fdSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50494a251fdSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50594a251fdSmrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50694a251fdSmrg			     [_AM_PROG_TAR([v7])])])
50794a251fdSmrg_AM_IF_OPTION([no-dependencies],,
50894a251fdSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50994a251fdSmrg		  [_AM_DEPENDENCIES(CC)],
51094a251fdSmrg		  [define([AC_PROG_CC],
51194a251fdSmrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
51294a251fdSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51394a251fdSmrg		  [_AM_DEPENDENCIES(CXX)],
51494a251fdSmrg		  [define([AC_PROG_CXX],
51594a251fdSmrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
51694a251fdSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51794a251fdSmrg		  [_AM_DEPENDENCIES(OBJC)],
51894a251fdSmrg		  [define([AC_PROG_OBJC],
51994a251fdSmrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
52094a251fdSmrg])
52194a251fdSmrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
52294a251fdSmrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
52394a251fdSmrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
52494a251fdSmrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
52594a251fdSmrgAC_CONFIG_COMMANDS_PRE(dnl
52694a251fdSmrg[m4_provide_if([_AM_COMPILER_EXEEXT],
52794a251fdSmrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
52894a251fdSmrg])
529e6232409Smrg
53094a251fdSmrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
53194a251fdSmrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
53294a251fdSmrgdnl mangled by Autoconf and run in a shell conditional statement.
53394a251fdSmrgm4_define([_AC_COMPILER_EXEEXT],
53494a251fdSmrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
535e6232409Smrg
536e6232409Smrg
53794a251fdSmrg# When config.status generates a header, we must update the stamp-h file.
53894a251fdSmrg# This file resides in the same directory as the config header
53994a251fdSmrg# that is generated.  The stamp files are numbered to have different names.
540e6232409Smrg
54194a251fdSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
54294a251fdSmrg# loop where config.status creates the headers, so we can generate
54394a251fdSmrg# our stamp files there.
54494a251fdSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
54594a251fdSmrg[# Compute $1's index in $config_headers.
54694a251fdSmrg_am_arg=$1
54794a251fdSmrg_am_stamp_count=1
54894a251fdSmrgfor _am_header in $config_headers :; do
54994a251fdSmrg  case $_am_header in
55094a251fdSmrg    $_am_arg | $_am_arg:* )
55194a251fdSmrg      break ;;
55294a251fdSmrg    * )
55394a251fdSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
55494a251fdSmrg  esac
55594a251fdSmrgdone
55694a251fdSmrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
557e6232409Smrg
55894a251fdSmrg# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
55994a251fdSmrg# Inc.
560e6232409Smrg#
56194a251fdSmrg# This file is free software; the Free Software Foundation
56294a251fdSmrg# gives unlimited permission to copy and/or distribute it,
56394a251fdSmrg# with or without modifications, as long as this notice is preserved.
564e6232409Smrg
56594a251fdSmrg# serial 1
566e6232409Smrg
56794a251fdSmrg# AM_PROG_INSTALL_SH
56894a251fdSmrg# ------------------
56994a251fdSmrg# Define $install_sh.
57094a251fdSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
57194a251fdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
57294a251fdSmrgif test x"${install_sh}" != xset; then
57394a251fdSmrg  case $am_aux_dir in
57494a251fdSmrg  *\ * | *\	*)
57594a251fdSmrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
57694a251fdSmrg  *)
57794a251fdSmrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
57894a251fdSmrg  esac
5798fff3f40Smrgfi
58094a251fdSmrgAC_SUBST(install_sh)])
581e6232409Smrg
58294a251fdSmrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
58394a251fdSmrg#
58494a251fdSmrg# This file is free software; the Free Software Foundation
58594a251fdSmrg# gives unlimited permission to copy and/or distribute it,
58694a251fdSmrg# with or without modifications, as long as this notice is preserved.
587e6232409Smrg
58894a251fdSmrg# serial 2
589e6232409Smrg
59094a251fdSmrg# Check whether the underlying file-system supports filenames
59194a251fdSmrg# with a leading dot.  For instance MS-DOS doesn't.
59294a251fdSmrgAC_DEFUN([AM_SET_LEADING_DOT],
59394a251fdSmrg[rm -rf .tst 2>/dev/null
59494a251fdSmrgmkdir .tst 2>/dev/null
59594a251fdSmrgif test -d .tst; then
59694a251fdSmrg  am__leading_dot=.
59794a251fdSmrgelse
59894a251fdSmrg  am__leading_dot=_
5998fff3f40Smrgfi
60094a251fdSmrgrmdir .tst 2>/dev/null
60194a251fdSmrgAC_SUBST([am__leading_dot])])
602e6232409Smrg
60394a251fdSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
60494a251fdSmrg# From Jim Meyering
605e6232409Smrg
60694a251fdSmrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
60794a251fdSmrg# 2011 Free Software Foundation, Inc.
6088fff3f40Smrg#
60994a251fdSmrg# This file is free software; the Free Software Foundation
61094a251fdSmrg# gives unlimited permission to copy and/or distribute it,
61194a251fdSmrg# with or without modifications, as long as this notice is preserved.
61294a251fdSmrg
61394a251fdSmrg# serial 5
61494a251fdSmrg
61594a251fdSmrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
61694a251fdSmrg# ----------------------------------
61794a251fdSmrg# Control maintainer-specific portions of Makefiles.
61894a251fdSmrg# Default is to disable them, unless `enable' is passed literally.
61994a251fdSmrg# For symmetry, `disable' may be passed as well.  Anyway, the user
62094a251fdSmrg# can override the default with the --enable/--disable switch.
62194a251fdSmrgAC_DEFUN([AM_MAINTAINER_MODE],
62294a251fdSmrg[m4_case(m4_default([$1], [disable]),
62394a251fdSmrg       [enable], [m4_define([am_maintainer_other], [disable])],
62494a251fdSmrg       [disable], [m4_define([am_maintainer_other], [enable])],
62594a251fdSmrg       [m4_define([am_maintainer_other], [enable])
62694a251fdSmrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
62794a251fdSmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
62894a251fdSmrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
62994a251fdSmrg  AC_ARG_ENABLE([maintainer-mode],
63094a251fdSmrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
63194a251fdSmrg			  (and sometimes confusing) to the casual installer],
63294a251fdSmrg      [USE_MAINTAINER_MODE=$enableval],
63394a251fdSmrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
63494a251fdSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
63594a251fdSmrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
63694a251fdSmrg  MAINT=$MAINTAINER_MODE_TRUE
63794a251fdSmrg  AC_SUBST([MAINT])dnl
63894a251fdSmrg]
63994a251fdSmrg)
64094a251fdSmrg
64194a251fdSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
64294a251fdSmrg
64394a251fdSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
64494a251fdSmrg
64594a251fdSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
6468fff3f40Smrg#
64794a251fdSmrg# This file is free software; the Free Software Foundation
64894a251fdSmrg# gives unlimited permission to copy and/or distribute it,
64994a251fdSmrg# with or without modifications, as long as this notice is preserved.
6508fff3f40Smrg
65194a251fdSmrg# serial 4
65294a251fdSmrg
65394a251fdSmrg# AM_MAKE_INCLUDE()
65494a251fdSmrg# -----------------
65594a251fdSmrg# Check to see how make treats includes.
65694a251fdSmrgAC_DEFUN([AM_MAKE_INCLUDE],
65794a251fdSmrg[am_make=${MAKE-make}
65894a251fdSmrgcat > confinc << 'END'
65994a251fdSmrgam__doit:
66094a251fdSmrg	@echo this is the am__doit target
66194a251fdSmrg.PHONY: am__doit
66294a251fdSmrgEND
66394a251fdSmrg# If we don't find an include directive, just comment out the code.
66494a251fdSmrgAC_MSG_CHECKING([for style of include used by $am_make])
66594a251fdSmrgam__include="#"
66694a251fdSmrgam__quote=
66794a251fdSmrg_am_result=none
66894a251fdSmrg# First try GNU make style include.
66994a251fdSmrgecho "include confinc" > confmf
67094a251fdSmrg# Ignore all kinds of additional output from `make'.
67194a251fdSmrgcase `$am_make -s -f confmf 2> /dev/null` in #(
67294a251fdSmrg*the\ am__doit\ target*)
67394a251fdSmrg  am__include=include
67494a251fdSmrg  am__quote=
67594a251fdSmrg  _am_result=GNU
67694a251fdSmrg  ;;
67794a251fdSmrgesac
67894a251fdSmrg# Now try BSD make style include.
67994a251fdSmrgif test "$am__include" = "#"; then
68094a251fdSmrg   echo '.include "confinc"' > confmf
68194a251fdSmrg   case `$am_make -s -f confmf 2> /dev/null` in #(
68294a251fdSmrg   *the\ am__doit\ target*)
68394a251fdSmrg     am__include=.include
68494a251fdSmrg     am__quote="\""
68594a251fdSmrg     _am_result=BSD
68694a251fdSmrg     ;;
68794a251fdSmrg   esac
688e6232409Smrgfi
68994a251fdSmrgAC_SUBST([am__include])
69094a251fdSmrgAC_SUBST([am__quote])
69194a251fdSmrgAC_MSG_RESULT([$_am_result])
69294a251fdSmrgrm -f confinc confmf
69394a251fdSmrg])
694e6232409Smrg
69594a251fdSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
69694a251fdSmrg
69794a251fdSmrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
69894a251fdSmrg# Free Software Foundation, Inc.
699e6232409Smrg#
70094a251fdSmrg# This file is free software; the Free Software Foundation
70194a251fdSmrg# gives unlimited permission to copy and/or distribute it,
70294a251fdSmrg# with or without modifications, as long as this notice is preserved.
7038fff3f40Smrg
70494a251fdSmrg# serial 6
70594a251fdSmrg
70694a251fdSmrg# AM_MISSING_PROG(NAME, PROGRAM)
70794a251fdSmrg# ------------------------------
70894a251fdSmrgAC_DEFUN([AM_MISSING_PROG],
70994a251fdSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71094a251fdSmrg$1=${$1-"${am_missing_run}$2"}
71194a251fdSmrgAC_SUBST($1)])
71294a251fdSmrg
71394a251fdSmrg
71494a251fdSmrg# AM_MISSING_HAS_RUN
71594a251fdSmrg# ------------------
71694a251fdSmrg# Define MISSING if not defined so far and test if it supports --run.
71794a251fdSmrg# If it does, set am_missing_run to use it, otherwise, to nothing.
71894a251fdSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
71994a251fdSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
72094a251fdSmrgAC_REQUIRE_AUX_FILE([missing])dnl
72194a251fdSmrgif test x"${MISSING+set}" != xset; then
72294a251fdSmrg  case $am_aux_dir in
72394a251fdSmrg  *\ * | *\	*)
72494a251fdSmrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
72594a251fdSmrg  *)
72694a251fdSmrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
72794a251fdSmrg  esac
72894a251fdSmrgfi
72994a251fdSmrg# Use eval to expand $SHELL
73094a251fdSmrgif eval "$MISSING --run true"; then
73194a251fdSmrg  am_missing_run="$MISSING --run "
732e6232409Smrgelse
73394a251fdSmrg  am_missing_run=
73494a251fdSmrg  AC_MSG_WARN([`missing' script is too old or missing])
735e6232409Smrgfi
73694a251fdSmrg])
737e6232409Smrg
73894a251fdSmrg# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
73994a251fdSmrg# Inc.
740e6232409Smrg#
74194a251fdSmrg# This file is free software; the Free Software Foundation
74294a251fdSmrg# gives unlimited permission to copy and/or distribute it,
74394a251fdSmrg# with or without modifications, as long as this notice is preserved.
74494a251fdSmrg
74594a251fdSmrg# serial 1
74694a251fdSmrg
74794a251fdSmrg# AM_PROG_MKDIR_P
74894a251fdSmrg# ---------------
74994a251fdSmrg# Check for `mkdir -p'.
75094a251fdSmrgAC_DEFUN([AM_PROG_MKDIR_P],
75194a251fdSmrg[AC_PREREQ([2.60])dnl
75294a251fdSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
75394a251fdSmrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
75494a251fdSmrgdnl while keeping a definition of mkdir_p for backward compatibility.
75594a251fdSmrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
75694a251fdSmrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
75794a251fdSmrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
75894a251fdSmrgdnl adjustment using top_builddir (which is defined more often than
75994a251fdSmrgdnl MKDIR_P).
76094a251fdSmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
76194a251fdSmrgcase $mkdir_p in
76294a251fdSmrg  [[\\/$]]* | ?:[[\\/]]*) ;;
76394a251fdSmrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
76494a251fdSmrgesac
76594a251fdSmrg])
76694a251fdSmrg
76794a251fdSmrg# Helper functions for option handling.                     -*- Autoconf -*-
76894a251fdSmrg
76994a251fdSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
77094a251fdSmrg# Foundation, Inc.
7718fff3f40Smrg#
77294a251fdSmrg# This file is free software; the Free Software Foundation
77394a251fdSmrg# gives unlimited permission to copy and/or distribute it,
77494a251fdSmrg# with or without modifications, as long as this notice is preserved.
77594a251fdSmrg
77694a251fdSmrg# serial 5
77794a251fdSmrg
77894a251fdSmrg# _AM_MANGLE_OPTION(NAME)
77994a251fdSmrg# -----------------------
78094a251fdSmrgAC_DEFUN([_AM_MANGLE_OPTION],
78194a251fdSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
78294a251fdSmrg
78394a251fdSmrg# _AM_SET_OPTION(NAME)
78494a251fdSmrg# --------------------
78594a251fdSmrg# Set option NAME.  Presently that only means defining a flag for this option.
78694a251fdSmrgAC_DEFUN([_AM_SET_OPTION],
78794a251fdSmrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
78894a251fdSmrg
78994a251fdSmrg# _AM_SET_OPTIONS(OPTIONS)
79094a251fdSmrg# ------------------------
79194a251fdSmrg# OPTIONS is a space-separated list of Automake options.
79294a251fdSmrgAC_DEFUN([_AM_SET_OPTIONS],
79394a251fdSmrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
79494a251fdSmrg
79594a251fdSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
79694a251fdSmrg# -------------------------------------------
79794a251fdSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
79894a251fdSmrgAC_DEFUN([_AM_IF_OPTION],
79994a251fdSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
80094a251fdSmrg
80194a251fdSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
80294a251fdSmrg
80394a251fdSmrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
80494a251fdSmrg# Free Software Foundation, Inc.
8058fff3f40Smrg#
80694a251fdSmrg# This file is free software; the Free Software Foundation
80794a251fdSmrg# gives unlimited permission to copy and/or distribute it,
80894a251fdSmrg# with or without modifications, as long as this notice is preserved.
8098fff3f40Smrg
81094a251fdSmrg# serial 5
81194a251fdSmrg
81294a251fdSmrg# AM_SANITY_CHECK
81394a251fdSmrg# ---------------
81494a251fdSmrgAC_DEFUN([AM_SANITY_CHECK],
81594a251fdSmrg[AC_MSG_CHECKING([whether build environment is sane])
81694a251fdSmrg# Just in case
81794a251fdSmrgsleep 1
81894a251fdSmrgecho timestamp > conftest.file
81994a251fdSmrg# Reject unsafe characters in $srcdir or the absolute working directory
82094a251fdSmrg# name.  Accept space and tab only in the latter.
82194a251fdSmrgam_lf='
82294a251fdSmrg'
82394a251fdSmrgcase `pwd` in
82494a251fdSmrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
82594a251fdSmrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
82694a251fdSmrgesac
82794a251fdSmrgcase $srcdir in
82894a251fdSmrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
82994a251fdSmrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
83094a251fdSmrgesac
83194a251fdSmrg
83294a251fdSmrg# Do `set' in a subshell so we don't clobber the current shell's
83394a251fdSmrg# arguments.  Must try -L first in case configure is actually a
83494a251fdSmrg# symlink; some systems play weird games with the mod time of symlinks
83594a251fdSmrg# (eg FreeBSD returns the mod time of the symlink's containing
83694a251fdSmrg# directory).
83794a251fdSmrgif (
83894a251fdSmrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
83994a251fdSmrg   if test "$[*]" = "X"; then
84094a251fdSmrg      # -L didn't work.
84194a251fdSmrg      set X `ls -t "$srcdir/configure" conftest.file`
8428fff3f40Smrg   fi
84394a251fdSmrg   rm -f conftest.file
84494a251fdSmrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
84594a251fdSmrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
84694a251fdSmrg
84794a251fdSmrg      # If neither matched, then we have a broken ls.  This can happen
84894a251fdSmrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
84994a251fdSmrg      # broken ls alias from the environment.  This has actually
85094a251fdSmrg      # happened.  Such a system could not be considered "sane".
85194a251fdSmrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
85294a251fdSmrgalias in your environment])
8538fff3f40Smrg   fi
85494a251fdSmrg
85594a251fdSmrg   test "$[2]" = conftest.file
85694a251fdSmrg   )
85794a251fdSmrgthen
85894a251fdSmrg   # Ok.
85994a251fdSmrg   :
860e6232409Smrgelse
86194a251fdSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
86294a251fdSmrgCheck your system clock])
863e6232409Smrgfi
86494a251fdSmrgAC_MSG_RESULT(yes)])
865e6232409Smrg
86694a251fdSmrg# Copyright (C) 2009  Free Software Foundation, Inc.
867e6232409Smrg#
86894a251fdSmrg# This file is free software; the Free Software Foundation
86994a251fdSmrg# gives unlimited permission to copy and/or distribute it,
87094a251fdSmrg# with or without modifications, as long as this notice is preserved.
8718fff3f40Smrg
87294a251fdSmrg# serial 1
873e6232409Smrg
87494a251fdSmrg# AM_SILENT_RULES([DEFAULT])
87594a251fdSmrg# --------------------------
87694a251fdSmrg# Enable less verbose build rules; with the default set to DEFAULT
87794a251fdSmrg# (`yes' being less verbose, `no' or empty being verbose).
87894a251fdSmrgAC_DEFUN([AM_SILENT_RULES],
87994a251fdSmrg[AC_ARG_ENABLE([silent-rules],
88094a251fdSmrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
88194a251fdSmrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
88294a251fdSmrgcase $enable_silent_rules in
88394a251fdSmrgyes) AM_DEFAULT_VERBOSITY=0;;
88494a251fdSmrgno)  AM_DEFAULT_VERBOSITY=1;;
88594a251fdSmrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
88694a251fdSmrgesac
88794a251fdSmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
88894a251fdSmrgAM_BACKSLASH='\'
88994a251fdSmrgAC_SUBST([AM_BACKSLASH])dnl
89094a251fdSmrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
89194a251fdSmrg])
89294a251fdSmrg
89394a251fdSmrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
8948fff3f40Smrg#
89594a251fdSmrg# This file is free software; the Free Software Foundation
89694a251fdSmrg# gives unlimited permission to copy and/or distribute it,
89794a251fdSmrg# with or without modifications, as long as this notice is preserved.
8988fff3f40Smrg
89994a251fdSmrg# serial 1
90094a251fdSmrg
90194a251fdSmrg# AM_PROG_INSTALL_STRIP
90294a251fdSmrg# ---------------------
90394a251fdSmrg# One issue with vendor `install' (even GNU) is that you can't
90494a251fdSmrg# specify the program used to strip binaries.  This is especially
90594a251fdSmrg# annoying in cross-compiling environments, where the build's strip
90694a251fdSmrg# is unlikely to handle the host's binaries.
90794a251fdSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
90894a251fdSmrg# always use install-sh in `make install-strip', and initialize
90994a251fdSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
91094a251fdSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
91194a251fdSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
91294a251fdSmrg# Installed binaries are usually stripped using `strip' when the user
91394a251fdSmrg# run `make install-strip'.  However `strip' might not be the right
91494a251fdSmrg# tool to use in cross-compilation environments, therefore Automake
91594a251fdSmrg# will honor the `STRIP' environment variable to overrule this program.
91694a251fdSmrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
91794a251fdSmrgif test "$cross_compiling" != no; then
91894a251fdSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
9198fff3f40Smrgfi
92094a251fdSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
92194a251fdSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
922e6232409Smrg
92394a251fdSmrg# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
9248fff3f40Smrg#
92594a251fdSmrg# This file is free software; the Free Software Foundation
92694a251fdSmrg# gives unlimited permission to copy and/or distribute it,
92794a251fdSmrg# with or without modifications, as long as this notice is preserved.
9288fff3f40Smrg
92994a251fdSmrg# serial 3
930e6232409Smrg
93194a251fdSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
93294a251fdSmrg# ---------------------------
93394a251fdSmrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
93494a251fdSmrg# This macro is traced by Automake.
93594a251fdSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
93694a251fdSmrg
93794a251fdSmrg# AM_SUBST_NOTMAKE(VARIABLE)
93894a251fdSmrg# --------------------------
93994a251fdSmrg# Public sister of _AM_SUBST_NOTMAKE.
94094a251fdSmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
94194a251fdSmrg
94294a251fdSmrg# Check how to create a tarball.                            -*- Autoconf -*-
94394a251fdSmrg
94494a251fdSmrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
9458fff3f40Smrg#
94694a251fdSmrg# This file is free software; the Free Software Foundation
94794a251fdSmrg# gives unlimited permission to copy and/or distribute it,
94894a251fdSmrg# with or without modifications, as long as this notice is preserved.
94994a251fdSmrg
95094a251fdSmrg# serial 2
95194a251fdSmrg
95294a251fdSmrg# _AM_PROG_TAR(FORMAT)
95394a251fdSmrg# --------------------
95494a251fdSmrg# Check how to create a tarball in format FORMAT.
95594a251fdSmrg# FORMAT should be one of `v7', `ustar', or `pax'.
9568fff3f40Smrg#
95794a251fdSmrg# Substitute a variable $(am__tar) that is a command
95894a251fdSmrg# writing to stdout a FORMAT-tarball containing the directory
95994a251fdSmrg# $tardir.
96094a251fdSmrg#     tardir=directory && $(am__tar) > result.tar
9618fff3f40Smrg#
96294a251fdSmrg# Substitute a variable $(am__untar) that extract such
96394a251fdSmrg# a tarball read from stdin.
96494a251fdSmrg#     $(am__untar) < result.tar
96594a251fdSmrgAC_DEFUN([_AM_PROG_TAR],
96694a251fdSmrg[# Always define AMTAR for backward compatibility.
96794a251fdSmrgAM_MISSING_PROG([AMTAR], [tar])
96894a251fdSmrgm4_if([$1], [v7],
96994a251fdSmrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
97094a251fdSmrg     [m4_case([$1], [ustar],, [pax],,
97194a251fdSmrg              [m4_fatal([Unknown tar format])])
97294a251fdSmrgAC_MSG_CHECKING([how to create a $1 tar archive])
97394a251fdSmrg# Loop over all known methods to create a tar archive until one works.
97494a251fdSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
97594a251fdSmrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
97694a251fdSmrg# Do not fold the above two line into one, because Tru64 sh and
97794a251fdSmrg# Solaris sh will not grok spaces in the rhs of `-'.
97894a251fdSmrgfor _am_tool in $_am_tools
97994a251fdSmrgdo
98094a251fdSmrg  case $_am_tool in
98194a251fdSmrg  gnutar)
98294a251fdSmrg    for _am_tar in tar gnutar gtar;
98394a251fdSmrg    do
98494a251fdSmrg      AM_RUN_LOG([$_am_tar --version]) && break
98594a251fdSmrg    done
98694a251fdSmrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
98794a251fdSmrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
98894a251fdSmrg    am__untar="$_am_tar -xf -"
98994a251fdSmrg    ;;
99094a251fdSmrg  plaintar)
99194a251fdSmrg    # Must skip GNU tar: if it does not support --format= it doesn't create
99294a251fdSmrg    # ustar tarball either.
99394a251fdSmrg    (tar --version) >/dev/null 2>&1 && continue
99494a251fdSmrg    am__tar='tar chf - "$$tardir"'
99594a251fdSmrg    am__tar_='tar chf - "$tardir"'
99694a251fdSmrg    am__untar='tar xf -'
99794a251fdSmrg    ;;
99894a251fdSmrg  pax)
99994a251fdSmrg    am__tar='pax -L -x $1 -w "$$tardir"'
100094a251fdSmrg    am__tar_='pax -L -x $1 -w "$tardir"'
100194a251fdSmrg    am__untar='pax -r'
100294a251fdSmrg    ;;
100394a251fdSmrg  cpio)
100494a251fdSmrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
100594a251fdSmrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
100694a251fdSmrg    am__untar='cpio -i -H $1 -d'
100794a251fdSmrg    ;;
100894a251fdSmrg  none)
100994a251fdSmrg    am__tar=false
101094a251fdSmrg    am__tar_=false
101194a251fdSmrg    am__untar=false
101294a251fdSmrg    ;;
101394a251fdSmrg  esac
10148fff3f40Smrg
101594a251fdSmrg  # If the value was cached, stop now.  We just wanted to have am__tar
101694a251fdSmrg  # and am__untar set.
101794a251fdSmrg  test -n "${am_cv_prog_tar_$1}" && break
101894a251fdSmrg
101994a251fdSmrg  # tar/untar a dummy directory, and stop if the command works
102094a251fdSmrg  rm -rf conftest.dir
102194a251fdSmrg  mkdir conftest.dir
102294a251fdSmrg  echo GrepMe > conftest.dir/file
102394a251fdSmrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
102494a251fdSmrg  rm -rf conftest.dir
102594a251fdSmrg  if test -s conftest.tar; then
102694a251fdSmrg    AM_RUN_LOG([$am__untar <conftest.tar])
102794a251fdSmrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
102894a251fdSmrg  fi
102994a251fdSmrgdone
103094a251fdSmrgrm -rf conftest.dir
103194a251fdSmrg
103294a251fdSmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
103394a251fdSmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
103494a251fdSmrgAC_SUBST([am__tar])
103594a251fdSmrgAC_SUBST([am__untar])
103694a251fdSmrg]) # _AM_PROG_TAR
103794a251fdSmrg
103894a251fdSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
103994a251fdSmrg# 
104094a251fdSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
10418fff3f40Smrg#
104294a251fdSmrg# This program is free software; you can redistribute it and/or modify
104394a251fdSmrg# it under the terms of the GNU General Public License as published by
104494a251fdSmrg# the Free Software Foundation; either version 2 of the License, or
104594a251fdSmrg# (at your option) any later version.
10468fff3f40Smrg#
104794a251fdSmrg# This program is distributed in the hope that it will be useful, but
104894a251fdSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
104994a251fdSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
105094a251fdSmrg# General Public License for more details.
10518fff3f40Smrg#
105294a251fdSmrg# You should have received a copy of the GNU General Public License
105394a251fdSmrg# along with this program; if not, write to the Free Software
105494a251fdSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
105594a251fdSmrg#
105694a251fdSmrg# As a special exception to the GNU General Public License, if you
105794a251fdSmrg# distribute this file as part of a program that contains a
105894a251fdSmrg# configuration script generated by Autoconf, you may include it under
105994a251fdSmrg# the same distribution terms that you use for the rest of that program.
106094a251fdSmrg
106194a251fdSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
106294a251fdSmrg# ----------------------------------
106394a251fdSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
106494a251fdSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
106594a251fdSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
106694a251fdSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
106794a251fdSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
106894a251fdSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
10698fff3f40Smrgfi
107094a251fdSmrgif test -n "$PKG_CONFIG"; then
107194a251fdSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
107294a251fdSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
107394a251fdSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
107494a251fdSmrg		AC_MSG_RESULT([yes])
107594a251fdSmrg	else
107694a251fdSmrg		AC_MSG_RESULT([no])
107794a251fdSmrg		PKG_CONFIG=""
107894a251fdSmrg	fi
107994a251fdSmrg		
108094a251fdSmrgfi[]dnl
108194a251fdSmrg])# PKG_PROG_PKG_CONFIG
10828fff3f40Smrg
108394a251fdSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10848fff3f40Smrg#
108594a251fdSmrg# Check to see whether a particular set of modules exists.  Similar
108694a251fdSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
10878fff3f40Smrg#
1088e6232409Smrg#
108994a251fdSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
109094a251fdSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
109194a251fdSmrg# PKG_CHECK_EXISTS manually
109294a251fdSmrg# --------------------------------------------------------------
109394a251fdSmrgAC_DEFUN([PKG_CHECK_EXISTS],
109494a251fdSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
109594a251fdSmrgif test -n "$PKG_CONFIG" && \
109694a251fdSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
109794a251fdSmrg  m4_ifval([$2], [$2], [:])
109894a251fdSmrgm4_ifvaln([$3], [else
109994a251fdSmrg  $3])dnl
110094a251fdSmrgfi])
1101e6232409Smrg
1102e6232409Smrg
110394a251fdSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
110494a251fdSmrg# ---------------------------------------------
110594a251fdSmrgm4_define([_PKG_CONFIG],
110694a251fdSmrg[if test -n "$$1"; then
110794a251fdSmrg    pkg_cv_[]$1="$$1"
110894a251fdSmrg elif test -n "$PKG_CONFIG"; then
110994a251fdSmrg    PKG_CHECK_EXISTS([$3],
111094a251fdSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
111194a251fdSmrg		     [pkg_failed=yes])
111294a251fdSmrg else
111394a251fdSmrg    pkg_failed=untried
111494a251fdSmrgfi[]dnl
111594a251fdSmrg])# _PKG_CONFIG
111694a251fdSmrg
111794a251fdSmrg# _PKG_SHORT_ERRORS_SUPPORTED
111894a251fdSmrg# -----------------------------
111994a251fdSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
112094a251fdSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
112194a251fdSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
112294a251fdSmrg        _pkg_short_errors_supported=yes
11238fff3f40Smrgelse
112494a251fdSmrg        _pkg_short_errors_supported=no
112594a251fdSmrgfi[]dnl
112694a251fdSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
1127e6232409Smrg
1128e6232409Smrg
112994a251fdSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
113094a251fdSmrg# [ACTION-IF-NOT-FOUND])
11318fff3f40Smrg#
11328fff3f40Smrg#
113394a251fdSmrg# Note that if there is a possibility the first call to
113494a251fdSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
113594a251fdSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
113694a251fdSmrg#
113794a251fdSmrg#
113894a251fdSmrg# --------------------------------------------------------------
113994a251fdSmrgAC_DEFUN([PKG_CHECK_MODULES],
114094a251fdSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
114194a251fdSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
114294a251fdSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
11438fff3f40Smrg
114494a251fdSmrgpkg_failed=no
114594a251fdSmrgAC_MSG_CHECKING([for $1])
1146e6232409Smrg
114794a251fdSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
114894a251fdSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
11498fff3f40Smrg
115094a251fdSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
115194a251fdSmrgand $1[]_LIBS to avoid the need to call pkg-config.
115294a251fdSmrgSee the pkg-config man page for more details.])
11538fff3f40Smrg
115494a251fdSmrgif test $pkg_failed = yes; then
115594a251fdSmrg        _PKG_SHORT_ERRORS_SUPPORTED
115694a251fdSmrg        if test $_pkg_short_errors_supported = yes; then
115794a251fdSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
115894a251fdSmrg        else 
115994a251fdSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
116094a251fdSmrg        fi
116194a251fdSmrg	# Put the nasty error message in config.log where it belongs
116294a251fdSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1163e6232409Smrg
116494a251fdSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
116594a251fdSmrg[Package requirements ($2) were not met:
1166e6232409Smrg
116794a251fdSmrg$$1_PKG_ERRORS
1168e6232409Smrg
116994a251fdSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
117094a251fdSmrginstalled software in a non-standard prefix.
1171e6232409Smrg
117294a251fdSmrg_PKG_TEXT
117394a251fdSmrg])],
117494a251fdSmrg		[AC_MSG_RESULT([no])
117594a251fdSmrg                $4])
117694a251fdSmrgelif test $pkg_failed = untried; then
117794a251fdSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
117894a251fdSmrg[The pkg-config script could not be found or is too old.  Make sure it
117994a251fdSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
118094a251fdSmrgpath to pkg-config.
11818fff3f40Smrg
118294a251fdSmrg_PKG_TEXT
1183e6232409Smrg
118494a251fdSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
118594a251fdSmrg		[$4])
118694a251fdSmrgelse
118794a251fdSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
118894a251fdSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
118994a251fdSmrg        AC_MSG_RESULT([yes])
119094a251fdSmrg	ifelse([$3], , :, [$3])
119194a251fdSmrgfi[]dnl
119294a251fdSmrg])# PKG_CHECK_MODULES
11938fff3f40Smrg
119494a251fdSmrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1195e6232409Smrgdnl
119694a251fdSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
119794a251fdSmrgdnl 
119894a251fdSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
119994a251fdSmrgdnl copy of this software and associated documentation files (the "Software"),
120094a251fdSmrgdnl to deal in the Software without restriction, including without limitation
120194a251fdSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
120294a251fdSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
120394a251fdSmrgdnl Software is furnished to do so, subject to the following conditions:
12048fff3f40Smrgdnl
120594a251fdSmrgdnl The above copyright notice and this permission notice (including the next
120694a251fdSmrgdnl paragraph) shall be included in all copies or substantial portions of the
120794a251fdSmrgdnl Software.
1208e6232409Smrgdnl
120994a251fdSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
121094a251fdSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
121194a251fdSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
121294a251fdSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
121394a251fdSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
121494a251fdSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
121594a251fdSmrgdnl DEALINGS IN THE SOFTWARE.
1216e6232409Smrg
121794a251fdSmrg# XORG_MACROS_VERSION(required-version)
121894a251fdSmrg# -------------------------------------
121994a251fdSmrg# Minimum version: 1.1.0
122094a251fdSmrg#
122194a251fdSmrg# If you're using a macro added in Version 1.1 or newer, include this in
122294a251fdSmrg# your configure.ac with the minimum required version, such as:
122394a251fdSmrg# XORG_MACROS_VERSION(1.1)
122494a251fdSmrg#
122594a251fdSmrg# To ensure that this macro is defined, also add:
122694a251fdSmrg# m4_ifndef([XORG_MACROS_VERSION],
122794a251fdSmrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
122894a251fdSmrg#
122994a251fdSmrg#
123094a251fdSmrg# See the "minimum version" comment for each macro you use to see what 
123194a251fdSmrg# version you require.
123294a251fdSmrgm4_defun([XORG_MACROS_VERSION],[
123394a251fdSmrgm4_define([vers_have], [1.17])
123494a251fdSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
123594a251fdSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
123694a251fdSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
123794a251fdSmrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
123894a251fdSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
123994a251fdSmrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
124094a251fdSmrgm4_undefine([vers_have])
124194a251fdSmrgm4_undefine([maj_have])
124294a251fdSmrgm4_undefine([maj_needed])
124394a251fdSmrg]) # XORG_MACROS_VERSION
124494a251fdSmrg
124594a251fdSmrg# XORG_PROG_RAWCPP()
124694a251fdSmrg# ------------------
124794a251fdSmrg# Minimum version: 1.0.0
124894a251fdSmrg#
124994a251fdSmrg# Find cpp program and necessary flags for use in pre-processing text files
125094a251fdSmrg# such as man pages and config files
125194a251fdSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
125294a251fdSmrgAC_REQUIRE([AC_PROG_CPP])
125394a251fdSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
125494a251fdSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
125594a251fdSmrg
125694a251fdSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
125794a251fdSmrg# which is not the best choice for supporting other OS'es, but covers most
125894a251fdSmrg# of the ones we need for now.
125994a251fdSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
126094a251fdSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
126194a251fdSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
126294a251fdSmrg	AC_MSG_RESULT([no])
126394a251fdSmrgelse
126494a251fdSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
126594a251fdSmrg		RAWCPPFLAGS=-undef
126694a251fdSmrg		AC_MSG_RESULT([yes])
126794a251fdSmrg	# under Cygwin unix is still defined even with -undef
126894a251fdSmrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
126994a251fdSmrg		RAWCPPFLAGS="-undef -ansi"
127094a251fdSmrg		AC_MSG_RESULT([yes, with -ansi])
127194a251fdSmrg	else
127294a251fdSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1273e6232409Smrg	fi
127494a251fdSmrgfi
127594a251fdSmrgrm -f conftest.$ac_ext
127694a251fdSmrg
127794a251fdSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
127894a251fdSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
127994a251fdSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
128094a251fdSmrg	AC_MSG_RESULT([no])
128194a251fdSmrgelse
128294a251fdSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
128394a251fdSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
128494a251fdSmrg		AC_MSG_RESULT([yes])
128594a251fdSmrg	else
128694a251fdSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1287e6232409Smrg	fi
128894a251fdSmrgfi
128994a251fdSmrgrm -f conftest.$ac_ext
129094a251fdSmrgAC_SUBST(RAWCPPFLAGS)
129194a251fdSmrg]) # XORG_PROG_RAWCPP
1292e6232409Smrg
129394a251fdSmrg# XORG_MANPAGE_SECTIONS()
129494a251fdSmrg# -----------------------
129594a251fdSmrg# Minimum version: 1.0.0
12968fff3f40Smrg#
129794a251fdSmrg# Determine which sections man pages go in for the different man page types
129894a251fdSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
129994a251fdSmrg# Not sure if there's any better way than just hardcoding by OS name.
130094a251fdSmrg# Override default settings by setting environment variables
130194a251fdSmrg# Added MAN_SUBSTS in version 1.8
130294a251fdSmrg# Added AC_PROG_SED in version 1.8
13038fff3f40Smrg
130494a251fdSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
130594a251fdSmrgAC_REQUIRE([AC_CANONICAL_HOST])
130694a251fdSmrgAC_REQUIRE([AC_PROG_SED])
1307e6232409Smrg
130894a251fdSmrgif test x$APP_MAN_SUFFIX = x    ; then
130994a251fdSmrg    APP_MAN_SUFFIX=1
131094a251fdSmrgfi
131194a251fdSmrgif test x$APP_MAN_DIR = x    ; then
131294a251fdSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
131394a251fdSmrgfi
1314e6232409Smrg
131594a251fdSmrgif test x$LIB_MAN_SUFFIX = x    ; then
131694a251fdSmrg    LIB_MAN_SUFFIX=3
131794a251fdSmrgfi
131894a251fdSmrgif test x$LIB_MAN_DIR = x    ; then
131994a251fdSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
132094a251fdSmrgfi
1321e6232409Smrg
132294a251fdSmrgif test x$FILE_MAN_SUFFIX = x    ; then
132394a251fdSmrg    case $host_os in
132494a251fdSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
132594a251fdSmrg	*)		FILE_MAN_SUFFIX=5  ;;
132694a251fdSmrg    esac
132794a251fdSmrgfi
132894a251fdSmrgif test x$FILE_MAN_DIR = x    ; then
132994a251fdSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
133094a251fdSmrgfi
1331e6232409Smrg
133294a251fdSmrgif test x$MISC_MAN_SUFFIX = x    ; then
133394a251fdSmrg    case $host_os in
133494a251fdSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
133594a251fdSmrg	*)		MISC_MAN_SUFFIX=7  ;;
133694a251fdSmrg    esac
133794a251fdSmrgfi
133894a251fdSmrgif test x$MISC_MAN_DIR = x    ; then
133994a251fdSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
134094a251fdSmrgfi
1341e6232409Smrg
134294a251fdSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
134394a251fdSmrg    case $host_os in
134494a251fdSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
134594a251fdSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
134694a251fdSmrg    esac
134794a251fdSmrgfi
134894a251fdSmrgif test x$DRIVER_MAN_DIR = x    ; then
134994a251fdSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
135094a251fdSmrgfi
1351e6232409Smrg
135294a251fdSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
135394a251fdSmrg    case $host_os in
135494a251fdSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
135594a251fdSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
135694a251fdSmrg    esac
135794a251fdSmrgfi
135894a251fdSmrgif test x$ADMIN_MAN_DIR = x    ; then
135994a251fdSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
136094a251fdSmrgfi
136194a251fdSmrg
136294a251fdSmrg
136394a251fdSmrgAC_SUBST([APP_MAN_SUFFIX])
136494a251fdSmrgAC_SUBST([LIB_MAN_SUFFIX])
136594a251fdSmrgAC_SUBST([FILE_MAN_SUFFIX])
136694a251fdSmrgAC_SUBST([MISC_MAN_SUFFIX])
136794a251fdSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
136894a251fdSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
136994a251fdSmrgAC_SUBST([APP_MAN_DIR])
137094a251fdSmrgAC_SUBST([LIB_MAN_DIR])
137194a251fdSmrgAC_SUBST([FILE_MAN_DIR])
137294a251fdSmrgAC_SUBST([MISC_MAN_DIR])
137394a251fdSmrgAC_SUBST([DRIVER_MAN_DIR])
137494a251fdSmrgAC_SUBST([ADMIN_MAN_DIR])
137594a251fdSmrg
137694a251fdSmrgXORG_MAN_PAGE="X Version 11"
137794a251fdSmrgAC_SUBST([XORG_MAN_PAGE])
137894a251fdSmrgMAN_SUBSTS="\
137994a251fdSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
138094a251fdSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
138194a251fdSmrg	-e 's|__xservername__|Xorg|g' \
138294a251fdSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
138394a251fdSmrg	-e 's|__projectroot__|\$(prefix)|g' \
138494a251fdSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
138594a251fdSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
138694a251fdSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
138794a251fdSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
138894a251fdSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
138994a251fdSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
139094a251fdSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
139194a251fdSmrgAC_SUBST([MAN_SUBSTS])
139294a251fdSmrg
139394a251fdSmrg]) # XORG_MANPAGE_SECTIONS
139494a251fdSmrg
139594a251fdSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
139694a251fdSmrg# ------------------------
139794a251fdSmrg# Minimum version: 1.7.0
13988fff3f40Smrg#
139994a251fdSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
140094a251fdSmrg# provided by xorg-sgml-doctools, if installed.
140194a251fdSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
140294a251fdSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
140394a251fdSmrgXORG_SGML_PATH=
140494a251fdSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
140594a251fdSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
140694a251fdSmrg    [m4_ifval([$1],[:],
140794a251fdSmrg        [if test x"$cross_compiling" != x"yes" ; then
140894a251fdSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
140994a251fdSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
141094a251fdSmrg         fi])
141194a251fdSmrg    ])
141294a251fdSmrg
141394a251fdSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
141494a251fdSmrg# the path and the name of the doc stylesheet
141594a251fdSmrgif test "x$XORG_SGML_PATH" != "x" ; then
141694a251fdSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
141794a251fdSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
141894a251fdSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
141994a251fdSmrgelse
142094a251fdSmrg   AC_MSG_RESULT([no])
142194a251fdSmrgfi
142294a251fdSmrg
142394a251fdSmrgAC_SUBST(XORG_SGML_PATH)
142494a251fdSmrgAC_SUBST(STYLESHEET_SRCDIR)
142594a251fdSmrgAC_SUBST(XSL_STYLESHEET)
142694a251fdSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
142794a251fdSmrg]) # XORG_CHECK_SGML_DOCTOOLS
142894a251fdSmrg
142994a251fdSmrg# XORG_CHECK_LINUXDOC
143094a251fdSmrg# -------------------
143194a251fdSmrg# Minimum version: 1.0.0
14328fff3f40Smrg#
143394a251fdSmrg# Defines the variable MAKE_TEXT if the necessary tools and
143494a251fdSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
143594a251fdSmrg# Whether or not the necessary tools and files are found can be checked
143694a251fdSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
143794a251fdSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
143894a251fdSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
143994a251fdSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1440e6232409Smrg
144194a251fdSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1442e6232409Smrg
144394a251fdSmrgAC_MSG_CHECKING([whether to build documentation])
1444e6232409Smrg
144594a251fdSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
144694a251fdSmrg   BUILDDOC=yes
144794a251fdSmrgelse
144894a251fdSmrg   BUILDDOC=no
144994a251fdSmrgfi
1450e6232409Smrg
145194a251fdSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1452e6232409Smrg
145394a251fdSmrgAC_MSG_RESULT([$BUILDDOC])
145494a251fdSmrg
145594a251fdSmrgAC_MSG_CHECKING([whether to build pdf documentation])
145694a251fdSmrg
145794a251fdSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
145894a251fdSmrg   BUILDPDFDOC=yes
1459e6232409Smrgelse
146094a251fdSmrg   BUILDPDFDOC=no
1461e6232409Smrgfi
1462e6232409Smrg
146394a251fdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1464e6232409Smrg
146594a251fdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1466e6232409Smrg
146794a251fdSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
146894a251fdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
146994a251fdSmrgMAKE_PDF="$PS2PDF"
147094a251fdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1471e6232409Smrg
147294a251fdSmrgAC_SUBST(MAKE_TEXT)
147394a251fdSmrgAC_SUBST(MAKE_PS)
147494a251fdSmrgAC_SUBST(MAKE_PDF)
147594a251fdSmrgAC_SUBST(MAKE_HTML)
147694a251fdSmrg]) # XORG_CHECK_LINUXDOC
1477e6232409Smrg
147894a251fdSmrg# XORG_CHECK_DOCBOOK
147994a251fdSmrg# -------------------
148094a251fdSmrg# Minimum version: 1.0.0
14818fff3f40Smrg#
148294a251fdSmrg# Checks for the ability to build output formats from SGML DocBook source.
148394a251fdSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
148494a251fdSmrg# indicates whether the necessary tools and files are found and, if set,
148594a251fdSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
148694a251fdSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
148794a251fdSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1488e6232409Smrg
148994a251fdSmrgBUILDTXTDOC=no
149094a251fdSmrgBUILDPDFDOC=no
149194a251fdSmrgBUILDPSDOC=no
149294a251fdSmrgBUILDHTMLDOC=no
1493e6232409Smrg
149494a251fdSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
149594a251fdSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
149694a251fdSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
149794a251fdSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1498e6232409Smrg
149994a251fdSmrgAC_MSG_CHECKING([whether to build text documentation])
150094a251fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
150194a251fdSmrg   test x$BUILD_TXTDOC != xno; then
150294a251fdSmrg	BUILDTXTDOC=yes
150394a251fdSmrgfi
150494a251fdSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
150594a251fdSmrgAC_MSG_RESULT([$BUILDTXTDOC])
1506e6232409Smrg
150794a251fdSmrgAC_MSG_CHECKING([whether to build PDF documentation])
150894a251fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
150994a251fdSmrg   test x$BUILD_PDFDOC != xno; then
151094a251fdSmrg	BUILDPDFDOC=yes
151194a251fdSmrgfi
151294a251fdSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
151394a251fdSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1514e6232409Smrg
151594a251fdSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
151694a251fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
151794a251fdSmrg   test x$BUILD_PSDOC != xno; then
151894a251fdSmrg	BUILDPSDOC=yes
151994a251fdSmrgfi
152094a251fdSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
152194a251fdSmrgAC_MSG_RESULT([$BUILDPSDOC])
152294a251fdSmrg
152394a251fdSmrgAC_MSG_CHECKING([whether to build HTML documentation])
152494a251fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
152594a251fdSmrg   test x$BUILD_HTMLDOC != xno; then
152694a251fdSmrg	BUILDHTMLDOC=yes
152794a251fdSmrgfi
152894a251fdSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
152994a251fdSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
153094a251fdSmrg
153194a251fdSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
153294a251fdSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
153394a251fdSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
153494a251fdSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
153594a251fdSmrg
153694a251fdSmrgAC_SUBST(MAKE_TEXT)
153794a251fdSmrgAC_SUBST(MAKE_PS)
153894a251fdSmrgAC_SUBST(MAKE_PDF)
153994a251fdSmrgAC_SUBST(MAKE_HTML)
154094a251fdSmrg]) # XORG_CHECK_DOCBOOK
154194a251fdSmrg
154294a251fdSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
154394a251fdSmrg# ----------------
154494a251fdSmrg# Minimum version: 1.5.0
154594a251fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
154694a251fdSmrg#
154794a251fdSmrg# Documentation tools are not always available on all platforms and sometimes
154894a251fdSmrg# not at the appropriate level. This macro enables a module to test for the
154994a251fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
155094a251fdSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
155194a251fdSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
155294a251fdSmrg# --with-xmlto assumes 'auto'.
155394a251fdSmrg#
155494a251fdSmrg# Interface to module:
155594a251fdSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
155694a251fdSmrg# XMLTO:	returns the path of the xmlto program found
155794a251fdSmrg#		returns the path set by the user in the environment
155894a251fdSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
155994a251fdSmrg#		'no' user instructs the module not to use xmlto
156094a251fdSmrg#
156194a251fdSmrg# Added in version 1.10.0
156294a251fdSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
156394a251fdSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
156494a251fdSmrg#
156594a251fdSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
156694a251fdSmrg#
156794a251fdSmrgAC_DEFUN([XORG_WITH_XMLTO],[
156894a251fdSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
156994a251fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
157094a251fdSmrgAC_ARG_WITH(xmlto,
157194a251fdSmrg	AS_HELP_STRING([--with-xmlto],
157294a251fdSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
157394a251fdSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
157494a251fdSmrgm4_undefine([_defopt])
157594a251fdSmrg
157694a251fdSmrgif test "x$use_xmlto" = x"auto"; then
157794a251fdSmrg   AC_PATH_PROG([XMLTO], [xmlto])
157894a251fdSmrg   if test "x$XMLTO" = "x"; then
157994a251fdSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
158094a251fdSmrg	have_xmlto=no
158194a251fdSmrg   else
158294a251fdSmrg        have_xmlto=yes
158394a251fdSmrg   fi
158494a251fdSmrgelif test "x$use_xmlto" = x"yes" ; then
158594a251fdSmrg   AC_PATH_PROG([XMLTO], [xmlto])
158694a251fdSmrg   if test "x$XMLTO" = "x"; then
158794a251fdSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
158894a251fdSmrg   fi
158994a251fdSmrg   have_xmlto=yes
159094a251fdSmrgelif test "x$use_xmlto" = x"no" ; then
159194a251fdSmrg   if test "x$XMLTO" != "x"; then
159294a251fdSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
159394a251fdSmrg   fi
159494a251fdSmrg   have_xmlto=no
159594a251fdSmrgelse
159694a251fdSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
159794a251fdSmrgfi
159894a251fdSmrg
159994a251fdSmrg# Test for a minimum version of xmlto, if provided.
160094a251fdSmrgm4_ifval([$1],
160194a251fdSmrg[if test "$have_xmlto" = yes; then
160294a251fdSmrg    # scrape the xmlto version
160394a251fdSmrg    AC_MSG_CHECKING([the xmlto version])
160494a251fdSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
160594a251fdSmrg    AC_MSG_RESULT([$xmlto_version])
160694a251fdSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
160794a251fdSmrg        [if test "x$use_xmlto" = xauto; then
160894a251fdSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
160994a251fdSmrg            have_xmlto=no
161094a251fdSmrg        else
161194a251fdSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
161294a251fdSmrg        fi])
161394a251fdSmrgfi])
1614e6232409Smrg
161594a251fdSmrg# Test for the ability of xmlto to generate a text target
161694a251fdSmrghave_xmlto_text=no
161794a251fdSmrgcat > conftest.xml << "EOF"
161894a251fdSmrgEOF
161994a251fdSmrgAS_IF([test "$have_xmlto" = yes],
162094a251fdSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
162194a251fdSmrg             [have_xmlto_text=yes],
162294a251fdSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
162394a251fdSmrgrm -f conftest.xml
162494a251fdSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
162594a251fdSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
162694a251fdSmrg]) # XORG_WITH_XMLTO
162794a251fdSmrg
162894a251fdSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
162994a251fdSmrg# --------------------------------------------
163094a251fdSmrg# Minimum version: 1.12.0
163194a251fdSmrg# Minimum version for optional DEFAULT argument: 1.12.0
163294a251fdSmrg#
163394a251fdSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
163494a251fdSmrg# XML-based language used for the transformation of XML documents.
163594a251fdSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
163694a251fdSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
163794a251fdSmrg# The XSLT processor is often used as a standalone tool for transformations.
163894a251fdSmrg# It should not be assumed that this tool is used only to work with documnetation.
163994a251fdSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
164094a251fdSmrg#
164194a251fdSmrg# Interface to module:
164294a251fdSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
164394a251fdSmrg# XSLTPROC:	 returns the path of the xsltproc program found
164494a251fdSmrg#		 returns the path set by the user in the environment
164594a251fdSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
164694a251fdSmrg#		  'no' user instructs the module not to use xsltproc
164794a251fdSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
164894a251fdSmrg#
164994a251fdSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
165094a251fdSmrg#
165194a251fdSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
165294a251fdSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
165394a251fdSmrg# Preserves the interface, should it be implemented later
165494a251fdSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
165594a251fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
165694a251fdSmrgAC_ARG_WITH(xsltproc,
165794a251fdSmrg	AS_HELP_STRING([--with-xsltproc],
165894a251fdSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
165994a251fdSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
166094a251fdSmrgm4_undefine([_defopt])
166194a251fdSmrg
166294a251fdSmrgif test "x$use_xsltproc" = x"auto"; then
166394a251fdSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
166494a251fdSmrg   if test "x$XSLTPROC" = "x"; then
166594a251fdSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
166694a251fdSmrg	have_xsltproc=no
166794a251fdSmrg   else
166894a251fdSmrg        have_xsltproc=yes
166994a251fdSmrg   fi
167094a251fdSmrgelif test "x$use_xsltproc" = x"yes" ; then
167194a251fdSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
167294a251fdSmrg   if test "x$XSLTPROC" = "x"; then
167394a251fdSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
167494a251fdSmrg   fi
167594a251fdSmrg   have_xsltproc=yes
167694a251fdSmrgelif test "x$use_xsltproc" = x"no" ; then
167794a251fdSmrg   if test "x$XSLTPROC" != "x"; then
167894a251fdSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
167994a251fdSmrg   fi
168094a251fdSmrg   have_xsltproc=no
16818fff3f40Smrgelse
168294a251fdSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1683e6232409Smrgfi
1684e6232409Smrg
168594a251fdSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
168694a251fdSmrg]) # XORG_WITH_XSLTPROC
1687e6232409Smrg
168894a251fdSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
168994a251fdSmrg# ----------------------------------------
169094a251fdSmrg# Minimum version: 1.15.0
169194a251fdSmrg#
169294a251fdSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
169394a251fdSmrg# scanning arbitrary text files, extracting information from those text files,
169494a251fdSmrg# and printing reports based on that information.
169594a251fdSmrg#
169694a251fdSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
169794a251fdSmrg#
169894a251fdSmrg# Interface to module:
169994a251fdSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
170094a251fdSmrg# PERL:	     returns the path of the perl program found
170194a251fdSmrg#	     returns the path set by the user in the environment
170294a251fdSmrg# --with-perl: 'yes' user instructs the module to use perl
170394a251fdSmrg#	       'no' user instructs the module not to use perl
170494a251fdSmrg# have_perl: returns yes if perl found in PATH or no
170594a251fdSmrg#
170694a251fdSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
170794a251fdSmrg#
170894a251fdSmrgAC_DEFUN([XORG_WITH_PERL],[
170994a251fdSmrgAC_ARG_VAR([PERL], [Path to perl command])
171094a251fdSmrg# Preserves the interface, should it be implemented later
171194a251fdSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
171294a251fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
171394a251fdSmrgAC_ARG_WITH(perl,
171494a251fdSmrg	AS_HELP_STRING([--with-perl],
171594a251fdSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
171694a251fdSmrg	   [use_perl=$withval], [use_perl=]_defopt)
171794a251fdSmrgm4_undefine([_defopt])
171894a251fdSmrg
171994a251fdSmrgif test "x$use_perl" = x"auto"; then
172094a251fdSmrg   AC_PATH_PROG([PERL], [perl])
172194a251fdSmrg   if test "x$PERL" = "x"; then
172294a251fdSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
172394a251fdSmrg	have_perl=no
172494a251fdSmrg   else
172594a251fdSmrg        have_perl=yes
172694a251fdSmrg   fi
172794a251fdSmrgelif test "x$use_perl" = x"yes" ; then
172894a251fdSmrg   AC_PATH_PROG([PERL], [perl])
172994a251fdSmrg   if test "x$PERL" = "x"; then
173094a251fdSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
173194a251fdSmrg   fi
173294a251fdSmrg   have_perl=yes
173394a251fdSmrgelif test "x$use_perl" = x"no" ; then
173494a251fdSmrg   if test "x$PERL" != "x"; then
173594a251fdSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
173694a251fdSmrg   fi
173794a251fdSmrg   have_perl=no
173894a251fdSmrgelse
173994a251fdSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
17408fff3f40Smrgfi
1741e6232409Smrg
174294a251fdSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
174394a251fdSmrg]) # XORG_WITH_PERL
1744e6232409Smrg
174594a251fdSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
174694a251fdSmrg# ----------------
174794a251fdSmrg# Minimum version: 1.5.0
174894a251fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1749e6232409Smrg#
175094a251fdSmrg# Documentation tools are not always available on all platforms and sometimes
175194a251fdSmrg# not at the appropriate level. This macro enables a module to test for the
175294a251fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
175394a251fdSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
175494a251fdSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
175594a251fdSmrg# --with-asciidoc assumes 'auto'.
175694a251fdSmrg#
175794a251fdSmrg# Interface to module:
175894a251fdSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
175994a251fdSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
176094a251fdSmrg#		 returns the path set by the user in the environment
176194a251fdSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
176294a251fdSmrg#		  'no' user instructs the module not to use asciidoc
176394a251fdSmrg#
176494a251fdSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
176594a251fdSmrg#
176694a251fdSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
176794a251fdSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
176894a251fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
176994a251fdSmrgAC_ARG_WITH(asciidoc,
177094a251fdSmrg	AS_HELP_STRING([--with-asciidoc],
177194a251fdSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
177294a251fdSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
177394a251fdSmrgm4_undefine([_defopt])
1774e6232409Smrg
177594a251fdSmrgif test "x$use_asciidoc" = x"auto"; then
177694a251fdSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
177794a251fdSmrg   if test "x$ASCIIDOC" = "x"; then
177894a251fdSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
177994a251fdSmrg	have_asciidoc=no
178094a251fdSmrg   else
178194a251fdSmrg        have_asciidoc=yes
178294a251fdSmrg   fi
178394a251fdSmrgelif test "x$use_asciidoc" = x"yes" ; then
178494a251fdSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
178594a251fdSmrg   if test "x$ASCIIDOC" = "x"; then
178694a251fdSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
178794a251fdSmrg   fi
178894a251fdSmrg   have_asciidoc=yes
178994a251fdSmrgelif test "x$use_asciidoc" = x"no" ; then
179094a251fdSmrg   if test "x$ASCIIDOC" != "x"; then
179194a251fdSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
179294a251fdSmrg   fi
179394a251fdSmrg   have_asciidoc=no
179494a251fdSmrgelse
179594a251fdSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
179694a251fdSmrgfi
179794a251fdSmrgm4_ifval([$1],
179894a251fdSmrg[if test "$have_asciidoc" = yes; then
179994a251fdSmrg    # scrape the asciidoc version
180094a251fdSmrg    AC_MSG_CHECKING([the asciidoc version])
180194a251fdSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
180294a251fdSmrg    AC_MSG_RESULT([$asciidoc_version])
180394a251fdSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
180494a251fdSmrg        [if test "x$use_asciidoc" = xauto; then
180594a251fdSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
180694a251fdSmrg            have_asciidoc=no
180794a251fdSmrg        else
180894a251fdSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
180994a251fdSmrg        fi])
181094a251fdSmrgfi])
181194a251fdSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
181294a251fdSmrg]) # XORG_WITH_ASCIIDOC
1813e6232409Smrg
181494a251fdSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
181594a251fdSmrg# --------------------------------
181694a251fdSmrg# Minimum version: 1.5.0
181794a251fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
181894a251fdSmrg#
181994a251fdSmrg# Documentation tools are not always available on all platforms and sometimes
182094a251fdSmrg# not at the appropriate level. This macro enables a module to test for the
182194a251fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
182294a251fdSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
182394a251fdSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
182494a251fdSmrg# --with-doxygen assumes 'auto'.
182594a251fdSmrg#
182694a251fdSmrg# Interface to module:
182794a251fdSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
182894a251fdSmrg# DOXYGEN:	 returns the path of the doxygen program found
182994a251fdSmrg#		 returns the path set by the user in the environment
183094a251fdSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
183194a251fdSmrg#		  'no' user instructs the module not to use doxygen
183294a251fdSmrg#
183394a251fdSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
183494a251fdSmrg#
183594a251fdSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
183694a251fdSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
183794a251fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
183894a251fdSmrgAC_ARG_WITH(doxygen,
183994a251fdSmrg	AS_HELP_STRING([--with-doxygen],
184094a251fdSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
184194a251fdSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
184294a251fdSmrgm4_undefine([_defopt])
1843e6232409Smrg
184494a251fdSmrgif test "x$use_doxygen" = x"auto"; then
184594a251fdSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
184694a251fdSmrg   if test "x$DOXYGEN" = "x"; then
184794a251fdSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
184894a251fdSmrg	have_doxygen=no
184994a251fdSmrg   else
185094a251fdSmrg        have_doxygen=yes
185194a251fdSmrg   fi
185294a251fdSmrgelif test "x$use_doxygen" = x"yes" ; then
185394a251fdSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
185494a251fdSmrg   if test "x$DOXYGEN" = "x"; then
185594a251fdSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
185694a251fdSmrg   fi
185794a251fdSmrg   have_doxygen=yes
185894a251fdSmrgelif test "x$use_doxygen" = x"no" ; then
185994a251fdSmrg   if test "x$DOXYGEN" != "x"; then
186094a251fdSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
186194a251fdSmrg   fi
186294a251fdSmrg   have_doxygen=no
186394a251fdSmrgelse
186494a251fdSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
186594a251fdSmrgfi
186694a251fdSmrgm4_ifval([$1],
186794a251fdSmrg[if test "$have_doxygen" = yes; then
186894a251fdSmrg    # scrape the doxygen version
186994a251fdSmrg    AC_MSG_CHECKING([the doxygen version])
187094a251fdSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
187194a251fdSmrg    AC_MSG_RESULT([$doxygen_version])
187294a251fdSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
187394a251fdSmrg        [if test "x$use_doxygen" = xauto; then
187494a251fdSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
187594a251fdSmrg            have_doxygen=no
187694a251fdSmrg        else
187794a251fdSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
187894a251fdSmrg        fi])
187994a251fdSmrgfi])
188094a251fdSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
188194a251fdSmrg]) # XORG_WITH_DOXYGEN
1882e6232409Smrg
188394a251fdSmrg# XORG_WITH_GROFF([DEFAULT])
188494a251fdSmrg# ----------------
188594a251fdSmrg# Minimum version: 1.6.0
188694a251fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
188794a251fdSmrg#
188894a251fdSmrg# Documentation tools are not always available on all platforms and sometimes
188994a251fdSmrg# not at the appropriate level. This macro enables a module to test for the
189094a251fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
189194a251fdSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
189294a251fdSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
189394a251fdSmrg# --with-groff assumes 'auto'.
189494a251fdSmrg#
189594a251fdSmrg# Interface to module:
189694a251fdSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
189794a251fdSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
189894a251fdSmrg# HAVE_GROFF_MS: the -ms macros package
189994a251fdSmrg# GROFF:	 returns the path of the groff program found
190094a251fdSmrg#		 returns the path set by the user in the environment
190194a251fdSmrg# --with-groff:	 'yes' user instructs the module to use groff
190294a251fdSmrg#		 'no' user instructs the module not to use groff
1903e6232409Smrg#
190494a251fdSmrg# Added in version 1.9.0:
190594a251fdSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
190694a251fdSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
190794a251fdSmrg#		   psselect from the psutils package.
190894a251fdSmrg#		   the ghostcript package. Refer to the grohtml man pages
1909e6232409Smrg#
191094a251fdSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1911e6232409Smrg#
191294a251fdSmrg# OS and distros often splits groff in a basic and full package, the former
191394a251fdSmrg# having the groff program and the later having devices, fonts and macros
191494a251fdSmrg# Checking for the groff executable is not enough.
191594a251fdSmrg#
191694a251fdSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
191794a251fdSmrg# unset HAVE_GROFF or GROFF env variables.
191894a251fdSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
191994a251fdSmrg#
192094a251fdSmrgAC_DEFUN([XORG_WITH_GROFF],[
192194a251fdSmrgAC_ARG_VAR([GROFF], [Path to groff command])
192294a251fdSmrgm4_define([_defopt], m4_default([$1], [auto]))
192394a251fdSmrgAC_ARG_WITH(groff,
192494a251fdSmrg	AS_HELP_STRING([--with-groff],
192594a251fdSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
192694a251fdSmrg	   [use_groff=$withval], [use_groff=]_defopt)
192794a251fdSmrgm4_undefine([_defopt])
19288fff3f40Smrg
192994a251fdSmrgif test "x$use_groff" = x"auto"; then
193094a251fdSmrg   AC_PATH_PROG([GROFF], [groff])
193194a251fdSmrg   if test "x$GROFF" = "x"; then
193294a251fdSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
193394a251fdSmrg	have_groff=no
193494a251fdSmrg   else
193594a251fdSmrg        have_groff=yes
193694a251fdSmrg   fi
193794a251fdSmrgelif test "x$use_groff" = x"yes" ; then
193894a251fdSmrg   AC_PATH_PROG([GROFF], [groff])
193994a251fdSmrg   if test "x$GROFF" = "x"; then
194094a251fdSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
194194a251fdSmrg   fi
194294a251fdSmrg   have_groff=yes
194394a251fdSmrgelif test "x$use_groff" = x"no" ; then
194494a251fdSmrg   if test "x$GROFF" != "x"; then
194594a251fdSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
194694a251fdSmrg   fi
194794a251fdSmrg   have_groff=no
194894a251fdSmrgelse
194994a251fdSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1950e6232409Smrgfi
1951e6232409Smrg
195294a251fdSmrg# We have groff, test for the presence of the macro packages
195394a251fdSmrgif test "x$have_groff" = x"yes"; then
195494a251fdSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
195594a251fdSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
195694a251fdSmrg        groff_ms_works=yes
195794a251fdSmrg    else
195894a251fdSmrg        groff_ms_works=no
195994a251fdSmrg    fi
196094a251fdSmrg    AC_MSG_RESULT([$groff_ms_works])
196194a251fdSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
196294a251fdSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
196394a251fdSmrg        groff_mm_works=yes
196494a251fdSmrg    else
196594a251fdSmrg        groff_mm_works=no
196694a251fdSmrg    fi
196794a251fdSmrg    AC_MSG_RESULT([$groff_mm_works])
19688fff3f40Smrgfi
19698fff3f40Smrg
197094a251fdSmrg# We have groff, test for HTML dependencies, one command per package
197194a251fdSmrgif test "x$have_groff" = x"yes"; then
197294a251fdSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
197394a251fdSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
197494a251fdSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
197594a251fdSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
197694a251fdSmrg      have_groff_html=yes
197794a251fdSmrg   else
197894a251fdSmrg      have_groff_html=no
197994a251fdSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
198094a251fdSmrg   fi
198194a251fdSmrgfi
19828fff3f40Smrg
198394a251fdSmrg# Set Automake conditionals for Makefiles
198494a251fdSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
198594a251fdSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
198694a251fdSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
198794a251fdSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
198894a251fdSmrg]) # XORG_WITH_GROFF
19898fff3f40Smrg
199094a251fdSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
199194a251fdSmrg# ---------------------------------------
199294a251fdSmrg# Minimum version: 1.6.0
199394a251fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
199494a251fdSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1995e6232409Smrg#
199694a251fdSmrg# Documentation tools are not always available on all platforms and sometimes
199794a251fdSmrg# not at the appropriate level. This macro enables a module to test for the
199894a251fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
199994a251fdSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
200094a251fdSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
200194a251fdSmrg# --with-fop assumes 'auto'.
200294a251fdSmrg#
200394a251fdSmrg# Interface to module:
200494a251fdSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
200594a251fdSmrg# FOP:	 	returns the path of the fop program found
200694a251fdSmrg#		returns the path set by the user in the environment
200794a251fdSmrg# --with-fop: 	'yes' user instructs the module to use fop
200894a251fdSmrg#		'no' user instructs the module not to use fop
200994a251fdSmrg#
201094a251fdSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
201194a251fdSmrg#
201294a251fdSmrgAC_DEFUN([XORG_WITH_FOP],[
201394a251fdSmrgAC_ARG_VAR([FOP], [Path to fop command])
201494a251fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
201594a251fdSmrgAC_ARG_WITH(fop,
201694a251fdSmrg	AS_HELP_STRING([--with-fop],
201794a251fdSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
201894a251fdSmrg	   [use_fop=$withval], [use_fop=]_defopt)
201994a251fdSmrgm4_undefine([_defopt])
20208fff3f40Smrg
202194a251fdSmrgif test "x$use_fop" = x"auto"; then
202294a251fdSmrg   AC_PATH_PROG([FOP], [fop])
202394a251fdSmrg   if test "x$FOP" = "x"; then
202494a251fdSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
202594a251fdSmrg	have_fop=no
202694a251fdSmrg   else
202794a251fdSmrg        have_fop=yes
202894a251fdSmrg   fi
202994a251fdSmrgelif test "x$use_fop" = x"yes" ; then
203094a251fdSmrg   AC_PATH_PROG([FOP], [fop])
203194a251fdSmrg   if test "x$FOP" = "x"; then
203294a251fdSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
203394a251fdSmrg   fi
203494a251fdSmrg   have_fop=yes
203594a251fdSmrgelif test "x$use_fop" = x"no" ; then
203694a251fdSmrg   if test "x$FOP" != "x"; then
203794a251fdSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
203894a251fdSmrg   fi
203994a251fdSmrg   have_fop=no
204094a251fdSmrgelse
204194a251fdSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
20428fff3f40Smrgfi
20438fff3f40Smrg
204494a251fdSmrg# Test for a minimum version of fop, if provided.
204594a251fdSmrgm4_ifval([$1],
204694a251fdSmrg[if test "$have_fop" = yes; then
204794a251fdSmrg    # scrape the fop version
204894a251fdSmrg    AC_MSG_CHECKING([for fop minimum version])
204994a251fdSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
205094a251fdSmrg    AC_MSG_RESULT([$fop_version])
205194a251fdSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
205294a251fdSmrg        [if test "x$use_fop" = xauto; then
205394a251fdSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
205494a251fdSmrg            have_fop=no
205594a251fdSmrg        else
205694a251fdSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
205794a251fdSmrg        fi])
205894a251fdSmrgfi])
205994a251fdSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
206094a251fdSmrg]) # XORG_WITH_FOP
20618fff3f40Smrg
206294a251fdSmrg# XORG_WITH_PS2PDF([DEFAULT])
206394a251fdSmrg# ----------------
206494a251fdSmrg# Minimum version: 1.6.0
206594a251fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
206694a251fdSmrg#
206794a251fdSmrg# Documentation tools are not always available on all platforms and sometimes
206894a251fdSmrg# not at the appropriate level. This macro enables a module to test for the
206994a251fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
207094a251fdSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
207194a251fdSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
207294a251fdSmrg# --with-ps2pdf assumes 'auto'.
207394a251fdSmrg#
207494a251fdSmrg# Interface to module:
207594a251fdSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
207694a251fdSmrg# PS2PDF:	returns the path of the ps2pdf program found
207794a251fdSmrg#		returns the path set by the user in the environment
207894a251fdSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
207994a251fdSmrg#		 'no' user instructs the module not to use ps2pdf
208094a251fdSmrg#
208194a251fdSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
208294a251fdSmrg#
208394a251fdSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
208494a251fdSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
208594a251fdSmrgm4_define([_defopt], m4_default([$1], [auto]))
208694a251fdSmrgAC_ARG_WITH(ps2pdf,
208794a251fdSmrg	AS_HELP_STRING([--with-ps2pdf],
208894a251fdSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
208994a251fdSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
209094a251fdSmrgm4_undefine([_defopt])
20918fff3f40Smrg
209294a251fdSmrgif test "x$use_ps2pdf" = x"auto"; then
209394a251fdSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
209494a251fdSmrg   if test "x$PS2PDF" = "x"; then
209594a251fdSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
209694a251fdSmrg	have_ps2pdf=no
209794a251fdSmrg   else
209894a251fdSmrg        have_ps2pdf=yes
209994a251fdSmrg   fi
210094a251fdSmrgelif test "x$use_ps2pdf" = x"yes" ; then
210194a251fdSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
210294a251fdSmrg   if test "x$PS2PDF" = "x"; then
210394a251fdSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
210494a251fdSmrg   fi
210594a251fdSmrg   have_ps2pdf=yes
210694a251fdSmrgelif test "x$use_ps2pdf" = x"no" ; then
210794a251fdSmrg   if test "x$PS2PDF" != "x"; then
210894a251fdSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
210994a251fdSmrg   fi
211094a251fdSmrg   have_ps2pdf=no
21118fff3f40Smrgelse
211294a251fdSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
21138fff3f40Smrgfi
211494a251fdSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
211594a251fdSmrg]) # XORG_WITH_PS2PDF
21168fff3f40Smrg
211794a251fdSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
211894a251fdSmrg# ----------------
211994a251fdSmrg# Minimum version: 1.6.0
2120e6232409Smrg#
212194a251fdSmrg# Documentation tools are not always available on all platforms and sometimes
212294a251fdSmrg# not at the appropriate level. This macro enables a builder to skip all
212394a251fdSmrg# documentation targets except traditional man pages.
212494a251fdSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
212594a251fdSmrg# maximum flexibilty in controlling documentation building.
212694a251fdSmrg# Refer to:
212794a251fdSmrg# XORG_WITH_XMLTO         --with-xmlto
212894a251fdSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
212994a251fdSmrg# XORG_WITH_DOXYGEN       --with-doxygen
213094a251fdSmrg# XORG_WITH_FOP           --with-fop
213194a251fdSmrg# XORG_WITH_GROFF         --with-groff
213294a251fdSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
21338fff3f40Smrg#
213494a251fdSmrg# Interface to module:
213594a251fdSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
213694a251fdSmrg# --enable-docs: 'yes' user instructs the module to generate docs
213794a251fdSmrg#		 'no' user instructs the module not to generate docs
213894a251fdSmrg# parm1:	specify the default value, yes or no.
213994a251fdSmrg#
214094a251fdSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
214194a251fdSmrgm4_define([docs_default], m4_default([$1], [yes]))
214294a251fdSmrgAC_ARG_ENABLE(docs,
214394a251fdSmrg	AS_HELP_STRING([--enable-docs],
214494a251fdSmrg	   [Enable building the documentation (default: ]docs_default[)]),
214594a251fdSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
214694a251fdSmrgm4_undefine([docs_default])
214794a251fdSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
214894a251fdSmrgAC_MSG_CHECKING([whether to build documentation])
214994a251fdSmrgAC_MSG_RESULT([$build_docs])
215094a251fdSmrg]) # XORG_ENABLE_DOCS
21518fff3f40Smrg
215294a251fdSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
215394a251fdSmrg# ----------------
215494a251fdSmrg# Minimum version: 1.6.0
215594a251fdSmrg#
215694a251fdSmrg# This macro enables a builder to skip all developer documentation.
215794a251fdSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
215894a251fdSmrg# maximum flexibilty in controlling documentation building.
215994a251fdSmrg# Refer to:
216094a251fdSmrg# XORG_WITH_XMLTO         --with-xmlto
216194a251fdSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
216294a251fdSmrg# XORG_WITH_DOXYGEN       --with-doxygen
216394a251fdSmrg# XORG_WITH_FOP           --with-fop
216494a251fdSmrg# XORG_WITH_GROFF         --with-groff
216594a251fdSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
216694a251fdSmrg#
216794a251fdSmrg# Interface to module:
216894a251fdSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
216994a251fdSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
217094a251fdSmrg#			'no' user instructs the module not to generate developer docs
217194a251fdSmrg# parm1:		specify the default value, yes or no.
217294a251fdSmrg#
217394a251fdSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
217494a251fdSmrgm4_define([devel_default], m4_default([$1], [yes]))
217594a251fdSmrgAC_ARG_ENABLE(devel-docs,
217694a251fdSmrg	AS_HELP_STRING([--enable-devel-docs],
217794a251fdSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
217894a251fdSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
217994a251fdSmrgm4_undefine([devel_default])
218094a251fdSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
218194a251fdSmrgAC_MSG_CHECKING([whether to build developer documentation])
218294a251fdSmrgAC_MSG_RESULT([$build_devel_docs])
218394a251fdSmrg]) # XORG_ENABLE_DEVEL_DOCS
2184e6232409Smrg
218594a251fdSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
218694a251fdSmrg# ----------------
218794a251fdSmrg# Minimum version: 1.6.0
218894a251fdSmrg#
218994a251fdSmrg# This macro enables a builder to skip all functional specification targets.
219094a251fdSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
219194a251fdSmrg# maximum flexibilty in controlling documentation building.
219294a251fdSmrg# Refer to:
219394a251fdSmrg# XORG_WITH_XMLTO         --with-xmlto
219494a251fdSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
219594a251fdSmrg# XORG_WITH_DOXYGEN       --with-doxygen
219694a251fdSmrg# XORG_WITH_FOP           --with-fop
219794a251fdSmrg# XORG_WITH_GROFF         --with-groff
219894a251fdSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
219994a251fdSmrg#
220094a251fdSmrg# Interface to module:
220194a251fdSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
220294a251fdSmrg# --enable-specs:	'yes' user instructs the module to generate specs
220394a251fdSmrg#			'no' user instructs the module not to generate specs
220494a251fdSmrg# parm1:		specify the default value, yes or no.
220594a251fdSmrg#
220694a251fdSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
220794a251fdSmrgm4_define([spec_default], m4_default([$1], [yes]))
220894a251fdSmrgAC_ARG_ENABLE(specs,
220994a251fdSmrg	AS_HELP_STRING([--enable-specs],
221094a251fdSmrg	   [Enable building the specs (default: ]spec_default[)]),
221194a251fdSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
221294a251fdSmrgm4_undefine([spec_default])
221394a251fdSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
221494a251fdSmrgAC_MSG_CHECKING([whether to build functional specifications])
221594a251fdSmrgAC_MSG_RESULT([$build_specs])
221694a251fdSmrg]) # XORG_ENABLE_SPECS
22178fff3f40Smrg
221894a251fdSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
221994a251fdSmrg# ----------------------------------------------
222094a251fdSmrg# Minimum version: 1.13.0
2221e6232409Smrg#
222294a251fdSmrg# This macro enables a builder to enable/disable unit testing
222394a251fdSmrg# It makes no assumption about the test cases implementation
222494a251fdSmrg# Test cases may or may not use Automake "Support for test suites"
222594a251fdSmrg# They may or may not use the software utility library GLib
222694a251fdSmrg#
222794a251fdSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
222894a251fdSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
222994a251fdSmrg# The variable enable_unit_tests is used by other macros in this file.
223094a251fdSmrg#
223194a251fdSmrg# Interface to module:
223294a251fdSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
223394a251fdSmrg# enable_unit_tests:    used in configure.ac for additional configuration
223494a251fdSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
223594a251fdSmrg#			'no' user instructs the module not to build tests
223694a251fdSmrg# parm1:		specify the default value, yes or no.
223794a251fdSmrg#
223894a251fdSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
223994a251fdSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
224094a251fdSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
224194a251fdSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
224294a251fdSmrgm4_define([_defopt], m4_default([$1], [auto]))
224394a251fdSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
224494a251fdSmrg	[Enable building unit test cases (default: ]_defopt[)]),
224594a251fdSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
224694a251fdSmrgm4_undefine([_defopt])
224794a251fdSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
224894a251fdSmrgAC_MSG_CHECKING([whether to build unit test cases])
224994a251fdSmrgAC_MSG_RESULT([$enable_unit_tests])
225094a251fdSmrg]) # XORG_ENABLE_UNIT_TESTS
225194a251fdSmrg
225294a251fdSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
225394a251fdSmrg# ------------------------------------------------------
225494a251fdSmrg# Minimum version: 1.17.0
225594a251fdSmrg#
225694a251fdSmrg# This macro enables a builder to enable/disable integration testing
225794a251fdSmrg# It makes no assumption about the test cases' implementation
225894a251fdSmrg# Test cases may or may not use Automake "Support for test suites"
225994a251fdSmrg#
226094a251fdSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
226194a251fdSmrg# usually requires less dependencies and may be built and run under less
226294a251fdSmrg# stringent environments than integration tests.
226394a251fdSmrg#
226494a251fdSmrg# Interface to module:
226594a251fdSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
226694a251fdSmrg# enable_integration_tests:   used in configure.ac for additional configuration
226794a251fdSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
226894a251fdSmrg#                             'no' user instructs the module not to build tests
226994a251fdSmrg# parm1:                      specify the default value, yes or no.
227094a251fdSmrg#
227194a251fdSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
227294a251fdSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
227394a251fdSmrgm4_define([_defopt], m4_default([$1], [auto]))
227494a251fdSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
227594a251fdSmrg	[Enable building integration test cases (default: ]_defopt[)]),
227694a251fdSmrg	[enable_integration_tests=$enableval],
227794a251fdSmrg	[enable_integration_tests=]_defopt)
227894a251fdSmrgm4_undefine([_defopt])
227994a251fdSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
228094a251fdSmrg	[test "x$enable_integration_tests" != xno])
228194a251fdSmrgAC_MSG_CHECKING([whether to build unit test cases])
228294a251fdSmrgAC_MSG_RESULT([$enable_integration_tests])
228394a251fdSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
228494a251fdSmrg
228594a251fdSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
228694a251fdSmrg# ----------------------------------------
228794a251fdSmrg# Minimum version: 1.13.0
228894a251fdSmrg#
228994a251fdSmrg# GLib is a library which provides advanced data structures and functions.
229094a251fdSmrg# This macro enables a module to test for the presence of Glib.
229194a251fdSmrg#
229294a251fdSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
229394a251fdSmrg# Otherwise the value of $enable_unit_tests is blank.
229494a251fdSmrg#
229594a251fdSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
229694a251fdSmrg# test support usually requires less dependencies and may be built and run under
229794a251fdSmrg# less stringent environments than integration tests.
229894a251fdSmrg#
229994a251fdSmrg# Interface to module:
230094a251fdSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
230194a251fdSmrg# with_glib: used in configure.ac to know if GLib has been found
230294a251fdSmrg# --with-glib:	'yes' user instructs the module to use glib
230394a251fdSmrg#		'no' user instructs the module not to use glib
230494a251fdSmrg#
230594a251fdSmrgAC_DEFUN([XORG_WITH_GLIB],[
230694a251fdSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
230794a251fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
230894a251fdSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
230994a251fdSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
231094a251fdSmrg	[with_glib=$withval], [with_glib=]_defopt)
231194a251fdSmrgm4_undefine([_defopt])
231294a251fdSmrg
231394a251fdSmrghave_glib=no
231494a251fdSmrg# Do not probe GLib if user explicitly disabled unit testing
231594a251fdSmrgif test "x$enable_unit_tests" != x"no"; then
231694a251fdSmrg  # Do not probe GLib if user explicitly disabled it
231794a251fdSmrg  if test "x$with_glib" != x"no"; then
231894a251fdSmrg    m4_ifval(
231994a251fdSmrg      [$1],
232094a251fdSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
232194a251fdSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
232294a251fdSmrg    )
232394a251fdSmrg  fi
232494a251fdSmrgfi
23258fff3f40Smrg
232694a251fdSmrg# Not having GLib when unit testing has been explicitly requested is an error
232794a251fdSmrgif test "x$enable_unit_tests" = x"yes"; then
232894a251fdSmrg  if test "x$have_glib" = x"no"; then
232994a251fdSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
233094a251fdSmrg  fi
233194a251fdSmrgfi
23328fff3f40Smrg
233394a251fdSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
233494a251fdSmrgif test "x$enable_unit_tests" = x"no"; then
233594a251fdSmrg  if test "x$with_glib" = x"yes"; then
233694a251fdSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
233794a251fdSmrg  fi
233894a251fdSmrgfi
233994a251fdSmrg
234094a251fdSmrg# Not having GLib when it has been explicitly requested is an error
234194a251fdSmrgif test "x$with_glib" = x"yes"; then
234294a251fdSmrg  if test "x$have_glib" = x"no"; then
234394a251fdSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
234494a251fdSmrg  fi
234594a251fdSmrgfi
23468fff3f40Smrg
234794a251fdSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
234894a251fdSmrg]) # XORG_WITH_GLIB
23498fff3f40Smrg
235094a251fdSmrg# XORG_LD_WRAP([required|optional])
235194a251fdSmrg# ---------------------------------
235294a251fdSmrg# Minimum version: 1.13.0
235394a251fdSmrg#
235494a251fdSmrg# Check if linker supports -wrap, passed via compiler flags
235594a251fdSmrg#
235694a251fdSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
235794a251fdSmrg# Otherwise the value of $enable_unit_tests is blank.
235894a251fdSmrg#
235994a251fdSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
236094a251fdSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
236194a251fdSmrg# available, an argument of "optional" allows use when some unit tests require
236294a251fdSmrg# ld -wrap and others do not.
236394a251fdSmrg#
236494a251fdSmrgAC_DEFUN([XORG_LD_WRAP],[
236594a251fdSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
236694a251fdSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
236794a251fdSmrg                      void __wrap_exit(int status) { return; }],
236894a251fdSmrg                     [exit(0);])])
236994a251fdSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
237094a251fdSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
237194a251fdSmrg  if test "x$have_ld_wrap" = x"no"; then
237294a251fdSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
237394a251fdSmrg  fi
23748fff3f40Smrgfi
237594a251fdSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
237694a251fdSmrg#
237794a251fdSmrg]) # XORG_LD_WRAP
237894a251fdSmrg
237994a251fdSmrg# XORG_CHECK_LINKER_FLAGS
238094a251fdSmrg# -----------------------
238194a251fdSmrg# SYNOPSIS
238294a251fdSmrg#
238394a251fdSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
238494a251fdSmrg#
238594a251fdSmrg# DESCRIPTION
238694a251fdSmrg#
238794a251fdSmrg#   Check whether the given linker FLAGS work with the current language's
238894a251fdSmrg#   linker, or whether they give an error.
238994a251fdSmrg#
239094a251fdSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
239194a251fdSmrg#   success/failure.
239294a251fdSmrg#
239394a251fdSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
239494a251fdSmrg#
239594a251fdSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
239694a251fdSmrg#
239794a251fdSmrg# LICENSE
239894a251fdSmrg#
239994a251fdSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
240094a251fdSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
240194a251fdSmrg#   Copyright (c) 2009 Matteo Frigo
240294a251fdSmrg#
240394a251fdSmrg#   This program is free software: you can redistribute it and/or modify it
240494a251fdSmrg#   under the terms of the GNU General Public License as published by the
240594a251fdSmrg#   Free Software Foundation, either version 3 of the License, or (at your
240694a251fdSmrg#   option) any later version.
240794a251fdSmrg#
240894a251fdSmrg#   This program is distributed in the hope that it will be useful, but
240994a251fdSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
241094a251fdSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
241194a251fdSmrg#   Public License for more details.
241294a251fdSmrg#
241394a251fdSmrg#   You should have received a copy of the GNU General Public License along
241494a251fdSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
241594a251fdSmrg#
241694a251fdSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
241794a251fdSmrg#   gives unlimited permission to copy, distribute and modify the configure
241894a251fdSmrg#   scripts that are the output of Autoconf when processing the Macro. You
241994a251fdSmrg#   need not follow the terms of the GNU General Public License when using
242094a251fdSmrg#   or distributing such scripts, even though portions of the text of the
242194a251fdSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
242294a251fdSmrg#   all other use of the material that constitutes the Autoconf Macro.
242394a251fdSmrg#
242494a251fdSmrg#   This special exception to the GPL applies to versions of the Autoconf
242594a251fdSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
242694a251fdSmrg#   modified version of the Autoconf Macro, you may extend this special
242794a251fdSmrg#   exception to the GPL to apply to your modified version as well.#
242894a251fdSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
242994a251fdSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
243094a251fdSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
243194a251fdSmrgAS_LITERAL_IF([$1],
243294a251fdSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
243394a251fdSmrg      ax_save_FLAGS=$LDFLAGS
243494a251fdSmrg      LDFLAGS="$1"
243594a251fdSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
243694a251fdSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
243794a251fdSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
243894a251fdSmrg      LDFLAGS=$ax_save_FLAGS])],
243994a251fdSmrg  [ax_save_FLAGS=$LDFLAGS
244094a251fdSmrg   LDFLAGS="$1"
244194a251fdSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
244294a251fdSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
244394a251fdSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
244494a251fdSmrg   LDFLAGS=$ax_save_FLAGS])
244594a251fdSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
244694a251fdSmrgAC_MSG_RESULT($xorg_check_linker_flags)
244794a251fdSmrgif test "x$xorg_check_linker_flags" = xyes; then
244894a251fdSmrg	m4_default([$2], :)
24498fff3f40Smrgelse
245094a251fdSmrg	m4_default([$3], :)
24518fff3f40Smrgfi
245294a251fdSmrg]) # XORG_CHECK_LINKER_FLAGS
24538fff3f40Smrg
245494a251fdSmrg# XORG_MEMORY_CHECK_FLAGS
245594a251fdSmrg# -----------------------
245694a251fdSmrg# Minimum version: 1.16.0
2457e6232409Smrg#
245894a251fdSmrg# This macro attempts to find appropriate memory checking functionality
245994a251fdSmrg# for various platforms which unit testing code may use to catch various
246094a251fdSmrg# forms of memory allocation and access errors in testing.
246194a251fdSmrg#
246294a251fdSmrg# Interface to module:
246394a251fdSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
246494a251fdSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
246594a251fdSmrg#
246694a251fdSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
246794a251fdSmrg#
246894a251fdSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
24698fff3f40Smrg
247094a251fdSmrgAC_REQUIRE([AC_CANONICAL_HOST])
247194a251fdSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
247294a251fdSmrg           [Environment variables to enable memory checking in tests])
247394a251fdSmrg
247494a251fdSmrg# Check for different types of support on different platforms
247594a251fdSmrgcase $host_os in
247694a251fdSmrg    solaris*)
247794a251fdSmrg        AC_CHECK_LIB([umem], [umem_alloc],
247894a251fdSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
247994a251fdSmrg        ;;
248094a251fdSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
248194a251fdSmrg        # both directly and inverted, so should not be 0 or 255.
248294a251fdSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
248394a251fdSmrg        ;;
248494a251fdSmrg    darwin*)
248594a251fdSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
248694a251fdSmrg        ;;
248794a251fdSmrg    *bsd*)
248894a251fdSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
248994a251fdSmrg        ;;
24908fff3f40Smrgesac
24918fff3f40Smrg
249294a251fdSmrg# User supplied flags override default flags
249394a251fdSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
249494a251fdSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
249594a251fdSmrgfi
2496e6232409Smrg
249794a251fdSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
249894a251fdSmrg]) # XORG_WITH_LINT
2499e6232409Smrg
250094a251fdSmrg# XORG_CHECK_MALLOC_ZERO
250194a251fdSmrg# ----------------------
250294a251fdSmrg# Minimum version: 1.0.0
250394a251fdSmrg#
250494a251fdSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
250594a251fdSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
250694a251fdSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
250794a251fdSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
250894a251fdSmrgAC_ARG_ENABLE(malloc0returnsnull,
250994a251fdSmrg	AS_HELP_STRING([--enable-malloc0returnsnull],
251094a251fdSmrg		       [malloc(0) returns NULL (default: auto)]),
251194a251fdSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
251294a251fdSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
25138fff3f40Smrg
251494a251fdSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
251594a251fdSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
251694a251fdSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
251794a251fdSmrg#include <stdlib.h>
251894a251fdSmrg],[
251994a251fdSmrg    char *m0, *r0, *c0, *p;
252094a251fdSmrg    m0 = malloc(0);
252194a251fdSmrg    p = malloc(10);
252294a251fdSmrg    r0 = realloc(p,0);
252394a251fdSmrg    c0 = calloc(0,10);
252494a251fdSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
252594a251fdSmrg])],
252694a251fdSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
252794a251fdSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
252894a251fdSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
252994a251fdSmrgfi
253094a251fdSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
25318fff3f40Smrg
253294a251fdSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
253394a251fdSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
253494a251fdSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
253594a251fdSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
253694a251fdSmrgelse
253794a251fdSmrg	MALLOC_ZERO_CFLAGS=""
253894a251fdSmrg	XMALLOC_ZERO_CFLAGS=""
253994a251fdSmrg	XTMALLOC_ZERO_CFLAGS=""
254094a251fdSmrgfi
25418fff3f40Smrg
254294a251fdSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
254394a251fdSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
254494a251fdSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
254594a251fdSmrg]) # XORG_CHECK_MALLOC_ZERO
25468fff3f40Smrg
254794a251fdSmrg# XORG_WITH_LINT()
254894a251fdSmrg# ----------------
254994a251fdSmrg# Minimum version: 1.1.0
2550e6232409Smrg#
255194a251fdSmrg# This macro enables the use of a tool that flags some suspicious and
255294a251fdSmrg# non-portable constructs (likely to be bugs) in C language source code.
255394a251fdSmrg# It will attempt to locate the tool and use appropriate options.
255494a251fdSmrg# There are various lint type tools on different platforms.
255594a251fdSmrg#
255694a251fdSmrg# Interface to module:
255794a251fdSmrg# LINT:		returns the path to the tool found on the platform
255894a251fdSmrg#		or the value set to LINT on the configure cmd line
255994a251fdSmrg#		also an Automake conditional
256094a251fdSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
256194a251fdSmrg#
256294a251fdSmrg# --with-lint:	'yes' user instructs the module to use lint
256394a251fdSmrg#		'no' user instructs the module not to use lint (default)
256494a251fdSmrg#
256594a251fdSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
256694a251fdSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
256794a251fdSmrg#
256894a251fdSmrgAC_DEFUN([XORG_WITH_LINT],[
25698fff3f40Smrg
257094a251fdSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
257194a251fdSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
257294a251fdSmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
257394a251fdSmrg		[Use a lint-style source code checker (default: disabled)])],
257494a251fdSmrg		[use_lint=$withval], [use_lint=no])
25758fff3f40Smrg
257694a251fdSmrg# Obtain platform specific info like program name and options
257794a251fdSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
257894a251fdSmrgcase $host_os in
257994a251fdSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
258094a251fdSmrg	lint_name=splint
258194a251fdSmrg	lint_options="-badflag"
258294a251fdSmrg	;;
258394a251fdSmrg  *freebsd* | *netbsd*)
258494a251fdSmrg	lint_name=lint
258594a251fdSmrg	lint_options="-u -b"
258694a251fdSmrg	;;
258794a251fdSmrg  *solaris*)
258894a251fdSmrg	lint_name=lint
258994a251fdSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
259094a251fdSmrg	;;
25918fff3f40Smrgesac
25928fff3f40Smrg
259394a251fdSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
259494a251fdSmrgif test "x$use_lint" = x"yes" ; then
259594a251fdSmrg   AC_PATH_PROG([LINT], [$lint_name])
259694a251fdSmrg   if test "x$LINT" = "x"; then
259794a251fdSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
25988fff3f40Smrg   fi
259994a251fdSmrgelif test "x$use_lint" = x"no" ; then
260094a251fdSmrg   if test "x$LINT" != "x"; then
260194a251fdSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
26028fff3f40Smrg   fi
26038fff3f40Smrgelse
260494a251fdSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
26058fff3f40Smrgfi
26068fff3f40Smrg
260794a251fdSmrg# User supplied flags override default flags
260894a251fdSmrgif test "x$LINT_FLAGS" != "x"; then
260994a251fdSmrg   lint_options=$LINT_FLAGS
261094a251fdSmrgfi
26118fff3f40Smrg
261294a251fdSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
261394a251fdSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
26148fff3f40Smrg
261594a251fdSmrg]) # XORG_WITH_LINT
261694a251fdSmrg
261794a251fdSmrg# XORG_LINT_LIBRARY(LIBNAME)
26188fff3f40Smrg# --------------------------
261994a251fdSmrg# Minimum version: 1.1.0
262094a251fdSmrg#
262194a251fdSmrg# Sets up flags for building lint libraries for checking programs that call
262294a251fdSmrg# functions in the library.
262394a251fdSmrg#
262494a251fdSmrg# Interface to module:
262594a251fdSmrg# LINTLIB		- Automake variable with the name of lint library file to make
262694a251fdSmrg# MAKE_LINT_LIB		- Automake conditional
262794a251fdSmrg#
262894a251fdSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
262994a251fdSmrg#			  - 'no' user instructs the module not to create a lint library (default)
263094a251fdSmrg
263194a251fdSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
263294a251fdSmrgAC_REQUIRE([XORG_WITH_LINT])
263394a251fdSmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
263494a251fdSmrg	[Create lint library (default: disabled)])],
263594a251fdSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
263694a251fdSmrg
263794a251fdSmrgif test "x$make_lint_lib" = x"yes" ; then
263894a251fdSmrg   LINTLIB=llib-l$1.ln
263994a251fdSmrg   if test "x$LINT" = "x"; then
264094a251fdSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
264194a251fdSmrg   fi
264294a251fdSmrgelif test "x$make_lint_lib" != x"no" ; then
264394a251fdSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
264494a251fdSmrgfi
264594a251fdSmrg
264694a251fdSmrgAC_SUBST(LINTLIB)
264794a251fdSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
264894a251fdSmrg
264994a251fdSmrg]) # XORG_LINT_LIBRARY
265094a251fdSmrg
265194a251fdSmrg# XORG_COMPILER_BRAND
265294a251fdSmrg# -------------------
265394a251fdSmrg# Minimum version: 1.14.0
265494a251fdSmrg#
265594a251fdSmrg# Checks for various brands of compilers and sets flags as appropriate:
265694a251fdSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
265794a251fdSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
265894a251fdSmrg#   clang compiler - sets CLANGCC to "yes"
265994a251fdSmrg#   Intel compiler - sets INTELCC to "yes"
266094a251fdSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
266194a251fdSmrg#
266294a251fdSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
266394a251fdSmrgAC_LANG_CASE(
266494a251fdSmrg	[C], [
266594a251fdSmrg		AC_REQUIRE([AC_PROG_CC_C99])
266694a251fdSmrg	],
266794a251fdSmrg	[C++], [
266894a251fdSmrg		AC_REQUIRE([AC_PROG_CXX])
266994a251fdSmrg	]
267094a251fdSmrg)
267194a251fdSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
267294a251fdSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
267394a251fdSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
267494a251fdSmrg]) # XORG_COMPILER_BRAND
267594a251fdSmrg
267694a251fdSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
267794a251fdSmrg# ---------------
267894a251fdSmrg# Minimum version: 1.16.0
267994a251fdSmrg#
268094a251fdSmrg# Test if the compiler works when passed the given flag as a command line argument.
268194a251fdSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
268294a251fdSmrg# next flag in the list until there are no more options.
268394a251fdSmrg#
268494a251fdSmrg# Note that this does not guarantee that the compiler supports the flag as some
268594a251fdSmrg# compilers will simply ignore arguments that they do not understand, but we do
268694a251fdSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
268794a251fdSmrg# -Werror=unused-command-line-argument
268894a251fdSmrg#
268994a251fdSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
269094a251fdSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
269194a251fdSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
269294a251fdSmrg
269394a251fdSmrgAC_LANG_COMPILER_REQUIRE
269494a251fdSmrg
269594a251fdSmrgAC_LANG_CASE(
269694a251fdSmrg	[C], [
269794a251fdSmrg		AC_REQUIRE([AC_PROG_CC_C99])
269894a251fdSmrg		define([PREFIX], [C])
269994a251fdSmrg		define([CACHE_PREFIX], [cc])
270094a251fdSmrg		define([COMPILER], [$CC])
270194a251fdSmrg	],
270294a251fdSmrg	[C++], [
270394a251fdSmrg		define([PREFIX], [CXX])
270494a251fdSmrg		define([CACHE_PREFIX], [cxx])
270594a251fdSmrg		define([COMPILER], [$CXX])
270694a251fdSmrg	]
270794a251fdSmrg)
270894a251fdSmrg
270994a251fdSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
271094a251fdSmrg
271194a251fdSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
271294a251fdSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
271394a251fdSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
271494a251fdSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
271594a251fdSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
271694a251fdSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
271794a251fdSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
271894a251fdSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
271994a251fdSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
272094a251fdSmrgfi
272194a251fdSmrg
272294a251fdSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
272394a251fdSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
272494a251fdSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
272594a251fdSmrg	fi
272694a251fdSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
272794a251fdSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
272894a251fdSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
272994a251fdSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
273094a251fdSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
273194a251fdSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
273294a251fdSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
273394a251fdSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
273494a251fdSmrgfi
273594a251fdSmrg
273694a251fdSmrgfound="no"
273794a251fdSmrgm4_foreach([flag], m4_cdr($@), [
273894a251fdSmrg	if test $found = "no" ; then
273994a251fdSmrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
274094a251fdSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
274194a251fdSmrg		fi
274294a251fdSmrg
274394a251fdSmrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
274494a251fdSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
274594a251fdSmrg		fi
274694a251fdSmrg
274794a251fdSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
274894a251fdSmrg
274994a251fdSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
275094a251fdSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
275194a251fdSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
275294a251fdSmrg		AC_CACHE_VAL($cacheid,
275394a251fdSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
275494a251fdSmrg					     [eval $cacheid=yes],
275594a251fdSmrg					     [eval $cacheid=no])])
275694a251fdSmrg
275794a251fdSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
275894a251fdSmrg
275994a251fdSmrg		eval supported=\$$cacheid
276094a251fdSmrg		AC_MSG_RESULT([$supported])
276194a251fdSmrg		if test "$supported" = "yes" ; then
276294a251fdSmrg			$1="$$1 ]flag["
276394a251fdSmrg			found="yes"
276494a251fdSmrg		fi
276594a251fdSmrg	fi
27668fff3f40Smrg])
276794a251fdSmrg]) # XORG_TESTSET_CFLAG
27688fff3f40Smrg
276994a251fdSmrg# XORG_COMPILER_FLAGS
277094a251fdSmrg# ---------------
277194a251fdSmrg# Minimum version: 1.16.0
277294a251fdSmrg#
277394a251fdSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
277494a251fdSmrg# arguments supported by the selected compiler which do NOT alter the generated
277594a251fdSmrg# code.  These arguments will cause the compiler to print various warnings
277694a251fdSmrg# during compilation AND turn a conservative set of warnings into errors.
277794a251fdSmrg#
277894a251fdSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
277994a251fdSmrg# future versions of util-macros as options are added to new compilers.
278094a251fdSmrg#
278194a251fdSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
278294a251fdSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
278394a251fdSmrg
278494a251fdSmrgAC_ARG_ENABLE(selective-werror,
278594a251fdSmrg              AS_HELP_STRING([--disable-selective-werror],
278694a251fdSmrg                             [Turn off selective compiler errors. (default: enabled)]),
278794a251fdSmrg              [SELECTIVE_WERROR=$enableval],
278894a251fdSmrg              [SELECTIVE_WERROR=yes])
278994a251fdSmrg
279094a251fdSmrgAC_LANG_CASE(
279194a251fdSmrg        [C], [
279294a251fdSmrg                define([PREFIX], [C])
279394a251fdSmrg        ],
279494a251fdSmrg        [C++], [
279594a251fdSmrg                define([PREFIX], [CXX])
279694a251fdSmrg        ]
279794a251fdSmrg)
279894a251fdSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
279994a251fdSmrgif test "x$SUNCC" = "xyes"; then
280094a251fdSmrg    [BASE_]PREFIX[FLAGS]="-v"
280194a251fdSmrgelse
280294a251fdSmrg    [BASE_]PREFIX[FLAGS]=""
280394a251fdSmrgfi
28048fff3f40Smrg
280594a251fdSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
280694a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
280794a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
280894a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
280994a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
281094a251fdSmrg
281194a251fdSmrgAC_LANG_CASE(
281294a251fdSmrg	[C], [
281394a251fdSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
281494a251fdSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
281594a251fdSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
281694a251fdSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
281794a251fdSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
281894a251fdSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
281994a251fdSmrg	]
282094a251fdSmrg)
282194a251fdSmrg
282294a251fdSmrg# This chunk adds additional warnings that could catch undesired effects.
282394a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
282494a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
282594a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
282694a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
282794a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
282894a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
282994a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
283094a251fdSmrg
283194a251fdSmrg# These are currently disabled because they are noisy.  They will be enabled
283294a251fdSmrg# in the future once the codebase is sufficiently modernized to silence
283394a251fdSmrg# them.  For now, I don't want them to drown out the other warnings.
283494a251fdSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
283594a251fdSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
283694a251fdSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
283794a251fdSmrg
283894a251fdSmrg# Turn some warnings into errors, so we don't accidently get successful builds
283994a251fdSmrg# when there are problems that should be fixed.
284094a251fdSmrg
284194a251fdSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
284294a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
284394a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
284494a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
284594a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
284694a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
284794a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
284894a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
284994a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
285094a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
285194a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
285294a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
285394a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
285494a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
285594a251fdSmrgelse
285694a251fdSmrgAC_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])
285794a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
285894a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
285994a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
286094a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
286194a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
286294a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
286394a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
286494a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
286594a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
286694a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
286794a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
286894a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
286994a251fdSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
28708fff3f40Smrgfi
28718fff3f40Smrg
287294a251fdSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
287394a251fdSmrg]) # XORG_COMPILER_FLAGS
287494a251fdSmrg
287594a251fdSmrg# XORG_CWARNFLAGS
287694a251fdSmrg# ---------------
287794a251fdSmrg# Minimum version: 1.2.0
287894a251fdSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2879e6232409Smrg#
288094a251fdSmrg# Defines CWARNFLAGS to enable C compiler warnings.
288194a251fdSmrg#
288294a251fdSmrg# This function is deprecated because it defines -fno-strict-aliasing
288394a251fdSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
288494a251fdSmrg# is needed, then it should be added explicitly in the module when
288594a251fdSmrg# it is updated to use BASE_CFLAGS.
288694a251fdSmrg#
288794a251fdSmrgAC_DEFUN([XORG_CWARNFLAGS], [
288894a251fdSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
288994a251fdSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
289094a251fdSmrgAC_LANG_CASE(
289194a251fdSmrg	[C], [
289294a251fdSmrg		CWARNFLAGS="$BASE_CFLAGS"
289394a251fdSmrg		if  test "x$GCC" = xyes ; then
289494a251fdSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
289594a251fdSmrg		fi
289694a251fdSmrg		AC_SUBST(CWARNFLAGS)
289794a251fdSmrg	]
289894a251fdSmrg)
289994a251fdSmrg]) # XORG_CWARNFLAGS
2900e6232409Smrg
290194a251fdSmrg# XORG_STRICT_OPTION
290294a251fdSmrg# -----------------------
290394a251fdSmrg# Minimum version: 1.3.0
290494a251fdSmrg#
290594a251fdSmrg# Add configure option to enable strict compilation flags, such as treating
290694a251fdSmrg# warnings as fatal errors.
290794a251fdSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
290894a251fdSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
290994a251fdSmrg#
291094a251fdSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
291194a251fdSmrg# when strict compilation is unconditionally desired.
291294a251fdSmrgAC_DEFUN([XORG_STRICT_OPTION], [
291394a251fdSmrgAC_REQUIRE([XORG_CWARNFLAGS])
291494a251fdSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2915e6232409Smrg
291694a251fdSmrgAC_ARG_ENABLE(strict-compilation,
291794a251fdSmrg			  AS_HELP_STRING([--enable-strict-compilation],
291894a251fdSmrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
291994a251fdSmrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2920e6232409Smrg
292194a251fdSmrgAC_LANG_CASE(
292294a251fdSmrg        [C], [
292394a251fdSmrg                define([PREFIX], [C])
292494a251fdSmrg        ],
292594a251fdSmrg        [C++], [
292694a251fdSmrg                define([PREFIX], [CXX])
292794a251fdSmrg        ]
292894a251fdSmrg)
2929e6232409Smrg
293094a251fdSmrg[STRICT_]PREFIX[FLAGS]=""
293194a251fdSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
293294a251fdSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2933e6232409Smrg
293494a251fdSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
293594a251fdSmrg# activate it with -Werror, so we add it here explicitly.
293694a251fdSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2937e6232409Smrg
293894a251fdSmrgif test "x$STRICT_COMPILE" = "xyes"; then
293994a251fdSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
294094a251fdSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
294194a251fdSmrgfi
294294a251fdSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
294394a251fdSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
294494a251fdSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
294594a251fdSmrg]) # XORG_STRICT_OPTION
2946e6232409Smrg
294794a251fdSmrg# XORG_DEFAULT_OPTIONS
29488fff3f40Smrg# --------------------
294994a251fdSmrg# Minimum version: 1.3.0
29508fff3f40Smrg#
295194a251fdSmrg# Defines default options for X.Org modules.
29528fff3f40Smrg#
295394a251fdSmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
295494a251fdSmrgAC_REQUIRE([AC_PROG_INSTALL])
295594a251fdSmrgXORG_COMPILER_FLAGS
295694a251fdSmrgXORG_CWARNFLAGS
295794a251fdSmrgXORG_STRICT_OPTION
295894a251fdSmrgXORG_RELEASE_VERSION
295994a251fdSmrgXORG_CHANGELOG
296094a251fdSmrgXORG_INSTALL
296194a251fdSmrgXORG_MANPAGE_SECTIONS
296294a251fdSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
296394a251fdSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
296494a251fdSmrg]) # XORG_DEFAULT_OPTIONS
29658fff3f40Smrg
296694a251fdSmrg# XORG_INSTALL()
296794a251fdSmrg# ----------------
296894a251fdSmrg# Minimum version: 1.4.0
296994a251fdSmrg#
297094a251fdSmrg# Defines the variable INSTALL_CMD as the command to copy
297194a251fdSmrg# INSTALL from $prefix/share/util-macros.
297294a251fdSmrg#
297394a251fdSmrgAC_DEFUN([XORG_INSTALL], [
297494a251fdSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
297594a251fdSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
297694a251fdSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
297794a251fdSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
297894a251fdSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
297994a251fdSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
298094a251fdSmrgAC_SUBST([INSTALL_CMD])
298194a251fdSmrg]) # XORG_INSTALL
298294a251fdSmrgdnl Copyright 2005 Red Hat, Inc
298394a251fdSmrgdnl
298494a251fdSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
298594a251fdSmrgdnl documentation for any purpose is hereby granted without fee, provided that
298694a251fdSmrgdnl the above copyright notice appear in all copies and that both that
298794a251fdSmrgdnl copyright notice and this permission notice appear in supporting
298894a251fdSmrgdnl documentation.
298994a251fdSmrgdnl
299094a251fdSmrgdnl The above copyright notice and this permission notice shall be included
299194a251fdSmrgdnl in all copies or substantial portions of the Software.
299294a251fdSmrgdnl
299394a251fdSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
299494a251fdSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
299594a251fdSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
299694a251fdSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
299794a251fdSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
299894a251fdSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
299994a251fdSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
300094a251fdSmrgdnl
300194a251fdSmrgdnl Except as contained in this notice, the name of the copyright holders shall
300294a251fdSmrgdnl not be used in advertising or otherwise to promote the sale, use or
300394a251fdSmrgdnl other dealings in this Software without prior written authorization
300494a251fdSmrgdnl from the copyright holders.
300594a251fdSmrgdnl
30068fff3f40Smrg
300794a251fdSmrg# XORG_RELEASE_VERSION
300894a251fdSmrg# --------------------
300994a251fdSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
301094a251fdSmrg 
301194a251fdSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
301294a251fdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
301394a251fdSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
301494a251fdSmrg		[Major version of this package])
301594a251fdSmrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
301694a251fdSmrg	if test "x$PVM" = "x"; then
301794a251fdSmrg		PVM="0"
301894a251fdSmrg	fi
301994a251fdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
302094a251fdSmrg		[$PVM],
302194a251fdSmrg		[Minor version of this package])
302294a251fdSmrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
302394a251fdSmrg	if test "x$PVP" = "x"; then
302494a251fdSmrg		PVP="0"
302594a251fdSmrg	fi
302694a251fdSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
302794a251fdSmrg		[$PVP],
302894a251fdSmrg		[Patch version of this package])
302994a251fdSmrg])
30308fff3f40Smrg
303194a251fdSmrg# XORG_CHANGELOG()
303294a251fdSmrg# ----------------
303394a251fdSmrg# Minimum version: 1.2.0
303494a251fdSmrg#
303594a251fdSmrg# Defines the variable CHANGELOG_CMD as the command to generate
303694a251fdSmrg# ChangeLog from git.
303794a251fdSmrg#
303894a251fdSmrg#
303994a251fdSmrgAC_DEFUN([XORG_CHANGELOG], [
304094a251fdSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
304194a251fdSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
304294a251fdSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
304394a251fdSmrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
304494a251fdSmrgAC_SUBST([CHANGELOG_CMD])
304594a251fdSmrg]) # XORG_CHANGELOG
3046e6232409Smrg
3047