aclocal.m4 revision 95fdd44c
195fdd44cSmrg# generated automatically by aclocal 1.15 -*- Autoconf -*-
281440437Smrg
395fdd44cSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
464ce7165Smrg
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
1481440437Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15fb23d3a8Smrgm4_ifndef([AC_AUTOCONF_VERSION],
16fb23d3a8Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1795fdd44cSmrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
1895fdd44cSmrg[m4_warning([this file was generated for autoconf 2.69.
19fb23d3a8SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
20fb23d3a8SmrgIf you have problems, you may need to regenerate the build system entirely.
2181440437SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
2264ce7165Smrg
2395fdd44cSmrg# Copyright (C) 2002-2014 Free Software Foundation, Inc.
2464ce7165Smrg#
2564ce7165Smrg# This file is free software; the Free Software Foundation
2664ce7165Smrg# gives unlimited permission to copy and/or distribute it,
2764ce7165Smrg# with or without modifications, as long as this notice is preserved.
2864ce7165Smrg
2964ce7165Smrg# AM_AUTOMAKE_VERSION(VERSION)
3064ce7165Smrg# ----------------------------
3164ce7165Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3264ce7165Smrg# generated from the m4 files accompanying Automake X.Y.
3364ce7165Smrg# (This private macro should not be called outside this file.)
3464ce7165SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3595fdd44cSmrg[am__api_version='1.15'
3664ce7165Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3764ce7165Smrgdnl require some minimum version.  Point them to the right macro.
3895fdd44cSmrgm4_if([$1], [1.15], [],
3964ce7165Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4064ce7165Smrg])
4164ce7165Smrg
4264ce7165Smrg# _AM_AUTOCONF_VERSION(VERSION)
4364ce7165Smrg# -----------------------------
4464ce7165Smrg# aclocal traces this macro to find the Autoconf version.
4564ce7165Smrg# This is a private macro too.  Using m4_define simplifies
4664ce7165Smrg# the logic in aclocal, which can simply ignore this definition.
4764ce7165Smrgm4_define([_AM_AUTOCONF_VERSION], [])
4864ce7165Smrg
4964ce7165Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
5064ce7165Smrg# -------------------------------
5164ce7165Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52fb23d3a8Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5364ce7165SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5495fdd44cSmrg[AM_AUTOMAKE_VERSION([1.15])dnl
55fb23d3a8Smrgm4_ifndef([AC_AUTOCONF_VERSION],
56fb23d3a8Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57fb23d3a8Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
5864ce7165Smrg
5964ce7165Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
6064ce7165Smrg
6195fdd44cSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
6264ce7165Smrg#
6364ce7165Smrg# This file is free software; the Free Software Foundation
6464ce7165Smrg# gives unlimited permission to copy and/or distribute it,
6564ce7165Smrg# with or without modifications, as long as this notice is preserved.
6664ce7165Smrg
6764ce7165Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6881440437Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
6981440437Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
7064ce7165Smrg#
7164ce7165Smrg# Of course, Automake must honor this variable whenever it calls a
7264ce7165Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7364ce7165Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7464ce7165Smrg# depending on how configure is run.  This is pretty annoying, since
7564ce7165Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7664ce7165Smrg# source directory, any form will work fine, but in subdirectories a
7764ce7165Smrg# relative path needs to be adjusted first.
7864ce7165Smrg#
7964ce7165Smrg# $ac_aux_dir/missing
8064ce7165Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8164ce7165Smrg# $top_srcdir/$ac_aux_dir/missing
8264ce7165Smrg#    fails if $ac_aux_dir is absolute,
8364ce7165Smrg#    fails when called from a subdirectory in a VPATH build with
8464ce7165Smrg#          a relative $ac_aux_dir
8564ce7165Smrg#
8664ce7165Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8764ce7165Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8881440437Smrg# harmless because $srcdir is '.', but things will broke when you
8964ce7165Smrg# start a VPATH build or use an absolute $srcdir.
9064ce7165Smrg#
9164ce7165Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9264ce7165Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9364ce7165Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9464ce7165Smrg# and then we would define $MISSING as
9564ce7165Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9664ce7165Smrg# This will work as long as MISSING is not called from configure, because
9764ce7165Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9864ce7165Smrg# However there are other variables, like CC, which are often used in
9964ce7165Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
10064ce7165Smrg#
10164ce7165Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10264ce7165Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10364ce7165Smrg# configured tree to be moved without reconfiguration.
10464ce7165Smrg
10564ce7165SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10695fdd44cSmrg[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
10795fdd44cSmrg# Expand $ac_aux_dir to an absolute path.
10895fdd44cSmrgam_aux_dir=`cd "$ac_aux_dir" && pwd`
10964ce7165Smrg])
11064ce7165Smrg
11164ce7165Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
11264ce7165Smrg
11395fdd44cSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
11464ce7165Smrg#
11564ce7165Smrg# This file is free software; the Free Software Foundation
11664ce7165Smrg# gives unlimited permission to copy and/or distribute it,
11764ce7165Smrg# with or without modifications, as long as this notice is preserved.
11864ce7165Smrg
11964ce7165Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12064ce7165Smrg# -------------------------------------
12164ce7165Smrg# Define a conditional.
12264ce7165SmrgAC_DEFUN([AM_CONDITIONAL],
12381440437Smrg[AC_PREREQ([2.52])dnl
12481440437Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12581440437Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12664ce7165SmrgAC_SUBST([$1_TRUE])dnl
12764ce7165SmrgAC_SUBST([$1_FALSE])dnl
12864ce7165Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
12964ce7165Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130fb23d3a8Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13164ce7165Smrgif $2; then
13264ce7165Smrg  $1_TRUE=
13364ce7165Smrg  $1_FALSE='#'
13464ce7165Smrgelse
13564ce7165Smrg  $1_TRUE='#'
13664ce7165Smrg  $1_FALSE=
13764ce7165Smrgfi
13864ce7165SmrgAC_CONFIG_COMMANDS_PRE(
13964ce7165Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14064ce7165Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14164ce7165SmrgUsually this means the macro was only invoked conditionally.]])
14264ce7165Smrgfi])])
14364ce7165Smrg
14495fdd44cSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
14564ce7165Smrg#
14664ce7165Smrg# This file is free software; the Free Software Foundation
14764ce7165Smrg# gives unlimited permission to copy and/or distribute it,
14864ce7165Smrg# with or without modifications, as long as this notice is preserved.
14964ce7165Smrg
15064ce7165Smrg
15181440437Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
15264ce7165Smrg# written in clear, in which case automake, when reading aclocal.m4,
15364ce7165Smrg# will think it sees a *use*, and therefore will trigger all it's
15464ce7165Smrg# C support machinery.  Also note that it means that autoscan, seeing
15564ce7165Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
15664ce7165Smrg
15764ce7165Smrg
15864ce7165Smrg# _AM_DEPENDENCIES(NAME)
15964ce7165Smrg# ----------------------
16064ce7165Smrg# See how the compiler implements dependency checking.
16181440437Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
16264ce7165Smrg# We try a few techniques and use that to set a single cache variable.
16364ce7165Smrg#
16464ce7165Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
16564ce7165Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
16664ce7165Smrg# dependency, and given that the user is not expected to run this macro,
16764ce7165Smrg# just rely on AC_PROG_CC.
16864ce7165SmrgAC_DEFUN([_AM_DEPENDENCIES],
16964ce7165Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17064ce7165SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17164ce7165SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17264ce7165SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
17364ce7165Smrg
17481440437Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
17581440437Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
17681440437Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
17781440437Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
17881440437Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
17981440437Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18081440437Smrg                    [depcc="$$1"   am_compiler_list=])
18164ce7165Smrg
18264ce7165SmrgAC_CACHE_CHECK([dependency style of $depcc],
18364ce7165Smrg               [am_cv_$1_dependencies_compiler_type],
18464ce7165Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18564ce7165Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
18664ce7165Smrg  # making bogus files that we don't know about and never remove.  For
18764ce7165Smrg  # instance it was reported that on HP-UX the gcc test will end up
18881440437Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
18981440437Smrg  # in D".
19081440437Smrg  rm -rf conftest.dir
19164ce7165Smrg  mkdir conftest.dir
19264ce7165Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19364ce7165Smrg  # using a relative directory.
19464ce7165Smrg  cp "$am_depcomp" conftest.dir
19564ce7165Smrg  cd conftest.dir
19664ce7165Smrg  # We will build objects and dependencies in a subdirectory because
19764ce7165Smrg  # it helps to detect inapplicable dependency modes.  For instance
19864ce7165Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
19964ce7165Smrg  # side effect of compilation, but ICC will put the dependencies in
20064ce7165Smrg  # the current directory while Tru64 will put them in the object
20164ce7165Smrg  # directory.
20264ce7165Smrg  mkdir sub
20364ce7165Smrg
20464ce7165Smrg  am_cv_$1_dependencies_compiler_type=none
20564ce7165Smrg  if test "$am_compiler_list" = ""; then
20664ce7165Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
20764ce7165Smrg  fi
208fb23d3a8Smrg  am__universal=false
209fb23d3a8Smrg  m4_case([$1], [CC],
210fb23d3a8Smrg    [case " $depcc " in #(
211fb23d3a8Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212fb23d3a8Smrg     esac],
213fb23d3a8Smrg    [CXX],
214fb23d3a8Smrg    [case " $depcc " in #(
215fb23d3a8Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216fb23d3a8Smrg     esac])
217fb23d3a8Smrg
21864ce7165Smrg  for depmode in $am_compiler_list; do
21964ce7165Smrg    # Setup a source with many dependencies, because some compilers
22064ce7165Smrg    # like to wrap large dependency lists on column 80 (with \), and
22164ce7165Smrg    # we should not choose a depcomp mode which is confused by this.
22264ce7165Smrg    #
22364ce7165Smrg    # We need to recreate these files for each test, as the compiler may
22464ce7165Smrg    # overwrite some of them when testing with obscure command lines.
22564ce7165Smrg    # This happens at least with the AIX C compiler.
22664ce7165Smrg    : > sub/conftest.c
22764ce7165Smrg    for i in 1 2 3 4 5 6; do
22864ce7165Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
22981440437Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
23081440437Smrg      # Solaris 10 /bin/sh.
23181440437Smrg      echo '/* dummy */' > sub/conftst$i.h
23264ce7165Smrg    done
23364ce7165Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23464ce7165Smrg
23581440437Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236fb23d3a8Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
23781440437Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
23881440437Smrg    # versions had trouble with output in subdirs.
239fb23d3a8Smrg    am__obj=sub/conftest.${OBJEXT-o}
240fb23d3a8Smrg    am__minus_obj="-o $am__obj"
24164ce7165Smrg    case $depmode in
242fb23d3a8Smrg    gcc)
243fb23d3a8Smrg      # This depmode causes a compiler race in universal mode.
244fb23d3a8Smrg      test "$am__universal" = false || continue
245fb23d3a8Smrg      ;;
24664ce7165Smrg    nosideeffect)
24781440437Smrg      # After this tag, mechanisms are not by side-effect, so they'll
24881440437Smrg      # only be used when explicitly requested.
24964ce7165Smrg      if test "x$enable_dependency_tracking" = xyes; then
25064ce7165Smrg	continue
25164ce7165Smrg      else
25264ce7165Smrg	break
25364ce7165Smrg      fi
25464ce7165Smrg      ;;
25581440437Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
25681440437Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
257fb23d3a8Smrg      # not run yet.  These depmodes are late enough in the game, and
258fb23d3a8Smrg      # so weak that their functioning should not be impacted.
259fb23d3a8Smrg      am__obj=conftest.${OBJEXT-o}
260fb23d3a8Smrg      am__minus_obj=
261fb23d3a8Smrg      ;;
26264ce7165Smrg    none) break ;;
26364ce7165Smrg    esac
26464ce7165Smrg    if depmode=$depmode \
265fb23d3a8Smrg       source=sub/conftest.c object=$am__obj \
26664ce7165Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267fb23d3a8Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
26864ce7165Smrg         >/dev/null 2>conftest.err &&
26964ce7165Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27064ce7165Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271fb23d3a8Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27264ce7165Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27364ce7165Smrg      # icc doesn't choke on unknown options, it will just issue warnings
27464ce7165Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
27564ce7165Smrg      # that says an option was ignored or not supported.
27664ce7165Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
27764ce7165Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
27864ce7165Smrg      # The diagnosis changed in icc 8.0:
27964ce7165Smrg      #   icc: Command line remark: option '-MP' not supported
28064ce7165Smrg      if (grep 'ignoring option' conftest.err ||
28164ce7165Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28264ce7165Smrg        am_cv_$1_dependencies_compiler_type=$depmode
28364ce7165Smrg        break
28464ce7165Smrg      fi
28564ce7165Smrg    fi
28664ce7165Smrg  done
28764ce7165Smrg
28864ce7165Smrg  cd ..
28964ce7165Smrg  rm -rf conftest.dir
29064ce7165Smrgelse
29164ce7165Smrg  am_cv_$1_dependencies_compiler_type=none
29264ce7165Smrgfi
29364ce7165Smrg])
29464ce7165SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29564ce7165SmrgAM_CONDITIONAL([am__fastdep$1], [
29664ce7165Smrg  test "x$enable_dependency_tracking" != xno \
29764ce7165Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
29864ce7165Smrg])
29964ce7165Smrg
30064ce7165Smrg
30164ce7165Smrg# AM_SET_DEPDIR
30264ce7165Smrg# -------------
30364ce7165Smrg# Choose a directory name for dependency files.
30481440437Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
30564ce7165SmrgAC_DEFUN([AM_SET_DEPDIR],
30664ce7165Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
30764ce7165SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
30864ce7165Smrg])
30964ce7165Smrg
31064ce7165Smrg
31164ce7165Smrg# AM_DEP_TRACK
31264ce7165Smrg# ------------
31364ce7165SmrgAC_DEFUN([AM_DEP_TRACK],
31481440437Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
31581440437SmrgAS_HELP_STRING(
31681440437Smrg  [--enable-dependency-tracking],
31781440437Smrg  [do not reject slow dependency extractors])
31881440437SmrgAS_HELP_STRING(
31981440437Smrg  [--disable-dependency-tracking],
32081440437Smrg  [speeds up one-time build])])
32164ce7165Smrgif test "x$enable_dependency_tracking" != xno; then
32264ce7165Smrg  am_depcomp="$ac_aux_dir/depcomp"
32364ce7165Smrg  AMDEPBACKSLASH='\'
32481440437Smrg  am__nodep='_no'
32564ce7165Smrgfi
32664ce7165SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32764ce7165SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32864ce7165Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32981440437SmrgAC_SUBST([am__nodep])dnl
33081440437Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
33164ce7165Smrg])
33264ce7165Smrg
33364ce7165Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33464ce7165Smrg
33595fdd44cSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
33664ce7165Smrg#
33764ce7165Smrg# This file is free software; the Free Software Foundation
33864ce7165Smrg# gives unlimited permission to copy and/or distribute it,
33964ce7165Smrg# with or without modifications, as long as this notice is preserved.
34064ce7165Smrg
34164ce7165Smrg
34264ce7165Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34364ce7165Smrg# ------------------------------
34464ce7165SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
345fb23d3a8Smrg[{
34681440437Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
347fb23d3a8Smrg  # are listed without --file.  Let's play safe and only enable the eval
348fb23d3a8Smrg  # if we detect the quoting.
349fb23d3a8Smrg  case $CONFIG_FILES in
350fb23d3a8Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
351fb23d3a8Smrg  *)   set x $CONFIG_FILES ;;
352fb23d3a8Smrg  esac
353fb23d3a8Smrg  shift
354fb23d3a8Smrg  for mf
355fb23d3a8Smrg  do
356fb23d3a8Smrg    # Strip MF so we end up with the name of the file.
357fb23d3a8Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
358fb23d3a8Smrg    # Check whether this is an Automake generated Makefile or not.
35981440437Smrg    # We used to match only the files named 'Makefile.in', but
360fb23d3a8Smrg    # some people rename them; so instead we look at the file content.
361fb23d3a8Smrg    # Grep'ing the first line is not enough: some people post-process
362fb23d3a8Smrg    # each Makefile.in and add a new line on top of each file to say so.
363fb23d3a8Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
364fb23d3a8Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
365fb23d3a8Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
366fb23d3a8Smrg      dirpart=`AS_DIRNAME("$mf")`
367fb23d3a8Smrg    else
368fb23d3a8Smrg      continue
369fb23d3a8Smrg    fi
370fb23d3a8Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
37181440437Smrg    # from the Makefile without running 'make'.
372fb23d3a8Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
373fb23d3a8Smrg    test -z "$DEPDIR" && continue
374fb23d3a8Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
37581440437Smrg    test -z "$am__include" && continue
376fb23d3a8Smrg    am__quote=`sed -n 's/^am__quote = //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" | \
38381440437Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/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
40181440437Smrg# 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
41195fdd44cSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
41264ce7165Smrg#
41364ce7165Smrg# This file is free software; the Free Software Foundation
41464ce7165Smrg# gives unlimited permission to copy and/or distribute it,
41564ce7165Smrg# with or without modifications, as long as this notice is preserved.
41664ce7165Smrg
41764ce7165Smrg# This macro actually does too much.  Some checks are only needed if
41864ce7165Smrg# your package does certain things.  But this isn't really a big deal.
41964ce7165Smrg
42081440437Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
42181440437Smrgm4_define([AC_PROG_CC],
42281440437Smrgm4_defn([AC_PROG_CC])
42381440437Smrg[_AM_PROG_CC_C_O
42481440437Smrg])
42581440437Smrg
42664ce7165Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
42764ce7165Smrg# AM_INIT_AUTOMAKE([OPTIONS])
42864ce7165Smrg# -----------------------------------------------
42964ce7165Smrg# The call with PACKAGE and VERSION arguments is the old style
43064ce7165Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
43164ce7165Smrg# and VERSION should now be passed to AC_INIT and removed from
43264ce7165Smrg# the call to AM_INIT_AUTOMAKE.
43364ce7165Smrg# We support both call styles for the transition.  After
43464ce7165Smrg# the next Automake release, Autoconf can make the AC_INIT
43564ce7165Smrg# arguments mandatory, and then we can depend on a new Autoconf
43664ce7165Smrg# release and drop the old call support.
43764ce7165SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43881440437Smrg[AC_PREREQ([2.65])dnl
43964ce7165Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
44064ce7165Smrgdnl the ones we care about.
44164ce7165Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
44264ce7165SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
44364ce7165SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44464ce7165Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44564ce7165Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44664ce7165Smrg  # is not polluted with repeated "-I."
44764ce7165Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44864ce7165Smrg  # test to see if srcdir already configured
44964ce7165Smrg  if test -f $srcdir/config.status; then
45064ce7165Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
45164ce7165Smrg  fi
45264ce7165Smrgfi
45364ce7165Smrg
45464ce7165Smrg# test whether we have cygpath
45564ce7165Smrgif test -z "$CYGPATH_W"; then
45664ce7165Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45764ce7165Smrg    CYGPATH_W='cygpath -w'
45864ce7165Smrg  else
45964ce7165Smrg    CYGPATH_W=echo
46064ce7165Smrg  fi
46164ce7165Smrgfi
46264ce7165SmrgAC_SUBST([CYGPATH_W])
46364ce7165Smrg
46464ce7165Smrg# Define the identity of the package.
46564ce7165Smrgdnl Distinguish between old-style and new-style calls.
46664ce7165Smrgm4_ifval([$2],
46781440437Smrg[AC_DIAGNOSE([obsolete],
46881440437Smrg             [$0: two- and three-arguments forms are deprecated.])
46981440437Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
47064ce7165Smrg AC_SUBST([PACKAGE], [$1])dnl
47164ce7165Smrg AC_SUBST([VERSION], [$2])],
47264ce7165Smrg[_AM_SET_OPTIONS([$1])dnl
47364ce7165Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47481440437Smrgm4_if(
47581440437Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
47681440437Smrg  [ok:ok],,
47764ce7165Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47864ce7165Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47964ce7165Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
48064ce7165Smrg
48164ce7165Smrg_AM_IF_OPTION([no-define],,
48281440437Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
48381440437Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
48464ce7165Smrg
48564ce7165Smrg# Some tools Automake needs.
48664ce7165SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48764ce7165SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48881440437SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
48981440437SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
49081440437SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
49181440437SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
49281440437SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
493fb23d3a8SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
494fb23d3a8SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49581440437SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
49681440437Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
49781440437Smrg# dies out for good.  For more background, see:
49881440437Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
49981440437Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
50081440437SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
50195fdd44cSmrg# We need awk for the "check" target (and possibly the TAP driver).  The
50295fdd44cSmrg# system "awk" is bad on some platforms.
50364ce7165SmrgAC_REQUIRE([AC_PROG_AWK])dnl
50464ce7165SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50564ce7165SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50664ce7165Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
507fb23d3a8Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
508fb23d3a8Smrg			     [_AM_PROG_TAR([v7])])])
50964ce7165Smrg_AM_IF_OPTION([no-dependencies],,
51064ce7165Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
51181440437Smrg		  [_AM_DEPENDENCIES([CC])],
51281440437Smrg		  [m4_define([AC_PROG_CC],
51381440437Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
51464ce7165SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51581440437Smrg		  [_AM_DEPENDENCIES([CXX])],
51681440437Smrg		  [m4_define([AC_PROG_CXX],
51781440437Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
51864ce7165SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51981440437Smrg		  [_AM_DEPENDENCIES([OBJC])],
52081440437Smrg		  [m4_define([AC_PROG_OBJC],
52181440437Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
52281440437SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
52381440437Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
52481440437Smrg		  [m4_define([AC_PROG_OBJCXX],
52581440437Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
52664ce7165Smrg])
52781440437SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
52881440437Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
52981440437Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
53081440437Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
531fb23d3a8SmrgAC_CONFIG_COMMANDS_PRE(dnl
532fb23d3a8Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
533fb23d3a8Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
53464ce7165Smrg
53581440437Smrg# POSIX will say in a future version that running "rm -f" with no argument
53681440437Smrg# is OK; and we want to be able to make that assumption in our Makefile
53781440437Smrg# recipes.  So use an aggressive probe to check that the usage we want is
53881440437Smrg# actually supported "in the wild" to an acceptable degree.
53981440437Smrg# See automake bug#10828.
54081440437Smrg# To make any issue more visible, cause the running configure to be aborted
54181440437Smrg# by default if the 'rm' program in use doesn't match our expectations; the
54281440437Smrg# user can still override this though.
54381440437Smrgif rm -f && rm -fr && rm -rf; then : OK; else
54481440437Smrg  cat >&2 <<'END'
54581440437SmrgOops!
54681440437Smrg
54781440437SmrgYour 'rm' program seems unable to run without file operands specified
54881440437Smrgon the command line, even when the '-f' option is present.  This is contrary
54981440437Smrgto the behaviour of most rm programs out there, and not conforming with
55081440437Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
55181440437Smrg
55281440437SmrgPlease tell bug-automake@gnu.org about your system, including the value
55381440437Smrgof your $PATH and any error possibly output before this message.  This
55481440437Smrgcan help us improve future automake versions.
55581440437Smrg
55681440437SmrgEND
55781440437Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
55881440437Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
55981440437Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
56081440437Smrg    echo >&2
56181440437Smrg  else
56281440437Smrg    cat >&2 <<'END'
56381440437SmrgAborting the configuration process, to ensure you take notice of the issue.
56481440437Smrg
56581440437SmrgYou can download and install GNU coreutils to get an 'rm' implementation
56681440437Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
56781440437Smrg
56881440437SmrgIf you want to complete the configuration process using your problematic
56981440437Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
57081440437Smrgto "yes", and re-run configure.
57181440437Smrg
57281440437SmrgEND
57381440437Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
57481440437Smrg  fi
57595fdd44cSmrgfi
57695fdd44cSmrgdnl The trailing newline in this macro's definition is deliberate, for
57795fdd44cSmrgdnl backward compatibility and to allow trailing 'dnl'-style comments
57895fdd44cSmrgdnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
57995fdd44cSmrg])
58081440437Smrg
58181440437Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
582fb23d3a8Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
583fb23d3a8Smrgdnl mangled by Autoconf and run in a shell conditional statement.
584fb23d3a8Smrgm4_define([_AC_COMPILER_EXEEXT],
585fb23d3a8Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
586fb23d3a8Smrg
58764ce7165Smrg# When config.status generates a header, we must update the stamp-h file.
58864ce7165Smrg# This file resides in the same directory as the config header
58964ce7165Smrg# that is generated.  The stamp files are numbered to have different names.
59064ce7165Smrg
59164ce7165Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
59264ce7165Smrg# loop where config.status creates the headers, so we can generate
59364ce7165Smrg# our stamp files there.
59464ce7165SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
59564ce7165Smrg[# Compute $1's index in $config_headers.
596fb23d3a8Smrg_am_arg=$1
59764ce7165Smrg_am_stamp_count=1
59864ce7165Smrgfor _am_header in $config_headers :; do
59964ce7165Smrg  case $_am_header in
600fb23d3a8Smrg    $_am_arg | $_am_arg:* )
60164ce7165Smrg      break ;;
60264ce7165Smrg    * )
60364ce7165Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
60464ce7165Smrg  esac
60564ce7165Smrgdone
606fb23d3a8Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
60764ce7165Smrg
60895fdd44cSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
60964ce7165Smrg#
61064ce7165Smrg# This file is free software; the Free Software Foundation
61164ce7165Smrg# gives unlimited permission to copy and/or distribute it,
61264ce7165Smrg# with or without modifications, as long as this notice is preserved.
61364ce7165Smrg
61464ce7165Smrg# AM_PROG_INSTALL_SH
61564ce7165Smrg# ------------------
61664ce7165Smrg# Define $install_sh.
61764ce7165SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
61864ce7165Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
61995fdd44cSmrgif test x"${install_sh+set}" != xset; then
620fb23d3a8Smrg  case $am_aux_dir in
621fb23d3a8Smrg  *\ * | *\	*)
622fb23d3a8Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
623fb23d3a8Smrg  *)
624fb23d3a8Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
625fb23d3a8Smrg  esac
626fb23d3a8Smrgfi
62781440437SmrgAC_SUBST([install_sh])])
62864ce7165Smrg
62995fdd44cSmrg# Copyright (C) 2003-2014 Free Software Foundation, Inc.
63064ce7165Smrg#
63164ce7165Smrg# This file is free software; the Free Software Foundation
63264ce7165Smrg# gives unlimited permission to copy and/or distribute it,
63364ce7165Smrg# with or without modifications, as long as this notice is preserved.
63464ce7165Smrg
63564ce7165Smrg# Check whether the underlying file-system supports filenames
63664ce7165Smrg# with a leading dot.  For instance MS-DOS doesn't.
63764ce7165SmrgAC_DEFUN([AM_SET_LEADING_DOT],
63864ce7165Smrg[rm -rf .tst 2>/dev/null
63964ce7165Smrgmkdir .tst 2>/dev/null
64064ce7165Smrgif test -d .tst; then
64164ce7165Smrg  am__leading_dot=.
64264ce7165Smrgelse
64364ce7165Smrg  am__leading_dot=_
64464ce7165Smrgfi
64564ce7165Smrgrmdir .tst 2>/dev/null
64664ce7165SmrgAC_SUBST([am__leading_dot])])
64764ce7165Smrg
64864ce7165Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
64964ce7165Smrg
65095fdd44cSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
65164ce7165Smrg#
65264ce7165Smrg# This file is free software; the Free Software Foundation
65364ce7165Smrg# gives unlimited permission to copy and/or distribute it,
65464ce7165Smrg# with or without modifications, as long as this notice is preserved.
65564ce7165Smrg
65664ce7165Smrg# AM_MAKE_INCLUDE()
65764ce7165Smrg# -----------------
65864ce7165Smrg# Check to see how make treats includes.
65964ce7165SmrgAC_DEFUN([AM_MAKE_INCLUDE],
66064ce7165Smrg[am_make=${MAKE-make}
66164ce7165Smrgcat > confinc << 'END'
66264ce7165Smrgam__doit:
663fb23d3a8Smrg	@echo this is the am__doit target
66464ce7165Smrg.PHONY: am__doit
66564ce7165SmrgEND
66664ce7165Smrg# If we don't find an include directive, just comment out the code.
66764ce7165SmrgAC_MSG_CHECKING([for style of include used by $am_make])
66864ce7165Smrgam__include="#"
66964ce7165Smrgam__quote=
67064ce7165Smrg_am_result=none
67164ce7165Smrg# First try GNU make style include.
67264ce7165Smrgecho "include confinc" > confmf
67381440437Smrg# Ignore all kinds of additional output from 'make'.
674fb23d3a8Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
675fb23d3a8Smrg*the\ am__doit\ target*)
676fb23d3a8Smrg  am__include=include
677fb23d3a8Smrg  am__quote=
678fb23d3a8Smrg  _am_result=GNU
679fb23d3a8Smrg  ;;
680fb23d3a8Smrgesac
68164ce7165Smrg# Now try BSD make style include.
68264ce7165Smrgif test "$am__include" = "#"; then
68364ce7165Smrg   echo '.include "confinc"' > confmf
684fb23d3a8Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
685fb23d3a8Smrg   *the\ am__doit\ target*)
686fb23d3a8Smrg     am__include=.include
687fb23d3a8Smrg     am__quote="\""
688fb23d3a8Smrg     _am_result=BSD
689fb23d3a8Smrg     ;;
690fb23d3a8Smrg   esac
69164ce7165Smrgfi
69264ce7165SmrgAC_SUBST([am__include])
69364ce7165SmrgAC_SUBST([am__quote])
69464ce7165SmrgAC_MSG_RESULT([$_am_result])
69564ce7165Smrgrm -f confinc confmf
69664ce7165Smrg])
69764ce7165Smrg
69864ce7165Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
69964ce7165Smrg
70095fdd44cSmrg# Copyright (C) 1997-2014 Free Software Foundation, Inc.
70164ce7165Smrg#
70264ce7165Smrg# This file is free software; the Free Software Foundation
70364ce7165Smrg# gives unlimited permission to copy and/or distribute it,
70464ce7165Smrg# with or without modifications, as long as this notice is preserved.
70564ce7165Smrg
70664ce7165Smrg# AM_MISSING_PROG(NAME, PROGRAM)
70764ce7165Smrg# ------------------------------
70864ce7165SmrgAC_DEFUN([AM_MISSING_PROG],
70964ce7165Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71064ce7165Smrg$1=${$1-"${am_missing_run}$2"}
71164ce7165SmrgAC_SUBST($1)])
71264ce7165Smrg
71364ce7165Smrg# AM_MISSING_HAS_RUN
71464ce7165Smrg# ------------------
71581440437Smrg# Define MISSING if not defined so far and test if it is modern enough.
71681440437Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
71764ce7165SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
71864ce7165Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
71964ce7165SmrgAC_REQUIRE_AUX_FILE([missing])dnl
720fb23d3a8Smrgif test x"${MISSING+set}" != xset; then
721fb23d3a8Smrg  case $am_aux_dir in
722fb23d3a8Smrg  *\ * | *\	*)
723fb23d3a8Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
724fb23d3a8Smrg  *)
725fb23d3a8Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
726fb23d3a8Smrg  esac
727fb23d3a8Smrgfi
72864ce7165Smrg# Use eval to expand $SHELL
72981440437Smrgif eval "$MISSING --is-lightweight"; then
73081440437Smrg  am_missing_run="$MISSING "
73164ce7165Smrgelse
73264ce7165Smrg  am_missing_run=
73381440437Smrg  AC_MSG_WARN(['missing' script is too old or missing])
73464ce7165Smrgfi
73564ce7165Smrg])
73664ce7165Smrg
73764ce7165Smrg# Helper functions for option handling.                     -*- Autoconf -*-
73864ce7165Smrg
73995fdd44cSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
74064ce7165Smrg#
74164ce7165Smrg# This file is free software; the Free Software Foundation
74264ce7165Smrg# gives unlimited permission to copy and/or distribute it,
74364ce7165Smrg# with or without modifications, as long as this notice is preserved.
74464ce7165Smrg
74564ce7165Smrg# _AM_MANGLE_OPTION(NAME)
74664ce7165Smrg# -----------------------
74764ce7165SmrgAC_DEFUN([_AM_MANGLE_OPTION],
74864ce7165Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
74964ce7165Smrg
75064ce7165Smrg# _AM_SET_OPTION(NAME)
75181440437Smrg# --------------------
75264ce7165Smrg# Set option NAME.  Presently that only means defining a flag for this option.
75364ce7165SmrgAC_DEFUN([_AM_SET_OPTION],
75481440437Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
75564ce7165Smrg
75664ce7165Smrg# _AM_SET_OPTIONS(OPTIONS)
75781440437Smrg# ------------------------
75864ce7165Smrg# OPTIONS is a space-separated list of Automake options.
75964ce7165SmrgAC_DEFUN([_AM_SET_OPTIONS],
760fb23d3a8Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
76164ce7165Smrg
76264ce7165Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
76364ce7165Smrg# -------------------------------------------
76464ce7165Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
76564ce7165SmrgAC_DEFUN([_AM_IF_OPTION],
76664ce7165Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
76764ce7165Smrg
76895fdd44cSmrg# Copyright (C) 1999-2014 Free Software Foundation, Inc.
76981440437Smrg#
77081440437Smrg# This file is free software; the Free Software Foundation
77181440437Smrg# gives unlimited permission to copy and/or distribute it,
77281440437Smrg# with or without modifications, as long as this notice is preserved.
77381440437Smrg
77481440437Smrg# _AM_PROG_CC_C_O
77581440437Smrg# ---------------
77681440437Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
77781440437Smrg# to automatically call this.
77881440437SmrgAC_DEFUN([_AM_PROG_CC_C_O],
77981440437Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
78081440437SmrgAC_REQUIRE_AUX_FILE([compile])dnl
78181440437SmrgAC_LANG_PUSH([C])dnl
78281440437SmrgAC_CACHE_CHECK(
78381440437Smrg  [whether $CC understands -c and -o together],
78481440437Smrg  [am_cv_prog_cc_c_o],
78581440437Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
78681440437Smrg  # Make sure it works both with $CC and with simple cc.
78781440437Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
78881440437Smrg  # compilers refuse to overwrite an existing .o file with -o,
78981440437Smrg  # though they will create one.
79081440437Smrg  am_cv_prog_cc_c_o=yes
79181440437Smrg  for am_i in 1 2; do
79281440437Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
79381440437Smrg         && test -f conftest2.$ac_objext; then
79481440437Smrg      : OK
79581440437Smrg    else
79681440437Smrg      am_cv_prog_cc_c_o=no
79781440437Smrg      break
79881440437Smrg    fi
79981440437Smrg  done
80081440437Smrg  rm -f core conftest*
80181440437Smrg  unset am_i])
80281440437Smrgif test "$am_cv_prog_cc_c_o" != yes; then
80381440437Smrg   # Losing compiler, so override with the script.
80481440437Smrg   # FIXME: It is wrong to rewrite CC.
80581440437Smrg   # But if we don't then we get into trouble of one sort or another.
80681440437Smrg   # A longer-term fix would be to have automake use am__CC in this case,
80781440437Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
80881440437Smrg   CC="$am_aux_dir/compile $CC"
80981440437Smrgfi
81081440437SmrgAC_LANG_POP([C])])
81181440437Smrg
81281440437Smrg# For backward compatibility.
81381440437SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
81464ce7165Smrg
81595fdd44cSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
81664ce7165Smrg#
81764ce7165Smrg# This file is free software; the Free Software Foundation
81864ce7165Smrg# gives unlimited permission to copy and/or distribute it,
81964ce7165Smrg# with or without modifications, as long as this notice is preserved.
82064ce7165Smrg
82181440437Smrg# AM_RUN_LOG(COMMAND)
82281440437Smrg# -------------------
82381440437Smrg# Run COMMAND, save the exit status in ac_status, and log it.
82481440437Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
82581440437SmrgAC_DEFUN([AM_RUN_LOG],
82681440437Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
82781440437Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
82881440437Smrg   ac_status=$?
82981440437Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
83081440437Smrg   (exit $ac_status); }])
83181440437Smrg
83281440437Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
83381440437Smrg
83495fdd44cSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc.
83581440437Smrg#
83681440437Smrg# This file is free software; the Free Software Foundation
83781440437Smrg# gives unlimited permission to copy and/or distribute it,
83881440437Smrg# with or without modifications, as long as this notice is preserved.
83964ce7165Smrg
84064ce7165Smrg# AM_SANITY_CHECK
84164ce7165Smrg# ---------------
84264ce7165SmrgAC_DEFUN([AM_SANITY_CHECK],
84364ce7165Smrg[AC_MSG_CHECKING([whether build environment is sane])
844fb23d3a8Smrg# Reject unsafe characters in $srcdir or the absolute working directory
845fb23d3a8Smrg# name.  Accept space and tab only in the latter.
846fb23d3a8Smrgam_lf='
847fb23d3a8Smrg'
848fb23d3a8Smrgcase `pwd` in
849fb23d3a8Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
850fb23d3a8Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
851fb23d3a8Smrgesac
852fb23d3a8Smrgcase $srcdir in
853fb23d3a8Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
85481440437Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
855fb23d3a8Smrgesac
856fb23d3a8Smrg
85781440437Smrg# Do 'set' in a subshell so we don't clobber the current shell's
85864ce7165Smrg# arguments.  Must try -L first in case configure is actually a
85964ce7165Smrg# symlink; some systems play weird games with the mod time of symlinks
86064ce7165Smrg# (eg FreeBSD returns the mod time of the symlink's containing
86164ce7165Smrg# directory).
86264ce7165Smrgif (
86381440437Smrg   am_has_slept=no
86481440437Smrg   for am_try in 1 2; do
86581440437Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
86681440437Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
86781440437Smrg     if test "$[*]" = "X"; then
86881440437Smrg	# -L didn't work.
86981440437Smrg	set X `ls -t "$srcdir/configure" conftest.file`
87081440437Smrg     fi
87181440437Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
87281440437Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
87381440437Smrg
87481440437Smrg	# If neither matched, then we have a broken ls.  This can happen
87581440437Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
87681440437Smrg	# broken ls alias from the environment.  This has actually
87781440437Smrg	# happened.  Such a system could not be considered "sane".
87881440437Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
87981440437Smrg  alias in your environment])
88081440437Smrg     fi
88181440437Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
88281440437Smrg       break
88381440437Smrg     fi
88481440437Smrg     # Just in case.
88581440437Smrg     sleep 1
88681440437Smrg     am_has_slept=yes
88781440437Smrg   done
88864ce7165Smrg   test "$[2]" = conftest.file
88964ce7165Smrg   )
89064ce7165Smrgthen
89164ce7165Smrg   # Ok.
89264ce7165Smrg   :
89364ce7165Smrgelse
89464ce7165Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
89564ce7165SmrgCheck your system clock])
89664ce7165Smrgfi
89781440437SmrgAC_MSG_RESULT([yes])
89881440437Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
89981440437Smrg# generated files are strictly newer.
90081440437Smrgam_sleep_pid=
90181440437Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
90281440437Smrg  ( sleep 1 ) &
90381440437Smrg  am_sleep_pid=$!
90481440437Smrgfi
90581440437SmrgAC_CONFIG_COMMANDS_PRE(
90681440437Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
90781440437Smrg   if test -n "$am_sleep_pid"; then
90881440437Smrg     # Hide warnings about reused PIDs.
90981440437Smrg     wait $am_sleep_pid 2>/dev/null
91081440437Smrg   fi
91181440437Smrg   AC_MSG_RESULT([done])])
91281440437Smrgrm -f conftest.file
91381440437Smrg])
91464ce7165Smrg
91595fdd44cSmrg# Copyright (C) 2009-2014 Free Software Foundation, Inc.
916fb23d3a8Smrg#
917fb23d3a8Smrg# This file is free software; the Free Software Foundation
918fb23d3a8Smrg# gives unlimited permission to copy and/or distribute it,
919fb23d3a8Smrg# with or without modifications, as long as this notice is preserved.
920fb23d3a8Smrg
921fb23d3a8Smrg# AM_SILENT_RULES([DEFAULT])
922fb23d3a8Smrg# --------------------------
923fb23d3a8Smrg# Enable less verbose build rules; with the default set to DEFAULT
92481440437Smrg# ("yes" being less verbose, "no" or empty being verbose).
925fb23d3a8SmrgAC_DEFUN([AM_SILENT_RULES],
92681440437Smrg[AC_ARG_ENABLE([silent-rules], [dnl
92781440437SmrgAS_HELP_STRING(
92881440437Smrg  [--enable-silent-rules],
92981440437Smrg  [less verbose build output (undo: "make V=1")])
93081440437SmrgAS_HELP_STRING(
93181440437Smrg  [--disable-silent-rules],
93281440437Smrg  [verbose build output (undo: "make V=0")])dnl
93381440437Smrg])
93481440437Smrgcase $enable_silent_rules in @%:@ (((
93581440437Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
93681440437Smrg   no) AM_DEFAULT_VERBOSITY=1;;
93781440437Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
938fb23d3a8Smrgesac
93981440437Smrgdnl
94081440437Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
94181440437Smrgdnl do not support nested variable expansions.
94281440437Smrgdnl See automake bug#9928 and bug#10237.
94381440437Smrgam_make=${MAKE-make}
94481440437SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
94581440437Smrg   [am_cv_make_support_nested_variables],
94681440437Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
94781440437SmrgBAR0=false
94881440437SmrgBAR1=true
94981440437SmrgV=1
95081440437Smrgam__doit:
95181440437Smrg	@$(TRUE)
95281440437Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
95381440437Smrg  am_cv_make_support_nested_variables=yes
95481440437Smrgelse
95581440437Smrg  am_cv_make_support_nested_variables=no
95681440437Smrgfi])
95781440437Smrgif test $am_cv_make_support_nested_variables = yes; then
95881440437Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
95981440437Smrg  AM_V='$(V)'
96081440437Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
96181440437Smrgelse
96281440437Smrg  AM_V=$AM_DEFAULT_VERBOSITY
96381440437Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
96481440437Smrgfi
96581440437SmrgAC_SUBST([AM_V])dnl
96681440437SmrgAM_SUBST_NOTMAKE([AM_V])dnl
96781440437SmrgAC_SUBST([AM_DEFAULT_V])dnl
96881440437SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
969fb23d3a8SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
970fb23d3a8SmrgAM_BACKSLASH='\'
971fb23d3a8SmrgAC_SUBST([AM_BACKSLASH])dnl
972fb23d3a8Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
973fb23d3a8Smrg])
974fb23d3a8Smrg
97595fdd44cSmrg# Copyright (C) 2001-2014 Free Software Foundation, Inc.
97664ce7165Smrg#
97764ce7165Smrg# This file is free software; the Free Software Foundation
97864ce7165Smrg# gives unlimited permission to copy and/or distribute it,
97964ce7165Smrg# with or without modifications, as long as this notice is preserved.
98064ce7165Smrg
98164ce7165Smrg# AM_PROG_INSTALL_STRIP
98264ce7165Smrg# ---------------------
98381440437Smrg# One issue with vendor 'install' (even GNU) is that you can't
98464ce7165Smrg# specify the program used to strip binaries.  This is especially
98564ce7165Smrg# annoying in cross-compiling environments, where the build's strip
98664ce7165Smrg# is unlikely to handle the host's binaries.
98764ce7165Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
98881440437Smrg# always use install-sh in "make install-strip", and initialize
98964ce7165Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
99064ce7165SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
99164ce7165Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
99281440437Smrg# Installed binaries are usually stripped using 'strip' when the user
99381440437Smrg# run "make install-strip".  However 'strip' might not be the right
99464ce7165Smrg# tool to use in cross-compilation environments, therefore Automake
99581440437Smrg# will honor the 'STRIP' environment variable to overrule this program.
99681440437Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
99764ce7165Smrgif test "$cross_compiling" != no; then
99864ce7165Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
99964ce7165Smrgfi
100064ce7165SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
100164ce7165SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
100264ce7165Smrg
100395fdd44cSmrg# Copyright (C) 2006-2014 Free Software Foundation, Inc.
100464ce7165Smrg#
100564ce7165Smrg# This file is free software; the Free Software Foundation
100664ce7165Smrg# gives unlimited permission to copy and/or distribute it,
100764ce7165Smrg# with or without modifications, as long as this notice is preserved.
100864ce7165Smrg
100964ce7165Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
101064ce7165Smrg# ---------------------------
1011fb23d3a8Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
101264ce7165Smrg# This macro is traced by Automake.
101364ce7165SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
101464ce7165Smrg
1015fb23d3a8Smrg# AM_SUBST_NOTMAKE(VARIABLE)
101681440437Smrg# --------------------------
1017fb23d3a8Smrg# Public sister of _AM_SUBST_NOTMAKE.
1018fb23d3a8SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1019fb23d3a8Smrg
102064ce7165Smrg# Check how to create a tarball.                            -*- Autoconf -*-
102164ce7165Smrg
102295fdd44cSmrg# Copyright (C) 2004-2014 Free Software Foundation, Inc.
102364ce7165Smrg#
102464ce7165Smrg# This file is free software; the Free Software Foundation
102564ce7165Smrg# gives unlimited permission to copy and/or distribute it,
102664ce7165Smrg# with or without modifications, as long as this notice is preserved.
102764ce7165Smrg
102864ce7165Smrg# _AM_PROG_TAR(FORMAT)
102964ce7165Smrg# --------------------
103064ce7165Smrg# Check how to create a tarball in format FORMAT.
103181440437Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
103264ce7165Smrg#
103364ce7165Smrg# Substitute a variable $(am__tar) that is a command
103464ce7165Smrg# writing to stdout a FORMAT-tarball containing the directory
103564ce7165Smrg# $tardir.
103664ce7165Smrg#     tardir=directory && $(am__tar) > result.tar
103764ce7165Smrg#
103864ce7165Smrg# Substitute a variable $(am__untar) that extract such
103964ce7165Smrg# a tarball read from stdin.
104064ce7165Smrg#     $(am__untar) < result.tar
104181440437Smrg#
104264ce7165SmrgAC_DEFUN([_AM_PROG_TAR],
104381440437Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
104481440437Smrg# in the wild :-(  We should find a proper way to deprecate it ...
104581440437SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
104681440437Smrg
104781440437Smrg# We'll loop over all known methods to create a tar archive until one works.
104864ce7165Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
104964ce7165Smrg
105081440437Smrgm4_if([$1], [v7],
105181440437Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
105281440437Smrg
105381440437Smrg  [m4_case([$1],
105481440437Smrg    [ustar],
105581440437Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
105681440437Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
105781440437Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
105881440437Smrg      # and bug#13588).
105981440437Smrg      am_max_uid=2097151 # 2^21 - 1
106081440437Smrg      am_max_gid=$am_max_uid
106181440437Smrg      # The $UID and $GID variables are not portable, so we need to resort
106281440437Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
106381440437Smrg      # below are definitely unexpected, so allow the users to see them
106481440437Smrg      # (that is, avoid stderr redirection).
106581440437Smrg      am_uid=`id -u || echo unknown`
106681440437Smrg      am_gid=`id -g || echo unknown`
106781440437Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
106881440437Smrg      if test $am_uid -le $am_max_uid; then
106981440437Smrg         AC_MSG_RESULT([yes])
107081440437Smrg      else
107181440437Smrg         AC_MSG_RESULT([no])
107281440437Smrg         _am_tools=none
107381440437Smrg      fi
107481440437Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
107581440437Smrg      if test $am_gid -le $am_max_gid; then
107681440437Smrg         AC_MSG_RESULT([yes])
107781440437Smrg      else
107881440437Smrg        AC_MSG_RESULT([no])
107981440437Smrg        _am_tools=none
108081440437Smrg      fi],
108181440437Smrg
108281440437Smrg  [pax],
108381440437Smrg    [],
108481440437Smrg
108581440437Smrg  [m4_fatal([Unknown tar format])])
108681440437Smrg
108781440437Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
108881440437Smrg
108981440437Smrg  # Go ahead even if we have the value already cached.  We do so because we
109081440437Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
109181440437Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
109281440437Smrg
109381440437Smrg  for _am_tool in $_am_tools; do
109481440437Smrg    case $_am_tool in
109581440437Smrg    gnutar)
109681440437Smrg      for _am_tar in tar gnutar gtar; do
109781440437Smrg        AM_RUN_LOG([$_am_tar --version]) && break
109881440437Smrg      done
109981440437Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
110081440437Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
110181440437Smrg      am__untar="$_am_tar -xf -"
110281440437Smrg      ;;
110381440437Smrg    plaintar)
110481440437Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
110581440437Smrg      # ustar tarball either.
110681440437Smrg      (tar --version) >/dev/null 2>&1 && continue
110781440437Smrg      am__tar='tar chf - "$$tardir"'
110881440437Smrg      am__tar_='tar chf - "$tardir"'
110981440437Smrg      am__untar='tar xf -'
111081440437Smrg      ;;
111181440437Smrg    pax)
111281440437Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
111381440437Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
111481440437Smrg      am__untar='pax -r'
111581440437Smrg      ;;
111681440437Smrg    cpio)
111781440437Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
111881440437Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
111981440437Smrg      am__untar='cpio -i -H $1 -d'
112081440437Smrg      ;;
112181440437Smrg    none)
112281440437Smrg      am__tar=false
112381440437Smrg      am__tar_=false
112481440437Smrg      am__untar=false
112581440437Smrg      ;;
112681440437Smrg    esac
112764ce7165Smrg
112881440437Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
112981440437Smrg    # and am__untar set.
113081440437Smrg    test -n "${am_cv_prog_tar_$1}" && break
113181440437Smrg
113281440437Smrg    # tar/untar a dummy directory, and stop if the command works.
113381440437Smrg    rm -rf conftest.dir
113481440437Smrg    mkdir conftest.dir
113581440437Smrg    echo GrepMe > conftest.dir/file
113681440437Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
113781440437Smrg    rm -rf conftest.dir
113881440437Smrg    if test -s conftest.tar; then
113981440437Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
114081440437Smrg      AM_RUN_LOG([cat conftest.dir/file])
114181440437Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
114281440437Smrg    fi
114381440437Smrg  done
114464ce7165Smrg  rm -rf conftest.dir
114564ce7165Smrg
114681440437Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
114781440437Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
114881440437Smrg
114964ce7165SmrgAC_SUBST([am__tar])
115064ce7165SmrgAC_SUBST([am__untar])
115164ce7165Smrg]) # _AM_PROG_TAR
115264ce7165Smrg
11533544ea2eSmrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
11543544ea2eSmrg# 
11553544ea2eSmrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11563544ea2eSmrg#
11573544ea2eSmrg# This program is free software; you can redistribute it and/or modify
11583544ea2eSmrg# it under the terms of the GNU General Public License as published by
11593544ea2eSmrg# the Free Software Foundation; either version 2 of the License, or
11603544ea2eSmrg# (at your option) any later version.
11613544ea2eSmrg#
11623544ea2eSmrg# This program is distributed in the hope that it will be useful, but
11633544ea2eSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
11643544ea2eSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11653544ea2eSmrg# General Public License for more details.
11663544ea2eSmrg#
11673544ea2eSmrg# You should have received a copy of the GNU General Public License
11683544ea2eSmrg# along with this program; if not, write to the Free Software
11693544ea2eSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
11703544ea2eSmrg#
11713544ea2eSmrg# As a special exception to the GNU General Public License, if you
11723544ea2eSmrg# distribute this file as part of a program that contains a
11733544ea2eSmrg# configuration script generated by Autoconf, you may include it under
11743544ea2eSmrg# the same distribution terms that you use for the rest of that program.
11753544ea2eSmrg
11763544ea2eSmrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
11773544ea2eSmrg# ----------------------------------
11783544ea2eSmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
11793544ea2eSmrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
11803544ea2eSmrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
11813544ea2eSmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
11823544ea2eSmrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
11833544ea2eSmrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
11843544ea2eSmrgfi
11853544ea2eSmrgif test -n "$PKG_CONFIG"; then
11863544ea2eSmrg	_pkg_min_version=m4_default([$1], [0.9.0])
11873544ea2eSmrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
11883544ea2eSmrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
11893544ea2eSmrg		AC_MSG_RESULT([yes])
11903544ea2eSmrg	else
11913544ea2eSmrg		AC_MSG_RESULT([no])
11923544ea2eSmrg		PKG_CONFIG=""
11933544ea2eSmrg	fi
11943544ea2eSmrg		
11953544ea2eSmrgfi[]dnl
11963544ea2eSmrg])# PKG_PROG_PKG_CONFIG
11973544ea2eSmrg
11983544ea2eSmrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
11993544ea2eSmrg#
12003544ea2eSmrg# Check to see whether a particular set of modules exists.  Similar
12013544ea2eSmrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
12023544ea2eSmrg#
12033544ea2eSmrg#
12043544ea2eSmrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
12053544ea2eSmrg# this or PKG_CHECK_MODULES is called, or make sure to call
12063544ea2eSmrg# PKG_CHECK_EXISTS manually
12073544ea2eSmrg# --------------------------------------------------------------
12083544ea2eSmrgAC_DEFUN([PKG_CHECK_EXISTS],
12093544ea2eSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12103544ea2eSmrgif test -n "$PKG_CONFIG" && \
12113544ea2eSmrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12123544ea2eSmrg  m4_ifval([$2], [$2], [:])
12133544ea2eSmrgm4_ifvaln([$3], [else
12143544ea2eSmrg  $3])dnl
12153544ea2eSmrgfi])
12163544ea2eSmrg
12173544ea2eSmrg
12183544ea2eSmrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12193544ea2eSmrg# ---------------------------------------------
12203544ea2eSmrgm4_define([_PKG_CONFIG],
12213544ea2eSmrg[if test -n "$$1"; then
12223544ea2eSmrg    pkg_cv_[]$1="$$1"
12233544ea2eSmrg elif test -n "$PKG_CONFIG"; then
12243544ea2eSmrg    PKG_CHECK_EXISTS([$3],
12253544ea2eSmrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
12263544ea2eSmrg		     [pkg_failed=yes])
12273544ea2eSmrg else
12283544ea2eSmrg    pkg_failed=untried
12293544ea2eSmrgfi[]dnl
12303544ea2eSmrg])# _PKG_CONFIG
12313544ea2eSmrg
12323544ea2eSmrg# _PKG_SHORT_ERRORS_SUPPORTED
12333544ea2eSmrg# -----------------------------
12343544ea2eSmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
12353544ea2eSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12363544ea2eSmrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
12373544ea2eSmrg        _pkg_short_errors_supported=yes
12383544ea2eSmrgelse
12393544ea2eSmrg        _pkg_short_errors_supported=no
12403544ea2eSmrgfi[]dnl
12413544ea2eSmrg])# _PKG_SHORT_ERRORS_SUPPORTED
12423544ea2eSmrg
12433544ea2eSmrg
12443544ea2eSmrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12453544ea2eSmrg# [ACTION-IF-NOT-FOUND])
12463544ea2eSmrg#
12473544ea2eSmrg#
12483544ea2eSmrg# Note that if there is a possibility the first call to
12493544ea2eSmrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
12503544ea2eSmrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
12513544ea2eSmrg#
12523544ea2eSmrg#
12533544ea2eSmrg# --------------------------------------------------------------
12543544ea2eSmrgAC_DEFUN([PKG_CHECK_MODULES],
12553544ea2eSmrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12563544ea2eSmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
12573544ea2eSmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12583544ea2eSmrg
12593544ea2eSmrgpkg_failed=no
12603544ea2eSmrgAC_MSG_CHECKING([for $1])
12613544ea2eSmrg
12623544ea2eSmrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
12633544ea2eSmrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
12643544ea2eSmrg
12653544ea2eSmrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
12663544ea2eSmrgand $1[]_LIBS to avoid the need to call pkg-config.
12673544ea2eSmrgSee the pkg-config man page for more details.])
12683544ea2eSmrg
12693544ea2eSmrgif test $pkg_failed = yes; then
12703544ea2eSmrg        _PKG_SHORT_ERRORS_SUPPORTED
12713544ea2eSmrg        if test $_pkg_short_errors_supported = yes; then
12723544ea2eSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
12733544ea2eSmrg        else 
12743544ea2eSmrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
12753544ea2eSmrg        fi
12763544ea2eSmrg	# Put the nasty error message in config.log where it belongs
12773544ea2eSmrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
12783544ea2eSmrg
12793544ea2eSmrg	ifelse([$4], , [AC_MSG_ERROR(dnl
12803544ea2eSmrg[Package requirements ($2) were not met:
12813544ea2eSmrg
12823544ea2eSmrg$$1_PKG_ERRORS
12833544ea2eSmrg
12843544ea2eSmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
12853544ea2eSmrginstalled software in a non-standard prefix.
12863544ea2eSmrg
12873544ea2eSmrg_PKG_TEXT
12883544ea2eSmrg])],
12893544ea2eSmrg		[AC_MSG_RESULT([no])
12903544ea2eSmrg                $4])
12913544ea2eSmrgelif test $pkg_failed = untried; then
12923544ea2eSmrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
12933544ea2eSmrg[The pkg-config script could not be found or is too old.  Make sure it
12943544ea2eSmrgis in your PATH or set the PKG_CONFIG environment variable to the full
12953544ea2eSmrgpath to pkg-config.
12963544ea2eSmrg
12973544ea2eSmrg_PKG_TEXT
12983544ea2eSmrg
12993544ea2eSmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
13003544ea2eSmrg		[$4])
13013544ea2eSmrgelse
13023544ea2eSmrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
13033544ea2eSmrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
13043544ea2eSmrg        AC_MSG_RESULT([yes])
13053544ea2eSmrg	ifelse([$3], , :, [$3])
13063544ea2eSmrgfi[]dnl
13073544ea2eSmrg])# PKG_CHECK_MODULES
13083544ea2eSmrg
1309fb23d3a8Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
131064ce7165Smrgdnl
1311169a0819Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
131295fdd44cSmrgdnl
131364ce7165Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
1314169a0819Smrgdnl copy of this software and associated documentation files (the "Software"),
1315169a0819Smrgdnl to deal in the Software without restriction, including without limitation
1316169a0819Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1317169a0819Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
1318169a0819Smrgdnl Software is furnished to do so, subject to the following conditions:
131964ce7165Smrgdnl
1320169a0819Smrgdnl The above copyright notice and this permission notice (including the next
1321169a0819Smrgdnl paragraph) shall be included in all copies or substantial portions of the
1322169a0819Smrgdnl Software.
132364ce7165Smrgdnl
1324169a0819Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1325169a0819Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1326169a0819Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1327169a0819Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1328169a0819Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1329169a0819Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1330169a0819Smrgdnl DEALINGS IN THE SOFTWARE.
133164ce7165Smrg
133264ce7165Smrg# XORG_MACROS_VERSION(required-version)
133364ce7165Smrg# -------------------------------------
133464ce7165Smrg# Minimum version: 1.1.0
133564ce7165Smrg#
133664ce7165Smrg# If you're using a macro added in Version 1.1 or newer, include this in
133764ce7165Smrg# your configure.ac with the minimum required version, such as:
133864ce7165Smrg# XORG_MACROS_VERSION(1.1)
133964ce7165Smrg#
1340fb23d3a8Smrg# To ensure that this macro is defined, also add:
1341fb23d3a8Smrg# m4_ifndef([XORG_MACROS_VERSION],
1342fb23d3a8Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
134364ce7165Smrg#
134464ce7165Smrg#
134595fdd44cSmrg# See the "minimum version" comment for each macro you use to see what
134664ce7165Smrg# version you require.
1347fb23d3a8Smrgm4_defun([XORG_MACROS_VERSION],[
134895fdd44cSmrgm4_define([vers_have], [1.19.0])
1349fb23d3a8Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1350fb23d3a8Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1351fb23d3a8Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
1352fb23d3a8Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1353fb23d3a8Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
1354fb23d3a8Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1355fb23d3a8Smrgm4_undefine([vers_have])
1356fb23d3a8Smrgm4_undefine([maj_have])
1357fb23d3a8Smrgm4_undefine([maj_needed])
135864ce7165Smrg]) # XORG_MACROS_VERSION
135964ce7165Smrg
136064ce7165Smrg# XORG_PROG_RAWCPP()
136164ce7165Smrg# ------------------
136264ce7165Smrg# Minimum version: 1.0.0
136364ce7165Smrg#
136464ce7165Smrg# Find cpp program and necessary flags for use in pre-processing text files
136564ce7165Smrg# such as man pages and config files
136664ce7165SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
136764ce7165SmrgAC_REQUIRE([AC_PROG_CPP])
136895fdd44cSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
136964ce7165Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
137064ce7165Smrg
137164ce7165Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
137264ce7165Smrg# which is not the best choice for supporting other OS'es, but covers most
137364ce7165Smrg# of the ones we need for now.
137464ce7165SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
13753544ea2eSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
137664ce7165Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
137764ce7165Smrg	AC_MSG_RESULT([no])
137864ce7165Smrgelse
137964ce7165Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
138064ce7165Smrg		RAWCPPFLAGS=-undef
138164ce7165Smrg		AC_MSG_RESULT([yes])
1382fb23d3a8Smrg	# under Cygwin unix is still defined even with -undef
1383fb23d3a8Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1384fb23d3a8Smrg		RAWCPPFLAGS="-undef -ansi"
1385fb23d3a8Smrg		AC_MSG_RESULT([yes, with -ansi])
138664ce7165Smrg	else
138764ce7165Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
138864ce7165Smrg	fi
138964ce7165Smrgfi
139064ce7165Smrgrm -f conftest.$ac_ext
139164ce7165Smrg
139264ce7165SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
13933544ea2eSmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
139464ce7165Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
139564ce7165Smrg	AC_MSG_RESULT([no])
139664ce7165Smrgelse
139764ce7165Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
139895fdd44cSmrg		TRADITIONALCPPFLAGS="-traditional"
139964ce7165Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
140064ce7165Smrg		AC_MSG_RESULT([yes])
140164ce7165Smrg	else
140264ce7165Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
140364ce7165Smrg	fi
140464ce7165Smrgfi
140564ce7165Smrgrm -f conftest.$ac_ext
140664ce7165SmrgAC_SUBST(RAWCPPFLAGS)
140795fdd44cSmrgAC_SUBST(TRADITIONALCPPFLAGS)
140864ce7165Smrg]) # XORG_PROG_RAWCPP
140964ce7165Smrg
141064ce7165Smrg# XORG_MANPAGE_SECTIONS()
141164ce7165Smrg# -----------------------
141264ce7165Smrg# Minimum version: 1.0.0
141364ce7165Smrg#
141464ce7165Smrg# Determine which sections man pages go in for the different man page types
141564ce7165Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
141664ce7165Smrg# Not sure if there's any better way than just hardcoding by OS name.
141764ce7165Smrg# Override default settings by setting environment variables
1418169a0819Smrg# Added MAN_SUBSTS in version 1.8
1419169a0819Smrg# Added AC_PROG_SED in version 1.8
142064ce7165Smrg
142164ce7165SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
142264ce7165SmrgAC_REQUIRE([AC_CANONICAL_HOST])
1423169a0819SmrgAC_REQUIRE([AC_PROG_SED])
142464ce7165Smrg
142564ce7165Smrgif test x$APP_MAN_SUFFIX = x    ; then
142664ce7165Smrg    APP_MAN_SUFFIX=1
142764ce7165Smrgfi
142864ce7165Smrgif test x$APP_MAN_DIR = x    ; then
142964ce7165Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
143064ce7165Smrgfi
143164ce7165Smrg
143264ce7165Smrgif test x$LIB_MAN_SUFFIX = x    ; then
143364ce7165Smrg    LIB_MAN_SUFFIX=3
143464ce7165Smrgfi
143564ce7165Smrgif test x$LIB_MAN_DIR = x    ; then
143664ce7165Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
143764ce7165Smrgfi
143864ce7165Smrg
143964ce7165Smrgif test x$FILE_MAN_SUFFIX = x    ; then
144064ce7165Smrg    case $host_os in
144164ce7165Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
144264ce7165Smrg	*)		FILE_MAN_SUFFIX=5  ;;
144364ce7165Smrg    esac
144464ce7165Smrgfi
144564ce7165Smrgif test x$FILE_MAN_DIR = x    ; then
144664ce7165Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
144764ce7165Smrgfi
144864ce7165Smrg
144964ce7165Smrgif test x$MISC_MAN_SUFFIX = x    ; then
145064ce7165Smrg    case $host_os in
145164ce7165Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
145264ce7165Smrg	*)		MISC_MAN_SUFFIX=7  ;;
145364ce7165Smrg    esac
145464ce7165Smrgfi
145564ce7165Smrgif test x$MISC_MAN_DIR = x    ; then
145664ce7165Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
145764ce7165Smrgfi
145864ce7165Smrg
145964ce7165Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
146064ce7165Smrg    case $host_os in
146164ce7165Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
146264ce7165Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
146364ce7165Smrg    esac
146464ce7165Smrgfi
146564ce7165Smrgif test x$DRIVER_MAN_DIR = x    ; then
146664ce7165Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
146764ce7165Smrgfi
146864ce7165Smrg
146964ce7165Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
147064ce7165Smrg    case $host_os in
147164ce7165Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
147264ce7165Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
147364ce7165Smrg    esac
147464ce7165Smrgfi
147564ce7165Smrgif test x$ADMIN_MAN_DIR = x    ; then
147664ce7165Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
147764ce7165Smrgfi
147864ce7165Smrg
147964ce7165Smrg
148064ce7165SmrgAC_SUBST([APP_MAN_SUFFIX])
148164ce7165SmrgAC_SUBST([LIB_MAN_SUFFIX])
148264ce7165SmrgAC_SUBST([FILE_MAN_SUFFIX])
148364ce7165SmrgAC_SUBST([MISC_MAN_SUFFIX])
148464ce7165SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
148564ce7165SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
148664ce7165SmrgAC_SUBST([APP_MAN_DIR])
148764ce7165SmrgAC_SUBST([LIB_MAN_DIR])
148864ce7165SmrgAC_SUBST([FILE_MAN_DIR])
148964ce7165SmrgAC_SUBST([MISC_MAN_DIR])
149064ce7165SmrgAC_SUBST([DRIVER_MAN_DIR])
149164ce7165SmrgAC_SUBST([ADMIN_MAN_DIR])
1492169a0819Smrg
1493169a0819SmrgXORG_MAN_PAGE="X Version 11"
1494169a0819SmrgAC_SUBST([XORG_MAN_PAGE])
1495169a0819SmrgMAN_SUBSTS="\
1496169a0819Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1497169a0819Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1498169a0819Smrg	-e 's|__xservername__|Xorg|g' \
1499169a0819Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
1500169a0819Smrg	-e 's|__projectroot__|\$(prefix)|g' \
1501169a0819Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1502169a0819Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1503169a0819Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1504169a0819Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1505169a0819Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1506169a0819Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1507169a0819Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1508169a0819SmrgAC_SUBST([MAN_SUBSTS])
1509169a0819Smrg
151064ce7165Smrg]) # XORG_MANPAGE_SECTIONS
151164ce7165Smrg
1512169a0819Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1513169a0819Smrg# ------------------------
1514169a0819Smrg# Minimum version: 1.7.0
1515169a0819Smrg#
1516169a0819Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1517169a0819Smrg# provided by xorg-sgml-doctools, if installed.
1518169a0819SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1519169a0819SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1520169a0819SmrgXORG_SGML_PATH=
1521169a0819SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1522169a0819Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1523169a0819Smrg    [m4_ifval([$1],[:],
1524169a0819Smrg        [if test x"$cross_compiling" != x"yes" ; then
1525169a0819Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1526169a0819Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
1527169a0819Smrg         fi])
1528169a0819Smrg    ])
1529169a0819Smrg
1530169a0819Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1531169a0819Smrg# the path and the name of the doc stylesheet
1532169a0819Smrgif test "x$XORG_SGML_PATH" != "x" ; then
1533169a0819Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
1534169a0819Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1535169a0819Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1536169a0819Smrgelse
1537169a0819Smrg   AC_MSG_RESULT([no])
1538169a0819Smrgfi
1539169a0819Smrg
1540169a0819SmrgAC_SUBST(XORG_SGML_PATH)
1541169a0819SmrgAC_SUBST(STYLESHEET_SRCDIR)
1542169a0819SmrgAC_SUBST(XSL_STYLESHEET)
1543169a0819SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1544169a0819Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1545169a0819Smrg
154664ce7165Smrg# XORG_CHECK_LINUXDOC
154764ce7165Smrg# -------------------
154864ce7165Smrg# Minimum version: 1.0.0
154964ce7165Smrg#
155064ce7165Smrg# Defines the variable MAKE_TEXT if the necessary tools and
155164ce7165Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
155264ce7165Smrg# Whether or not the necessary tools and files are found can be checked
155364ce7165Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
155464ce7165SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
1555169a0819SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1556169a0819SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
155764ce7165Smrg
155864ce7165SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
155964ce7165Smrg
1560169a0819SmrgAC_MSG_CHECKING([whether to build documentation])
156164ce7165Smrg
1562169a0819Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
156364ce7165Smrg   BUILDDOC=yes
156464ce7165Smrgelse
156564ce7165Smrg   BUILDDOC=no
156664ce7165Smrgfi
156764ce7165Smrg
156864ce7165SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
156964ce7165Smrg
157064ce7165SmrgAC_MSG_RESULT([$BUILDDOC])
157164ce7165Smrg
1572169a0819SmrgAC_MSG_CHECKING([whether to build pdf documentation])
157364ce7165Smrg
1574169a0819Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
157564ce7165Smrg   BUILDPDFDOC=yes
157664ce7165Smrgelse
157764ce7165Smrg   BUILDPDFDOC=no
157864ce7165Smrgfi
157964ce7165Smrg
158064ce7165SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
158164ce7165Smrg
158264ce7165SmrgAC_MSG_RESULT([$BUILDPDFDOC])
158364ce7165Smrg
1584169a0819SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
158564ce7165SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
158664ce7165SmrgMAKE_PDF="$PS2PDF"
158764ce7165SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
158864ce7165Smrg
158964ce7165SmrgAC_SUBST(MAKE_TEXT)
159064ce7165SmrgAC_SUBST(MAKE_PS)
159164ce7165SmrgAC_SUBST(MAKE_PDF)
159264ce7165SmrgAC_SUBST(MAKE_HTML)
159364ce7165Smrg]) # XORG_CHECK_LINUXDOC
159464ce7165Smrg
159564ce7165Smrg# XORG_CHECK_DOCBOOK
159664ce7165Smrg# -------------------
159764ce7165Smrg# Minimum version: 1.0.0
159864ce7165Smrg#
159964ce7165Smrg# Checks for the ability to build output formats from SGML DocBook source.
160064ce7165Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
160164ce7165Smrg# indicates whether the necessary tools and files are found and, if set,
160264ce7165Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
160364ce7165SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
1604169a0819SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1605169a0819Smrg
160664ce7165SmrgBUILDTXTDOC=no
160764ce7165SmrgBUILDPDFDOC=no
160864ce7165SmrgBUILDPSDOC=no
160964ce7165SmrgBUILDHTMLDOC=no
161064ce7165Smrg
161164ce7165SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
161264ce7165SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
161364ce7165SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
161464ce7165SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
161564ce7165Smrg
1616169a0819SmrgAC_MSG_CHECKING([whether to build text documentation])
1617169a0819Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
161864ce7165Smrg   test x$BUILD_TXTDOC != xno; then
161964ce7165Smrg	BUILDTXTDOC=yes
162064ce7165Smrgfi
162164ce7165SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
162264ce7165SmrgAC_MSG_RESULT([$BUILDTXTDOC])
162364ce7165Smrg
1624169a0819SmrgAC_MSG_CHECKING([whether to build PDF documentation])
1625169a0819Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
162664ce7165Smrg   test x$BUILD_PDFDOC != xno; then
162764ce7165Smrg	BUILDPDFDOC=yes
162864ce7165Smrgfi
162964ce7165SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
163064ce7165SmrgAC_MSG_RESULT([$BUILDPDFDOC])
163164ce7165Smrg
1632169a0819SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
1633169a0819Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
163464ce7165Smrg   test x$BUILD_PSDOC != xno; then
163564ce7165Smrg	BUILDPSDOC=yes
163664ce7165Smrgfi
163764ce7165SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
163864ce7165SmrgAC_MSG_RESULT([$BUILDPSDOC])
163964ce7165Smrg
1640169a0819SmrgAC_MSG_CHECKING([whether to build HTML documentation])
1641169a0819Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
164264ce7165Smrg   test x$BUILD_HTMLDOC != xno; then
164364ce7165Smrg	BUILDHTMLDOC=yes
164464ce7165Smrgfi
164564ce7165SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
164664ce7165SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
164764ce7165Smrg
164864ce7165SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
164964ce7165SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
165064ce7165SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
165164ce7165SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
165264ce7165Smrg
165364ce7165SmrgAC_SUBST(MAKE_TEXT)
165464ce7165SmrgAC_SUBST(MAKE_PS)
165564ce7165SmrgAC_SUBST(MAKE_PDF)
165664ce7165SmrgAC_SUBST(MAKE_HTML)
165764ce7165Smrg]) # XORG_CHECK_DOCBOOK
165864ce7165Smrg
1659169a0819Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1660169a0819Smrg# ----------------
1661169a0819Smrg# Minimum version: 1.5.0
1662169a0819Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1663169a0819Smrg#
1664169a0819Smrg# Documentation tools are not always available on all platforms and sometimes
1665169a0819Smrg# not at the appropriate level. This macro enables a module to test for the
1666169a0819Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1667169a0819Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
1668169a0819Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
1669169a0819Smrg# --with-xmlto assumes 'auto'.
1670169a0819Smrg#
1671169a0819Smrg# Interface to module:
1672169a0819Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1673169a0819Smrg# XMLTO:	returns the path of the xmlto program found
1674169a0819Smrg#		returns the path set by the user in the environment
1675169a0819Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
1676169a0819Smrg#		'no' user instructs the module not to use xmlto
1677169a0819Smrg#
1678169a0819Smrg# Added in version 1.10.0
1679169a0819Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1680169a0819Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
1681169a0819Smrg#
1682169a0819Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1683169a0819Smrg#
1684169a0819SmrgAC_DEFUN([XORG_WITH_XMLTO],[
1685169a0819SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
1686169a0819Smrgm4_define([_defopt], m4_default([$2], [auto]))
1687169a0819SmrgAC_ARG_WITH(xmlto,
1688169a0819Smrg	AS_HELP_STRING([--with-xmlto],
1689169a0819Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1690169a0819Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1691169a0819Smrgm4_undefine([_defopt])
1692169a0819Smrg
1693169a0819Smrgif test "x$use_xmlto" = x"auto"; then
1694169a0819Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1695169a0819Smrg   if test "x$XMLTO" = "x"; then
1696169a0819Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1697169a0819Smrg	have_xmlto=no
1698169a0819Smrg   else
1699169a0819Smrg        have_xmlto=yes
1700169a0819Smrg   fi
1701169a0819Smrgelif test "x$use_xmlto" = x"yes" ; then
1702169a0819Smrg   AC_PATH_PROG([XMLTO], [xmlto])
1703169a0819Smrg   if test "x$XMLTO" = "x"; then
1704169a0819Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1705169a0819Smrg   fi
1706169a0819Smrg   have_xmlto=yes
1707169a0819Smrgelif test "x$use_xmlto" = x"no" ; then
1708169a0819Smrg   if test "x$XMLTO" != "x"; then
1709169a0819Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1710169a0819Smrg   fi
1711169a0819Smrg   have_xmlto=no
1712169a0819Smrgelse
1713169a0819Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1714169a0819Smrgfi
1715169a0819Smrg
1716169a0819Smrg# Test for a minimum version of xmlto, if provided.
1717169a0819Smrgm4_ifval([$1],
1718169a0819Smrg[if test "$have_xmlto" = yes; then
1719169a0819Smrg    # scrape the xmlto version
1720169a0819Smrg    AC_MSG_CHECKING([the xmlto version])
1721169a0819Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1722169a0819Smrg    AC_MSG_RESULT([$xmlto_version])
1723169a0819Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
1724169a0819Smrg        [if test "x$use_xmlto" = xauto; then
1725169a0819Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1726169a0819Smrg            have_xmlto=no
1727169a0819Smrg        else
1728169a0819Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1729169a0819Smrg        fi])
1730169a0819Smrgfi])
1731169a0819Smrg
1732169a0819Smrg# Test for the ability of xmlto to generate a text target
1733169a0819Smrghave_xmlto_text=no
1734169a0819Smrgcat > conftest.xml << "EOF"
1735169a0819SmrgEOF
1736169a0819SmrgAS_IF([test "$have_xmlto" = yes],
1737169a0819Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1738169a0819Smrg             [have_xmlto_text=yes],
1739169a0819Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
1740169a0819Smrgrm -f conftest.xml
1741169a0819SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1742169a0819SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1743169a0819Smrg]) # XORG_WITH_XMLTO
1744169a0819Smrg
17453544ea2eSmrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
17463544ea2eSmrg# --------------------------------------------
17473544ea2eSmrg# Minimum version: 1.12.0
17483544ea2eSmrg# Minimum version for optional DEFAULT argument: 1.12.0
17493544ea2eSmrg#
17503544ea2eSmrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
17513544ea2eSmrg# XML-based language used for the transformation of XML documents.
17523544ea2eSmrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
17533544ea2eSmrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
17543544ea2eSmrg# The XSLT processor is often used as a standalone tool for transformations.
17553544ea2eSmrg# It should not be assumed that this tool is used only to work with documnetation.
17563544ea2eSmrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
17573544ea2eSmrg#
17583544ea2eSmrg# Interface to module:
17593544ea2eSmrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
17603544ea2eSmrg# XSLTPROC:	 returns the path of the xsltproc program found
17613544ea2eSmrg#		 returns the path set by the user in the environment
17623544ea2eSmrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
17633544ea2eSmrg#		  'no' user instructs the module not to use xsltproc
17643544ea2eSmrg# have_xsltproc: returns yes if xsltproc found in PATH or no
17653544ea2eSmrg#
17663544ea2eSmrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
17673544ea2eSmrg#
17683544ea2eSmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
17693544ea2eSmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
17703544ea2eSmrg# Preserves the interface, should it be implemented later
17713544ea2eSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
17723544ea2eSmrgm4_define([_defopt], m4_default([$2], [auto]))
17733544ea2eSmrgAC_ARG_WITH(xsltproc,
17743544ea2eSmrg	AS_HELP_STRING([--with-xsltproc],
17753544ea2eSmrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
17763544ea2eSmrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
17773544ea2eSmrgm4_undefine([_defopt])
17783544ea2eSmrg
17793544ea2eSmrgif test "x$use_xsltproc" = x"auto"; then
17803544ea2eSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
17813544ea2eSmrg   if test "x$XSLTPROC" = "x"; then
17823544ea2eSmrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
17833544ea2eSmrg	have_xsltproc=no
17843544ea2eSmrg   else
17853544ea2eSmrg        have_xsltproc=yes
17863544ea2eSmrg   fi
17873544ea2eSmrgelif test "x$use_xsltproc" = x"yes" ; then
17883544ea2eSmrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
17893544ea2eSmrg   if test "x$XSLTPROC" = "x"; then
17903544ea2eSmrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
17913544ea2eSmrg   fi
17923544ea2eSmrg   have_xsltproc=yes
17933544ea2eSmrgelif test "x$use_xsltproc" = x"no" ; then
17943544ea2eSmrg   if test "x$XSLTPROC" != "x"; then
17953544ea2eSmrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
17963544ea2eSmrg   fi
17973544ea2eSmrg   have_xsltproc=no
17983544ea2eSmrgelse
17993544ea2eSmrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
18003544ea2eSmrgfi
18013544ea2eSmrg
18023544ea2eSmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
18033544ea2eSmrg]) # XORG_WITH_XSLTPROC
18043544ea2eSmrg
18053544ea2eSmrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
18063544ea2eSmrg# ----------------------------------------
18073544ea2eSmrg# Minimum version: 1.15.0
18083544ea2eSmrg#
18093544ea2eSmrg# PERL (Practical Extraction and Report Language) is a language optimized for
18103544ea2eSmrg# scanning arbitrary text files, extracting information from those text files,
18113544ea2eSmrg# and printing reports based on that information.
18123544ea2eSmrg#
18133544ea2eSmrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
18143544ea2eSmrg#
18153544ea2eSmrg# Interface to module:
18163544ea2eSmrg# HAVE_PERL: used in makefiles to conditionally scan text files
18173544ea2eSmrg# PERL:	     returns the path of the perl program found
18183544ea2eSmrg#	     returns the path set by the user in the environment
18193544ea2eSmrg# --with-perl: 'yes' user instructs the module to use perl
18203544ea2eSmrg#	       'no' user instructs the module not to use perl
18213544ea2eSmrg# have_perl: returns yes if perl found in PATH or no
18223544ea2eSmrg#
18233544ea2eSmrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
18243544ea2eSmrg#
18253544ea2eSmrgAC_DEFUN([XORG_WITH_PERL],[
18263544ea2eSmrgAC_ARG_VAR([PERL], [Path to perl command])
18273544ea2eSmrg# Preserves the interface, should it be implemented later
18283544ea2eSmrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
18293544ea2eSmrgm4_define([_defopt], m4_default([$2], [auto]))
18303544ea2eSmrgAC_ARG_WITH(perl,
18313544ea2eSmrg	AS_HELP_STRING([--with-perl],
18323544ea2eSmrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
18333544ea2eSmrg	   [use_perl=$withval], [use_perl=]_defopt)
18343544ea2eSmrgm4_undefine([_defopt])
18353544ea2eSmrg
18363544ea2eSmrgif test "x$use_perl" = x"auto"; then
18373544ea2eSmrg   AC_PATH_PROG([PERL], [perl])
18383544ea2eSmrg   if test "x$PERL" = "x"; then
18393544ea2eSmrg        AC_MSG_WARN([perl not found - cannot extract information and report])
18403544ea2eSmrg	have_perl=no
18413544ea2eSmrg   else
18423544ea2eSmrg        have_perl=yes
18433544ea2eSmrg   fi
18443544ea2eSmrgelif test "x$use_perl" = x"yes" ; then
18453544ea2eSmrg   AC_PATH_PROG([PERL], [perl])
18463544ea2eSmrg   if test "x$PERL" = "x"; then
18473544ea2eSmrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
18483544ea2eSmrg   fi
18493544ea2eSmrg   have_perl=yes
18503544ea2eSmrgelif test "x$use_perl" = x"no" ; then
18513544ea2eSmrg   if test "x$PERL" != "x"; then
18523544ea2eSmrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
18533544ea2eSmrg   fi
18543544ea2eSmrg   have_perl=no
18553544ea2eSmrgelse
18563544ea2eSmrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
18573544ea2eSmrgfi
18583544ea2eSmrg
18593544ea2eSmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
18603544ea2eSmrg]) # XORG_WITH_PERL
18613544ea2eSmrg
1862169a0819Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1863169a0819Smrg# ----------------
1864169a0819Smrg# Minimum version: 1.5.0
1865169a0819Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1866169a0819Smrg#
1867169a0819Smrg# Documentation tools are not always available on all platforms and sometimes
1868169a0819Smrg# not at the appropriate level. This macro enables a module to test for the
1869169a0819Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1870169a0819Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1871169a0819Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1872169a0819Smrg# --with-asciidoc assumes 'auto'.
1873169a0819Smrg#
1874169a0819Smrg# Interface to module:
1875169a0819Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1876169a0819Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
1877169a0819Smrg#		 returns the path set by the user in the environment
1878169a0819Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1879169a0819Smrg#		  'no' user instructs the module not to use asciidoc
1880169a0819Smrg#
1881169a0819Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1882169a0819Smrg#
1883169a0819SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
1884169a0819SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1885169a0819Smrgm4_define([_defopt], m4_default([$2], [auto]))
1886169a0819SmrgAC_ARG_WITH(asciidoc,
1887169a0819Smrg	AS_HELP_STRING([--with-asciidoc],
1888169a0819Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1889169a0819Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1890169a0819Smrgm4_undefine([_defopt])
1891169a0819Smrg
1892169a0819Smrgif test "x$use_asciidoc" = x"auto"; then
1893169a0819Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1894169a0819Smrg   if test "x$ASCIIDOC" = "x"; then
1895169a0819Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1896169a0819Smrg	have_asciidoc=no
1897169a0819Smrg   else
1898169a0819Smrg        have_asciidoc=yes
1899169a0819Smrg   fi
1900169a0819Smrgelif test "x$use_asciidoc" = x"yes" ; then
1901169a0819Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1902169a0819Smrg   if test "x$ASCIIDOC" = "x"; then
1903169a0819Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1904169a0819Smrg   fi
1905169a0819Smrg   have_asciidoc=yes
1906169a0819Smrgelif test "x$use_asciidoc" = x"no" ; then
1907169a0819Smrg   if test "x$ASCIIDOC" != "x"; then
1908169a0819Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1909169a0819Smrg   fi
1910169a0819Smrg   have_asciidoc=no
1911169a0819Smrgelse
1912169a0819Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1913169a0819Smrgfi
1914169a0819Smrgm4_ifval([$1],
1915169a0819Smrg[if test "$have_asciidoc" = yes; then
1916169a0819Smrg    # scrape the asciidoc version
1917169a0819Smrg    AC_MSG_CHECKING([the asciidoc version])
1918169a0819Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1919169a0819Smrg    AC_MSG_RESULT([$asciidoc_version])
1920169a0819Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1921169a0819Smrg        [if test "x$use_asciidoc" = xauto; then
1922169a0819Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1923169a0819Smrg            have_asciidoc=no
1924169a0819Smrg        else
1925169a0819Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1926169a0819Smrg        fi])
1927169a0819Smrgfi])
1928169a0819SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1929169a0819Smrg]) # XORG_WITH_ASCIIDOC
1930169a0819Smrg
1931169a0819Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
193295fdd44cSmrg# -------------------------------------------
1933169a0819Smrg# Minimum version: 1.5.0
1934169a0819Smrg# Minimum version for optional DEFAULT argument: 1.11.0
193595fdd44cSmrg# Minimum version for optional DOT checking: 1.18.0
1936169a0819Smrg#
1937169a0819Smrg# Documentation tools are not always available on all platforms and sometimes
1938169a0819Smrg# not at the appropriate level. This macro enables a module to test for the
1939169a0819Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
1940169a0819Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
1941169a0819Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
1942169a0819Smrg# --with-doxygen assumes 'auto'.
1943169a0819Smrg#
1944169a0819Smrg# Interface to module:
1945169a0819Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1946169a0819Smrg# DOXYGEN:	 returns the path of the doxygen program found
1947169a0819Smrg#		 returns the path set by the user in the environment
1948169a0819Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
1949169a0819Smrg#		  'no' user instructs the module not to use doxygen
1950169a0819Smrg#
1951169a0819Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1952169a0819Smrg#
1953169a0819SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
1954169a0819SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
195595fdd44cSmrgAC_ARG_VAR([DOT], [Path to the dot graphics utility])
1956169a0819Smrgm4_define([_defopt], m4_default([$2], [auto]))
1957169a0819SmrgAC_ARG_WITH(doxygen,
1958169a0819Smrg	AS_HELP_STRING([--with-doxygen],
1959169a0819Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1960169a0819Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1961169a0819Smrgm4_undefine([_defopt])
1962169a0819Smrg
1963169a0819Smrgif test "x$use_doxygen" = x"auto"; then
1964169a0819Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1965169a0819Smrg   if test "x$DOXYGEN" = "x"; then
1966169a0819Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1967169a0819Smrg	have_doxygen=no
1968169a0819Smrg   else
1969169a0819Smrg        have_doxygen=yes
1970169a0819Smrg   fi
1971169a0819Smrgelif test "x$use_doxygen" = x"yes" ; then
1972169a0819Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
1973169a0819Smrg   if test "x$DOXYGEN" = "x"; then
1974169a0819Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1975169a0819Smrg   fi
1976169a0819Smrg   have_doxygen=yes
1977169a0819Smrgelif test "x$use_doxygen" = x"no" ; then
1978169a0819Smrg   if test "x$DOXYGEN" != "x"; then
1979169a0819Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1980169a0819Smrg   fi
1981169a0819Smrg   have_doxygen=no
1982169a0819Smrgelse
1983169a0819Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1984169a0819Smrgfi
1985169a0819Smrgm4_ifval([$1],
1986169a0819Smrg[if test "$have_doxygen" = yes; then
1987169a0819Smrg    # scrape the doxygen version
1988169a0819Smrg    AC_MSG_CHECKING([the doxygen version])
1989169a0819Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
1990169a0819Smrg    AC_MSG_RESULT([$doxygen_version])
1991169a0819Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
1992169a0819Smrg        [if test "x$use_doxygen" = xauto; then
1993169a0819Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
1994169a0819Smrg            have_doxygen=no
1995169a0819Smrg        else
1996169a0819Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
1997169a0819Smrg        fi])
1998169a0819Smrgfi])
199995fdd44cSmrg
200095fdd44cSmrgdnl Check for DOT if we have doxygen. The caller decides if it is mandatory
200195fdd44cSmrgdnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
200295fdd44cSmrgdnl 	HAVE_DOT = @HAVE_DOT@
200395fdd44cSmrgHAVE_DOT=no
200495fdd44cSmrgif test "x$have_doxygen" = "xyes"; then
200595fdd44cSmrg  AC_PATH_PROG([DOT], [dot])
200695fdd44cSmrg    if test "x$DOT" != "x"; then
200795fdd44cSmrg      HAVE_DOT=yes
200895fdd44cSmrg    fi
200995fdd44cSmrgfi
201095fdd44cSmrg
201195fdd44cSmrgAC_SUBST([HAVE_DOT])
201295fdd44cSmrgAM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2013169a0819SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2014169a0819Smrg]) # XORG_WITH_DOXYGEN
2015169a0819Smrg
2016169a0819Smrg# XORG_WITH_GROFF([DEFAULT])
2017169a0819Smrg# ----------------
2018169a0819Smrg# Minimum version: 1.6.0
2019169a0819Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2020169a0819Smrg#
2021169a0819Smrg# Documentation tools are not always available on all platforms and sometimes
2022169a0819Smrg# not at the appropriate level. This macro enables a module to test for the
2023169a0819Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2024169a0819Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
2025169a0819Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
2026169a0819Smrg# --with-groff assumes 'auto'.
2027169a0819Smrg#
2028169a0819Smrg# Interface to module:
2029169a0819Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2030169a0819Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
2031169a0819Smrg# HAVE_GROFF_MS: the -ms macros package
2032169a0819Smrg# GROFF:	 returns the path of the groff program found
2033169a0819Smrg#		 returns the path set by the user in the environment
2034169a0819Smrg# --with-groff:	 'yes' user instructs the module to use groff
2035169a0819Smrg#		 'no' user instructs the module not to use groff
2036169a0819Smrg#
2037169a0819Smrg# Added in version 1.9.0:
2038169a0819Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2039169a0819Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2040169a0819Smrg#		   psselect from the psutils package.
2041169a0819Smrg#		   the ghostcript package. Refer to the grohtml man pages
2042169a0819Smrg#
2043169a0819Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2044169a0819Smrg#
2045169a0819Smrg# OS and distros often splits groff in a basic and full package, the former
2046169a0819Smrg# having the groff program and the later having devices, fonts and macros
2047169a0819Smrg# Checking for the groff executable is not enough.
2048169a0819Smrg#
2049169a0819Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
2050169a0819Smrg# unset HAVE_GROFF or GROFF env variables.
2051169a0819Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2052169a0819Smrg#
2053169a0819SmrgAC_DEFUN([XORG_WITH_GROFF],[
2054169a0819SmrgAC_ARG_VAR([GROFF], [Path to groff command])
2055169a0819Smrgm4_define([_defopt], m4_default([$1], [auto]))
2056169a0819SmrgAC_ARG_WITH(groff,
2057169a0819Smrg	AS_HELP_STRING([--with-groff],
2058169a0819Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2059169a0819Smrg	   [use_groff=$withval], [use_groff=]_defopt)
2060169a0819Smrgm4_undefine([_defopt])
2061169a0819Smrg
2062169a0819Smrgif test "x$use_groff" = x"auto"; then
2063169a0819Smrg   AC_PATH_PROG([GROFF], [groff])
2064169a0819Smrg   if test "x$GROFF" = "x"; then
2065169a0819Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2066169a0819Smrg	have_groff=no
2067169a0819Smrg   else
2068169a0819Smrg        have_groff=yes
2069169a0819Smrg   fi
2070169a0819Smrgelif test "x$use_groff" = x"yes" ; then
2071169a0819Smrg   AC_PATH_PROG([GROFF], [groff])
2072169a0819Smrg   if test "x$GROFF" = "x"; then
2073169a0819Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2074169a0819Smrg   fi
2075169a0819Smrg   have_groff=yes
2076169a0819Smrgelif test "x$use_groff" = x"no" ; then
2077169a0819Smrg   if test "x$GROFF" != "x"; then
2078169a0819Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2079169a0819Smrg   fi
2080169a0819Smrg   have_groff=no
2081169a0819Smrgelse
2082169a0819Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2083169a0819Smrgfi
2084169a0819Smrg
2085169a0819Smrg# We have groff, test for the presence of the macro packages
2086169a0819Smrgif test "x$have_groff" = x"yes"; then
2087169a0819Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2088169a0819Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2089169a0819Smrg        groff_ms_works=yes
2090169a0819Smrg    else
2091169a0819Smrg        groff_ms_works=no
2092169a0819Smrg    fi
2093169a0819Smrg    AC_MSG_RESULT([$groff_ms_works])
2094169a0819Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2095169a0819Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2096169a0819Smrg        groff_mm_works=yes
2097169a0819Smrg    else
2098169a0819Smrg        groff_mm_works=no
2099169a0819Smrg    fi
2100169a0819Smrg    AC_MSG_RESULT([$groff_mm_works])
2101169a0819Smrgfi
2102169a0819Smrg
2103169a0819Smrg# We have groff, test for HTML dependencies, one command per package
2104169a0819Smrgif test "x$have_groff" = x"yes"; then
2105169a0819Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2106169a0819Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2107169a0819Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2108169a0819Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2109169a0819Smrg      have_groff_html=yes
2110169a0819Smrg   else
2111169a0819Smrg      have_groff_html=no
2112169a0819Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2113169a0819Smrg   fi
2114169a0819Smrgfi
2115169a0819Smrg
2116169a0819Smrg# Set Automake conditionals for Makefiles
2117169a0819SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2118169a0819SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2119169a0819SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2120169a0819SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2121169a0819Smrg]) # XORG_WITH_GROFF
2122169a0819Smrg
21233544ea2eSmrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
21243544ea2eSmrg# ---------------------------------------
2125169a0819Smrg# Minimum version: 1.6.0
2126169a0819Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21273544ea2eSmrg# Minimum version for optional MIN-VERSION argument: 1.15.0
2128169a0819Smrg#
2129169a0819Smrg# Documentation tools are not always available on all platforms and sometimes
2130169a0819Smrg# not at the appropriate level. This macro enables a module to test for the
2131169a0819Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2132169a0819Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
2133169a0819Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
2134169a0819Smrg# --with-fop assumes 'auto'.
2135169a0819Smrg#
2136169a0819Smrg# Interface to module:
2137169a0819Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2138169a0819Smrg# FOP:	 	returns the path of the fop program found
2139169a0819Smrg#		returns the path set by the user in the environment
2140169a0819Smrg# --with-fop: 	'yes' user instructs the module to use fop
2141169a0819Smrg#		'no' user instructs the module not to use fop
2142169a0819Smrg#
2143169a0819Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2144169a0819Smrg#
2145169a0819SmrgAC_DEFUN([XORG_WITH_FOP],[
2146169a0819SmrgAC_ARG_VAR([FOP], [Path to fop command])
21473544ea2eSmrgm4_define([_defopt], m4_default([$2], [auto]))
2148169a0819SmrgAC_ARG_WITH(fop,
2149169a0819Smrg	AS_HELP_STRING([--with-fop],
2150169a0819Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2151169a0819Smrg	   [use_fop=$withval], [use_fop=]_defopt)
2152169a0819Smrgm4_undefine([_defopt])
2153169a0819Smrg
2154169a0819Smrgif test "x$use_fop" = x"auto"; then
2155169a0819Smrg   AC_PATH_PROG([FOP], [fop])
2156169a0819Smrg   if test "x$FOP" = "x"; then
2157169a0819Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2158169a0819Smrg	have_fop=no
2159169a0819Smrg   else
2160169a0819Smrg        have_fop=yes
2161169a0819Smrg   fi
2162169a0819Smrgelif test "x$use_fop" = x"yes" ; then
2163169a0819Smrg   AC_PATH_PROG([FOP], [fop])
2164169a0819Smrg   if test "x$FOP" = "x"; then
2165169a0819Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2166169a0819Smrg   fi
2167169a0819Smrg   have_fop=yes
2168169a0819Smrgelif test "x$use_fop" = x"no" ; then
2169169a0819Smrg   if test "x$FOP" != "x"; then
2170169a0819Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2171169a0819Smrg   fi
2172169a0819Smrg   have_fop=no
2173169a0819Smrgelse
2174169a0819Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2175169a0819Smrgfi
21763544ea2eSmrg
21773544ea2eSmrg# Test for a minimum version of fop, if provided.
21783544ea2eSmrgm4_ifval([$1],
21793544ea2eSmrg[if test "$have_fop" = yes; then
21803544ea2eSmrg    # scrape the fop version
21813544ea2eSmrg    AC_MSG_CHECKING([for fop minimum version])
21823544ea2eSmrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
21833544ea2eSmrg    AC_MSG_RESULT([$fop_version])
21843544ea2eSmrg    AS_VERSION_COMPARE([$fop_version], [$1],
21853544ea2eSmrg        [if test "x$use_fop" = xauto; then
21863544ea2eSmrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
21873544ea2eSmrg            have_fop=no
21883544ea2eSmrg        else
21893544ea2eSmrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
21903544ea2eSmrg        fi])
21913544ea2eSmrgfi])
2192169a0819SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2193169a0819Smrg]) # XORG_WITH_FOP
2194169a0819Smrg
219595fdd44cSmrg# XORG_WITH_M4([MIN-VERSION])
219695fdd44cSmrg# ---------------------------
219795fdd44cSmrg# Minimum version: 1.19.0
219895fdd44cSmrg#
219995fdd44cSmrg# This macro attempts to locate an m4 macro processor which supports
220095fdd44cSmrg# -I option and is only useful for modules relying on M4 in order to
220195fdd44cSmrg# expand macros in source code files.
220295fdd44cSmrg#
220395fdd44cSmrg# Interface to module:
220495fdd44cSmrg# M4:	 	returns the path of the m4 program found
220595fdd44cSmrg#		returns the path set by the user in the environment
220695fdd44cSmrg#
220795fdd44cSmrgAC_DEFUN([XORG_WITH_M4], [
220895fdd44cSmrgAC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
220995fdd44cSmrg   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
221095fdd44cSmrg       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
221195fdd44cSmrg         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
221295fdd44cSmrg   [AC_MSG_ERROR([could not find m4 that supports -I option])],
221395fdd44cSmrg   [$PATH:/usr/gnu/bin])])
221495fdd44cSmrg
221595fdd44cSmrgAC_SUBST([M4], [$ac_cv_path_M4])
221695fdd44cSmrg]) # XORG_WITH_M4
221795fdd44cSmrg
2218169a0819Smrg# XORG_WITH_PS2PDF([DEFAULT])
2219169a0819Smrg# ----------------
2220169a0819Smrg# Minimum version: 1.6.0
2221169a0819Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2222169a0819Smrg#
2223169a0819Smrg# Documentation tools are not always available on all platforms and sometimes
2224169a0819Smrg# not at the appropriate level. This macro enables a module to test for the
2225169a0819Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
2226169a0819Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2227169a0819Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2228169a0819Smrg# --with-ps2pdf assumes 'auto'.
2229169a0819Smrg#
2230169a0819Smrg# Interface to module:
2231169a0819Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2232169a0819Smrg# PS2PDF:	returns the path of the ps2pdf program found
2233169a0819Smrg#		returns the path set by the user in the environment
2234169a0819Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2235169a0819Smrg#		 'no' user instructs the module not to use ps2pdf
2236169a0819Smrg#
2237169a0819Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2238169a0819Smrg#
2239169a0819SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
2240169a0819SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2241169a0819Smrgm4_define([_defopt], m4_default([$1], [auto]))
2242169a0819SmrgAC_ARG_WITH(ps2pdf,
2243169a0819Smrg	AS_HELP_STRING([--with-ps2pdf],
2244169a0819Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2245169a0819Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2246169a0819Smrgm4_undefine([_defopt])
2247169a0819Smrg
2248169a0819Smrgif test "x$use_ps2pdf" = x"auto"; then
2249169a0819Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2250169a0819Smrg   if test "x$PS2PDF" = "x"; then
2251169a0819Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2252169a0819Smrg	have_ps2pdf=no
2253169a0819Smrg   else
2254169a0819Smrg        have_ps2pdf=yes
2255169a0819Smrg   fi
2256169a0819Smrgelif test "x$use_ps2pdf" = x"yes" ; then
2257169a0819Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
2258169a0819Smrg   if test "x$PS2PDF" = "x"; then
2259169a0819Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2260169a0819Smrg   fi
2261169a0819Smrg   have_ps2pdf=yes
2262169a0819Smrgelif test "x$use_ps2pdf" = x"no" ; then
2263169a0819Smrg   if test "x$PS2PDF" != "x"; then
2264169a0819Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2265169a0819Smrg   fi
2266169a0819Smrg   have_ps2pdf=no
2267169a0819Smrgelse
2268169a0819Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2269169a0819Smrgfi
2270169a0819SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2271169a0819Smrg]) # XORG_WITH_PS2PDF
2272169a0819Smrg
2273169a0819Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
2274169a0819Smrg# ----------------
2275169a0819Smrg# Minimum version: 1.6.0
2276169a0819Smrg#
2277169a0819Smrg# Documentation tools are not always available on all platforms and sometimes
2278169a0819Smrg# not at the appropriate level. This macro enables a builder to skip all
2279169a0819Smrg# documentation targets except traditional man pages.
2280169a0819Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2281169a0819Smrg# maximum flexibilty in controlling documentation building.
2282169a0819Smrg# Refer to:
2283169a0819Smrg# XORG_WITH_XMLTO         --with-xmlto
2284169a0819Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2285169a0819Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2286169a0819Smrg# XORG_WITH_FOP           --with-fop
2287169a0819Smrg# XORG_WITH_GROFF         --with-groff
2288169a0819Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2289169a0819Smrg#
2290169a0819Smrg# Interface to module:
2291169a0819Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2292169a0819Smrg# --enable-docs: 'yes' user instructs the module to generate docs
2293169a0819Smrg#		 'no' user instructs the module not to generate docs
2294169a0819Smrg# parm1:	specify the default value, yes or no.
2295169a0819Smrg#
2296169a0819SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
22973544ea2eSmrgm4_define([docs_default], m4_default([$1], [yes]))
2298169a0819SmrgAC_ARG_ENABLE(docs,
2299169a0819Smrg	AS_HELP_STRING([--enable-docs],
23003544ea2eSmrg	   [Enable building the documentation (default: ]docs_default[)]),
23013544ea2eSmrg	   [build_docs=$enableval], [build_docs=]docs_default)
23023544ea2eSmrgm4_undefine([docs_default])
2303169a0819SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2304169a0819SmrgAC_MSG_CHECKING([whether to build documentation])
2305169a0819SmrgAC_MSG_RESULT([$build_docs])
2306169a0819Smrg]) # XORG_ENABLE_DOCS
2307169a0819Smrg
2308169a0819Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2309169a0819Smrg# ----------------
2310169a0819Smrg# Minimum version: 1.6.0
2311169a0819Smrg#
2312169a0819Smrg# This macro enables a builder to skip all developer documentation.
2313169a0819Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2314169a0819Smrg# maximum flexibilty in controlling documentation building.
2315169a0819Smrg# Refer to:
2316169a0819Smrg# XORG_WITH_XMLTO         --with-xmlto
2317169a0819Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2318169a0819Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2319169a0819Smrg# XORG_WITH_FOP           --with-fop
2320169a0819Smrg# XORG_WITH_GROFF         --with-groff
2321169a0819Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2322169a0819Smrg#
2323169a0819Smrg# Interface to module:
2324169a0819Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2325169a0819Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2326169a0819Smrg#			'no' user instructs the module not to generate developer docs
2327169a0819Smrg# parm1:		specify the default value, yes or no.
2328169a0819Smrg#
2329169a0819SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2330169a0819Smrgm4_define([devel_default], m4_default([$1], [yes]))
2331169a0819SmrgAC_ARG_ENABLE(devel-docs,
2332169a0819Smrg	AS_HELP_STRING([--enable-devel-docs],
2333169a0819Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
2334169a0819Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2335169a0819Smrgm4_undefine([devel_default])
2336169a0819SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2337169a0819SmrgAC_MSG_CHECKING([whether to build developer documentation])
2338169a0819SmrgAC_MSG_RESULT([$build_devel_docs])
2339169a0819Smrg]) # XORG_ENABLE_DEVEL_DOCS
2340169a0819Smrg
2341169a0819Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
2342169a0819Smrg# ----------------
2343169a0819Smrg# Minimum version: 1.6.0
2344169a0819Smrg#
2345169a0819Smrg# This macro enables a builder to skip all functional specification targets.
2346169a0819Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
2347169a0819Smrg# maximum flexibilty in controlling documentation building.
2348169a0819Smrg# Refer to:
2349169a0819Smrg# XORG_WITH_XMLTO         --with-xmlto
2350169a0819Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
2351169a0819Smrg# XORG_WITH_DOXYGEN       --with-doxygen
2352169a0819Smrg# XORG_WITH_FOP           --with-fop
2353169a0819Smrg# XORG_WITH_GROFF         --with-groff
2354169a0819Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
2355169a0819Smrg#
2356169a0819Smrg# Interface to module:
2357169a0819Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2358169a0819Smrg# --enable-specs:	'yes' user instructs the module to generate specs
2359169a0819Smrg#			'no' user instructs the module not to generate specs
2360169a0819Smrg# parm1:		specify the default value, yes or no.
2361169a0819Smrg#
2362169a0819SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
2363169a0819Smrgm4_define([spec_default], m4_default([$1], [yes]))
2364169a0819SmrgAC_ARG_ENABLE(specs,
2365169a0819Smrg	AS_HELP_STRING([--enable-specs],
2366169a0819Smrg	   [Enable building the specs (default: ]spec_default[)]),
2367169a0819Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
2368169a0819Smrgm4_undefine([spec_default])
2369169a0819SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2370169a0819SmrgAC_MSG_CHECKING([whether to build functional specifications])
2371169a0819SmrgAC_MSG_RESULT([$build_specs])
2372169a0819Smrg]) # XORG_ENABLE_SPECS
2373169a0819Smrg
23743544ea2eSmrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
23753544ea2eSmrg# ----------------------------------------------
23763544ea2eSmrg# Minimum version: 1.13.0
23773544ea2eSmrg#
23783544ea2eSmrg# This macro enables a builder to enable/disable unit testing
23793544ea2eSmrg# It makes no assumption about the test cases implementation
23803544ea2eSmrg# Test cases may or may not use Automake "Support for test suites"
23813544ea2eSmrg# They may or may not use the software utility library GLib
23823544ea2eSmrg#
23833544ea2eSmrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
23843544ea2eSmrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
23853544ea2eSmrg# The variable enable_unit_tests is used by other macros in this file.
23863544ea2eSmrg#
23873544ea2eSmrg# Interface to module:
23883544ea2eSmrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
23893544ea2eSmrg# enable_unit_tests:    used in configure.ac for additional configuration
23903544ea2eSmrg# --enable-unit-tests:	'yes' user instructs the module to build tests
23913544ea2eSmrg#			'no' user instructs the module not to build tests
23923544ea2eSmrg# parm1:		specify the default value, yes or no.
23933544ea2eSmrg#
23943544ea2eSmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
23953544ea2eSmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
23963544ea2eSmrgAC_BEFORE([$0], [XORG_LD_WRAP])
23973544ea2eSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
23983544ea2eSmrgm4_define([_defopt], m4_default([$1], [auto]))
23993544ea2eSmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
24003544ea2eSmrg	[Enable building unit test cases (default: ]_defopt[)]),
24013544ea2eSmrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
24023544ea2eSmrgm4_undefine([_defopt])
24033544ea2eSmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
24043544ea2eSmrgAC_MSG_CHECKING([whether to build unit test cases])
24053544ea2eSmrgAC_MSG_RESULT([$enable_unit_tests])
24063544ea2eSmrg]) # XORG_ENABLE_UNIT_TESTS
24073544ea2eSmrg
24083544ea2eSmrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
24093544ea2eSmrg# ------------------------------------------------------
24103544ea2eSmrg# Minimum version: 1.17.0
24113544ea2eSmrg#
24123544ea2eSmrg# This macro enables a builder to enable/disable integration testing
24133544ea2eSmrg# It makes no assumption about the test cases' implementation
24143544ea2eSmrg# Test cases may or may not use Automake "Support for test suites"
24153544ea2eSmrg#
24163544ea2eSmrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
24173544ea2eSmrg# usually requires less dependencies and may be built and run under less
24183544ea2eSmrg# stringent environments than integration tests.
24193544ea2eSmrg#
24203544ea2eSmrg# Interface to module:
24213544ea2eSmrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
24223544ea2eSmrg# enable_integration_tests:   used in configure.ac for additional configuration
24233544ea2eSmrg# --enable-integration-tests: 'yes' user instructs the module to build tests
24243544ea2eSmrg#                             'no' user instructs the module not to build tests
24253544ea2eSmrg# parm1:                      specify the default value, yes or no.
24263544ea2eSmrg#
24273544ea2eSmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
24283544ea2eSmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
24293544ea2eSmrgm4_define([_defopt], m4_default([$1], [auto]))
24303544ea2eSmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
24313544ea2eSmrg	[Enable building integration test cases (default: ]_defopt[)]),
24323544ea2eSmrg	[enable_integration_tests=$enableval],
24333544ea2eSmrg	[enable_integration_tests=]_defopt)
24343544ea2eSmrgm4_undefine([_defopt])
24353544ea2eSmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
24363544ea2eSmrg	[test "x$enable_integration_tests" != xno])
24373544ea2eSmrgAC_MSG_CHECKING([whether to build unit test cases])
24383544ea2eSmrgAC_MSG_RESULT([$enable_integration_tests])
24393544ea2eSmrg]) # XORG_ENABLE_INTEGRATION_TESTS
24403544ea2eSmrg
24413544ea2eSmrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
24423544ea2eSmrg# ----------------------------------------
24433544ea2eSmrg# Minimum version: 1.13.0
24443544ea2eSmrg#
24453544ea2eSmrg# GLib is a library which provides advanced data structures and functions.
24463544ea2eSmrg# This macro enables a module to test for the presence of Glib.
24473544ea2eSmrg#
24483544ea2eSmrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
24493544ea2eSmrg# Otherwise the value of $enable_unit_tests is blank.
24503544ea2eSmrg#
24513544ea2eSmrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
24523544ea2eSmrg# test support usually requires less dependencies and may be built and run under
24533544ea2eSmrg# less stringent environments than integration tests.
24543544ea2eSmrg#
24553544ea2eSmrg# Interface to module:
24563544ea2eSmrg# HAVE_GLIB: used in makefiles to conditionally build targets
24573544ea2eSmrg# with_glib: used in configure.ac to know if GLib has been found
24583544ea2eSmrg# --with-glib:	'yes' user instructs the module to use glib
24593544ea2eSmrg#		'no' user instructs the module not to use glib
24603544ea2eSmrg#
24613544ea2eSmrgAC_DEFUN([XORG_WITH_GLIB],[
24623544ea2eSmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
24633544ea2eSmrgm4_define([_defopt], m4_default([$2], [auto]))
24643544ea2eSmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
24653544ea2eSmrg	[Use GLib library for unit testing (default: ]_defopt[)]),
24663544ea2eSmrg	[with_glib=$withval], [with_glib=]_defopt)
24673544ea2eSmrgm4_undefine([_defopt])
24683544ea2eSmrg
24693544ea2eSmrghave_glib=no
24703544ea2eSmrg# Do not probe GLib if user explicitly disabled unit testing
24713544ea2eSmrgif test "x$enable_unit_tests" != x"no"; then
24723544ea2eSmrg  # Do not probe GLib if user explicitly disabled it
24733544ea2eSmrg  if test "x$with_glib" != x"no"; then
24743544ea2eSmrg    m4_ifval(
24753544ea2eSmrg      [$1],
24763544ea2eSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
24773544ea2eSmrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
24783544ea2eSmrg    )
24793544ea2eSmrg  fi
24803544ea2eSmrgfi
24813544ea2eSmrg
24823544ea2eSmrg# Not having GLib when unit testing has been explicitly requested is an error
24833544ea2eSmrgif test "x$enable_unit_tests" = x"yes"; then
24843544ea2eSmrg  if test "x$have_glib" = x"no"; then
24853544ea2eSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
24863544ea2eSmrg  fi
24873544ea2eSmrgfi
24883544ea2eSmrg
24893544ea2eSmrg# Having unit testing disabled when GLib has been explicitly requested is an error
24903544ea2eSmrgif test "x$enable_unit_tests" = x"no"; then
24913544ea2eSmrg  if test "x$with_glib" = x"yes"; then
24923544ea2eSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
24933544ea2eSmrg  fi
24943544ea2eSmrgfi
24953544ea2eSmrg
24963544ea2eSmrg# Not having GLib when it has been explicitly requested is an error
24973544ea2eSmrgif test "x$with_glib" = x"yes"; then
24983544ea2eSmrg  if test "x$have_glib" = x"no"; then
24993544ea2eSmrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
25003544ea2eSmrg  fi
25013544ea2eSmrgfi
25023544ea2eSmrg
25033544ea2eSmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
25043544ea2eSmrg]) # XORG_WITH_GLIB
25053544ea2eSmrg
25063544ea2eSmrg# XORG_LD_WRAP([required|optional])
25073544ea2eSmrg# ---------------------------------
25083544ea2eSmrg# Minimum version: 1.13.0
25093544ea2eSmrg#
25103544ea2eSmrg# Check if linker supports -wrap, passed via compiler flags
25113544ea2eSmrg#
25123544ea2eSmrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
25133544ea2eSmrg# Otherwise the value of $enable_unit_tests is blank.
25143544ea2eSmrg#
25153544ea2eSmrg# Argument added in 1.16.0 - default is "required", to match existing behavior
25163544ea2eSmrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
25173544ea2eSmrg# available, an argument of "optional" allows use when some unit tests require
25183544ea2eSmrg# ld -wrap and others do not.
25193544ea2eSmrg#
25203544ea2eSmrgAC_DEFUN([XORG_LD_WRAP],[
25213544ea2eSmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
25223544ea2eSmrg    [AC_LANG_PROGRAM([#include <stdlib.h>
25233544ea2eSmrg                      void __wrap_exit(int status) { return; }],
25243544ea2eSmrg                     [exit(0);])])
25253544ea2eSmrg# Not having ld wrap when unit testing has been explicitly requested is an error
25263544ea2eSmrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
25273544ea2eSmrg  if test "x$have_ld_wrap" = x"no"; then
25283544ea2eSmrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
25293544ea2eSmrg  fi
25303544ea2eSmrgfi
25313544ea2eSmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
25323544ea2eSmrg#
25333544ea2eSmrg]) # XORG_LD_WRAP
25343544ea2eSmrg
25353544ea2eSmrg# XORG_CHECK_LINKER_FLAGS
25363544ea2eSmrg# -----------------------
25373544ea2eSmrg# SYNOPSIS
25383544ea2eSmrg#
25393544ea2eSmrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
25403544ea2eSmrg#
25413544ea2eSmrg# DESCRIPTION
25423544ea2eSmrg#
25433544ea2eSmrg#   Check whether the given linker FLAGS work with the current language's
25443544ea2eSmrg#   linker, or whether they give an error.
25453544ea2eSmrg#
25463544ea2eSmrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
25473544ea2eSmrg#   success/failure.
25483544ea2eSmrg#
25493544ea2eSmrg#   PROGRAM-SOURCE is the program source to link with, if needed
25503544ea2eSmrg#
25513544ea2eSmrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
25523544ea2eSmrg#
25533544ea2eSmrg# LICENSE
25543544ea2eSmrg#
25553544ea2eSmrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
25563544ea2eSmrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
25573544ea2eSmrg#   Copyright (c) 2009 Matteo Frigo
25583544ea2eSmrg#
25593544ea2eSmrg#   This program is free software: you can redistribute it and/or modify it
25603544ea2eSmrg#   under the terms of the GNU General Public License as published by the
25613544ea2eSmrg#   Free Software Foundation, either version 3 of the License, or (at your
25623544ea2eSmrg#   option) any later version.
25633544ea2eSmrg#
25643544ea2eSmrg#   This program is distributed in the hope that it will be useful, but
25653544ea2eSmrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
25663544ea2eSmrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
25673544ea2eSmrg#   Public License for more details.
25683544ea2eSmrg#
25693544ea2eSmrg#   You should have received a copy of the GNU General Public License along
25703544ea2eSmrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
25713544ea2eSmrg#
25723544ea2eSmrg#   As a special exception, the respective Autoconf Macro's copyright owner
25733544ea2eSmrg#   gives unlimited permission to copy, distribute and modify the configure
25743544ea2eSmrg#   scripts that are the output of Autoconf when processing the Macro. You
25753544ea2eSmrg#   need not follow the terms of the GNU General Public License when using
25763544ea2eSmrg#   or distributing such scripts, even though portions of the text of the
25773544ea2eSmrg#   Macro appear in them. The GNU General Public License (GPL) does govern
25783544ea2eSmrg#   all other use of the material that constitutes the Autoconf Macro.
25793544ea2eSmrg#
25803544ea2eSmrg#   This special exception to the GPL applies to versions of the Autoconf
25813544ea2eSmrg#   Macro released by the Autoconf Archive. When you make and distribute a
25823544ea2eSmrg#   modified version of the Autoconf Macro, you may extend this special
25833544ea2eSmrg#   exception to the GPL to apply to your modified version as well.#
25843544ea2eSmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
25853544ea2eSmrg[AC_MSG_CHECKING([whether the linker accepts $1])
25863544ea2eSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
25873544ea2eSmrgAS_LITERAL_IF([$1],
25883544ea2eSmrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
25893544ea2eSmrg      ax_save_FLAGS=$LDFLAGS
25903544ea2eSmrg      LDFLAGS="$1"
25913544ea2eSmrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
25923544ea2eSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
25933544ea2eSmrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
25943544ea2eSmrg      LDFLAGS=$ax_save_FLAGS])],
25953544ea2eSmrg  [ax_save_FLAGS=$LDFLAGS
25963544ea2eSmrg   LDFLAGS="$1"
25973544ea2eSmrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
25983544ea2eSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
25993544ea2eSmrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
26003544ea2eSmrg   LDFLAGS=$ax_save_FLAGS])
26013544ea2eSmrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
26023544ea2eSmrgAC_MSG_RESULT($xorg_check_linker_flags)
26033544ea2eSmrgif test "x$xorg_check_linker_flags" = xyes; then
26043544ea2eSmrg	m4_default([$2], :)
26053544ea2eSmrgelse
26063544ea2eSmrg	m4_default([$3], :)
26073544ea2eSmrgfi
26083544ea2eSmrg]) # XORG_CHECK_LINKER_FLAGS
26093544ea2eSmrg
26103544ea2eSmrg# XORG_MEMORY_CHECK_FLAGS
26113544ea2eSmrg# -----------------------
26123544ea2eSmrg# Minimum version: 1.16.0
26133544ea2eSmrg#
26143544ea2eSmrg# This macro attempts to find appropriate memory checking functionality
26153544ea2eSmrg# for various platforms which unit testing code may use to catch various
26163544ea2eSmrg# forms of memory allocation and access errors in testing.
26173544ea2eSmrg#
26183544ea2eSmrg# Interface to module:
26193544ea2eSmrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
26203544ea2eSmrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
26213544ea2eSmrg#
26223544ea2eSmrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
26233544ea2eSmrg#
26243544ea2eSmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
26253544ea2eSmrg
26263544ea2eSmrgAC_REQUIRE([AC_CANONICAL_HOST])
26273544ea2eSmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
26283544ea2eSmrg           [Environment variables to enable memory checking in tests])
26293544ea2eSmrg
26303544ea2eSmrg# Check for different types of support on different platforms
26313544ea2eSmrgcase $host_os in
26323544ea2eSmrg    solaris*)
26333544ea2eSmrg        AC_CHECK_LIB([umem], [umem_alloc],
26343544ea2eSmrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
26353544ea2eSmrg        ;;
26363544ea2eSmrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
26373544ea2eSmrg        # both directly and inverted, so should not be 0 or 255.
26383544ea2eSmrg        malloc_debug_env='MALLOC_PERTURB_=15'
26393544ea2eSmrg        ;;
26403544ea2eSmrg    darwin*)
26413544ea2eSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
26423544ea2eSmrg        ;;
26433544ea2eSmrg    *bsd*)
26443544ea2eSmrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
26453544ea2eSmrg        ;;
26463544ea2eSmrgesac
26473544ea2eSmrg
26483544ea2eSmrg# User supplied flags override default flags
26493544ea2eSmrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
26503544ea2eSmrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
26513544ea2eSmrgfi
26523544ea2eSmrg
26533544ea2eSmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
26543544ea2eSmrg]) # XORG_WITH_LINT
26553544ea2eSmrg
265664ce7165Smrg# XORG_CHECK_MALLOC_ZERO
265764ce7165Smrg# ----------------------
265864ce7165Smrg# Minimum version: 1.0.0
265964ce7165Smrg#
266064ce7165Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
266164ce7165Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
266264ce7165Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
266364ce7165SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
266464ce7165SmrgAC_ARG_ENABLE(malloc0returnsnull,
2665fb23d3a8Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
266664ce7165Smrg		       [malloc(0) returns NULL (default: auto)]),
266764ce7165Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
266864ce7165Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
266964ce7165Smrg
267064ce7165SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
267164ce7165Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
267295fdd44cSmrgAC_CACHE_VAL([xorg_cv_malloc0_returns_null],
267395fdd44cSmrg	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
26743544ea2eSmrg#include <stdlib.h>
26753544ea2eSmrg],[
267664ce7165Smrg    char *m0, *r0, *c0, *p;
267764ce7165Smrg    m0 = malloc(0);
267864ce7165Smrg    p = malloc(10);
267964ce7165Smrg    r0 = realloc(p,0);
26803544ea2eSmrg    c0 = calloc(0,10);
26813544ea2eSmrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
26823544ea2eSmrg])],
268395fdd44cSmrg		[xorg_cv_malloc0_returns_null=yes],
268495fdd44cSmrg		[xorg_cv_malloc0_returns_null=no])])
268595fdd44cSmrgMALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
268664ce7165Smrgfi
268764ce7165SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
268864ce7165Smrg
268964ce7165Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
269064ce7165Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
269164ce7165Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
269264ce7165Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
269364ce7165Smrgelse
269464ce7165Smrg	MALLOC_ZERO_CFLAGS=""
269564ce7165Smrg	XMALLOC_ZERO_CFLAGS=""
269664ce7165Smrg	XTMALLOC_ZERO_CFLAGS=""
269764ce7165Smrgfi
269864ce7165Smrg
269964ce7165SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
270064ce7165SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
270164ce7165SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
270264ce7165Smrg]) # XORG_CHECK_MALLOC_ZERO
270364ce7165Smrg
270464ce7165Smrg# XORG_WITH_LINT()
270564ce7165Smrg# ----------------
270664ce7165Smrg# Minimum version: 1.1.0
270764ce7165Smrg#
2708169a0819Smrg# This macro enables the use of a tool that flags some suspicious and
2709169a0819Smrg# non-portable constructs (likely to be bugs) in C language source code.
2710169a0819Smrg# It will attempt to locate the tool and use appropriate options.
2711169a0819Smrg# There are various lint type tools on different platforms.
2712169a0819Smrg#
2713169a0819Smrg# Interface to module:
2714169a0819Smrg# LINT:		returns the path to the tool found on the platform
2715169a0819Smrg#		or the value set to LINT on the configure cmd line
2716169a0819Smrg#		also an Automake conditional
2717169a0819Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
2718169a0819Smrg#
2719169a0819Smrg# --with-lint:	'yes' user instructs the module to use lint
2720169a0819Smrg#		'no' user instructs the module not to use lint (default)
2721169a0819Smrg#
2722169a0819Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2723169a0819Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
272464ce7165Smrg#
272564ce7165SmrgAC_DEFUN([XORG_WITH_LINT],[
272664ce7165Smrg
2727169a0819SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
2728169a0819SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2729fb23d3a8SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
273064ce7165Smrg		[Use a lint-style source code checker (default: disabled)])],
273164ce7165Smrg		[use_lint=$withval], [use_lint=no])
2732169a0819Smrg
2733169a0819Smrg# Obtain platform specific info like program name and options
2734169a0819Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2735169a0819Smrgcase $host_os in
2736169a0819Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2737169a0819Smrg	lint_name=splint
2738169a0819Smrg	lint_options="-badflag"
2739169a0819Smrg	;;
2740169a0819Smrg  *freebsd* | *netbsd*)
2741169a0819Smrg	lint_name=lint
2742169a0819Smrg	lint_options="-u -b"
2743169a0819Smrg	;;
2744169a0819Smrg  *solaris*)
2745169a0819Smrg	lint_name=lint
2746169a0819Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2747169a0819Smrg	;;
2748169a0819Smrgesac
2749169a0819Smrg
2750169a0819Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
2751169a0819Smrgif test "x$use_lint" = x"yes" ; then
2752169a0819Smrg   AC_PATH_PROG([LINT], [$lint_name])
2753169a0819Smrg   if test "x$LINT" = "x"; then
2754169a0819Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2755169a0819Smrg   fi
2756169a0819Smrgelif test "x$use_lint" = x"no" ; then
2757169a0819Smrg   if test "x$LINT" != "x"; then
2758169a0819Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2759169a0819Smrg   fi
276064ce7165Smrgelse
2761169a0819Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
276264ce7165Smrgfi
2763169a0819Smrg
2764169a0819Smrg# User supplied flags override default flags
2765169a0819Smrgif test "x$LINT_FLAGS" != "x"; then
2766169a0819Smrg   lint_options=$LINT_FLAGS
276764ce7165Smrgfi
276864ce7165Smrg
2769169a0819SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
2770169a0819SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
277164ce7165Smrg
277264ce7165Smrg]) # XORG_WITH_LINT
277364ce7165Smrg
277464ce7165Smrg# XORG_LINT_LIBRARY(LIBNAME)
277564ce7165Smrg# --------------------------
277664ce7165Smrg# Minimum version: 1.1.0
277764ce7165Smrg#
277864ce7165Smrg# Sets up flags for building lint libraries for checking programs that call
277964ce7165Smrg# functions in the library.
278064ce7165Smrg#
2781169a0819Smrg# Interface to module:
2782169a0819Smrg# LINTLIB		- Automake variable with the name of lint library file to make
2783169a0819Smrg# MAKE_LINT_LIB		- Automake conditional
2784169a0819Smrg#
2785169a0819Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2786169a0819Smrg#			  - 'no' user instructs the module not to create a lint library (default)
278764ce7165Smrg
278864ce7165SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
278964ce7165SmrgAC_REQUIRE([XORG_WITH_LINT])
2790fb23d3a8SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
279164ce7165Smrg	[Create lint library (default: disabled)])],
279264ce7165Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2793169a0819Smrg
2794169a0819Smrgif test "x$make_lint_lib" = x"yes" ; then
2795169a0819Smrg   LINTLIB=llib-l$1.ln
2796169a0819Smrg   if test "x$LINT" = "x"; then
2797169a0819Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2798169a0819Smrg   fi
2799169a0819Smrgelif test "x$make_lint_lib" != x"no" ; then
2800169a0819Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
280164ce7165Smrgfi
2802169a0819Smrg
280364ce7165SmrgAC_SUBST(LINTLIB)
280464ce7165SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
280564ce7165Smrg
280664ce7165Smrg]) # XORG_LINT_LIBRARY
280764ce7165Smrg
28083544ea2eSmrg# XORG_COMPILER_BRAND
28093544ea2eSmrg# -------------------
28103544ea2eSmrg# Minimum version: 1.14.0
28113544ea2eSmrg#
28123544ea2eSmrg# Checks for various brands of compilers and sets flags as appropriate:
28133544ea2eSmrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
28143544ea2eSmrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
28153544ea2eSmrg#   clang compiler - sets CLANGCC to "yes"
28163544ea2eSmrg#   Intel compiler - sets INTELCC to "yes"
28173544ea2eSmrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
28183544ea2eSmrg#
28193544ea2eSmrgAC_DEFUN([XORG_COMPILER_BRAND], [
28203544ea2eSmrgAC_LANG_CASE(
28213544ea2eSmrg	[C], [
28223544ea2eSmrg		AC_REQUIRE([AC_PROG_CC_C99])
28233544ea2eSmrg	],
28243544ea2eSmrg	[C++], [
28253544ea2eSmrg		AC_REQUIRE([AC_PROG_CXX])
28263544ea2eSmrg	]
28273544ea2eSmrg)
28283544ea2eSmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
28293544ea2eSmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
28303544ea2eSmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
28313544ea2eSmrg]) # XORG_COMPILER_BRAND
28323544ea2eSmrg
28333544ea2eSmrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
28343544ea2eSmrg# ---------------
28353544ea2eSmrg# Minimum version: 1.16.0
28363544ea2eSmrg#
28373544ea2eSmrg# Test if the compiler works when passed the given flag as a command line argument.
28383544ea2eSmrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
28393544ea2eSmrg# next flag in the list until there are no more options.
28403544ea2eSmrg#
28413544ea2eSmrg# Note that this does not guarantee that the compiler supports the flag as some
28423544ea2eSmrg# compilers will simply ignore arguments that they do not understand, but we do
28433544ea2eSmrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
28443544ea2eSmrg# -Werror=unused-command-line-argument
28453544ea2eSmrg#
28463544ea2eSmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
28473544ea2eSmrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
28483544ea2eSmrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
28493544ea2eSmrg
28503544ea2eSmrgAC_LANG_COMPILER_REQUIRE
28513544ea2eSmrg
28523544ea2eSmrgAC_LANG_CASE(
28533544ea2eSmrg	[C], [
28543544ea2eSmrg		AC_REQUIRE([AC_PROG_CC_C99])
28553544ea2eSmrg		define([PREFIX], [C])
28563544ea2eSmrg		define([CACHE_PREFIX], [cc])
28573544ea2eSmrg		define([COMPILER], [$CC])
28583544ea2eSmrg	],
28593544ea2eSmrg	[C++], [
28603544ea2eSmrg		define([PREFIX], [CXX])
28613544ea2eSmrg		define([CACHE_PREFIX], [cxx])
28623544ea2eSmrg		define([COMPILER], [$CXX])
28633544ea2eSmrg	]
28643544ea2eSmrg)
28653544ea2eSmrg
28663544ea2eSmrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
28673544ea2eSmrg
28683544ea2eSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
28693544ea2eSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28703544ea2eSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
28713544ea2eSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
28723544ea2eSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
28733544ea2eSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
28743544ea2eSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
28753544ea2eSmrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
28763544ea2eSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
28773544ea2eSmrgfi
28783544ea2eSmrg
28793544ea2eSmrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
28803544ea2eSmrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
28813544ea2eSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28823544ea2eSmrg	fi
28833544ea2eSmrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
28843544ea2eSmrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
28853544ea2eSmrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
28863544ea2eSmrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
28873544ea2eSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
28883544ea2eSmrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
28893544ea2eSmrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
28903544ea2eSmrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
28913544ea2eSmrgfi
28923544ea2eSmrg
28933544ea2eSmrgfound="no"
28943544ea2eSmrgm4_foreach([flag], m4_cdr($@), [
28953544ea2eSmrg	if test $found = "no" ; then
289695fdd44cSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
28973544ea2eSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28983544ea2eSmrg		fi
28993544ea2eSmrg
290095fdd44cSmrg		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
29013544ea2eSmrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
29023544ea2eSmrg		fi
29033544ea2eSmrg
29043544ea2eSmrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
29053544ea2eSmrg
29063544ea2eSmrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
290781440437Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
29083544ea2eSmrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
29093544ea2eSmrg		AC_CACHE_VAL($cacheid,
29103544ea2eSmrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
29113544ea2eSmrg					     [eval $cacheid=yes],
29123544ea2eSmrg					     [eval $cacheid=no])])
29133544ea2eSmrg
29143544ea2eSmrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
29153544ea2eSmrg
29163544ea2eSmrg		eval supported=\$$cacheid
29173544ea2eSmrg		AC_MSG_RESULT([$supported])
29183544ea2eSmrg		if test "$supported" = "yes" ; then
29193544ea2eSmrg			$1="$$1 ]flag["
29203544ea2eSmrg			found="yes"
29213544ea2eSmrg		fi
29223544ea2eSmrg	fi
29233544ea2eSmrg])
29243544ea2eSmrg]) # XORG_TESTSET_CFLAG
29253544ea2eSmrg
29263544ea2eSmrg# XORG_COMPILER_FLAGS
29273544ea2eSmrg# ---------------
29283544ea2eSmrg# Minimum version: 1.16.0
29293544ea2eSmrg#
29303544ea2eSmrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
29313544ea2eSmrg# arguments supported by the selected compiler which do NOT alter the generated
29323544ea2eSmrg# code.  These arguments will cause the compiler to print various warnings
29333544ea2eSmrg# during compilation AND turn a conservative set of warnings into errors.
29343544ea2eSmrg#
29353544ea2eSmrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
29363544ea2eSmrg# future versions of util-macros as options are added to new compilers.
29373544ea2eSmrg#
29383544ea2eSmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
29393544ea2eSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
29403544ea2eSmrg
29413544ea2eSmrgAC_ARG_ENABLE(selective-werror,
29423544ea2eSmrg              AS_HELP_STRING([--disable-selective-werror],
29433544ea2eSmrg                             [Turn off selective compiler errors. (default: enabled)]),
29443544ea2eSmrg              [SELECTIVE_WERROR=$enableval],
29453544ea2eSmrg              [SELECTIVE_WERROR=yes])
29463544ea2eSmrg
29473544ea2eSmrgAC_LANG_CASE(
29483544ea2eSmrg        [C], [
29493544ea2eSmrg                define([PREFIX], [C])
29503544ea2eSmrg        ],
29513544ea2eSmrg        [C++], [
29523544ea2eSmrg                define([PREFIX], [CXX])
29533544ea2eSmrg        ]
29543544ea2eSmrg)
29553544ea2eSmrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
29563544ea2eSmrgif test "x$SUNCC" = "xyes"; then
29573544ea2eSmrg    [BASE_]PREFIX[FLAGS]="-v"
29583544ea2eSmrgelse
29593544ea2eSmrg    [BASE_]PREFIX[FLAGS]=""
29603544ea2eSmrgfi
29613544ea2eSmrg
29623544ea2eSmrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
29633544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
29643544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
29653544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
29663544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
29673544ea2eSmrg
29683544ea2eSmrgAC_LANG_CASE(
29693544ea2eSmrg	[C], [
29703544ea2eSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
29713544ea2eSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
29723544ea2eSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
29733544ea2eSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
297495fdd44cSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
29753544ea2eSmrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
29763544ea2eSmrg	]
29773544ea2eSmrg)
29783544ea2eSmrg
29793544ea2eSmrg# This chunk adds additional warnings that could catch undesired effects.
29803544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
29813544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
29823544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
29833544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
29843544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
29853544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
298695fdd44cSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
29873544ea2eSmrg
29883544ea2eSmrg# These are currently disabled because they are noisy.  They will be enabled
29893544ea2eSmrg# in the future once the codebase is sufficiently modernized to silence
29903544ea2eSmrg# them.  For now, I don't want them to drown out the other warnings.
29913544ea2eSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
29923544ea2eSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
299395fdd44cSmrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
29943544ea2eSmrg
29953544ea2eSmrg# Turn some warnings into errors, so we don't accidently get successful builds
29963544ea2eSmrg# when there are problems that should be fixed.
29973544ea2eSmrg
29983544ea2eSmrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
29993544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
30003544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
30013544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
30023544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
30033544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
30043544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
30053544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
30063544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
30073544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
30083544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
30093544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
30103544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
30113544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
30123544ea2eSmrgelse
30133544ea2eSmrgAC_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])
30143544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
30153544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
30163544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
30173544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
30183544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
30193544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
30203544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
30213544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
30223544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
30233544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
30243544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
30253544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
30263544ea2eSmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
30273544ea2eSmrgfi
30283544ea2eSmrg
30293544ea2eSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
30303544ea2eSmrg]) # XORG_COMPILER_FLAGS
30313544ea2eSmrg
3032fb23d3a8Smrg# XORG_CWARNFLAGS
3033fb23d3a8Smrg# ---------------
3034fb23d3a8Smrg# Minimum version: 1.2.0
30353544ea2eSmrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3036fb23d3a8Smrg#
3037fb23d3a8Smrg# Defines CWARNFLAGS to enable C compiler warnings.
3038fb23d3a8Smrg#
30393544ea2eSmrg# This function is deprecated because it defines -fno-strict-aliasing
30403544ea2eSmrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
30413544ea2eSmrg# is needed, then it should be added explicitly in the module when
30423544ea2eSmrg# it is updated to use BASE_CFLAGS.
30433544ea2eSmrg#
3044fb23d3a8SmrgAC_DEFUN([XORG_CWARNFLAGS], [
30453544ea2eSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
30463544ea2eSmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30473544ea2eSmrgAC_LANG_CASE(
30483544ea2eSmrg	[C], [
30493544ea2eSmrg		CWARNFLAGS="$BASE_CFLAGS"
30503544ea2eSmrg		if  test "x$GCC" = xyes ; then
30513544ea2eSmrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
30523544ea2eSmrg		fi
30533544ea2eSmrg		AC_SUBST(CWARNFLAGS)
30543544ea2eSmrg	]
30553544ea2eSmrg)
3056fb23d3a8Smrg]) # XORG_CWARNFLAGS
3057fb23d3a8Smrg
3058fb23d3a8Smrg# XORG_STRICT_OPTION
3059fb23d3a8Smrg# -----------------------
3060fb23d3a8Smrg# Minimum version: 1.3.0
3061fb23d3a8Smrg#
30623544ea2eSmrg# Add configure option to enable strict compilation flags, such as treating
30633544ea2eSmrg# warnings as fatal errors.
30643544ea2eSmrg# If --enable-strict-compilation is passed to configure, adds strict flags to
30653544ea2eSmrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
30663544ea2eSmrg#
30673544ea2eSmrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
30683544ea2eSmrg# when strict compilation is unconditionally desired.
3069fb23d3a8SmrgAC_DEFUN([XORG_STRICT_OPTION], [
3070fb23d3a8SmrgAC_REQUIRE([XORG_CWARNFLAGS])
30713544ea2eSmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
3072fb23d3a8Smrg
3073fb23d3a8SmrgAC_ARG_ENABLE(strict-compilation,
3074fb23d3a8Smrg			  AS_HELP_STRING([--enable-strict-compilation],
3075fb23d3a8Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3076fb23d3a8Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
30773544ea2eSmrg
30783544ea2eSmrgAC_LANG_CASE(
30793544ea2eSmrg        [C], [
30803544ea2eSmrg                define([PREFIX], [C])
30813544ea2eSmrg        ],
30823544ea2eSmrg        [C++], [
30833544ea2eSmrg                define([PREFIX], [CXX])
30843544ea2eSmrg        ]
30853544ea2eSmrg)
30863544ea2eSmrg
30873544ea2eSmrg[STRICT_]PREFIX[FLAGS]=""
30883544ea2eSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
30893544ea2eSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
30903544ea2eSmrg
30913544ea2eSmrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
30923544ea2eSmrg# activate it with -Werror, so we add it here explicitly.
30933544ea2eSmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
30943544ea2eSmrg
3095fb23d3a8Smrgif test "x$STRICT_COMPILE" = "xyes"; then
30963544ea2eSmrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
30973544ea2eSmrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3098fb23d3a8Smrgfi
30993544ea2eSmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
31003544ea2eSmrgAC_SUBST([BASE_]PREFIX[FLAGS])
31013544ea2eSmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3102fb23d3a8Smrg]) # XORG_STRICT_OPTION
3103fb23d3a8Smrg
3104fb23d3a8Smrg# XORG_DEFAULT_OPTIONS
3105fb23d3a8Smrg# --------------------
3106fb23d3a8Smrg# Minimum version: 1.3.0
3107fb23d3a8Smrg#
3108fb23d3a8Smrg# Defines default options for X.Org modules.
3109fb23d3a8Smrg#
3110fb23d3a8SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
3111169a0819SmrgAC_REQUIRE([AC_PROG_INSTALL])
31123544ea2eSmrgXORG_COMPILER_FLAGS
3113fb23d3a8SmrgXORG_CWARNFLAGS
3114fb23d3a8SmrgXORG_STRICT_OPTION
3115fb23d3a8SmrgXORG_RELEASE_VERSION
3116fb23d3a8SmrgXORG_CHANGELOG
3117169a0819SmrgXORG_INSTALL
3118fb23d3a8SmrgXORG_MANPAGE_SECTIONS
3119169a0819Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3120169a0819Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3121fb23d3a8Smrg]) # XORG_DEFAULT_OPTIONS
3122169a0819Smrg
3123169a0819Smrg# XORG_INSTALL()
3124169a0819Smrg# ----------------
3125169a0819Smrg# Minimum version: 1.4.0
3126169a0819Smrg#
3127169a0819Smrg# Defines the variable INSTALL_CMD as the command to copy
3128169a0819Smrg# INSTALL from $prefix/share/util-macros.
3129169a0819Smrg#
3130169a0819SmrgAC_DEFUN([XORG_INSTALL], [
3131169a0819SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
3132169a0819Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3133169a0819SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3134169a0819Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3135169a0819Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
3136169a0819Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
3137169a0819SmrgAC_SUBST([INSTALL_CMD])
3138169a0819Smrg]) # XORG_INSTALL
313964ce7165Smrgdnl Copyright 2005 Red Hat, Inc
314064ce7165Smrgdnl
314164ce7165Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
314264ce7165Smrgdnl documentation for any purpose is hereby granted without fee, provided that
314364ce7165Smrgdnl the above copyright notice appear in all copies and that both that
314464ce7165Smrgdnl copyright notice and this permission notice appear in supporting
314564ce7165Smrgdnl documentation.
314664ce7165Smrgdnl
314764ce7165Smrgdnl The above copyright notice and this permission notice shall be included
314864ce7165Smrgdnl in all copies or substantial portions of the Software.
314964ce7165Smrgdnl
315064ce7165Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
315164ce7165Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
315264ce7165Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
315364ce7165Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
315464ce7165Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
315564ce7165Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
315664ce7165Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
315764ce7165Smrgdnl
315864ce7165Smrgdnl Except as contained in this notice, the name of the copyright holders shall
315964ce7165Smrgdnl not be used in advertising or otherwise to promote the sale, use or
316064ce7165Smrgdnl other dealings in this Software without prior written authorization
316164ce7165Smrgdnl from the copyright holders.
316264ce7165Smrgdnl
316364ce7165Smrg
316464ce7165Smrg# XORG_RELEASE_VERSION
316564ce7165Smrg# --------------------
3166169a0819Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
316795fdd44cSmrg
316864ce7165SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
316964ce7165Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
317064ce7165Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
317164ce7165Smrg		[Major version of this package])
3172fb23d3a8Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
317364ce7165Smrg	if test "x$PVM" = "x"; then
317464ce7165Smrg		PVM="0"
317564ce7165Smrg	fi
317664ce7165Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
317764ce7165Smrg		[$PVM],
317864ce7165Smrg		[Minor version of this package])
3179fb23d3a8Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
318064ce7165Smrg	if test "x$PVP" = "x"; then
318164ce7165Smrg		PVP="0"
318264ce7165Smrg	fi
318364ce7165Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
318464ce7165Smrg		[$PVP],
318564ce7165Smrg		[Patch version of this package])
318664ce7165Smrg])
318764ce7165Smrg
3188fb23d3a8Smrg# XORG_CHANGELOG()
3189fb23d3a8Smrg# ----------------
3190fb23d3a8Smrg# Minimum version: 1.2.0
3191fb23d3a8Smrg#
3192fb23d3a8Smrg# Defines the variable CHANGELOG_CMD as the command to generate
3193fb23d3a8Smrg# ChangeLog from git.
3194fb23d3a8Smrg#
3195fb23d3a8Smrg#
3196fb23d3a8SmrgAC_DEFUN([XORG_CHANGELOG], [
3197169a0819SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
3198169a0819Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3199169a0819Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
3200fb23d3a8Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
3201fb23d3a8SmrgAC_SUBST([CHANGELOG_CMD])
3202fb23d3a8Smrg]) # XORG_CHANGELOG
3203fb23d3a8Smrg
320464ce7165Smrgdnl
32053544ea2eSmrgdnl Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
3206169a0819Smrgdnl
3207169a0819Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
3208169a0819Smrgdnl copy of this software and associated documentation files (the "Software"),
3209169a0819Smrgdnl to deal in the Software without restriction, including without limitation
3210169a0819Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
3211169a0819Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
3212169a0819Smrgdnl Software is furnished to do so, subject to the following conditions:
3213169a0819Smrgdnl
3214169a0819Smrgdnl The above copyright notice and this permission notice (including the next
3215169a0819Smrgdnl paragraph) shall be included in all copies or substantial portions of the
3216169a0819Smrgdnl Software.
3217169a0819Smrgdnl
3218169a0819Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3219169a0819Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3220169a0819Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3221169a0819Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3222169a0819Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3223169a0819Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3224169a0819Smrgdnl DEALINGS IN THE SOFTWARE.
32253544ea2eSmrgdnl
322664ce7165Smrg
322764ce7165Smrg# XTRANS_TCP_FLAGS()
322864ce7165Smrg# ------------------
322964ce7165Smrg# Find needed libraries for TCP sockets, and check for IPv6 support
323064ce7165SmrgAC_DEFUN([XTRANS_TCP_FLAGS],[
323164ce7165Smrg # SVR4 hides these in libraries other than libc
323264ce7165Smrg AC_SEARCH_LIBS(socket, [socket])
323364ce7165Smrg AC_SEARCH_LIBS(gethostbyname, [nsl])
3234169a0819Smrg if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
323595fdd44cSmrg   AC_CHECK_LIB([ws2_32],[main])
3236169a0819Smrg fi
323764ce7165Smrg
323864ce7165Smrg # Needs to come after above checks for libsocket & libnsl for SVR4 systems
32393544ea2eSmrg AC_ARG_ENABLE(ipv6,
324095fdd44cSmrg	AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
32413544ea2eSmrg	[IPV6CONN=$enableval],
324264ce7165Smrg	[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
324364ce7165Smrg AC_MSG_CHECKING([if IPv6 support should be built])
324464ce7165Smrg if test "$IPV6CONN" = "yes"; then
324564ce7165Smrg	AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections])
324664ce7165Smrg fi
324764ce7165Smrg AC_MSG_RESULT($IPV6CONN)
324864ce7165Smrg
324964ce7165Smrg # 4.3BSD-Reno added a new member to struct sockaddr_in
32503544ea2eSmrg AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
325164ce7165Smrg	AC_DEFINE([BSD44SOCKETS],1,
325264ce7165Smrg 	    [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [
325364ce7165Smrg#include <sys/types.h>
325464ce7165Smrg#include <sys/socket.h>
325564ce7165Smrg#include <netinet/in.h>
325664ce7165Smrg ])
3257fb23d3a8Smrg
3258fb23d3a8Smrg # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc.
3259fb23d3a8Smrg AC_CHECK_TYPES([socklen_t], [], [], [
3260fb23d3a8SmrgAC_INCLUDES_DEFAULT
3261fb23d3a8Smrg#include <sys/socket.h>])
32623544ea2eSmrg
326395fdd44cSmrg # XPG4v2/UNIX95 added msg_control - check to see if we need to define
326495fdd44cSmrg # _XOPEN_SOURCE to get it (such as on Solaris)
326595fdd44cSmrg AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
326695fdd44cSmrg                 [
326795fdd44cSmrgAC_INCLUDES_DEFAULT
326895fdd44cSmrg#include <sys/socket.h>
326995fdd44cSmrg                 ])
327095fdd44cSmrg # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
327195fdd44cSmrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
327295fdd44cSmrg     unset ac_cv_member_struct_msghdr_msg_control
327395fdd44cSmrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
327495fdd44cSmrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
327595fdd44cSmrg                     [AC_DEFINE([_XOPEN_SOURCE], [600],
327695fdd44cSmrg                       [Defined if needed to expose struct msghdr.msg_control])
327795fdd44cSmrg                     ], [], [
327895fdd44cSmrg#define _XOPEN_SOURCE 600
327995fdd44cSmrgAC_INCLUDES_DEFAULT
328095fdd44cSmrg#include <sys/socket.h>
328195fdd44cSmrg                     ])
328295fdd44cSmrg fi
328395fdd44cSmrg # If that didn't work, fall back to XPG5/UNIX98 with C89
328495fdd44cSmrg if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
328595fdd44cSmrg     unset ac_cv_member_struct_msghdr_msg_control
328695fdd44cSmrg     AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
328795fdd44cSmrg     AC_CHECK_MEMBER([struct msghdr.msg_control],
328895fdd44cSmrg                     [AC_DEFINE([_XOPEN_SOURCE], [500],
328995fdd44cSmrg                       [Defined if needed to expose struct msghdr.msg_control])
329095fdd44cSmrg                     ], [], [
329195fdd44cSmrg#define _XOPEN_SOURCE 500
329295fdd44cSmrgAC_INCLUDES_DEFAULT
329395fdd44cSmrg#include <sys/socket.h>
329495fdd44cSmrg                     ])
329595fdd44cSmrg fi
329695fdd44cSmrg
329795fdd44cSmrg
329864ce7165Smrg]) # XTRANS_TCP_FLAGS
329964ce7165Smrg
330064ce7165Smrg# XTRANS_CONNECTION_FLAGS()
330164ce7165Smrg# -------------------------
330264ce7165Smrg# Standard checks for which Xtrans transports to use by the Xorg packages
330364ce7165Smrg# that use Xtrans functions
330464ce7165SmrgAC_DEFUN([XTRANS_CONNECTION_FLAGS],[
330564ce7165Smrg AC_REQUIRE([AC_CANONICAL_HOST])
3306fb23d3a8Smrg [case $host_os in
3307fb23d3a8Smrg	mingw*)	unixdef="no"   ;;
3308fb23d3a8Smrg	*)	unixdef="yes"  ;;
3309fb23d3a8Smrg esac]
331064ce7165Smrg AC_ARG_ENABLE(unix-transport,
331195fdd44cSmrg	AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]),
3312fb23d3a8Smrg	[UNIXCONN=$enableval], [UNIXCONN=$unixdef])
331364ce7165Smrg AC_MSG_CHECKING([if Xtrans should support UNIX socket connections])
331464ce7165Smrg if test "$UNIXCONN" = "yes"; then
331564ce7165Smrg	AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections])
331664ce7165Smrg fi
331764ce7165Smrg AC_MSG_RESULT($UNIXCONN)
33183544ea2eSmrg AC_ARG_ENABLE(tcp-transport,
331995fdd44cSmrg	AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]),
3320fb23d3a8Smrg	[TCPCONN=$enableval], [TCPCONN=yes])
332164ce7165Smrg AC_MSG_CHECKING([if Xtrans should support TCP socket connections])
332264ce7165Smrg AC_MSG_RESULT($TCPCONN)
332364ce7165Smrg if test "$TCPCONN" = "yes"; then
332464ce7165Smrg	AC_DEFINE(TCPCONN,1,[Support TCP socket connections])
332564ce7165Smrg	XTRANS_TCP_FLAGS
332664ce7165Smrg fi
332764ce7165Smrg [case $host_os in
332864ce7165Smrg	solaris*|sco*|sysv4*)	localdef="yes" ;;
332964ce7165Smrg	*)			localdef="no"  ;;
333064ce7165Smrg esac]
333164ce7165Smrg AC_ARG_ENABLE(local-transport,
333295fdd44cSmrg	AS_HELP_STRING([--enable-local-transport],[Enable os-specific local transport]),
333364ce7165Smrg	[LOCALCONN=$enableval], [LOCALCONN=$localdef])
333464ce7165Smrg AC_MSG_CHECKING([if Xtrans should support os-specific local connections])
333564ce7165Smrg AC_MSG_RESULT($LOCALCONN)
333664ce7165Smrg if test "$LOCALCONN" = "yes"; then
333764ce7165Smrg	AC_DEFINE(LOCALCONN,1,[Support os-specific local connections])
333864ce7165Smrg fi
33393544ea2eSmrg
334064ce7165Smrg]) # XTRANS_CONNECTION_FLAGS
334164ce7165Smrg
334264ce7165Smrg
334364ce7165Smrg# XTRANS_SECURE_RPC_FLAGS()
334464ce7165Smrg# -------------------------
334564ce7165Smrg# Check for Secure RPC functions - must come after XTRANS_TCP_FLAGS
334664ce7165Smrg# so that any necessary networking libraries are already found
334764ce7165SmrgAC_DEFUN([XTRANS_SECURE_RPC_FLAGS],
334864ce7165Smrg[AC_REQUIRE([XTRANS_TCP_FLAGS])
33493544ea2eSmrg AC_ARG_ENABLE(secure-rpc,
335095fdd44cSmrg	AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]),
335164ce7165Smrg        [SECURE_RPC=$enableval], [SECURE_RPC="try"])
335264ce7165Smrg
335364ce7165Smrg if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then
335464ce7165Smrg	FOUND_SECURE_RPC="no"
335564ce7165Smrg	AC_CHECK_FUNCS([authdes_seccreate authdes_create],
335664ce7165Smrg			[FOUND_SECURE_RPC="yes"])
335764ce7165Smrg	if test "x$FOUND_SECURE_RPC" = "xno" ; then
335864ce7165Smrg		if test "x$SECURE_RPC" = "xyes" ; then
335964ce7165Smrg	AC_MSG_ERROR([Secure RPC requested, but required functions not found])
33603544ea2eSmrg		fi
336164ce7165Smrg		SECURE_RPC="no"
336264ce7165Smrg	else
336364ce7165Smrg		dnl FreeBSD keeps getsecretkey in librpcsvc
336464ce7165Smrg		AC_SEARCH_LIBS(getsecretkey, [rpcsvc])
336564ce7165Smrg		SECURE_RPC="yes"
336664ce7165Smrg	fi
336764ce7165Smrg fi
336864ce7165Smrg AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported])
336964ce7165Smrg if test "x$SECURE_RPC" = "xyes" ; then
337064ce7165Smrg	AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients])
337164ce7165Smrg fi
337264ce7165Smrg AC_MSG_RESULT($SECURE_RPC)
337364ce7165Smrg]) # XTRANS_SECURE_RPC_FLAGS
337464ce7165Smrg
337564ce7165Smrg
3376