aclocal.m4 revision 3544ea2e
1169a0819Smrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
264ce7165Smrg
364ce7165Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4fb23d3a8Smrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
564ce7165Smrg# This file is free software; the Free Software Foundation
664ce7165Smrg# gives unlimited permission to copy and/or distribute it,
764ce7165Smrg# with or without modifications, as long as this notice is preserved.
864ce7165Smrg
964ce7165Smrg# This program is distributed in the hope that it will be useful,
1064ce7165Smrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1164ce7165Smrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1264ce7165Smrg# PARTICULAR PURPOSE.
1364ce7165Smrg
14fb23d3a8Smrgm4_ifndef([AC_AUTOCONF_VERSION],
15fb23d3a8Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
16169a0819Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
17169a0819Smrg[m4_warning([this file was generated for autoconf 2.68.
18fb23d3a8SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
19fb23d3a8SmrgIf you have problems, you may need to regenerate the build system entirely.
20fb23d3a8SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
2164ce7165Smrg
22fb23d3a8Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
2364ce7165Smrg#
2464ce7165Smrg# This file is free software; the Free Software Foundation
2564ce7165Smrg# gives unlimited permission to copy and/or distribute it,
2664ce7165Smrg# with or without modifications, as long as this notice is preserved.
2764ce7165Smrg
2864ce7165Smrg# AM_AUTOMAKE_VERSION(VERSION)
2964ce7165Smrg# ----------------------------
3064ce7165Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3164ce7165Smrg# generated from the m4 files accompanying Automake X.Y.
3264ce7165Smrg# (This private macro should not be called outside this file.)
3364ce7165SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
34fb23d3a8Smrg[am__api_version='1.11'
3564ce7165Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3664ce7165Smrgdnl require some minimum version.  Point them to the right macro.
37169a0819Smrgm4_if([$1], [1.11.1], [],
3864ce7165Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
3964ce7165Smrg])
4064ce7165Smrg
4164ce7165Smrg# _AM_AUTOCONF_VERSION(VERSION)
4264ce7165Smrg# -----------------------------
4364ce7165Smrg# aclocal traces this macro to find the Autoconf version.
4464ce7165Smrg# This is a private macro too.  Using m4_define simplifies
4564ce7165Smrg# the logic in aclocal, which can simply ignore this definition.
4664ce7165Smrgm4_define([_AM_AUTOCONF_VERSION], [])
4764ce7165Smrg
4864ce7165Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
4964ce7165Smrg# -------------------------------
5064ce7165Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
51fb23d3a8Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5264ce7165SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
53169a0819Smrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
54fb23d3a8Smrgm4_ifndef([AC_AUTOCONF_VERSION],
55fb23d3a8Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
56fb23d3a8Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5764ce7165Smrg
5864ce7165Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
5964ce7165Smrg
6064ce7165Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
6164ce7165Smrg#
6264ce7165Smrg# This file is free software; the Free Software Foundation
6364ce7165Smrg# gives unlimited permission to copy and/or distribute it,
6464ce7165Smrg# with or without modifications, as long as this notice is preserved.
6564ce7165Smrg
6664ce7165Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6764ce7165Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
6864ce7165Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
6964ce7165Smrg#
7064ce7165Smrg# Of course, Automake must honor this variable whenever it calls a
7164ce7165Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7264ce7165Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7364ce7165Smrg# depending on how configure is run.  This is pretty annoying, since
7464ce7165Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7564ce7165Smrg# source directory, any form will work fine, but in subdirectories a
7664ce7165Smrg# relative path needs to be adjusted first.
7764ce7165Smrg#
7864ce7165Smrg# $ac_aux_dir/missing
7964ce7165Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8064ce7165Smrg# $top_srcdir/$ac_aux_dir/missing
8164ce7165Smrg#    fails if $ac_aux_dir is absolute,
8264ce7165Smrg#    fails when called from a subdirectory in a VPATH build with
8364ce7165Smrg#          a relative $ac_aux_dir
8464ce7165Smrg#
8564ce7165Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8664ce7165Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8764ce7165Smrg# harmless because $srcdir is `.', but things will broke when you
8864ce7165Smrg# start a VPATH build or use an absolute $srcdir.
8964ce7165Smrg#
9064ce7165Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9164ce7165Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9264ce7165Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9364ce7165Smrg# and then we would define $MISSING as
9464ce7165Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9564ce7165Smrg# This will work as long as MISSING is not called from configure, because
9664ce7165Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9764ce7165Smrg# However there are other variables, like CC, which are often used in
9864ce7165Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
9964ce7165Smrg#
10064ce7165Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10164ce7165Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10264ce7165Smrg# configured tree to be moved without reconfiguration.
10364ce7165Smrg
10464ce7165SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10564ce7165Smrg[dnl Rely on autoconf to set up CDPATH properly.
10664ce7165SmrgAC_PREREQ([2.50])dnl
10764ce7165Smrg# expand $ac_aux_dir to an absolute path
10864ce7165Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
10964ce7165Smrg])
11064ce7165Smrg
11164ce7165Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11264ce7165Smrg
113fb23d3a8Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
11464ce7165Smrg# Free Software Foundation, Inc.
11564ce7165Smrg#
11664ce7165Smrg# This file is free software; the Free Software Foundation
11764ce7165Smrg# gives unlimited permission to copy and/or distribute it,
11864ce7165Smrg# with or without modifications, as long as this notice is preserved.
11964ce7165Smrg
120fb23d3a8Smrg# serial 9
12164ce7165Smrg
12264ce7165Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12364ce7165Smrg# -------------------------------------
12464ce7165Smrg# Define a conditional.
12564ce7165SmrgAC_DEFUN([AM_CONDITIONAL],
12664ce7165Smrg[AC_PREREQ(2.52)dnl
12764ce7165Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12864ce7165Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12964ce7165SmrgAC_SUBST([$1_TRUE])dnl
13064ce7165SmrgAC_SUBST([$1_FALSE])dnl
13164ce7165Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
13264ce7165Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
133fb23d3a8Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13464ce7165Smrgif $2; then
13564ce7165Smrg  $1_TRUE=
13664ce7165Smrg  $1_FALSE='#'
13764ce7165Smrgelse
13864ce7165Smrg  $1_TRUE='#'
13964ce7165Smrg  $1_FALSE=
14064ce7165Smrgfi
14164ce7165SmrgAC_CONFIG_COMMANDS_PRE(
14264ce7165Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14364ce7165Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14464ce7165SmrgUsually this means the macro was only invoked conditionally.]])
14564ce7165Smrgfi])])
14664ce7165Smrg
147fb23d3a8Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
14864ce7165Smrg# Free Software Foundation, Inc.
14964ce7165Smrg#
15064ce7165Smrg# This file is free software; the Free Software Foundation
15164ce7165Smrg# gives unlimited permission to copy and/or distribute it,
15264ce7165Smrg# with or without modifications, as long as this notice is preserved.
15364ce7165Smrg
154fb23d3a8Smrg# serial 10
15564ce7165Smrg
15664ce7165Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
15764ce7165Smrg# written in clear, in which case automake, when reading aclocal.m4,
15864ce7165Smrg# will think it sees a *use*, and therefore will trigger all it's
15964ce7165Smrg# C support machinery.  Also note that it means that autoscan, seeing
16064ce7165Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
16164ce7165Smrg
16264ce7165Smrg
16364ce7165Smrg# _AM_DEPENDENCIES(NAME)
16464ce7165Smrg# ----------------------
16564ce7165Smrg# See how the compiler implements dependency checking.
16664ce7165Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
16764ce7165Smrg# We try a few techniques and use that to set a single cache variable.
16864ce7165Smrg#
16964ce7165Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
17064ce7165Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
17164ce7165Smrg# dependency, and given that the user is not expected to run this macro,
17264ce7165Smrg# just rely on AC_PROG_CC.
17364ce7165SmrgAC_DEFUN([_AM_DEPENDENCIES],
17464ce7165Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17564ce7165SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17664ce7165SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17764ce7165SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17864ce7165Smrg
17964ce7165Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
18064ce7165Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
18164ce7165Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
18264ce7165Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
18364ce7165Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18464ce7165Smrg                   [depcc="$$1"   am_compiler_list=])
18564ce7165Smrg
18664ce7165SmrgAC_CACHE_CHECK([dependency style of $depcc],
18764ce7165Smrg               [am_cv_$1_dependencies_compiler_type],
18864ce7165Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18964ce7165Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
19064ce7165Smrg  # making bogus files that we don't know about and never remove.  For
19164ce7165Smrg  # instance it was reported that on HP-UX the gcc test will end up
19264ce7165Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
19364ce7165Smrg  # in D'.
19464ce7165Smrg  mkdir conftest.dir
19564ce7165Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19664ce7165Smrg  # using a relative directory.
19764ce7165Smrg  cp "$am_depcomp" conftest.dir
19864ce7165Smrg  cd conftest.dir
19964ce7165Smrg  # We will build objects and dependencies in a subdirectory because
20064ce7165Smrg  # it helps to detect inapplicable dependency modes.  For instance
20164ce7165Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
20264ce7165Smrg  # side effect of compilation, but ICC will put the dependencies in
20364ce7165Smrg  # the current directory while Tru64 will put them in the object
20464ce7165Smrg  # directory.
20564ce7165Smrg  mkdir sub
20664ce7165Smrg
20764ce7165Smrg  am_cv_$1_dependencies_compiler_type=none
20864ce7165Smrg  if test "$am_compiler_list" = ""; then
20964ce7165Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
21064ce7165Smrg  fi
211fb23d3a8Smrg  am__universal=false
212fb23d3a8Smrg  m4_case([$1], [CC],
213fb23d3a8Smrg    [case " $depcc " in #(
214fb23d3a8Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
215fb23d3a8Smrg     esac],
216fb23d3a8Smrg    [CXX],
217fb23d3a8Smrg    [case " $depcc " in #(
218fb23d3a8Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
219fb23d3a8Smrg     esac])
220fb23d3a8Smrg
22164ce7165Smrg  for depmode in $am_compiler_list; do
22264ce7165Smrg    # Setup a source with many dependencies, because some compilers
22364ce7165Smrg    # like to wrap large dependency lists on column 80 (with \), and
22464ce7165Smrg    # we should not choose a depcomp mode which is confused by this.
22564ce7165Smrg    #
22664ce7165Smrg    # We need to recreate these files for each test, as the compiler may
22764ce7165Smrg    # overwrite some of them when testing with obscure command lines.
22864ce7165Smrg    # This happens at least with the AIX C compiler.
22964ce7165Smrg    : > sub/conftest.c
23064ce7165Smrg    for i in 1 2 3 4 5 6; do
23164ce7165Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
23264ce7165Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
23364ce7165Smrg      # Solaris 8's {/usr,}/bin/sh.
23464ce7165Smrg      touch sub/conftst$i.h
23564ce7165Smrg    done
23664ce7165Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23764ce7165Smrg
238fb23d3a8Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
239fb23d3a8Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
240fb23d3a8Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
241fb23d3a8Smrg    # versions had trouble with output in subdirs
242fb23d3a8Smrg    am__obj=sub/conftest.${OBJEXT-o}
243fb23d3a8Smrg    am__minus_obj="-o $am__obj"
24464ce7165Smrg    case $depmode in
245fb23d3a8Smrg    gcc)
246fb23d3a8Smrg      # This depmode causes a compiler race in universal mode.
247fb23d3a8Smrg      test "$am__universal" = false || continue
248fb23d3a8Smrg      ;;
24964ce7165Smrg    nosideeffect)
25064ce7165Smrg      # after this tag, mechanisms are not by side-effect, so they'll
25164ce7165Smrg      # only be used when explicitly requested
25264ce7165Smrg      if test "x$enable_dependency_tracking" = xyes; then
25364ce7165Smrg	continue
25464ce7165Smrg      else
25564ce7165Smrg	break
25664ce7165Smrg      fi
25764ce7165Smrg      ;;
258fb23d3a8Smrg    msvisualcpp | msvcmsys)
259fb23d3a8Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
260fb23d3a8Smrg      # not run yet.  These depmodes are late enough in the game, and
261fb23d3a8Smrg      # so weak that their functioning should not be impacted.
262fb23d3a8Smrg      am__obj=conftest.${OBJEXT-o}
263fb23d3a8Smrg      am__minus_obj=
264fb23d3a8Smrg      ;;
26564ce7165Smrg    none) break ;;
26664ce7165Smrg    esac
26764ce7165Smrg    if depmode=$depmode \
268fb23d3a8Smrg       source=sub/conftest.c object=$am__obj \
26964ce7165Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
270fb23d3a8Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
27164ce7165Smrg         >/dev/null 2>conftest.err &&
27264ce7165Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27364ce7165Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
274fb23d3a8Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27564ce7165Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27664ce7165Smrg      # icc doesn't choke on unknown options, it will just issue warnings
27764ce7165Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
27864ce7165Smrg      # that says an option was ignored or not supported.
27964ce7165Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
28064ce7165Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
28164ce7165Smrg      # The diagnosis changed in icc 8.0:
28264ce7165Smrg      #   icc: Command line remark: option '-MP' not supported
28364ce7165Smrg      if (grep 'ignoring option' conftest.err ||
28464ce7165Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28564ce7165Smrg        am_cv_$1_dependencies_compiler_type=$depmode
28664ce7165Smrg        break
28764ce7165Smrg      fi
28864ce7165Smrg    fi
28964ce7165Smrg  done
29064ce7165Smrg
29164ce7165Smrg  cd ..
29264ce7165Smrg  rm -rf conftest.dir
29364ce7165Smrgelse
29464ce7165Smrg  am_cv_$1_dependencies_compiler_type=none
29564ce7165Smrgfi
29664ce7165Smrg])
29764ce7165SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29864ce7165SmrgAM_CONDITIONAL([am__fastdep$1], [
29964ce7165Smrg  test "x$enable_dependency_tracking" != xno \
30064ce7165Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
30164ce7165Smrg])
30264ce7165Smrg
30364ce7165Smrg
30464ce7165Smrg# AM_SET_DEPDIR
30564ce7165Smrg# -------------
30664ce7165Smrg# Choose a directory name for dependency files.
30764ce7165Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
30864ce7165SmrgAC_DEFUN([AM_SET_DEPDIR],
30964ce7165Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
31064ce7165SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
31164ce7165Smrg])
31264ce7165Smrg
31364ce7165Smrg
31464ce7165Smrg# AM_DEP_TRACK
31564ce7165Smrg# ------------
31664ce7165SmrgAC_DEFUN([AM_DEP_TRACK],
31764ce7165Smrg[AC_ARG_ENABLE(dependency-tracking,
31864ce7165Smrg[  --disable-dependency-tracking  speeds up one-time build
31964ce7165Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
32064ce7165Smrgif test "x$enable_dependency_tracking" != xno; then
32164ce7165Smrg  am_depcomp="$ac_aux_dir/depcomp"
32264ce7165Smrg  AMDEPBACKSLASH='\'
32364ce7165Smrgfi
32464ce7165SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32564ce7165SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32664ce7165Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32764ce7165Smrg])
32864ce7165Smrg
32964ce7165Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33064ce7165Smrg
331fb23d3a8Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
33264ce7165Smrg# Free Software Foundation, Inc.
33364ce7165Smrg#
33464ce7165Smrg# This file is free software; the Free Software Foundation
33564ce7165Smrg# gives unlimited permission to copy and/or distribute it,
33664ce7165Smrg# with or without modifications, as long as this notice is preserved.
33764ce7165Smrg
338fb23d3a8Smrg#serial 5
33964ce7165Smrg
34064ce7165Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34164ce7165Smrg# ------------------------------
34264ce7165SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
343fb23d3a8Smrg[{
344fb23d3a8Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
345fb23d3a8Smrg  # are listed without --file.  Let's play safe and only enable the eval
346fb23d3a8Smrg  # if we detect the quoting.
347fb23d3a8Smrg  case $CONFIG_FILES in
348fb23d3a8Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
349fb23d3a8Smrg  *)   set x $CONFIG_FILES ;;
350fb23d3a8Smrg  esac
351fb23d3a8Smrg  shift
352fb23d3a8Smrg  for mf
353fb23d3a8Smrg  do
354fb23d3a8Smrg    # Strip MF so we end up with the name of the file.
355fb23d3a8Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
356fb23d3a8Smrg    # Check whether this is an Automake generated Makefile or not.
357fb23d3a8Smrg    # We used to match only the files named `Makefile.in', but
358fb23d3a8Smrg    # some people rename them; so instead we look at the file content.
359fb23d3a8Smrg    # Grep'ing the first line is not enough: some people post-process
360fb23d3a8Smrg    # each Makefile.in and add a new line on top of each file to say so.
361fb23d3a8Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
362fb23d3a8Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
363fb23d3a8Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
364fb23d3a8Smrg      dirpart=`AS_DIRNAME("$mf")`
365fb23d3a8Smrg    else
366fb23d3a8Smrg      continue
367fb23d3a8Smrg    fi
368fb23d3a8Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
369fb23d3a8Smrg    # from the Makefile without running `make'.
370fb23d3a8Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
371fb23d3a8Smrg    test -z "$DEPDIR" && continue
372fb23d3a8Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
373fb23d3a8Smrg    test -z "am__include" && continue
374fb23d3a8Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
375fb23d3a8Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
376fb23d3a8Smrg    U=`sed -n 's/^U = //p' < "$mf"`
377fb23d3a8Smrg    # Find all dependency output files, they are included files with
378fb23d3a8Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
379fb23d3a8Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
380fb23d3a8Smrg    # expansion.
381fb23d3a8Smrg    for file in `sed -n "
382fb23d3a8Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
383fb23d3a8Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
384fb23d3a8Smrg      # Make sure the directory exists.
385fb23d3a8Smrg      test -f "$dirpart/$file" && continue
386fb23d3a8Smrg      fdir=`AS_DIRNAME(["$file"])`
387fb23d3a8Smrg      AS_MKDIR_P([$dirpart/$fdir])
388fb23d3a8Smrg      # echo "creating $dirpart/$file"
389fb23d3a8Smrg      echo '# dummy' > "$dirpart/$file"
390fb23d3a8Smrg    done
39164ce7165Smrg  done
392fb23d3a8Smrg}
39364ce7165Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
39464ce7165Smrg
39564ce7165Smrg
39664ce7165Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39764ce7165Smrg# -----------------------------
39864ce7165Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
39964ce7165Smrg#
40064ce7165Smrg# This code is only required when automatic dependency tracking
40164ce7165Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
40264ce7165Smrg# need in order to bootstrap the dependency handling code.
40364ce7165SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
40464ce7165Smrg[AC_CONFIG_COMMANDS([depfiles],
40564ce7165Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
40664ce7165Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
40764ce7165Smrg])
40864ce7165Smrg
40964ce7165Smrg# Do all the work for Automake.                             -*- Autoconf -*-
41064ce7165Smrg
41164ce7165Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
412fb23d3a8Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
41364ce7165Smrg#
41464ce7165Smrg# This file is free software; the Free Software Foundation
41564ce7165Smrg# gives unlimited permission to copy and/or distribute it,
41664ce7165Smrg# with or without modifications, as long as this notice is preserved.
41764ce7165Smrg
418fb23d3a8Smrg# serial 16
41964ce7165Smrg
42064ce7165Smrg# This macro actually does too much.  Some checks are only needed if
42164ce7165Smrg# your package does certain things.  But this isn't really a big deal.
42264ce7165Smrg
42364ce7165Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
42464ce7165Smrg# AM_INIT_AUTOMAKE([OPTIONS])
42564ce7165Smrg# -----------------------------------------------
42664ce7165Smrg# The call with PACKAGE and VERSION arguments is the old style
42764ce7165Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42864ce7165Smrg# and VERSION should now be passed to AC_INIT and removed from
42964ce7165Smrg# the call to AM_INIT_AUTOMAKE.
43064ce7165Smrg# We support both call styles for the transition.  After
43164ce7165Smrg# the next Automake release, Autoconf can make the AC_INIT
43264ce7165Smrg# arguments mandatory, and then we can depend on a new Autoconf
43364ce7165Smrg# release and drop the old call support.
43464ce7165SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
435fb23d3a8Smrg[AC_PREREQ([2.62])dnl
43664ce7165Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43764ce7165Smrgdnl the ones we care about.
43864ce7165Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43964ce7165SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
44064ce7165SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44164ce7165Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44264ce7165Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44364ce7165Smrg  # is not polluted with repeated "-I."
44464ce7165Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44564ce7165Smrg  # test to see if srcdir already configured
44664ce7165Smrg  if test -f $srcdir/config.status; then
44764ce7165Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44864ce7165Smrg  fi
44964ce7165Smrgfi
45064ce7165Smrg
45164ce7165Smrg# test whether we have cygpath
45264ce7165Smrgif test -z "$CYGPATH_W"; then
45364ce7165Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45464ce7165Smrg    CYGPATH_W='cygpath -w'
45564ce7165Smrg  else
45664ce7165Smrg    CYGPATH_W=echo
45764ce7165Smrg  fi
45864ce7165Smrgfi
45964ce7165SmrgAC_SUBST([CYGPATH_W])
46064ce7165Smrg
46164ce7165Smrg# Define the identity of the package.
46264ce7165Smrgdnl Distinguish between old-style and new-style calls.
46364ce7165Smrgm4_ifval([$2],
46464ce7165Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46564ce7165Smrg AC_SUBST([PACKAGE], [$1])dnl
46664ce7165Smrg AC_SUBST([VERSION], [$2])],
46764ce7165Smrg[_AM_SET_OPTIONS([$1])dnl
46864ce7165Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
46964ce7165Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
47064ce7165Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47164ce7165Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47264ce7165Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
47364ce7165Smrg
47464ce7165Smrg_AM_IF_OPTION([no-define],,
47564ce7165Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
47664ce7165Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
47764ce7165Smrg
47864ce7165Smrg# Some tools Automake needs.
47964ce7165SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48064ce7165SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48164ce7165SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
48264ce7165SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
48364ce7165SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
48464ce7165SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
48564ce7165SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
486fb23d3a8SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
487fb23d3a8SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
48864ce7165SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
48964ce7165Smrg# We need awk for the "check" target.  The system "awk" is bad on
49064ce7165Smrg# some platforms.
49164ce7165SmrgAC_REQUIRE([AC_PROG_AWK])dnl
49264ce7165SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
49364ce7165SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
49464ce7165Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
495fb23d3a8Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
496fb23d3a8Smrg			     [_AM_PROG_TAR([v7])])])
49764ce7165Smrg_AM_IF_OPTION([no-dependencies],,
49864ce7165Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
499fb23d3a8Smrg		  [_AM_DEPENDENCIES(CC)],
500fb23d3a8Smrg		  [define([AC_PROG_CC],
501fb23d3a8Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
50264ce7165SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
503fb23d3a8Smrg		  [_AM_DEPENDENCIES(CXX)],
504fb23d3a8Smrg		  [define([AC_PROG_CXX],
505fb23d3a8Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
50664ce7165SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
507fb23d3a8Smrg		  [_AM_DEPENDENCIES(OBJC)],
508fb23d3a8Smrg		  [define([AC_PROG_OBJC],
509fb23d3a8Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
51064ce7165Smrg])
511fb23d3a8Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
512fb23d3a8Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
513fb23d3a8Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
514fb23d3a8Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
515fb23d3a8SmrgAC_CONFIG_COMMANDS_PRE(dnl
516fb23d3a8Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
517fb23d3a8Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
51864ce7165Smrg])
51964ce7165Smrg
520fb23d3a8Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
521fb23d3a8Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
522fb23d3a8Smrgdnl mangled by Autoconf and run in a shell conditional statement.
523fb23d3a8Smrgm4_define([_AC_COMPILER_EXEEXT],
524fb23d3a8Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
525fb23d3a8Smrg
52664ce7165Smrg
52764ce7165Smrg# When config.status generates a header, we must update the stamp-h file.
52864ce7165Smrg# This file resides in the same directory as the config header
52964ce7165Smrg# that is generated.  The stamp files are numbered to have different names.
53064ce7165Smrg
53164ce7165Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
53264ce7165Smrg# loop where config.status creates the headers, so we can generate
53364ce7165Smrg# our stamp files there.
53464ce7165SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
53564ce7165Smrg[# Compute $1's index in $config_headers.
536fb23d3a8Smrg_am_arg=$1
53764ce7165Smrg_am_stamp_count=1
53864ce7165Smrgfor _am_header in $config_headers :; do
53964ce7165Smrg  case $_am_header in
540fb23d3a8Smrg    $_am_arg | $_am_arg:* )
54164ce7165Smrg      break ;;
54264ce7165Smrg    * )
54364ce7165Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
54464ce7165Smrg  esac
54564ce7165Smrgdone
546fb23d3a8Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
54764ce7165Smrg
548fb23d3a8Smrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
54964ce7165Smrg#
55064ce7165Smrg# This file is free software; the Free Software Foundation
55164ce7165Smrg# gives unlimited permission to copy and/or distribute it,
55264ce7165Smrg# with or without modifications, as long as this notice is preserved.
55364ce7165Smrg
55464ce7165Smrg# AM_PROG_INSTALL_SH
55564ce7165Smrg# ------------------
55664ce7165Smrg# Define $install_sh.
55764ce7165SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
55864ce7165Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
559fb23d3a8Smrgif test x"${install_sh}" != xset; then
560fb23d3a8Smrg  case $am_aux_dir in
561fb23d3a8Smrg  *\ * | *\	*)
562fb23d3a8Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
563fb23d3a8Smrg  *)
564fb23d3a8Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
565fb23d3a8Smrg  esac
566fb23d3a8Smrgfi
56764ce7165SmrgAC_SUBST(install_sh)])
56864ce7165Smrg
56964ce7165Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
57064ce7165Smrg#
57164ce7165Smrg# This file is free software; the Free Software Foundation
57264ce7165Smrg# gives unlimited permission to copy and/or distribute it,
57364ce7165Smrg# with or without modifications, as long as this notice is preserved.
57464ce7165Smrg
57564ce7165Smrg# serial 2
57664ce7165Smrg
57764ce7165Smrg# Check whether the underlying file-system supports filenames
57864ce7165Smrg# with a leading dot.  For instance MS-DOS doesn't.
57964ce7165SmrgAC_DEFUN([AM_SET_LEADING_DOT],
58064ce7165Smrg[rm -rf .tst 2>/dev/null
58164ce7165Smrgmkdir .tst 2>/dev/null
58264ce7165Smrgif test -d .tst; then
58364ce7165Smrg  am__leading_dot=.
58464ce7165Smrgelse
58564ce7165Smrg  am__leading_dot=_
58664ce7165Smrgfi
58764ce7165Smrgrmdir .tst 2>/dev/null
58864ce7165SmrgAC_SUBST([am__leading_dot])])
58964ce7165Smrg
59064ce7165Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
59164ce7165Smrg# From Jim Meyering
59264ce7165Smrg
593fb23d3a8Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
59464ce7165Smrg# Free Software Foundation, Inc.
59564ce7165Smrg#
59664ce7165Smrg# This file is free software; the Free Software Foundation
59764ce7165Smrg# gives unlimited permission to copy and/or distribute it,
59864ce7165Smrg# with or without modifications, as long as this notice is preserved.
59964ce7165Smrg
600fb23d3a8Smrg# serial 5
60164ce7165Smrg
602fb23d3a8Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
603fb23d3a8Smrg# ----------------------------------
604fb23d3a8Smrg# Control maintainer-specific portions of Makefiles.
605fb23d3a8Smrg# Default is to disable them, unless `enable' is passed literally.
606fb23d3a8Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
607fb23d3a8Smrg# can override the default with the --enable/--disable switch.
60864ce7165SmrgAC_DEFUN([AM_MAINTAINER_MODE],
609fb23d3a8Smrg[m4_case(m4_default([$1], [disable]),
610fb23d3a8Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
611fb23d3a8Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
612fb23d3a8Smrg       [m4_define([am_maintainer_other], [enable])
613fb23d3a8Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
614fb23d3a8SmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
615fb23d3a8Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
616fb23d3a8Smrg  AC_ARG_ENABLE([maintainer-mode],
617fb23d3a8Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
61864ce7165Smrg			  (and sometimes confusing) to the casual installer],
619fb23d3a8Smrg      [USE_MAINTAINER_MODE=$enableval],
620fb23d3a8Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
62164ce7165Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
622fb23d3a8Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
62364ce7165Smrg  MAINT=$MAINTAINER_MODE_TRUE
624fb23d3a8Smrg  AC_SUBST([MAINT])dnl
62564ce7165Smrg]
62664ce7165Smrg)
62764ce7165Smrg
62864ce7165SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
62964ce7165Smrg
63064ce7165Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
63164ce7165Smrg
632fb23d3a8Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
63364ce7165Smrg#
63464ce7165Smrg# This file is free software; the Free Software Foundation
63564ce7165Smrg# gives unlimited permission to copy and/or distribute it,
63664ce7165Smrg# with or without modifications, as long as this notice is preserved.
63764ce7165Smrg
638fb23d3a8Smrg# serial 4
63964ce7165Smrg
64064ce7165Smrg# AM_MAKE_INCLUDE()
64164ce7165Smrg# -----------------
64264ce7165Smrg# Check to see how make treats includes.
64364ce7165SmrgAC_DEFUN([AM_MAKE_INCLUDE],
64464ce7165Smrg[am_make=${MAKE-make}
64564ce7165Smrgcat > confinc << 'END'
64664ce7165Smrgam__doit:
647fb23d3a8Smrg	@echo this is the am__doit target
64864ce7165Smrg.PHONY: am__doit
64964ce7165SmrgEND
65064ce7165Smrg# If we don't find an include directive, just comment out the code.
65164ce7165SmrgAC_MSG_CHECKING([for style of include used by $am_make])
65264ce7165Smrgam__include="#"
65364ce7165Smrgam__quote=
65464ce7165Smrg_am_result=none
65564ce7165Smrg# First try GNU make style include.
65664ce7165Smrgecho "include confinc" > confmf
657fb23d3a8Smrg# Ignore all kinds of additional output from `make'.
658fb23d3a8Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
659fb23d3a8Smrg*the\ am__doit\ target*)
660fb23d3a8Smrg  am__include=include
661fb23d3a8Smrg  am__quote=
662fb23d3a8Smrg  _am_result=GNU
663fb23d3a8Smrg  ;;
664fb23d3a8Smrgesac
66564ce7165Smrg# Now try BSD make style include.
66664ce7165Smrgif test "$am__include" = "#"; then
66764ce7165Smrg   echo '.include "confinc"' > confmf
668fb23d3a8Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
669fb23d3a8Smrg   *the\ am__doit\ target*)
670fb23d3a8Smrg     am__include=.include
671fb23d3a8Smrg     am__quote="\""
672fb23d3a8Smrg     _am_result=BSD
673fb23d3a8Smrg     ;;
674fb23d3a8Smrg   esac
67564ce7165Smrgfi
67664ce7165SmrgAC_SUBST([am__include])
67764ce7165SmrgAC_SUBST([am__quote])
67864ce7165SmrgAC_MSG_RESULT([$_am_result])
67964ce7165Smrgrm -f confinc confmf
68064ce7165Smrg])
68164ce7165Smrg
68264ce7165Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
68364ce7165Smrg
684fb23d3a8Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
68564ce7165Smrg# Free Software Foundation, Inc.
68664ce7165Smrg#
68764ce7165Smrg# This file is free software; the Free Software Foundation
68864ce7165Smrg# gives unlimited permission to copy and/or distribute it,
68964ce7165Smrg# with or without modifications, as long as this notice is preserved.
69064ce7165Smrg
691fb23d3a8Smrg# serial 6
69264ce7165Smrg
69364ce7165Smrg# AM_MISSING_PROG(NAME, PROGRAM)
69464ce7165Smrg# ------------------------------
69564ce7165SmrgAC_DEFUN([AM_MISSING_PROG],
69664ce7165Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
69764ce7165Smrg$1=${$1-"${am_missing_run}$2"}
69864ce7165SmrgAC_SUBST($1)])
69964ce7165Smrg
70064ce7165Smrg
70164ce7165Smrg# AM_MISSING_HAS_RUN
70264ce7165Smrg# ------------------
70364ce7165Smrg# Define MISSING if not defined so far and test if it supports --run.
70464ce7165Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
70564ce7165SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
70664ce7165Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
70764ce7165SmrgAC_REQUIRE_AUX_FILE([missing])dnl
708fb23d3a8Smrgif test x"${MISSING+set}" != xset; then
709fb23d3a8Smrg  case $am_aux_dir in
710fb23d3a8Smrg  *\ * | *\	*)
711fb23d3a8Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
712fb23d3a8Smrg  *)
713fb23d3a8Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
714fb23d3a8Smrg  esac
715fb23d3a8Smrgfi
71664ce7165Smrg# Use eval to expand $SHELL
71764ce7165Smrgif eval "$MISSING --run true"; then
71864ce7165Smrg  am_missing_run="$MISSING --run "
71964ce7165Smrgelse
72064ce7165Smrg  am_missing_run=
72164ce7165Smrg  AC_MSG_WARN([`missing' script is too old or missing])
72264ce7165Smrgfi
72364ce7165Smrg])
72464ce7165Smrg
72564ce7165Smrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
72664ce7165Smrg#
72764ce7165Smrg# This file is free software; the Free Software Foundation
72864ce7165Smrg# gives unlimited permission to copy and/or distribute it,
72964ce7165Smrg# with or without modifications, as long as this notice is preserved.
73064ce7165Smrg
73164ce7165Smrg# AM_PROG_MKDIR_P
73264ce7165Smrg# ---------------
73364ce7165Smrg# Check for `mkdir -p'.
73464ce7165SmrgAC_DEFUN([AM_PROG_MKDIR_P],
73564ce7165Smrg[AC_PREREQ([2.60])dnl
73664ce7165SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
73764ce7165Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
73864ce7165Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
73964ce7165Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
74064ce7165Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
74164ce7165Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
74264ce7165Smrgdnl adjustment using top_builddir (which is defined more often than
74364ce7165Smrgdnl MKDIR_P).
74464ce7165SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
74564ce7165Smrgcase $mkdir_p in
74664ce7165Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
74764ce7165Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
74864ce7165Smrgesac
74964ce7165Smrg])
75064ce7165Smrg
75164ce7165Smrg# Helper functions for option handling.                     -*- Autoconf -*-
75264ce7165Smrg
753fb23d3a8Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
75464ce7165Smrg#
75564ce7165Smrg# This file is free software; the Free Software Foundation
75664ce7165Smrg# gives unlimited permission to copy and/or distribute it,
75764ce7165Smrg# with or without modifications, as long as this notice is preserved.
75864ce7165Smrg
759fb23d3a8Smrg# serial 4
76064ce7165Smrg
76164ce7165Smrg# _AM_MANGLE_OPTION(NAME)
76264ce7165Smrg# -----------------------
76364ce7165SmrgAC_DEFUN([_AM_MANGLE_OPTION],
76464ce7165Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
76564ce7165Smrg
76664ce7165Smrg# _AM_SET_OPTION(NAME)
76764ce7165Smrg# ------------------------------
76864ce7165Smrg# Set option NAME.  Presently that only means defining a flag for this option.
76964ce7165SmrgAC_DEFUN([_AM_SET_OPTION],
77064ce7165Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
77164ce7165Smrg
77264ce7165Smrg# _AM_SET_OPTIONS(OPTIONS)
77364ce7165Smrg# ----------------------------------
77464ce7165Smrg# OPTIONS is a space-separated list of Automake options.
77564ce7165SmrgAC_DEFUN([_AM_SET_OPTIONS],
776fb23d3a8Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
77764ce7165Smrg
77864ce7165Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
77964ce7165Smrg# -------------------------------------------
78064ce7165Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
78164ce7165SmrgAC_DEFUN([_AM_IF_OPTION],
78264ce7165Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
78364ce7165Smrg
78464ce7165Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
78564ce7165Smrg
786fb23d3a8Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
78764ce7165Smrg# Free Software Foundation, Inc.
78864ce7165Smrg#
78964ce7165Smrg# This file is free software; the Free Software Foundation
79064ce7165Smrg# gives unlimited permission to copy and/or distribute it,
79164ce7165Smrg# with or without modifications, as long as this notice is preserved.
79264ce7165Smrg
793fb23d3a8Smrg# serial 5
79464ce7165Smrg
79564ce7165Smrg# AM_SANITY_CHECK
79664ce7165Smrg# ---------------
79764ce7165SmrgAC_DEFUN([AM_SANITY_CHECK],
79864ce7165Smrg[AC_MSG_CHECKING([whether build environment is sane])
79964ce7165Smrg# Just in case
80064ce7165Smrgsleep 1
80164ce7165Smrgecho timestamp > conftest.file
802fb23d3a8Smrg# Reject unsafe characters in $srcdir or the absolute working directory
803fb23d3a8Smrg# name.  Accept space and tab only in the latter.
804fb23d3a8Smrgam_lf='
805fb23d3a8Smrg'
806fb23d3a8Smrgcase `pwd` in
807fb23d3a8Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
808fb23d3a8Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
809fb23d3a8Smrgesac
810fb23d3a8Smrgcase $srcdir in
811fb23d3a8Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
812fb23d3a8Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
813fb23d3a8Smrgesac
814fb23d3a8Smrg
81564ce7165Smrg# Do `set' in a subshell so we don't clobber the current shell's
81664ce7165Smrg# arguments.  Must try -L first in case configure is actually a
81764ce7165Smrg# symlink; some systems play weird games with the mod time of symlinks
81864ce7165Smrg# (eg FreeBSD returns the mod time of the symlink's containing
81964ce7165Smrg# directory).
82064ce7165Smrgif (
821fb23d3a8Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
82264ce7165Smrg   if test "$[*]" = "X"; then
82364ce7165Smrg      # -L didn't work.
824fb23d3a8Smrg      set X `ls -t "$srcdir/configure" conftest.file`
82564ce7165Smrg   fi
82664ce7165Smrg   rm -f conftest.file
82764ce7165Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
82864ce7165Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
82964ce7165Smrg
83064ce7165Smrg      # If neither matched, then we have a broken ls.  This can happen
83164ce7165Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
83264ce7165Smrg      # broken ls alias from the environment.  This has actually
83364ce7165Smrg      # happened.  Such a system could not be considered "sane".
83464ce7165Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
83564ce7165Smrgalias in your environment])
83664ce7165Smrg   fi
83764ce7165Smrg
83864ce7165Smrg   test "$[2]" = conftest.file
83964ce7165Smrg   )
84064ce7165Smrgthen
84164ce7165Smrg   # Ok.
84264ce7165Smrg   :
84364ce7165Smrgelse
84464ce7165Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
84564ce7165SmrgCheck your system clock])
84664ce7165Smrgfi
84764ce7165SmrgAC_MSG_RESULT(yes)])
84864ce7165Smrg
849fb23d3a8Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
850fb23d3a8Smrg#
851fb23d3a8Smrg# This file is free software; the Free Software Foundation
852fb23d3a8Smrg# gives unlimited permission to copy and/or distribute it,
853fb23d3a8Smrg# with or without modifications, as long as this notice is preserved.
854fb23d3a8Smrg
855fb23d3a8Smrg# serial 1
856fb23d3a8Smrg
857fb23d3a8Smrg# AM_SILENT_RULES([DEFAULT])
858fb23d3a8Smrg# --------------------------
859fb23d3a8Smrg# Enable less verbose build rules; with the default set to DEFAULT
860fb23d3a8Smrg# (`yes' being less verbose, `no' or empty being verbose).
861fb23d3a8SmrgAC_DEFUN([AM_SILENT_RULES],
862fb23d3a8Smrg[AC_ARG_ENABLE([silent-rules],
863fb23d3a8Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
864fb23d3a8Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
865fb23d3a8Smrgcase $enable_silent_rules in
866fb23d3a8Smrgyes) AM_DEFAULT_VERBOSITY=0;;
867fb23d3a8Smrgno)  AM_DEFAULT_VERBOSITY=1;;
868fb23d3a8Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
869fb23d3a8Smrgesac
870fb23d3a8SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
871fb23d3a8SmrgAM_BACKSLASH='\'
872fb23d3a8SmrgAC_SUBST([AM_BACKSLASH])dnl
873fb23d3a8Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
874fb23d3a8Smrg])
875fb23d3a8Smrg
87664ce7165Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
87764ce7165Smrg#
87864ce7165Smrg# This file is free software; the Free Software Foundation
87964ce7165Smrg# gives unlimited permission to copy and/or distribute it,
88064ce7165Smrg# with or without modifications, as long as this notice is preserved.
88164ce7165Smrg
88264ce7165Smrg# AM_PROG_INSTALL_STRIP
88364ce7165Smrg# ---------------------
88464ce7165Smrg# One issue with vendor `install' (even GNU) is that you can't
88564ce7165Smrg# specify the program used to strip binaries.  This is especially
88664ce7165Smrg# annoying in cross-compiling environments, where the build's strip
88764ce7165Smrg# is unlikely to handle the host's binaries.
88864ce7165Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
88964ce7165Smrg# always use install-sh in `make install-strip', and initialize
89064ce7165Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
89164ce7165SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
89264ce7165Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
89364ce7165Smrg# Installed binaries are usually stripped using `strip' when the user
89464ce7165Smrg# run `make install-strip'.  However `strip' might not be the right
89564ce7165Smrg# tool to use in cross-compilation environments, therefore Automake
89664ce7165Smrg# will honor the `STRIP' environment variable to overrule this program.
89764ce7165Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
89864ce7165Smrgif test "$cross_compiling" != no; then
89964ce7165Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
90064ce7165Smrgfi
90164ce7165SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
90264ce7165SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
90364ce7165Smrg
904fb23d3a8Smrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
90564ce7165Smrg#
90664ce7165Smrg# This file is free software; the Free Software Foundation
90764ce7165Smrg# gives unlimited permission to copy and/or distribute it,
90864ce7165Smrg# with or without modifications, as long as this notice is preserved.
90964ce7165Smrg
910fb23d3a8Smrg# serial 2
911fb23d3a8Smrg
91264ce7165Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
91364ce7165Smrg# ---------------------------
914fb23d3a8Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
91564ce7165Smrg# This macro is traced by Automake.
91664ce7165SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
91764ce7165Smrg
918fb23d3a8Smrg# AM_SUBST_NOTMAKE(VARIABLE)
919fb23d3a8Smrg# ---------------------------
920fb23d3a8Smrg# Public sister of _AM_SUBST_NOTMAKE.
921fb23d3a8SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
922fb23d3a8Smrg
92364ce7165Smrg# Check how to create a tarball.                            -*- Autoconf -*-
92464ce7165Smrg
92564ce7165Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
92664ce7165Smrg#
92764ce7165Smrg# This file is free software; the Free Software Foundation
92864ce7165Smrg# gives unlimited permission to copy and/or distribute it,
92964ce7165Smrg# with or without modifications, as long as this notice is preserved.
93064ce7165Smrg
93164ce7165Smrg# serial 2
93264ce7165Smrg
93364ce7165Smrg# _AM_PROG_TAR(FORMAT)
93464ce7165Smrg# --------------------
93564ce7165Smrg# Check how to create a tarball in format FORMAT.
93664ce7165Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
93764ce7165Smrg#
93864ce7165Smrg# Substitute a variable $(am__tar) that is a command
93964ce7165Smrg# writing to stdout a FORMAT-tarball containing the directory
94064ce7165Smrg# $tardir.
94164ce7165Smrg#     tardir=directory && $(am__tar) > result.tar
94264ce7165Smrg#
94364ce7165Smrg# Substitute a variable $(am__untar) that extract such
94464ce7165Smrg# a tarball read from stdin.
94564ce7165Smrg#     $(am__untar) < result.tar
94664ce7165SmrgAC_DEFUN([_AM_PROG_TAR],
94764ce7165Smrg[# Always define AMTAR for backward compatibility.
94864ce7165SmrgAM_MISSING_PROG([AMTAR], [tar])
94964ce7165Smrgm4_if([$1], [v7],
95064ce7165Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
95164ce7165Smrg     [m4_case([$1], [ustar],, [pax],,
95264ce7165Smrg              [m4_fatal([Unknown tar format])])
95364ce7165SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
95464ce7165Smrg# Loop over all known methods to create a tar archive until one works.
95564ce7165Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
95664ce7165Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
95764ce7165Smrg# Do not fold the above two line into one, because Tru64 sh and
95864ce7165Smrg# Solaris sh will not grok spaces in the rhs of `-'.
95964ce7165Smrgfor _am_tool in $_am_tools
96064ce7165Smrgdo
96164ce7165Smrg  case $_am_tool in
96264ce7165Smrg  gnutar)
96364ce7165Smrg    for _am_tar in tar gnutar gtar;
96464ce7165Smrg    do
96564ce7165Smrg      AM_RUN_LOG([$_am_tar --version]) && break
96664ce7165Smrg    done
96764ce7165Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
96864ce7165Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
96964ce7165Smrg    am__untar="$_am_tar -xf -"
97064ce7165Smrg    ;;
97164ce7165Smrg  plaintar)
97264ce7165Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
97364ce7165Smrg    # ustar tarball either.
97464ce7165Smrg    (tar --version) >/dev/null 2>&1 && continue
97564ce7165Smrg    am__tar='tar chf - "$$tardir"'
97664ce7165Smrg    am__tar_='tar chf - "$tardir"'
97764ce7165Smrg    am__untar='tar xf -'
97864ce7165Smrg    ;;
97964ce7165Smrg  pax)
98064ce7165Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
98164ce7165Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
98264ce7165Smrg    am__untar='pax -r'
98364ce7165Smrg    ;;
98464ce7165Smrg  cpio)
98564ce7165Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
98664ce7165Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
98764ce7165Smrg    am__untar='cpio -i -H $1 -d'
98864ce7165Smrg    ;;
98964ce7165Smrg  none)
99064ce7165Smrg    am__tar=false
99164ce7165Smrg    am__tar_=false
99264ce7165Smrg    am__untar=false
99364ce7165Smrg    ;;
99464ce7165Smrg  esac
99564ce7165Smrg
99664ce7165Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
99764ce7165Smrg  # and am__untar set.
99864ce7165Smrg  test -n "${am_cv_prog_tar_$1}" && break
99964ce7165Smrg
100064ce7165Smrg  # tar/untar a dummy directory, and stop if the command works
100164ce7165Smrg  rm -rf conftest.dir
100264ce7165Smrg  mkdir conftest.dir
100364ce7165Smrg  echo GrepMe > conftest.dir/file
100464ce7165Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
100564ce7165Smrg  rm -rf conftest.dir
100664ce7165Smrg  if test -s conftest.tar; then
100764ce7165Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
100864ce7165Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
100964ce7165Smrg  fi
101064ce7165Smrgdone
101164ce7165Smrgrm -rf conftest.dir
101264ce7165Smrg
101364ce7165SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
101464ce7165SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
101564ce7165SmrgAC_SUBST([am__tar])
101664ce7165SmrgAC_SUBST([am__untar])
101764ce7165Smrg]) # _AM_PROG_TAR
101864ce7165Smrg
10193544ea2eSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
10203544ea2eSmrg# 
10213544ea2eSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
10223544ea2eSmrg#
10233544ea2eSmrg# This program is free software; you can redistribute it and/or modify
10243544ea2eSmrg# it under the terms of the GNU General Public License as published by
10253544ea2eSmrg# the Free Software Foundation; either version 2 of the License, or
10263544ea2eSmrg# (at your option) any later version.
10273544ea2eSmrg#
10283544ea2eSmrg# This program is distributed in the hope that it will be useful, but
10293544ea2eSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
10303544ea2eSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10313544ea2eSmrg# General Public License for more details.
10323544ea2eSmrg#
10333544ea2eSmrg# You should have received a copy of the GNU General Public License
10343544ea2eSmrg# along with this program; if not, write to the Free Software
10353544ea2eSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
10363544ea2eSmrg#
10373544ea2eSmrg# As a special exception to the GNU General Public License, if you
10383544ea2eSmrg# distribute this file as part of a program that contains a
10393544ea2eSmrg# configuration script generated by Autoconf, you may include it under
10403544ea2eSmrg# the same distribution terms that you use for the rest of that program.
10413544ea2eSmrg
10423544ea2eSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
10433544ea2eSmrg# ----------------------------------
10443544ea2eSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
10453544ea2eSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
10463544ea2eSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
10473544ea2eSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
10483544ea2eSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
10493544ea2eSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
10503544ea2eSmrgfi
10513544ea2eSmrgif test -n "$PKG_CONFIG"; then
10523544ea2eSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
10533544ea2eSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
10543544ea2eSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
10553544ea2eSmrg		AC_MSG_RESULT([yes])
10563544ea2eSmrg	else
10573544ea2eSmrg		AC_MSG_RESULT([no])
10583544ea2eSmrg		PKG_CONFIG=""
10593544ea2eSmrg	fi
10603544ea2eSmrg		
10613544ea2eSmrgfi[]dnl
10623544ea2eSmrg])# PKG_PROG_PKG_CONFIG
10633544ea2eSmrg
10643544ea2eSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10653544ea2eSmrg#
10663544ea2eSmrg# Check to see whether a particular set of modules exists.  Similar
10673544ea2eSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
10683544ea2eSmrg#
10693544ea2eSmrg#
10703544ea2eSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
10713544ea2eSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
10723544ea2eSmrg# PKG_CHECK_EXISTS manually
10733544ea2eSmrg# --------------------------------------------------------------
10743544ea2eSmrgAC_DEFUN([PKG_CHECK_EXISTS],
10753544ea2eSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
10763544ea2eSmrgif test -n "$PKG_CONFIG" && \
10773544ea2eSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
10783544ea2eSmrg  m4_ifval([$2], [$2], [:])
10793544ea2eSmrgm4_ifvaln([$3], [else
10803544ea2eSmrg  $3])dnl
10813544ea2eSmrgfi])
10823544ea2eSmrg
10833544ea2eSmrg
10843544ea2eSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
10853544ea2eSmrg# ---------------------------------------------
10863544ea2eSmrgm4_define([_PKG_CONFIG],
10873544ea2eSmrg[if test -n "$$1"; then
10883544ea2eSmrg    pkg_cv_[]$1="$$1"
10893544ea2eSmrg elif test -n "$PKG_CONFIG"; then
10903544ea2eSmrg    PKG_CHECK_EXISTS([$3],
10913544ea2eSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
10923544ea2eSmrg		     [pkg_failed=yes])
10933544ea2eSmrg else
10943544ea2eSmrg    pkg_failed=untried
10953544ea2eSmrgfi[]dnl
10963544ea2eSmrg])# _PKG_CONFIG
10973544ea2eSmrg
10983544ea2eSmrg# _PKG_SHORT_ERRORS_SUPPORTED
10993544ea2eSmrg# -----------------------------
11003544ea2eSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
11013544ea2eSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
11023544ea2eSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
11033544ea2eSmrg        _pkg_short_errors_supported=yes
11043544ea2eSmrgelse
11053544ea2eSmrg        _pkg_short_errors_supported=no
11063544ea2eSmrgfi[]dnl
11073544ea2eSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
11083544ea2eSmrg
11093544ea2eSmrg
11103544ea2eSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
11113544ea2eSmrg# [ACTION-IF-NOT-FOUND])
11123544ea2eSmrg#
11133544ea2eSmrg#
11143544ea2eSmrg# Note that if there is a possibility the first call to
11153544ea2eSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
11163544ea2eSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
11173544ea2eSmrg#
11183544ea2eSmrg#
11193544ea2eSmrg# --------------------------------------------------------------
11203544ea2eSmrgAC_DEFUN([PKG_CHECK_MODULES],
11213544ea2eSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
11223544ea2eSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
11233544ea2eSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
11243544ea2eSmrg
11253544ea2eSmrgpkg_failed=no
11263544ea2eSmrgAC_MSG_CHECKING([for $1])
11273544ea2eSmrg
11283544ea2eSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
11293544ea2eSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
11303544ea2eSmrg
11313544ea2eSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
11323544ea2eSmrgand $1[]_LIBS to avoid the need to call pkg-config.
11333544ea2eSmrgSee the pkg-config man page for more details.])
11343544ea2eSmrg
11353544ea2eSmrgif test $pkg_failed = yes; then
11363544ea2eSmrg        _PKG_SHORT_ERRORS_SUPPORTED
11373544ea2eSmrg        if test $_pkg_short_errors_supported = yes; then
11383544ea2eSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
11393544ea2eSmrg        else 
11403544ea2eSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
11413544ea2eSmrg        fi
11423544ea2eSmrg	# Put the nasty error message in config.log where it belongs
11433544ea2eSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
11443544ea2eSmrg
11453544ea2eSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
11463544ea2eSmrg[Package requirements ($2) were not met:
11473544ea2eSmrg
11483544ea2eSmrg$$1_PKG_ERRORS
11493544ea2eSmrg
11503544ea2eSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
11513544ea2eSmrginstalled software in a non-standard prefix.
11523544ea2eSmrg
11533544ea2eSmrg_PKG_TEXT
11543544ea2eSmrg])],
11553544ea2eSmrg		[AC_MSG_RESULT([no])
11563544ea2eSmrg                $4])
11573544ea2eSmrgelif test $pkg_failed = untried; then
11583544ea2eSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
11593544ea2eSmrg[The pkg-config script could not be found or is too old.  Make sure it
11603544ea2eSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
11613544ea2eSmrgpath to pkg-config.
11623544ea2eSmrg
11633544ea2eSmrg_PKG_TEXT
11643544ea2eSmrg
11653544ea2eSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
11663544ea2eSmrg		[$4])
11673544ea2eSmrgelse
11683544ea2eSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
11693544ea2eSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
11703544ea2eSmrg        AC_MSG_RESULT([yes])
11713544ea2eSmrg	ifelse([$3], , :, [$3])
11723544ea2eSmrgfi[]dnl
11733544ea2eSmrg])# PKG_CHECK_MODULES
11743544ea2eSmrg
1175fb23d3a8Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
117664ce7165Smrgdnl
1177169a0819Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
117864ce7165Smrgdnl 
117964ce7165Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1180169a0819Smrgdnl copy of this software and associated documentation files (the "Software"),
1181169a0819Smrgdnl to deal in the Software without restriction, including without limitation
1182169a0819Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1183169a0819Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1184169a0819Smrgdnl Software is furnished to do so, subject to the following conditions:
118564ce7165Smrgdnl
1186169a0819Smrgdnl The above copyright notice and this permission notice (including the next
1187169a0819Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1188169a0819Smrgdnl Software.
118964ce7165Smrgdnl
1190169a0819Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1191169a0819Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1192169a0819Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1193169a0819Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1194169a0819Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1195169a0819Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1196169a0819Smrgdnl DEALINGS IN THE SOFTWARE.
119764ce7165Smrg
119864ce7165Smrg# XORG_MACROS_VERSION(required-version)
119964ce7165Smrg# -------------------------------------
120064ce7165Smrg# Minimum version: 1.1.0
120164ce7165Smrg#
120264ce7165Smrg# If you're using a macro added in Version 1.1 or newer, include this in
120364ce7165Smrg# your configure.ac with the minimum required version, such as:
120464ce7165Smrg# XORG_MACROS_VERSION(1.1)
120564ce7165Smrg#
1206fb23d3a8Smrg# To ensure that this macro is defined, also add:
1207fb23d3a8Smrg# m4_ifndef([XORG_MACROS_VERSION],
1208fb23d3a8Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
120964ce7165Smrg#
121064ce7165Smrg#
121164ce7165Smrg# See the "minimum version" comment for each macro you use to see what 
121264ce7165Smrg# version you require.
1213fb23d3a8Smrgm4_defun([XORG_MACROS_VERSION],[
12143544ea2eSmrgm4_define([vers_have], [1.17])
1215fb23d3a8Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1216fb23d3a8Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1217fb23d3a8Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1218fb23d3a8Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1219fb23d3a8Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1220fb23d3a8Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1221fb23d3a8Smrgm4_undefine([vers_have])
1222fb23d3a8Smrgm4_undefine([maj_have])
1223fb23d3a8Smrgm4_undefine([maj_needed])
122464ce7165Smrg]) # XORG_MACROS_VERSION
122564ce7165Smrg
122664ce7165Smrg# XORG_PROG_RAWCPP()
122764ce7165Smrg# ------------------
122864ce7165Smrg# Minimum version: 1.0.0
122964ce7165Smrg#
123064ce7165Smrg# Find cpp program and necessary flags for use in pre-processing text files
123164ce7165Smrg# such as man pages and config files
123264ce7165SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
123364ce7165SmrgAC_REQUIRE([AC_PROG_CPP])
123464ce7165SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
123564ce7165Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
123664ce7165Smrg
123764ce7165Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
123864ce7165Smrg# which is not the best choice for supporting other OS'es, but covers most
123964ce7165Smrg# of the ones we need for now.
124064ce7165SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
12413544ea2eSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
124264ce7165Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
124364ce7165Smrg	AC_MSG_RESULT([no])
124464ce7165Smrgelse
124564ce7165Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
124664ce7165Smrg		RAWCPPFLAGS=-undef
124764ce7165Smrg		AC_MSG_RESULT([yes])
1248fb23d3a8Smrg	# under Cygwin unix is still defined even with -undef
1249fb23d3a8Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1250fb23d3a8Smrg		RAWCPPFLAGS="-undef -ansi"
1251fb23d3a8Smrg		AC_MSG_RESULT([yes, with -ansi])
125264ce7165Smrg	else
125364ce7165Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
125464ce7165Smrg	fi
125564ce7165Smrgfi
125664ce7165Smrgrm -f conftest.$ac_ext
125764ce7165Smrg
125864ce7165SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
12593544ea2eSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
126064ce7165Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
126164ce7165Smrg	AC_MSG_RESULT([no])
126264ce7165Smrgelse
126364ce7165Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
126464ce7165Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
126564ce7165Smrg		AC_MSG_RESULT([yes])
126664ce7165Smrg	else
126764ce7165Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
126864ce7165Smrg	fi
126964ce7165Smrgfi
127064ce7165Smrgrm -f conftest.$ac_ext
127164ce7165SmrgAC_SUBST(RAWCPPFLAGS)
127264ce7165Smrg]) # XORG_PROG_RAWCPP
127364ce7165Smrg
127464ce7165Smrg# XORG_MANPAGE_SECTIONS()
127564ce7165Smrg# -----------------------
127664ce7165Smrg# Minimum version: 1.0.0
127764ce7165Smrg#
127864ce7165Smrg# Determine which sections man pages go in for the different man page types
127964ce7165Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
128064ce7165Smrg# Not sure if there's any better way than just hardcoding by OS name.
128164ce7165Smrg# Override default settings by setting environment variables
1282169a0819Smrg# Added MAN_SUBSTS in version 1.8
1283169a0819Smrg# Added AC_PROG_SED in version 1.8
128464ce7165Smrg
128564ce7165SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
128664ce7165SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1287169a0819SmrgAC_REQUIRE([AC_PROG_SED])
128864ce7165Smrg
128964ce7165Smrgif test x$APP_MAN_SUFFIX = x    ; then
129064ce7165Smrg    APP_MAN_SUFFIX=1
129164ce7165Smrgfi
129264ce7165Smrgif test x$APP_MAN_DIR = x    ; then
129364ce7165Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
129464ce7165Smrgfi
129564ce7165Smrg
129664ce7165Smrgif test x$LIB_MAN_SUFFIX = x    ; then
129764ce7165Smrg    LIB_MAN_SUFFIX=3
129864ce7165Smrgfi
129964ce7165Smrgif test x$LIB_MAN_DIR = x    ; then
130064ce7165Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
130164ce7165Smrgfi
130264ce7165Smrg
130364ce7165Smrgif test x$FILE_MAN_SUFFIX = x    ; then
130464ce7165Smrg    case $host_os in
130564ce7165Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
130664ce7165Smrg	*)		FILE_MAN_SUFFIX=5  ;;
130764ce7165Smrg    esac
130864ce7165Smrgfi
130964ce7165Smrgif test x$FILE_MAN_DIR = x    ; then
131064ce7165Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
131164ce7165Smrgfi
131264ce7165Smrg
131364ce7165Smrgif test x$MISC_MAN_SUFFIX = x    ; then
131464ce7165Smrg    case $host_os in
131564ce7165Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
131664ce7165Smrg	*)		MISC_MAN_SUFFIX=7  ;;
131764ce7165Smrg    esac
131864ce7165Smrgfi
131964ce7165Smrgif test x$MISC_MAN_DIR = x    ; then
132064ce7165Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
132164ce7165Smrgfi
132264ce7165Smrg
132364ce7165Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
132464ce7165Smrg    case $host_os in
132564ce7165Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
132664ce7165Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
132764ce7165Smrg    esac
132864ce7165Smrgfi
132964ce7165Smrgif test x$DRIVER_MAN_DIR = x    ; then
133064ce7165Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
133164ce7165Smrgfi
133264ce7165Smrg
133364ce7165Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
133464ce7165Smrg    case $host_os in
133564ce7165Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
133664ce7165Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
133764ce7165Smrg    esac
133864ce7165Smrgfi
133964ce7165Smrgif test x$ADMIN_MAN_DIR = x    ; then
134064ce7165Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
134164ce7165Smrgfi
134264ce7165Smrg
134364ce7165Smrg
134464ce7165SmrgAC_SUBST([APP_MAN_SUFFIX])
134564ce7165SmrgAC_SUBST([LIB_MAN_SUFFIX])
134664ce7165SmrgAC_SUBST([FILE_MAN_SUFFIX])
134764ce7165SmrgAC_SUBST([MISC_MAN_SUFFIX])
134864ce7165SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
134964ce7165SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
135064ce7165SmrgAC_SUBST([APP_MAN_DIR])
135164ce7165SmrgAC_SUBST([LIB_MAN_DIR])
135264ce7165SmrgAC_SUBST([FILE_MAN_DIR])
135364ce7165SmrgAC_SUBST([MISC_MAN_DIR])
135464ce7165SmrgAC_SUBST([DRIVER_MAN_DIR])
135564ce7165SmrgAC_SUBST([ADMIN_MAN_DIR])
1356169a0819Smrg
1357169a0819SmrgXORG_MAN_PAGE="X Version 11"
1358169a0819SmrgAC_SUBST([XORG_MAN_PAGE])
1359169a0819SmrgMAN_SUBSTS="\
1360169a0819Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1361169a0819Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1362169a0819Smrg	-e 's|__xservername__|Xorg|g' \
1363169a0819Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1364169a0819Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1365169a0819Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1366169a0819Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1367169a0819Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1368169a0819Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1369169a0819Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1370169a0819Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1371169a0819Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1372169a0819SmrgAC_SUBST([MAN_SUBSTS])
1373169a0819Smrg
137464ce7165Smrg]) # XORG_MANPAGE_SECTIONS
137564ce7165Smrg
1376169a0819Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1377169a0819Smrg# ------------------------
1378169a0819Smrg# Minimum version: 1.7.0
1379169a0819Smrg#
1380169a0819Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1381169a0819Smrg# provided by xorg-sgml-doctools, if installed.
1382169a0819SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1383169a0819SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1384169a0819SmrgXORG_SGML_PATH=
1385169a0819SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1386169a0819Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1387169a0819Smrg    [m4_ifval([$1],[:],
1388169a0819Smrg        [if test x"$cross_compiling" != x"yes" ; then
1389169a0819Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1390169a0819Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1391169a0819Smrg         fi])
1392169a0819Smrg    ])
1393169a0819Smrg
1394169a0819Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1395169a0819Smrg# the path and the name of the doc stylesheet
1396169a0819Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1397169a0819Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1398169a0819Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1399169a0819Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1400169a0819Smrgelse
1401169a0819Smrg   AC_MSG_RESULT([no])
1402169a0819Smrgfi
1403169a0819Smrg
1404169a0819SmrgAC_SUBST(XORG_SGML_PATH)
1405169a0819SmrgAC_SUBST(STYLESHEET_SRCDIR)
1406169a0819SmrgAC_SUBST(XSL_STYLESHEET)
1407169a0819SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1408169a0819Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1409169a0819Smrg
141064ce7165Smrg# XORG_CHECK_LINUXDOC
141164ce7165Smrg# -------------------
141264ce7165Smrg# Minimum version: 1.0.0
141364ce7165Smrg#
141464ce7165Smrg# Defines the variable MAKE_TEXT if the necessary tools and
141564ce7165Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
141664ce7165Smrg# Whether or not the necessary tools and files are found can be checked
141764ce7165Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
141864ce7165SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1419169a0819SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1420169a0819SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
142164ce7165Smrg
142264ce7165SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
142364ce7165Smrg
1424169a0819SmrgAC_MSG_CHECKING([whether to build documentation])
142564ce7165Smrg
1426169a0819Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
142764ce7165Smrg   BUILDDOC=yes
142864ce7165Smrgelse
142964ce7165Smrg   BUILDDOC=no
143064ce7165Smrgfi
143164ce7165Smrg
143264ce7165SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
143364ce7165Smrg
143464ce7165SmrgAC_MSG_RESULT([$BUILDDOC])
143564ce7165Smrg
1436169a0819SmrgAC_MSG_CHECKING([whether to build pdf documentation])
143764ce7165Smrg
1438169a0819Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
143964ce7165Smrg   BUILDPDFDOC=yes
144064ce7165Smrgelse
144164ce7165Smrg   BUILDPDFDOC=no
144264ce7165Smrgfi
144364ce7165Smrg
144464ce7165SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
144564ce7165Smrg
144664ce7165SmrgAC_MSG_RESULT([$BUILDPDFDOC])
144764ce7165Smrg
1448169a0819SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
144964ce7165SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
145064ce7165SmrgMAKE_PDF="$PS2PDF"
145164ce7165SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
145264ce7165Smrg
145364ce7165SmrgAC_SUBST(MAKE_TEXT)
145464ce7165SmrgAC_SUBST(MAKE_PS)
145564ce7165SmrgAC_SUBST(MAKE_PDF)
145664ce7165SmrgAC_SUBST(MAKE_HTML)
145764ce7165Smrg]) # XORG_CHECK_LINUXDOC
145864ce7165Smrg
145964ce7165Smrg# XORG_CHECK_DOCBOOK
146064ce7165Smrg# -------------------
146164ce7165Smrg# Minimum version: 1.0.0
146264ce7165Smrg#
146364ce7165Smrg# Checks for the ability to build output formats from SGML DocBook source.
146464ce7165Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
146564ce7165Smrg# indicates whether the necessary tools and files are found and, if set,
146664ce7165Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
146764ce7165SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1468169a0819SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1469169a0819Smrg
147064ce7165SmrgBUILDTXTDOC=no
147164ce7165SmrgBUILDPDFDOC=no
147264ce7165SmrgBUILDPSDOC=no
147364ce7165SmrgBUILDHTMLDOC=no
147464ce7165Smrg
147564ce7165SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
147664ce7165SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
147764ce7165SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
147864ce7165SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
147964ce7165Smrg
1480169a0819SmrgAC_MSG_CHECKING([whether to build text documentation])
1481169a0819Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
148264ce7165Smrg   test x$BUILD_TXTDOC != xno; then
148364ce7165Smrg	BUILDTXTDOC=yes
148464ce7165Smrgfi
148564ce7165SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
148664ce7165SmrgAC_MSG_RESULT([$BUILDTXTDOC])
148764ce7165Smrg
1488169a0819SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1489169a0819Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
149064ce7165Smrg   test x$BUILD_PDFDOC != xno; then
149164ce7165Smrg	BUILDPDFDOC=yes
149264ce7165Smrgfi
149364ce7165SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
149464ce7165SmrgAC_MSG_RESULT([$BUILDPDFDOC])
149564ce7165Smrg
1496169a0819SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1497169a0819Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
149864ce7165Smrg   test x$BUILD_PSDOC != xno; then
149964ce7165Smrg	BUILDPSDOC=yes
150064ce7165Smrgfi
150164ce7165SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
150264ce7165SmrgAC_MSG_RESULT([$BUILDPSDOC])
150364ce7165Smrg
1504169a0819SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1505169a0819Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
150664ce7165Smrg   test x$BUILD_HTMLDOC != xno; then
150764ce7165Smrg	BUILDHTMLDOC=yes
150864ce7165Smrgfi
150964ce7165SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
151064ce7165SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
151164ce7165Smrg
151264ce7165SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
151364ce7165SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
151464ce7165SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
151564ce7165SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
151664ce7165Smrg
151764ce7165SmrgAC_SUBST(MAKE_TEXT)
151864ce7165SmrgAC_SUBST(MAKE_PS)
151964ce7165SmrgAC_SUBST(MAKE_PDF)
152064ce7165SmrgAC_SUBST(MAKE_HTML)
152164ce7165Smrg]) # XORG_CHECK_DOCBOOK
152264ce7165Smrg
1523169a0819Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1524169a0819Smrg# ----------------
1525169a0819Smrg# Minimum version: 1.5.0
1526169a0819Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1527169a0819Smrg#
1528169a0819Smrg# Documentation tools are not always available on all platforms and sometimes
1529169a0819Smrg# not at the appropriate level. This macro enables a module to test for the
1530169a0819Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1531169a0819Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1532169a0819Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1533169a0819Smrg# --with-xmlto assumes 'auto'.
1534169a0819Smrg#
1535169a0819Smrg# Interface to module:
1536169a0819Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1537169a0819Smrg# XMLTO:	returns the path of the xmlto program found
1538169a0819Smrg#		returns the path set by the user in the environment
1539169a0819Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1540169a0819Smrg#		'no' user instructs the module not to use xmlto
1541169a0819Smrg#
1542169a0819Smrg# Added in version 1.10.0
1543169a0819Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1544169a0819Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1545169a0819Smrg#
1546169a0819Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1547169a0819Smrg#
1548169a0819SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1549169a0819SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1550169a0819Smrgm4_define([_defopt], m4_default([$2], [auto]))
1551169a0819SmrgAC_ARG_WITH(xmlto,
1552169a0819Smrg	AS_HELP_STRING([--with-xmlto],
1553169a0819Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1554169a0819Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1555169a0819Smrgm4_undefine([_defopt])
1556169a0819Smrg
1557169a0819Smrgif test "x$use_xmlto" = x"auto"; then
1558169a0819Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1559169a0819Smrg   if test "x$XMLTO" = "x"; then
1560169a0819Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1561169a0819Smrg	have_xmlto=no
1562169a0819Smrg   else
1563169a0819Smrg        have_xmlto=yes
1564169a0819Smrg   fi
1565169a0819Smrgelif test "x$use_xmlto" = x"yes" ; then
1566169a0819Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1567169a0819Smrg   if test "x$XMLTO" = "x"; then
1568169a0819Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1569169a0819Smrg   fi
1570169a0819Smrg   have_xmlto=yes
1571169a0819Smrgelif test "x$use_xmlto" = x"no" ; then
1572169a0819Smrg   if test "x$XMLTO" != "x"; then
1573169a0819Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1574169a0819Smrg   fi
1575169a0819Smrg   have_xmlto=no
1576169a0819Smrgelse
1577169a0819Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1578169a0819Smrgfi
1579169a0819Smrg
1580169a0819Smrg# Test for a minimum version of xmlto, if provided.
1581169a0819Smrgm4_ifval([$1],
1582169a0819Smrg[if test "$have_xmlto" = yes; then
1583169a0819Smrg    # scrape the xmlto version
1584169a0819Smrg    AC_MSG_CHECKING([the xmlto version])
1585169a0819Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1586169a0819Smrg    AC_MSG_RESULT([$xmlto_version])
1587169a0819Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1588169a0819Smrg        [if test "x$use_xmlto" = xauto; then
1589169a0819Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1590169a0819Smrg            have_xmlto=no
1591169a0819Smrg        else
1592169a0819Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1593169a0819Smrg        fi])
1594169a0819Smrgfi])
1595169a0819Smrg
1596169a0819Smrg# Test for the ability of xmlto to generate a text target
1597169a0819Smrghave_xmlto_text=no
1598169a0819Smrgcat > conftest.xml << "EOF"
1599169a0819SmrgEOF
1600169a0819SmrgAS_IF([test "$have_xmlto" = yes],
1601169a0819Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1602169a0819Smrg             [have_xmlto_text=yes],
1603169a0819Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1604169a0819Smrgrm -f conftest.xml
1605169a0819SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1606169a0819SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1607169a0819Smrg]) # XORG_WITH_XMLTO
1608169a0819Smrg
16093544ea2eSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
16103544ea2eSmrg# --------------------------------------------
16113544ea2eSmrg# Minimum version: 1.12.0
16123544ea2eSmrg# Minimum version for optional DEFAULT argument: 1.12.0
16133544ea2eSmrg#
16143544ea2eSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
16153544ea2eSmrg# XML-based language used for the transformation of XML documents.
16163544ea2eSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
16173544ea2eSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
16183544ea2eSmrg# The XSLT processor is often used as a standalone tool for transformations.
16193544ea2eSmrg# It should not be assumed that this tool is used only to work with documnetation.
16203544ea2eSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
16213544ea2eSmrg#
16223544ea2eSmrg# Interface to module:
16233544ea2eSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
16243544ea2eSmrg# XSLTPROC:	 returns the path of the xsltproc program found
16253544ea2eSmrg#		 returns the path set by the user in the environment
16263544ea2eSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
16273544ea2eSmrg#		  'no' user instructs the module not to use xsltproc
16283544ea2eSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
16293544ea2eSmrg#
16303544ea2eSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
16313544ea2eSmrg#
16323544ea2eSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
16333544ea2eSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
16343544ea2eSmrg# Preserves the interface, should it be implemented later
16353544ea2eSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
16363544ea2eSmrgm4_define([_defopt], m4_default([$2], [auto]))
16373544ea2eSmrgAC_ARG_WITH(xsltproc,
16383544ea2eSmrg	AS_HELP_STRING([--with-xsltproc],
16393544ea2eSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
16403544ea2eSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
16413544ea2eSmrgm4_undefine([_defopt])
16423544ea2eSmrg
16433544ea2eSmrgif test "x$use_xsltproc" = x"auto"; then
16443544ea2eSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
16453544ea2eSmrg   if test "x$XSLTPROC" = "x"; then
16463544ea2eSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
16473544ea2eSmrg	have_xsltproc=no
16483544ea2eSmrg   else
16493544ea2eSmrg        have_xsltproc=yes
16503544ea2eSmrg   fi
16513544ea2eSmrgelif test "x$use_xsltproc" = x"yes" ; then
16523544ea2eSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
16533544ea2eSmrg   if test "x$XSLTPROC" = "x"; then
16543544ea2eSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
16553544ea2eSmrg   fi
16563544ea2eSmrg   have_xsltproc=yes
16573544ea2eSmrgelif test "x$use_xsltproc" = x"no" ; then
16583544ea2eSmrg   if test "x$XSLTPROC" != "x"; then
16593544ea2eSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
16603544ea2eSmrg   fi
16613544ea2eSmrg   have_xsltproc=no
16623544ea2eSmrgelse
16633544ea2eSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
16643544ea2eSmrgfi
16653544ea2eSmrg
16663544ea2eSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
16673544ea2eSmrg]) # XORG_WITH_XSLTPROC
16683544ea2eSmrg
16693544ea2eSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
16703544ea2eSmrg# ----------------------------------------
16713544ea2eSmrg# Minimum version: 1.15.0
16723544ea2eSmrg#
16733544ea2eSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
16743544ea2eSmrg# scanning arbitrary text files, extracting information from those text files,
16753544ea2eSmrg# and printing reports based on that information.
16763544ea2eSmrg#
16773544ea2eSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
16783544ea2eSmrg#
16793544ea2eSmrg# Interface to module:
16803544ea2eSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
16813544ea2eSmrg# PERL:	     returns the path of the perl program found
16823544ea2eSmrg#	     returns the path set by the user in the environment
16833544ea2eSmrg# --with-perl: 'yes' user instructs the module to use perl
16843544ea2eSmrg#	       'no' user instructs the module not to use perl
16853544ea2eSmrg# have_perl: returns yes if perl found in PATH or no
16863544ea2eSmrg#
16873544ea2eSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
16883544ea2eSmrg#
16893544ea2eSmrgAC_DEFUN([XORG_WITH_PERL],[
16903544ea2eSmrgAC_ARG_VAR([PERL], [Path to perl command])
16913544ea2eSmrg# Preserves the interface, should it be implemented later
16923544ea2eSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
16933544ea2eSmrgm4_define([_defopt], m4_default([$2], [auto]))
16943544ea2eSmrgAC_ARG_WITH(perl,
16953544ea2eSmrg	AS_HELP_STRING([--with-perl],
16963544ea2eSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
16973544ea2eSmrg	   [use_perl=$withval], [use_perl=]_defopt)
16983544ea2eSmrgm4_undefine([_defopt])
16993544ea2eSmrg
17003544ea2eSmrgif test "x$use_perl" = x"auto"; then
17013544ea2eSmrg   AC_PATH_PROG([PERL], [perl])
17023544ea2eSmrg   if test "x$PERL" = "x"; then
17033544ea2eSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
17043544ea2eSmrg	have_perl=no
17053544ea2eSmrg   else
17063544ea2eSmrg        have_perl=yes
17073544ea2eSmrg   fi
17083544ea2eSmrgelif test "x$use_perl" = x"yes" ; then
17093544ea2eSmrg   AC_PATH_PROG([PERL], [perl])
17103544ea2eSmrg   if test "x$PERL" = "x"; then
17113544ea2eSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
17123544ea2eSmrg   fi
17133544ea2eSmrg   have_perl=yes
17143544ea2eSmrgelif test "x$use_perl" = x"no" ; then
17153544ea2eSmrg   if test "x$PERL" != "x"; then
17163544ea2eSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
17173544ea2eSmrg   fi
17183544ea2eSmrg   have_perl=no
17193544ea2eSmrgelse
17203544ea2eSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
17213544ea2eSmrgfi
17223544ea2eSmrg
17233544ea2eSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
17243544ea2eSmrg]) # XORG_WITH_PERL
17253544ea2eSmrg
1726169a0819Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1727169a0819Smrg# ----------------
1728169a0819Smrg# Minimum version: 1.5.0
1729169a0819Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1730169a0819Smrg#
1731169a0819Smrg# Documentation tools are not always available on all platforms and sometimes
1732169a0819Smrg# not at the appropriate level. This macro enables a module to test for the
1733169a0819Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1734169a0819Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1735169a0819Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1736169a0819Smrg# --with-asciidoc assumes 'auto'.
1737169a0819Smrg#
1738169a0819Smrg# Interface to module:
1739169a0819Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1740169a0819Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
1741169a0819Smrg#		 returns the path set by the user in the environment
1742169a0819Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1743169a0819Smrg#		  'no' user instructs the module not to use asciidoc
1744169a0819Smrg#
1745169a0819Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1746169a0819Smrg#
1747169a0819SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1748169a0819SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1749169a0819Smrgm4_define([_defopt], m4_default([$2], [auto]))
1750169a0819SmrgAC_ARG_WITH(asciidoc,
1751169a0819Smrg	AS_HELP_STRING([--with-asciidoc],
1752169a0819Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1753169a0819Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1754169a0819Smrgm4_undefine([_defopt])
1755169a0819Smrg
1756169a0819Smrgif test "x$use_asciidoc" = x"auto"; then
1757169a0819Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1758169a0819Smrg   if test "x$ASCIIDOC" = "x"; then
1759169a0819Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1760169a0819Smrg	have_asciidoc=no
1761169a0819Smrg   else
1762169a0819Smrg        have_asciidoc=yes
1763169a0819Smrg   fi
1764169a0819Smrgelif test "x$use_asciidoc" = x"yes" ; then
1765169a0819Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1766169a0819Smrg   if test "x$ASCIIDOC" = "x"; then
1767169a0819Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1768169a0819Smrg   fi
1769169a0819Smrg   have_asciidoc=yes
1770169a0819Smrgelif test "x$use_asciidoc" = x"no" ; then
1771169a0819Smrg   if test "x$ASCIIDOC" != "x"; then
1772169a0819Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1773169a0819Smrg   fi
1774169a0819Smrg   have_asciidoc=no
1775169a0819Smrgelse
1776169a0819Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1777169a0819Smrgfi
1778169a0819Smrgm4_ifval([$1],
1779169a0819Smrg[if test "$have_asciidoc" = yes; then
1780169a0819Smrg    # scrape the asciidoc version
1781169a0819Smrg    AC_MSG_CHECKING([the asciidoc version])
1782169a0819Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1783169a0819Smrg    AC_MSG_RESULT([$asciidoc_version])
1784169a0819Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1785169a0819Smrg        [if test "x$use_asciidoc" = xauto; then
1786169a0819Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1787169a0819Smrg            have_asciidoc=no
1788169a0819Smrg        else
1789169a0819Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1790169a0819Smrg        fi])
1791169a0819Smrgfi])
1792169a0819SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1793169a0819Smrg]) # XORG_WITH_ASCIIDOC
1794169a0819Smrg
1795169a0819Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1796169a0819Smrg# --------------------------------
1797169a0819Smrg# Minimum version: 1.5.0
1798169a0819Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1799169a0819Smrg#
1800169a0819Smrg# Documentation tools are not always available on all platforms and sometimes
1801169a0819Smrg# not at the appropriate level. This macro enables a module to test for the
1802169a0819Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1803169a0819Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1804169a0819Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1805169a0819Smrg# --with-doxygen assumes 'auto'.
1806169a0819Smrg#
1807169a0819Smrg# Interface to module:
1808169a0819Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1809169a0819Smrg# DOXYGEN:	 returns the path of the doxygen program found
1810169a0819Smrg#		 returns the path set by the user in the environment
1811169a0819Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1812169a0819Smrg#		  'no' user instructs the module not to use doxygen
1813169a0819Smrg#
1814169a0819Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1815169a0819Smrg#
1816169a0819SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1817169a0819SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1818169a0819Smrgm4_define([_defopt], m4_default([$2], [auto]))
1819169a0819SmrgAC_ARG_WITH(doxygen,
1820169a0819Smrg	AS_HELP_STRING([--with-doxygen],
1821169a0819Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1822169a0819Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1823169a0819Smrgm4_undefine([_defopt])
1824169a0819Smrg
1825169a0819Smrgif test "x$use_doxygen" = x"auto"; then
1826169a0819Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1827169a0819Smrg   if test "x$DOXYGEN" = "x"; then
1828169a0819Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1829169a0819Smrg	have_doxygen=no
1830169a0819Smrg   else
1831169a0819Smrg        have_doxygen=yes
1832169a0819Smrg   fi
1833169a0819Smrgelif test "x$use_doxygen" = x"yes" ; then
1834169a0819Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1835169a0819Smrg   if test "x$DOXYGEN" = "x"; then
1836169a0819Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1837169a0819Smrg   fi
1838169a0819Smrg   have_doxygen=yes
1839169a0819Smrgelif test "x$use_doxygen" = x"no" ; then
1840169a0819Smrg   if test "x$DOXYGEN" != "x"; then
1841169a0819Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1842169a0819Smrg   fi
1843169a0819Smrg   have_doxygen=no
1844169a0819Smrgelse
1845169a0819Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1846169a0819Smrgfi
1847169a0819Smrgm4_ifval([$1],
1848169a0819Smrg[if test "$have_doxygen" = yes; then
1849169a0819Smrg    # scrape the doxygen version
1850169a0819Smrg    AC_MSG_CHECKING([the doxygen version])
1851169a0819Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1852169a0819Smrg    AC_MSG_RESULT([$doxygen_version])
1853169a0819Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1854169a0819Smrg        [if test "x$use_doxygen" = xauto; then
1855169a0819Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1856169a0819Smrg            have_doxygen=no
1857169a0819Smrg        else
1858169a0819Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1859169a0819Smrg        fi])
1860169a0819Smrgfi])
1861169a0819SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
1862169a0819Smrg]) # XORG_WITH_DOXYGEN
1863169a0819Smrg
1864169a0819Smrg# XORG_WITH_GROFF([DEFAULT])
1865169a0819Smrg# ----------------
1866169a0819Smrg# Minimum version: 1.6.0
1867169a0819Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1868169a0819Smrg#
1869169a0819Smrg# Documentation tools are not always available on all platforms and sometimes
1870169a0819Smrg# not at the appropriate level. This macro enables a module to test for the
1871169a0819Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1872169a0819Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
1873169a0819Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
1874169a0819Smrg# --with-groff assumes 'auto'.
1875169a0819Smrg#
1876169a0819Smrg# Interface to module:
1877169a0819Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
1878169a0819Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
1879169a0819Smrg# HAVE_GROFF_MS: the -ms macros package
1880169a0819Smrg# GROFF:	 returns the path of the groff program found
1881169a0819Smrg#		 returns the path set by the user in the environment
1882169a0819Smrg# --with-groff:	 'yes' user instructs the module to use groff
1883169a0819Smrg#		 'no' user instructs the module not to use groff
1884169a0819Smrg#
1885169a0819Smrg# Added in version 1.9.0:
1886169a0819Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
1887169a0819Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
1888169a0819Smrg#		   psselect from the psutils package.
1889169a0819Smrg#		   the ghostcript package. Refer to the grohtml man pages
1890169a0819Smrg#
1891169a0819Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
1892169a0819Smrg#
1893169a0819Smrg# OS and distros often splits groff in a basic and full package, the former
1894169a0819Smrg# having the groff program and the later having devices, fonts and macros
1895169a0819Smrg# Checking for the groff executable is not enough.
1896169a0819Smrg#
1897169a0819Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
1898169a0819Smrg# unset HAVE_GROFF or GROFF env variables.
1899169a0819Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
1900169a0819Smrg#
1901169a0819SmrgAC_DEFUN([XORG_WITH_GROFF],[
1902169a0819SmrgAC_ARG_VAR([GROFF], [Path to groff command])
1903169a0819Smrgm4_define([_defopt], m4_default([$1], [auto]))
1904169a0819SmrgAC_ARG_WITH(groff,
1905169a0819Smrg	AS_HELP_STRING([--with-groff],
1906169a0819Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
1907169a0819Smrg	   [use_groff=$withval], [use_groff=]_defopt)
1908169a0819Smrgm4_undefine([_defopt])
1909169a0819Smrg
1910169a0819Smrgif test "x$use_groff" = x"auto"; then
1911169a0819Smrg   AC_PATH_PROG([GROFF], [groff])
1912169a0819Smrg   if test "x$GROFF" = "x"; then
1913169a0819Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
1914169a0819Smrg	have_groff=no
1915169a0819Smrg   else
1916169a0819Smrg        have_groff=yes
1917169a0819Smrg   fi
1918169a0819Smrgelif test "x$use_groff" = x"yes" ; then
1919169a0819Smrg   AC_PATH_PROG([GROFF], [groff])
1920169a0819Smrg   if test "x$GROFF" = "x"; then
1921169a0819Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
1922169a0819Smrg   fi
1923169a0819Smrg   have_groff=yes
1924169a0819Smrgelif test "x$use_groff" = x"no" ; then
1925169a0819Smrg   if test "x$GROFF" != "x"; then
1926169a0819Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
1927169a0819Smrg   fi
1928169a0819Smrg   have_groff=no
1929169a0819Smrgelse
1930169a0819Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1931169a0819Smrgfi
1932169a0819Smrg
1933169a0819Smrg# We have groff, test for the presence of the macro packages
1934169a0819Smrgif test "x$have_groff" = x"yes"; then
1935169a0819Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
1936169a0819Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
1937169a0819Smrg        groff_ms_works=yes
1938169a0819Smrg    else
1939169a0819Smrg        groff_ms_works=no
1940169a0819Smrg    fi
1941169a0819Smrg    AC_MSG_RESULT([$groff_ms_works])
1942169a0819Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
1943169a0819Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
1944169a0819Smrg        groff_mm_works=yes
1945169a0819Smrg    else
1946169a0819Smrg        groff_mm_works=no
1947169a0819Smrg    fi
1948169a0819Smrg    AC_MSG_RESULT([$groff_mm_works])
1949169a0819Smrgfi
1950169a0819Smrg
1951169a0819Smrg# We have groff, test for HTML dependencies, one command per package
1952169a0819Smrgif test "x$have_groff" = x"yes"; then
1953169a0819Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
1954169a0819Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
1955169a0819Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
1956169a0819Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
1957169a0819Smrg      have_groff_html=yes
1958169a0819Smrg   else
1959169a0819Smrg      have_groff_html=no
1960169a0819Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
1961169a0819Smrg   fi
1962169a0819Smrgfi
1963169a0819Smrg
1964169a0819Smrg# Set Automake conditionals for Makefiles
1965169a0819SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
1966169a0819SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
1967169a0819SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
1968169a0819SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
1969169a0819Smrg]) # XORG_WITH_GROFF
1970169a0819Smrg
19713544ea2eSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
19723544ea2eSmrg# ---------------------------------------
1973169a0819Smrg# Minimum version: 1.6.0
1974169a0819Smrg# Minimum version for optional DEFAULT argument: 1.11.0
19753544ea2eSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1976169a0819Smrg#
1977169a0819Smrg# Documentation tools are not always available on all platforms and sometimes
1978169a0819Smrg# not at the appropriate level. This macro enables a module to test for the
1979169a0819Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1980169a0819Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
1981169a0819Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
1982169a0819Smrg# --with-fop assumes 'auto'.
1983169a0819Smrg#
1984169a0819Smrg# Interface to module:
1985169a0819Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
1986169a0819Smrg# FOP:	 	returns the path of the fop program found
1987169a0819Smrg#		returns the path set by the user in the environment
1988169a0819Smrg# --with-fop: 	'yes' user instructs the module to use fop
1989169a0819Smrg#		'no' user instructs the module not to use fop
1990169a0819Smrg#
1991169a0819Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
1992169a0819Smrg#
1993169a0819SmrgAC_DEFUN([XORG_WITH_FOP],[
1994169a0819SmrgAC_ARG_VAR([FOP], [Path to fop command])
19953544ea2eSmrgm4_define([_defopt], m4_default([$2], [auto]))
1996169a0819SmrgAC_ARG_WITH(fop,
1997169a0819Smrg	AS_HELP_STRING([--with-fop],
1998169a0819Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
1999169a0819Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2000169a0819Smrgm4_undefine([_defopt])
2001169a0819Smrg
2002169a0819Smrgif test "x$use_fop" = x"auto"; then
2003169a0819Smrg   AC_PATH_PROG([FOP], [fop])
2004169a0819Smrg   if test "x$FOP" = "x"; then
2005169a0819Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2006169a0819Smrg	have_fop=no
2007169a0819Smrg   else
2008169a0819Smrg        have_fop=yes
2009169a0819Smrg   fi
2010169a0819Smrgelif test "x$use_fop" = x"yes" ; then
2011169a0819Smrg   AC_PATH_PROG([FOP], [fop])
2012169a0819Smrg   if test "x$FOP" = "x"; then
2013169a0819Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2014169a0819Smrg   fi
2015169a0819Smrg   have_fop=yes
2016169a0819Smrgelif test "x$use_fop" = x"no" ; then
2017169a0819Smrg   if test "x$FOP" != "x"; then
2018169a0819Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2019169a0819Smrg   fi
2020169a0819Smrg   have_fop=no
2021169a0819Smrgelse
2022169a0819Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2023169a0819Smrgfi
20243544ea2eSmrg
20253544ea2eSmrg# Test for a minimum version of fop, if provided.
20263544ea2eSmrgm4_ifval([$1],
20273544ea2eSmrg[if test "$have_fop" = yes; then
20283544ea2eSmrg    # scrape the fop version
20293544ea2eSmrg    AC_MSG_CHECKING([for fop minimum version])
20303544ea2eSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
20313544ea2eSmrg    AC_MSG_RESULT([$fop_version])
20323544ea2eSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
20333544ea2eSmrg        [if test "x$use_fop" = xauto; then
20343544ea2eSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
20353544ea2eSmrg            have_fop=no
20363544ea2eSmrg        else
20373544ea2eSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
20383544ea2eSmrg        fi])
20393544ea2eSmrgfi])
2040169a0819SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2041169a0819Smrg]) # XORG_WITH_FOP
2042169a0819Smrg
2043169a0819Smrg# XORG_WITH_PS2PDF([DEFAULT])
2044169a0819Smrg# ----------------
2045169a0819Smrg# Minimum version: 1.6.0
2046169a0819Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2047169a0819Smrg#
2048169a0819Smrg# Documentation tools are not always available on all platforms and sometimes
2049169a0819Smrg# not at the appropriate level. This macro enables a module to test for the
2050169a0819Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2051169a0819Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2052169a0819Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2053169a0819Smrg# --with-ps2pdf assumes 'auto'.
2054169a0819Smrg#
2055169a0819Smrg# Interface to module:
2056169a0819Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2057169a0819Smrg# PS2PDF:	returns the path of the ps2pdf program found
2058169a0819Smrg#		returns the path set by the user in the environment
2059169a0819Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2060169a0819Smrg#		 'no' user instructs the module not to use ps2pdf
2061169a0819Smrg#
2062169a0819Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2063169a0819Smrg#
2064169a0819SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2065169a0819SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2066169a0819Smrgm4_define([_defopt], m4_default([$1], [auto]))
2067169a0819SmrgAC_ARG_WITH(ps2pdf,
2068169a0819Smrg	AS_HELP_STRING([--with-ps2pdf],
2069169a0819Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2070169a0819Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2071169a0819Smrgm4_undefine([_defopt])
2072169a0819Smrg
2073169a0819Smrgif test "x$use_ps2pdf" = x"auto"; then
2074169a0819Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2075169a0819Smrg   if test "x$PS2PDF" = "x"; then
2076169a0819Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2077169a0819Smrg	have_ps2pdf=no
2078169a0819Smrg   else
2079169a0819Smrg        have_ps2pdf=yes
2080169a0819Smrg   fi
2081169a0819Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2082169a0819Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2083169a0819Smrg   if test "x$PS2PDF" = "x"; then
2084169a0819Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2085169a0819Smrg   fi
2086169a0819Smrg   have_ps2pdf=yes
2087169a0819Smrgelif test "x$use_ps2pdf" = x"no" ; then
2088169a0819Smrg   if test "x$PS2PDF" != "x"; then
2089169a0819Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2090169a0819Smrg   fi
2091169a0819Smrg   have_ps2pdf=no
2092169a0819Smrgelse
2093169a0819Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2094169a0819Smrgfi
2095169a0819SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2096169a0819Smrg]) # XORG_WITH_PS2PDF
2097169a0819Smrg
2098169a0819Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2099169a0819Smrg# ----------------
2100169a0819Smrg# Minimum version: 1.6.0
2101169a0819Smrg#
2102169a0819Smrg# Documentation tools are not always available on all platforms and sometimes
2103169a0819Smrg# not at the appropriate level. This macro enables a builder to skip all
2104169a0819Smrg# documentation targets except traditional man pages.
2105169a0819Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2106169a0819Smrg# maximum flexibilty in controlling documentation building.
2107169a0819Smrg# Refer to:
2108169a0819Smrg# XORG_WITH_XMLTO         --with-xmlto
2109169a0819Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2110169a0819Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2111169a0819Smrg# XORG_WITH_FOP           --with-fop
2112169a0819Smrg# XORG_WITH_GROFF         --with-groff
2113169a0819Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2114169a0819Smrg#
2115169a0819Smrg# Interface to module:
2116169a0819Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2117169a0819Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2118169a0819Smrg#		 'no' user instructs the module not to generate docs
2119169a0819Smrg# parm1:	specify the default value, yes or no.
2120169a0819Smrg#
2121169a0819SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
21223544ea2eSmrgm4_define([docs_default], m4_default([$1], [yes]))
2123169a0819SmrgAC_ARG_ENABLE(docs,
2124169a0819Smrg	AS_HELP_STRING([--enable-docs],
21253544ea2eSmrg	   [Enable building the documentation (default: ]docs_default[)]),
21263544ea2eSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
21273544ea2eSmrgm4_undefine([docs_default])
2128169a0819SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2129169a0819SmrgAC_MSG_CHECKING([whether to build documentation])
2130169a0819SmrgAC_MSG_RESULT([$build_docs])
2131169a0819Smrg]) # XORG_ENABLE_DOCS
2132169a0819Smrg
2133169a0819Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2134169a0819Smrg# ----------------
2135169a0819Smrg# Minimum version: 1.6.0
2136169a0819Smrg#
2137169a0819Smrg# This macro enables a builder to skip all developer documentation.
2138169a0819Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2139169a0819Smrg# maximum flexibilty in controlling documentation building.
2140169a0819Smrg# Refer to:
2141169a0819Smrg# XORG_WITH_XMLTO         --with-xmlto
2142169a0819Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2143169a0819Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2144169a0819Smrg# XORG_WITH_FOP           --with-fop
2145169a0819Smrg# XORG_WITH_GROFF         --with-groff
2146169a0819Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2147169a0819Smrg#
2148169a0819Smrg# Interface to module:
2149169a0819Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2150169a0819Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2151169a0819Smrg#			'no' user instructs the module not to generate developer docs
2152169a0819Smrg# parm1:		specify the default value, yes or no.
2153169a0819Smrg#
2154169a0819SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2155169a0819Smrgm4_define([devel_default], m4_default([$1], [yes]))
2156169a0819SmrgAC_ARG_ENABLE(devel-docs,
2157169a0819Smrg	AS_HELP_STRING([--enable-devel-docs],
2158169a0819Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2159169a0819Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2160169a0819Smrgm4_undefine([devel_default])
2161169a0819SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2162169a0819SmrgAC_MSG_CHECKING([whether to build developer documentation])
2163169a0819SmrgAC_MSG_RESULT([$build_devel_docs])
2164169a0819Smrg]) # XORG_ENABLE_DEVEL_DOCS
2165169a0819Smrg
2166169a0819Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2167169a0819Smrg# ----------------
2168169a0819Smrg# Minimum version: 1.6.0
2169169a0819Smrg#
2170169a0819Smrg# This macro enables a builder to skip all functional specification targets.
2171169a0819Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2172169a0819Smrg# maximum flexibilty in controlling documentation building.
2173169a0819Smrg# Refer to:
2174169a0819Smrg# XORG_WITH_XMLTO         --with-xmlto
2175169a0819Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2176169a0819Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2177169a0819Smrg# XORG_WITH_FOP           --with-fop
2178169a0819Smrg# XORG_WITH_GROFF         --with-groff
2179169a0819Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2180169a0819Smrg#
2181169a0819Smrg# Interface to module:
2182169a0819Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2183169a0819Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2184169a0819Smrg#			'no' user instructs the module not to generate specs
2185169a0819Smrg# parm1:		specify the default value, yes or no.
2186169a0819Smrg#
2187169a0819SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2188169a0819Smrgm4_define([spec_default], m4_default([$1], [yes]))
2189169a0819SmrgAC_ARG_ENABLE(specs,
2190169a0819Smrg	AS_HELP_STRING([--enable-specs],
2191169a0819Smrg	   [Enable building the specs (default: ]spec_default[)]),
2192169a0819Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2193169a0819Smrgm4_undefine([spec_default])
2194169a0819SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2195169a0819SmrgAC_MSG_CHECKING([whether to build functional specifications])
2196169a0819SmrgAC_MSG_RESULT([$build_specs])
2197169a0819Smrg]) # XORG_ENABLE_SPECS
2198169a0819Smrg
21993544ea2eSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
22003544ea2eSmrg# ----------------------------------------------
22013544ea2eSmrg# Minimum version: 1.13.0
22023544ea2eSmrg#
22033544ea2eSmrg# This macro enables a builder to enable/disable unit testing
22043544ea2eSmrg# It makes no assumption about the test cases implementation
22053544ea2eSmrg# Test cases may or may not use Automake "Support for test suites"
22063544ea2eSmrg# They may or may not use the software utility library GLib
22073544ea2eSmrg#
22083544ea2eSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
22093544ea2eSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
22103544ea2eSmrg# The variable enable_unit_tests is used by other macros in this file.
22113544ea2eSmrg#
22123544ea2eSmrg# Interface to module:
22133544ea2eSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
22143544ea2eSmrg# enable_unit_tests:    used in configure.ac for additional configuration
22153544ea2eSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
22163544ea2eSmrg#			'no' user instructs the module not to build tests
22173544ea2eSmrg# parm1:		specify the default value, yes or no.
22183544ea2eSmrg#
22193544ea2eSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
22203544ea2eSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
22213544ea2eSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
22223544ea2eSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
22233544ea2eSmrgm4_define([_defopt], m4_default([$1], [auto]))
22243544ea2eSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
22253544ea2eSmrg	[Enable building unit test cases (default: ]_defopt[)]),
22263544ea2eSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
22273544ea2eSmrgm4_undefine([_defopt])
22283544ea2eSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
22293544ea2eSmrgAC_MSG_CHECKING([whether to build unit test cases])
22303544ea2eSmrgAC_MSG_RESULT([$enable_unit_tests])
22313544ea2eSmrg]) # XORG_ENABLE_UNIT_TESTS
22323544ea2eSmrg
22333544ea2eSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
22343544ea2eSmrg# ------------------------------------------------------
22353544ea2eSmrg# Minimum version: 1.17.0
22363544ea2eSmrg#
22373544ea2eSmrg# This macro enables a builder to enable/disable integration testing
22383544ea2eSmrg# It makes no assumption about the test cases' implementation
22393544ea2eSmrg# Test cases may or may not use Automake "Support for test suites"
22403544ea2eSmrg#
22413544ea2eSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
22423544ea2eSmrg# usually requires less dependencies and may be built and run under less
22433544ea2eSmrg# stringent environments than integration tests.
22443544ea2eSmrg#
22453544ea2eSmrg# Interface to module:
22463544ea2eSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
22473544ea2eSmrg# enable_integration_tests:   used in configure.ac for additional configuration
22483544ea2eSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
22493544ea2eSmrg#                             'no' user instructs the module not to build tests
22503544ea2eSmrg# parm1:                      specify the default value, yes or no.
22513544ea2eSmrg#
22523544ea2eSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
22533544ea2eSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
22543544ea2eSmrgm4_define([_defopt], m4_default([$1], [auto]))
22553544ea2eSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
22563544ea2eSmrg	[Enable building integration test cases (default: ]_defopt[)]),
22573544ea2eSmrg	[enable_integration_tests=$enableval],
22583544ea2eSmrg	[enable_integration_tests=]_defopt)
22593544ea2eSmrgm4_undefine([_defopt])
22603544ea2eSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
22613544ea2eSmrg	[test "x$enable_integration_tests" != xno])
22623544ea2eSmrgAC_MSG_CHECKING([whether to build unit test cases])
22633544ea2eSmrgAC_MSG_RESULT([$enable_integration_tests])
22643544ea2eSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
22653544ea2eSmrg
22663544ea2eSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
22673544ea2eSmrg# ----------------------------------------
22683544ea2eSmrg# Minimum version: 1.13.0
22693544ea2eSmrg#
22703544ea2eSmrg# GLib is a library which provides advanced data structures and functions.
22713544ea2eSmrg# This macro enables a module to test for the presence of Glib.
22723544ea2eSmrg#
22733544ea2eSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
22743544ea2eSmrg# Otherwise the value of $enable_unit_tests is blank.
22753544ea2eSmrg#
22763544ea2eSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
22773544ea2eSmrg# test support usually requires less dependencies and may be built and run under
22783544ea2eSmrg# less stringent environments than integration tests.
22793544ea2eSmrg#
22803544ea2eSmrg# Interface to module:
22813544ea2eSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
22823544ea2eSmrg# with_glib: used in configure.ac to know if GLib has been found
22833544ea2eSmrg# --with-glib:	'yes' user instructs the module to use glib
22843544ea2eSmrg#		'no' user instructs the module not to use glib
22853544ea2eSmrg#
22863544ea2eSmrgAC_DEFUN([XORG_WITH_GLIB],[
22873544ea2eSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
22883544ea2eSmrgm4_define([_defopt], m4_default([$2], [auto]))
22893544ea2eSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
22903544ea2eSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
22913544ea2eSmrg	[with_glib=$withval], [with_glib=]_defopt)
22923544ea2eSmrgm4_undefine([_defopt])
22933544ea2eSmrg
22943544ea2eSmrghave_glib=no
22953544ea2eSmrg# Do not probe GLib if user explicitly disabled unit testing
22963544ea2eSmrgif test "x$enable_unit_tests" != x"no"; then
22973544ea2eSmrg  # Do not probe GLib if user explicitly disabled it
22983544ea2eSmrg  if test "x$with_glib" != x"no"; then
22993544ea2eSmrg    m4_ifval(
23003544ea2eSmrg      [$1],
23013544ea2eSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
23023544ea2eSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
23033544ea2eSmrg    )
23043544ea2eSmrg  fi
23053544ea2eSmrgfi
23063544ea2eSmrg
23073544ea2eSmrg# Not having GLib when unit testing has been explicitly requested is an error
23083544ea2eSmrgif test "x$enable_unit_tests" = x"yes"; then
23093544ea2eSmrg  if test "x$have_glib" = x"no"; then
23103544ea2eSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
23113544ea2eSmrg  fi
23123544ea2eSmrgfi
23133544ea2eSmrg
23143544ea2eSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
23153544ea2eSmrgif test "x$enable_unit_tests" = x"no"; then
23163544ea2eSmrg  if test "x$with_glib" = x"yes"; then
23173544ea2eSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
23183544ea2eSmrg  fi
23193544ea2eSmrgfi
23203544ea2eSmrg
23213544ea2eSmrg# Not having GLib when it has been explicitly requested is an error
23223544ea2eSmrgif test "x$with_glib" = x"yes"; then
23233544ea2eSmrg  if test "x$have_glib" = x"no"; then
23243544ea2eSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
23253544ea2eSmrg  fi
23263544ea2eSmrgfi
23273544ea2eSmrg
23283544ea2eSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
23293544ea2eSmrg]) # XORG_WITH_GLIB
23303544ea2eSmrg
23313544ea2eSmrg# XORG_LD_WRAP([required|optional])
23323544ea2eSmrg# ---------------------------------
23333544ea2eSmrg# Minimum version: 1.13.0
23343544ea2eSmrg#
23353544ea2eSmrg# Check if linker supports -wrap, passed via compiler flags
23363544ea2eSmrg#
23373544ea2eSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
23383544ea2eSmrg# Otherwise the value of $enable_unit_tests is blank.
23393544ea2eSmrg#
23403544ea2eSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
23413544ea2eSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
23423544ea2eSmrg# available, an argument of "optional" allows use when some unit tests require
23433544ea2eSmrg# ld -wrap and others do not.
23443544ea2eSmrg#
23453544ea2eSmrgAC_DEFUN([XORG_LD_WRAP],[
23463544ea2eSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
23473544ea2eSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
23483544ea2eSmrg                      void __wrap_exit(int status) { return; }],
23493544ea2eSmrg                     [exit(0);])])
23503544ea2eSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
23513544ea2eSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
23523544ea2eSmrg  if test "x$have_ld_wrap" = x"no"; then
23533544ea2eSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
23543544ea2eSmrg  fi
23553544ea2eSmrgfi
23563544ea2eSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
23573544ea2eSmrg#
23583544ea2eSmrg]) # XORG_LD_WRAP
23593544ea2eSmrg
23603544ea2eSmrg# XORG_CHECK_LINKER_FLAGS
23613544ea2eSmrg# -----------------------
23623544ea2eSmrg# SYNOPSIS
23633544ea2eSmrg#
23643544ea2eSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
23653544ea2eSmrg#
23663544ea2eSmrg# DESCRIPTION
23673544ea2eSmrg#
23683544ea2eSmrg#   Check whether the given linker FLAGS work with the current language's
23693544ea2eSmrg#   linker, or whether they give an error.
23703544ea2eSmrg#
23713544ea2eSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
23723544ea2eSmrg#   success/failure.
23733544ea2eSmrg#
23743544ea2eSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
23753544ea2eSmrg#
23763544ea2eSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
23773544ea2eSmrg#
23783544ea2eSmrg# LICENSE
23793544ea2eSmrg#
23803544ea2eSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
23813544ea2eSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
23823544ea2eSmrg#   Copyright (c) 2009 Matteo Frigo
23833544ea2eSmrg#
23843544ea2eSmrg#   This program is free software: you can redistribute it and/or modify it
23853544ea2eSmrg#   under the terms of the GNU General Public License as published by the
23863544ea2eSmrg#   Free Software Foundation, either version 3 of the License, or (at your
23873544ea2eSmrg#   option) any later version.
23883544ea2eSmrg#
23893544ea2eSmrg#   This program is distributed in the hope that it will be useful, but
23903544ea2eSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
23913544ea2eSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
23923544ea2eSmrg#   Public License for more details.
23933544ea2eSmrg#
23943544ea2eSmrg#   You should have received a copy of the GNU General Public License along
23953544ea2eSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
23963544ea2eSmrg#
23973544ea2eSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
23983544ea2eSmrg#   gives unlimited permission to copy, distribute and modify the configure
23993544ea2eSmrg#   scripts that are the output of Autoconf when processing the Macro. You
24003544ea2eSmrg#   need not follow the terms of the GNU General Public License when using
24013544ea2eSmrg#   or distributing such scripts, even though portions of the text of the
24023544ea2eSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
24033544ea2eSmrg#   all other use of the material that constitutes the Autoconf Macro.
24043544ea2eSmrg#
24053544ea2eSmrg#   This special exception to the GPL applies to versions of the Autoconf
24063544ea2eSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
24073544ea2eSmrg#   modified version of the Autoconf Macro, you may extend this special
24083544ea2eSmrg#   exception to the GPL to apply to your modified version as well.#
24093544ea2eSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
24103544ea2eSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
24113544ea2eSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
24123544ea2eSmrgAS_LITERAL_IF([$1],
24133544ea2eSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
24143544ea2eSmrg      ax_save_FLAGS=$LDFLAGS
24153544ea2eSmrg      LDFLAGS="$1"
24163544ea2eSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
24173544ea2eSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
24183544ea2eSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
24193544ea2eSmrg      LDFLAGS=$ax_save_FLAGS])],
24203544ea2eSmrg  [ax_save_FLAGS=$LDFLAGS
24213544ea2eSmrg   LDFLAGS="$1"
24223544ea2eSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
24233544ea2eSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
24243544ea2eSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
24253544ea2eSmrg   LDFLAGS=$ax_save_FLAGS])
24263544ea2eSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
24273544ea2eSmrgAC_MSG_RESULT($xorg_check_linker_flags)
24283544ea2eSmrgif test "x$xorg_check_linker_flags" = xyes; then
24293544ea2eSmrg	m4_default([$2], :)
24303544ea2eSmrgelse
24313544ea2eSmrg	m4_default([$3], :)
24323544ea2eSmrgfi
24333544ea2eSmrg]) # XORG_CHECK_LINKER_FLAGS
24343544ea2eSmrg
24353544ea2eSmrg# XORG_MEMORY_CHECK_FLAGS
24363544ea2eSmrg# -----------------------
24373544ea2eSmrg# Minimum version: 1.16.0
24383544ea2eSmrg#
24393544ea2eSmrg# This macro attempts to find appropriate memory checking functionality
24403544ea2eSmrg# for various platforms which unit testing code may use to catch various
24413544ea2eSmrg# forms of memory allocation and access errors in testing.
24423544ea2eSmrg#
24433544ea2eSmrg# Interface to module:
24443544ea2eSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
24453544ea2eSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
24463544ea2eSmrg#
24473544ea2eSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
24483544ea2eSmrg#
24493544ea2eSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
24503544ea2eSmrg
24513544ea2eSmrgAC_REQUIRE([AC_CANONICAL_HOST])
24523544ea2eSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
24533544ea2eSmrg           [Environment variables to enable memory checking in tests])
24543544ea2eSmrg
24553544ea2eSmrg# Check for different types of support on different platforms
24563544ea2eSmrgcase $host_os in
24573544ea2eSmrg    solaris*)
24583544ea2eSmrg        AC_CHECK_LIB([umem], [umem_alloc],
24593544ea2eSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
24603544ea2eSmrg        ;;
24613544ea2eSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
24623544ea2eSmrg        # both directly and inverted, so should not be 0 or 255.
24633544ea2eSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
24643544ea2eSmrg        ;;
24653544ea2eSmrg    darwin*)
24663544ea2eSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
24673544ea2eSmrg        ;;
24683544ea2eSmrg    *bsd*)
24693544ea2eSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
24703544ea2eSmrg        ;;
24713544ea2eSmrgesac
24723544ea2eSmrg
24733544ea2eSmrg# User supplied flags override default flags
24743544ea2eSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
24753544ea2eSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
24763544ea2eSmrgfi
24773544ea2eSmrg
24783544ea2eSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
24793544ea2eSmrg]) # XORG_WITH_LINT
24803544ea2eSmrg
248164ce7165Smrg# XORG_CHECK_MALLOC_ZERO
248264ce7165Smrg# ----------------------
248364ce7165Smrg# Minimum version: 1.0.0
248464ce7165Smrg#
248564ce7165Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
248664ce7165Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
248764ce7165Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
248864ce7165SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
248964ce7165SmrgAC_ARG_ENABLE(malloc0returnsnull,
2490fb23d3a8Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
249164ce7165Smrg		       [malloc(0) returns NULL (default: auto)]),
249264ce7165Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
249364ce7165Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
249464ce7165Smrg
249564ce7165SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
249664ce7165Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
24973544ea2eSmrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
24983544ea2eSmrg#include <stdlib.h>
24993544ea2eSmrg],[
250064ce7165Smrg    char *m0, *r0, *c0, *p;
250164ce7165Smrg    m0 = malloc(0);
250264ce7165Smrg    p = malloc(10);
250364ce7165Smrg    r0 = realloc(p,0);
25043544ea2eSmrg    c0 = calloc(0,10);
25053544ea2eSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
25063544ea2eSmrg])],
250764ce7165Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
2508169a0819Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
2509169a0819Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
251064ce7165Smrgfi
251164ce7165SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
251264ce7165Smrg
251364ce7165Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
251464ce7165Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
251564ce7165Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
251664ce7165Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
251764ce7165Smrgelse
251864ce7165Smrg	MALLOC_ZERO_CFLAGS=""
251964ce7165Smrg	XMALLOC_ZERO_CFLAGS=""
252064ce7165Smrg	XTMALLOC_ZERO_CFLAGS=""
252164ce7165Smrgfi
252264ce7165Smrg
252364ce7165SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
252464ce7165SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
252564ce7165SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
252664ce7165Smrg]) # XORG_CHECK_MALLOC_ZERO
252764ce7165Smrg
252864ce7165Smrg# XORG_WITH_LINT()
252964ce7165Smrg# ----------------
253064ce7165Smrg# Minimum version: 1.1.0
253164ce7165Smrg#
2532169a0819Smrg# This macro enables the use of a tool that flags some suspicious and
2533169a0819Smrg# non-portable constructs (likely to be bugs) in C language source code.
2534169a0819Smrg# It will attempt to locate the tool and use appropriate options.
2535169a0819Smrg# There are various lint type tools on different platforms.
2536169a0819Smrg#
2537169a0819Smrg# Interface to module:
2538169a0819Smrg# LINT:		returns the path to the tool found on the platform
2539169a0819Smrg#		or the value set to LINT on the configure cmd line
2540169a0819Smrg#		also an Automake conditional
2541169a0819Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2542169a0819Smrg#
2543169a0819Smrg# --with-lint:	'yes' user instructs the module to use lint
2544169a0819Smrg#		'no' user instructs the module not to use lint (default)
2545169a0819Smrg#
2546169a0819Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2547169a0819Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
254864ce7165Smrg#
254964ce7165SmrgAC_DEFUN([XORG_WITH_LINT],[
255064ce7165Smrg
2551169a0819SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2552169a0819SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2553fb23d3a8SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
255464ce7165Smrg		[Use a lint-style source code checker (default: disabled)])],
255564ce7165Smrg		[use_lint=$withval], [use_lint=no])
2556169a0819Smrg
2557169a0819Smrg# Obtain platform specific info like program name and options
2558169a0819Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2559169a0819Smrgcase $host_os in
2560169a0819Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2561169a0819Smrg	lint_name=splint
2562169a0819Smrg	lint_options="-badflag"
2563169a0819Smrg	;;
2564169a0819Smrg  *freebsd* | *netbsd*)
2565169a0819Smrg	lint_name=lint
2566169a0819Smrg	lint_options="-u -b"
2567169a0819Smrg	;;
2568169a0819Smrg  *solaris*)
2569169a0819Smrg	lint_name=lint
2570169a0819Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2571169a0819Smrg	;;
2572169a0819Smrgesac
2573169a0819Smrg
2574169a0819Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2575169a0819Smrgif test "x$use_lint" = x"yes" ; then
2576169a0819Smrg   AC_PATH_PROG([LINT], [$lint_name])
2577169a0819Smrg   if test "x$LINT" = "x"; then
2578169a0819Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2579169a0819Smrg   fi
2580169a0819Smrgelif test "x$use_lint" = x"no" ; then
2581169a0819Smrg   if test "x$LINT" != "x"; then
2582169a0819Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2583169a0819Smrg   fi
258464ce7165Smrgelse
2585169a0819Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
258664ce7165Smrgfi
2587169a0819Smrg
2588169a0819Smrg# User supplied flags override default flags
2589169a0819Smrgif test "x$LINT_FLAGS" != "x"; then
2590169a0819Smrg   lint_options=$LINT_FLAGS
259164ce7165Smrgfi
259264ce7165Smrg
2593169a0819SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2594169a0819SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
259564ce7165Smrg
259664ce7165Smrg]) # XORG_WITH_LINT
259764ce7165Smrg
259864ce7165Smrg# XORG_LINT_LIBRARY(LIBNAME)
259964ce7165Smrg# --------------------------
260064ce7165Smrg# Minimum version: 1.1.0
260164ce7165Smrg#
260264ce7165Smrg# Sets up flags for building lint libraries for checking programs that call
260364ce7165Smrg# functions in the library.
260464ce7165Smrg#
2605169a0819Smrg# Interface to module:
2606169a0819Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2607169a0819Smrg# MAKE_LINT_LIB		- Automake conditional
2608169a0819Smrg#
2609169a0819Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2610169a0819Smrg#			  - 'no' user instructs the module not to create a lint library (default)
261164ce7165Smrg
261264ce7165SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
261364ce7165SmrgAC_REQUIRE([XORG_WITH_LINT])
2614fb23d3a8SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
261564ce7165Smrg	[Create lint library (default: disabled)])],
261664ce7165Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2617169a0819Smrg
2618169a0819Smrgif test "x$make_lint_lib" = x"yes" ; then
2619169a0819Smrg   LINTLIB=llib-l$1.ln
2620169a0819Smrg   if test "x$LINT" = "x"; then
2621169a0819Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2622169a0819Smrg   fi
2623169a0819Smrgelif test "x$make_lint_lib" != x"no" ; then
2624169a0819Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
262564ce7165Smrgfi
2626169a0819Smrg
262764ce7165SmrgAC_SUBST(LINTLIB)
262864ce7165SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
262964ce7165Smrg
263064ce7165Smrg]) # XORG_LINT_LIBRARY
263164ce7165Smrg
26323544ea2eSmrg# XORG_COMPILER_BRAND
26333544ea2eSmrg# -------------------
26343544ea2eSmrg# Minimum version: 1.14.0
26353544ea2eSmrg#
26363544ea2eSmrg# Checks for various brands of compilers and sets flags as appropriate:
26373544ea2eSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
26383544ea2eSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
26393544ea2eSmrg#   clang compiler - sets CLANGCC to "yes"
26403544ea2eSmrg#   Intel compiler - sets INTELCC to "yes"
26413544ea2eSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
26423544ea2eSmrg#
26433544ea2eSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
26443544ea2eSmrgAC_LANG_CASE(
26453544ea2eSmrg	[C], [
26463544ea2eSmrg		AC_REQUIRE([AC_PROG_CC_C99])
26473544ea2eSmrg	],
26483544ea2eSmrg	[C++], [
26493544ea2eSmrg		AC_REQUIRE([AC_PROG_CXX])
26503544ea2eSmrg	]
26513544ea2eSmrg)
26523544ea2eSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
26533544ea2eSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
26543544ea2eSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
26553544ea2eSmrg]) # XORG_COMPILER_BRAND
26563544ea2eSmrg
26573544ea2eSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
26583544ea2eSmrg# ---------------
26593544ea2eSmrg# Minimum version: 1.16.0
26603544ea2eSmrg#
26613544ea2eSmrg# Test if the compiler works when passed the given flag as a command line argument.
26623544ea2eSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
26633544ea2eSmrg# next flag in the list until there are no more options.
26643544ea2eSmrg#
26653544ea2eSmrg# Note that this does not guarantee that the compiler supports the flag as some
26663544ea2eSmrg# compilers will simply ignore arguments that they do not understand, but we do
26673544ea2eSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
26683544ea2eSmrg# -Werror=unused-command-line-argument
26693544ea2eSmrg#
26703544ea2eSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
26713544ea2eSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
26723544ea2eSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
26733544ea2eSmrg
26743544ea2eSmrgAC_LANG_COMPILER_REQUIRE
26753544ea2eSmrg
26763544ea2eSmrgAC_LANG_CASE(
26773544ea2eSmrg	[C], [
26783544ea2eSmrg		AC_REQUIRE([AC_PROG_CC_C99])
26793544ea2eSmrg		define([PREFIX], [C])
26803544ea2eSmrg		define([CACHE_PREFIX], [cc])
26813544ea2eSmrg		define([COMPILER], [$CC])
26823544ea2eSmrg	],
26833544ea2eSmrg	[C++], [
26843544ea2eSmrg		define([PREFIX], [CXX])
26853544ea2eSmrg		define([CACHE_PREFIX], [cxx])
26863544ea2eSmrg		define([COMPILER], [$CXX])
26873544ea2eSmrg	]
26883544ea2eSmrg)
26893544ea2eSmrg
26903544ea2eSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
26913544ea2eSmrg
26923544ea2eSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
26933544ea2eSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
26943544ea2eSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
26953544ea2eSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
26963544ea2eSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
26973544ea2eSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
26983544ea2eSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
26993544ea2eSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
27003544ea2eSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
27013544ea2eSmrgfi
27023544ea2eSmrg
27033544ea2eSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
27043544ea2eSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
27053544ea2eSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
27063544ea2eSmrg	fi
27073544ea2eSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
27083544ea2eSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
27093544ea2eSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
27103544ea2eSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
27113544ea2eSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
27123544ea2eSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
27133544ea2eSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
27143544ea2eSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
27153544ea2eSmrgfi
27163544ea2eSmrg
27173544ea2eSmrgfound="no"
27183544ea2eSmrgm4_foreach([flag], m4_cdr($@), [
27193544ea2eSmrg	if test $found = "no" ; then
27203544ea2eSmrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
27213544ea2eSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
27223544ea2eSmrg		fi
27233544ea2eSmrg
27243544ea2eSmrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
27253544ea2eSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
27263544ea2eSmrg		fi
27273544ea2eSmrg
27283544ea2eSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
27293544ea2eSmrg
27303544ea2eSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
27313544ea2eSmrg		AC_MSG_CHECKING([if ]COMPILER[ supports]flag[])
27323544ea2eSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
27333544ea2eSmrg		AC_CACHE_VAL($cacheid,
27343544ea2eSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
27353544ea2eSmrg					     [eval $cacheid=yes],
27363544ea2eSmrg					     [eval $cacheid=no])])
27373544ea2eSmrg
27383544ea2eSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
27393544ea2eSmrg
27403544ea2eSmrg		eval supported=\$$cacheid
27413544ea2eSmrg		AC_MSG_RESULT([$supported])
27423544ea2eSmrg		if test "$supported" = "yes" ; then
27433544ea2eSmrg			$1="$$1 ]flag["
27443544ea2eSmrg			found="yes"
27453544ea2eSmrg		fi
27463544ea2eSmrg	fi
27473544ea2eSmrg])
27483544ea2eSmrg]) # XORG_TESTSET_CFLAG
27493544ea2eSmrg
27503544ea2eSmrg# XORG_COMPILER_FLAGS
27513544ea2eSmrg# ---------------
27523544ea2eSmrg# Minimum version: 1.16.0
27533544ea2eSmrg#
27543544ea2eSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
27553544ea2eSmrg# arguments supported by the selected compiler which do NOT alter the generated
27563544ea2eSmrg# code.  These arguments will cause the compiler to print various warnings
27573544ea2eSmrg# during compilation AND turn a conservative set of warnings into errors.
27583544ea2eSmrg#
27593544ea2eSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
27603544ea2eSmrg# future versions of util-macros as options are added to new compilers.
27613544ea2eSmrg#
27623544ea2eSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
27633544ea2eSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
27643544ea2eSmrg
27653544ea2eSmrgAC_ARG_ENABLE(selective-werror,
27663544ea2eSmrg              AS_HELP_STRING([--disable-selective-werror],
27673544ea2eSmrg                             [Turn off selective compiler errors. (default: enabled)]),
27683544ea2eSmrg              [SELECTIVE_WERROR=$enableval],
27693544ea2eSmrg              [SELECTIVE_WERROR=yes])
27703544ea2eSmrg
27713544ea2eSmrgAC_LANG_CASE(
27723544ea2eSmrg        [C], [
27733544ea2eSmrg                define([PREFIX], [C])
27743544ea2eSmrg        ],
27753544ea2eSmrg        [C++], [
27763544ea2eSmrg                define([PREFIX], [CXX])
27773544ea2eSmrg        ]
27783544ea2eSmrg)
27793544ea2eSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
27803544ea2eSmrgif test "x$SUNCC" = "xyes"; then
27813544ea2eSmrg    [BASE_]PREFIX[FLAGS]="-v"
27823544ea2eSmrgelse
27833544ea2eSmrg    [BASE_]PREFIX[FLAGS]=""
27843544ea2eSmrgfi
27853544ea2eSmrg
27863544ea2eSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
27873544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
27883544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
27893544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
27903544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
27913544ea2eSmrg
27923544ea2eSmrgAC_LANG_CASE(
27933544ea2eSmrg	[C], [
27943544ea2eSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
27953544ea2eSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
27963544ea2eSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
27973544ea2eSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
27983544ea2eSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
27993544ea2eSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
28003544ea2eSmrg	]
28013544ea2eSmrg)
28023544ea2eSmrg
28033544ea2eSmrg# This chunk adds additional warnings that could catch undesired effects.
28043544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
28053544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
28063544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
28073544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
28083544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
28093544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
28103544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
28113544ea2eSmrg
28123544ea2eSmrg# These are currently disabled because they are noisy.  They will be enabled
28133544ea2eSmrg# in the future once the codebase is sufficiently modernized to silence
28143544ea2eSmrg# them.  For now, I don't want them to drown out the other warnings.
28153544ea2eSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
28163544ea2eSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
28173544ea2eSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
28183544ea2eSmrg
28193544ea2eSmrg# Turn some warnings into errors, so we don't accidently get successful builds
28203544ea2eSmrg# when there are problems that should be fixed.
28213544ea2eSmrg
28223544ea2eSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
28233544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
28243544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
28253544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
28263544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
28273544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
28283544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
28293544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
28303544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
28313544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
28323544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
28333544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
28343544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
28353544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
28363544ea2eSmrgelse
28373544ea2eSmrgAC_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])
28383544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
28393544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
28403544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
28413544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
28423544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
28433544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
28443544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
28453544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
28463544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
28473544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
28483544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
28493544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
28503544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
28513544ea2eSmrgfi
28523544ea2eSmrg
28533544ea2eSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
28543544ea2eSmrg]) # XORG_COMPILER_FLAGS
28553544ea2eSmrg
2856fb23d3a8Smrg# XORG_CWARNFLAGS
2857fb23d3a8Smrg# ---------------
2858fb23d3a8Smrg# Minimum version: 1.2.0
28593544ea2eSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2860fb23d3a8Smrg#
2861fb23d3a8Smrg# Defines CWARNFLAGS to enable C compiler warnings.
2862fb23d3a8Smrg#
28633544ea2eSmrg# This function is deprecated because it defines -fno-strict-aliasing
28643544ea2eSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
28653544ea2eSmrg# is needed, then it should be added explicitly in the module when
28663544ea2eSmrg# it is updated to use BASE_CFLAGS.
28673544ea2eSmrg#
2868fb23d3a8SmrgAC_DEFUN([XORG_CWARNFLAGS], [
28693544ea2eSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
28703544ea2eSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
28713544ea2eSmrgAC_LANG_CASE(
28723544ea2eSmrg	[C], [
28733544ea2eSmrg		CWARNFLAGS="$BASE_CFLAGS"
28743544ea2eSmrg		if  test "x$GCC" = xyes ; then
28753544ea2eSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
28763544ea2eSmrg		fi
28773544ea2eSmrg		AC_SUBST(CWARNFLAGS)
28783544ea2eSmrg	]
28793544ea2eSmrg)
2880fb23d3a8Smrg]) # XORG_CWARNFLAGS
2881fb23d3a8Smrg
2882fb23d3a8Smrg# XORG_STRICT_OPTION
2883fb23d3a8Smrg# -----------------------
2884fb23d3a8Smrg# Minimum version: 1.3.0
2885fb23d3a8Smrg#
28863544ea2eSmrg# Add configure option to enable strict compilation flags, such as treating
28873544ea2eSmrg# warnings as fatal errors.
28883544ea2eSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
28893544ea2eSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
28903544ea2eSmrg#
28913544ea2eSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
28923544ea2eSmrg# when strict compilation is unconditionally desired.
2893fb23d3a8SmrgAC_DEFUN([XORG_STRICT_OPTION], [
2894fb23d3a8SmrgAC_REQUIRE([XORG_CWARNFLAGS])
28953544ea2eSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2896fb23d3a8Smrg
2897fb23d3a8SmrgAC_ARG_ENABLE(strict-compilation,
2898fb23d3a8Smrg			  AS_HELP_STRING([--enable-strict-compilation],
2899fb23d3a8Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
2900fb23d3a8Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
29013544ea2eSmrg
29023544ea2eSmrgAC_LANG_CASE(
29033544ea2eSmrg        [C], [
29043544ea2eSmrg                define([PREFIX], [C])
29053544ea2eSmrg        ],
29063544ea2eSmrg        [C++], [
29073544ea2eSmrg                define([PREFIX], [CXX])
29083544ea2eSmrg        ]
29093544ea2eSmrg)
29103544ea2eSmrg
29113544ea2eSmrg[STRICT_]PREFIX[FLAGS]=""
29123544ea2eSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
29133544ea2eSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
29143544ea2eSmrg
29153544ea2eSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
29163544ea2eSmrg# activate it with -Werror, so we add it here explicitly.
29173544ea2eSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
29183544ea2eSmrg
2919fb23d3a8Smrgif test "x$STRICT_COMPILE" = "xyes"; then
29203544ea2eSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
29213544ea2eSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
2922fb23d3a8Smrgfi
29233544ea2eSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
29243544ea2eSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
29253544ea2eSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
2926fb23d3a8Smrg]) # XORG_STRICT_OPTION
2927fb23d3a8Smrg
2928fb23d3a8Smrg# XORG_DEFAULT_OPTIONS
2929fb23d3a8Smrg# --------------------
2930fb23d3a8Smrg# Minimum version: 1.3.0
2931fb23d3a8Smrg#
2932fb23d3a8Smrg# Defines default options for X.Org modules.
2933fb23d3a8Smrg#
2934fb23d3a8SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
2935169a0819SmrgAC_REQUIRE([AC_PROG_INSTALL])
29363544ea2eSmrgXORG_COMPILER_FLAGS
2937fb23d3a8SmrgXORG_CWARNFLAGS
2938fb23d3a8SmrgXORG_STRICT_OPTION
2939fb23d3a8SmrgXORG_RELEASE_VERSION
2940fb23d3a8SmrgXORG_CHANGELOG
2941169a0819SmrgXORG_INSTALL
2942fb23d3a8SmrgXORG_MANPAGE_SECTIONS
2943169a0819Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
2944169a0819Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
2945fb23d3a8Smrg]) # XORG_DEFAULT_OPTIONS
2946169a0819Smrg
2947169a0819Smrg# XORG_INSTALL()
2948169a0819Smrg# ----------------
2949169a0819Smrg# Minimum version: 1.4.0
2950169a0819Smrg#
2951169a0819Smrg# Defines the variable INSTALL_CMD as the command to copy
2952169a0819Smrg# INSTALL from $prefix/share/util-macros.
2953169a0819Smrg#
2954169a0819SmrgAC_DEFUN([XORG_INSTALL], [
2955169a0819SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
2956169a0819Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
2957169a0819SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
2958169a0819Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
2959169a0819Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
2960169a0819Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
2961169a0819SmrgAC_SUBST([INSTALL_CMD])
2962169a0819Smrg]) # XORG_INSTALL
296364ce7165Smrgdnl Copyright 2005 Red Hat, Inc
296464ce7165Smrgdnl
296564ce7165Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
296664ce7165Smrgdnl documentation for any purpose is hereby granted without fee, provided that
296764ce7165Smrgdnl the above copyright notice appear in all copies and that both that
296864ce7165Smrgdnl copyright notice and this permission notice appear in supporting
296964ce7165Smrgdnl documentation.
297064ce7165Smrgdnl
297164ce7165Smrgdnl The above copyright notice and this permission notice shall be included
297264ce7165Smrgdnl in all copies or substantial portions of the Software.
297364ce7165Smrgdnl
297464ce7165Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
297564ce7165Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
297664ce7165Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
297764ce7165Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
297864ce7165Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
297964ce7165Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
298064ce7165Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
298164ce7165Smrgdnl
298264ce7165Smrgdnl Except as contained in this notice, the name of the copyright holders shall
298364ce7165Smrgdnl not be used in advertising or otherwise to promote the sale, use or
298464ce7165Smrgdnl other dealings in this Software without prior written authorization
298564ce7165Smrgdnl from the copyright holders.
298664ce7165Smrgdnl
298764ce7165Smrg
298864ce7165Smrg# XORG_RELEASE_VERSION
298964ce7165Smrg# --------------------
2990169a0819Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
299164ce7165Smrg 
299264ce7165SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
299364ce7165Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
299464ce7165Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
299564ce7165Smrg		[Major version of this package])
2996fb23d3a8Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
299764ce7165Smrg	if test "x$PVM" = "x"; then
299864ce7165Smrg		PVM="0"
299964ce7165Smrg	fi
300064ce7165Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
300164ce7165Smrg		[$PVM],
300264ce7165Smrg		[Minor version of this package])
3003fb23d3a8Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
300464ce7165Smrg	if test "x$PVP" = "x"; then
300564ce7165Smrg		PVP="0"
300664ce7165Smrg	fi
300764ce7165Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
300864ce7165Smrg		[$PVP],
300964ce7165Smrg		[Patch version of this package])
301064ce7165Smrg])
301164ce7165Smrg
3012fb23d3a8Smrg# XORG_CHANGELOG()
3013fb23d3a8Smrg# ----------------
3014fb23d3a8Smrg# Minimum version: 1.2.0
3015fb23d3a8Smrg#
3016fb23d3a8Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3017fb23d3a8Smrg# ChangeLog from git.
3018fb23d3a8Smrg#
3019fb23d3a8Smrg#
3020fb23d3a8SmrgAC_DEFUN([XORG_CHANGELOG], [
3021169a0819SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3022169a0819Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3023169a0819Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3024fb23d3a8Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3025fb23d3a8SmrgAC_SUBST([CHANGELOG_CMD])
3026fb23d3a8Smrg]) # XORG_CHANGELOG
3027fb23d3a8Smrg
302864ce7165Smrgdnl
30293544ea2eSmrgdnl Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
3030169a0819Smrgdnl
3031169a0819Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3032169a0819Smrgdnl copy of this software and associated documentation files (the "Software"),
3033169a0819Smrgdnl to deal in the Software without restriction, including without limitation
3034169a0819Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3035169a0819Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
3036169a0819Smrgdnl Software is furnished to do so, subject to the following conditions:
3037169a0819Smrgdnl
3038169a0819Smrgdnl The above copyright notice and this permission notice (including the next
3039169a0819Smrgdnl paragraph) shall be included in all copies or substantial portions of the
3040169a0819Smrgdnl Software.
3041169a0819Smrgdnl
3042169a0819Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3043169a0819Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3044169a0819Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3045169a0819Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3046169a0819Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3047169a0819Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3048169a0819Smrgdnl DEALINGS IN THE SOFTWARE.
30493544ea2eSmrgdnl
305064ce7165Smrg
305164ce7165Smrg# XTRANS_TCP_FLAGS()
305264ce7165Smrg# ------------------
305364ce7165Smrg# Find needed libraries for TCP sockets, and check for IPv6 support
305464ce7165SmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
305564ce7165Smrg # SVR4 hides these in libraries other than libc
305664ce7165Smrg AC_SEARCH_LIBS(socket, [socket])
305764ce7165Smrg AC_SEARCH_LIBS(gethostbyname, [nsl])
3058169a0819Smrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
3059169a0819Smrg   AC_HAVE_LIBRARY([ws2_32])
3060169a0819Smrg fi
306164ce7165Smrg
306264ce7165Smrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
30633544ea2eSmrg AC_ARG_ENABLE(ipv6,
3064fb23d3a8Smrg	AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
30653544ea2eSmrg	[IPV6CONN=$enableval],
306664ce7165Smrg	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
306764ce7165Smrg AC_MSG_CHECKING([if IPv6 support should be built])
306864ce7165Smrg if test "$IPV6CONN" = "yes"; then
306964ce7165Smrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
307064ce7165Smrg fi
307164ce7165Smrg AC_MSG_RESULT($IPV6CONN)
307264ce7165Smrg
307364ce7165Smrg # 4.3BSD-Reno added a new member to struct sockaddr_in
30743544ea2eSmrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
307564ce7165Smrg	AC_DEFINE([BSD44SOCKETS],1,
307664ce7165Smrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
307764ce7165Smrg#include <sys/types.h>
307864ce7165Smrg#include <sys/socket.h>
307964ce7165Smrg#include <netinet/in.h>
308064ce7165Smrg ])
3081fb23d3a8Smrg
3082fb23d3a8Smrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
3083fb23d3a8Smrg AC_CHECK_TYPES([socklen_t], [], [], [
3084fb23d3a8SmrgAC_INCLUDES_DEFAULT
3085fb23d3a8Smrg#include <sys/socket.h>])
30863544ea2eSmrg
308764ce7165Smrg]) # XTRANS_TCP_FLAGS
308864ce7165Smrg
308964ce7165Smrg# XTRANS_CONNECTION_FLAGS()
309064ce7165Smrg# -------------------------
309164ce7165Smrg# Standard checks for which Xtrans transports to use by the Xorg packages
309264ce7165Smrg# that use Xtrans functions
309364ce7165SmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
309464ce7165Smrg AC_REQUIRE([AC_CANONICAL_HOST])
309564ce7165Smrg AC_REQUIRE([AC_TYPE_SIGNAL])
3096fb23d3a8Smrg [case $host_os in
3097fb23d3a8Smrg	mingw*)	unixdef="no"   ;;
3098fb23d3a8Smrg	*)	unixdef="yes"  ;;
3099fb23d3a8Smrg esac]
310064ce7165Smrg AC_ARG_ENABLE(unix-transport,
310164ce7165Smrg	AC_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
3102fb23d3a8Smrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
310364ce7165Smrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
310464ce7165Smrg if test "$UNIXCONN" = "yes"; then
310564ce7165Smrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
310664ce7165Smrg fi
310764ce7165Smrg AC_MSG_RESULT($UNIXCONN)
31083544ea2eSmrg AC_ARG_ENABLE(tcp-transport,
3109fb23d3a8Smrg	AC_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
3110fb23d3a8Smrg	[TCPCONN=$enableval], [TCPCONN=yes])
311164ce7165Smrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
311264ce7165Smrg AC_MSG_RESULT($TCPCONN)
311364ce7165Smrg if test "$TCPCONN" = "yes"; then
311464ce7165Smrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
311564ce7165Smrg	XTRANS_TCP_FLAGS
311664ce7165Smrg fi
311764ce7165Smrg [case $host_os in
311864ce7165Smrg	solaris*|sco*|sysv4*)	localdef="yes" ;;
311964ce7165Smrg	*)			localdef="no"  ;;
312064ce7165Smrg esac]
312164ce7165Smrg AC_ARG_ENABLE(local-transport,
312264ce7165Smrg	AC_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
312364ce7165Smrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
312464ce7165Smrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
312564ce7165Smrg AC_MSG_RESULT($LOCALCONN)
312664ce7165Smrg if test "$LOCALCONN" = "yes"; then
312764ce7165Smrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
312864ce7165Smrg fi
31293544ea2eSmrg
313064ce7165Smrg]) # XTRANS_CONNECTION_FLAGS
313164ce7165Smrg
313264ce7165Smrg
313364ce7165Smrg# XTRANS_SECURE_RPC_FLAGS()
313464ce7165Smrg# -------------------------
313564ce7165Smrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
313664ce7165Smrg# so that any necessary networking libraries are already found
313764ce7165SmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
313864ce7165Smrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
31393544ea2eSmrg AC_ARG_ENABLE(secure-rpc,
314064ce7165Smrg	AC_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
314164ce7165Smrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
314264ce7165Smrg
314364ce7165Smrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
314464ce7165Smrg	FOUND_SECURE_RPC="no"
314564ce7165Smrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
314664ce7165Smrg			[FOUND_SECURE_RPC="yes"])
314764ce7165Smrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
314864ce7165Smrg		if test "x$SECURE_RPC" = "xyes" ; then
314964ce7165Smrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
31503544ea2eSmrg		fi
315164ce7165Smrg		SECURE_RPC="no"
315264ce7165Smrg	else
315364ce7165Smrg		dnl FreeBSD keeps getsecretkey in librpcsvc
315464ce7165Smrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
315564ce7165Smrg		SECURE_RPC="yes"
315664ce7165Smrg	fi
315764ce7165Smrg fi
315864ce7165Smrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
315964ce7165Smrg if test "x$SECURE_RPC" = "xyes" ; then
316064ce7165Smrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
316164ce7165Smrg fi
316264ce7165Smrg AC_MSG_RESULT($SECURE_RPC)
316364ce7165Smrg]) # XTRANS_SECURE_RPC_FLAGS
316464ce7165Smrg
316564ce7165Smrg
3166