aclocal.m4 revision 82e12b1b
182e12b1bSmrg# generated automatically by aclocal 1.11.2 -*- Autoconf -*-
221c2f794Smrg
321c2f794Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
482e12b1bSmrg# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
582e12b1bSmrg# Inc.
621c2f794Smrg# This file is free software; the Free Software Foundation
721c2f794Smrg# gives unlimited permission to copy and/or distribute it,
821c2f794Smrg# with or without modifications, as long as this notice is preserved.
921c2f794Smrg
1021c2f794Smrg# This program is distributed in the hope that it will be useful,
1121c2f794Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1221c2f794Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1321c2f794Smrg# PARTICULAR PURPOSE.
1421c2f794Smrg
1512391620Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1612391620Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1712391620Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
1812391620Smrg[m4_warning([this file was generated for autoconf 2.68.
1912391620SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2012391620SmrgIf you have problems, you may need to regenerate the build system entirely.
2112391620SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
2221c2f794Smrg
2382e12b1bSmrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
2482e12b1bSmrg# Foundation, Inc.
2521c2f794Smrg#
2621c2f794Smrg# This file is free software; the Free Software Foundation
2721c2f794Smrg# gives unlimited permission to copy and/or distribute it,
2821c2f794Smrg# with or without modifications, as long as this notice is preserved.
2921c2f794Smrg
3082e12b1bSmrg# serial 1
3182e12b1bSmrg
3221c2f794Smrg# AM_AUTOMAKE_VERSION(VERSION)
3321c2f794Smrg# ----------------------------
3421c2f794Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3521c2f794Smrg# generated from the m4 files accompanying Automake X.Y.
3621c2f794Smrg# (This private macro should not be called outside this file.)
3721c2f794SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3812391620Smrg[am__api_version='1.11'
3921c2f794Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
4021c2f794Smrgdnl require some minimum version.  Point them to the right macro.
4182e12b1bSmrgm4_if([$1], [1.11.2], [],
4221c2f794Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4321c2f794Smrg])
4421c2f794Smrg
4521c2f794Smrg# _AM_AUTOCONF_VERSION(VERSION)
4621c2f794Smrg# -----------------------------
4721c2f794Smrg# aclocal traces this macro to find the Autoconf version.
4821c2f794Smrg# This is a private macro too.  Using m4_define simplifies
4921c2f794Smrg# the logic in aclocal, which can simply ignore this definition.
5021c2f794Smrgm4_define([_AM_AUTOCONF_VERSION], [])
5121c2f794Smrg
5221c2f794Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5321c2f794Smrg# -------------------------------
5421c2f794Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5512391620Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5621c2f794SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5782e12b1bSmrg[AM_AUTOMAKE_VERSION([1.11.2])dnl
5812391620Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5912391620Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
6012391620Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
6121c2f794Smrg
6221c2f794Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6321c2f794Smrg
6482e12b1bSmrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
6521c2f794Smrg#
6621c2f794Smrg# This file is free software; the Free Software Foundation
6721c2f794Smrg# gives unlimited permission to copy and/or distribute it,
6821c2f794Smrg# with or without modifications, as long as this notice is preserved.
6921c2f794Smrg
7082e12b1bSmrg# serial 1
7182e12b1bSmrg
7221c2f794Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
7321c2f794Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
7421c2f794Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
7521c2f794Smrg#
7621c2f794Smrg# Of course, Automake must honor this variable whenever it calls a
7721c2f794Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7821c2f794Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7921c2f794Smrg# depending on how configure is run.  This is pretty annoying, since
8021c2f794Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
8121c2f794Smrg# source directory, any form will work fine, but in subdirectories a
8221c2f794Smrg# relative path needs to be adjusted first.
8321c2f794Smrg#
8421c2f794Smrg# $ac_aux_dir/missing
8521c2f794Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8621c2f794Smrg# $top_srcdir/$ac_aux_dir/missing
8721c2f794Smrg#    fails if $ac_aux_dir is absolute,
8821c2f794Smrg#    fails when called from a subdirectory in a VPATH build with
8921c2f794Smrg#          a relative $ac_aux_dir
9021c2f794Smrg#
9121c2f794Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
9221c2f794Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
9321c2f794Smrg# harmless because $srcdir is `.', but things will broke when you
9421c2f794Smrg# start a VPATH build or use an absolute $srcdir.
9521c2f794Smrg#
9621c2f794Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9721c2f794Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9821c2f794Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9921c2f794Smrg# and then we would define $MISSING as
10021c2f794Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
10121c2f794Smrg# This will work as long as MISSING is not called from configure, because
10221c2f794Smrg# unfortunately $(top_srcdir) has no meaning in configure.
10321c2f794Smrg# However there are other variables, like CC, which are often used in
10421c2f794Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10521c2f794Smrg#
10621c2f794Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10721c2f794Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10821c2f794Smrg# configured tree to be moved without reconfiguration.
10921c2f794Smrg
11021c2f794SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
11121c2f794Smrg[dnl Rely on autoconf to set up CDPATH properly.
11221c2f794SmrgAC_PREREQ([2.50])dnl
11321c2f794Smrg# expand $ac_aux_dir to an absolute path
11421c2f794Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
11521c2f794Smrg])
11621c2f794Smrg
11721c2f794Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11821c2f794Smrg
11912391620Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
12021c2f794Smrg# Free Software Foundation, Inc.
12121c2f794Smrg#
12221c2f794Smrg# This file is free software; the Free Software Foundation
12321c2f794Smrg# gives unlimited permission to copy and/or distribute it,
12421c2f794Smrg# with or without modifications, as long as this notice is preserved.
12521c2f794Smrg
12612391620Smrg# serial 9
12721c2f794Smrg
12821c2f794Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12921c2f794Smrg# -------------------------------------
13021c2f794Smrg# Define a conditional.
13121c2f794SmrgAC_DEFUN([AM_CONDITIONAL],
13221c2f794Smrg[AC_PREREQ(2.52)dnl
13321c2f794Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
13421c2f794Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
13521c2f794SmrgAC_SUBST([$1_TRUE])dnl
13621c2f794SmrgAC_SUBST([$1_FALSE])dnl
13721c2f794Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
13821c2f794Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13912391620Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
14021c2f794Smrgif $2; then
14121c2f794Smrg  $1_TRUE=
14221c2f794Smrg  $1_FALSE='#'
14321c2f794Smrgelse
14421c2f794Smrg  $1_TRUE='#'
14521c2f794Smrg  $1_FALSE=
14621c2f794Smrgfi
14721c2f794SmrgAC_CONFIG_COMMANDS_PRE(
14821c2f794Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14921c2f794Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
15021c2f794SmrgUsually this means the macro was only invoked conditionally.]])
15121c2f794Smrgfi])])
15221c2f794Smrg
15382e12b1bSmrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
15482e12b1bSmrg# 2010, 2011 Free Software Foundation, Inc.
15521c2f794Smrg#
15621c2f794Smrg# This file is free software; the Free Software Foundation
15721c2f794Smrg# gives unlimited permission to copy and/or distribute it,
15821c2f794Smrg# with or without modifications, as long as this notice is preserved.
15921c2f794Smrg
16082e12b1bSmrg# serial 12
16121c2f794Smrg
16221c2f794Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
16321c2f794Smrg# written in clear, in which case automake, when reading aclocal.m4,
16421c2f794Smrg# will think it sees a *use*, and therefore will trigger all it's
16521c2f794Smrg# C support machinery.  Also note that it means that autoscan, seeing
16621c2f794Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
16721c2f794Smrg
16821c2f794Smrg
16921c2f794Smrg# _AM_DEPENDENCIES(NAME)
17021c2f794Smrg# ----------------------
17121c2f794Smrg# See how the compiler implements dependency checking.
17221c2f794Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
17321c2f794Smrg# We try a few techniques and use that to set a single cache variable.
17421c2f794Smrg#
17521c2f794Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
17621c2f794Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
17721c2f794Smrg# dependency, and given that the user is not expected to run this macro,
17821c2f794Smrg# just rely on AC_PROG_CC.
17921c2f794SmrgAC_DEFUN([_AM_DEPENDENCIES],
18021c2f794Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
18121c2f794SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
18221c2f794SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
18321c2f794SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
18421c2f794Smrg
18521c2f794Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
18621c2f794Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
18721c2f794Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
18821c2f794Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
18921c2f794Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
19021c2f794Smrg                   [depcc="$$1"   am_compiler_list=])
19121c2f794Smrg
19221c2f794SmrgAC_CACHE_CHECK([dependency style of $depcc],
19321c2f794Smrg               [am_cv_$1_dependencies_compiler_type],
19421c2f794Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
19521c2f794Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
19621c2f794Smrg  # making bogus files that we don't know about and never remove.  For
19721c2f794Smrg  # instance it was reported that on HP-UX the gcc test will end up
19821c2f794Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
19921c2f794Smrg  # in D'.
20082e12b1bSmrg  rm -rf conftest.dir
20121c2f794Smrg  mkdir conftest.dir
20221c2f794Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
20321c2f794Smrg  # using a relative directory.
20421c2f794Smrg  cp "$am_depcomp" conftest.dir
20521c2f794Smrg  cd conftest.dir
20621c2f794Smrg  # We will build objects and dependencies in a subdirectory because
20721c2f794Smrg  # it helps to detect inapplicable dependency modes.  For instance
20821c2f794Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
20921c2f794Smrg  # side effect of compilation, but ICC will put the dependencies in
21021c2f794Smrg  # the current directory while Tru64 will put them in the object
21121c2f794Smrg  # directory.
21221c2f794Smrg  mkdir sub
21321c2f794Smrg
21421c2f794Smrg  am_cv_$1_dependencies_compiler_type=none
21521c2f794Smrg  if test "$am_compiler_list" = ""; then
21621c2f794Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
21721c2f794Smrg  fi
21812391620Smrg  am__universal=false
21912391620Smrg  m4_case([$1], [CC],
22012391620Smrg    [case " $depcc " in #(
22112391620Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
22212391620Smrg     esac],
22312391620Smrg    [CXX],
22412391620Smrg    [case " $depcc " in #(
22512391620Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
22612391620Smrg     esac])
22712391620Smrg
22821c2f794Smrg  for depmode in $am_compiler_list; do
22921c2f794Smrg    # Setup a source with many dependencies, because some compilers
23021c2f794Smrg    # like to wrap large dependency lists on column 80 (with \), and
23121c2f794Smrg    # we should not choose a depcomp mode which is confused by this.
23221c2f794Smrg    #
23321c2f794Smrg    # We need to recreate these files for each test, as the compiler may
23421c2f794Smrg    # overwrite some of them when testing with obscure command lines.
23521c2f794Smrg    # This happens at least with the AIX C compiler.
23621c2f794Smrg    : > sub/conftest.c
23721c2f794Smrg    for i in 1 2 3 4 5 6; do
23821c2f794Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
23921c2f794Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
24021c2f794Smrg      # Solaris 8's {/usr,}/bin/sh.
24121c2f794Smrg      touch sub/conftst$i.h
24221c2f794Smrg    done
24321c2f794Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
24421c2f794Smrg
24512391620Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
24612391620Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
24712391620Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
24812391620Smrg    # versions had trouble with output in subdirs
24912391620Smrg    am__obj=sub/conftest.${OBJEXT-o}
25012391620Smrg    am__minus_obj="-o $am__obj"
25121c2f794Smrg    case $depmode in
25212391620Smrg    gcc)
25312391620Smrg      # This depmode causes a compiler race in universal mode.
25412391620Smrg      test "$am__universal" = false || continue
25512391620Smrg      ;;
25621c2f794Smrg    nosideeffect)
25721c2f794Smrg      # after this tag, mechanisms are not by side-effect, so they'll
25821c2f794Smrg      # only be used when explicitly requested
25921c2f794Smrg      if test "x$enable_dependency_tracking" = xyes; then
26021c2f794Smrg	continue
26121c2f794Smrg      else
26221c2f794Smrg	break
26321c2f794Smrg      fi
26421c2f794Smrg      ;;
26582e12b1bSmrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
26612391620Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
26712391620Smrg      # not run yet.  These depmodes are late enough in the game, and
26812391620Smrg      # so weak that their functioning should not be impacted.
26912391620Smrg      am__obj=conftest.${OBJEXT-o}
27012391620Smrg      am__minus_obj=
27112391620Smrg      ;;
27221c2f794Smrg    none) break ;;
27321c2f794Smrg    esac
27421c2f794Smrg    if depmode=$depmode \
27512391620Smrg       source=sub/conftest.c object=$am__obj \
27621c2f794Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
27712391620Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
27821c2f794Smrg         >/dev/null 2>conftest.err &&
27921c2f794Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
28021c2f794Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
28112391620Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
28221c2f794Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
28321c2f794Smrg      # icc doesn't choke on unknown options, it will just issue warnings
28421c2f794Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
28521c2f794Smrg      # that says an option was ignored or not supported.
28621c2f794Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
28721c2f794Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
28821c2f794Smrg      # The diagnosis changed in icc 8.0:
28921c2f794Smrg      #   icc: Command line remark: option '-MP' not supported
29021c2f794Smrg      if (grep 'ignoring option' conftest.err ||
29121c2f794Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
29221c2f794Smrg        am_cv_$1_dependencies_compiler_type=$depmode
29321c2f794Smrg        break
29421c2f794Smrg      fi
29521c2f794Smrg    fi
29621c2f794Smrg  done
29721c2f794Smrg
29821c2f794Smrg  cd ..
29921c2f794Smrg  rm -rf conftest.dir
30021c2f794Smrgelse
30121c2f794Smrg  am_cv_$1_dependencies_compiler_type=none
30221c2f794Smrgfi
30321c2f794Smrg])
30421c2f794SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
30521c2f794SmrgAM_CONDITIONAL([am__fastdep$1], [
30621c2f794Smrg  test "x$enable_dependency_tracking" != xno \
30721c2f794Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
30821c2f794Smrg])
30921c2f794Smrg
31021c2f794Smrg
31121c2f794Smrg# AM_SET_DEPDIR
31221c2f794Smrg# -------------
31321c2f794Smrg# Choose a directory name for dependency files.
31421c2f794Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
31521c2f794SmrgAC_DEFUN([AM_SET_DEPDIR],
31621c2f794Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
31721c2f794SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
31821c2f794Smrg])
31921c2f794Smrg
32021c2f794Smrg
32121c2f794Smrg# AM_DEP_TRACK
32221c2f794Smrg# ------------
32321c2f794SmrgAC_DEFUN([AM_DEP_TRACK],
32421c2f794Smrg[AC_ARG_ENABLE(dependency-tracking,
32521c2f794Smrg[  --disable-dependency-tracking  speeds up one-time build
32621c2f794Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
32721c2f794Smrgif test "x$enable_dependency_tracking" != xno; then
32821c2f794Smrg  am_depcomp="$ac_aux_dir/depcomp"
32921c2f794Smrg  AMDEPBACKSLASH='\'
33082e12b1bSmrg  am__nodep='_no'
33121c2f794Smrgfi
33221c2f794SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
33321c2f794SmrgAC_SUBST([AMDEPBACKSLASH])dnl
33421c2f794Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
33582e12b1bSmrgAC_SUBST([am__nodep])dnl
33682e12b1bSmrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33721c2f794Smrg])
33821c2f794Smrg
33921c2f794Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
34021c2f794Smrg
34112391620Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
34221c2f794Smrg# Free Software Foundation, Inc.
34321c2f794Smrg#
34421c2f794Smrg# This file is free software; the Free Software Foundation
34521c2f794Smrg# gives unlimited permission to copy and/or distribute it,
34621c2f794Smrg# with or without modifications, as long as this notice is preserved.
34721c2f794Smrg
34812391620Smrg#serial 5
34921c2f794Smrg
35021c2f794Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
35121c2f794Smrg# ------------------------------
35221c2f794SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
35312391620Smrg[{
35412391620Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
35512391620Smrg  # are listed without --file.  Let's play safe and only enable the eval
35612391620Smrg  # if we detect the quoting.
35712391620Smrg  case $CONFIG_FILES in
35812391620Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
35912391620Smrg  *)   set x $CONFIG_FILES ;;
36012391620Smrg  esac
36112391620Smrg  shift
36212391620Smrg  for mf
36312391620Smrg  do
36412391620Smrg    # Strip MF so we end up with the name of the file.
36512391620Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
36612391620Smrg    # Check whether this is an Automake generated Makefile or not.
36712391620Smrg    # We used to match only the files named `Makefile.in', but
36812391620Smrg    # some people rename them; so instead we look at the file content.
36912391620Smrg    # Grep'ing the first line is not enough: some people post-process
37012391620Smrg    # each Makefile.in and add a new line on top of each file to say so.
37112391620Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
37212391620Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
37312391620Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
37412391620Smrg      dirpart=`AS_DIRNAME("$mf")`
37512391620Smrg    else
37612391620Smrg      continue
37712391620Smrg    fi
37812391620Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
37912391620Smrg    # from the Makefile without running `make'.
38012391620Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
38112391620Smrg    test -z "$DEPDIR" && continue
38212391620Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
38312391620Smrg    test -z "am__include" && continue
38412391620Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
38512391620Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
38612391620Smrg    U=`sed -n 's/^U = //p' < "$mf"`
38712391620Smrg    # Find all dependency output files, they are included files with
38812391620Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
38912391620Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
39012391620Smrg    # expansion.
39112391620Smrg    for file in `sed -n "
39212391620Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
39312391620Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
39412391620Smrg      # Make sure the directory exists.
39512391620Smrg      test -f "$dirpart/$file" && continue
39612391620Smrg      fdir=`AS_DIRNAME(["$file"])`
39712391620Smrg      AS_MKDIR_P([$dirpart/$fdir])
39812391620Smrg      # echo "creating $dirpart/$file"
39912391620Smrg      echo '# dummy' > "$dirpart/$file"
40012391620Smrg    done
40121c2f794Smrg  done
40212391620Smrg}
40321c2f794Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
40421c2f794Smrg
40521c2f794Smrg
40621c2f794Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
40721c2f794Smrg# -----------------------------
40821c2f794Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
40921c2f794Smrg#
41021c2f794Smrg# This code is only required when automatic dependency tracking
41121c2f794Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
41221c2f794Smrg# need in order to bootstrap the dependency handling code.
41321c2f794SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
41421c2f794Smrg[AC_CONFIG_COMMANDS([depfiles],
41521c2f794Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
41621c2f794Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
41721c2f794Smrg])
41821c2f794Smrg
41921c2f794Smrg# Do all the work for Automake.                             -*- Autoconf -*-
42021c2f794Smrg
42121c2f794Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
42212391620Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
42321c2f794Smrg#
42421c2f794Smrg# This file is free software; the Free Software Foundation
42521c2f794Smrg# gives unlimited permission to copy and/or distribute it,
42621c2f794Smrg# with or without modifications, as long as this notice is preserved.
42721c2f794Smrg
42812391620Smrg# serial 16
42921c2f794Smrg
43021c2f794Smrg# This macro actually does too much.  Some checks are only needed if
43121c2f794Smrg# your package does certain things.  But this isn't really a big deal.
43221c2f794Smrg
43321c2f794Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
43421c2f794Smrg# AM_INIT_AUTOMAKE([OPTIONS])
43521c2f794Smrg# -----------------------------------------------
43621c2f794Smrg# The call with PACKAGE and VERSION arguments is the old style
43721c2f794Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
43821c2f794Smrg# and VERSION should now be passed to AC_INIT and removed from
43921c2f794Smrg# the call to AM_INIT_AUTOMAKE.
44021c2f794Smrg# We support both call styles for the transition.  After
44121c2f794Smrg# the next Automake release, Autoconf can make the AC_INIT
44221c2f794Smrg# arguments mandatory, and then we can depend on a new Autoconf
44321c2f794Smrg# release and drop the old call support.
44421c2f794SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
44512391620Smrg[AC_PREREQ([2.62])dnl
44621c2f794Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
44721c2f794Smrgdnl the ones we care about.
44821c2f794Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
44921c2f794SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
45021c2f794SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
45121c2f794Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
45221c2f794Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
45321c2f794Smrg  # is not polluted with repeated "-I."
45421c2f794Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
45521c2f794Smrg  # test to see if srcdir already configured
45621c2f794Smrg  if test -f $srcdir/config.status; then
45721c2f794Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
45821c2f794Smrg  fi
45921c2f794Smrgfi
46021c2f794Smrg
46121c2f794Smrg# test whether we have cygpath
46221c2f794Smrgif test -z "$CYGPATH_W"; then
46321c2f794Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
46421c2f794Smrg    CYGPATH_W='cygpath -w'
46521c2f794Smrg  else
46621c2f794Smrg    CYGPATH_W=echo
46721c2f794Smrg  fi
46821c2f794Smrgfi
46921c2f794SmrgAC_SUBST([CYGPATH_W])
47021c2f794Smrg
47121c2f794Smrg# Define the identity of the package.
47221c2f794Smrgdnl Distinguish between old-style and new-style calls.
47321c2f794Smrgm4_ifval([$2],
47421c2f794Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
47521c2f794Smrg AC_SUBST([PACKAGE], [$1])dnl
47621c2f794Smrg AC_SUBST([VERSION], [$2])],
47721c2f794Smrg[_AM_SET_OPTIONS([$1])dnl
47821c2f794Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47921c2f794Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
48021c2f794Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
48121c2f794Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
48221c2f794Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
48321c2f794Smrg
48421c2f794Smrg_AM_IF_OPTION([no-define],,
48521c2f794Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
48621c2f794Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
48721c2f794Smrg
48821c2f794Smrg# Some tools Automake needs.
48921c2f794SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
49021c2f794SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
49121c2f794SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
49221c2f794SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
49321c2f794SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
49421c2f794SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
49521c2f794SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
49612391620SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49712391620SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49821c2f794SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
49921c2f794Smrg# We need awk for the "check" target.  The system "awk" is bad on
50021c2f794Smrg# some platforms.
50121c2f794SmrgAC_REQUIRE([AC_PROG_AWK])dnl
50221c2f794SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50321c2f794SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50421c2f794Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50512391620Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50612391620Smrg			     [_AM_PROG_TAR([v7])])])
50721c2f794Smrg_AM_IF_OPTION([no-dependencies],,
50821c2f794Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50912391620Smrg		  [_AM_DEPENDENCIES(CC)],
51012391620Smrg		  [define([AC_PROG_CC],
51112391620Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
51221c2f794SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51312391620Smrg		  [_AM_DEPENDENCIES(CXX)],
51412391620Smrg		  [define([AC_PROG_CXX],
51512391620Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
51621c2f794SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51712391620Smrg		  [_AM_DEPENDENCIES(OBJC)],
51812391620Smrg		  [define([AC_PROG_OBJC],
51912391620Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
52021c2f794Smrg])
52112391620Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
52212391620Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
52312391620Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
52412391620Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
52512391620SmrgAC_CONFIG_COMMANDS_PRE(dnl
52612391620Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
52712391620Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
52821c2f794Smrg])
52921c2f794Smrg
53012391620Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
53112391620Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
53212391620Smrgdnl mangled by Autoconf and run in a shell conditional statement.
53312391620Smrgm4_define([_AC_COMPILER_EXEEXT],
53412391620Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
53512391620Smrg
53621c2f794Smrg
53721c2f794Smrg# When config.status generates a header, we must update the stamp-h file.
53821c2f794Smrg# This file resides in the same directory as the config header
53921c2f794Smrg# that is generated.  The stamp files are numbered to have different names.
54021c2f794Smrg
54121c2f794Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
54221c2f794Smrg# loop where config.status creates the headers, so we can generate
54321c2f794Smrg# our stamp files there.
54421c2f794SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
54521c2f794Smrg[# Compute $1's index in $config_headers.
54612391620Smrg_am_arg=$1
54721c2f794Smrg_am_stamp_count=1
54821c2f794Smrgfor _am_header in $config_headers :; do
54921c2f794Smrg  case $_am_header in
55012391620Smrg    $_am_arg | $_am_arg:* )
55121c2f794Smrg      break ;;
55221c2f794Smrg    * )
55321c2f794Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
55421c2f794Smrg  esac
55521c2f794Smrgdone
55612391620Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
55721c2f794Smrg
55882e12b1bSmrg# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
55982e12b1bSmrg# Inc.
56021c2f794Smrg#
56121c2f794Smrg# This file is free software; the Free Software Foundation
56221c2f794Smrg# gives unlimited permission to copy and/or distribute it,
56321c2f794Smrg# with or without modifications, as long as this notice is preserved.
56421c2f794Smrg
56582e12b1bSmrg# serial 1
56682e12b1bSmrg
56721c2f794Smrg# AM_PROG_INSTALL_SH
56821c2f794Smrg# ------------------
56921c2f794Smrg# Define $install_sh.
57021c2f794SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
57121c2f794Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
57212391620Smrgif test x"${install_sh}" != xset; then
57312391620Smrg  case $am_aux_dir in
57412391620Smrg  *\ * | *\	*)
57512391620Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
57612391620Smrg  *)
57712391620Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
57812391620Smrg  esac
57912391620Smrgfi
58021c2f794SmrgAC_SUBST(install_sh)])
58121c2f794Smrg
58221c2f794Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
58321c2f794Smrg#
58421c2f794Smrg# This file is free software; the Free Software Foundation
58521c2f794Smrg# gives unlimited permission to copy and/or distribute it,
58621c2f794Smrg# with or without modifications, as long as this notice is preserved.
58721c2f794Smrg
58821c2f794Smrg# serial 2
58921c2f794Smrg
59021c2f794Smrg# Check whether the underlying file-system supports filenames
59121c2f794Smrg# with a leading dot.  For instance MS-DOS doesn't.
59221c2f794SmrgAC_DEFUN([AM_SET_LEADING_DOT],
59321c2f794Smrg[rm -rf .tst 2>/dev/null
59421c2f794Smrgmkdir .tst 2>/dev/null
59521c2f794Smrgif test -d .tst; then
59621c2f794Smrg  am__leading_dot=.
59721c2f794Smrgelse
59821c2f794Smrg  am__leading_dot=_
59921c2f794Smrgfi
60021c2f794Smrgrmdir .tst 2>/dev/null
60121c2f794SmrgAC_SUBST([am__leading_dot])])
60221c2f794Smrg
60321c2f794Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
60421c2f794Smrg# From Jim Meyering
60521c2f794Smrg
60682e12b1bSmrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
60782e12b1bSmrg# 2011 Free Software Foundation, Inc.
60821c2f794Smrg#
60921c2f794Smrg# This file is free software; the Free Software Foundation
61021c2f794Smrg# gives unlimited permission to copy and/or distribute it,
61121c2f794Smrg# with or without modifications, as long as this notice is preserved.
61221c2f794Smrg
61312391620Smrg# serial 5
61421c2f794Smrg
61512391620Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
61612391620Smrg# ----------------------------------
61712391620Smrg# Control maintainer-specific portions of Makefiles.
61812391620Smrg# Default is to disable them, unless `enable' is passed literally.
61912391620Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
62012391620Smrg# can override the default with the --enable/--disable switch.
62121c2f794SmrgAC_DEFUN([AM_MAINTAINER_MODE],
62212391620Smrg[m4_case(m4_default([$1], [disable]),
62312391620Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
62412391620Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
62512391620Smrg       [m4_define([am_maintainer_other], [enable])
62612391620Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
62782e12b1bSmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
62812391620Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
62912391620Smrg  AC_ARG_ENABLE([maintainer-mode],
63012391620Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
63121c2f794Smrg			  (and sometimes confusing) to the casual installer],
63212391620Smrg      [USE_MAINTAINER_MODE=$enableval],
63312391620Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
63421c2f794Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
63512391620Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
63621c2f794Smrg  MAINT=$MAINTAINER_MODE_TRUE
63712391620Smrg  AC_SUBST([MAINT])dnl
63821c2f794Smrg]
63921c2f794Smrg)
64021c2f794Smrg
64121c2f794SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
64221c2f794Smrg
64321c2f794Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
64421c2f794Smrg
64512391620Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
64621c2f794Smrg#
64721c2f794Smrg# This file is free software; the Free Software Foundation
64821c2f794Smrg# gives unlimited permission to copy and/or distribute it,
64921c2f794Smrg# with or without modifications, as long as this notice is preserved.
65021c2f794Smrg
65112391620Smrg# serial 4
65221c2f794Smrg
65321c2f794Smrg# AM_MAKE_INCLUDE()
65421c2f794Smrg# -----------------
65521c2f794Smrg# Check to see how make treats includes.
65621c2f794SmrgAC_DEFUN([AM_MAKE_INCLUDE],
65721c2f794Smrg[am_make=${MAKE-make}
65821c2f794Smrgcat > confinc << 'END'
65921c2f794Smrgam__doit:
66012391620Smrg	@echo this is the am__doit target
66121c2f794Smrg.PHONY: am__doit
66221c2f794SmrgEND
66321c2f794Smrg# If we don't find an include directive, just comment out the code.
66421c2f794SmrgAC_MSG_CHECKING([for style of include used by $am_make])
66521c2f794Smrgam__include="#"
66621c2f794Smrgam__quote=
66721c2f794Smrg_am_result=none
66821c2f794Smrg# First try GNU make style include.
66921c2f794Smrgecho "include confinc" > confmf
67012391620Smrg# Ignore all kinds of additional output from `make'.
67112391620Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
67212391620Smrg*the\ am__doit\ target*)
67312391620Smrg  am__include=include
67412391620Smrg  am__quote=
67512391620Smrg  _am_result=GNU
67612391620Smrg  ;;
67712391620Smrgesac
67821c2f794Smrg# Now try BSD make style include.
67921c2f794Smrgif test "$am__include" = "#"; then
68021c2f794Smrg   echo '.include "confinc"' > confmf
68112391620Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
68212391620Smrg   *the\ am__doit\ target*)
68312391620Smrg     am__include=.include
68412391620Smrg     am__quote="\""
68512391620Smrg     _am_result=BSD
68612391620Smrg     ;;
68712391620Smrg   esac
68821c2f794Smrgfi
68921c2f794SmrgAC_SUBST([am__include])
69021c2f794SmrgAC_SUBST([am__quote])
69121c2f794SmrgAC_MSG_RESULT([$_am_result])
69221c2f794Smrgrm -f confinc confmf
69321c2f794Smrg])
69421c2f794Smrg
69521c2f794Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
69621c2f794Smrg
69712391620Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
69821c2f794Smrg# Free Software Foundation, Inc.
69921c2f794Smrg#
70021c2f794Smrg# This file is free software; the Free Software Foundation
70121c2f794Smrg# gives unlimited permission to copy and/or distribute it,
70221c2f794Smrg# with or without modifications, as long as this notice is preserved.
70321c2f794Smrg
70412391620Smrg# serial 6
70521c2f794Smrg
70621c2f794Smrg# AM_MISSING_PROG(NAME, PROGRAM)
70721c2f794Smrg# ------------------------------
70821c2f794SmrgAC_DEFUN([AM_MISSING_PROG],
70921c2f794Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71021c2f794Smrg$1=${$1-"${am_missing_run}$2"}
71121c2f794SmrgAC_SUBST($1)])
71221c2f794Smrg
71321c2f794Smrg
71421c2f794Smrg# AM_MISSING_HAS_RUN
71521c2f794Smrg# ------------------
71621c2f794Smrg# Define MISSING if not defined so far and test if it supports --run.
71721c2f794Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
71821c2f794SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
71921c2f794Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
72021c2f794SmrgAC_REQUIRE_AUX_FILE([missing])dnl
72112391620Smrgif test x"${MISSING+set}" != xset; then
72212391620Smrg  case $am_aux_dir in
72312391620Smrg  *\ * | *\	*)
72412391620Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
72512391620Smrg  *)
72612391620Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
72712391620Smrg  esac
72812391620Smrgfi
72921c2f794Smrg# Use eval to expand $SHELL
73021c2f794Smrgif eval "$MISSING --run true"; then
73121c2f794Smrg  am_missing_run="$MISSING --run "
73221c2f794Smrgelse
73321c2f794Smrg  am_missing_run=
73421c2f794Smrg  AC_MSG_WARN([`missing' script is too old or missing])
73521c2f794Smrgfi
73621c2f794Smrg])
73721c2f794Smrg
73882e12b1bSmrg# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
73982e12b1bSmrg# Inc.
74021c2f794Smrg#
74121c2f794Smrg# This file is free software; the Free Software Foundation
74221c2f794Smrg# gives unlimited permission to copy and/or distribute it,
74321c2f794Smrg# with or without modifications, as long as this notice is preserved.
74421c2f794Smrg
74582e12b1bSmrg# serial 1
74682e12b1bSmrg
74721c2f794Smrg# AM_PROG_MKDIR_P
74821c2f794Smrg# ---------------
74921c2f794Smrg# Check for `mkdir -p'.
75021c2f794SmrgAC_DEFUN([AM_PROG_MKDIR_P],
75121c2f794Smrg[AC_PREREQ([2.60])dnl
75221c2f794SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
75321c2f794Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
75421c2f794Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
75521c2f794Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
75621c2f794Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
75721c2f794Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
75821c2f794Smrgdnl adjustment using top_builddir (which is defined more often than
75921c2f794Smrgdnl MKDIR_P).
76021c2f794SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
76121c2f794Smrgcase $mkdir_p in
76221c2f794Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
76321c2f794Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
76421c2f794Smrgesac
76521c2f794Smrg])
76621c2f794Smrg
76721c2f794Smrg# Helper functions for option handling.                     -*- Autoconf -*-
76821c2f794Smrg
76982e12b1bSmrg# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
77082e12b1bSmrg# Foundation, Inc.
77121c2f794Smrg#
77221c2f794Smrg# This file is free software; the Free Software Foundation
77321c2f794Smrg# gives unlimited permission to copy and/or distribute it,
77421c2f794Smrg# with or without modifications, as long as this notice is preserved.
77521c2f794Smrg
77682e12b1bSmrg# serial 5
77721c2f794Smrg
77821c2f794Smrg# _AM_MANGLE_OPTION(NAME)
77921c2f794Smrg# -----------------------
78021c2f794SmrgAC_DEFUN([_AM_MANGLE_OPTION],
78121c2f794Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
78221c2f794Smrg
78321c2f794Smrg# _AM_SET_OPTION(NAME)
78482e12b1bSmrg# --------------------
78521c2f794Smrg# Set option NAME.  Presently that only means defining a flag for this option.
78621c2f794SmrgAC_DEFUN([_AM_SET_OPTION],
78721c2f794Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
78821c2f794Smrg
78921c2f794Smrg# _AM_SET_OPTIONS(OPTIONS)
79082e12b1bSmrg# ------------------------
79121c2f794Smrg# OPTIONS is a space-separated list of Automake options.
79221c2f794SmrgAC_DEFUN([_AM_SET_OPTIONS],
79312391620Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
79421c2f794Smrg
79521c2f794Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
79621c2f794Smrg# -------------------------------------------
79721c2f794Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
79821c2f794SmrgAC_DEFUN([_AM_IF_OPTION],
79921c2f794Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
80021c2f794Smrg
80121c2f794Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
80221c2f794Smrg
80312391620Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
80421c2f794Smrg# Free Software Foundation, Inc.
80521c2f794Smrg#
80621c2f794Smrg# This file is free software; the Free Software Foundation
80721c2f794Smrg# gives unlimited permission to copy and/or distribute it,
80821c2f794Smrg# with or without modifications, as long as this notice is preserved.
80921c2f794Smrg
81012391620Smrg# serial 5
81121c2f794Smrg
81221c2f794Smrg# AM_SANITY_CHECK
81321c2f794Smrg# ---------------
81421c2f794SmrgAC_DEFUN([AM_SANITY_CHECK],
81521c2f794Smrg[AC_MSG_CHECKING([whether build environment is sane])
81621c2f794Smrg# Just in case
81721c2f794Smrgsleep 1
81821c2f794Smrgecho timestamp > conftest.file
81912391620Smrg# Reject unsafe characters in $srcdir or the absolute working directory
82012391620Smrg# name.  Accept space and tab only in the latter.
82112391620Smrgam_lf='
82212391620Smrg'
82312391620Smrgcase `pwd` in
82412391620Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
82512391620Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
82612391620Smrgesac
82712391620Smrgcase $srcdir in
82812391620Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
82912391620Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
83012391620Smrgesac
83112391620Smrg
83221c2f794Smrg# Do `set' in a subshell so we don't clobber the current shell's
83321c2f794Smrg# arguments.  Must try -L first in case configure is actually a
83421c2f794Smrg# symlink; some systems play weird games with the mod time of symlinks
83521c2f794Smrg# (eg FreeBSD returns the mod time of the symlink's containing
83621c2f794Smrg# directory).
83721c2f794Smrgif (
83812391620Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
83921c2f794Smrg   if test "$[*]" = "X"; then
84021c2f794Smrg      # -L didn't work.
84112391620Smrg      set X `ls -t "$srcdir/configure" conftest.file`
84221c2f794Smrg   fi
84321c2f794Smrg   rm -f conftest.file
84421c2f794Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
84521c2f794Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
84621c2f794Smrg
84721c2f794Smrg      # If neither matched, then we have a broken ls.  This can happen
84821c2f794Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
84921c2f794Smrg      # broken ls alias from the environment.  This has actually
85021c2f794Smrg      # happened.  Such a system could not be considered "sane".
85121c2f794Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
85221c2f794Smrgalias in your environment])
85321c2f794Smrg   fi
85421c2f794Smrg
85521c2f794Smrg   test "$[2]" = conftest.file
85621c2f794Smrg   )
85721c2f794Smrgthen
85821c2f794Smrg   # Ok.
85921c2f794Smrg   :
86021c2f794Smrgelse
86121c2f794Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
86221c2f794SmrgCheck your system clock])
86321c2f794Smrgfi
86421c2f794SmrgAC_MSG_RESULT(yes)])
86521c2f794Smrg
86612391620Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
86712391620Smrg#
86812391620Smrg# This file is free software; the Free Software Foundation
86912391620Smrg# gives unlimited permission to copy and/or distribute it,
87012391620Smrg# with or without modifications, as long as this notice is preserved.
87112391620Smrg
87212391620Smrg# serial 1
87312391620Smrg
87412391620Smrg# AM_SILENT_RULES([DEFAULT])
87512391620Smrg# --------------------------
87612391620Smrg# Enable less verbose build rules; with the default set to DEFAULT
87712391620Smrg# (`yes' being less verbose, `no' or empty being verbose).
87812391620SmrgAC_DEFUN([AM_SILENT_RULES],
87912391620Smrg[AC_ARG_ENABLE([silent-rules],
88012391620Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
88112391620Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
88212391620Smrgcase $enable_silent_rules in
88312391620Smrgyes) AM_DEFAULT_VERBOSITY=0;;
88412391620Smrgno)  AM_DEFAULT_VERBOSITY=1;;
88512391620Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
88612391620Smrgesac
88712391620SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
88812391620SmrgAM_BACKSLASH='\'
88912391620SmrgAC_SUBST([AM_BACKSLASH])dnl
89012391620Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
89112391620Smrg])
89212391620Smrg
89382e12b1bSmrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
89421c2f794Smrg#
89521c2f794Smrg# This file is free software; the Free Software Foundation
89621c2f794Smrg# gives unlimited permission to copy and/or distribute it,
89721c2f794Smrg# with or without modifications, as long as this notice is preserved.
89821c2f794Smrg
89982e12b1bSmrg# serial 1
90082e12b1bSmrg
90121c2f794Smrg# AM_PROG_INSTALL_STRIP
90221c2f794Smrg# ---------------------
90321c2f794Smrg# One issue with vendor `install' (even GNU) is that you can't
90421c2f794Smrg# specify the program used to strip binaries.  This is especially
90521c2f794Smrg# annoying in cross-compiling environments, where the build's strip
90621c2f794Smrg# is unlikely to handle the host's binaries.
90721c2f794Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
90821c2f794Smrg# always use install-sh in `make install-strip', and initialize
90921c2f794Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
91021c2f794SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
91121c2f794Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
91221c2f794Smrg# Installed binaries are usually stripped using `strip' when the user
91321c2f794Smrg# run `make install-strip'.  However `strip' might not be the right
91421c2f794Smrg# tool to use in cross-compilation environments, therefore Automake
91521c2f794Smrg# will honor the `STRIP' environment variable to overrule this program.
91621c2f794Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
91721c2f794Smrgif test "$cross_compiling" != no; then
91821c2f794Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
91921c2f794Smrgfi
92021c2f794SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
92121c2f794SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
92221c2f794Smrg
92382e12b1bSmrg# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
92421c2f794Smrg#
92521c2f794Smrg# This file is free software; the Free Software Foundation
92621c2f794Smrg# gives unlimited permission to copy and/or distribute it,
92721c2f794Smrg# with or without modifications, as long as this notice is preserved.
92821c2f794Smrg
92982e12b1bSmrg# serial 3
93012391620Smrg
93121c2f794Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
93221c2f794Smrg# ---------------------------
93312391620Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
93421c2f794Smrg# This macro is traced by Automake.
93521c2f794SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
93621c2f794Smrg
93712391620Smrg# AM_SUBST_NOTMAKE(VARIABLE)
93882e12b1bSmrg# --------------------------
93912391620Smrg# Public sister of _AM_SUBST_NOTMAKE.
94012391620SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
94112391620Smrg
94221c2f794Smrg# Check how to create a tarball.                            -*- Autoconf -*-
94321c2f794Smrg
94421c2f794Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
94521c2f794Smrg#
94621c2f794Smrg# This file is free software; the Free Software Foundation
94721c2f794Smrg# gives unlimited permission to copy and/or distribute it,
94821c2f794Smrg# with or without modifications, as long as this notice is preserved.
94921c2f794Smrg
95021c2f794Smrg# serial 2
95121c2f794Smrg
95221c2f794Smrg# _AM_PROG_TAR(FORMAT)
95321c2f794Smrg# --------------------
95421c2f794Smrg# Check how to create a tarball in format FORMAT.
95521c2f794Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
95621c2f794Smrg#
95721c2f794Smrg# Substitute a variable $(am__tar) that is a command
95821c2f794Smrg# writing to stdout a FORMAT-tarball containing the directory
95921c2f794Smrg# $tardir.
96021c2f794Smrg#     tardir=directory && $(am__tar) > result.tar
96121c2f794Smrg#
96221c2f794Smrg# Substitute a variable $(am__untar) that extract such
96321c2f794Smrg# a tarball read from stdin.
96421c2f794Smrg#     $(am__untar) < result.tar
96521c2f794SmrgAC_DEFUN([_AM_PROG_TAR],
96621c2f794Smrg[# Always define AMTAR for backward compatibility.
96721c2f794SmrgAM_MISSING_PROG([AMTAR], [tar])
96821c2f794Smrgm4_if([$1], [v7],
96921c2f794Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
97021c2f794Smrg     [m4_case([$1], [ustar],, [pax],,
97121c2f794Smrg              [m4_fatal([Unknown tar format])])
97221c2f794SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
97321c2f794Smrg# Loop over all known methods to create a tar archive until one works.
97421c2f794Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
97521c2f794Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
97621c2f794Smrg# Do not fold the above two line into one, because Tru64 sh and
97721c2f794Smrg# Solaris sh will not grok spaces in the rhs of `-'.
97821c2f794Smrgfor _am_tool in $_am_tools
97921c2f794Smrgdo
98021c2f794Smrg  case $_am_tool in
98121c2f794Smrg  gnutar)
98221c2f794Smrg    for _am_tar in tar gnutar gtar;
98321c2f794Smrg    do
98421c2f794Smrg      AM_RUN_LOG([$_am_tar --version]) && break
98521c2f794Smrg    done
98621c2f794Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
98721c2f794Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
98821c2f794Smrg    am__untar="$_am_tar -xf -"
98921c2f794Smrg    ;;
99021c2f794Smrg  plaintar)
99121c2f794Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
99221c2f794Smrg    # ustar tarball either.
99321c2f794Smrg    (tar --version) >/dev/null 2>&1 && continue
99421c2f794Smrg    am__tar='tar chf - "$$tardir"'
99521c2f794Smrg    am__tar_='tar chf - "$tardir"'
99621c2f794Smrg    am__untar='tar xf -'
99721c2f794Smrg    ;;
99821c2f794Smrg  pax)
99921c2f794Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
100021c2f794Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
100121c2f794Smrg    am__untar='pax -r'
100221c2f794Smrg    ;;
100321c2f794Smrg  cpio)
100421c2f794Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
100521c2f794Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
100621c2f794Smrg    am__untar='cpio -i -H $1 -d'
100721c2f794Smrg    ;;
100821c2f794Smrg  none)
100921c2f794Smrg    am__tar=false
101021c2f794Smrg    am__tar_=false
101121c2f794Smrg    am__untar=false
101221c2f794Smrg    ;;
101321c2f794Smrg  esac
101421c2f794Smrg
101521c2f794Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
101621c2f794Smrg  # and am__untar set.
101721c2f794Smrg  test -n "${am_cv_prog_tar_$1}" && break
101821c2f794Smrg
101921c2f794Smrg  # tar/untar a dummy directory, and stop if the command works
102021c2f794Smrg  rm -rf conftest.dir
102121c2f794Smrg  mkdir conftest.dir
102221c2f794Smrg  echo GrepMe > conftest.dir/file
102321c2f794Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
102421c2f794Smrg  rm -rf conftest.dir
102521c2f794Smrg  if test -s conftest.tar; then
102621c2f794Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
102721c2f794Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
102821c2f794Smrg  fi
102921c2f794Smrgdone
103021c2f794Smrgrm -rf conftest.dir
103121c2f794Smrg
103221c2f794SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
103321c2f794SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
103421c2f794SmrgAC_SUBST([am__tar])
103521c2f794SmrgAC_SUBST([am__untar])
103621c2f794Smrg]) # _AM_PROG_TAR
103721c2f794Smrg
103882e12b1bSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
103982e12b1bSmrg# 
104082e12b1bSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
104182e12b1bSmrg#
104282e12b1bSmrg# This program is free software; you can redistribute it and/or modify
104382e12b1bSmrg# it under the terms of the GNU General Public License as published by
104482e12b1bSmrg# the Free Software Foundation; either version 2 of the License, or
104582e12b1bSmrg# (at your option) any later version.
104682e12b1bSmrg#
104782e12b1bSmrg# This program is distributed in the hope that it will be useful, but
104882e12b1bSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
104982e12b1bSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
105082e12b1bSmrg# General Public License for more details.
105182e12b1bSmrg#
105282e12b1bSmrg# You should have received a copy of the GNU General Public License
105382e12b1bSmrg# along with this program; if not, write to the Free Software
105482e12b1bSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
105582e12b1bSmrg#
105682e12b1bSmrg# As a special exception to the GNU General Public License, if you
105782e12b1bSmrg# distribute this file as part of a program that contains a
105882e12b1bSmrg# configuration script generated by Autoconf, you may include it under
105982e12b1bSmrg# the same distribution terms that you use for the rest of that program.
106082e12b1bSmrg
106182e12b1bSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
106282e12b1bSmrg# ----------------------------------
106382e12b1bSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
106482e12b1bSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
106582e12b1bSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
106682e12b1bSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
106782e12b1bSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
106882e12b1bSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
106982e12b1bSmrgfi
107082e12b1bSmrgif test -n "$PKG_CONFIG"; then
107182e12b1bSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
107282e12b1bSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
107382e12b1bSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
107482e12b1bSmrg		AC_MSG_RESULT([yes])
107582e12b1bSmrg	else
107682e12b1bSmrg		AC_MSG_RESULT([no])
107782e12b1bSmrg		PKG_CONFIG=""
107882e12b1bSmrg	fi
107982e12b1bSmrg		
108082e12b1bSmrgfi[]dnl
108182e12b1bSmrg])# PKG_PROG_PKG_CONFIG
108282e12b1bSmrg
108382e12b1bSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
108482e12b1bSmrg#
108582e12b1bSmrg# Check to see whether a particular set of modules exists.  Similar
108682e12b1bSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
108782e12b1bSmrg#
108882e12b1bSmrg#
108982e12b1bSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
109082e12b1bSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
109182e12b1bSmrg# PKG_CHECK_EXISTS manually
109282e12b1bSmrg# --------------------------------------------------------------
109382e12b1bSmrgAC_DEFUN([PKG_CHECK_EXISTS],
109482e12b1bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
109582e12b1bSmrgif test -n "$PKG_CONFIG" && \
109682e12b1bSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
109782e12b1bSmrg  m4_ifval([$2], [$2], [:])
109882e12b1bSmrgm4_ifvaln([$3], [else
109982e12b1bSmrg  $3])dnl
110082e12b1bSmrgfi])
110182e12b1bSmrg
110282e12b1bSmrg
110382e12b1bSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
110482e12b1bSmrg# ---------------------------------------------
110582e12b1bSmrgm4_define([_PKG_CONFIG],
110682e12b1bSmrg[if test -n "$$1"; then
110782e12b1bSmrg    pkg_cv_[]$1="$$1"
110882e12b1bSmrg elif test -n "$PKG_CONFIG"; then
110982e12b1bSmrg    PKG_CHECK_EXISTS([$3],
111082e12b1bSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
111182e12b1bSmrg		     [pkg_failed=yes])
111282e12b1bSmrg else
111382e12b1bSmrg    pkg_failed=untried
111482e12b1bSmrgfi[]dnl
111582e12b1bSmrg])# _PKG_CONFIG
111682e12b1bSmrg
111782e12b1bSmrg# _PKG_SHORT_ERRORS_SUPPORTED
111882e12b1bSmrg# -----------------------------
111982e12b1bSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
112082e12b1bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
112182e12b1bSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
112282e12b1bSmrg        _pkg_short_errors_supported=yes
112382e12b1bSmrgelse
112482e12b1bSmrg        _pkg_short_errors_supported=no
112582e12b1bSmrgfi[]dnl
112682e12b1bSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
112782e12b1bSmrg
112882e12b1bSmrg
112982e12b1bSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
113082e12b1bSmrg# [ACTION-IF-NOT-FOUND])
113182e12b1bSmrg#
113282e12b1bSmrg#
113382e12b1bSmrg# Note that if there is a possibility the first call to
113482e12b1bSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
113582e12b1bSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
113682e12b1bSmrg#
113782e12b1bSmrg#
113882e12b1bSmrg# --------------------------------------------------------------
113982e12b1bSmrgAC_DEFUN([PKG_CHECK_MODULES],
114082e12b1bSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
114182e12b1bSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
114282e12b1bSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
114382e12b1bSmrg
114482e12b1bSmrgpkg_failed=no
114582e12b1bSmrgAC_MSG_CHECKING([for $1])
114682e12b1bSmrg
114782e12b1bSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
114882e12b1bSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
114982e12b1bSmrg
115082e12b1bSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
115182e12b1bSmrgand $1[]_LIBS to avoid the need to call pkg-config.
115282e12b1bSmrgSee the pkg-config man page for more details.])
115382e12b1bSmrg
115482e12b1bSmrgif test $pkg_failed = yes; then
115582e12b1bSmrg        _PKG_SHORT_ERRORS_SUPPORTED
115682e12b1bSmrg        if test $_pkg_short_errors_supported = yes; then
115782e12b1bSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
115882e12b1bSmrg        else 
115982e12b1bSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
116082e12b1bSmrg        fi
116182e12b1bSmrg	# Put the nasty error message in config.log where it belongs
116282e12b1bSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
116382e12b1bSmrg
116482e12b1bSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
116582e12b1bSmrg[Package requirements ($2) were not met:
116682e12b1bSmrg
116782e12b1bSmrg$$1_PKG_ERRORS
116882e12b1bSmrg
116982e12b1bSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
117082e12b1bSmrginstalled software in a non-standard prefix.
117182e12b1bSmrg
117282e12b1bSmrg_PKG_TEXT
117382e12b1bSmrg])],
117482e12b1bSmrg		[AC_MSG_RESULT([no])
117582e12b1bSmrg                $4])
117682e12b1bSmrgelif test $pkg_failed = untried; then
117782e12b1bSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
117882e12b1bSmrg[The pkg-config script could not be found or is too old.  Make sure it
117982e12b1bSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
118082e12b1bSmrgpath to pkg-config.
118182e12b1bSmrg
118282e12b1bSmrg_PKG_TEXT
118382e12b1bSmrg
118482e12b1bSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
118582e12b1bSmrg		[$4])
118682e12b1bSmrgelse
118782e12b1bSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
118882e12b1bSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
118982e12b1bSmrg        AC_MSG_RESULT([yes])
119082e12b1bSmrg	ifelse([$3], , :, [$3])
119182e12b1bSmrgfi[]dnl
119282e12b1bSmrg])# PKG_CHECK_MODULES
119382e12b1bSmrg
119412391620Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
119521c2f794Smrgdnl
119612391620Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
119721c2f794Smrgdnl 
119821c2f794Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
119912391620Smrgdnl copy of this software and associated documentation files (the "Software"),
120012391620Smrgdnl to deal in the Software without restriction, including without limitation
120112391620Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
120212391620Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
120312391620Smrgdnl Software is furnished to do so, subject to the following conditions:
120421c2f794Smrgdnl
120512391620Smrgdnl The above copyright notice and this permission notice (including the next
120612391620Smrgdnl paragraph) shall be included in all copies or substantial portions of the
120712391620Smrgdnl Software.
120821c2f794Smrgdnl
120912391620Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
121012391620Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
121112391620Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
121212391620Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
121312391620Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
121412391620Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
121512391620Smrgdnl DEALINGS IN THE SOFTWARE.
121621c2f794Smrg
121721c2f794Smrg# XORG_MACROS_VERSION(required-version)
121821c2f794Smrg# -------------------------------------
121921c2f794Smrg# Minimum version: 1.1.0
122021c2f794Smrg#
122121c2f794Smrg# If you're using a macro added in Version 1.1 or newer, include this in
122221c2f794Smrg# your configure.ac with the minimum required version, such as:
122321c2f794Smrg# XORG_MACROS_VERSION(1.1)
122421c2f794Smrg#
122512391620Smrg# To ensure that this macro is defined, also add:
122612391620Smrg# m4_ifndef([XORG_MACROS_VERSION],
122712391620Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
122821c2f794Smrg#
122921c2f794Smrg#
123021c2f794Smrg# See the "minimum version" comment for each macro you use to see what 
123121c2f794Smrg# version you require.
123212391620Smrgm4_defun([XORG_MACROS_VERSION],[
123382e12b1bSmrgm4_define([vers_have], [1.17])
123412391620Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
123512391620Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
123612391620Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
123712391620Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
123812391620Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
123912391620Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
124012391620Smrgm4_undefine([vers_have])
124112391620Smrgm4_undefine([maj_have])
124212391620Smrgm4_undefine([maj_needed])
124321c2f794Smrg]) # XORG_MACROS_VERSION
124421c2f794Smrg
124521c2f794Smrg# XORG_PROG_RAWCPP()
124621c2f794Smrg# ------------------
124721c2f794Smrg# Minimum version: 1.0.0
124821c2f794Smrg#
124921c2f794Smrg# Find cpp program and necessary flags for use in pre-processing text files
125021c2f794Smrg# such as man pages and config files
125121c2f794SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
125221c2f794SmrgAC_REQUIRE([AC_PROG_CPP])
125321c2f794SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
125421c2f794Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
125521c2f794Smrg
125621c2f794Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
125721c2f794Smrg# which is not the best choice for supporting other OS'es, but covers most
125821c2f794Smrg# of the ones we need for now.
125921c2f794SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
126082e12b1bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
126121c2f794Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
126221c2f794Smrg	AC_MSG_RESULT([no])
126321c2f794Smrgelse
126421c2f794Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
126521c2f794Smrg		RAWCPPFLAGS=-undef
126621c2f794Smrg		AC_MSG_RESULT([yes])
126712391620Smrg	# under Cygwin unix is still defined even with -undef
126812391620Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
126912391620Smrg		RAWCPPFLAGS="-undef -ansi"
127012391620Smrg		AC_MSG_RESULT([yes, with -ansi])
127121c2f794Smrg	else
127221c2f794Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
127321c2f794Smrg	fi
127421c2f794Smrgfi
127521c2f794Smrgrm -f conftest.$ac_ext
127621c2f794Smrg
127721c2f794SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
127882e12b1bSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
127921c2f794Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
128021c2f794Smrg	AC_MSG_RESULT([no])
128121c2f794Smrgelse
128221c2f794Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
128321c2f794Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
128421c2f794Smrg		AC_MSG_RESULT([yes])
128521c2f794Smrg	else
128621c2f794Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
128721c2f794Smrg	fi
128821c2f794Smrgfi
128921c2f794Smrgrm -f conftest.$ac_ext
129021c2f794SmrgAC_SUBST(RAWCPPFLAGS)
129121c2f794Smrg]) # XORG_PROG_RAWCPP
129221c2f794Smrg
129321c2f794Smrg# XORG_MANPAGE_SECTIONS()
129421c2f794Smrg# -----------------------
129521c2f794Smrg# Minimum version: 1.0.0
129621c2f794Smrg#
129721c2f794Smrg# Determine which sections man pages go in for the different man page types
129821c2f794Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
129921c2f794Smrg# Not sure if there's any better way than just hardcoding by OS name.
130021c2f794Smrg# Override default settings by setting environment variables
130112391620Smrg# Added MAN_SUBSTS in version 1.8
130212391620Smrg# Added AC_PROG_SED in version 1.8
130321c2f794Smrg
130421c2f794SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
130521c2f794SmrgAC_REQUIRE([AC_CANONICAL_HOST])
130612391620SmrgAC_REQUIRE([AC_PROG_SED])
130721c2f794Smrg
130821c2f794Smrgif test x$APP_MAN_SUFFIX = x    ; then
130921c2f794Smrg    APP_MAN_SUFFIX=1
131021c2f794Smrgfi
131121c2f794Smrgif test x$APP_MAN_DIR = x    ; then
131221c2f794Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
131321c2f794Smrgfi
131421c2f794Smrg
131521c2f794Smrgif test x$LIB_MAN_SUFFIX = x    ; then
131621c2f794Smrg    LIB_MAN_SUFFIX=3
131721c2f794Smrgfi
131821c2f794Smrgif test x$LIB_MAN_DIR = x    ; then
131921c2f794Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
132021c2f794Smrgfi
132121c2f794Smrg
132221c2f794Smrgif test x$FILE_MAN_SUFFIX = x    ; then
132321c2f794Smrg    case $host_os in
132421c2f794Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
132521c2f794Smrg	*)		FILE_MAN_SUFFIX=5  ;;
132621c2f794Smrg    esac
132721c2f794Smrgfi
132821c2f794Smrgif test x$FILE_MAN_DIR = x    ; then
132921c2f794Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
133021c2f794Smrgfi
133121c2f794Smrg
133221c2f794Smrgif test x$MISC_MAN_SUFFIX = x    ; then
133321c2f794Smrg    case $host_os in
133421c2f794Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
133521c2f794Smrg	*)		MISC_MAN_SUFFIX=7  ;;
133621c2f794Smrg    esac
133721c2f794Smrgfi
133821c2f794Smrgif test x$MISC_MAN_DIR = x    ; then
133921c2f794Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
134021c2f794Smrgfi
134121c2f794Smrg
134221c2f794Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
134321c2f794Smrg    case $host_os in
134421c2f794Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
134521c2f794Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
134621c2f794Smrg    esac
134721c2f794Smrgfi
134821c2f794Smrgif test x$DRIVER_MAN_DIR = x    ; then
134921c2f794Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
135021c2f794Smrgfi
135121c2f794Smrg
135221c2f794Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
135321c2f794Smrg    case $host_os in
135421c2f794Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
135521c2f794Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
135621c2f794Smrg    esac
135721c2f794Smrgfi
135821c2f794Smrgif test x$ADMIN_MAN_DIR = x    ; then
135921c2f794Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
136021c2f794Smrgfi
136121c2f794Smrg
136221c2f794Smrg
136321c2f794SmrgAC_SUBST([APP_MAN_SUFFIX])
136421c2f794SmrgAC_SUBST([LIB_MAN_SUFFIX])
136521c2f794SmrgAC_SUBST([FILE_MAN_SUFFIX])
136621c2f794SmrgAC_SUBST([MISC_MAN_SUFFIX])
136721c2f794SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
136821c2f794SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
136921c2f794SmrgAC_SUBST([APP_MAN_DIR])
137021c2f794SmrgAC_SUBST([LIB_MAN_DIR])
137121c2f794SmrgAC_SUBST([FILE_MAN_DIR])
137221c2f794SmrgAC_SUBST([MISC_MAN_DIR])
137321c2f794SmrgAC_SUBST([DRIVER_MAN_DIR])
137421c2f794SmrgAC_SUBST([ADMIN_MAN_DIR])
137512391620Smrg
137612391620SmrgXORG_MAN_PAGE="X Version 11"
137712391620SmrgAC_SUBST([XORG_MAN_PAGE])
137812391620SmrgMAN_SUBSTS="\
137912391620Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
138012391620Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
138112391620Smrg	-e 's|__xservername__|Xorg|g' \
138212391620Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
138312391620Smrg	-e 's|__projectroot__|\$(prefix)|g' \
138412391620Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
138512391620Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
138612391620Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
138712391620Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
138812391620Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
138912391620Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
139012391620Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
139112391620SmrgAC_SUBST([MAN_SUBSTS])
139212391620Smrg
139321c2f794Smrg]) # XORG_MANPAGE_SECTIONS
139421c2f794Smrg
139512391620Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
139612391620Smrg# ------------------------
139712391620Smrg# Minimum version: 1.7.0
139812391620Smrg#
139912391620Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
140012391620Smrg# provided by xorg-sgml-doctools, if installed.
140112391620SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
140212391620SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
140312391620SmrgXORG_SGML_PATH=
140412391620SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
140512391620Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
140612391620Smrg    [m4_ifval([$1],[:],
140712391620Smrg        [if test x"$cross_compiling" != x"yes" ; then
140812391620Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
140912391620Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
141012391620Smrg         fi])
141112391620Smrg    ])
141212391620Smrg
141312391620Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
141412391620Smrg# the path and the name of the doc stylesheet
141512391620Smrgif test "x$XORG_SGML_PATH" != "x" ; then
141612391620Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
141712391620Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
141812391620Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
141912391620Smrgelse
142012391620Smrg   AC_MSG_RESULT([no])
142112391620Smrgfi
142212391620Smrg
142312391620SmrgAC_SUBST(XORG_SGML_PATH)
142412391620SmrgAC_SUBST(STYLESHEET_SRCDIR)
142512391620SmrgAC_SUBST(XSL_STYLESHEET)
142612391620SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
142712391620Smrg]) # XORG_CHECK_SGML_DOCTOOLS
142812391620Smrg
142921c2f794Smrg# XORG_CHECK_LINUXDOC
143021c2f794Smrg# -------------------
143121c2f794Smrg# Minimum version: 1.0.0
143221c2f794Smrg#
143321c2f794Smrg# Defines the variable MAKE_TEXT if the necessary tools and
143421c2f794Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
143521c2f794Smrg# Whether or not the necessary tools and files are found can be checked
143621c2f794Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
143721c2f794SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
143812391620SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
143912391620SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
144021c2f794Smrg
144121c2f794SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
144221c2f794Smrg
144312391620SmrgAC_MSG_CHECKING([whether to build documentation])
144421c2f794Smrg
144512391620Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
144621c2f794Smrg   BUILDDOC=yes
144721c2f794Smrgelse
144821c2f794Smrg   BUILDDOC=no
144921c2f794Smrgfi
145021c2f794Smrg
145121c2f794SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
145221c2f794Smrg
145321c2f794SmrgAC_MSG_RESULT([$BUILDDOC])
145421c2f794Smrg
145512391620SmrgAC_MSG_CHECKING([whether to build pdf documentation])
145621c2f794Smrg
145712391620Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
145821c2f794Smrg   BUILDPDFDOC=yes
145921c2f794Smrgelse
146021c2f794Smrg   BUILDPDFDOC=no
146121c2f794Smrgfi
146221c2f794Smrg
146321c2f794SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
146421c2f794Smrg
146521c2f794SmrgAC_MSG_RESULT([$BUILDPDFDOC])
146621c2f794Smrg
146712391620SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
146821c2f794SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
146921c2f794SmrgMAKE_PDF="$PS2PDF"
147021c2f794SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
147121c2f794Smrg
147221c2f794SmrgAC_SUBST(MAKE_TEXT)
147321c2f794SmrgAC_SUBST(MAKE_PS)
147421c2f794SmrgAC_SUBST(MAKE_PDF)
147521c2f794SmrgAC_SUBST(MAKE_HTML)
147621c2f794Smrg]) # XORG_CHECK_LINUXDOC
147721c2f794Smrg
147821c2f794Smrg# XORG_CHECK_DOCBOOK
147921c2f794Smrg# -------------------
148021c2f794Smrg# Minimum version: 1.0.0
148121c2f794Smrg#
148221c2f794Smrg# Checks for the ability to build output formats from SGML DocBook source.
148321c2f794Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
148421c2f794Smrg# indicates whether the necessary tools and files are found and, if set,
148521c2f794Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
148621c2f794SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
148712391620SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
148812391620Smrg
148921c2f794SmrgBUILDTXTDOC=no
149021c2f794SmrgBUILDPDFDOC=no
149121c2f794SmrgBUILDPSDOC=no
149221c2f794SmrgBUILDHTMLDOC=no
149321c2f794Smrg
149421c2f794SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
149521c2f794SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
149621c2f794SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
149721c2f794SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
149821c2f794Smrg
149912391620SmrgAC_MSG_CHECKING([whether to build text documentation])
150012391620Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
150121c2f794Smrg   test x$BUILD_TXTDOC != xno; then
150221c2f794Smrg	BUILDTXTDOC=yes
150321c2f794Smrgfi
150421c2f794SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
150521c2f794SmrgAC_MSG_RESULT([$BUILDTXTDOC])
150621c2f794Smrg
150712391620SmrgAC_MSG_CHECKING([whether to build PDF documentation])
150812391620Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
150921c2f794Smrg   test x$BUILD_PDFDOC != xno; then
151021c2f794Smrg	BUILDPDFDOC=yes
151121c2f794Smrgfi
151221c2f794SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
151321c2f794SmrgAC_MSG_RESULT([$BUILDPDFDOC])
151421c2f794Smrg
151512391620SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
151612391620Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
151721c2f794Smrg   test x$BUILD_PSDOC != xno; then
151821c2f794Smrg	BUILDPSDOC=yes
151921c2f794Smrgfi
152021c2f794SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
152121c2f794SmrgAC_MSG_RESULT([$BUILDPSDOC])
152221c2f794Smrg
152312391620SmrgAC_MSG_CHECKING([whether to build HTML documentation])
152412391620Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
152521c2f794Smrg   test x$BUILD_HTMLDOC != xno; then
152621c2f794Smrg	BUILDHTMLDOC=yes
152721c2f794Smrgfi
152821c2f794SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
152921c2f794SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
153021c2f794Smrg
153121c2f794SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
153221c2f794SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
153321c2f794SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
153421c2f794SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
153521c2f794Smrg
153621c2f794SmrgAC_SUBST(MAKE_TEXT)
153721c2f794SmrgAC_SUBST(MAKE_PS)
153821c2f794SmrgAC_SUBST(MAKE_PDF)
153921c2f794SmrgAC_SUBST(MAKE_HTML)
154021c2f794Smrg]) # XORG_CHECK_DOCBOOK
154121c2f794Smrg
154212391620Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
154312391620Smrg# ----------------
154412391620Smrg# Minimum version: 1.5.0
154512391620Smrg# Minimum version for optional DEFAULT argument: 1.11.0
154612391620Smrg#
154712391620Smrg# Documentation tools are not always available on all platforms and sometimes
154812391620Smrg# not at the appropriate level. This macro enables a module to test for the
154912391620Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
155012391620Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
155112391620Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
155212391620Smrg# --with-xmlto assumes 'auto'.
155312391620Smrg#
155412391620Smrg# Interface to module:
155512391620Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
155612391620Smrg# XMLTO:	returns the path of the xmlto program found
155712391620Smrg#		returns the path set by the user in the environment
155812391620Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
155912391620Smrg#		'no' user instructs the module not to use xmlto
156012391620Smrg#
156112391620Smrg# Added in version 1.10.0
156212391620Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
156312391620Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
156412391620Smrg#
156512391620Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
156612391620Smrg#
156712391620SmrgAC_DEFUN([XORG_WITH_XMLTO],[
156812391620SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
156912391620Smrgm4_define([_defopt], m4_default([$2], [auto]))
157012391620SmrgAC_ARG_WITH(xmlto,
157112391620Smrg	AS_HELP_STRING([--with-xmlto],
157212391620Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
157312391620Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
157412391620Smrgm4_undefine([_defopt])
157512391620Smrg
157612391620Smrgif test "x$use_xmlto" = x"auto"; then
157712391620Smrg   AC_PATH_PROG([XMLTO], [xmlto])
157812391620Smrg   if test "x$XMLTO" = "x"; then
157912391620Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
158012391620Smrg	have_xmlto=no
158112391620Smrg   else
158212391620Smrg        have_xmlto=yes
158312391620Smrg   fi
158412391620Smrgelif test "x$use_xmlto" = x"yes" ; then
158512391620Smrg   AC_PATH_PROG([XMLTO], [xmlto])
158612391620Smrg   if test "x$XMLTO" = "x"; then
158712391620Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
158812391620Smrg   fi
158912391620Smrg   have_xmlto=yes
159012391620Smrgelif test "x$use_xmlto" = x"no" ; then
159112391620Smrg   if test "x$XMLTO" != "x"; then
159212391620Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
159312391620Smrg   fi
159412391620Smrg   have_xmlto=no
159512391620Smrgelse
159612391620Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
159712391620Smrgfi
159812391620Smrg
159912391620Smrg# Test for a minimum version of xmlto, if provided.
160012391620Smrgm4_ifval([$1],
160112391620Smrg[if test "$have_xmlto" = yes; then
160212391620Smrg    # scrape the xmlto version
160312391620Smrg    AC_MSG_CHECKING([the xmlto version])
160412391620Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
160512391620Smrg    AC_MSG_RESULT([$xmlto_version])
160612391620Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
160712391620Smrg        [if test "x$use_xmlto" = xauto; then
160812391620Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
160912391620Smrg            have_xmlto=no
161012391620Smrg        else
161112391620Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
161212391620Smrg        fi])
161312391620Smrgfi])
161412391620Smrg
161512391620Smrg# Test for the ability of xmlto to generate a text target
161612391620Smrghave_xmlto_text=no
161712391620Smrgcat > conftest.xml << "EOF"
161812391620SmrgEOF
161912391620SmrgAS_IF([test "$have_xmlto" = yes],
162012391620Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
162112391620Smrg             [have_xmlto_text=yes],
162212391620Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
162312391620Smrgrm -f conftest.xml
162412391620SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
162512391620SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
162612391620Smrg]) # XORG_WITH_XMLTO
162712391620Smrg
162882e12b1bSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
162982e12b1bSmrg# --------------------------------------------
163082e12b1bSmrg# Minimum version: 1.12.0
163182e12b1bSmrg# Minimum version for optional DEFAULT argument: 1.12.0
163282e12b1bSmrg#
163382e12b1bSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
163482e12b1bSmrg# XML-based language used for the transformation of XML documents.
163582e12b1bSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
163682e12b1bSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
163782e12b1bSmrg# The XSLT processor is often used as a standalone tool for transformations.
163882e12b1bSmrg# It should not be assumed that this tool is used only to work with documnetation.
163982e12b1bSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
164082e12b1bSmrg#
164182e12b1bSmrg# Interface to module:
164282e12b1bSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
164382e12b1bSmrg# XSLTPROC:	 returns the path of the xsltproc program found
164482e12b1bSmrg#		 returns the path set by the user in the environment
164582e12b1bSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
164682e12b1bSmrg#		  'no' user instructs the module not to use xsltproc
164782e12b1bSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
164882e12b1bSmrg#
164982e12b1bSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
165082e12b1bSmrg#
165182e12b1bSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
165282e12b1bSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
165382e12b1bSmrg# Preserves the interface, should it be implemented later
165482e12b1bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
165582e12b1bSmrgm4_define([_defopt], m4_default([$2], [auto]))
165682e12b1bSmrgAC_ARG_WITH(xsltproc,
165782e12b1bSmrg	AS_HELP_STRING([--with-xsltproc],
165882e12b1bSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
165982e12b1bSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
166082e12b1bSmrgm4_undefine([_defopt])
166182e12b1bSmrg
166282e12b1bSmrgif test "x$use_xsltproc" = x"auto"; then
166382e12b1bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
166482e12b1bSmrg   if test "x$XSLTPROC" = "x"; then
166582e12b1bSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
166682e12b1bSmrg	have_xsltproc=no
166782e12b1bSmrg   else
166882e12b1bSmrg        have_xsltproc=yes
166982e12b1bSmrg   fi
167082e12b1bSmrgelif test "x$use_xsltproc" = x"yes" ; then
167182e12b1bSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
167282e12b1bSmrg   if test "x$XSLTPROC" = "x"; then
167382e12b1bSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
167482e12b1bSmrg   fi
167582e12b1bSmrg   have_xsltproc=yes
167682e12b1bSmrgelif test "x$use_xsltproc" = x"no" ; then
167782e12b1bSmrg   if test "x$XSLTPROC" != "x"; then
167882e12b1bSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
167982e12b1bSmrg   fi
168082e12b1bSmrg   have_xsltproc=no
168182e12b1bSmrgelse
168282e12b1bSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
168382e12b1bSmrgfi
168482e12b1bSmrg
168582e12b1bSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
168682e12b1bSmrg]) # XORG_WITH_XSLTPROC
168782e12b1bSmrg
168882e12b1bSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
168982e12b1bSmrg# ----------------------------------------
169082e12b1bSmrg# Minimum version: 1.15.0
169182e12b1bSmrg#
169282e12b1bSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
169382e12b1bSmrg# scanning arbitrary text files, extracting information from those text files,
169482e12b1bSmrg# and printing reports based on that information.
169582e12b1bSmrg#
169682e12b1bSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
169782e12b1bSmrg#
169882e12b1bSmrg# Interface to module:
169982e12b1bSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
170082e12b1bSmrg# PERL:	     returns the path of the perl program found
170182e12b1bSmrg#	     returns the path set by the user in the environment
170282e12b1bSmrg# --with-perl: 'yes' user instructs the module to use perl
170382e12b1bSmrg#	       'no' user instructs the module not to use perl
170482e12b1bSmrg# have_perl: returns yes if perl found in PATH or no
170582e12b1bSmrg#
170682e12b1bSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
170782e12b1bSmrg#
170882e12b1bSmrgAC_DEFUN([XORG_WITH_PERL],[
170982e12b1bSmrgAC_ARG_VAR([PERL], [Path to perl command])
171082e12b1bSmrg# Preserves the interface, should it be implemented later
171182e12b1bSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
171282e12b1bSmrgm4_define([_defopt], m4_default([$2], [auto]))
171382e12b1bSmrgAC_ARG_WITH(perl,
171482e12b1bSmrg	AS_HELP_STRING([--with-perl],
171582e12b1bSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
171682e12b1bSmrg	   [use_perl=$withval], [use_perl=]_defopt)
171782e12b1bSmrgm4_undefine([_defopt])
171882e12b1bSmrg
171982e12b1bSmrgif test "x$use_perl" = x"auto"; then
172082e12b1bSmrg   AC_PATH_PROG([PERL], [perl])
172182e12b1bSmrg   if test "x$PERL" = "x"; then
172282e12b1bSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
172382e12b1bSmrg	have_perl=no
172482e12b1bSmrg   else
172582e12b1bSmrg        have_perl=yes
172682e12b1bSmrg   fi
172782e12b1bSmrgelif test "x$use_perl" = x"yes" ; then
172882e12b1bSmrg   AC_PATH_PROG([PERL], [perl])
172982e12b1bSmrg   if test "x$PERL" = "x"; then
173082e12b1bSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
173182e12b1bSmrg   fi
173282e12b1bSmrg   have_perl=yes
173382e12b1bSmrgelif test "x$use_perl" = x"no" ; then
173482e12b1bSmrg   if test "x$PERL" != "x"; then
173582e12b1bSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
173682e12b1bSmrg   fi
173782e12b1bSmrg   have_perl=no
173882e12b1bSmrgelse
173982e12b1bSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
174082e12b1bSmrgfi
174182e12b1bSmrg
174282e12b1bSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
174382e12b1bSmrg]) # XORG_WITH_PERL
174482e12b1bSmrg
174512391620Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
174612391620Smrg# ----------------
174712391620Smrg# Minimum version: 1.5.0
174812391620Smrg# Minimum version for optional DEFAULT argument: 1.11.0
174912391620Smrg#
175012391620Smrg# Documentation tools are not always available on all platforms and sometimes
175112391620Smrg# not at the appropriate level. This macro enables a module to test for the
175212391620Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
175312391620Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
175412391620Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
175512391620Smrg# --with-asciidoc assumes 'auto'.
175612391620Smrg#
175712391620Smrg# Interface to module:
175812391620Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
175912391620Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
176012391620Smrg#		 returns the path set by the user in the environment
176112391620Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
176212391620Smrg#		  'no' user instructs the module not to use asciidoc
176312391620Smrg#
176412391620Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
176512391620Smrg#
176612391620SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
176712391620SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
176812391620Smrgm4_define([_defopt], m4_default([$2], [auto]))
176912391620SmrgAC_ARG_WITH(asciidoc,
177012391620Smrg	AS_HELP_STRING([--with-asciidoc],
177112391620Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
177212391620Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
177312391620Smrgm4_undefine([_defopt])
177412391620Smrg
177512391620Smrgif test "x$use_asciidoc" = x"auto"; then
177612391620Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
177712391620Smrg   if test "x$ASCIIDOC" = "x"; then
177812391620Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
177912391620Smrg	have_asciidoc=no
178012391620Smrg   else
178112391620Smrg        have_asciidoc=yes
178212391620Smrg   fi
178312391620Smrgelif test "x$use_asciidoc" = x"yes" ; then
178412391620Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
178512391620Smrg   if test "x$ASCIIDOC" = "x"; then
178612391620Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
178712391620Smrg   fi
178812391620Smrg   have_asciidoc=yes
178912391620Smrgelif test "x$use_asciidoc" = x"no" ; then
179012391620Smrg   if test "x$ASCIIDOC" != "x"; then
179112391620Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
179212391620Smrg   fi
179312391620Smrg   have_asciidoc=no
179412391620Smrgelse
179512391620Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
179612391620Smrgfi
179712391620Smrgm4_ifval([$1],
179812391620Smrg[if test "$have_asciidoc" = yes; then
179912391620Smrg    # scrape the asciidoc version
180012391620Smrg    AC_MSG_CHECKING([the asciidoc version])
180112391620Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
180212391620Smrg    AC_MSG_RESULT([$asciidoc_version])
180312391620Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
180412391620Smrg        [if test "x$use_asciidoc" = xauto; then
180512391620Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
180612391620Smrg            have_asciidoc=no
180712391620Smrg        else
180812391620Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
180912391620Smrg        fi])
181012391620Smrgfi])
181112391620SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
181212391620Smrg]) # XORG_WITH_ASCIIDOC
181312391620Smrg
181412391620Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
181512391620Smrg# --------------------------------
181612391620Smrg# Minimum version: 1.5.0
181712391620Smrg# Minimum version for optional DEFAULT argument: 1.11.0
181812391620Smrg#
181912391620Smrg# Documentation tools are not always available on all platforms and sometimes
182012391620Smrg# not at the appropriate level. This macro enables a module to test for the
182112391620Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
182212391620Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
182312391620Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
182412391620Smrg# --with-doxygen assumes 'auto'.
182512391620Smrg#
182612391620Smrg# Interface to module:
182712391620Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
182812391620Smrg# DOXYGEN:	 returns the path of the doxygen program found
182912391620Smrg#		 returns the path set by the user in the environment
183012391620Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
183112391620Smrg#		  'no' user instructs the module not to use doxygen
183212391620Smrg#
183312391620Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
183412391620Smrg#
183512391620SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
183612391620SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
183712391620Smrgm4_define([_defopt], m4_default([$2], [auto]))
183812391620SmrgAC_ARG_WITH(doxygen,
183912391620Smrg	AS_HELP_STRING([--with-doxygen],
184012391620Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
184112391620Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
184212391620Smrgm4_undefine([_defopt])
184312391620Smrg
184412391620Smrgif test "x$use_doxygen" = x"auto"; then
184512391620Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
184612391620Smrg   if test "x$DOXYGEN" = "x"; then
184712391620Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
184812391620Smrg	have_doxygen=no
184912391620Smrg   else
185012391620Smrg        have_doxygen=yes
185112391620Smrg   fi
185212391620Smrgelif test "x$use_doxygen" = x"yes" ; then
185312391620Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
185412391620Smrg   if test "x$DOXYGEN" = "x"; then
185512391620Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
185612391620Smrg   fi
185712391620Smrg   have_doxygen=yes
185812391620Smrgelif test "x$use_doxygen" = x"no" ; then
185912391620Smrg   if test "x$DOXYGEN" != "x"; then
186012391620Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
186112391620Smrg   fi
186212391620Smrg   have_doxygen=no
186312391620Smrgelse
186412391620Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
186512391620Smrgfi
186612391620Smrgm4_ifval([$1],
186712391620Smrg[if test "$have_doxygen" = yes; then
186812391620Smrg    # scrape the doxygen version
186912391620Smrg    AC_MSG_CHECKING([the doxygen version])
187012391620Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
187112391620Smrg    AC_MSG_RESULT([$doxygen_version])
187212391620Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
187312391620Smrg        [if test "x$use_doxygen" = xauto; then
187412391620Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
187512391620Smrg            have_doxygen=no
187612391620Smrg        else
187712391620Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
187812391620Smrg        fi])
187912391620Smrgfi])
188012391620SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
188112391620Smrg]) # XORG_WITH_DOXYGEN
188212391620Smrg
188312391620Smrg# XORG_WITH_GROFF([DEFAULT])
188412391620Smrg# ----------------
188512391620Smrg# Minimum version: 1.6.0
188612391620Smrg# Minimum version for optional DEFAULT argument: 1.11.0
188712391620Smrg#
188812391620Smrg# Documentation tools are not always available on all platforms and sometimes
188912391620Smrg# not at the appropriate level. This macro enables a module to test for the
189012391620Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
189112391620Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
189212391620Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
189312391620Smrg# --with-groff assumes 'auto'.
189412391620Smrg#
189512391620Smrg# Interface to module:
189612391620Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
189712391620Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
189812391620Smrg# HAVE_GROFF_MS: the -ms macros package
189912391620Smrg# GROFF:	 returns the path of the groff program found
190012391620Smrg#		 returns the path set by the user in the environment
190112391620Smrg# --with-groff:	 'yes' user instructs the module to use groff
190212391620Smrg#		 'no' user instructs the module not to use groff
190312391620Smrg#
190412391620Smrg# Added in version 1.9.0:
190512391620Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
190612391620Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
190712391620Smrg#		   psselect from the psutils package.
190812391620Smrg#		   the ghostcript package. Refer to the grohtml man pages
190912391620Smrg#
191012391620Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
191112391620Smrg#
191212391620Smrg# OS and distros often splits groff in a basic and full package, the former
191312391620Smrg# having the groff program and the later having devices, fonts and macros
191412391620Smrg# Checking for the groff executable is not enough.
191512391620Smrg#
191612391620Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
191712391620Smrg# unset HAVE_GROFF or GROFF env variables.
191812391620Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
191912391620Smrg#
192012391620SmrgAC_DEFUN([XORG_WITH_GROFF],[
192112391620SmrgAC_ARG_VAR([GROFF], [Path to groff command])
192212391620Smrgm4_define([_defopt], m4_default([$1], [auto]))
192312391620SmrgAC_ARG_WITH(groff,
192412391620Smrg	AS_HELP_STRING([--with-groff],
192512391620Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
192612391620Smrg	   [use_groff=$withval], [use_groff=]_defopt)
192712391620Smrgm4_undefine([_defopt])
192812391620Smrg
192912391620Smrgif test "x$use_groff" = x"auto"; then
193012391620Smrg   AC_PATH_PROG([GROFF], [groff])
193112391620Smrg   if test "x$GROFF" = "x"; then
193212391620Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
193312391620Smrg	have_groff=no
193412391620Smrg   else
193512391620Smrg        have_groff=yes
193612391620Smrg   fi
193712391620Smrgelif test "x$use_groff" = x"yes" ; then
193812391620Smrg   AC_PATH_PROG([GROFF], [groff])
193912391620Smrg   if test "x$GROFF" = "x"; then
194012391620Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
194112391620Smrg   fi
194212391620Smrg   have_groff=yes
194312391620Smrgelif test "x$use_groff" = x"no" ; then
194412391620Smrg   if test "x$GROFF" != "x"; then
194512391620Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
194612391620Smrg   fi
194712391620Smrg   have_groff=no
194812391620Smrgelse
194912391620Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
195012391620Smrgfi
195112391620Smrg
195212391620Smrg# We have groff, test for the presence of the macro packages
195312391620Smrgif test "x$have_groff" = x"yes"; then
195412391620Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
195512391620Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
195612391620Smrg        groff_ms_works=yes
195712391620Smrg    else
195812391620Smrg        groff_ms_works=no
195912391620Smrg    fi
196012391620Smrg    AC_MSG_RESULT([$groff_ms_works])
196112391620Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
196212391620Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
196312391620Smrg        groff_mm_works=yes
196412391620Smrg    else
196512391620Smrg        groff_mm_works=no
196612391620Smrg    fi
196712391620Smrg    AC_MSG_RESULT([$groff_mm_works])
196812391620Smrgfi
196912391620Smrg
197012391620Smrg# We have groff, test for HTML dependencies, one command per package
197112391620Smrgif test "x$have_groff" = x"yes"; then
197212391620Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
197312391620Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
197412391620Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
197512391620Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
197612391620Smrg      have_groff_html=yes
197712391620Smrg   else
197812391620Smrg      have_groff_html=no
197912391620Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
198012391620Smrg   fi
198112391620Smrgfi
198212391620Smrg
198312391620Smrg# Set Automake conditionals for Makefiles
198412391620SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
198512391620SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
198612391620SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
198712391620SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
198812391620Smrg]) # XORG_WITH_GROFF
198912391620Smrg
199082e12b1bSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
199182e12b1bSmrg# ---------------------------------------
199212391620Smrg# Minimum version: 1.6.0
199312391620Smrg# Minimum version for optional DEFAULT argument: 1.11.0
199482e12b1bSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
199512391620Smrg#
199612391620Smrg# Documentation tools are not always available on all platforms and sometimes
199712391620Smrg# not at the appropriate level. This macro enables a module to test for the
199812391620Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
199912391620Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
200012391620Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
200112391620Smrg# --with-fop assumes 'auto'.
200212391620Smrg#
200312391620Smrg# Interface to module:
200412391620Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
200512391620Smrg# FOP:	 	returns the path of the fop program found
200612391620Smrg#		returns the path set by the user in the environment
200712391620Smrg# --with-fop: 	'yes' user instructs the module to use fop
200812391620Smrg#		'no' user instructs the module not to use fop
200912391620Smrg#
201012391620Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
201112391620Smrg#
201212391620SmrgAC_DEFUN([XORG_WITH_FOP],[
201312391620SmrgAC_ARG_VAR([FOP], [Path to fop command])
201482e12b1bSmrgm4_define([_defopt], m4_default([$2], [auto]))
201512391620SmrgAC_ARG_WITH(fop,
201612391620Smrg	AS_HELP_STRING([--with-fop],
201712391620Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
201812391620Smrg	   [use_fop=$withval], [use_fop=]_defopt)
201912391620Smrgm4_undefine([_defopt])
202012391620Smrg
202112391620Smrgif test "x$use_fop" = x"auto"; then
202212391620Smrg   AC_PATH_PROG([FOP], [fop])
202312391620Smrg   if test "x$FOP" = "x"; then
202412391620Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
202512391620Smrg	have_fop=no
202612391620Smrg   else
202712391620Smrg        have_fop=yes
202812391620Smrg   fi
202912391620Smrgelif test "x$use_fop" = x"yes" ; then
203012391620Smrg   AC_PATH_PROG([FOP], [fop])
203112391620Smrg   if test "x$FOP" = "x"; then
203212391620Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
203312391620Smrg   fi
203412391620Smrg   have_fop=yes
203512391620Smrgelif test "x$use_fop" = x"no" ; then
203612391620Smrg   if test "x$FOP" != "x"; then
203712391620Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
203812391620Smrg   fi
203912391620Smrg   have_fop=no
204012391620Smrgelse
204112391620Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
204212391620Smrgfi
204382e12b1bSmrg
204482e12b1bSmrg# Test for a minimum version of fop, if provided.
204582e12b1bSmrgm4_ifval([$1],
204682e12b1bSmrg[if test "$have_fop" = yes; then
204782e12b1bSmrg    # scrape the fop version
204882e12b1bSmrg    AC_MSG_CHECKING([for fop minimum version])
204982e12b1bSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
205082e12b1bSmrg    AC_MSG_RESULT([$fop_version])
205182e12b1bSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
205282e12b1bSmrg        [if test "x$use_fop" = xauto; then
205382e12b1bSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
205482e12b1bSmrg            have_fop=no
205582e12b1bSmrg        else
205682e12b1bSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
205782e12b1bSmrg        fi])
205882e12b1bSmrgfi])
205912391620SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
206012391620Smrg]) # XORG_WITH_FOP
206112391620Smrg
206212391620Smrg# XORG_WITH_PS2PDF([DEFAULT])
206312391620Smrg# ----------------
206412391620Smrg# Minimum version: 1.6.0
206512391620Smrg# Minimum version for optional DEFAULT argument: 1.11.0
206612391620Smrg#
206712391620Smrg# Documentation tools are not always available on all platforms and sometimes
206812391620Smrg# not at the appropriate level. This macro enables a module to test for the
206912391620Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
207012391620Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
207112391620Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
207212391620Smrg# --with-ps2pdf assumes 'auto'.
207312391620Smrg#
207412391620Smrg# Interface to module:
207512391620Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
207612391620Smrg# PS2PDF:	returns the path of the ps2pdf program found
207712391620Smrg#		returns the path set by the user in the environment
207812391620Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
207912391620Smrg#		 'no' user instructs the module not to use ps2pdf
208012391620Smrg#
208112391620Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
208212391620Smrg#
208312391620SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
208412391620SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
208512391620Smrgm4_define([_defopt], m4_default([$1], [auto]))
208612391620SmrgAC_ARG_WITH(ps2pdf,
208712391620Smrg	AS_HELP_STRING([--with-ps2pdf],
208812391620Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
208912391620Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
209012391620Smrgm4_undefine([_defopt])
209112391620Smrg
209212391620Smrgif test "x$use_ps2pdf" = x"auto"; then
209312391620Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
209412391620Smrg   if test "x$PS2PDF" = "x"; then
209512391620Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
209612391620Smrg	have_ps2pdf=no
209712391620Smrg   else
209812391620Smrg        have_ps2pdf=yes
209912391620Smrg   fi
210012391620Smrgelif test "x$use_ps2pdf" = x"yes" ; then
210112391620Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
210212391620Smrg   if test "x$PS2PDF" = "x"; then
210312391620Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
210412391620Smrg   fi
210512391620Smrg   have_ps2pdf=yes
210612391620Smrgelif test "x$use_ps2pdf" = x"no" ; then
210712391620Smrg   if test "x$PS2PDF" != "x"; then
210812391620Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
210912391620Smrg   fi
211012391620Smrg   have_ps2pdf=no
211112391620Smrgelse
211212391620Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
211312391620Smrgfi
211412391620SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
211512391620Smrg]) # XORG_WITH_PS2PDF
211612391620Smrg
211712391620Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
211812391620Smrg# ----------------
211912391620Smrg# Minimum version: 1.6.0
212012391620Smrg#
212112391620Smrg# Documentation tools are not always available on all platforms and sometimes
212212391620Smrg# not at the appropriate level. This macro enables a builder to skip all
212312391620Smrg# documentation targets except traditional man pages.
212412391620Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
212512391620Smrg# maximum flexibilty in controlling documentation building.
212612391620Smrg# Refer to:
212712391620Smrg# XORG_WITH_XMLTO         --with-xmlto
212812391620Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
212912391620Smrg# XORG_WITH_DOXYGEN       --with-doxygen
213012391620Smrg# XORG_WITH_FOP           --with-fop
213112391620Smrg# XORG_WITH_GROFF         --with-groff
213212391620Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
213312391620Smrg#
213412391620Smrg# Interface to module:
213512391620Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
213612391620Smrg# --enable-docs: 'yes' user instructs the module to generate docs
213712391620Smrg#		 'no' user instructs the module not to generate docs
213812391620Smrg# parm1:	specify the default value, yes or no.
213912391620Smrg#
214012391620SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
214182e12b1bSmrgm4_define([docs_default], m4_default([$1], [yes]))
214212391620SmrgAC_ARG_ENABLE(docs,
214312391620Smrg	AS_HELP_STRING([--enable-docs],
214482e12b1bSmrg	   [Enable building the documentation (default: ]docs_default[)]),
214582e12b1bSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
214682e12b1bSmrgm4_undefine([docs_default])
214712391620SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
214812391620SmrgAC_MSG_CHECKING([whether to build documentation])
214912391620SmrgAC_MSG_RESULT([$build_docs])
215012391620Smrg]) # XORG_ENABLE_DOCS
215112391620Smrg
215212391620Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
215312391620Smrg# ----------------
215412391620Smrg# Minimum version: 1.6.0
215512391620Smrg#
215612391620Smrg# This macro enables a builder to skip all developer documentation.
215712391620Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
215812391620Smrg# maximum flexibilty in controlling documentation building.
215912391620Smrg# Refer to:
216012391620Smrg# XORG_WITH_XMLTO         --with-xmlto
216112391620Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
216212391620Smrg# XORG_WITH_DOXYGEN       --with-doxygen
216312391620Smrg# XORG_WITH_FOP           --with-fop
216412391620Smrg# XORG_WITH_GROFF         --with-groff
216512391620Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
216612391620Smrg#
216712391620Smrg# Interface to module:
216812391620Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
216912391620Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
217012391620Smrg#			'no' user instructs the module not to generate developer docs
217112391620Smrg# parm1:		specify the default value, yes or no.
217212391620Smrg#
217312391620SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
217412391620Smrgm4_define([devel_default], m4_default([$1], [yes]))
217512391620SmrgAC_ARG_ENABLE(devel-docs,
217612391620Smrg	AS_HELP_STRING([--enable-devel-docs],
217712391620Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
217812391620Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
217912391620Smrgm4_undefine([devel_default])
218012391620SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
218112391620SmrgAC_MSG_CHECKING([whether to build developer documentation])
218212391620SmrgAC_MSG_RESULT([$build_devel_docs])
218312391620Smrg]) # XORG_ENABLE_DEVEL_DOCS
218412391620Smrg
218512391620Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
218612391620Smrg# ----------------
218712391620Smrg# Minimum version: 1.6.0
218812391620Smrg#
218912391620Smrg# This macro enables a builder to skip all functional specification targets.
219012391620Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
219112391620Smrg# maximum flexibilty in controlling documentation building.
219212391620Smrg# Refer to:
219312391620Smrg# XORG_WITH_XMLTO         --with-xmlto
219412391620Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
219512391620Smrg# XORG_WITH_DOXYGEN       --with-doxygen
219612391620Smrg# XORG_WITH_FOP           --with-fop
219712391620Smrg# XORG_WITH_GROFF         --with-groff
219812391620Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
219912391620Smrg#
220012391620Smrg# Interface to module:
220112391620Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
220212391620Smrg# --enable-specs:	'yes' user instructs the module to generate specs
220312391620Smrg#			'no' user instructs the module not to generate specs
220412391620Smrg# parm1:		specify the default value, yes or no.
220512391620Smrg#
220612391620SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
220712391620Smrgm4_define([spec_default], m4_default([$1], [yes]))
220812391620SmrgAC_ARG_ENABLE(specs,
220912391620Smrg	AS_HELP_STRING([--enable-specs],
221012391620Smrg	   [Enable building the specs (default: ]spec_default[)]),
221112391620Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
221212391620Smrgm4_undefine([spec_default])
221312391620SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
221412391620SmrgAC_MSG_CHECKING([whether to build functional specifications])
221512391620SmrgAC_MSG_RESULT([$build_specs])
221612391620Smrg]) # XORG_ENABLE_SPECS
221712391620Smrg
221882e12b1bSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
221982e12b1bSmrg# ----------------------------------------------
222082e12b1bSmrg# Minimum version: 1.13.0
222182e12b1bSmrg#
222282e12b1bSmrg# This macro enables a builder to enable/disable unit testing
222382e12b1bSmrg# It makes no assumption about the test cases implementation
222482e12b1bSmrg# Test cases may or may not use Automake "Support for test suites"
222582e12b1bSmrg# They may or may not use the software utility library GLib
222682e12b1bSmrg#
222782e12b1bSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
222882e12b1bSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
222982e12b1bSmrg# The variable enable_unit_tests is used by other macros in this file.
223082e12b1bSmrg#
223182e12b1bSmrg# Interface to module:
223282e12b1bSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
223382e12b1bSmrg# enable_unit_tests:    used in configure.ac for additional configuration
223482e12b1bSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
223582e12b1bSmrg#			'no' user instructs the module not to build tests
223682e12b1bSmrg# parm1:		specify the default value, yes or no.
223782e12b1bSmrg#
223882e12b1bSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
223982e12b1bSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
224082e12b1bSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
224182e12b1bSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
224282e12b1bSmrgm4_define([_defopt], m4_default([$1], [auto]))
224382e12b1bSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
224482e12b1bSmrg	[Enable building unit test cases (default: ]_defopt[)]),
224582e12b1bSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
224682e12b1bSmrgm4_undefine([_defopt])
224782e12b1bSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
224882e12b1bSmrgAC_MSG_CHECKING([whether to build unit test cases])
224982e12b1bSmrgAC_MSG_RESULT([$enable_unit_tests])
225082e12b1bSmrg]) # XORG_ENABLE_UNIT_TESTS
225182e12b1bSmrg
225282e12b1bSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
225382e12b1bSmrg# ------------------------------------------------------
225482e12b1bSmrg# Minimum version: 1.17.0
225582e12b1bSmrg#
225682e12b1bSmrg# This macro enables a builder to enable/disable integration testing
225782e12b1bSmrg# It makes no assumption about the test cases' implementation
225882e12b1bSmrg# Test cases may or may not use Automake "Support for test suites"
225982e12b1bSmrg#
226082e12b1bSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
226182e12b1bSmrg# usually requires less dependencies and may be built and run under less
226282e12b1bSmrg# stringent environments than integration tests.
226382e12b1bSmrg#
226482e12b1bSmrg# Interface to module:
226582e12b1bSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
226682e12b1bSmrg# enable_integration_tests:   used in configure.ac for additional configuration
226782e12b1bSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
226882e12b1bSmrg#                             'no' user instructs the module not to build tests
226982e12b1bSmrg# parm1:                      specify the default value, yes or no.
227082e12b1bSmrg#
227182e12b1bSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
227282e12b1bSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
227382e12b1bSmrgm4_define([_defopt], m4_default([$1], [auto]))
227482e12b1bSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
227582e12b1bSmrg	[Enable building integration test cases (default: ]_defopt[)]),
227682e12b1bSmrg	[enable_integration_tests=$enableval],
227782e12b1bSmrg	[enable_integration_tests=]_defopt)
227882e12b1bSmrgm4_undefine([_defopt])
227982e12b1bSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
228082e12b1bSmrg	[test "x$enable_integration_tests" != xno])
228182e12b1bSmrgAC_MSG_CHECKING([whether to build unit test cases])
228282e12b1bSmrgAC_MSG_RESULT([$enable_integration_tests])
228382e12b1bSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
228482e12b1bSmrg
228582e12b1bSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
228682e12b1bSmrg# ----------------------------------------
228782e12b1bSmrg# Minimum version: 1.13.0
228882e12b1bSmrg#
228982e12b1bSmrg# GLib is a library which provides advanced data structures and functions.
229082e12b1bSmrg# This macro enables a module to test for the presence of Glib.
229182e12b1bSmrg#
229282e12b1bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
229382e12b1bSmrg# Otherwise the value of $enable_unit_tests is blank.
229482e12b1bSmrg#
229582e12b1bSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
229682e12b1bSmrg# test support usually requires less dependencies and may be built and run under
229782e12b1bSmrg# less stringent environments than integration tests.
229882e12b1bSmrg#
229982e12b1bSmrg# Interface to module:
230082e12b1bSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
230182e12b1bSmrg# with_glib: used in configure.ac to know if GLib has been found
230282e12b1bSmrg# --with-glib:	'yes' user instructs the module to use glib
230382e12b1bSmrg#		'no' user instructs the module not to use glib
230482e12b1bSmrg#
230582e12b1bSmrgAC_DEFUN([XORG_WITH_GLIB],[
230682e12b1bSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
230782e12b1bSmrgm4_define([_defopt], m4_default([$2], [auto]))
230882e12b1bSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
230982e12b1bSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
231082e12b1bSmrg	[with_glib=$withval], [with_glib=]_defopt)
231182e12b1bSmrgm4_undefine([_defopt])
231282e12b1bSmrg
231382e12b1bSmrghave_glib=no
231482e12b1bSmrg# Do not probe GLib if user explicitly disabled unit testing
231582e12b1bSmrgif test "x$enable_unit_tests" != x"no"; then
231682e12b1bSmrg  # Do not probe GLib if user explicitly disabled it
231782e12b1bSmrg  if test "x$with_glib" != x"no"; then
231882e12b1bSmrg    m4_ifval(
231982e12b1bSmrg      [$1],
232082e12b1bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
232182e12b1bSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
232282e12b1bSmrg    )
232382e12b1bSmrg  fi
232482e12b1bSmrgfi
232582e12b1bSmrg
232682e12b1bSmrg# Not having GLib when unit testing has been explicitly requested is an error
232782e12b1bSmrgif test "x$enable_unit_tests" = x"yes"; then
232882e12b1bSmrg  if test "x$have_glib" = x"no"; then
232982e12b1bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
233082e12b1bSmrg  fi
233182e12b1bSmrgfi
233282e12b1bSmrg
233382e12b1bSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
233482e12b1bSmrgif test "x$enable_unit_tests" = x"no"; then
233582e12b1bSmrg  if test "x$with_glib" = x"yes"; then
233682e12b1bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
233782e12b1bSmrg  fi
233882e12b1bSmrgfi
233982e12b1bSmrg
234082e12b1bSmrg# Not having GLib when it has been explicitly requested is an error
234182e12b1bSmrgif test "x$with_glib" = x"yes"; then
234282e12b1bSmrg  if test "x$have_glib" = x"no"; then
234382e12b1bSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
234482e12b1bSmrg  fi
234582e12b1bSmrgfi
234682e12b1bSmrg
234782e12b1bSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
234882e12b1bSmrg]) # XORG_WITH_GLIB
234982e12b1bSmrg
235082e12b1bSmrg# XORG_LD_WRAP([required|optional])
235182e12b1bSmrg# ---------------------------------
235282e12b1bSmrg# Minimum version: 1.13.0
235382e12b1bSmrg#
235482e12b1bSmrg# Check if linker supports -wrap, passed via compiler flags
235582e12b1bSmrg#
235682e12b1bSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
235782e12b1bSmrg# Otherwise the value of $enable_unit_tests is blank.
235882e12b1bSmrg#
235982e12b1bSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
236082e12b1bSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
236182e12b1bSmrg# available, an argument of "optional" allows use when some unit tests require
236282e12b1bSmrg# ld -wrap and others do not.
236382e12b1bSmrg#
236482e12b1bSmrgAC_DEFUN([XORG_LD_WRAP],[
236582e12b1bSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
236682e12b1bSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
236782e12b1bSmrg                      void __wrap_exit(int status) { return; }],
236882e12b1bSmrg                     [exit(0);])])
236982e12b1bSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
237082e12b1bSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
237182e12b1bSmrg  if test "x$have_ld_wrap" = x"no"; then
237282e12b1bSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
237382e12b1bSmrg  fi
237482e12b1bSmrgfi
237582e12b1bSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
237682e12b1bSmrg#
237782e12b1bSmrg]) # XORG_LD_WRAP
237882e12b1bSmrg
237982e12b1bSmrg# XORG_CHECK_LINKER_FLAGS
238082e12b1bSmrg# -----------------------
238182e12b1bSmrg# SYNOPSIS
238282e12b1bSmrg#
238382e12b1bSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
238482e12b1bSmrg#
238582e12b1bSmrg# DESCRIPTION
238682e12b1bSmrg#
238782e12b1bSmrg#   Check whether the given linker FLAGS work with the current language's
238882e12b1bSmrg#   linker, or whether they give an error.
238982e12b1bSmrg#
239082e12b1bSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
239182e12b1bSmrg#   success/failure.
239282e12b1bSmrg#
239382e12b1bSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
239482e12b1bSmrg#
239582e12b1bSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
239682e12b1bSmrg#
239782e12b1bSmrg# LICENSE
239882e12b1bSmrg#
239982e12b1bSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
240082e12b1bSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
240182e12b1bSmrg#   Copyright (c) 2009 Matteo Frigo
240282e12b1bSmrg#
240382e12b1bSmrg#   This program is free software: you can redistribute it and/or modify it
240482e12b1bSmrg#   under the terms of the GNU General Public License as published by the
240582e12b1bSmrg#   Free Software Foundation, either version 3 of the License, or (at your
240682e12b1bSmrg#   option) any later version.
240782e12b1bSmrg#
240882e12b1bSmrg#   This program is distributed in the hope that it will be useful, but
240982e12b1bSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
241082e12b1bSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
241182e12b1bSmrg#   Public License for more details.
241282e12b1bSmrg#
241382e12b1bSmrg#   You should have received a copy of the GNU General Public License along
241482e12b1bSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
241582e12b1bSmrg#
241682e12b1bSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
241782e12b1bSmrg#   gives unlimited permission to copy, distribute and modify the configure
241882e12b1bSmrg#   scripts that are the output of Autoconf when processing the Macro. You
241982e12b1bSmrg#   need not follow the terms of the GNU General Public License when using
242082e12b1bSmrg#   or distributing such scripts, even though portions of the text of the
242182e12b1bSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
242282e12b1bSmrg#   all other use of the material that constitutes the Autoconf Macro.
242382e12b1bSmrg#
242482e12b1bSmrg#   This special exception to the GPL applies to versions of the Autoconf
242582e12b1bSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
242682e12b1bSmrg#   modified version of the Autoconf Macro, you may extend this special
242782e12b1bSmrg#   exception to the GPL to apply to your modified version as well.#
242882e12b1bSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
242982e12b1bSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
243082e12b1bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
243182e12b1bSmrgAS_LITERAL_IF([$1],
243282e12b1bSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
243382e12b1bSmrg      ax_save_FLAGS=$LDFLAGS
243482e12b1bSmrg      LDFLAGS="$1"
243582e12b1bSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
243682e12b1bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
243782e12b1bSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
243882e12b1bSmrg      LDFLAGS=$ax_save_FLAGS])],
243982e12b1bSmrg  [ax_save_FLAGS=$LDFLAGS
244082e12b1bSmrg   LDFLAGS="$1"
244182e12b1bSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
244282e12b1bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
244382e12b1bSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
244482e12b1bSmrg   LDFLAGS=$ax_save_FLAGS])
244582e12b1bSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
244682e12b1bSmrgAC_MSG_RESULT($xorg_check_linker_flags)
244782e12b1bSmrgif test "x$xorg_check_linker_flags" = xyes; then
244882e12b1bSmrg	m4_default([$2], :)
244982e12b1bSmrgelse
245082e12b1bSmrg	m4_default([$3], :)
245182e12b1bSmrgfi
245282e12b1bSmrg]) # XORG_CHECK_LINKER_FLAGS
245382e12b1bSmrg
245482e12b1bSmrg# XORG_MEMORY_CHECK_FLAGS
245582e12b1bSmrg# -----------------------
245682e12b1bSmrg# Minimum version: 1.16.0
245782e12b1bSmrg#
245882e12b1bSmrg# This macro attempts to find appropriate memory checking functionality
245982e12b1bSmrg# for various platforms which unit testing code may use to catch various
246082e12b1bSmrg# forms of memory allocation and access errors in testing.
246182e12b1bSmrg#
246282e12b1bSmrg# Interface to module:
246382e12b1bSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
246482e12b1bSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
246582e12b1bSmrg#
246682e12b1bSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
246782e12b1bSmrg#
246882e12b1bSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
246982e12b1bSmrg
247082e12b1bSmrgAC_REQUIRE([AC_CANONICAL_HOST])
247182e12b1bSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
247282e12b1bSmrg           [Environment variables to enable memory checking in tests])
247382e12b1bSmrg
247482e12b1bSmrg# Check for different types of support on different platforms
247582e12b1bSmrgcase $host_os in
247682e12b1bSmrg    solaris*)
247782e12b1bSmrg        AC_CHECK_LIB([umem], [umem_alloc],
247882e12b1bSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
247982e12b1bSmrg        ;;
248082e12b1bSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
248182e12b1bSmrg        # both directly and inverted, so should not be 0 or 255.
248282e12b1bSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
248382e12b1bSmrg        ;;
248482e12b1bSmrg    darwin*)
248582e12b1bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
248682e12b1bSmrg        ;;
248782e12b1bSmrg    *bsd*)
248882e12b1bSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
248982e12b1bSmrg        ;;
249082e12b1bSmrgesac
249182e12b1bSmrg
249282e12b1bSmrg# User supplied flags override default flags
249382e12b1bSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
249482e12b1bSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
249582e12b1bSmrgfi
249682e12b1bSmrg
249782e12b1bSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
249882e12b1bSmrg]) # XORG_WITH_LINT
249982e12b1bSmrg
250021c2f794Smrg# XORG_CHECK_MALLOC_ZERO
250121c2f794Smrg# ----------------------
250221c2f794Smrg# Minimum version: 1.0.0
250321c2f794Smrg#
250421c2f794Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
250521c2f794Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
250621c2f794Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
250721c2f794SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
250821c2f794SmrgAC_ARG_ENABLE(malloc0returnsnull,
250912391620Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
251021c2f794Smrg		       [malloc(0) returns NULL (default: auto)]),
251121c2f794Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
251221c2f794Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
251321c2f794Smrg
251421c2f794SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
251521c2f794Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
251682e12b1bSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
251782e12b1bSmrg#include <stdlib.h>
251882e12b1bSmrg],[
251921c2f794Smrg    char *m0, *r0, *c0, *p;
252021c2f794Smrg    m0 = malloc(0);
252121c2f794Smrg    p = malloc(10);
252221c2f794Smrg    r0 = realloc(p,0);
252382e12b1bSmrg    c0 = calloc(0,10);
252482e12b1bSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
252582e12b1bSmrg])],
252621c2f794Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
252712391620Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
252812391620Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
252921c2f794Smrgfi
253021c2f794SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
253121c2f794Smrg
253221c2f794Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
253321c2f794Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
253421c2f794Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
253521c2f794Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
253621c2f794Smrgelse
253721c2f794Smrg	MALLOC_ZERO_CFLAGS=""
253821c2f794Smrg	XMALLOC_ZERO_CFLAGS=""
253921c2f794Smrg	XTMALLOC_ZERO_CFLAGS=""
254021c2f794Smrgfi
254121c2f794Smrg
254221c2f794SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
254321c2f794SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
254421c2f794SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
254521c2f794Smrg]) # XORG_CHECK_MALLOC_ZERO
254621c2f794Smrg
254721c2f794Smrg# XORG_WITH_LINT()
254821c2f794Smrg# ----------------
254921c2f794Smrg# Minimum version: 1.1.0
255021c2f794Smrg#
255112391620Smrg# This macro enables the use of a tool that flags some suspicious and
255212391620Smrg# non-portable constructs (likely to be bugs) in C language source code.
255312391620Smrg# It will attempt to locate the tool and use appropriate options.
255412391620Smrg# There are various lint type tools on different platforms.
255512391620Smrg#
255612391620Smrg# Interface to module:
255712391620Smrg# LINT:		returns the path to the tool found on the platform
255812391620Smrg#		or the value set to LINT on the configure cmd line
255912391620Smrg#		also an Automake conditional
256012391620Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
256112391620Smrg#
256212391620Smrg# --with-lint:	'yes' user instructs the module to use lint
256312391620Smrg#		'no' user instructs the module not to use lint (default)
256412391620Smrg#
256512391620Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
256612391620Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
256721c2f794Smrg#
256821c2f794SmrgAC_DEFUN([XORG_WITH_LINT],[
256921c2f794Smrg
257012391620SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
257112391620SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
257212391620SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
257321c2f794Smrg		[Use a lint-style source code checker (default: disabled)])],
257421c2f794Smrg		[use_lint=$withval], [use_lint=no])
257512391620Smrg
257612391620Smrg# Obtain platform specific info like program name and options
257712391620Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
257812391620Smrgcase $host_os in
257912391620Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
258012391620Smrg	lint_name=splint
258112391620Smrg	lint_options="-badflag"
258212391620Smrg	;;
258312391620Smrg  *freebsd* | *netbsd*)
258412391620Smrg	lint_name=lint
258512391620Smrg	lint_options="-u -b"
258612391620Smrg	;;
258712391620Smrg  *solaris*)
258812391620Smrg	lint_name=lint
258912391620Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
259012391620Smrg	;;
259112391620Smrgesac
259212391620Smrg
259312391620Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
259412391620Smrgif test "x$use_lint" = x"yes" ; then
259512391620Smrg   AC_PATH_PROG([LINT], [$lint_name])
259612391620Smrg   if test "x$LINT" = "x"; then
259712391620Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
259812391620Smrg   fi
259912391620Smrgelif test "x$use_lint" = x"no" ; then
260012391620Smrg   if test "x$LINT" != "x"; then
260112391620Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
260212391620Smrg   fi
260321c2f794Smrgelse
260412391620Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
260521c2f794Smrgfi
260612391620Smrg
260712391620Smrg# User supplied flags override default flags
260812391620Smrgif test "x$LINT_FLAGS" != "x"; then
260912391620Smrg   lint_options=$LINT_FLAGS
261021c2f794Smrgfi
261121c2f794Smrg
261212391620SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
261312391620SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
261421c2f794Smrg
261521c2f794Smrg]) # XORG_WITH_LINT
261621c2f794Smrg
261721c2f794Smrg# XORG_LINT_LIBRARY(LIBNAME)
261821c2f794Smrg# --------------------------
261921c2f794Smrg# Minimum version: 1.1.0
262021c2f794Smrg#
262121c2f794Smrg# Sets up flags for building lint libraries for checking programs that call
262221c2f794Smrg# functions in the library.
262321c2f794Smrg#
262412391620Smrg# Interface to module:
262512391620Smrg# LINTLIB		- Automake variable with the name of lint library file to make
262612391620Smrg# MAKE_LINT_LIB		- Automake conditional
262712391620Smrg#
262812391620Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
262912391620Smrg#			  - 'no' user instructs the module not to create a lint library (default)
263021c2f794Smrg
263121c2f794SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
263221c2f794SmrgAC_REQUIRE([XORG_WITH_LINT])
263312391620SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
263421c2f794Smrg	[Create lint library (default: disabled)])],
263521c2f794Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
263612391620Smrg
263712391620Smrgif test "x$make_lint_lib" = x"yes" ; then
263812391620Smrg   LINTLIB=llib-l$1.ln
263912391620Smrg   if test "x$LINT" = "x"; then
264012391620Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
264112391620Smrg   fi
264212391620Smrgelif test "x$make_lint_lib" != x"no" ; then
264312391620Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
264421c2f794Smrgfi
264512391620Smrg
264621c2f794SmrgAC_SUBST(LINTLIB)
264721c2f794SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
264821c2f794Smrg
264921c2f794Smrg]) # XORG_LINT_LIBRARY
265021c2f794Smrg
265182e12b1bSmrg# XORG_COMPILER_BRAND
265282e12b1bSmrg# -------------------
265382e12b1bSmrg# Minimum version: 1.14.0
265482e12b1bSmrg#
265582e12b1bSmrg# Checks for various brands of compilers and sets flags as appropriate:
265682e12b1bSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
265782e12b1bSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
265882e12b1bSmrg#   clang compiler - sets CLANGCC to "yes"
265982e12b1bSmrg#   Intel compiler - sets INTELCC to "yes"
266082e12b1bSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
266182e12b1bSmrg#
266282e12b1bSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
266382e12b1bSmrgAC_LANG_CASE(
266482e12b1bSmrg	[C], [
266582e12b1bSmrg		AC_REQUIRE([AC_PROG_CC_C99])
266682e12b1bSmrg	],
266782e12b1bSmrg	[C++], [
266882e12b1bSmrg		AC_REQUIRE([AC_PROG_CXX])
266982e12b1bSmrg	]
267082e12b1bSmrg)
267182e12b1bSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
267282e12b1bSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
267382e12b1bSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
267482e12b1bSmrg]) # XORG_COMPILER_BRAND
267582e12b1bSmrg
267682e12b1bSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
267782e12b1bSmrg# ---------------
267882e12b1bSmrg# Minimum version: 1.16.0
267982e12b1bSmrg#
268082e12b1bSmrg# Test if the compiler works when passed the given flag as a command line argument.
268182e12b1bSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
268282e12b1bSmrg# next flag in the list until there are no more options.
268382e12b1bSmrg#
268482e12b1bSmrg# Note that this does not guarantee that the compiler supports the flag as some
268582e12b1bSmrg# compilers will simply ignore arguments that they do not understand, but we do
268682e12b1bSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
268782e12b1bSmrg# -Werror=unused-command-line-argument
268882e12b1bSmrg#
268982e12b1bSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
269082e12b1bSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
269182e12b1bSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
269282e12b1bSmrg
269382e12b1bSmrgAC_LANG_COMPILER_REQUIRE
269482e12b1bSmrg
269582e12b1bSmrgAC_LANG_CASE(
269682e12b1bSmrg	[C], [
269782e12b1bSmrg		AC_REQUIRE([AC_PROG_CC_C99])
269882e12b1bSmrg		define([PREFIX], [C])
269982e12b1bSmrg		define([CACHE_PREFIX], [cc])
270082e12b1bSmrg		define([COMPILER], [$CC])
270182e12b1bSmrg	],
270282e12b1bSmrg	[C++], [
270382e12b1bSmrg		define([PREFIX], [CXX])
270482e12b1bSmrg		define([CACHE_PREFIX], [cxx])
270582e12b1bSmrg		define([COMPILER], [$CXX])
270682e12b1bSmrg	]
270782e12b1bSmrg)
270882e12b1bSmrg
270982e12b1bSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
271082e12b1bSmrg
271182e12b1bSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
271282e12b1bSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
271382e12b1bSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
271482e12b1bSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
271582e12b1bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
271682e12b1bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
271782e12b1bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
271882e12b1bSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
271982e12b1bSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
272082e12b1bSmrgfi
272182e12b1bSmrg
272282e12b1bSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
272382e12b1bSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
272482e12b1bSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
272582e12b1bSmrg	fi
272682e12b1bSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
272782e12b1bSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
272882e12b1bSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
272982e12b1bSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
273082e12b1bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
273182e12b1bSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
273282e12b1bSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
273382e12b1bSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
273482e12b1bSmrgfi
273582e12b1bSmrg
273682e12b1bSmrgfound="no"
273782e12b1bSmrgm4_foreach([flag], m4_cdr($@), [
273882e12b1bSmrg	if test $found = "no" ; then
273982e12b1bSmrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
274082e12b1bSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
274182e12b1bSmrg		fi
274282e12b1bSmrg
274382e12b1bSmrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
274482e12b1bSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
274582e12b1bSmrg		fi
274682e12b1bSmrg
274782e12b1bSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
274882e12b1bSmrg
274982e12b1bSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
275082e12b1bSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
275182e12b1bSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
275282e12b1bSmrg		AC_CACHE_VAL($cacheid,
275382e12b1bSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
275482e12b1bSmrg					     [eval $cacheid=yes],
275582e12b1bSmrg					     [eval $cacheid=no])])
275682e12b1bSmrg
275782e12b1bSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
275882e12b1bSmrg
275982e12b1bSmrg		eval supported=\$$cacheid
276082e12b1bSmrg		AC_MSG_RESULT([$supported])
276182e12b1bSmrg		if test "$supported" = "yes" ; then
276282e12b1bSmrg			$1="$$1 ]flag["
276382e12b1bSmrg			found="yes"
276482e12b1bSmrg		fi
276582e12b1bSmrg	fi
276682e12b1bSmrg])
276782e12b1bSmrg]) # XORG_TESTSET_CFLAG
276882e12b1bSmrg
276982e12b1bSmrg# XORG_COMPILER_FLAGS
277082e12b1bSmrg# ---------------
277182e12b1bSmrg# Minimum version: 1.16.0
277282e12b1bSmrg#
277382e12b1bSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
277482e12b1bSmrg# arguments supported by the selected compiler which do NOT alter the generated
277582e12b1bSmrg# code.  These arguments will cause the compiler to print various warnings
277682e12b1bSmrg# during compilation AND turn a conservative set of warnings into errors.
277782e12b1bSmrg#
277882e12b1bSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
277982e12b1bSmrg# future versions of util-macros as options are added to new compilers.
278082e12b1bSmrg#
278182e12b1bSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
278282e12b1bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
278382e12b1bSmrg
278482e12b1bSmrgAC_ARG_ENABLE(selective-werror,
278582e12b1bSmrg              AS_HELP_STRING([--disable-selective-werror],
278682e12b1bSmrg                             [Turn off selective compiler errors. (default: enabled)]),
278782e12b1bSmrg              [SELECTIVE_WERROR=$enableval],
278882e12b1bSmrg              [SELECTIVE_WERROR=yes])
278982e12b1bSmrg
279082e12b1bSmrgAC_LANG_CASE(
279182e12b1bSmrg        [C], [
279282e12b1bSmrg                define([PREFIX], [C])
279382e12b1bSmrg        ],
279482e12b1bSmrg        [C++], [
279582e12b1bSmrg                define([PREFIX], [CXX])
279682e12b1bSmrg        ]
279782e12b1bSmrg)
279882e12b1bSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
279982e12b1bSmrgif test "x$SUNCC" = "xyes"; then
280082e12b1bSmrg    [BASE_]PREFIX[FLAGS]="-v"
280182e12b1bSmrgelse
280282e12b1bSmrg    [BASE_]PREFIX[FLAGS]=""
280382e12b1bSmrgfi
280482e12b1bSmrg
280582e12b1bSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
280682e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
280782e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
280882e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
280982e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
281082e12b1bSmrg
281182e12b1bSmrgAC_LANG_CASE(
281282e12b1bSmrg	[C], [
281382e12b1bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
281482e12b1bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
281582e12b1bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
281682e12b1bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
281782e12b1bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
281882e12b1bSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
281982e12b1bSmrg	]
282082e12b1bSmrg)
282182e12b1bSmrg
282282e12b1bSmrg# This chunk adds additional warnings that could catch undesired effects.
282382e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
282482e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
282582e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
282682e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
282782e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
282882e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
282982e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
283082e12b1bSmrg
283182e12b1bSmrg# These are currently disabled because they are noisy.  They will be enabled
283282e12b1bSmrg# in the future once the codebase is sufficiently modernized to silence
283382e12b1bSmrg# them.  For now, I don't want them to drown out the other warnings.
283482e12b1bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
283582e12b1bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
283682e12b1bSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
283782e12b1bSmrg
283882e12b1bSmrg# Turn some warnings into errors, so we don't accidently get successful builds
283982e12b1bSmrg# when there are problems that should be fixed.
284082e12b1bSmrg
284182e12b1bSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
284282e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
284382e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
284482e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
284582e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
284682e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
284782e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
284882e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
284982e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
285082e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
285182e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
285282e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
285382e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
285482e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
285582e12b1bSmrgelse
285682e12b1bSmrgAC_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])
285782e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
285882e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
285982e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
286082e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
286182e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
286282e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
286382e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
286482e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
286582e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
286682e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
286782e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
286882e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
286982e12b1bSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
287082e12b1bSmrgfi
287182e12b1bSmrg
287282e12b1bSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
287382e12b1bSmrg]) # XORG_COMPILER_FLAGS
287482e12b1bSmrg
287512391620Smrg# XORG_CWARNFLAGS
287612391620Smrg# ---------------
287712391620Smrg# Minimum version: 1.2.0
287882e12b1bSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
287912391620Smrg#
288012391620Smrg# Defines CWARNFLAGS to enable C compiler warnings.
288112391620Smrg#
288282e12b1bSmrg# This function is deprecated because it defines -fno-strict-aliasing
288382e12b1bSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
288482e12b1bSmrg# is needed, then it should be added explicitly in the module when
288582e12b1bSmrg# it is updated to use BASE_CFLAGS.
288682e12b1bSmrg#
288712391620SmrgAC_DEFUN([XORG_CWARNFLAGS], [
288882e12b1bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
288982e12b1bSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
289082e12b1bSmrgAC_LANG_CASE(
289182e12b1bSmrg	[C], [
289282e12b1bSmrg		CWARNFLAGS="$BASE_CFLAGS"
289382e12b1bSmrg		if  test "x$GCC" = xyes ; then
289482e12b1bSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
289582e12b1bSmrg		fi
289682e12b1bSmrg		AC_SUBST(CWARNFLAGS)
289782e12b1bSmrg	]
289882e12b1bSmrg)
289912391620Smrg]) # XORG_CWARNFLAGS
290012391620Smrg
290112391620Smrg# XORG_STRICT_OPTION
290212391620Smrg# -----------------------
290312391620Smrg# Minimum version: 1.3.0
290412391620Smrg#
290582e12b1bSmrg# Add configure option to enable strict compilation flags, such as treating
290682e12b1bSmrg# warnings as fatal errors.
290782e12b1bSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
290882e12b1bSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
290982e12b1bSmrg#
291082e12b1bSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
291182e12b1bSmrg# when strict compilation is unconditionally desired.
291212391620SmrgAC_DEFUN([XORG_STRICT_OPTION], [
291312391620SmrgAC_REQUIRE([XORG_CWARNFLAGS])
291482e12b1bSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
291512391620Smrg
291612391620SmrgAC_ARG_ENABLE(strict-compilation,
291712391620Smrg			  AS_HELP_STRING([--enable-strict-compilation],
291812391620Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
291912391620Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
292082e12b1bSmrg
292182e12b1bSmrgAC_LANG_CASE(
292282e12b1bSmrg        [C], [
292382e12b1bSmrg                define([PREFIX], [C])
292482e12b1bSmrg        ],
292582e12b1bSmrg        [C++], [
292682e12b1bSmrg                define([PREFIX], [CXX])
292782e12b1bSmrg        ]
292882e12b1bSmrg)
292982e12b1bSmrg
293082e12b1bSmrg[STRICT_]PREFIX[FLAGS]=""
293182e12b1bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
293282e12b1bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
293382e12b1bSmrg
293482e12b1bSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
293582e12b1bSmrg# activate it with -Werror, so we add it here explicitly.
293682e12b1bSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
293782e12b1bSmrg
293812391620Smrgif test "x$STRICT_COMPILE" = "xyes"; then
293982e12b1bSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
294082e12b1bSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
294112391620Smrgfi
294282e12b1bSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
294382e12b1bSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
294482e12b1bSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
294512391620Smrg]) # XORG_STRICT_OPTION
294612391620Smrg
294712391620Smrg# XORG_DEFAULT_OPTIONS
294812391620Smrg# --------------------
294912391620Smrg# Minimum version: 1.3.0
295012391620Smrg#
295112391620Smrg# Defines default options for X.Org modules.
295212391620Smrg#
295312391620SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
295412391620SmrgAC_REQUIRE([AC_PROG_INSTALL])
295582e12b1bSmrgXORG_COMPILER_FLAGS
295612391620SmrgXORG_CWARNFLAGS
295712391620SmrgXORG_STRICT_OPTION
295812391620SmrgXORG_RELEASE_VERSION
295912391620SmrgXORG_CHANGELOG
296012391620SmrgXORG_INSTALL
296112391620SmrgXORG_MANPAGE_SECTIONS
296212391620Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
296312391620Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
296412391620Smrg]) # XORG_DEFAULT_OPTIONS
296512391620Smrg
296612391620Smrg# XORG_INSTALL()
296712391620Smrg# ----------------
296812391620Smrg# Minimum version: 1.4.0
296912391620Smrg#
297012391620Smrg# Defines the variable INSTALL_CMD as the command to copy
297112391620Smrg# INSTALL from $prefix/share/util-macros.
297212391620Smrg#
297312391620SmrgAC_DEFUN([XORG_INSTALL], [
297412391620SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
297512391620Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
297612391620SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
297712391620Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
297812391620Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
297912391620Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
298012391620SmrgAC_SUBST([INSTALL_CMD])
298112391620Smrg]) # XORG_INSTALL
298221c2f794Smrgdnl Copyright 2005 Red Hat, Inc
298321c2f794Smrgdnl
298421c2f794Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
298521c2f794Smrgdnl documentation for any purpose is hereby granted without fee, provided that
298621c2f794Smrgdnl the above copyright notice appear in all copies and that both that
298721c2f794Smrgdnl copyright notice and this permission notice appear in supporting
298821c2f794Smrgdnl documentation.
298921c2f794Smrgdnl
299021c2f794Smrgdnl The above copyright notice and this permission notice shall be included
299121c2f794Smrgdnl in all copies or substantial portions of the Software.
299221c2f794Smrgdnl
299321c2f794Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
299421c2f794Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
299521c2f794Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
299621c2f794Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
299721c2f794Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
299821c2f794Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
299921c2f794Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
300021c2f794Smrgdnl
300121c2f794Smrgdnl Except as contained in this notice, the name of the copyright holders shall
300221c2f794Smrgdnl not be used in advertising or otherwise to promote the sale, use or
300321c2f794Smrgdnl other dealings in this Software without prior written authorization
300421c2f794Smrgdnl from the copyright holders.
300521c2f794Smrgdnl
300621c2f794Smrg
300721c2f794Smrg# XORG_RELEASE_VERSION
300821c2f794Smrg# --------------------
300912391620Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
301021c2f794Smrg 
301121c2f794SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
301221c2f794Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
301321c2f794Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
301421c2f794Smrg		[Major version of this package])
301521c2f794Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
301621c2f794Smrg	if test "x$PVM" = "x"; then
301721c2f794Smrg		PVM="0"
301821c2f794Smrg	fi
301921c2f794Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
302021c2f794Smrg		[$PVM],
302121c2f794Smrg		[Minor version of this package])
302221c2f794Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
302321c2f794Smrg	if test "x$PVP" = "x"; then
302421c2f794Smrg		PVP="0"
302521c2f794Smrg	fi
302621c2f794Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
302721c2f794Smrg		[$PVP],
302821c2f794Smrg		[Patch version of this package])
302921c2f794Smrg])
303021c2f794Smrg
303112391620Smrg# XORG_CHANGELOG()
303212391620Smrg# ----------------
303312391620Smrg# Minimum version: 1.2.0
303412391620Smrg#
303512391620Smrg# Defines the variable CHANGELOG_CMD as the command to generate
303612391620Smrg# ChangeLog from git.
303712391620Smrg#
303812391620Smrg#
303912391620SmrgAC_DEFUN([XORG_CHANGELOG], [
304012391620SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
304112391620Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
304212391620Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
304312391620Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
304412391620SmrgAC_SUBST([CHANGELOG_CMD])
304512391620Smrg]) # XORG_CHANGELOG
304612391620Smrg
3047