aclocal.m4 revision eea2e341
108e312fdSmrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
272b4363aSmrg
372b4363aSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4dd77ae96Smrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
572b4363aSmrg# This file is free software; the Free Software Foundation
672b4363aSmrg# gives unlimited permission to copy and/or distribute it,
772b4363aSmrg# with or without modifications, as long as this notice is preserved.
872b4363aSmrg
972b4363aSmrg# This program is distributed in the hope that it will be useful,
1072b4363aSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1172b4363aSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1272b4363aSmrg# PARTICULAR PURPOSE.
1372b4363aSmrg
14dd77ae96Smrgm4_ifndef([AC_AUTOCONF_VERSION],
15dd77ae96Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1608e312fdSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
1708e312fdSmrg[m4_warning([this file was generated for autoconf 2.68.
18dd77ae96SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
19dd77ae96SmrgIf you have problems, you may need to regenerate the build system entirely.
20dd77ae96SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
2172b4363aSmrg
22dd77ae96Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
2372b4363aSmrg#
2472b4363aSmrg# This file is free software; the Free Software Foundation
2572b4363aSmrg# gives unlimited permission to copy and/or distribute it,
2672b4363aSmrg# with or without modifications, as long as this notice is preserved.
2772b4363aSmrg
2872b4363aSmrg# AM_AUTOMAKE_VERSION(VERSION)
2972b4363aSmrg# ----------------------------
3072b4363aSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3172b4363aSmrg# generated from the m4 files accompanying Automake X.Y.
3272b4363aSmrg# (This private macro should not be called outside this file.)
3372b4363aSmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
34dd77ae96Smrg[am__api_version='1.11'
3572b4363aSmrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3672b4363aSmrgdnl require some minimum version.  Point them to the right macro.
3708e312fdSmrgm4_if([$1], [1.11.1], [],
3872b4363aSmrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
3972b4363aSmrg])
4072b4363aSmrg
4172b4363aSmrg# _AM_AUTOCONF_VERSION(VERSION)
4272b4363aSmrg# -----------------------------
4372b4363aSmrg# aclocal traces this macro to find the Autoconf version.
4472b4363aSmrg# This is a private macro too.  Using m4_define simplifies
4572b4363aSmrg# the logic in aclocal, which can simply ignore this definition.
4672b4363aSmrgm4_define([_AM_AUTOCONF_VERSION], [])
4772b4363aSmrg
4872b4363aSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
4972b4363aSmrg# -------------------------------
5072b4363aSmrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
51dd77ae96Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5272b4363aSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5308e312fdSmrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
54dd77ae96Smrgm4_ifndef([AC_AUTOCONF_VERSION],
55dd77ae96Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
56dd77ae96Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5772b4363aSmrg
5872b4363aSmrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
5972b4363aSmrg
6072b4363aSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
6172b4363aSmrg#
6272b4363aSmrg# This file is free software; the Free Software Foundation
6372b4363aSmrg# gives unlimited permission to copy and/or distribute it,
6472b4363aSmrg# with or without modifications, as long as this notice is preserved.
6572b4363aSmrg
6672b4363aSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6772b4363aSmrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
6872b4363aSmrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
6972b4363aSmrg#
7072b4363aSmrg# Of course, Automake must honor this variable whenever it calls a
7172b4363aSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7272b4363aSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7372b4363aSmrg# depending on how configure is run.  This is pretty annoying, since
7472b4363aSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7572b4363aSmrg# source directory, any form will work fine, but in subdirectories a
7672b4363aSmrg# relative path needs to be adjusted first.
7772b4363aSmrg#
7872b4363aSmrg# $ac_aux_dir/missing
7972b4363aSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8072b4363aSmrg# $top_srcdir/$ac_aux_dir/missing
8172b4363aSmrg#    fails if $ac_aux_dir is absolute,
8272b4363aSmrg#    fails when called from a subdirectory in a VPATH build with
8372b4363aSmrg#          a relative $ac_aux_dir
8472b4363aSmrg#
8572b4363aSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8672b4363aSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
8772b4363aSmrg# harmless because $srcdir is `.', but things will broke when you
8872b4363aSmrg# start a VPATH build or use an absolute $srcdir.
8972b4363aSmrg#
9072b4363aSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9172b4363aSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9272b4363aSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9372b4363aSmrg# and then we would define $MISSING as
9472b4363aSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9572b4363aSmrg# This will work as long as MISSING is not called from configure, because
9672b4363aSmrg# unfortunately $(top_srcdir) has no meaning in configure.
9772b4363aSmrg# However there are other variables, like CC, which are often used in
9872b4363aSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
9972b4363aSmrg#
10072b4363aSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
10172b4363aSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
10272b4363aSmrg# configured tree to be moved without reconfiguration.
10372b4363aSmrg
10472b4363aSmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10572b4363aSmrg[dnl Rely on autoconf to set up CDPATH properly.
10672b4363aSmrgAC_PREREQ([2.50])dnl
10772b4363aSmrg# expand $ac_aux_dir to an absolute path
10872b4363aSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
10972b4363aSmrg])
11072b4363aSmrg
11172b4363aSmrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11272b4363aSmrg
113dd77ae96Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
11472b4363aSmrg# Free Software Foundation, Inc.
11572b4363aSmrg#
11672b4363aSmrg# This file is free software; the Free Software Foundation
11772b4363aSmrg# gives unlimited permission to copy and/or distribute it,
11872b4363aSmrg# with or without modifications, as long as this notice is preserved.
11972b4363aSmrg
120dd77ae96Smrg# serial 9
12172b4363aSmrg
12272b4363aSmrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12372b4363aSmrg# -------------------------------------
12472b4363aSmrg# Define a conditional.
12572b4363aSmrgAC_DEFUN([AM_CONDITIONAL],
12672b4363aSmrg[AC_PREREQ(2.52)dnl
12772b4363aSmrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12872b4363aSmrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12972b4363aSmrgAC_SUBST([$1_TRUE])dnl
13072b4363aSmrgAC_SUBST([$1_FALSE])dnl
13172b4363aSmrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
13272b4363aSmrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
133dd77ae96Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13472b4363aSmrgif $2; then
13572b4363aSmrg  $1_TRUE=
13672b4363aSmrg  $1_FALSE='#'
13772b4363aSmrgelse
13872b4363aSmrg  $1_TRUE='#'
13972b4363aSmrg  $1_FALSE=
14072b4363aSmrgfi
14172b4363aSmrgAC_CONFIG_COMMANDS_PRE(
14272b4363aSmrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14372b4363aSmrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14472b4363aSmrgUsually this means the macro was only invoked conditionally.]])
14572b4363aSmrgfi])])
14672b4363aSmrg
147dd77ae96Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
14872b4363aSmrg# Free Software Foundation, Inc.
14972b4363aSmrg#
15072b4363aSmrg# This file is free software; the Free Software Foundation
15172b4363aSmrg# gives unlimited permission to copy and/or distribute it,
15272b4363aSmrg# with or without modifications, as long as this notice is preserved.
15372b4363aSmrg
154dd77ae96Smrg# serial 10
15572b4363aSmrg
15672b4363aSmrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
15772b4363aSmrg# written in clear, in which case automake, when reading aclocal.m4,
15872b4363aSmrg# will think it sees a *use*, and therefore will trigger all it's
15972b4363aSmrg# C support machinery.  Also note that it means that autoscan, seeing
16072b4363aSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
16172b4363aSmrg
16272b4363aSmrg
16372b4363aSmrg# _AM_DEPENDENCIES(NAME)
16472b4363aSmrg# ----------------------
16572b4363aSmrg# See how the compiler implements dependency checking.
16672b4363aSmrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
16772b4363aSmrg# We try a few techniques and use that to set a single cache variable.
16872b4363aSmrg#
16972b4363aSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
17072b4363aSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
17172b4363aSmrg# dependency, and given that the user is not expected to run this macro,
17272b4363aSmrg# just rely on AC_PROG_CC.
17372b4363aSmrgAC_DEFUN([_AM_DEPENDENCIES],
17472b4363aSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17572b4363aSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17672b4363aSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17772b4363aSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17872b4363aSmrg
17972b4363aSmrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
18072b4363aSmrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
18172b4363aSmrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
18272b4363aSmrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
18372b4363aSmrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18472b4363aSmrg                   [depcc="$$1"   am_compiler_list=])
18572b4363aSmrg
18672b4363aSmrgAC_CACHE_CHECK([dependency style of $depcc],
18772b4363aSmrg               [am_cv_$1_dependencies_compiler_type],
18872b4363aSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18972b4363aSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
19072b4363aSmrg  # making bogus files that we don't know about and never remove.  For
19172b4363aSmrg  # instance it was reported that on HP-UX the gcc test will end up
19272b4363aSmrg  # making a dummy file named `D' -- because `-MD' means `put the output
19372b4363aSmrg  # in D'.
19472b4363aSmrg  mkdir conftest.dir
19572b4363aSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19672b4363aSmrg  # using a relative directory.
19772b4363aSmrg  cp "$am_depcomp" conftest.dir
19872b4363aSmrg  cd conftest.dir
19972b4363aSmrg  # We will build objects and dependencies in a subdirectory because
20072b4363aSmrg  # it helps to detect inapplicable dependency modes.  For instance
20172b4363aSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
20272b4363aSmrg  # side effect of compilation, but ICC will put the dependencies in
20372b4363aSmrg  # the current directory while Tru64 will put them in the object
20472b4363aSmrg  # directory.
20572b4363aSmrg  mkdir sub
20672b4363aSmrg
20772b4363aSmrg  am_cv_$1_dependencies_compiler_type=none
20872b4363aSmrg  if test "$am_compiler_list" = ""; then
20972b4363aSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
21072b4363aSmrg  fi
211dd77ae96Smrg  am__universal=false
212dd77ae96Smrg  m4_case([$1], [CC],
213dd77ae96Smrg    [case " $depcc " in #(
214dd77ae96Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
215dd77ae96Smrg     esac],
216dd77ae96Smrg    [CXX],
217dd77ae96Smrg    [case " $depcc " in #(
218dd77ae96Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
219dd77ae96Smrg     esac])
220dd77ae96Smrg
22172b4363aSmrg  for depmode in $am_compiler_list; do
22272b4363aSmrg    # Setup a source with many dependencies, because some compilers
22372b4363aSmrg    # like to wrap large dependency lists on column 80 (with \), and
22472b4363aSmrg    # we should not choose a depcomp mode which is confused by this.
22572b4363aSmrg    #
22672b4363aSmrg    # We need to recreate these files for each test, as the compiler may
22772b4363aSmrg    # overwrite some of them when testing with obscure command lines.
22872b4363aSmrg    # This happens at least with the AIX C compiler.
22972b4363aSmrg    : > sub/conftest.c
23072b4363aSmrg    for i in 1 2 3 4 5 6; do
23172b4363aSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
23272b4363aSmrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
23372b4363aSmrg      # Solaris 8's {/usr,}/bin/sh.
23472b4363aSmrg      touch sub/conftst$i.h
23572b4363aSmrg    done
23672b4363aSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23772b4363aSmrg
238dd77ae96Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
239dd77ae96Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
240dd77ae96Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
241dd77ae96Smrg    # versions had trouble with output in subdirs
242dd77ae96Smrg    am__obj=sub/conftest.${OBJEXT-o}
243dd77ae96Smrg    am__minus_obj="-o $am__obj"
24472b4363aSmrg    case $depmode in
245dd77ae96Smrg    gcc)
246dd77ae96Smrg      # This depmode causes a compiler race in universal mode.
247dd77ae96Smrg      test "$am__universal" = false || continue
248dd77ae96Smrg      ;;
24972b4363aSmrg    nosideeffect)
25072b4363aSmrg      # after this tag, mechanisms are not by side-effect, so they'll
25172b4363aSmrg      # only be used when explicitly requested
25272b4363aSmrg      if test "x$enable_dependency_tracking" = xyes; then
25372b4363aSmrg	continue
25472b4363aSmrg      else
25572b4363aSmrg	break
25672b4363aSmrg      fi
25772b4363aSmrg      ;;
258dd77ae96Smrg    msvisualcpp | msvcmsys)
259dd77ae96Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
260dd77ae96Smrg      # not run yet.  These depmodes are late enough in the game, and
261dd77ae96Smrg      # so weak that their functioning should not be impacted.
262dd77ae96Smrg      am__obj=conftest.${OBJEXT-o}
263dd77ae96Smrg      am__minus_obj=
264dd77ae96Smrg      ;;
26572b4363aSmrg    none) break ;;
26672b4363aSmrg    esac
26772b4363aSmrg    if depmode=$depmode \
268dd77ae96Smrg       source=sub/conftest.c object=$am__obj \
26972b4363aSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
270dd77ae96Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
27172b4363aSmrg         >/dev/null 2>conftest.err &&
27272b4363aSmrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27372b4363aSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
274dd77ae96Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27572b4363aSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27672b4363aSmrg      # icc doesn't choke on unknown options, it will just issue warnings
27772b4363aSmrg      # or remarks (even with -Werror).  So we grep stderr for any message
27872b4363aSmrg      # that says an option was ignored or not supported.
27972b4363aSmrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
28072b4363aSmrg      #   icc: Command line warning: ignoring option '-M'; no argument required
28172b4363aSmrg      # The diagnosis changed in icc 8.0:
28272b4363aSmrg      #   icc: Command line remark: option '-MP' not supported
28372b4363aSmrg      if (grep 'ignoring option' conftest.err ||
28472b4363aSmrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28572b4363aSmrg        am_cv_$1_dependencies_compiler_type=$depmode
28672b4363aSmrg        break
28772b4363aSmrg      fi
28872b4363aSmrg    fi
28972b4363aSmrg  done
29072b4363aSmrg
29172b4363aSmrg  cd ..
29272b4363aSmrg  rm -rf conftest.dir
29372b4363aSmrgelse
29472b4363aSmrg  am_cv_$1_dependencies_compiler_type=none
29572b4363aSmrgfi
29672b4363aSmrg])
29772b4363aSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29872b4363aSmrgAM_CONDITIONAL([am__fastdep$1], [
29972b4363aSmrg  test "x$enable_dependency_tracking" != xno \
30072b4363aSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
30172b4363aSmrg])
30272b4363aSmrg
30372b4363aSmrg
30472b4363aSmrg# AM_SET_DEPDIR
30572b4363aSmrg# -------------
30672b4363aSmrg# Choose a directory name for dependency files.
30772b4363aSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
30872b4363aSmrgAC_DEFUN([AM_SET_DEPDIR],
30972b4363aSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
31072b4363aSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
31172b4363aSmrg])
31272b4363aSmrg
31372b4363aSmrg
31472b4363aSmrg# AM_DEP_TRACK
31572b4363aSmrg# ------------
31672b4363aSmrgAC_DEFUN([AM_DEP_TRACK],
31772b4363aSmrg[AC_ARG_ENABLE(dependency-tracking,
31872b4363aSmrg[  --disable-dependency-tracking  speeds up one-time build
31972b4363aSmrg  --enable-dependency-tracking   do not reject slow dependency extractors])
32072b4363aSmrgif test "x$enable_dependency_tracking" != xno; then
32172b4363aSmrg  am_depcomp="$ac_aux_dir/depcomp"
32272b4363aSmrg  AMDEPBACKSLASH='\'
32372b4363aSmrgfi
32472b4363aSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32572b4363aSmrgAC_SUBST([AMDEPBACKSLASH])dnl
32672b4363aSmrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32772b4363aSmrg])
32872b4363aSmrg
32972b4363aSmrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33072b4363aSmrg
331dd77ae96Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
33272b4363aSmrg# Free Software Foundation, Inc.
33372b4363aSmrg#
33472b4363aSmrg# This file is free software; the Free Software Foundation
33572b4363aSmrg# gives unlimited permission to copy and/or distribute it,
33672b4363aSmrg# with or without modifications, as long as this notice is preserved.
33772b4363aSmrg
338dd77ae96Smrg#serial 5
33972b4363aSmrg
34072b4363aSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34172b4363aSmrg# ------------------------------
34272b4363aSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
343dd77ae96Smrg[{
344dd77ae96Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
345dd77ae96Smrg  # are listed without --file.  Let's play safe and only enable the eval
346dd77ae96Smrg  # if we detect the quoting.
347dd77ae96Smrg  case $CONFIG_FILES in
348dd77ae96Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
349dd77ae96Smrg  *)   set x $CONFIG_FILES ;;
350dd77ae96Smrg  esac
351dd77ae96Smrg  shift
352dd77ae96Smrg  for mf
353dd77ae96Smrg  do
354dd77ae96Smrg    # Strip MF so we end up with the name of the file.
355dd77ae96Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
356dd77ae96Smrg    # Check whether this is an Automake generated Makefile or not.
357dd77ae96Smrg    # We used to match only the files named `Makefile.in', but
358dd77ae96Smrg    # some people rename them; so instead we look at the file content.
359dd77ae96Smrg    # Grep'ing the first line is not enough: some people post-process
360dd77ae96Smrg    # each Makefile.in and add a new line on top of each file to say so.
361dd77ae96Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
362dd77ae96Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
363dd77ae96Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
364dd77ae96Smrg      dirpart=`AS_DIRNAME("$mf")`
365dd77ae96Smrg    else
366dd77ae96Smrg      continue
367dd77ae96Smrg    fi
368dd77ae96Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
369dd77ae96Smrg    # from the Makefile without running `make'.
370dd77ae96Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
371dd77ae96Smrg    test -z "$DEPDIR" && continue
372dd77ae96Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
373dd77ae96Smrg    test -z "am__include" && continue
374dd77ae96Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
375dd77ae96Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
376dd77ae96Smrg    U=`sed -n 's/^U = //p' < "$mf"`
377dd77ae96Smrg    # Find all dependency output files, they are included files with
378dd77ae96Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379dd77ae96Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380dd77ae96Smrg    # expansion.
381dd77ae96Smrg    for file in `sed -n "
382dd77ae96Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
383dd77ae96Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
384dd77ae96Smrg      # Make sure the directory exists.
385dd77ae96Smrg      test -f "$dirpart/$file" && continue
386dd77ae96Smrg      fdir=`AS_DIRNAME(["$file"])`
387dd77ae96Smrg      AS_MKDIR_P([$dirpart/$fdir])
388dd77ae96Smrg      # echo "creating $dirpart/$file"
389dd77ae96Smrg      echo '# dummy' > "$dirpart/$file"
390dd77ae96Smrg    done
39172b4363aSmrg  done
392dd77ae96Smrg}
39372b4363aSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
39472b4363aSmrg
39572b4363aSmrg
39672b4363aSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39772b4363aSmrg# -----------------------------
39872b4363aSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
39972b4363aSmrg#
40072b4363aSmrg# This code is only required when automatic dependency tracking
40172b4363aSmrg# is enabled.  FIXME.  This creates each `.P' file that we will
40272b4363aSmrg# need in order to bootstrap the dependency handling code.
40372b4363aSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
40472b4363aSmrg[AC_CONFIG_COMMANDS([depfiles],
40572b4363aSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
40672b4363aSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
40772b4363aSmrg])
40872b4363aSmrg
40972b4363aSmrg# Do all the work for Automake.                             -*- Autoconf -*-
41072b4363aSmrg
41172b4363aSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
412dd77ae96Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
41372b4363aSmrg#
41472b4363aSmrg# This file is free software; the Free Software Foundation
41572b4363aSmrg# gives unlimited permission to copy and/or distribute it,
41672b4363aSmrg# with or without modifications, as long as this notice is preserved.
41772b4363aSmrg
418dd77ae96Smrg# serial 16
41972b4363aSmrg
42072b4363aSmrg# This macro actually does too much.  Some checks are only needed if
42172b4363aSmrg# your package does certain things.  But this isn't really a big deal.
42272b4363aSmrg
42372b4363aSmrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
42472b4363aSmrg# AM_INIT_AUTOMAKE([OPTIONS])
42572b4363aSmrg# -----------------------------------------------
42672b4363aSmrg# The call with PACKAGE and VERSION arguments is the old style
42772b4363aSmrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42872b4363aSmrg# and VERSION should now be passed to AC_INIT and removed from
42972b4363aSmrg# the call to AM_INIT_AUTOMAKE.
43072b4363aSmrg# We support both call styles for the transition.  After
43172b4363aSmrg# the next Automake release, Autoconf can make the AC_INIT
43272b4363aSmrg# arguments mandatory, and then we can depend on a new Autoconf
43372b4363aSmrg# release and drop the old call support.
43472b4363aSmrgAC_DEFUN([AM_INIT_AUTOMAKE],
435dd77ae96Smrg[AC_PREREQ([2.62])dnl
43672b4363aSmrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43772b4363aSmrgdnl the ones we care about.
43872b4363aSmrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43972b4363aSmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
44072b4363aSmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44172b4363aSmrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44272b4363aSmrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44372b4363aSmrg  # is not polluted with repeated "-I."
44472b4363aSmrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44572b4363aSmrg  # test to see if srcdir already configured
44672b4363aSmrg  if test -f $srcdir/config.status; then
44772b4363aSmrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44872b4363aSmrg  fi
44972b4363aSmrgfi
45072b4363aSmrg
45172b4363aSmrg# test whether we have cygpath
45272b4363aSmrgif test -z "$CYGPATH_W"; then
45372b4363aSmrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45472b4363aSmrg    CYGPATH_W='cygpath -w'
45572b4363aSmrg  else
45672b4363aSmrg    CYGPATH_W=echo
45772b4363aSmrg  fi
45872b4363aSmrgfi
45972b4363aSmrgAC_SUBST([CYGPATH_W])
46072b4363aSmrg
46172b4363aSmrg# Define the identity of the package.
46272b4363aSmrgdnl Distinguish between old-style and new-style calls.
46372b4363aSmrgm4_ifval([$2],
46472b4363aSmrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46572b4363aSmrg AC_SUBST([PACKAGE], [$1])dnl
46672b4363aSmrg AC_SUBST([VERSION], [$2])],
46772b4363aSmrg[_AM_SET_OPTIONS([$1])dnl
46872b4363aSmrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
46972b4363aSmrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
47072b4363aSmrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47172b4363aSmrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47272b4363aSmrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
47372b4363aSmrg
47472b4363aSmrg_AM_IF_OPTION([no-define],,
47572b4363aSmrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
47672b4363aSmrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
47772b4363aSmrg
47872b4363aSmrg# Some tools Automake needs.
47972b4363aSmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48072b4363aSmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48172b4363aSmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
48272b4363aSmrgAM_MISSING_PROG(AUTOCONF, autoconf)
48372b4363aSmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
48472b4363aSmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
48572b4363aSmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
486dd77ae96SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
487dd77ae96SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
48872b4363aSmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
48972b4363aSmrg# We need awk for the "check" target.  The system "awk" is bad on
49072b4363aSmrg# some platforms.
49172b4363aSmrgAC_REQUIRE([AC_PROG_AWK])dnl
49272b4363aSmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
49372b4363aSmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
49472b4363aSmrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
495dd77ae96Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
496dd77ae96Smrg			     [_AM_PROG_TAR([v7])])])
49772b4363aSmrg_AM_IF_OPTION([no-dependencies],,
49872b4363aSmrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
499dd77ae96Smrg		  [_AM_DEPENDENCIES(CC)],
500dd77ae96Smrg		  [define([AC_PROG_CC],
501dd77ae96Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
50272b4363aSmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
503dd77ae96Smrg		  [_AM_DEPENDENCIES(CXX)],
504dd77ae96Smrg		  [define([AC_PROG_CXX],
505dd77ae96Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
50672b4363aSmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
507dd77ae96Smrg		  [_AM_DEPENDENCIES(OBJC)],
508dd77ae96Smrg		  [define([AC_PROG_OBJC],
509dd77ae96Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
51072b4363aSmrg])
511dd77ae96Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
512dd77ae96Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
513dd77ae96Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
514dd77ae96Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
515dd77ae96SmrgAC_CONFIG_COMMANDS_PRE(dnl
516dd77ae96Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
517dd77ae96Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
51872b4363aSmrg])
51972b4363aSmrg
520dd77ae96Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
521dd77ae96Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
522dd77ae96Smrgdnl mangled by Autoconf and run in a shell conditional statement.
523dd77ae96Smrgm4_define([_AC_COMPILER_EXEEXT],
524dd77ae96Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
525dd77ae96Smrg
52672b4363aSmrg
52772b4363aSmrg# When config.status generates a header, we must update the stamp-h file.
52872b4363aSmrg# This file resides in the same directory as the config header
52972b4363aSmrg# that is generated.  The stamp files are numbered to have different names.
53072b4363aSmrg
53172b4363aSmrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
53272b4363aSmrg# loop where config.status creates the headers, so we can generate
53372b4363aSmrg# our stamp files there.
53472b4363aSmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
53572b4363aSmrg[# Compute $1's index in $config_headers.
536dd77ae96Smrg_am_arg=$1
53772b4363aSmrg_am_stamp_count=1
53872b4363aSmrgfor _am_header in $config_headers :; do
53972b4363aSmrg  case $_am_header in
540dd77ae96Smrg    $_am_arg | $_am_arg:* )
54172b4363aSmrg      break ;;
54272b4363aSmrg    * )
54372b4363aSmrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
54472b4363aSmrg  esac
54572b4363aSmrgdone
546dd77ae96Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
54772b4363aSmrg
548dd77ae96Smrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
54972b4363aSmrg#
55072b4363aSmrg# This file is free software; the Free Software Foundation
55172b4363aSmrg# gives unlimited permission to copy and/or distribute it,
55272b4363aSmrg# with or without modifications, as long as this notice is preserved.
55372b4363aSmrg
55472b4363aSmrg# AM_PROG_INSTALL_SH
55572b4363aSmrg# ------------------
55672b4363aSmrg# Define $install_sh.
55772b4363aSmrgAC_DEFUN([AM_PROG_INSTALL_SH],
55872b4363aSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
559dd77ae96Smrgif test x"${install_sh}" != xset; then
560dd77ae96Smrg  case $am_aux_dir in
561dd77ae96Smrg  *\ * | *\	*)
562dd77ae96Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
563dd77ae96Smrg  *)
564dd77ae96Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
565dd77ae96Smrg  esac
566dd77ae96Smrgfi
56772b4363aSmrgAC_SUBST(install_sh)])
56872b4363aSmrg
56972b4363aSmrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
57072b4363aSmrg#
57172b4363aSmrg# This file is free software; the Free Software Foundation
57272b4363aSmrg# gives unlimited permission to copy and/or distribute it,
57372b4363aSmrg# with or without modifications, as long as this notice is preserved.
57472b4363aSmrg
57572b4363aSmrg# serial 2
57672b4363aSmrg
57772b4363aSmrg# Check whether the underlying file-system supports filenames
57872b4363aSmrg# with a leading dot.  For instance MS-DOS doesn't.
57972b4363aSmrgAC_DEFUN([AM_SET_LEADING_DOT],
58072b4363aSmrg[rm -rf .tst 2>/dev/null
58172b4363aSmrgmkdir .tst 2>/dev/null
58272b4363aSmrgif test -d .tst; then
58372b4363aSmrg  am__leading_dot=.
58472b4363aSmrgelse
58572b4363aSmrg  am__leading_dot=_
58672b4363aSmrgfi
58772b4363aSmrgrmdir .tst 2>/dev/null
58872b4363aSmrgAC_SUBST([am__leading_dot])])
58972b4363aSmrg
59072b4363aSmrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
59172b4363aSmrg# From Jim Meyering
59272b4363aSmrg
593dd77ae96Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
59472b4363aSmrg# Free Software Foundation, Inc.
59572b4363aSmrg#
59672b4363aSmrg# This file is free software; the Free Software Foundation
59772b4363aSmrg# gives unlimited permission to copy and/or distribute it,
59872b4363aSmrg# with or without modifications, as long as this notice is preserved.
59972b4363aSmrg
600dd77ae96Smrg# serial 5
60172b4363aSmrg
602dd77ae96Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
603dd77ae96Smrg# ----------------------------------
604dd77ae96Smrg# Control maintainer-specific portions of Makefiles.
605dd77ae96Smrg# Default is to disable them, unless `enable' is passed literally.
606dd77ae96Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
607dd77ae96Smrg# can override the default with the --enable/--disable switch.
60872b4363aSmrgAC_DEFUN([AM_MAINTAINER_MODE],
609dd77ae96Smrg[m4_case(m4_default([$1], [disable]),
610dd77ae96Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
611dd77ae96Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
612dd77ae96Smrg       [m4_define([am_maintainer_other], [enable])
613dd77ae96Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
614dd77ae96SmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
615dd77ae96Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
616dd77ae96Smrg  AC_ARG_ENABLE([maintainer-mode],
617dd77ae96Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
61872b4363aSmrg			  (and sometimes confusing) to the casual installer],
619dd77ae96Smrg      [USE_MAINTAINER_MODE=$enableval],
620dd77ae96Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
62172b4363aSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
622dd77ae96Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
62372b4363aSmrg  MAINT=$MAINTAINER_MODE_TRUE
624dd77ae96Smrg  AC_SUBST([MAINT])dnl
62572b4363aSmrg]
62672b4363aSmrg)
62772b4363aSmrg
62872b4363aSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
62972b4363aSmrg
63072b4363aSmrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
63172b4363aSmrg
632dd77ae96Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
63372b4363aSmrg#
63472b4363aSmrg# This file is free software; the Free Software Foundation
63572b4363aSmrg# gives unlimited permission to copy and/or distribute it,
63672b4363aSmrg# with or without modifications, as long as this notice is preserved.
63772b4363aSmrg
638dd77ae96Smrg# serial 4
63972b4363aSmrg
64072b4363aSmrg# AM_MAKE_INCLUDE()
64172b4363aSmrg# -----------------
64272b4363aSmrg# Check to see how make treats includes.
64372b4363aSmrgAC_DEFUN([AM_MAKE_INCLUDE],
64472b4363aSmrg[am_make=${MAKE-make}
64572b4363aSmrgcat > confinc << 'END'
64672b4363aSmrgam__doit:
647dd77ae96Smrg	@echo this is the am__doit target
64872b4363aSmrg.PHONY: am__doit
64972b4363aSmrgEND
65072b4363aSmrg# If we don't find an include directive, just comment out the code.
65172b4363aSmrgAC_MSG_CHECKING([for style of include used by $am_make])
65272b4363aSmrgam__include="#"
65372b4363aSmrgam__quote=
65472b4363aSmrg_am_result=none
65572b4363aSmrg# First try GNU make style include.
65672b4363aSmrgecho "include confinc" > confmf
657dd77ae96Smrg# Ignore all kinds of additional output from `make'.
658dd77ae96Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
659dd77ae96Smrg*the\ am__doit\ target*)
660dd77ae96Smrg  am__include=include
661dd77ae96Smrg  am__quote=
662dd77ae96Smrg  _am_result=GNU
663dd77ae96Smrg  ;;
664dd77ae96Smrgesac
66572b4363aSmrg# Now try BSD make style include.
66672b4363aSmrgif test "$am__include" = "#"; then
66772b4363aSmrg   echo '.include "confinc"' > confmf
668dd77ae96Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
669dd77ae96Smrg   *the\ am__doit\ target*)
670dd77ae96Smrg     am__include=.include
671dd77ae96Smrg     am__quote="\""
672dd77ae96Smrg     _am_result=BSD
673dd77ae96Smrg     ;;
674dd77ae96Smrg   esac
67572b4363aSmrgfi
67672b4363aSmrgAC_SUBST([am__include])
67772b4363aSmrgAC_SUBST([am__quote])
67872b4363aSmrgAC_MSG_RESULT([$_am_result])
67972b4363aSmrgrm -f confinc confmf
68072b4363aSmrg])
68172b4363aSmrg
68272b4363aSmrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
68372b4363aSmrg
684dd77ae96Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
68572b4363aSmrg# Free Software Foundation, Inc.
68672b4363aSmrg#
68772b4363aSmrg# This file is free software; the Free Software Foundation
68872b4363aSmrg# gives unlimited permission to copy and/or distribute it,
68972b4363aSmrg# with or without modifications, as long as this notice is preserved.
69072b4363aSmrg
691dd77ae96Smrg# serial 6
69272b4363aSmrg
69372b4363aSmrg# AM_MISSING_PROG(NAME, PROGRAM)
69472b4363aSmrg# ------------------------------
69572b4363aSmrgAC_DEFUN([AM_MISSING_PROG],
69672b4363aSmrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
69772b4363aSmrg$1=${$1-"${am_missing_run}$2"}
69872b4363aSmrgAC_SUBST($1)])
69972b4363aSmrg
70072b4363aSmrg
70172b4363aSmrg# AM_MISSING_HAS_RUN
70272b4363aSmrg# ------------------
70372b4363aSmrg# Define MISSING if not defined so far and test if it supports --run.
70472b4363aSmrg# If it does, set am_missing_run to use it, otherwise, to nothing.
70572b4363aSmrgAC_DEFUN([AM_MISSING_HAS_RUN],
70672b4363aSmrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
70772b4363aSmrgAC_REQUIRE_AUX_FILE([missing])dnl
708dd77ae96Smrgif test x"${MISSING+set}" != xset; then
709dd77ae96Smrg  case $am_aux_dir in
710dd77ae96Smrg  *\ * | *\	*)
711dd77ae96Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
712dd77ae96Smrg  *)
713dd77ae96Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
714dd77ae96Smrg  esac
715dd77ae96Smrgfi
71672b4363aSmrg# Use eval to expand $SHELL
71772b4363aSmrgif eval "$MISSING --run true"; then
71872b4363aSmrg  am_missing_run="$MISSING --run "
71972b4363aSmrgelse
72072b4363aSmrg  am_missing_run=
72172b4363aSmrg  AC_MSG_WARN([`missing' script is too old or missing])
72272b4363aSmrgfi
72372b4363aSmrg])
72472b4363aSmrg
72572b4363aSmrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
72672b4363aSmrg#
72772b4363aSmrg# This file is free software; the Free Software Foundation
72872b4363aSmrg# gives unlimited permission to copy and/or distribute it,
72972b4363aSmrg# with or without modifications, as long as this notice is preserved.
73072b4363aSmrg
73172b4363aSmrg# AM_PROG_MKDIR_P
73272b4363aSmrg# ---------------
73372b4363aSmrg# Check for `mkdir -p'.
73472b4363aSmrgAC_DEFUN([AM_PROG_MKDIR_P],
73572b4363aSmrg[AC_PREREQ([2.60])dnl
73672b4363aSmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
73772b4363aSmrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
73872b4363aSmrgdnl while keeping a definition of mkdir_p for backward compatibility.
73972b4363aSmrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
74072b4363aSmrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
74172b4363aSmrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
74272b4363aSmrgdnl adjustment using top_builddir (which is defined more often than
74372b4363aSmrgdnl MKDIR_P).
74472b4363aSmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
74572b4363aSmrgcase $mkdir_p in
74672b4363aSmrg  [[\\/$]]* | ?:[[\\/]]*) ;;
74772b4363aSmrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
74872b4363aSmrgesac
74972b4363aSmrg])
75072b4363aSmrg
75172b4363aSmrg# Helper functions for option handling.                     -*- Autoconf -*-
75272b4363aSmrg
753dd77ae96Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
75472b4363aSmrg#
75572b4363aSmrg# This file is free software; the Free Software Foundation
75672b4363aSmrg# gives unlimited permission to copy and/or distribute it,
75772b4363aSmrg# with or without modifications, as long as this notice is preserved.
75872b4363aSmrg
759dd77ae96Smrg# serial 4
76072b4363aSmrg
76172b4363aSmrg# _AM_MANGLE_OPTION(NAME)
76272b4363aSmrg# -----------------------
76372b4363aSmrgAC_DEFUN([_AM_MANGLE_OPTION],
76472b4363aSmrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
76572b4363aSmrg
76672b4363aSmrg# _AM_SET_OPTION(NAME)
76772b4363aSmrg# ------------------------------
76872b4363aSmrg# Set option NAME.  Presently that only means defining a flag for this option.
76972b4363aSmrgAC_DEFUN([_AM_SET_OPTION],
77072b4363aSmrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
77172b4363aSmrg
77272b4363aSmrg# _AM_SET_OPTIONS(OPTIONS)
77372b4363aSmrg# ----------------------------------
77472b4363aSmrg# OPTIONS is a space-separated list of Automake options.
77572b4363aSmrgAC_DEFUN([_AM_SET_OPTIONS],
776dd77ae96Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
77772b4363aSmrg
77872b4363aSmrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
77972b4363aSmrg# -------------------------------------------
78072b4363aSmrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
78172b4363aSmrgAC_DEFUN([_AM_IF_OPTION],
78272b4363aSmrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
78372b4363aSmrg
78472b4363aSmrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
78572b4363aSmrg
786dd77ae96Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
78772b4363aSmrg# Free Software Foundation, Inc.
78872b4363aSmrg#
78972b4363aSmrg# This file is free software; the Free Software Foundation
79072b4363aSmrg# gives unlimited permission to copy and/or distribute it,
79172b4363aSmrg# with or without modifications, as long as this notice is preserved.
79272b4363aSmrg
793dd77ae96Smrg# serial 5
79472b4363aSmrg
79572b4363aSmrg# AM_SANITY_CHECK
79672b4363aSmrg# ---------------
79772b4363aSmrgAC_DEFUN([AM_SANITY_CHECK],
79872b4363aSmrg[AC_MSG_CHECKING([whether build environment is sane])
79972b4363aSmrg# Just in case
80072b4363aSmrgsleep 1
80172b4363aSmrgecho timestamp > conftest.file
802dd77ae96Smrg# Reject unsafe characters in $srcdir or the absolute working directory
803dd77ae96Smrg# name.  Accept space and tab only in the latter.
804dd77ae96Smrgam_lf='
805dd77ae96Smrg'
806dd77ae96Smrgcase `pwd` in
807dd77ae96Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
808dd77ae96Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
809dd77ae96Smrgesac
810dd77ae96Smrgcase $srcdir in
811dd77ae96Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
812dd77ae96Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
813dd77ae96Smrgesac
814dd77ae96Smrg
81572b4363aSmrg# Do `set' in a subshell so we don't clobber the current shell's
81672b4363aSmrg# arguments.  Must try -L first in case configure is actually a
81772b4363aSmrg# symlink; some systems play weird games with the mod time of symlinks
81872b4363aSmrg# (eg FreeBSD returns the mod time of the symlink's containing
81972b4363aSmrg# directory).
82072b4363aSmrgif (
821dd77ae96Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
82272b4363aSmrg   if test "$[*]" = "X"; then
82372b4363aSmrg      # -L didn't work.
824dd77ae96Smrg      set X `ls -t "$srcdir/configure" conftest.file`
82572b4363aSmrg   fi
82672b4363aSmrg   rm -f conftest.file
82772b4363aSmrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
82872b4363aSmrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
82972b4363aSmrg
83072b4363aSmrg      # If neither matched, then we have a broken ls.  This can happen
83172b4363aSmrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
83272b4363aSmrg      # broken ls alias from the environment.  This has actually
83372b4363aSmrg      # happened.  Such a system could not be considered "sane".
83472b4363aSmrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
83572b4363aSmrgalias in your environment])
83672b4363aSmrg   fi
83772b4363aSmrg
83872b4363aSmrg   test "$[2]" = conftest.file
83972b4363aSmrg   )
84072b4363aSmrgthen
84172b4363aSmrg   # Ok.
84272b4363aSmrg   :
84372b4363aSmrgelse
84472b4363aSmrg   AC_MSG_ERROR([newly created file is older than distributed files!
84572b4363aSmrgCheck your system clock])
84672b4363aSmrgfi
84772b4363aSmrgAC_MSG_RESULT(yes)])
84872b4363aSmrg
849dd77ae96Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
850dd77ae96Smrg#
851dd77ae96Smrg# This file is free software; the Free Software Foundation
852dd77ae96Smrg# gives unlimited permission to copy and/or distribute it,
853dd77ae96Smrg# with or without modifications, as long as this notice is preserved.
854dd77ae96Smrg
855dd77ae96Smrg# serial 1
856dd77ae96Smrg
857dd77ae96Smrg# AM_SILENT_RULES([DEFAULT])
858dd77ae96Smrg# --------------------------
859dd77ae96Smrg# Enable less verbose build rules; with the default set to DEFAULT
860dd77ae96Smrg# (`yes' being less verbose, `no' or empty being verbose).
861dd77ae96SmrgAC_DEFUN([AM_SILENT_RULES],
862dd77ae96Smrg[AC_ARG_ENABLE([silent-rules],
863dd77ae96Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
864dd77ae96Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
865dd77ae96Smrgcase $enable_silent_rules in
866dd77ae96Smrgyes) AM_DEFAULT_VERBOSITY=0;;
867dd77ae96Smrgno)  AM_DEFAULT_VERBOSITY=1;;
868dd77ae96Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
869dd77ae96Smrgesac
870dd77ae96SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
871dd77ae96SmrgAM_BACKSLASH='\'
872dd77ae96SmrgAC_SUBST([AM_BACKSLASH])dnl
873dd77ae96Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
874dd77ae96Smrg])
875dd77ae96Smrg
87672b4363aSmrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
87772b4363aSmrg#
87872b4363aSmrg# This file is free software; the Free Software Foundation
87972b4363aSmrg# gives unlimited permission to copy and/or distribute it,
88072b4363aSmrg# with or without modifications, as long as this notice is preserved.
88172b4363aSmrg
88272b4363aSmrg# AM_PROG_INSTALL_STRIP
88372b4363aSmrg# ---------------------
88472b4363aSmrg# One issue with vendor `install' (even GNU) is that you can't
88572b4363aSmrg# specify the program used to strip binaries.  This is especially
88672b4363aSmrg# annoying in cross-compiling environments, where the build's strip
88772b4363aSmrg# is unlikely to handle the host's binaries.
88872b4363aSmrg# Fortunately install-sh will honor a STRIPPROG variable, so we
88972b4363aSmrg# always use install-sh in `make install-strip', and initialize
89072b4363aSmrg# STRIPPROG with the value of the STRIP variable (set by the user).
89172b4363aSmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
89272b4363aSmrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
89372b4363aSmrg# Installed binaries are usually stripped using `strip' when the user
89472b4363aSmrg# run `make install-strip'.  However `strip' might not be the right
89572b4363aSmrg# tool to use in cross-compilation environments, therefore Automake
89672b4363aSmrg# will honor the `STRIP' environment variable to overrule this program.
89772b4363aSmrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
89872b4363aSmrgif test "$cross_compiling" != no; then
89972b4363aSmrg  AC_CHECK_TOOL([STRIP], [strip], :)
90072b4363aSmrgfi
90172b4363aSmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
90272b4363aSmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
90372b4363aSmrg
904dd77ae96Smrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
90572b4363aSmrg#
90672b4363aSmrg# This file is free software; the Free Software Foundation
90772b4363aSmrg# gives unlimited permission to copy and/or distribute it,
90872b4363aSmrg# with or without modifications, as long as this notice is preserved.
90972b4363aSmrg
910dd77ae96Smrg# serial 2
911dd77ae96Smrg
91272b4363aSmrg# _AM_SUBST_NOTMAKE(VARIABLE)
91372b4363aSmrg# ---------------------------
914dd77ae96Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
91572b4363aSmrg# This macro is traced by Automake.
91672b4363aSmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
91772b4363aSmrg
918dd77ae96Smrg# AM_SUBST_NOTMAKE(VARIABLE)
919dd77ae96Smrg# ---------------------------
920dd77ae96Smrg# Public sister of _AM_SUBST_NOTMAKE.
921dd77ae96SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
922dd77ae96Smrg
92372b4363aSmrg# Check how to create a tarball.                            -*- Autoconf -*-
92472b4363aSmrg
92572b4363aSmrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
92672b4363aSmrg#
92772b4363aSmrg# This file is free software; the Free Software Foundation
92872b4363aSmrg# gives unlimited permission to copy and/or distribute it,
92972b4363aSmrg# with or without modifications, as long as this notice is preserved.
93072b4363aSmrg
93172b4363aSmrg# serial 2
93272b4363aSmrg
93372b4363aSmrg# _AM_PROG_TAR(FORMAT)
93472b4363aSmrg# --------------------
93572b4363aSmrg# Check how to create a tarball in format FORMAT.
93672b4363aSmrg# FORMAT should be one of `v7', `ustar', or `pax'.
93772b4363aSmrg#
93872b4363aSmrg# Substitute a variable $(am__tar) that is a command
93972b4363aSmrg# writing to stdout a FORMAT-tarball containing the directory
94072b4363aSmrg# $tardir.
94172b4363aSmrg#     tardir=directory && $(am__tar) > result.tar
94272b4363aSmrg#
94372b4363aSmrg# Substitute a variable $(am__untar) that extract such
94472b4363aSmrg# a tarball read from stdin.
94572b4363aSmrg#     $(am__untar) < result.tar
94672b4363aSmrgAC_DEFUN([_AM_PROG_TAR],
94772b4363aSmrg[# Always define AMTAR for backward compatibility.
94872b4363aSmrgAM_MISSING_PROG([AMTAR], [tar])
94972b4363aSmrgm4_if([$1], [v7],
95072b4363aSmrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
95172b4363aSmrg     [m4_case([$1], [ustar],, [pax],,
95272b4363aSmrg              [m4_fatal([Unknown tar format])])
95372b4363aSmrgAC_MSG_CHECKING([how to create a $1 tar archive])
95472b4363aSmrg# Loop over all known methods to create a tar archive until one works.
95572b4363aSmrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
95672b4363aSmrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
95772b4363aSmrg# Do not fold the above two line into one, because Tru64 sh and
95872b4363aSmrg# Solaris sh will not grok spaces in the rhs of `-'.
95972b4363aSmrgfor _am_tool in $_am_tools
96072b4363aSmrgdo
96172b4363aSmrg  case $_am_tool in
96272b4363aSmrg  gnutar)
96372b4363aSmrg    for _am_tar in tar gnutar gtar;
96472b4363aSmrg    do
96572b4363aSmrg      AM_RUN_LOG([$_am_tar --version]) && break
96672b4363aSmrg    done
96772b4363aSmrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
96872b4363aSmrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
96972b4363aSmrg    am__untar="$_am_tar -xf -"
97072b4363aSmrg    ;;
97172b4363aSmrg  plaintar)
97272b4363aSmrg    # Must skip GNU tar: if it does not support --format= it doesn't create
97372b4363aSmrg    # ustar tarball either.
97472b4363aSmrg    (tar --version) >/dev/null 2>&1 && continue
97572b4363aSmrg    am__tar='tar chf - "$$tardir"'
97672b4363aSmrg    am__tar_='tar chf - "$tardir"'
97772b4363aSmrg    am__untar='tar xf -'
97872b4363aSmrg    ;;
97972b4363aSmrg  pax)
98072b4363aSmrg    am__tar='pax -L -x $1 -w "$$tardir"'
98172b4363aSmrg    am__tar_='pax -L -x $1 -w "$tardir"'
98272b4363aSmrg    am__untar='pax -r'
98372b4363aSmrg    ;;
98472b4363aSmrg  cpio)
98572b4363aSmrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
98672b4363aSmrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
98772b4363aSmrg    am__untar='cpio -i -H $1 -d'
98872b4363aSmrg    ;;
98972b4363aSmrg  none)
99072b4363aSmrg    am__tar=false
99172b4363aSmrg    am__tar_=false
99272b4363aSmrg    am__untar=false
99372b4363aSmrg    ;;
99472b4363aSmrg  esac
99572b4363aSmrg
99672b4363aSmrg  # If the value was cached, stop now.  We just wanted to have am__tar
99772b4363aSmrg  # and am__untar set.
99872b4363aSmrg  test -n "${am_cv_prog_tar_$1}" && break
99972b4363aSmrg
100072b4363aSmrg  # tar/untar a dummy directory, and stop if the command works
100172b4363aSmrg  rm -rf conftest.dir
100272b4363aSmrg  mkdir conftest.dir
100372b4363aSmrg  echo GrepMe > conftest.dir/file
100472b4363aSmrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
100572b4363aSmrg  rm -rf conftest.dir
100672b4363aSmrg  if test -s conftest.tar; then
100772b4363aSmrg    AM_RUN_LOG([$am__untar <conftest.tar])
100872b4363aSmrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
100972b4363aSmrg  fi
101072b4363aSmrgdone
101172b4363aSmrgrm -rf conftest.dir
101272b4363aSmrg
101372b4363aSmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
101472b4363aSmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
101572b4363aSmrgAC_SUBST([am__tar])
101672b4363aSmrgAC_SUBST([am__untar])
101772b4363aSmrg]) # _AM_PROG_TAR
101872b4363aSmrg
1019eea2e341Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1020eea2e341Smrg# 
1021eea2e341Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1022eea2e341Smrg#
1023eea2e341Smrg# This program is free software; you can redistribute it and/or modify
1024eea2e341Smrg# it under the terms of the GNU General Public License as published by
1025eea2e341Smrg# the Free Software Foundation; either version 2 of the License, or
1026eea2e341Smrg# (at your option) any later version.
1027eea2e341Smrg#
1028eea2e341Smrg# This program is distributed in the hope that it will be useful, but
1029eea2e341Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1030eea2e341Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1031eea2e341Smrg# General Public License for more details.
1032eea2e341Smrg#
1033eea2e341Smrg# You should have received a copy of the GNU General Public License
1034eea2e341Smrg# along with this program; if not, write to the Free Software
1035eea2e341Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1036eea2e341Smrg#
1037eea2e341Smrg# As a special exception to the GNU General Public License, if you
1038eea2e341Smrg# distribute this file as part of a program that contains a
1039eea2e341Smrg# configuration script generated by Autoconf, you may include it under
1040eea2e341Smrg# the same distribution terms that you use for the rest of that program.
1041eea2e341Smrg
1042eea2e341Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1043eea2e341Smrg# ----------------------------------
1044eea2e341SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
1045eea2e341Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1046eea2e341Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1047eea2e341SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1048eea2e341Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1049eea2e341Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1050eea2e341Smrgfi
1051eea2e341Smrgif test -n "$PKG_CONFIG"; then
1052eea2e341Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
1053eea2e341Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1054eea2e341Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1055eea2e341Smrg		AC_MSG_RESULT([yes])
1056eea2e341Smrg	else
1057eea2e341Smrg		AC_MSG_RESULT([no])
1058eea2e341Smrg		PKG_CONFIG=""
1059eea2e341Smrg	fi
1060eea2e341Smrg		
1061eea2e341Smrgfi[]dnl
1062eea2e341Smrg])# PKG_PROG_PKG_CONFIG
1063eea2e341Smrg
1064eea2e341Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1065eea2e341Smrg#
1066eea2e341Smrg# Check to see whether a particular set of modules exists.  Similar
1067eea2e341Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1068eea2e341Smrg#
1069eea2e341Smrg#
1070eea2e341Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1071eea2e341Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
1072eea2e341Smrg# PKG_CHECK_EXISTS manually
1073eea2e341Smrg# --------------------------------------------------------------
1074eea2e341SmrgAC_DEFUN([PKG_CHECK_EXISTS],
1075eea2e341Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1076eea2e341Smrgif test -n "$PKG_CONFIG" && \
1077eea2e341Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1078eea2e341Smrg  m4_ifval([$2], [$2], [:])
1079eea2e341Smrgm4_ifvaln([$3], [else
1080eea2e341Smrg  $3])dnl
1081eea2e341Smrgfi])
1082eea2e341Smrg
1083eea2e341Smrg
1084eea2e341Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1085eea2e341Smrg# ---------------------------------------------
1086eea2e341Smrgm4_define([_PKG_CONFIG],
1087eea2e341Smrg[if test -n "$$1"; then
1088eea2e341Smrg    pkg_cv_[]$1="$$1"
1089eea2e341Smrg elif test -n "$PKG_CONFIG"; then
1090eea2e341Smrg    PKG_CHECK_EXISTS([$3],
1091eea2e341Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1092eea2e341Smrg		     [pkg_failed=yes])
1093eea2e341Smrg else
1094eea2e341Smrg    pkg_failed=untried
1095eea2e341Smrgfi[]dnl
1096eea2e341Smrg])# _PKG_CONFIG
1097eea2e341Smrg
1098eea2e341Smrg# _PKG_SHORT_ERRORS_SUPPORTED
1099eea2e341Smrg# -----------------------------
1100eea2e341SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1101eea2e341Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1102eea2e341Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1103eea2e341Smrg        _pkg_short_errors_supported=yes
1104eea2e341Smrgelse
1105eea2e341Smrg        _pkg_short_errors_supported=no
1106eea2e341Smrgfi[]dnl
1107eea2e341Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
1108eea2e341Smrg
1109eea2e341Smrg
1110eea2e341Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1111eea2e341Smrg# [ACTION-IF-NOT-FOUND])
1112eea2e341Smrg#
1113eea2e341Smrg#
1114eea2e341Smrg# Note that if there is a possibility the first call to
1115eea2e341Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
1116eea2e341Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1117eea2e341Smrg#
1118eea2e341Smrg#
1119eea2e341Smrg# --------------------------------------------------------------
1120eea2e341SmrgAC_DEFUN([PKG_CHECK_MODULES],
1121eea2e341Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1122eea2e341SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1123eea2e341SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1124eea2e341Smrg
1125eea2e341Smrgpkg_failed=no
1126eea2e341SmrgAC_MSG_CHECKING([for $1])
1127eea2e341Smrg
1128eea2e341Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1129eea2e341Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1130eea2e341Smrg
1131eea2e341Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1132eea2e341Smrgand $1[]_LIBS to avoid the need to call pkg-config.
1133eea2e341SmrgSee the pkg-config man page for more details.])
1134eea2e341Smrg
1135eea2e341Smrgif test $pkg_failed = yes; then
1136eea2e341Smrg        _PKG_SHORT_ERRORS_SUPPORTED
1137eea2e341Smrg        if test $_pkg_short_errors_supported = yes; then
1138eea2e341Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1139eea2e341Smrg        else 
1140eea2e341Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1141eea2e341Smrg        fi
1142eea2e341Smrg	# Put the nasty error message in config.log where it belongs
1143eea2e341Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1144eea2e341Smrg
1145eea2e341Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
1146eea2e341Smrg[Package requirements ($2) were not met:
1147eea2e341Smrg
1148eea2e341Smrg$$1_PKG_ERRORS
1149eea2e341Smrg
1150eea2e341SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
1151eea2e341Smrginstalled software in a non-standard prefix.
1152eea2e341Smrg
1153eea2e341Smrg_PKG_TEXT
1154eea2e341Smrg])],
1155eea2e341Smrg		[AC_MSG_RESULT([no])
1156eea2e341Smrg                $4])
1157eea2e341Smrgelif test $pkg_failed = untried; then
1158eea2e341Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
1159eea2e341Smrg[The pkg-config script could not be found or is too old.  Make sure it
1160eea2e341Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
1161eea2e341Smrgpath to pkg-config.
1162eea2e341Smrg
1163eea2e341Smrg_PKG_TEXT
1164eea2e341Smrg
1165eea2e341SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1166eea2e341Smrg		[$4])
1167eea2e341Smrgelse
1168eea2e341Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1169eea2e341Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1170eea2e341Smrg        AC_MSG_RESULT([yes])
1171eea2e341Smrg	ifelse([$3], , :, [$3])
1172eea2e341Smrgfi[]dnl
1173eea2e341Smrg])# PKG_CHECK_MODULES
1174eea2e341Smrg
1175dd77ae96Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
117672b4363aSmrgdnl
117708e312fdSmrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
117872b4363aSmrgdnl 
117972b4363aSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
118008e312fdSmrgdnl copy of this software and associated documentation files (the "Software"),
118108e312fdSmrgdnl to deal in the Software without restriction, including without limitation
118208e312fdSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
118308e312fdSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
118408e312fdSmrgdnl Software is furnished to do so, subject to the following conditions:
118572b4363aSmrgdnl
118608e312fdSmrgdnl The above copyright notice and this permission notice (including the next
118708e312fdSmrgdnl paragraph) shall be included in all copies or substantial portions of the
118808e312fdSmrgdnl Software.
118972b4363aSmrgdnl
119008e312fdSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
119108e312fdSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
119208e312fdSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
119308e312fdSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
119408e312fdSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
119508e312fdSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
119608e312fdSmrgdnl DEALINGS IN THE SOFTWARE.
119772b4363aSmrg
119872b4363aSmrg# XORG_MACROS_VERSION(required-version)
119972b4363aSmrg# -------------------------------------
120072b4363aSmrg# Minimum version: 1.1.0
120172b4363aSmrg#
120272b4363aSmrg# If you're using a macro added in Version 1.1 or newer, include this in
120372b4363aSmrg# your configure.ac with the minimum required version, such as:
120472b4363aSmrg# XORG_MACROS_VERSION(1.1)
120572b4363aSmrg#
1206dd77ae96Smrg# To ensure that this macro is defined, also add:
1207dd77ae96Smrg# m4_ifndef([XORG_MACROS_VERSION],
1208dd77ae96Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
120972b4363aSmrg#
121072b4363aSmrg#
121172b4363aSmrg# See the "minimum version" comment for each macro you use to see what 
121272b4363aSmrg# version you require.
1213dd77ae96Smrgm4_defun([XORG_MACROS_VERSION],[
1214eea2e341Smrgm4_define([vers_have], [1.17])
1215dd77ae96Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1216dd77ae96Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1217dd77ae96Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1218dd77ae96Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1219dd77ae96Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1220dd77ae96Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1221dd77ae96Smrgm4_undefine([vers_have])
1222dd77ae96Smrgm4_undefine([maj_have])
1223dd77ae96Smrgm4_undefine([maj_needed])
122472b4363aSmrg]) # XORG_MACROS_VERSION
122572b4363aSmrg
122672b4363aSmrg# XORG_PROG_RAWCPP()
122772b4363aSmrg# ------------------
122872b4363aSmrg# Minimum version: 1.0.0
122972b4363aSmrg#
123072b4363aSmrg# Find cpp program and necessary flags for use in pre-processing text files
123172b4363aSmrg# such as man pages and config files
123272b4363aSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
123372b4363aSmrgAC_REQUIRE([AC_PROG_CPP])
123472b4363aSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
123572b4363aSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
123672b4363aSmrg
123772b4363aSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
123872b4363aSmrg# which is not the best choice for supporting other OS'es, but covers most
123972b4363aSmrg# of the ones we need for now.
124072b4363aSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
1241eea2e341SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
124272b4363aSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
124372b4363aSmrg	AC_MSG_RESULT([no])
124472b4363aSmrgelse
124572b4363aSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
124672b4363aSmrg		RAWCPPFLAGS=-undef
124772b4363aSmrg		AC_MSG_RESULT([yes])
1248dd77ae96Smrg	# under Cygwin unix is still defined even with -undef
1249dd77ae96Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1250dd77ae96Smrg		RAWCPPFLAGS="-undef -ansi"
1251dd77ae96Smrg		AC_MSG_RESULT([yes, with -ansi])
125272b4363aSmrg	else
125372b4363aSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
125472b4363aSmrg	fi
125572b4363aSmrgfi
125672b4363aSmrgrm -f conftest.$ac_ext
125772b4363aSmrg
125872b4363aSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
1259eea2e341SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
126072b4363aSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
126172b4363aSmrg	AC_MSG_RESULT([no])
126272b4363aSmrgelse
126372b4363aSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
126472b4363aSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
126572b4363aSmrg		AC_MSG_RESULT([yes])
126672b4363aSmrg	else
126772b4363aSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
126872b4363aSmrg	fi
126972b4363aSmrgfi
127072b4363aSmrgrm -f conftest.$ac_ext
127172b4363aSmrgAC_SUBST(RAWCPPFLAGS)
127272b4363aSmrg]) # XORG_PROG_RAWCPP
127372b4363aSmrg
127472b4363aSmrg# XORG_MANPAGE_SECTIONS()
127572b4363aSmrg# -----------------------
127672b4363aSmrg# Minimum version: 1.0.0
127772b4363aSmrg#
127872b4363aSmrg# Determine which sections man pages go in for the different man page types
127972b4363aSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
128072b4363aSmrg# Not sure if there's any better way than just hardcoding by OS name.
128172b4363aSmrg# Override default settings by setting environment variables
128208e312fdSmrg# Added MAN_SUBSTS in version 1.8
128308e312fdSmrg# Added AC_PROG_SED in version 1.8
128472b4363aSmrg
128572b4363aSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
128672b4363aSmrgAC_REQUIRE([AC_CANONICAL_HOST])
128708e312fdSmrgAC_REQUIRE([AC_PROG_SED])
128872b4363aSmrg
128972b4363aSmrgif test x$APP_MAN_SUFFIX = x    ; then
129072b4363aSmrg    APP_MAN_SUFFIX=1
129172b4363aSmrgfi
129272b4363aSmrgif test x$APP_MAN_DIR = x    ; then
129372b4363aSmrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
129472b4363aSmrgfi
129572b4363aSmrg
129672b4363aSmrgif test x$LIB_MAN_SUFFIX = x    ; then
129772b4363aSmrg    LIB_MAN_SUFFIX=3
129872b4363aSmrgfi
129972b4363aSmrgif test x$LIB_MAN_DIR = x    ; then
130072b4363aSmrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
130172b4363aSmrgfi
130272b4363aSmrg
130372b4363aSmrgif test x$FILE_MAN_SUFFIX = x    ; then
130472b4363aSmrg    case $host_os in
130572b4363aSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
130672b4363aSmrg	*)		FILE_MAN_SUFFIX=5  ;;
130772b4363aSmrg    esac
130872b4363aSmrgfi
130972b4363aSmrgif test x$FILE_MAN_DIR = x    ; then
131072b4363aSmrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
131172b4363aSmrgfi
131272b4363aSmrg
131372b4363aSmrgif test x$MISC_MAN_SUFFIX = x    ; then
131472b4363aSmrg    case $host_os in
131572b4363aSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
131672b4363aSmrg	*)		MISC_MAN_SUFFIX=7  ;;
131772b4363aSmrg    esac
131872b4363aSmrgfi
131972b4363aSmrgif test x$MISC_MAN_DIR = x    ; then
132072b4363aSmrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
132172b4363aSmrgfi
132272b4363aSmrg
132372b4363aSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
132472b4363aSmrg    case $host_os in
132572b4363aSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
132672b4363aSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
132772b4363aSmrg    esac
132872b4363aSmrgfi
132972b4363aSmrgif test x$DRIVER_MAN_DIR = x    ; then
133072b4363aSmrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
133172b4363aSmrgfi
133272b4363aSmrg
133372b4363aSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
133472b4363aSmrg    case $host_os in
133572b4363aSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
133672b4363aSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
133772b4363aSmrg    esac
133872b4363aSmrgfi
133972b4363aSmrgif test x$ADMIN_MAN_DIR = x    ; then
134072b4363aSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
134172b4363aSmrgfi
134272b4363aSmrg
134372b4363aSmrg
134472b4363aSmrgAC_SUBST([APP_MAN_SUFFIX])
134572b4363aSmrgAC_SUBST([LIB_MAN_SUFFIX])
134672b4363aSmrgAC_SUBST([FILE_MAN_SUFFIX])
134772b4363aSmrgAC_SUBST([MISC_MAN_SUFFIX])
134872b4363aSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
134972b4363aSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
135072b4363aSmrgAC_SUBST([APP_MAN_DIR])
135172b4363aSmrgAC_SUBST([LIB_MAN_DIR])
135272b4363aSmrgAC_SUBST([FILE_MAN_DIR])
135372b4363aSmrgAC_SUBST([MISC_MAN_DIR])
135472b4363aSmrgAC_SUBST([DRIVER_MAN_DIR])
135572b4363aSmrgAC_SUBST([ADMIN_MAN_DIR])
135608e312fdSmrg
135708e312fdSmrgXORG_MAN_PAGE="X Version 11"
135808e312fdSmrgAC_SUBST([XORG_MAN_PAGE])
135908e312fdSmrgMAN_SUBSTS="\
136008e312fdSmrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
136108e312fdSmrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
136208e312fdSmrg	-e 's|__xservername__|Xorg|g' \
136308e312fdSmrg	-e 's|__xconfigfile__|xorg.conf|g' \
136408e312fdSmrg	-e 's|__projectroot__|\$(prefix)|g' \
136508e312fdSmrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
136608e312fdSmrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
136708e312fdSmrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
136808e312fdSmrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
136908e312fdSmrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
137008e312fdSmrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
137108e312fdSmrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
137208e312fdSmrgAC_SUBST([MAN_SUBSTS])
137308e312fdSmrg
137472b4363aSmrg]) # XORG_MANPAGE_SECTIONS
137572b4363aSmrg
137608e312fdSmrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
137708e312fdSmrg# ------------------------
137808e312fdSmrg# Minimum version: 1.7.0
137908e312fdSmrg#
138008e312fdSmrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
138108e312fdSmrg# provided by xorg-sgml-doctools, if installed.
138208e312fdSmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
138308e312fdSmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
138408e312fdSmrgXORG_SGML_PATH=
138508e312fdSmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
138608e312fdSmrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
138708e312fdSmrg    [m4_ifval([$1],[:],
138808e312fdSmrg        [if test x"$cross_compiling" != x"yes" ; then
138908e312fdSmrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
139008e312fdSmrg                          [XORG_SGML_PATH=$prefix/share/sgml])
139108e312fdSmrg         fi])
139208e312fdSmrg    ])
139308e312fdSmrg
139408e312fdSmrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
139508e312fdSmrg# the path and the name of the doc stylesheet
139608e312fdSmrgif test "x$XORG_SGML_PATH" != "x" ; then
139708e312fdSmrg   AC_MSG_RESULT([$XORG_SGML_PATH])
139808e312fdSmrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
139908e312fdSmrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
140008e312fdSmrgelse
140108e312fdSmrg   AC_MSG_RESULT([no])
140208e312fdSmrgfi
140308e312fdSmrg
140408e312fdSmrgAC_SUBST(XORG_SGML_PATH)
140508e312fdSmrgAC_SUBST(STYLESHEET_SRCDIR)
140608e312fdSmrgAC_SUBST(XSL_STYLESHEET)
140708e312fdSmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
140808e312fdSmrg]) # XORG_CHECK_SGML_DOCTOOLS
140908e312fdSmrg
141072b4363aSmrg# XORG_CHECK_LINUXDOC
141172b4363aSmrg# -------------------
141272b4363aSmrg# Minimum version: 1.0.0
141372b4363aSmrg#
141472b4363aSmrg# Defines the variable MAKE_TEXT if the necessary tools and
141572b4363aSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
141672b4363aSmrg# Whether or not the necessary tools and files are found can be checked
141772b4363aSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
141872b4363aSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
141908e312fdSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
142008e312fdSmrgAC_REQUIRE([XORG_WITH_PS2PDF])
142172b4363aSmrg
142272b4363aSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
142372b4363aSmrg
142408e312fdSmrgAC_MSG_CHECKING([whether to build documentation])
142572b4363aSmrg
142608e312fdSmrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
142772b4363aSmrg   BUILDDOC=yes
142872b4363aSmrgelse
142972b4363aSmrg   BUILDDOC=no
143072b4363aSmrgfi
143172b4363aSmrg
143272b4363aSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
143372b4363aSmrg
143472b4363aSmrgAC_MSG_RESULT([$BUILDDOC])
143572b4363aSmrg
143608e312fdSmrgAC_MSG_CHECKING([whether to build pdf documentation])
143772b4363aSmrg
143808e312fdSmrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
143972b4363aSmrg   BUILDPDFDOC=yes
144072b4363aSmrgelse
144172b4363aSmrg   BUILDPDFDOC=no
144272b4363aSmrgfi
144372b4363aSmrg
144472b4363aSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
144572b4363aSmrg
144672b4363aSmrgAC_MSG_RESULT([$BUILDPDFDOC])
144772b4363aSmrg
144808e312fdSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
144972b4363aSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
145072b4363aSmrgMAKE_PDF="$PS2PDF"
145172b4363aSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
145272b4363aSmrg
145372b4363aSmrgAC_SUBST(MAKE_TEXT)
145472b4363aSmrgAC_SUBST(MAKE_PS)
145572b4363aSmrgAC_SUBST(MAKE_PDF)
145672b4363aSmrgAC_SUBST(MAKE_HTML)
145772b4363aSmrg]) # XORG_CHECK_LINUXDOC
145872b4363aSmrg
145972b4363aSmrg# XORG_CHECK_DOCBOOK
146072b4363aSmrg# -------------------
146172b4363aSmrg# Minimum version: 1.0.0
146272b4363aSmrg#
146372b4363aSmrg# Checks for the ability to build output formats from SGML DocBook source.
146472b4363aSmrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
146572b4363aSmrg# indicates whether the necessary tools and files are found and, if set,
146672b4363aSmrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
146772b4363aSmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
146808e312fdSmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
146908e312fdSmrg
147072b4363aSmrgBUILDTXTDOC=no
147172b4363aSmrgBUILDPDFDOC=no
147272b4363aSmrgBUILDPSDOC=no
147372b4363aSmrgBUILDHTMLDOC=no
147472b4363aSmrg
147572b4363aSmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
147672b4363aSmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
147772b4363aSmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
147872b4363aSmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
147972b4363aSmrg
148008e312fdSmrgAC_MSG_CHECKING([whether to build text documentation])
148108e312fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
148272b4363aSmrg   test x$BUILD_TXTDOC != xno; then
148372b4363aSmrg	BUILDTXTDOC=yes
148472b4363aSmrgfi
148572b4363aSmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
148672b4363aSmrgAC_MSG_RESULT([$BUILDTXTDOC])
148772b4363aSmrg
148808e312fdSmrgAC_MSG_CHECKING([whether to build PDF documentation])
148908e312fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
149072b4363aSmrg   test x$BUILD_PDFDOC != xno; then
149172b4363aSmrg	BUILDPDFDOC=yes
149272b4363aSmrgfi
149372b4363aSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
149472b4363aSmrgAC_MSG_RESULT([$BUILDPDFDOC])
149572b4363aSmrg
149608e312fdSmrgAC_MSG_CHECKING([whether to build PostScript documentation])
149708e312fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
149872b4363aSmrg   test x$BUILD_PSDOC != xno; then
149972b4363aSmrg	BUILDPSDOC=yes
150072b4363aSmrgfi
150172b4363aSmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
150272b4363aSmrgAC_MSG_RESULT([$BUILDPSDOC])
150372b4363aSmrg
150408e312fdSmrgAC_MSG_CHECKING([whether to build HTML documentation])
150508e312fdSmrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
150672b4363aSmrg   test x$BUILD_HTMLDOC != xno; then
150772b4363aSmrg	BUILDHTMLDOC=yes
150872b4363aSmrgfi
150972b4363aSmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
151072b4363aSmrgAC_MSG_RESULT([$BUILDHTMLDOC])
151172b4363aSmrg
151272b4363aSmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
151372b4363aSmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
151472b4363aSmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
151572b4363aSmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
151672b4363aSmrg
151772b4363aSmrgAC_SUBST(MAKE_TEXT)
151872b4363aSmrgAC_SUBST(MAKE_PS)
151972b4363aSmrgAC_SUBST(MAKE_PDF)
152072b4363aSmrgAC_SUBST(MAKE_HTML)
152172b4363aSmrg]) # XORG_CHECK_DOCBOOK
152272b4363aSmrg
152308e312fdSmrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
152408e312fdSmrg# ----------------
152508e312fdSmrg# Minimum version: 1.5.0
152608e312fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
152708e312fdSmrg#
152808e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
152908e312fdSmrg# not at the appropriate level. This macro enables a module to test for the
153008e312fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
153108e312fdSmrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
153208e312fdSmrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
153308e312fdSmrg# --with-xmlto assumes 'auto'.
153408e312fdSmrg#
153508e312fdSmrg# Interface to module:
153608e312fdSmrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
153708e312fdSmrg# XMLTO:	returns the path of the xmlto program found
153808e312fdSmrg#		returns the path set by the user in the environment
153908e312fdSmrg# --with-xmlto:	'yes' user instructs the module to use xmlto
154008e312fdSmrg#		'no' user instructs the module not to use xmlto
154108e312fdSmrg#
154208e312fdSmrg# Added in version 1.10.0
154308e312fdSmrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
154408e312fdSmrg#                  xmlto for text output requires either lynx, links, or w3m browsers
154508e312fdSmrg#
154608e312fdSmrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
154708e312fdSmrg#
154808e312fdSmrgAC_DEFUN([XORG_WITH_XMLTO],[
154908e312fdSmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
155008e312fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
155108e312fdSmrgAC_ARG_WITH(xmlto,
155208e312fdSmrg	AS_HELP_STRING([--with-xmlto],
155308e312fdSmrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
155408e312fdSmrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
155508e312fdSmrgm4_undefine([_defopt])
155608e312fdSmrg
155708e312fdSmrgif test "x$use_xmlto" = x"auto"; then
155808e312fdSmrg   AC_PATH_PROG([XMLTO], [xmlto])
155908e312fdSmrg   if test "x$XMLTO" = "x"; then
156008e312fdSmrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
156108e312fdSmrg	have_xmlto=no
156208e312fdSmrg   else
156308e312fdSmrg        have_xmlto=yes
156408e312fdSmrg   fi
156508e312fdSmrgelif test "x$use_xmlto" = x"yes" ; then
156608e312fdSmrg   AC_PATH_PROG([XMLTO], [xmlto])
156708e312fdSmrg   if test "x$XMLTO" = "x"; then
156808e312fdSmrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
156908e312fdSmrg   fi
157008e312fdSmrg   have_xmlto=yes
157108e312fdSmrgelif test "x$use_xmlto" = x"no" ; then
157208e312fdSmrg   if test "x$XMLTO" != "x"; then
157308e312fdSmrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
157408e312fdSmrg   fi
157508e312fdSmrg   have_xmlto=no
157608e312fdSmrgelse
157708e312fdSmrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
157808e312fdSmrgfi
157908e312fdSmrg
158008e312fdSmrg# Test for a minimum version of xmlto, if provided.
158108e312fdSmrgm4_ifval([$1],
158208e312fdSmrg[if test "$have_xmlto" = yes; then
158308e312fdSmrg    # scrape the xmlto version
158408e312fdSmrg    AC_MSG_CHECKING([the xmlto version])
158508e312fdSmrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
158608e312fdSmrg    AC_MSG_RESULT([$xmlto_version])
158708e312fdSmrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
158808e312fdSmrg        [if test "x$use_xmlto" = xauto; then
158908e312fdSmrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
159008e312fdSmrg            have_xmlto=no
159108e312fdSmrg        else
159208e312fdSmrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
159308e312fdSmrg        fi])
159408e312fdSmrgfi])
159508e312fdSmrg
159608e312fdSmrg# Test for the ability of xmlto to generate a text target
159708e312fdSmrghave_xmlto_text=no
159808e312fdSmrgcat > conftest.xml << "EOF"
159908e312fdSmrgEOF
160008e312fdSmrgAS_IF([test "$have_xmlto" = yes],
160108e312fdSmrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
160208e312fdSmrg             [have_xmlto_text=yes],
160308e312fdSmrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
160408e312fdSmrgrm -f conftest.xml
160508e312fdSmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
160608e312fdSmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
160708e312fdSmrg]) # XORG_WITH_XMLTO
160808e312fdSmrg
1609eea2e341Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1610eea2e341Smrg# --------------------------------------------
1611eea2e341Smrg# Minimum version: 1.12.0
1612eea2e341Smrg# Minimum version for optional DEFAULT argument: 1.12.0
1613eea2e341Smrg#
1614eea2e341Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1615eea2e341Smrg# XML-based language used for the transformation of XML documents.
1616eea2e341Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1617eea2e341Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
1618eea2e341Smrg# The XSLT processor is often used as a standalone tool for transformations.
1619eea2e341Smrg# It should not be assumed that this tool is used only to work with documnetation.
1620eea2e341Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1621eea2e341Smrg#
1622eea2e341Smrg# Interface to module:
1623eea2e341Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1624eea2e341Smrg# XSLTPROC:	 returns the path of the xsltproc program found
1625eea2e341Smrg#		 returns the path set by the user in the environment
1626eea2e341Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1627eea2e341Smrg#		  'no' user instructs the module not to use xsltproc
1628eea2e341Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
1629eea2e341Smrg#
1630eea2e341Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1631eea2e341Smrg#
1632eea2e341SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
1633eea2e341SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1634eea2e341Smrg# Preserves the interface, should it be implemented later
1635eea2e341Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1636eea2e341Smrgm4_define([_defopt], m4_default([$2], [auto]))
1637eea2e341SmrgAC_ARG_WITH(xsltproc,
1638eea2e341Smrg	AS_HELP_STRING([--with-xsltproc],
1639eea2e341Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1640eea2e341Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1641eea2e341Smrgm4_undefine([_defopt])
1642eea2e341Smrg
1643eea2e341Smrgif test "x$use_xsltproc" = x"auto"; then
1644eea2e341Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1645eea2e341Smrg   if test "x$XSLTPROC" = "x"; then
1646eea2e341Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1647eea2e341Smrg	have_xsltproc=no
1648eea2e341Smrg   else
1649eea2e341Smrg        have_xsltproc=yes
1650eea2e341Smrg   fi
1651eea2e341Smrgelif test "x$use_xsltproc" = x"yes" ; then
1652eea2e341Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
1653eea2e341Smrg   if test "x$XSLTPROC" = "x"; then
1654eea2e341Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1655eea2e341Smrg   fi
1656eea2e341Smrg   have_xsltproc=yes
1657eea2e341Smrgelif test "x$use_xsltproc" = x"no" ; then
1658eea2e341Smrg   if test "x$XSLTPROC" != "x"; then
1659eea2e341Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1660eea2e341Smrg   fi
1661eea2e341Smrg   have_xsltproc=no
1662eea2e341Smrgelse
1663eea2e341Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1664eea2e341Smrgfi
1665eea2e341Smrg
1666eea2e341SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1667eea2e341Smrg]) # XORG_WITH_XSLTPROC
1668eea2e341Smrg
1669eea2e341Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1670eea2e341Smrg# ----------------------------------------
1671eea2e341Smrg# Minimum version: 1.15.0
1672eea2e341Smrg#
1673eea2e341Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
1674eea2e341Smrg# scanning arbitrary text files, extracting information from those text files,
1675eea2e341Smrg# and printing reports based on that information.
1676eea2e341Smrg#
1677eea2e341Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
1678eea2e341Smrg#
1679eea2e341Smrg# Interface to module:
1680eea2e341Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
1681eea2e341Smrg# PERL:	     returns the path of the perl program found
1682eea2e341Smrg#	     returns the path set by the user in the environment
1683eea2e341Smrg# --with-perl: 'yes' user instructs the module to use perl
1684eea2e341Smrg#	       'no' user instructs the module not to use perl
1685eea2e341Smrg# have_perl: returns yes if perl found in PATH or no
1686eea2e341Smrg#
1687eea2e341Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1688eea2e341Smrg#
1689eea2e341SmrgAC_DEFUN([XORG_WITH_PERL],[
1690eea2e341SmrgAC_ARG_VAR([PERL], [Path to perl command])
1691eea2e341Smrg# Preserves the interface, should it be implemented later
1692eea2e341Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1693eea2e341Smrgm4_define([_defopt], m4_default([$2], [auto]))
1694eea2e341SmrgAC_ARG_WITH(perl,
1695eea2e341Smrg	AS_HELP_STRING([--with-perl],
1696eea2e341Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
1697eea2e341Smrg	   [use_perl=$withval], [use_perl=]_defopt)
1698eea2e341Smrgm4_undefine([_defopt])
1699eea2e341Smrg
1700eea2e341Smrgif test "x$use_perl" = x"auto"; then
1701eea2e341Smrg   AC_PATH_PROG([PERL], [perl])
1702eea2e341Smrg   if test "x$PERL" = "x"; then
1703eea2e341Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
1704eea2e341Smrg	have_perl=no
1705eea2e341Smrg   else
1706eea2e341Smrg        have_perl=yes
1707eea2e341Smrg   fi
1708eea2e341Smrgelif test "x$use_perl" = x"yes" ; then
1709eea2e341Smrg   AC_PATH_PROG([PERL], [perl])
1710eea2e341Smrg   if test "x$PERL" = "x"; then
1711eea2e341Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1712eea2e341Smrg   fi
1713eea2e341Smrg   have_perl=yes
1714eea2e341Smrgelif test "x$use_perl" = x"no" ; then
1715eea2e341Smrg   if test "x$PERL" != "x"; then
1716eea2e341Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1717eea2e341Smrg   fi
1718eea2e341Smrg   have_perl=no
1719eea2e341Smrgelse
1720eea2e341Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1721eea2e341Smrgfi
1722eea2e341Smrg
1723eea2e341SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1724eea2e341Smrg]) # XORG_WITH_PERL
1725eea2e341Smrg
172608e312fdSmrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
172708e312fdSmrg# ----------------
172808e312fdSmrg# Minimum version: 1.5.0
172908e312fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
173008e312fdSmrg#
173108e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
173208e312fdSmrg# not at the appropriate level. This macro enables a module to test for the
173308e312fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
173408e312fdSmrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
173508e312fdSmrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
173608e312fdSmrg# --with-asciidoc assumes 'auto'.
173708e312fdSmrg#
173808e312fdSmrg# Interface to module:
173908e312fdSmrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
174008e312fdSmrg# ASCIIDOC:	 returns the path of the asciidoc program found
174108e312fdSmrg#		 returns the path set by the user in the environment
174208e312fdSmrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
174308e312fdSmrg#		  'no' user instructs the module not to use asciidoc
174408e312fdSmrg#
174508e312fdSmrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
174608e312fdSmrg#
174708e312fdSmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
174808e312fdSmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
174908e312fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
175008e312fdSmrgAC_ARG_WITH(asciidoc,
175108e312fdSmrg	AS_HELP_STRING([--with-asciidoc],
175208e312fdSmrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
175308e312fdSmrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
175408e312fdSmrgm4_undefine([_defopt])
175508e312fdSmrg
175608e312fdSmrgif test "x$use_asciidoc" = x"auto"; then
175708e312fdSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
175808e312fdSmrg   if test "x$ASCIIDOC" = "x"; then
175908e312fdSmrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
176008e312fdSmrg	have_asciidoc=no
176108e312fdSmrg   else
176208e312fdSmrg        have_asciidoc=yes
176308e312fdSmrg   fi
176408e312fdSmrgelif test "x$use_asciidoc" = x"yes" ; then
176508e312fdSmrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
176608e312fdSmrg   if test "x$ASCIIDOC" = "x"; then
176708e312fdSmrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
176808e312fdSmrg   fi
176908e312fdSmrg   have_asciidoc=yes
177008e312fdSmrgelif test "x$use_asciidoc" = x"no" ; then
177108e312fdSmrg   if test "x$ASCIIDOC" != "x"; then
177208e312fdSmrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
177308e312fdSmrg   fi
177408e312fdSmrg   have_asciidoc=no
177508e312fdSmrgelse
177608e312fdSmrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
177708e312fdSmrgfi
177808e312fdSmrgm4_ifval([$1],
177908e312fdSmrg[if test "$have_asciidoc" = yes; then
178008e312fdSmrg    # scrape the asciidoc version
178108e312fdSmrg    AC_MSG_CHECKING([the asciidoc version])
178208e312fdSmrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
178308e312fdSmrg    AC_MSG_RESULT([$asciidoc_version])
178408e312fdSmrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
178508e312fdSmrg        [if test "x$use_asciidoc" = xauto; then
178608e312fdSmrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
178708e312fdSmrg            have_asciidoc=no
178808e312fdSmrg        else
178908e312fdSmrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
179008e312fdSmrg        fi])
179108e312fdSmrgfi])
179208e312fdSmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
179308e312fdSmrg]) # XORG_WITH_ASCIIDOC
179408e312fdSmrg
179508e312fdSmrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
179608e312fdSmrg# --------------------------------
179708e312fdSmrg# Minimum version: 1.5.0
179808e312fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
179908e312fdSmrg#
180008e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
180108e312fdSmrg# not at the appropriate level. This macro enables a module to test for the
180208e312fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
180308e312fdSmrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
180408e312fdSmrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
180508e312fdSmrg# --with-doxygen assumes 'auto'.
180608e312fdSmrg#
180708e312fdSmrg# Interface to module:
180808e312fdSmrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
180908e312fdSmrg# DOXYGEN:	 returns the path of the doxygen program found
181008e312fdSmrg#		 returns the path set by the user in the environment
181108e312fdSmrg# --with-doxygen: 'yes' user instructs the module to use doxygen
181208e312fdSmrg#		  'no' user instructs the module not to use doxygen
181308e312fdSmrg#
181408e312fdSmrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
181508e312fdSmrg#
181608e312fdSmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
181708e312fdSmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
181808e312fdSmrgm4_define([_defopt], m4_default([$2], [auto]))
181908e312fdSmrgAC_ARG_WITH(doxygen,
182008e312fdSmrg	AS_HELP_STRING([--with-doxygen],
182108e312fdSmrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
182208e312fdSmrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
182308e312fdSmrgm4_undefine([_defopt])
182408e312fdSmrg
182508e312fdSmrgif test "x$use_doxygen" = x"auto"; then
182608e312fdSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
182708e312fdSmrg   if test "x$DOXYGEN" = "x"; then
182808e312fdSmrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
182908e312fdSmrg	have_doxygen=no
183008e312fdSmrg   else
183108e312fdSmrg        have_doxygen=yes
183208e312fdSmrg   fi
183308e312fdSmrgelif test "x$use_doxygen" = x"yes" ; then
183408e312fdSmrg   AC_PATH_PROG([DOXYGEN], [doxygen])
183508e312fdSmrg   if test "x$DOXYGEN" = "x"; then
183608e312fdSmrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
183708e312fdSmrg   fi
183808e312fdSmrg   have_doxygen=yes
183908e312fdSmrgelif test "x$use_doxygen" = x"no" ; then
184008e312fdSmrg   if test "x$DOXYGEN" != "x"; then
184108e312fdSmrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
184208e312fdSmrg   fi
184308e312fdSmrg   have_doxygen=no
184408e312fdSmrgelse
184508e312fdSmrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
184608e312fdSmrgfi
184708e312fdSmrgm4_ifval([$1],
184808e312fdSmrg[if test "$have_doxygen" = yes; then
184908e312fdSmrg    # scrape the doxygen version
185008e312fdSmrg    AC_MSG_CHECKING([the doxygen version])
185108e312fdSmrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
185208e312fdSmrg    AC_MSG_RESULT([$doxygen_version])
185308e312fdSmrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
185408e312fdSmrg        [if test "x$use_doxygen" = xauto; then
185508e312fdSmrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
185608e312fdSmrg            have_doxygen=no
185708e312fdSmrg        else
185808e312fdSmrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
185908e312fdSmrg        fi])
186008e312fdSmrgfi])
186108e312fdSmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
186208e312fdSmrg]) # XORG_WITH_DOXYGEN
186308e312fdSmrg
186408e312fdSmrg# XORG_WITH_GROFF([DEFAULT])
186508e312fdSmrg# ----------------
186608e312fdSmrg# Minimum version: 1.6.0
186708e312fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
186808e312fdSmrg#
186908e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
187008e312fdSmrg# not at the appropriate level. This macro enables a module to test for the
187108e312fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
187208e312fdSmrg# the --with-groff option, it allows maximum flexibilty in making decisions
187308e312fdSmrg# as whether or not to use the groff package. When DEFAULT is not specified,
187408e312fdSmrg# --with-groff assumes 'auto'.
187508e312fdSmrg#
187608e312fdSmrg# Interface to module:
187708e312fdSmrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
187808e312fdSmrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
187908e312fdSmrg# HAVE_GROFF_MS: the -ms macros package
188008e312fdSmrg# GROFF:	 returns the path of the groff program found
188108e312fdSmrg#		 returns the path set by the user in the environment
188208e312fdSmrg# --with-groff:	 'yes' user instructs the module to use groff
188308e312fdSmrg#		 'no' user instructs the module not to use groff
188408e312fdSmrg#
188508e312fdSmrg# Added in version 1.9.0:
188608e312fdSmrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
188708e312fdSmrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
188808e312fdSmrg#		   psselect from the psutils package.
188908e312fdSmrg#		   the ghostcript package. Refer to the grohtml man pages
189008e312fdSmrg#
189108e312fdSmrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
189208e312fdSmrg#
189308e312fdSmrg# OS and distros often splits groff in a basic and full package, the former
189408e312fdSmrg# having the groff program and the later having devices, fonts and macros
189508e312fdSmrg# Checking for the groff executable is not enough.
189608e312fdSmrg#
189708e312fdSmrg# If macros are missing, we cannot assume that groff is useless, so we don't
189808e312fdSmrg# unset HAVE_GROFF or GROFF env variables.
189908e312fdSmrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
190008e312fdSmrg#
190108e312fdSmrgAC_DEFUN([XORG_WITH_GROFF],[
190208e312fdSmrgAC_ARG_VAR([GROFF], [Path to groff command])
190308e312fdSmrgm4_define([_defopt], m4_default([$1], [auto]))
190408e312fdSmrgAC_ARG_WITH(groff,
190508e312fdSmrg	AS_HELP_STRING([--with-groff],
190608e312fdSmrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
190708e312fdSmrg	   [use_groff=$withval], [use_groff=]_defopt)
190808e312fdSmrgm4_undefine([_defopt])
190908e312fdSmrg
191008e312fdSmrgif test "x$use_groff" = x"auto"; then
191108e312fdSmrg   AC_PATH_PROG([GROFF], [groff])
191208e312fdSmrg   if test "x$GROFF" = "x"; then
191308e312fdSmrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
191408e312fdSmrg	have_groff=no
191508e312fdSmrg   else
191608e312fdSmrg        have_groff=yes
191708e312fdSmrg   fi
191808e312fdSmrgelif test "x$use_groff" = x"yes" ; then
191908e312fdSmrg   AC_PATH_PROG([GROFF], [groff])
192008e312fdSmrg   if test "x$GROFF" = "x"; then
192108e312fdSmrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
192208e312fdSmrg   fi
192308e312fdSmrg   have_groff=yes
192408e312fdSmrgelif test "x$use_groff" = x"no" ; then
192508e312fdSmrg   if test "x$GROFF" != "x"; then
192608e312fdSmrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
192708e312fdSmrg   fi
192808e312fdSmrg   have_groff=no
192908e312fdSmrgelse
193008e312fdSmrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
193108e312fdSmrgfi
193208e312fdSmrg
193308e312fdSmrg# We have groff, test for the presence of the macro packages
193408e312fdSmrgif test "x$have_groff" = x"yes"; then
193508e312fdSmrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
193608e312fdSmrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
193708e312fdSmrg        groff_ms_works=yes
193808e312fdSmrg    else
193908e312fdSmrg        groff_ms_works=no
194008e312fdSmrg    fi
194108e312fdSmrg    AC_MSG_RESULT([$groff_ms_works])
194208e312fdSmrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
194308e312fdSmrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
194408e312fdSmrg        groff_mm_works=yes
194508e312fdSmrg    else
194608e312fdSmrg        groff_mm_works=no
194708e312fdSmrg    fi
194808e312fdSmrg    AC_MSG_RESULT([$groff_mm_works])
194908e312fdSmrgfi
195008e312fdSmrg
195108e312fdSmrg# We have groff, test for HTML dependencies, one command per package
195208e312fdSmrgif test "x$have_groff" = x"yes"; then
195308e312fdSmrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
195408e312fdSmrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
195508e312fdSmrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
195608e312fdSmrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
195708e312fdSmrg      have_groff_html=yes
195808e312fdSmrg   else
195908e312fdSmrg      have_groff_html=no
196008e312fdSmrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
196108e312fdSmrg   fi
196208e312fdSmrgfi
196308e312fdSmrg
196408e312fdSmrg# Set Automake conditionals for Makefiles
196508e312fdSmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
196608e312fdSmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
196708e312fdSmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
196808e312fdSmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
196908e312fdSmrg]) # XORG_WITH_GROFF
197008e312fdSmrg
1971eea2e341Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
1972eea2e341Smrg# ---------------------------------------
197308e312fdSmrg# Minimum version: 1.6.0
197408e312fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
1975eea2e341Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
197608e312fdSmrg#
197708e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
197808e312fdSmrg# not at the appropriate level. This macro enables a module to test for the
197908e312fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
198008e312fdSmrg# the --with-fop option, it allows maximum flexibilty in making decisions
198108e312fdSmrg# as whether or not to use the fop package. When DEFAULT is not specified,
198208e312fdSmrg# --with-fop assumes 'auto'.
198308e312fdSmrg#
198408e312fdSmrg# Interface to module:
198508e312fdSmrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
198608e312fdSmrg# FOP:	 	returns the path of the fop program found
198708e312fdSmrg#		returns the path set by the user in the environment
198808e312fdSmrg# --with-fop: 	'yes' user instructs the module to use fop
198908e312fdSmrg#		'no' user instructs the module not to use fop
199008e312fdSmrg#
199108e312fdSmrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
199208e312fdSmrg#
199308e312fdSmrgAC_DEFUN([XORG_WITH_FOP],[
199408e312fdSmrgAC_ARG_VAR([FOP], [Path to fop command])
1995eea2e341Smrgm4_define([_defopt], m4_default([$2], [auto]))
199608e312fdSmrgAC_ARG_WITH(fop,
199708e312fdSmrg	AS_HELP_STRING([--with-fop],
199808e312fdSmrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
199908e312fdSmrg	   [use_fop=$withval], [use_fop=]_defopt)
200008e312fdSmrgm4_undefine([_defopt])
200108e312fdSmrg
200208e312fdSmrgif test "x$use_fop" = x"auto"; then
200308e312fdSmrg   AC_PATH_PROG([FOP], [fop])
200408e312fdSmrg   if test "x$FOP" = "x"; then
200508e312fdSmrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
200608e312fdSmrg	have_fop=no
200708e312fdSmrg   else
200808e312fdSmrg        have_fop=yes
200908e312fdSmrg   fi
201008e312fdSmrgelif test "x$use_fop" = x"yes" ; then
201108e312fdSmrg   AC_PATH_PROG([FOP], [fop])
201208e312fdSmrg   if test "x$FOP" = "x"; then
201308e312fdSmrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
201408e312fdSmrg   fi
201508e312fdSmrg   have_fop=yes
201608e312fdSmrgelif test "x$use_fop" = x"no" ; then
201708e312fdSmrg   if test "x$FOP" != "x"; then
201808e312fdSmrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
201908e312fdSmrg   fi
202008e312fdSmrg   have_fop=no
202108e312fdSmrgelse
202208e312fdSmrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
202308e312fdSmrgfi
2024eea2e341Smrg
2025eea2e341Smrg# Test for a minimum version of fop, if provided.
2026eea2e341Smrgm4_ifval([$1],
2027eea2e341Smrg[if test "$have_fop" = yes; then
2028eea2e341Smrg    # scrape the fop version
2029eea2e341Smrg    AC_MSG_CHECKING([for fop minimum version])
2030eea2e341Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2031eea2e341Smrg    AC_MSG_RESULT([$fop_version])
2032eea2e341Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
2033eea2e341Smrg        [if test "x$use_fop" = xauto; then
2034eea2e341Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2035eea2e341Smrg            have_fop=no
2036eea2e341Smrg        else
2037eea2e341Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2038eea2e341Smrg        fi])
2039eea2e341Smrgfi])
204008e312fdSmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
204108e312fdSmrg]) # XORG_WITH_FOP
204208e312fdSmrg
204308e312fdSmrg# XORG_WITH_PS2PDF([DEFAULT])
204408e312fdSmrg# ----------------
204508e312fdSmrg# Minimum version: 1.6.0
204608e312fdSmrg# Minimum version for optional DEFAULT argument: 1.11.0
204708e312fdSmrg#
204808e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
204908e312fdSmrg# not at the appropriate level. This macro enables a module to test for the
205008e312fdSmrg# presence of the tool and obtain it's path in separate variables. Coupled with
205108e312fdSmrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
205208e312fdSmrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
205308e312fdSmrg# --with-ps2pdf assumes 'auto'.
205408e312fdSmrg#
205508e312fdSmrg# Interface to module:
205608e312fdSmrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
205708e312fdSmrg# PS2PDF:	returns the path of the ps2pdf program found
205808e312fdSmrg#		returns the path set by the user in the environment
205908e312fdSmrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
206008e312fdSmrg#		 'no' user instructs the module not to use ps2pdf
206108e312fdSmrg#
206208e312fdSmrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
206308e312fdSmrg#
206408e312fdSmrgAC_DEFUN([XORG_WITH_PS2PDF],[
206508e312fdSmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
206608e312fdSmrgm4_define([_defopt], m4_default([$1], [auto]))
206708e312fdSmrgAC_ARG_WITH(ps2pdf,
206808e312fdSmrg	AS_HELP_STRING([--with-ps2pdf],
206908e312fdSmrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
207008e312fdSmrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
207108e312fdSmrgm4_undefine([_defopt])
207208e312fdSmrg
207308e312fdSmrgif test "x$use_ps2pdf" = x"auto"; then
207408e312fdSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
207508e312fdSmrg   if test "x$PS2PDF" = "x"; then
207608e312fdSmrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
207708e312fdSmrg	have_ps2pdf=no
207808e312fdSmrg   else
207908e312fdSmrg        have_ps2pdf=yes
208008e312fdSmrg   fi
208108e312fdSmrgelif test "x$use_ps2pdf" = x"yes" ; then
208208e312fdSmrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
208308e312fdSmrg   if test "x$PS2PDF" = "x"; then
208408e312fdSmrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
208508e312fdSmrg   fi
208608e312fdSmrg   have_ps2pdf=yes
208708e312fdSmrgelif test "x$use_ps2pdf" = x"no" ; then
208808e312fdSmrg   if test "x$PS2PDF" != "x"; then
208908e312fdSmrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
209008e312fdSmrg   fi
209108e312fdSmrg   have_ps2pdf=no
209208e312fdSmrgelse
209308e312fdSmrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
209408e312fdSmrgfi
209508e312fdSmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
209608e312fdSmrg]) # XORG_WITH_PS2PDF
209708e312fdSmrg
209808e312fdSmrg# XORG_ENABLE_DOCS (enable_docs=yes)
209908e312fdSmrg# ----------------
210008e312fdSmrg# Minimum version: 1.6.0
210108e312fdSmrg#
210208e312fdSmrg# Documentation tools are not always available on all platforms and sometimes
210308e312fdSmrg# not at the appropriate level. This macro enables a builder to skip all
210408e312fdSmrg# documentation targets except traditional man pages.
210508e312fdSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
210608e312fdSmrg# maximum flexibilty in controlling documentation building.
210708e312fdSmrg# Refer to:
210808e312fdSmrg# XORG_WITH_XMLTO         --with-xmlto
210908e312fdSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
211008e312fdSmrg# XORG_WITH_DOXYGEN       --with-doxygen
211108e312fdSmrg# XORG_WITH_FOP           --with-fop
211208e312fdSmrg# XORG_WITH_GROFF         --with-groff
211308e312fdSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
211408e312fdSmrg#
211508e312fdSmrg# Interface to module:
211608e312fdSmrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
211708e312fdSmrg# --enable-docs: 'yes' user instructs the module to generate docs
211808e312fdSmrg#		 'no' user instructs the module not to generate docs
211908e312fdSmrg# parm1:	specify the default value, yes or no.
212008e312fdSmrg#
212108e312fdSmrgAC_DEFUN([XORG_ENABLE_DOCS],[
2122eea2e341Smrgm4_define([docs_default], m4_default([$1], [yes]))
212308e312fdSmrgAC_ARG_ENABLE(docs,
212408e312fdSmrg	AS_HELP_STRING([--enable-docs],
2125eea2e341Smrg	   [Enable building the documentation (default: ]docs_default[)]),
2126eea2e341Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
2127eea2e341Smrgm4_undefine([docs_default])
212808e312fdSmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
212908e312fdSmrgAC_MSG_CHECKING([whether to build documentation])
213008e312fdSmrgAC_MSG_RESULT([$build_docs])
213108e312fdSmrg]) # XORG_ENABLE_DOCS
213208e312fdSmrg
213308e312fdSmrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
213408e312fdSmrg# ----------------
213508e312fdSmrg# Minimum version: 1.6.0
213608e312fdSmrg#
213708e312fdSmrg# This macro enables a builder to skip all developer documentation.
213808e312fdSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
213908e312fdSmrg# maximum flexibilty in controlling documentation building.
214008e312fdSmrg# Refer to:
214108e312fdSmrg# XORG_WITH_XMLTO         --with-xmlto
214208e312fdSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
214308e312fdSmrg# XORG_WITH_DOXYGEN       --with-doxygen
214408e312fdSmrg# XORG_WITH_FOP           --with-fop
214508e312fdSmrg# XORG_WITH_GROFF         --with-groff
214608e312fdSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
214708e312fdSmrg#
214808e312fdSmrg# Interface to module:
214908e312fdSmrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
215008e312fdSmrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
215108e312fdSmrg#			'no' user instructs the module not to generate developer docs
215208e312fdSmrg# parm1:		specify the default value, yes or no.
215308e312fdSmrg#
215408e312fdSmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
215508e312fdSmrgm4_define([devel_default], m4_default([$1], [yes]))
215608e312fdSmrgAC_ARG_ENABLE(devel-docs,
215708e312fdSmrg	AS_HELP_STRING([--enable-devel-docs],
215808e312fdSmrg	   [Enable building the developer documentation (default: ]devel_default[)]),
215908e312fdSmrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
216008e312fdSmrgm4_undefine([devel_default])
216108e312fdSmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
216208e312fdSmrgAC_MSG_CHECKING([whether to build developer documentation])
216308e312fdSmrgAC_MSG_RESULT([$build_devel_docs])
216408e312fdSmrg]) # XORG_ENABLE_DEVEL_DOCS
216508e312fdSmrg
216608e312fdSmrg# XORG_ENABLE_SPECS (enable_specs=yes)
216708e312fdSmrg# ----------------
216808e312fdSmrg# Minimum version: 1.6.0
216908e312fdSmrg#
217008e312fdSmrg# This macro enables a builder to skip all functional specification targets.
217108e312fdSmrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
217208e312fdSmrg# maximum flexibilty in controlling documentation building.
217308e312fdSmrg# Refer to:
217408e312fdSmrg# XORG_WITH_XMLTO         --with-xmlto
217508e312fdSmrg# XORG_WITH_ASCIIDOC      --with-asciidoc
217608e312fdSmrg# XORG_WITH_DOXYGEN       --with-doxygen
217708e312fdSmrg# XORG_WITH_FOP           --with-fop
217808e312fdSmrg# XORG_WITH_GROFF         --with-groff
217908e312fdSmrg# XORG_WITH_PS2PDF        --with-ps2pdf
218008e312fdSmrg#
218108e312fdSmrg# Interface to module:
218208e312fdSmrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
218308e312fdSmrg# --enable-specs:	'yes' user instructs the module to generate specs
218408e312fdSmrg#			'no' user instructs the module not to generate specs
218508e312fdSmrg# parm1:		specify the default value, yes or no.
218608e312fdSmrg#
218708e312fdSmrgAC_DEFUN([XORG_ENABLE_SPECS],[
218808e312fdSmrgm4_define([spec_default], m4_default([$1], [yes]))
218908e312fdSmrgAC_ARG_ENABLE(specs,
219008e312fdSmrg	AS_HELP_STRING([--enable-specs],
219108e312fdSmrg	   [Enable building the specs (default: ]spec_default[)]),
219208e312fdSmrg	   [build_specs=$enableval], [build_specs=]spec_default)
219308e312fdSmrgm4_undefine([spec_default])
219408e312fdSmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
219508e312fdSmrgAC_MSG_CHECKING([whether to build functional specifications])
219608e312fdSmrgAC_MSG_RESULT([$build_specs])
219708e312fdSmrg]) # XORG_ENABLE_SPECS
219808e312fdSmrg
2199eea2e341Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2200eea2e341Smrg# ----------------------------------------------
2201eea2e341Smrg# Minimum version: 1.13.0
2202eea2e341Smrg#
2203eea2e341Smrg# This macro enables a builder to enable/disable unit testing
2204eea2e341Smrg# It makes no assumption about the test cases implementation
2205eea2e341Smrg# Test cases may or may not use Automake "Support for test suites"
2206eea2e341Smrg# They may or may not use the software utility library GLib
2207eea2e341Smrg#
2208eea2e341Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2209eea2e341Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2210eea2e341Smrg# The variable enable_unit_tests is used by other macros in this file.
2211eea2e341Smrg#
2212eea2e341Smrg# Interface to module:
2213eea2e341Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2214eea2e341Smrg# enable_unit_tests:    used in configure.ac for additional configuration
2215eea2e341Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
2216eea2e341Smrg#			'no' user instructs the module not to build tests
2217eea2e341Smrg# parm1:		specify the default value, yes or no.
2218eea2e341Smrg#
2219eea2e341SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2220eea2e341SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
2221eea2e341SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
2222eea2e341SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2223eea2e341Smrgm4_define([_defopt], m4_default([$1], [auto]))
2224eea2e341SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2225eea2e341Smrg	[Enable building unit test cases (default: ]_defopt[)]),
2226eea2e341Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2227eea2e341Smrgm4_undefine([_defopt])
2228eea2e341SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2229eea2e341SmrgAC_MSG_CHECKING([whether to build unit test cases])
2230eea2e341SmrgAC_MSG_RESULT([$enable_unit_tests])
2231eea2e341Smrg]) # XORG_ENABLE_UNIT_TESTS
2232eea2e341Smrg
2233eea2e341Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2234eea2e341Smrg# ------------------------------------------------------
2235eea2e341Smrg# Minimum version: 1.17.0
2236eea2e341Smrg#
2237eea2e341Smrg# This macro enables a builder to enable/disable integration testing
2238eea2e341Smrg# It makes no assumption about the test cases' implementation
2239eea2e341Smrg# Test cases may or may not use Automake "Support for test suites"
2240eea2e341Smrg#
2241eea2e341Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2242eea2e341Smrg# usually requires less dependencies and may be built and run under less
2243eea2e341Smrg# stringent environments than integration tests.
2244eea2e341Smrg#
2245eea2e341Smrg# Interface to module:
2246eea2e341Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2247eea2e341Smrg# enable_integration_tests:   used in configure.ac for additional configuration
2248eea2e341Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
2249eea2e341Smrg#                             'no' user instructs the module not to build tests
2250eea2e341Smrg# parm1:                      specify the default value, yes or no.
2251eea2e341Smrg#
2252eea2e341SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2253eea2e341SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2254eea2e341Smrgm4_define([_defopt], m4_default([$1], [auto]))
2255eea2e341SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2256eea2e341Smrg	[Enable building integration test cases (default: ]_defopt[)]),
2257eea2e341Smrg	[enable_integration_tests=$enableval],
2258eea2e341Smrg	[enable_integration_tests=]_defopt)
2259eea2e341Smrgm4_undefine([_defopt])
2260eea2e341SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2261eea2e341Smrg	[test "x$enable_integration_tests" != xno])
2262eea2e341SmrgAC_MSG_CHECKING([whether to build unit test cases])
2263eea2e341SmrgAC_MSG_RESULT([$enable_integration_tests])
2264eea2e341Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
2265eea2e341Smrg
2266eea2e341Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2267eea2e341Smrg# ----------------------------------------
2268eea2e341Smrg# Minimum version: 1.13.0
2269eea2e341Smrg#
2270eea2e341Smrg# GLib is a library which provides advanced data structures and functions.
2271eea2e341Smrg# This macro enables a module to test for the presence of Glib.
2272eea2e341Smrg#
2273eea2e341Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2274eea2e341Smrg# Otherwise the value of $enable_unit_tests is blank.
2275eea2e341Smrg#
2276eea2e341Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2277eea2e341Smrg# test support usually requires less dependencies and may be built and run under
2278eea2e341Smrg# less stringent environments than integration tests.
2279eea2e341Smrg#
2280eea2e341Smrg# Interface to module:
2281eea2e341Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
2282eea2e341Smrg# with_glib: used in configure.ac to know if GLib has been found
2283eea2e341Smrg# --with-glib:	'yes' user instructs the module to use glib
2284eea2e341Smrg#		'no' user instructs the module not to use glib
2285eea2e341Smrg#
2286eea2e341SmrgAC_DEFUN([XORG_WITH_GLIB],[
2287eea2e341SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2288eea2e341Smrgm4_define([_defopt], m4_default([$2], [auto]))
2289eea2e341SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2290eea2e341Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
2291eea2e341Smrg	[with_glib=$withval], [with_glib=]_defopt)
2292eea2e341Smrgm4_undefine([_defopt])
2293eea2e341Smrg
2294eea2e341Smrghave_glib=no
2295eea2e341Smrg# Do not probe GLib if user explicitly disabled unit testing
2296eea2e341Smrgif test "x$enable_unit_tests" != x"no"; then
2297eea2e341Smrg  # Do not probe GLib if user explicitly disabled it
2298eea2e341Smrg  if test "x$with_glib" != x"no"; then
2299eea2e341Smrg    m4_ifval(
2300eea2e341Smrg      [$1],
2301eea2e341Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2302eea2e341Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2303eea2e341Smrg    )
2304eea2e341Smrg  fi
2305eea2e341Smrgfi
2306eea2e341Smrg
2307eea2e341Smrg# Not having GLib when unit testing has been explicitly requested is an error
2308eea2e341Smrgif test "x$enable_unit_tests" = x"yes"; then
2309eea2e341Smrg  if test "x$have_glib" = x"no"; then
2310eea2e341Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2311eea2e341Smrg  fi
2312eea2e341Smrgfi
2313eea2e341Smrg
2314eea2e341Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
2315eea2e341Smrgif test "x$enable_unit_tests" = x"no"; then
2316eea2e341Smrg  if test "x$with_glib" = x"yes"; then
2317eea2e341Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2318eea2e341Smrg  fi
2319eea2e341Smrgfi
2320eea2e341Smrg
2321eea2e341Smrg# Not having GLib when it has been explicitly requested is an error
2322eea2e341Smrgif test "x$with_glib" = x"yes"; then
2323eea2e341Smrg  if test "x$have_glib" = x"no"; then
2324eea2e341Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2325eea2e341Smrg  fi
2326eea2e341Smrgfi
2327eea2e341Smrg
2328eea2e341SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2329eea2e341Smrg]) # XORG_WITH_GLIB
2330eea2e341Smrg
2331eea2e341Smrg# XORG_LD_WRAP([required|optional])
2332eea2e341Smrg# ---------------------------------
2333eea2e341Smrg# Minimum version: 1.13.0
2334eea2e341Smrg#
2335eea2e341Smrg# Check if linker supports -wrap, passed via compiler flags
2336eea2e341Smrg#
2337eea2e341Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2338eea2e341Smrg# Otherwise the value of $enable_unit_tests is blank.
2339eea2e341Smrg#
2340eea2e341Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
2341eea2e341Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2342eea2e341Smrg# available, an argument of "optional" allows use when some unit tests require
2343eea2e341Smrg# ld -wrap and others do not.
2344eea2e341Smrg#
2345eea2e341SmrgAC_DEFUN([XORG_LD_WRAP],[
2346eea2e341SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2347eea2e341Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
2348eea2e341Smrg                      void __wrap_exit(int status) { return; }],
2349eea2e341Smrg                     [exit(0);])])
2350eea2e341Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
2351eea2e341Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2352eea2e341Smrg  if test "x$have_ld_wrap" = x"no"; then
2353eea2e341Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2354eea2e341Smrg  fi
2355eea2e341Smrgfi
2356eea2e341SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2357eea2e341Smrg#
2358eea2e341Smrg]) # XORG_LD_WRAP
2359eea2e341Smrg
2360eea2e341Smrg# XORG_CHECK_LINKER_FLAGS
2361eea2e341Smrg# -----------------------
2362eea2e341Smrg# SYNOPSIS
2363eea2e341Smrg#
2364eea2e341Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2365eea2e341Smrg#
2366eea2e341Smrg# DESCRIPTION
2367eea2e341Smrg#
2368eea2e341Smrg#   Check whether the given linker FLAGS work with the current language's
2369eea2e341Smrg#   linker, or whether they give an error.
2370eea2e341Smrg#
2371eea2e341Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2372eea2e341Smrg#   success/failure.
2373eea2e341Smrg#
2374eea2e341Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
2375eea2e341Smrg#
2376eea2e341Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2377eea2e341Smrg#
2378eea2e341Smrg# LICENSE
2379eea2e341Smrg#
2380eea2e341Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2381eea2e341Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2382eea2e341Smrg#   Copyright (c) 2009 Matteo Frigo
2383eea2e341Smrg#
2384eea2e341Smrg#   This program is free software: you can redistribute it and/or modify it
2385eea2e341Smrg#   under the terms of the GNU General Public License as published by the
2386eea2e341Smrg#   Free Software Foundation, either version 3 of the License, or (at your
2387eea2e341Smrg#   option) any later version.
2388eea2e341Smrg#
2389eea2e341Smrg#   This program is distributed in the hope that it will be useful, but
2390eea2e341Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
2391eea2e341Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2392eea2e341Smrg#   Public License for more details.
2393eea2e341Smrg#
2394eea2e341Smrg#   You should have received a copy of the GNU General Public License along
2395eea2e341Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
2396eea2e341Smrg#
2397eea2e341Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
2398eea2e341Smrg#   gives unlimited permission to copy, distribute and modify the configure
2399eea2e341Smrg#   scripts that are the output of Autoconf when processing the Macro. You
2400eea2e341Smrg#   need not follow the terms of the GNU General Public License when using
2401eea2e341Smrg#   or distributing such scripts, even though portions of the text of the
2402eea2e341Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
2403eea2e341Smrg#   all other use of the material that constitutes the Autoconf Macro.
2404eea2e341Smrg#
2405eea2e341Smrg#   This special exception to the GPL applies to versions of the Autoconf
2406eea2e341Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
2407eea2e341Smrg#   modified version of the Autoconf Macro, you may extend this special
2408eea2e341Smrg#   exception to the GPL to apply to your modified version as well.#
2409eea2e341SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2410eea2e341Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
2411eea2e341Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2412eea2e341SmrgAS_LITERAL_IF([$1],
2413eea2e341Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2414eea2e341Smrg      ax_save_FLAGS=$LDFLAGS
2415eea2e341Smrg      LDFLAGS="$1"
2416eea2e341Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2417eea2e341Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2418eea2e341Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2419eea2e341Smrg      LDFLAGS=$ax_save_FLAGS])],
2420eea2e341Smrg  [ax_save_FLAGS=$LDFLAGS
2421eea2e341Smrg   LDFLAGS="$1"
2422eea2e341Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2423eea2e341Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2424eea2e341Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2425eea2e341Smrg   LDFLAGS=$ax_save_FLAGS])
2426eea2e341Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2427eea2e341SmrgAC_MSG_RESULT($xorg_check_linker_flags)
2428eea2e341Smrgif test "x$xorg_check_linker_flags" = xyes; then
2429eea2e341Smrg	m4_default([$2], :)
2430eea2e341Smrgelse
2431eea2e341Smrg	m4_default([$3], :)
2432eea2e341Smrgfi
2433eea2e341Smrg]) # XORG_CHECK_LINKER_FLAGS
2434eea2e341Smrg
2435eea2e341Smrg# XORG_MEMORY_CHECK_FLAGS
2436eea2e341Smrg# -----------------------
2437eea2e341Smrg# Minimum version: 1.16.0
2438eea2e341Smrg#
2439eea2e341Smrg# This macro attempts to find appropriate memory checking functionality
2440eea2e341Smrg# for various platforms which unit testing code may use to catch various
2441eea2e341Smrg# forms of memory allocation and access errors in testing.
2442eea2e341Smrg#
2443eea2e341Smrg# Interface to module:
2444eea2e341Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2445eea2e341Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2446eea2e341Smrg#
2447eea2e341Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2448eea2e341Smrg#
2449eea2e341SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2450eea2e341Smrg
2451eea2e341SmrgAC_REQUIRE([AC_CANONICAL_HOST])
2452eea2e341SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2453eea2e341Smrg           [Environment variables to enable memory checking in tests])
2454eea2e341Smrg
2455eea2e341Smrg# Check for different types of support on different platforms
2456eea2e341Smrgcase $host_os in
2457eea2e341Smrg    solaris*)
2458eea2e341Smrg        AC_CHECK_LIB([umem], [umem_alloc],
2459eea2e341Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2460eea2e341Smrg        ;;
2461eea2e341Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2462eea2e341Smrg        # both directly and inverted, so should not be 0 or 255.
2463eea2e341Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
2464eea2e341Smrg        ;;
2465eea2e341Smrg    darwin*)
2466eea2e341Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2467eea2e341Smrg        ;;
2468eea2e341Smrg    *bsd*)
2469eea2e341Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2470eea2e341Smrg        ;;
2471eea2e341Smrgesac
2472eea2e341Smrg
2473eea2e341Smrg# User supplied flags override default flags
2474eea2e341Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2475eea2e341Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2476eea2e341Smrgfi
2477eea2e341Smrg
2478eea2e341SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2479eea2e341Smrg]) # XORG_WITH_LINT
2480eea2e341Smrg
248172b4363aSmrg# XORG_CHECK_MALLOC_ZERO
248272b4363aSmrg# ----------------------
248372b4363aSmrg# Minimum version: 1.0.0
248472b4363aSmrg#
248572b4363aSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
248672b4363aSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
248772b4363aSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
248872b4363aSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
248972b4363aSmrgAC_ARG_ENABLE(malloc0returnsnull,
2490dd77ae96Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
249172b4363aSmrg		       [malloc(0) returns NULL (default: auto)]),
249272b4363aSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
249372b4363aSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
249472b4363aSmrg
249572b4363aSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
249672b4363aSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2497eea2e341Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
2498eea2e341Smrg#include <stdlib.h>
2499eea2e341Smrg],[
250072b4363aSmrg    char *m0, *r0, *c0, *p;
250172b4363aSmrg    m0 = malloc(0);
250272b4363aSmrg    p = malloc(10);
250372b4363aSmrg    r0 = realloc(p,0);
2504eea2e341Smrg    c0 = calloc(0,10);
2505eea2e341Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2506eea2e341Smrg])],
250772b4363aSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
250808e312fdSmrg		[MALLOC_ZERO_RETURNS_NULL=no],
250908e312fdSmrg		[MALLOC_ZERO_RETURNS_NULL=yes])
251072b4363aSmrgfi
251172b4363aSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
251272b4363aSmrg
251372b4363aSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
251472b4363aSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
251572b4363aSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
251672b4363aSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
251772b4363aSmrgelse
251872b4363aSmrg	MALLOC_ZERO_CFLAGS=""
251972b4363aSmrg	XMALLOC_ZERO_CFLAGS=""
252072b4363aSmrg	XTMALLOC_ZERO_CFLAGS=""
252172b4363aSmrgfi
252272b4363aSmrg
252372b4363aSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
252472b4363aSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
252572b4363aSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
252672b4363aSmrg]) # XORG_CHECK_MALLOC_ZERO
252772b4363aSmrg
252872b4363aSmrg# XORG_WITH_LINT()
252972b4363aSmrg# ----------------
253072b4363aSmrg# Minimum version: 1.1.0
253172b4363aSmrg#
253208e312fdSmrg# This macro enables the use of a tool that flags some suspicious and
253308e312fdSmrg# non-portable constructs (likely to be bugs) in C language source code.
253408e312fdSmrg# It will attempt to locate the tool and use appropriate options.
253508e312fdSmrg# There are various lint type tools on different platforms.
253608e312fdSmrg#
253708e312fdSmrg# Interface to module:
253808e312fdSmrg# LINT:		returns the path to the tool found on the platform
253908e312fdSmrg#		or the value set to LINT on the configure cmd line
254008e312fdSmrg#		also an Automake conditional
254108e312fdSmrg# LINT_FLAGS:	an Automake variable with appropriate flags
254208e312fdSmrg#
254308e312fdSmrg# --with-lint:	'yes' user instructs the module to use lint
254408e312fdSmrg#		'no' user instructs the module not to use lint (default)
254508e312fdSmrg#
254608e312fdSmrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
254708e312fdSmrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
254872b4363aSmrg#
254972b4363aSmrgAC_DEFUN([XORG_WITH_LINT],[
255072b4363aSmrg
255108e312fdSmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
255208e312fdSmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2553dd77ae96SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
255472b4363aSmrg		[Use a lint-style source code checker (default: disabled)])],
255572b4363aSmrg		[use_lint=$withval], [use_lint=no])
255608e312fdSmrg
255708e312fdSmrg# Obtain platform specific info like program name and options
255808e312fdSmrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
255908e312fdSmrgcase $host_os in
256008e312fdSmrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
256108e312fdSmrg	lint_name=splint
256208e312fdSmrg	lint_options="-badflag"
256308e312fdSmrg	;;
256408e312fdSmrg  *freebsd* | *netbsd*)
256508e312fdSmrg	lint_name=lint
256608e312fdSmrg	lint_options="-u -b"
256708e312fdSmrg	;;
256808e312fdSmrg  *solaris*)
256908e312fdSmrg	lint_name=lint
257008e312fdSmrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
257108e312fdSmrg	;;
257208e312fdSmrgesac
257308e312fdSmrg
257408e312fdSmrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
257508e312fdSmrgif test "x$use_lint" = x"yes" ; then
257608e312fdSmrg   AC_PATH_PROG([LINT], [$lint_name])
257708e312fdSmrg   if test "x$LINT" = "x"; then
257808e312fdSmrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
257908e312fdSmrg   fi
258008e312fdSmrgelif test "x$use_lint" = x"no" ; then
258108e312fdSmrg   if test "x$LINT" != "x"; then
258208e312fdSmrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
258308e312fdSmrg   fi
258472b4363aSmrgelse
258508e312fdSmrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
258672b4363aSmrgfi
258708e312fdSmrg
258808e312fdSmrg# User supplied flags override default flags
258908e312fdSmrgif test "x$LINT_FLAGS" != "x"; then
259008e312fdSmrg   lint_options=$LINT_FLAGS
259172b4363aSmrgfi
259272b4363aSmrg
259308e312fdSmrgAC_SUBST([LINT_FLAGS],[$lint_options])
259408e312fdSmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
259572b4363aSmrg
259672b4363aSmrg]) # XORG_WITH_LINT
259772b4363aSmrg
259872b4363aSmrg# XORG_LINT_LIBRARY(LIBNAME)
259972b4363aSmrg# --------------------------
260072b4363aSmrg# Minimum version: 1.1.0
260172b4363aSmrg#
260272b4363aSmrg# Sets up flags for building lint libraries for checking programs that call
260372b4363aSmrg# functions in the library.
260472b4363aSmrg#
260508e312fdSmrg# Interface to module:
260608e312fdSmrg# LINTLIB		- Automake variable with the name of lint library file to make
260708e312fdSmrg# MAKE_LINT_LIB		- Automake conditional
260808e312fdSmrg#
260908e312fdSmrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
261008e312fdSmrg#			  - 'no' user instructs the module not to create a lint library (default)
261172b4363aSmrg
261272b4363aSmrgAC_DEFUN([XORG_LINT_LIBRARY],[
261372b4363aSmrgAC_REQUIRE([XORG_WITH_LINT])
2614dd77ae96SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
261572b4363aSmrg	[Create lint library (default: disabled)])],
261672b4363aSmrg	[make_lint_lib=$enableval], [make_lint_lib=no])
261708e312fdSmrg
261808e312fdSmrgif test "x$make_lint_lib" = x"yes" ; then
261908e312fdSmrg   LINTLIB=llib-l$1.ln
262008e312fdSmrg   if test "x$LINT" = "x"; then
262108e312fdSmrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
262208e312fdSmrg   fi
262308e312fdSmrgelif test "x$make_lint_lib" != x"no" ; then
262408e312fdSmrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
262572b4363aSmrgfi
262608e312fdSmrg
262772b4363aSmrgAC_SUBST(LINTLIB)
262872b4363aSmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
262972b4363aSmrg
263072b4363aSmrg]) # XORG_LINT_LIBRARY
263172b4363aSmrg
2632eea2e341Smrg# XORG_COMPILER_BRAND
2633eea2e341Smrg# -------------------
2634eea2e341Smrg# Minimum version: 1.14.0
2635eea2e341Smrg#
2636eea2e341Smrg# Checks for various brands of compilers and sets flags as appropriate:
2637eea2e341Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2638eea2e341Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2639eea2e341Smrg#   clang compiler - sets CLANGCC to "yes"
2640eea2e341Smrg#   Intel compiler - sets INTELCC to "yes"
2641eea2e341Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2642eea2e341Smrg#
2643eea2e341SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
2644eea2e341SmrgAC_LANG_CASE(
2645eea2e341Smrg	[C], [
2646eea2e341Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2647eea2e341Smrg	],
2648eea2e341Smrg	[C++], [
2649eea2e341Smrg		AC_REQUIRE([AC_PROG_CXX])
2650eea2e341Smrg	]
2651eea2e341Smrg)
2652eea2e341SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2653eea2e341SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2654eea2e341SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2655eea2e341Smrg]) # XORG_COMPILER_BRAND
2656eea2e341Smrg
2657eea2e341Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2658eea2e341Smrg# ---------------
2659eea2e341Smrg# Minimum version: 1.16.0
2660eea2e341Smrg#
2661eea2e341Smrg# Test if the compiler works when passed the given flag as a command line argument.
2662eea2e341Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2663eea2e341Smrg# next flag in the list until there are no more options.
2664eea2e341Smrg#
2665eea2e341Smrg# Note that this does not guarantee that the compiler supports the flag as some
2666eea2e341Smrg# compilers will simply ignore arguments that they do not understand, but we do
2667eea2e341Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
2668eea2e341Smrg# -Werror=unused-command-line-argument
2669eea2e341Smrg#
2670eea2e341SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
2671eea2e341Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2672eea2e341Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2673eea2e341Smrg
2674eea2e341SmrgAC_LANG_COMPILER_REQUIRE
2675eea2e341Smrg
2676eea2e341SmrgAC_LANG_CASE(
2677eea2e341Smrg	[C], [
2678eea2e341Smrg		AC_REQUIRE([AC_PROG_CC_C99])
2679eea2e341Smrg		define([PREFIX], [C])
2680eea2e341Smrg		define([CACHE_PREFIX], [cc])
2681eea2e341Smrg		define([COMPILER], [$CC])
2682eea2e341Smrg	],
2683eea2e341Smrg	[C++], [
2684eea2e341Smrg		define([PREFIX], [CXX])
2685eea2e341Smrg		define([CACHE_PREFIX], [cxx])
2686eea2e341Smrg		define([COMPILER], [$CXX])
2687eea2e341Smrg	]
2688eea2e341Smrg)
2689eea2e341Smrg
2690eea2e341Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2691eea2e341Smrg
2692eea2e341Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2693eea2e341Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2694eea2e341Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2695eea2e341Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2696eea2e341Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2697eea2e341Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2698eea2e341Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2699eea2e341Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2700eea2e341Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2701eea2e341Smrgfi
2702eea2e341Smrg
2703eea2e341Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2704eea2e341Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2705eea2e341Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2706eea2e341Smrg	fi
2707eea2e341Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2708eea2e341Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2709eea2e341Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2710eea2e341Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2711eea2e341Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2712eea2e341Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2713eea2e341Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2714eea2e341Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2715eea2e341Smrgfi
2716eea2e341Smrg
2717eea2e341Smrgfound="no"
2718eea2e341Smrgm4_foreach([flag], m4_cdr($@), [
2719eea2e341Smrg	if test $found = "no" ; then
2720eea2e341Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2721eea2e341Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2722eea2e341Smrg		fi
2723eea2e341Smrg
2724eea2e341Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2725eea2e341Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2726eea2e341Smrg		fi
2727eea2e341Smrg
2728eea2e341Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2729eea2e341Smrg
2730eea2e341Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2731eea2e341Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports]flag[])
2732eea2e341Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2733eea2e341Smrg		AC_CACHE_VAL($cacheid,
2734eea2e341Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2735eea2e341Smrg					     [eval $cacheid=yes],
2736eea2e341Smrg					     [eval $cacheid=no])])
2737eea2e341Smrg
2738eea2e341Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2739eea2e341Smrg
2740eea2e341Smrg		eval supported=\$$cacheid
2741eea2e341Smrg		AC_MSG_RESULT([$supported])
2742eea2e341Smrg		if test "$supported" = "yes" ; then
2743eea2e341Smrg			$1="$$1 ]flag["
2744eea2e341Smrg			found="yes"
2745eea2e341Smrg		fi
2746eea2e341Smrg	fi
2747eea2e341Smrg])
2748eea2e341Smrg]) # XORG_TESTSET_CFLAG
2749eea2e341Smrg
2750eea2e341Smrg# XORG_COMPILER_FLAGS
2751eea2e341Smrg# ---------------
2752eea2e341Smrg# Minimum version: 1.16.0
2753eea2e341Smrg#
2754eea2e341Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2755eea2e341Smrg# arguments supported by the selected compiler which do NOT alter the generated
2756eea2e341Smrg# code.  These arguments will cause the compiler to print various warnings
2757eea2e341Smrg# during compilation AND turn a conservative set of warnings into errors.
2758eea2e341Smrg#
2759eea2e341Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2760eea2e341Smrg# future versions of util-macros as options are added to new compilers.
2761eea2e341Smrg#
2762eea2e341SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
2763eea2e341SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2764eea2e341Smrg
2765eea2e341SmrgAC_ARG_ENABLE(selective-werror,
2766eea2e341Smrg              AS_HELP_STRING([--disable-selective-werror],
2767eea2e341Smrg                             [Turn off selective compiler errors. (default: enabled)]),
2768eea2e341Smrg              [SELECTIVE_WERROR=$enableval],
2769eea2e341Smrg              [SELECTIVE_WERROR=yes])
2770eea2e341Smrg
2771eea2e341SmrgAC_LANG_CASE(
2772eea2e341Smrg        [C], [
2773eea2e341Smrg                define([PREFIX], [C])
2774eea2e341Smrg        ],
2775eea2e341Smrg        [C++], [
2776eea2e341Smrg                define([PREFIX], [CXX])
2777eea2e341Smrg        ]
2778eea2e341Smrg)
2779eea2e341Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
2780eea2e341Smrgif test "x$SUNCC" = "xyes"; then
2781eea2e341Smrg    [BASE_]PREFIX[FLAGS]="-v"
2782eea2e341Smrgelse
2783eea2e341Smrg    [BASE_]PREFIX[FLAGS]=""
2784eea2e341Smrgfi
2785eea2e341Smrg
2786eea2e341Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2787eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2788eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2789eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2790eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2791eea2e341Smrg
2792eea2e341SmrgAC_LANG_CASE(
2793eea2e341Smrg	[C], [
2794eea2e341Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2795eea2e341Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2796eea2e341Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2797eea2e341Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2798eea2e341Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
2799eea2e341Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2800eea2e341Smrg	]
2801eea2e341Smrg)
2802eea2e341Smrg
2803eea2e341Smrg# This chunk adds additional warnings that could catch undesired effects.
2804eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2805eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2806eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2807eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
2808eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2809eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2810eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2811eea2e341Smrg
2812eea2e341Smrg# These are currently disabled because they are noisy.  They will be enabled
2813eea2e341Smrg# in the future once the codebase is sufficiently modernized to silence
2814eea2e341Smrg# them.  For now, I don't want them to drown out the other warnings.
2815eea2e341Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2816eea2e341Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
2817eea2e341Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
2818eea2e341Smrg
2819eea2e341Smrg# Turn some warnings into errors, so we don't accidently get successful builds
2820eea2e341Smrg# when there are problems that should be fixed.
2821eea2e341Smrg
2822eea2e341Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
2823eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2824eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
2825eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
2826eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
2827eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
2828eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
2829eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2830eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
2831eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
2832eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
2833eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
2834eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2835eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2836eea2e341Smrgelse
2837eea2e341SmrgAC_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])
2838eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
2839eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
2840eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
2841eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
2842eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
2843eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
2844eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
2845eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
2846eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
2847eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
2848eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
2849eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
2850eea2e341SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
2851eea2e341Smrgfi
2852eea2e341Smrg
2853eea2e341SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2854eea2e341Smrg]) # XORG_COMPILER_FLAGS
2855eea2e341Smrg
2856dd77ae96Smrg# XORG_CWARNFLAGS
2857dd77ae96Smrg# ---------------
2858dd77ae96Smrg# Minimum version: 1.2.0
2859eea2e341Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2860dd77ae96Smrg#
2861dd77ae96Smrg# Defines CWARNFLAGS to enable C compiler warnings.
2862dd77ae96Smrg#
2863eea2e341Smrg# This function is deprecated because it defines -fno-strict-aliasing
2864eea2e341Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
2865eea2e341Smrg# is needed, then it should be added explicitly in the module when
2866eea2e341Smrg# it is updated to use BASE_CFLAGS.
2867eea2e341Smrg#
2868dd77ae96SmrgAC_DEFUN([XORG_CWARNFLAGS], [
2869eea2e341SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2870eea2e341SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
2871eea2e341SmrgAC_LANG_CASE(
2872eea2e341Smrg	[C], [
2873eea2e341Smrg		CWARNFLAGS="$BASE_CFLAGS"
2874eea2e341Smrg		if  test "x$GCC" = xyes ; then
2875eea2e341Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2876eea2e341Smrg		fi
2877eea2e341Smrg		AC_SUBST(CWARNFLAGS)
2878eea2e341Smrg	]
2879eea2e341Smrg)
2880dd77ae96Smrg]) # XORG_CWARNFLAGS
2881dd77ae96Smrg
2882dd77ae96Smrg# XORG_STRICT_OPTION
2883dd77ae96Smrg# -----------------------
2884dd77ae96Smrg# Minimum version: 1.3.0
2885dd77ae96Smrg#
2886eea2e341Smrg# Add configure option to enable strict compilation flags, such as treating
2887eea2e341Smrg# warnings as fatal errors.
2888eea2e341Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
2889eea2e341Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
2890eea2e341Smrg#
2891eea2e341Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2892eea2e341Smrg# when strict compilation is unconditionally desired.
2893dd77ae96SmrgAC_DEFUN([XORG_STRICT_OPTION], [
2894dd77ae96SmrgAC_REQUIRE([XORG_CWARNFLAGS])
2895eea2e341SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2896dd77ae96Smrg
2897dd77ae96SmrgAC_ARG_ENABLE(strict-compilation,
2898dd77ae96Smrg			  AS_HELP_STRING([--enable-strict-compilation],
2899dd77ae96Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2900dd77ae96Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2901eea2e341Smrg
2902eea2e341SmrgAC_LANG_CASE(
2903eea2e341Smrg        [C], [
2904eea2e341Smrg                define([PREFIX], [C])
2905eea2e341Smrg        ],
2906eea2e341Smrg        [C++], [
2907eea2e341Smrg                define([PREFIX], [CXX])
2908eea2e341Smrg        ]
2909eea2e341Smrg)
2910eea2e341Smrg
2911eea2e341Smrg[STRICT_]PREFIX[FLAGS]=""
2912eea2e341SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
2913eea2e341SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
2914eea2e341Smrg
2915eea2e341Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2916eea2e341Smrg# activate it with -Werror, so we add it here explicitly.
2917eea2e341SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
2918eea2e341Smrg
2919dd77ae96Smrgif test "x$STRICT_COMPILE" = "xyes"; then
2920eea2e341Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
2921eea2e341Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2922dd77ae96Smrgfi
2923eea2e341SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
2924eea2e341SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
2925eea2e341SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2926dd77ae96Smrg]) # XORG_STRICT_OPTION
2927dd77ae96Smrg
2928dd77ae96Smrg# XORG_DEFAULT_OPTIONS
2929dd77ae96Smrg# --------------------
2930dd77ae96Smrg# Minimum version: 1.3.0
2931dd77ae96Smrg#
2932dd77ae96Smrg# Defines default options for X.Org modules.
2933dd77ae96Smrg#
2934dd77ae96SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
293508e312fdSmrgAC_REQUIRE([AC_PROG_INSTALL])
2936eea2e341SmrgXORG_COMPILER_FLAGS
2937dd77ae96SmrgXORG_CWARNFLAGS
2938dd77ae96SmrgXORG_STRICT_OPTION
2939dd77ae96SmrgXORG_RELEASE_VERSION
2940dd77ae96SmrgXORG_CHANGELOG
294108e312fdSmrgXORG_INSTALL
2942dd77ae96SmrgXORG_MANPAGE_SECTIONS
294308e312fdSmrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
294408e312fdSmrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2945dd77ae96Smrg]) # XORG_DEFAULT_OPTIONS
294608e312fdSmrg
294708e312fdSmrg# XORG_INSTALL()
294808e312fdSmrg# ----------------
294908e312fdSmrg# Minimum version: 1.4.0
295008e312fdSmrg#
295108e312fdSmrg# Defines the variable INSTALL_CMD as the command to copy
295208e312fdSmrg# INSTALL from $prefix/share/util-macros.
295308e312fdSmrg#
295408e312fdSmrgAC_DEFUN([XORG_INSTALL], [
295508e312fdSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
295608e312fdSmrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
295708e312fdSmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
295808e312fdSmrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
295908e312fdSmrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
296008e312fdSmrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
296108e312fdSmrgAC_SUBST([INSTALL_CMD])
296208e312fdSmrg]) # XORG_INSTALL
296372b4363aSmrgdnl Copyright 2005 Red Hat, Inc
296472b4363aSmrgdnl
296572b4363aSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
296672b4363aSmrgdnl documentation for any purpose is hereby granted without fee, provided that
296772b4363aSmrgdnl the above copyright notice appear in all copies and that both that
296872b4363aSmrgdnl copyright notice and this permission notice appear in supporting
296972b4363aSmrgdnl documentation.
297072b4363aSmrgdnl
297172b4363aSmrgdnl The above copyright notice and this permission notice shall be included
297272b4363aSmrgdnl in all copies or substantial portions of the Software.
297372b4363aSmrgdnl
297472b4363aSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
297572b4363aSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
297672b4363aSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
297772b4363aSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
297872b4363aSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
297972b4363aSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
298072b4363aSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
298172b4363aSmrgdnl
298272b4363aSmrgdnl Except as contained in this notice, the name of the copyright holders shall
298372b4363aSmrgdnl not be used in advertising or otherwise to promote the sale, use or
298472b4363aSmrgdnl other dealings in this Software without prior written authorization
298572b4363aSmrgdnl from the copyright holders.
298672b4363aSmrgdnl
298772b4363aSmrg
298872b4363aSmrg# XORG_RELEASE_VERSION
298972b4363aSmrg# --------------------
299008e312fdSmrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
299172b4363aSmrg 
299272b4363aSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
299372b4363aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
299472b4363aSmrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
299572b4363aSmrg		[Major version of this package])
2996dd77ae96Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
299772b4363aSmrg	if test "x$PVM" = "x"; then
299872b4363aSmrg		PVM="0"
299972b4363aSmrg	fi
300072b4363aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
300172b4363aSmrg		[$PVM],
300272b4363aSmrg		[Minor version of this package])
3003dd77ae96Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
300472b4363aSmrg	if test "x$PVP" = "x"; then
300572b4363aSmrg		PVP="0"
300672b4363aSmrg	fi
300772b4363aSmrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
300872b4363aSmrg		[$PVP],
300972b4363aSmrg		[Patch version of this package])
301072b4363aSmrg])
301172b4363aSmrg
3012dd77ae96Smrg# XORG_CHANGELOG()
3013dd77ae96Smrg# ----------------
3014dd77ae96Smrg# Minimum version: 1.2.0
3015dd77ae96Smrg#
3016dd77ae96Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3017dd77ae96Smrg# ChangeLog from git.
3018dd77ae96Smrg#
3019dd77ae96Smrg#
3020dd77ae96SmrgAC_DEFUN([XORG_CHANGELOG], [
302108e312fdSmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
302208e312fdSmrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
302308e312fdSmrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3024dd77ae96Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3025dd77ae96SmrgAC_SUBST([CHANGELOG_CMD])
3026dd77ae96Smrg]) # XORG_CHANGELOG
3027dd77ae96Smrg
3028