1dbe7da2eSmrg# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
2a8fdb4bcSmrg
3a8fdb4bcSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4dbe7da2eSmrg# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
5a8fdb4bcSmrg# This file is free software; the Free Software Foundation
6a8fdb4bcSmrg# gives unlimited permission to copy and/or distribute it,
7a8fdb4bcSmrg# with or without modifications, as long as this notice is preserved.
8a8fdb4bcSmrg
9a8fdb4bcSmrg# This program is distributed in the hope that it will be useful,
10a8fdb4bcSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11a8fdb4bcSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12a8fdb4bcSmrg# PARTICULAR PURPOSE.
13a8fdb4bcSmrg
14a8fdb4bcSmrgm4_ifndef([AC_AUTOCONF_VERSION],
15a8fdb4bcSmrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
1677683534Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
1777683534Smrg[m4_warning([this file was generated for autoconf 2.68.
18a8fdb4bcSmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
19a8fdb4bcSmrgIf you have problems, you may need to regenerate the build system entirely.
20a8fdb4bcSmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
21a8fdb4bcSmrg
2277683534Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
23a8fdb4bcSmrg#
2477683534Smrg# This file is free software; the Free Software Foundation
2577683534Smrg# gives unlimited permission to copy and/or distribute it,
2677683534Smrg# with or without modifications, as long as this notice is preserved.
27a8fdb4bcSmrg
2877683534Smrg# AM_AUTOMAKE_VERSION(VERSION)
2977683534Smrg# ----------------------------
3077683534Smrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
3177683534Smrg# generated from the m4 files accompanying Automake X.Y.
3277683534Smrg# (This private macro should not be called outside this file.)
3377683534SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3477683534Smrg[am__api_version='1.11'
3577683534Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3677683534Smrgdnl require some minimum version.  Point them to the right macro.
3777683534Smrgm4_if([$1], [1.11.1], [],
3877683534Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
3977683534Smrg])
40a8fdb4bcSmrg
4177683534Smrg# _AM_AUTOCONF_VERSION(VERSION)
4277683534Smrg# -----------------------------
4377683534Smrg# aclocal traces this macro to find the Autoconf version.
4477683534Smrg# This is a private macro too.  Using m4_define simplifies
4577683534Smrg# the logic in aclocal, which can simply ignore this definition.
4677683534Smrgm4_define([_AM_AUTOCONF_VERSION], [])
47a8fdb4bcSmrg
4877683534Smrg# AM_SET_CURRENT_AUTOMAKE_VERSION
4977683534Smrg# -------------------------------
5077683534Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5177683534Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5277683534SmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
5377683534Smrg[AM_AUTOMAKE_VERSION([1.11.1])dnl
5477683534Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5577683534Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5677683534Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
57a8fdb4bcSmrg
5877683534Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
59a8fdb4bcSmrg
6077683534Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
6177683534Smrg#
6277683534Smrg# This file is free software; the Free Software Foundation
6377683534Smrg# gives unlimited permission to copy and/or distribute it,
6477683534Smrg# with or without modifications, as long as this notice is preserved.
65a8fdb4bcSmrg
6677683534Smrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
6777683534Smrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
6877683534Smrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
6977683534Smrg#
7077683534Smrg# Of course, Automake must honor this variable whenever it calls a
7177683534Smrg# tool from the auxiliary directory.  The problem is that $srcdir (and
7277683534Smrg# therefore $ac_aux_dir as well) can be either absolute or relative,
7377683534Smrg# depending on how configure is run.  This is pretty annoying, since
7477683534Smrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
7577683534Smrg# source directory, any form will work fine, but in subdirectories a
7677683534Smrg# relative path needs to be adjusted first.
77a8fdb4bcSmrg#
7877683534Smrg# $ac_aux_dir/missing
7977683534Smrg#    fails when called from a subdirectory if $ac_aux_dir is relative
8077683534Smrg# $top_srcdir/$ac_aux_dir/missing
8177683534Smrg#    fails if $ac_aux_dir is absolute,
8277683534Smrg#    fails when called from a subdirectory in a VPATH build with
8377683534Smrg#          a relative $ac_aux_dir
84a8fdb4bcSmrg#
8577683534Smrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
8677683534Smrg# are both prefixed by $srcdir.  In an in-source build this is usually
8777683534Smrg# harmless because $srcdir is `.', but things will broke when you
8877683534Smrg# start a VPATH build or use an absolute $srcdir.
89a8fdb4bcSmrg#
9077683534Smrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
9177683534Smrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
9277683534Smrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
9377683534Smrg# and then we would define $MISSING as
9477683534Smrg#   MISSING="\${SHELL} $am_aux_dir/missing"
9577683534Smrg# This will work as long as MISSING is not called from configure, because
9677683534Smrg# unfortunately $(top_srcdir) has no meaning in configure.
9777683534Smrg# However there are other variables, like CC, which are often used in
9877683534Smrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
99a8fdb4bcSmrg#
10077683534Smrg# Another solution, used here, is to always expand $ac_aux_dir to an
10177683534Smrg# absolute PATH.  The drawback is that using absolute paths prevent a
10277683534Smrg# configured tree to be moved without reconfiguration.
103a8fdb4bcSmrg
10477683534SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
10577683534Smrg[dnl Rely on autoconf to set up CDPATH properly.
10677683534SmrgAC_PREREQ([2.50])dnl
10777683534Smrg# expand $ac_aux_dir to an absolute path
10877683534Smrgam_aux_dir=`cd $ac_aux_dir && pwd`
10977683534Smrg])
110a8fdb4bcSmrg
11177683534Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
112a8fdb4bcSmrg
11377683534Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
11477683534Smrg# Free Software Foundation, Inc.
11577683534Smrg#
11677683534Smrg# This file is free software; the Free Software Foundation
11777683534Smrg# gives unlimited permission to copy and/or distribute it,
11877683534Smrg# with or without modifications, as long as this notice is preserved.
119a8fdb4bcSmrg
12077683534Smrg# serial 9
121a8fdb4bcSmrg
12277683534Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12377683534Smrg# -------------------------------------
12477683534Smrg# Define a conditional.
12577683534SmrgAC_DEFUN([AM_CONDITIONAL],
12677683534Smrg[AC_PREREQ(2.52)dnl
12777683534Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
12877683534Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
12977683534SmrgAC_SUBST([$1_TRUE])dnl
13077683534SmrgAC_SUBST([$1_FALSE])dnl
13177683534Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
13277683534Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13377683534Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
13477683534Smrgif $2; then
13577683534Smrg  $1_TRUE=
13677683534Smrg  $1_FALSE='#'
13777683534Smrgelse
13877683534Smrg  $1_TRUE='#'
13977683534Smrg  $1_FALSE=
14077683534Smrgfi
14177683534SmrgAC_CONFIG_COMMANDS_PRE(
14277683534Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14377683534Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
14477683534SmrgUsually this means the macro was only invoked conditionally.]])
14577683534Smrgfi])])
146a8fdb4bcSmrg
14777683534Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
14877683534Smrg# Free Software Foundation, Inc.
14977683534Smrg#
15077683534Smrg# This file is free software; the Free Software Foundation
15177683534Smrg# gives unlimited permission to copy and/or distribute it,
15277683534Smrg# with or without modifications, as long as this notice is preserved.
153a8fdb4bcSmrg
15477683534Smrg# serial 10
155a8fdb4bcSmrg
15677683534Smrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
15777683534Smrg# written in clear, in which case automake, when reading aclocal.m4,
15877683534Smrg# will think it sees a *use*, and therefore will trigger all it's
15977683534Smrg# C support machinery.  Also note that it means that autoscan, seeing
16077683534Smrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
161a8fdb4bcSmrg
162a8fdb4bcSmrg
16377683534Smrg# _AM_DEPENDENCIES(NAME)
16477683534Smrg# ----------------------
16577683534Smrg# See how the compiler implements dependency checking.
16677683534Smrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
16777683534Smrg# We try a few techniques and use that to set a single cache variable.
168a8fdb4bcSmrg#
16977683534Smrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
17077683534Smrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
17177683534Smrg# dependency, and given that the user is not expected to run this macro,
17277683534Smrg# just rely on AC_PROG_CC.
17377683534SmrgAC_DEFUN([_AM_DEPENDENCIES],
17477683534Smrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
17577683534SmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
17677683534SmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
17777683534SmrgAC_REQUIRE([AM_DEP_TRACK])dnl
178a8fdb4bcSmrg
17977683534Smrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
18077683534Smrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
18177683534Smrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
18277683534Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
18377683534Smrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
18477683534Smrg                   [depcc="$$1"   am_compiler_list=])
185a8fdb4bcSmrg
18677683534SmrgAC_CACHE_CHECK([dependency style of $depcc],
18777683534Smrg               [am_cv_$1_dependencies_compiler_type],
18877683534Smrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
18977683534Smrg  # We make a subdir and do the tests there.  Otherwise we can end up
19077683534Smrg  # making bogus files that we don't know about and never remove.  For
19177683534Smrg  # instance it was reported that on HP-UX the gcc test will end up
19277683534Smrg  # making a dummy file named `D' -- because `-MD' means `put the output
19377683534Smrg  # in D'.
19477683534Smrg  mkdir conftest.dir
19577683534Smrg  # Copy depcomp to subdir because otherwise we won't find it if we're
19677683534Smrg  # using a relative directory.
19777683534Smrg  cp "$am_depcomp" conftest.dir
19877683534Smrg  cd conftest.dir
19977683534Smrg  # We will build objects and dependencies in a subdirectory because
20077683534Smrg  # it helps to detect inapplicable dependency modes.  For instance
20177683534Smrg  # both Tru64's cc and ICC support -MD to output dependencies as a
20277683534Smrg  # side effect of compilation, but ICC will put the dependencies in
20377683534Smrg  # the current directory while Tru64 will put them in the object
20477683534Smrg  # directory.
20577683534Smrg  mkdir sub
20677683534Smrg
20777683534Smrg  am_cv_$1_dependencies_compiler_type=none
20877683534Smrg  if test "$am_compiler_list" = ""; then
20977683534Smrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
21077683534Smrg  fi
21177683534Smrg  am__universal=false
21277683534Smrg  m4_case([$1], [CC],
21377683534Smrg    [case " $depcc " in #(
21477683534Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21577683534Smrg     esac],
21677683534Smrg    [CXX],
21777683534Smrg    [case " $depcc " in #(
21877683534Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
21977683534Smrg     esac])
22077683534Smrg
22177683534Smrg  for depmode in $am_compiler_list; do
22277683534Smrg    # Setup a source with many dependencies, because some compilers
22377683534Smrg    # like to wrap large dependency lists on column 80 (with \), and
22477683534Smrg    # we should not choose a depcomp mode which is confused by this.
22577683534Smrg    #
22677683534Smrg    # We need to recreate these files for each test, as the compiler may
22777683534Smrg    # overwrite some of them when testing with obscure command lines.
22877683534Smrg    # This happens at least with the AIX C compiler.
22977683534Smrg    : > sub/conftest.c
23077683534Smrg    for i in 1 2 3 4 5 6; do
23177683534Smrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
23277683534Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
23377683534Smrg      # Solaris 8's {/usr,}/bin/sh.
23477683534Smrg      touch sub/conftst$i.h
23577683534Smrg    done
23677683534Smrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
23777683534Smrg
23877683534Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
23977683534Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
24077683534Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
24177683534Smrg    # versions had trouble with output in subdirs
24277683534Smrg    am__obj=sub/conftest.${OBJEXT-o}
24377683534Smrg    am__minus_obj="-o $am__obj"
24477683534Smrg    case $depmode in
24577683534Smrg    gcc)
24677683534Smrg      # This depmode causes a compiler race in universal mode.
24777683534Smrg      test "$am__universal" = false || continue
24877683534Smrg      ;;
24977683534Smrg    nosideeffect)
25077683534Smrg      # after this tag, mechanisms are not by side-effect, so they'll
25177683534Smrg      # only be used when explicitly requested
25277683534Smrg      if test "x$enable_dependency_tracking" = xyes; then
25377683534Smrg	continue
25477683534Smrg      else
25577683534Smrg	break
25677683534Smrg      fi
25777683534Smrg      ;;
25877683534Smrg    msvisualcpp | msvcmsys)
25977683534Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
26077683534Smrg      # not run yet.  These depmodes are late enough in the game, and
26177683534Smrg      # so weak that their functioning should not be impacted.
26277683534Smrg      am__obj=conftest.${OBJEXT-o}
26377683534Smrg      am__minus_obj=
26477683534Smrg      ;;
26577683534Smrg    none) break ;;
26677683534Smrg    esac
26777683534Smrg    if depmode=$depmode \
26877683534Smrg       source=sub/conftest.c object=$am__obj \
26977683534Smrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
27077683534Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
27177683534Smrg         >/dev/null 2>conftest.err &&
27277683534Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
27377683534Smrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
27477683534Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
27577683534Smrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
27677683534Smrg      # icc doesn't choke on unknown options, it will just issue warnings
27777683534Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
27877683534Smrg      # that says an option was ignored or not supported.
27977683534Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
28077683534Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
28177683534Smrg      # The diagnosis changed in icc 8.0:
28277683534Smrg      #   icc: Command line remark: option '-MP' not supported
28377683534Smrg      if (grep 'ignoring option' conftest.err ||
28477683534Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
28577683534Smrg        am_cv_$1_dependencies_compiler_type=$depmode
28677683534Smrg        break
28777683534Smrg      fi
28877683534Smrg    fi
28977683534Smrg  done
29077683534Smrg
29177683534Smrg  cd ..
29277683534Smrg  rm -rf conftest.dir
293a8fdb4bcSmrgelse
29477683534Smrg  am_cv_$1_dependencies_compiler_type=none
295a8fdb4bcSmrgfi
29677683534Smrg])
29777683534SmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
29877683534SmrgAM_CONDITIONAL([am__fastdep$1], [
29977683534Smrg  test "x$enable_dependency_tracking" != xno \
30077683534Smrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
30177683534Smrg])
302a8fdb4bcSmrg
30377683534Smrg
30477683534Smrg# AM_SET_DEPDIR
30577683534Smrg# -------------
30677683534Smrg# Choose a directory name for dependency files.
30777683534Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
30877683534SmrgAC_DEFUN([AM_SET_DEPDIR],
30977683534Smrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
31077683534SmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
31177683534Smrg])
31277683534Smrg
31377683534Smrg
31477683534Smrg# AM_DEP_TRACK
31577683534Smrg# ------------
31677683534SmrgAC_DEFUN([AM_DEP_TRACK],
31777683534Smrg[AC_ARG_ENABLE(dependency-tracking,
31877683534Smrg[  --disable-dependency-tracking  speeds up one-time build
31977683534Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
32077683534Smrgif test "x$enable_dependency_tracking" != xno; then
32177683534Smrg  am_depcomp="$ac_aux_dir/depcomp"
32277683534Smrg  AMDEPBACKSLASH='\'
323a8fdb4bcSmrgfi
32477683534SmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
32577683534SmrgAC_SUBST([AMDEPBACKSLASH])dnl
32677683534Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
32777683534Smrg])
328a8fdb4bcSmrg
32977683534Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
33077683534Smrg
33177683534Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
33277683534Smrg# Free Software Foundation, Inc.
333a8fdb4bcSmrg#
33477683534Smrg# This file is free software; the Free Software Foundation
33577683534Smrg# gives unlimited permission to copy and/or distribute it,
33677683534Smrg# with or without modifications, as long as this notice is preserved.
337a8fdb4bcSmrg
33877683534Smrg#serial 5
339a8fdb4bcSmrg
34077683534Smrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
34177683534Smrg# ------------------------------
34277683534SmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
34377683534Smrg[{
34477683534Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
34577683534Smrg  # are listed without --file.  Let's play safe and only enable the eval
34677683534Smrg  # if we detect the quoting.
34777683534Smrg  case $CONFIG_FILES in
34877683534Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
34977683534Smrg  *)   set x $CONFIG_FILES ;;
35077683534Smrg  esac
35177683534Smrg  shift
35277683534Smrg  for mf
35377683534Smrg  do
35477683534Smrg    # Strip MF so we end up with the name of the file.
35577683534Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
35677683534Smrg    # Check whether this is an Automake generated Makefile or not.
35777683534Smrg    # We used to match only the files named `Makefile.in', but
35877683534Smrg    # some people rename them; so instead we look at the file content.
35977683534Smrg    # Grep'ing the first line is not enough: some people post-process
36077683534Smrg    # each Makefile.in and add a new line on top of each file to say so.
36177683534Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
36277683534Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
36377683534Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
36477683534Smrg      dirpart=`AS_DIRNAME("$mf")`
36577683534Smrg    else
36677683534Smrg      continue
36777683534Smrg    fi
36877683534Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
36977683534Smrg    # from the Makefile without running `make'.
37077683534Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
37177683534Smrg    test -z "$DEPDIR" && continue
37277683534Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
37377683534Smrg    test -z "am__include" && continue
37477683534Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
37577683534Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
37677683534Smrg    U=`sed -n 's/^U = //p' < "$mf"`
37777683534Smrg    # Find all dependency output files, they are included files with
37877683534Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
37977683534Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
38077683534Smrg    # expansion.
38177683534Smrg    for file in `sed -n "
38277683534Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
38377683534Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
38477683534Smrg      # Make sure the directory exists.
38577683534Smrg      test -f "$dirpart/$file" && continue
38677683534Smrg      fdir=`AS_DIRNAME(["$file"])`
38777683534Smrg      AS_MKDIR_P([$dirpart/$fdir])
38877683534Smrg      # echo "creating $dirpart/$file"
38977683534Smrg      echo '# dummy' > "$dirpart/$file"
39077683534Smrg    done
39177683534Smrg  done
39277683534Smrg}
39377683534Smrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
394a8fdb4bcSmrg
395a8fdb4bcSmrg
39677683534Smrg# AM_OUTPUT_DEPENDENCY_COMMANDS
39777683534Smrg# -----------------------------
39877683534Smrg# This macro should only be invoked once -- use via AC_REQUIRE.
39977683534Smrg#
40077683534Smrg# This code is only required when automatic dependency tracking
40177683534Smrg# is enabled.  FIXME.  This creates each `.P' file that we will
40277683534Smrg# need in order to bootstrap the dependency handling code.
40377683534SmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
40477683534Smrg[AC_CONFIG_COMMANDS([depfiles],
40577683534Smrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
40677683534Smrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
40777683534Smrg])
408a8fdb4bcSmrg
40977683534Smrg# Do all the work for Automake.                             -*- Autoconf -*-
41077683534Smrg
41177683534Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
41277683534Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
41377683534Smrg#
41477683534Smrg# This file is free software; the Free Software Foundation
41577683534Smrg# gives unlimited permission to copy and/or distribute it,
41677683534Smrg# with or without modifications, as long as this notice is preserved.
41777683534Smrg
41877683534Smrg# serial 16
41977683534Smrg
42077683534Smrg# This macro actually does too much.  Some checks are only needed if
42177683534Smrg# your package does certain things.  But this isn't really a big deal.
42277683534Smrg
42377683534Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
42477683534Smrg# AM_INIT_AUTOMAKE([OPTIONS])
42577683534Smrg# -----------------------------------------------
42677683534Smrg# The call with PACKAGE and VERSION arguments is the old style
42777683534Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
42877683534Smrg# and VERSION should now be passed to AC_INIT and removed from
42977683534Smrg# the call to AM_INIT_AUTOMAKE.
43077683534Smrg# We support both call styles for the transition.  After
43177683534Smrg# the next Automake release, Autoconf can make the AC_INIT
43277683534Smrg# arguments mandatory, and then we can depend on a new Autoconf
43377683534Smrg# release and drop the old call support.
43477683534SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
43577683534Smrg[AC_PREREQ([2.62])dnl
43677683534Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
43777683534Smrgdnl the ones we care about.
43877683534Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
43977683534SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
44077683534SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
44177683534Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
44277683534Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
44377683534Smrg  # is not polluted with repeated "-I."
44477683534Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
44577683534Smrg  # test to see if srcdir already configured
44677683534Smrg  if test -f $srcdir/config.status; then
44777683534Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
44877683534Smrg  fi
449a8fdb4bcSmrgfi
45077683534Smrg
45177683534Smrg# test whether we have cygpath
45277683534Smrgif test -z "$CYGPATH_W"; then
45377683534Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
45477683534Smrg    CYGPATH_W='cygpath -w'
45577683534Smrg  else
45677683534Smrg    CYGPATH_W=echo
45777683534Smrg  fi
458a8fdb4bcSmrgfi
45977683534SmrgAC_SUBST([CYGPATH_W])
460a8fdb4bcSmrg
46177683534Smrg# Define the identity of the package.
46277683534Smrgdnl Distinguish between old-style and new-style calls.
46377683534Smrgm4_ifval([$2],
46477683534Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
46577683534Smrg AC_SUBST([PACKAGE], [$1])dnl
46677683534Smrg AC_SUBST([VERSION], [$2])],
46777683534Smrg[_AM_SET_OPTIONS([$1])dnl
46877683534Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
46977683534Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
47077683534Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
47177683534Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
47277683534Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
473a8fdb4bcSmrg
47477683534Smrg_AM_IF_OPTION([no-define],,
47577683534Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
47677683534Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
47777683534Smrg
47877683534Smrg# Some tools Automake needs.
47977683534SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
48077683534SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
48177683534SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
48277683534SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
48377683534SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
48477683534SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
48577683534SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
48677683534SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
48777683534SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
48877683534SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
48977683534Smrg# We need awk for the "check" target.  The system "awk" is bad on
49077683534Smrg# some platforms.
49177683534SmrgAC_REQUIRE([AC_PROG_AWK])dnl
49277683534SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
49377683534SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
49477683534Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
49577683534Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
49677683534Smrg			     [_AM_PROG_TAR([v7])])])
49777683534Smrg_AM_IF_OPTION([no-dependencies],,
49877683534Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
49977683534Smrg		  [_AM_DEPENDENCIES(CC)],
50077683534Smrg		  [define([AC_PROG_CC],
50177683534Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
50277683534SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
50377683534Smrg		  [_AM_DEPENDENCIES(CXX)],
50477683534Smrg		  [define([AC_PROG_CXX],
50577683534Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
50677683534SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
50777683534Smrg		  [_AM_DEPENDENCIES(OBJC)],
50877683534Smrg		  [define([AC_PROG_OBJC],
50977683534Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
51077683534Smrg])
51177683534Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
51277683534Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
51377683534Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
51477683534Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
51577683534SmrgAC_CONFIG_COMMANDS_PRE(dnl
51677683534Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
51777683534Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
51877683534Smrg])
519a8fdb4bcSmrg
52077683534Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
52177683534Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
52277683534Smrgdnl mangled by Autoconf and run in a shell conditional statement.
52377683534Smrgm4_define([_AC_COMPILER_EXEEXT],
52477683534Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
525a8fdb4bcSmrg
526a8fdb4bcSmrg
52777683534Smrg# When config.status generates a header, we must update the stamp-h file.
52877683534Smrg# This file resides in the same directory as the config header
52977683534Smrg# that is generated.  The stamp files are numbered to have different names.
530a8fdb4bcSmrg
53177683534Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
53277683534Smrg# loop where config.status creates the headers, so we can generate
53377683534Smrg# our stamp files there.
53477683534SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
53577683534Smrg[# Compute $1's index in $config_headers.
53677683534Smrg_am_arg=$1
53777683534Smrg_am_stamp_count=1
53877683534Smrgfor _am_header in $config_headers :; do
53977683534Smrg  case $_am_header in
54077683534Smrg    $_am_arg | $_am_arg:* )
54177683534Smrg      break ;;
54277683534Smrg    * )
54377683534Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
54477683534Smrg  esac
54577683534Smrgdone
54677683534Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
547a8fdb4bcSmrg
54877683534Smrg# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
54977683534Smrg#
55077683534Smrg# This file is free software; the Free Software Foundation
55177683534Smrg# gives unlimited permission to copy and/or distribute it,
55277683534Smrg# with or without modifications, as long as this notice is preserved.
553a8fdb4bcSmrg
55477683534Smrg# AM_PROG_INSTALL_SH
55577683534Smrg# ------------------
55677683534Smrg# Define $install_sh.
55777683534SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
55877683534Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
55977683534Smrgif test x"${install_sh}" != xset; then
56077683534Smrg  case $am_aux_dir in
56177683534Smrg  *\ * | *\	*)
56277683534Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
56377683534Smrg  *)
56477683534Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
56577683534Smrg  esac
56677683534Smrgfi
56777683534SmrgAC_SUBST(install_sh)])
568a8fdb4bcSmrg
56977683534Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
57077683534Smrg#
57177683534Smrg# This file is free software; the Free Software Foundation
57277683534Smrg# gives unlimited permission to copy and/or distribute it,
57377683534Smrg# with or without modifications, as long as this notice is preserved.
574a8fdb4bcSmrg
57577683534Smrg# serial 2
576a8fdb4bcSmrg
57777683534Smrg# Check whether the underlying file-system supports filenames
57877683534Smrg# with a leading dot.  For instance MS-DOS doesn't.
57977683534SmrgAC_DEFUN([AM_SET_LEADING_DOT],
58077683534Smrg[rm -rf .tst 2>/dev/null
58177683534Smrgmkdir .tst 2>/dev/null
58277683534Smrgif test -d .tst; then
58377683534Smrg  am__leading_dot=.
584a8fdb4bcSmrgelse
58577683534Smrg  am__leading_dot=_
586a8fdb4bcSmrgfi
58777683534Smrgrmdir .tst 2>/dev/null
58877683534SmrgAC_SUBST([am__leading_dot])])
589a8fdb4bcSmrg
59077683534Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
59177683534Smrg# From Jim Meyering
592a8fdb4bcSmrg
59377683534Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
59477683534Smrg# Free Software Foundation, Inc.
595a8fdb4bcSmrg#
59677683534Smrg# This file is free software; the Free Software Foundation
59777683534Smrg# gives unlimited permission to copy and/or distribute it,
59877683534Smrg# with or without modifications, as long as this notice is preserved.
599a8fdb4bcSmrg
60077683534Smrg# serial 5
601a8fdb4bcSmrg
60277683534Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
60377683534Smrg# ----------------------------------
60477683534Smrg# Control maintainer-specific portions of Makefiles.
60577683534Smrg# Default is to disable them, unless `enable' is passed literally.
60677683534Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
60777683534Smrg# can override the default with the --enable/--disable switch.
60877683534SmrgAC_DEFUN([AM_MAINTAINER_MODE],
60977683534Smrg[m4_case(m4_default([$1], [disable]),
61077683534Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
61177683534Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
61277683534Smrg       [m4_define([am_maintainer_other], [enable])
61377683534Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
61477683534SmrgAC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
61577683534Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
61677683534Smrg  AC_ARG_ENABLE([maintainer-mode],
61777683534Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
61877683534Smrg			  (and sometimes confusing) to the casual installer],
61977683534Smrg      [USE_MAINTAINER_MODE=$enableval],
62077683534Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
62177683534Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
62277683534Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
62377683534Smrg  MAINT=$MAINTAINER_MODE_TRUE
62477683534Smrg  AC_SUBST([MAINT])dnl
62577683534Smrg]
62677683534Smrg)
627a8fdb4bcSmrg
62877683534SmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
629a8fdb4bcSmrg
63077683534Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
631a8fdb4bcSmrg
63277683534Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
633dbe7da2eSmrg#
63477683534Smrg# This file is free software; the Free Software Foundation
63577683534Smrg# gives unlimited permission to copy and/or distribute it,
63677683534Smrg# with or without modifications, as long as this notice is preserved.
637dbe7da2eSmrg
63877683534Smrg# serial 4
63977683534Smrg
64077683534Smrg# AM_MAKE_INCLUDE()
64177683534Smrg# -----------------
64277683534Smrg# Check to see how make treats includes.
64377683534SmrgAC_DEFUN([AM_MAKE_INCLUDE],
64477683534Smrg[am_make=${MAKE-make}
64577683534Smrgcat > confinc << 'END'
64677683534Smrgam__doit:
64777683534Smrg	@echo this is the am__doit target
64877683534Smrg.PHONY: am__doit
64977683534SmrgEND
65077683534Smrg# If we don't find an include directive, just comment out the code.
65177683534SmrgAC_MSG_CHECKING([for style of include used by $am_make])
65277683534Smrgam__include="#"
65377683534Smrgam__quote=
65477683534Smrg_am_result=none
65577683534Smrg# First try GNU make style include.
65677683534Smrgecho "include confinc" > confmf
65777683534Smrg# Ignore all kinds of additional output from `make'.
65877683534Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
65977683534Smrg*the\ am__doit\ target*)
66077683534Smrg  am__include=include
66177683534Smrg  am__quote=
66277683534Smrg  _am_result=GNU
66377683534Smrg  ;;
66477683534Smrgesac
66577683534Smrg# Now try BSD make style include.
66677683534Smrgif test "$am__include" = "#"; then
66777683534Smrg   echo '.include "confinc"' > confmf
66877683534Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
66977683534Smrg   *the\ am__doit\ target*)
67077683534Smrg     am__include=.include
67177683534Smrg     am__quote="\""
67277683534Smrg     _am_result=BSD
67377683534Smrg     ;;
67477683534Smrg   esac
675dbe7da2eSmrgfi
67677683534SmrgAC_SUBST([am__include])
67777683534SmrgAC_SUBST([am__quote])
67877683534SmrgAC_MSG_RESULT([$_am_result])
67977683534Smrgrm -f confinc confmf
68077683534Smrg])
681dbe7da2eSmrg
68277683534Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
68377683534Smrg
68477683534Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
68577683534Smrg# Free Software Foundation, Inc.
686dbe7da2eSmrg#
68777683534Smrg# This file is free software; the Free Software Foundation
68877683534Smrg# gives unlimited permission to copy and/or distribute it,
68977683534Smrg# with or without modifications, as long as this notice is preserved.
690dbe7da2eSmrg
69177683534Smrg# serial 6
692dbe7da2eSmrg
69377683534Smrg# AM_MISSING_PROG(NAME, PROGRAM)
69477683534Smrg# ------------------------------
69577683534SmrgAC_DEFUN([AM_MISSING_PROG],
69677683534Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
69777683534Smrg$1=${$1-"${am_missing_run}$2"}
69877683534SmrgAC_SUBST($1)])
699dbe7da2eSmrg
70077683534Smrg
70177683534Smrg# AM_MISSING_HAS_RUN
70277683534Smrg# ------------------
70377683534Smrg# Define MISSING if not defined so far and test if it supports --run.
70477683534Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
70577683534SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
70677683534Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
70777683534SmrgAC_REQUIRE_AUX_FILE([missing])dnl
70877683534Smrgif test x"${MISSING+set}" != xset; then
70977683534Smrg  case $am_aux_dir in
71077683534Smrg  *\ * | *\	*)
71177683534Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
71277683534Smrg  *)
71377683534Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
71477683534Smrg  esac
71577683534Smrgfi
71677683534Smrg# Use eval to expand $SHELL
71777683534Smrgif eval "$MISSING --run true"; then
71877683534Smrg  am_missing_run="$MISSING --run "
719dbe7da2eSmrgelse
72077683534Smrg  am_missing_run=
72177683534Smrg  AC_MSG_WARN([`missing' script is too old or missing])
722dbe7da2eSmrgfi
72377683534Smrg])
724dbe7da2eSmrg
72577683534Smrg# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
726a8fdb4bcSmrg#
72777683534Smrg# This file is free software; the Free Software Foundation
72877683534Smrg# gives unlimited permission to copy and/or distribute it,
72977683534Smrg# with or without modifications, as long as this notice is preserved.
730a8fdb4bcSmrg
73177683534Smrg# AM_PROG_MKDIR_P
73277683534Smrg# ---------------
73377683534Smrg# Check for `mkdir -p'.
73477683534SmrgAC_DEFUN([AM_PROG_MKDIR_P],
73577683534Smrg[AC_PREREQ([2.60])dnl
73677683534SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
73777683534Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
73877683534Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
73977683534Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
74077683534Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
74177683534Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
74277683534Smrgdnl adjustment using top_builddir (which is defined more often than
74377683534Smrgdnl MKDIR_P).
74477683534SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
74577683534Smrgcase $mkdir_p in
74677683534Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
74777683534Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
74877683534Smrgesac
74977683534Smrg])
750a8fdb4bcSmrg
75177683534Smrg# Helper functions for option handling.                     -*- Autoconf -*-
752a8fdb4bcSmrg
75377683534Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
754a8fdb4bcSmrg#
75577683534Smrg# This file is free software; the Free Software Foundation
75677683534Smrg# gives unlimited permission to copy and/or distribute it,
75777683534Smrg# with or without modifications, as long as this notice is preserved.
758a8fdb4bcSmrg
75977683534Smrg# serial 4
76077683534Smrg
76177683534Smrg# _AM_MANGLE_OPTION(NAME)
76277683534Smrg# -----------------------
76377683534SmrgAC_DEFUN([_AM_MANGLE_OPTION],
76477683534Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
76577683534Smrg
76677683534Smrg# _AM_SET_OPTION(NAME)
76777683534Smrg# ------------------------------
76877683534Smrg# Set option NAME.  Presently that only means defining a flag for this option.
76977683534SmrgAC_DEFUN([_AM_SET_OPTION],
77077683534Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
771a8fdb4bcSmrg
77277683534Smrg# _AM_SET_OPTIONS(OPTIONS)
77377683534Smrg# ----------------------------------
77477683534Smrg# OPTIONS is a space-separated list of Automake options.
77577683534SmrgAC_DEFUN([_AM_SET_OPTIONS],
77677683534Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
77777683534Smrg
77877683534Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
77977683534Smrg# -------------------------------------------
78077683534Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
78177683534SmrgAC_DEFUN([_AM_IF_OPTION],
78277683534Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
783a8fdb4bcSmrg
78477683534Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
785a8fdb4bcSmrg
78677683534Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
78777683534Smrg# Free Software Foundation, Inc.
788a8fdb4bcSmrg#
78977683534Smrg# This file is free software; the Free Software Foundation
79077683534Smrg# gives unlimited permission to copy and/or distribute it,
79177683534Smrg# with or without modifications, as long as this notice is preserved.
792a8fdb4bcSmrg
79377683534Smrg# serial 5
794a8fdb4bcSmrg
79577683534Smrg# AM_SANITY_CHECK
796dbe7da2eSmrg# ---------------
79777683534SmrgAC_DEFUN([AM_SANITY_CHECK],
79877683534Smrg[AC_MSG_CHECKING([whether build environment is sane])
79977683534Smrg# Just in case
80077683534Smrgsleep 1
80177683534Smrgecho timestamp > conftest.file
80277683534Smrg# Reject unsafe characters in $srcdir or the absolute working directory
80377683534Smrg# name.  Accept space and tab only in the latter.
80477683534Smrgam_lf='
80577683534Smrg'
80677683534Smrgcase `pwd` in
80777683534Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
80877683534Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
80977683534Smrgesac
81077683534Smrgcase $srcdir in
81177683534Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
81277683534Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
81377683534Smrgesac
814dbe7da2eSmrg
81577683534Smrg# Do `set' in a subshell so we don't clobber the current shell's
81677683534Smrg# arguments.  Must try -L first in case configure is actually a
81777683534Smrg# symlink; some systems play weird games with the mod time of symlinks
81877683534Smrg# (eg FreeBSD returns the mod time of the symlink's containing
81977683534Smrg# directory).
82077683534Smrgif (
82177683534Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
82277683534Smrg   if test "$[*]" = "X"; then
82377683534Smrg      # -L didn't work.
82477683534Smrg      set X `ls -t "$srcdir/configure" conftest.file`
82577683534Smrg   fi
82677683534Smrg   rm -f conftest.file
82777683534Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
82877683534Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
829dbe7da2eSmrg
83077683534Smrg      # If neither matched, then we have a broken ls.  This can happen
83177683534Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
83277683534Smrg      # broken ls alias from the environment.  This has actually
83377683534Smrg      # happened.  Such a system could not be considered "sane".
83477683534Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
83577683534Smrgalias in your environment])
83677683534Smrg   fi
83777683534Smrg
83877683534Smrg   test "$[2]" = conftest.file
83977683534Smrg   )
84077683534Smrgthen
84177683534Smrg   # Ok.
84277683534Smrg   :
84377683534Smrgelse
84477683534Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
84577683534SmrgCheck your system clock])
846dbe7da2eSmrgfi
84777683534SmrgAC_MSG_RESULT(yes)])
848dbe7da2eSmrg
84977683534Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
850dbe7da2eSmrg#
85177683534Smrg# This file is free software; the Free Software Foundation
85277683534Smrg# gives unlimited permission to copy and/or distribute it,
85377683534Smrg# with or without modifications, as long as this notice is preserved.
854dbe7da2eSmrg
85577683534Smrg# serial 1
856a8fdb4bcSmrg
85777683534Smrg# AM_SILENT_RULES([DEFAULT])
85877683534Smrg# --------------------------
85977683534Smrg# Enable less verbose build rules; with the default set to DEFAULT
86077683534Smrg# (`yes' being less verbose, `no' or empty being verbose).
86177683534SmrgAC_DEFUN([AM_SILENT_RULES],
86277683534Smrg[AC_ARG_ENABLE([silent-rules],
86377683534Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
86477683534Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
86577683534Smrgcase $enable_silent_rules in
86677683534Smrgyes) AM_DEFAULT_VERBOSITY=0;;
86777683534Smrgno)  AM_DEFAULT_VERBOSITY=1;;
86877683534Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
86977683534Smrgesac
87077683534SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
87177683534SmrgAM_BACKSLASH='\'
87277683534SmrgAC_SUBST([AM_BACKSLASH])dnl
87377683534Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
874a8fdb4bcSmrg])
875a8fdb4bcSmrg
87677683534Smrg# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
877dbe7da2eSmrg#
87877683534Smrg# This file is free software; the Free Software Foundation
87977683534Smrg# gives unlimited permission to copy and/or distribute it,
88077683534Smrg# with or without modifications, as long as this notice is preserved.
88177683534Smrg
88277683534Smrg# AM_PROG_INSTALL_STRIP
88377683534Smrg# ---------------------
88477683534Smrg# One issue with vendor `install' (even GNU) is that you can't
88577683534Smrg# specify the program used to strip binaries.  This is especially
88677683534Smrg# annoying in cross-compiling environments, where the build's strip
88777683534Smrg# is unlikely to handle the host's binaries.
88877683534Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
88977683534Smrg# always use install-sh in `make install-strip', and initialize
89077683534Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
89177683534SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
89277683534Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
89377683534Smrg# Installed binaries are usually stripped using `strip' when the user
89477683534Smrg# run `make install-strip'.  However `strip' might not be the right
89577683534Smrg# tool to use in cross-compilation environments, therefore Automake
89677683534Smrg# will honor the `STRIP' environment variable to overrule this program.
89777683534Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
89877683534Smrgif test "$cross_compiling" != no; then
89977683534Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
90077683534Smrgfi
90177683534SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
90277683534SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
903dbe7da2eSmrg
90477683534Smrg# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
905a8fdb4bcSmrg#
906a8fdb4bcSmrg# This file is free software; the Free Software Foundation
907a8fdb4bcSmrg# gives unlimited permission to copy and/or distribute it,
908a8fdb4bcSmrg# with or without modifications, as long as this notice is preserved.
909a8fdb4bcSmrg
91077683534Smrg# serial 2
911a8fdb4bcSmrg
91277683534Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
91377683534Smrg# ---------------------------
91477683534Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
91577683534Smrg# This macro is traced by Automake.
91677683534SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
917a8fdb4bcSmrg
91877683534Smrg# AM_SUBST_NOTMAKE(VARIABLE)
91977683534Smrg# ---------------------------
92077683534Smrg# Public sister of _AM_SUBST_NOTMAKE.
92177683534SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
922a8fdb4bcSmrg
92377683534Smrg# Check how to create a tarball.                            -*- Autoconf -*-
924a8fdb4bcSmrg
92577683534Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
926a8fdb4bcSmrg#
927a8fdb4bcSmrg# This file is free software; the Free Software Foundation
928a8fdb4bcSmrg# gives unlimited permission to copy and/or distribute it,
929a8fdb4bcSmrg# with or without modifications, as long as this notice is preserved.
930a8fdb4bcSmrg
93177683534Smrg# serial 2
93277683534Smrg
93377683534Smrg# _AM_PROG_TAR(FORMAT)
93477683534Smrg# --------------------
93577683534Smrg# Check how to create a tarball in format FORMAT.
93677683534Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
937a8fdb4bcSmrg#
93877683534Smrg# Substitute a variable $(am__tar) that is a command
93977683534Smrg# writing to stdout a FORMAT-tarball containing the directory
94077683534Smrg# $tardir.
94177683534Smrg#     tardir=directory && $(am__tar) > result.tar
942a8fdb4bcSmrg#
94377683534Smrg# Substitute a variable $(am__untar) that extract such
94477683534Smrg# a tarball read from stdin.
94577683534Smrg#     $(am__untar) < result.tar
94677683534SmrgAC_DEFUN([_AM_PROG_TAR],
94777683534Smrg[# Always define AMTAR for backward compatibility.
94877683534SmrgAM_MISSING_PROG([AMTAR], [tar])
94977683534Smrgm4_if([$1], [v7],
95077683534Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
95177683534Smrg     [m4_case([$1], [ustar],, [pax],,
95277683534Smrg              [m4_fatal([Unknown tar format])])
95377683534SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
95477683534Smrg# Loop over all known methods to create a tar archive until one works.
95577683534Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
95677683534Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
95777683534Smrg# Do not fold the above two line into one, because Tru64 sh and
95877683534Smrg# Solaris sh will not grok spaces in the rhs of `-'.
95977683534Smrgfor _am_tool in $_am_tools
96077683534Smrgdo
96177683534Smrg  case $_am_tool in
96277683534Smrg  gnutar)
96377683534Smrg    for _am_tar in tar gnutar gtar;
96477683534Smrg    do
96577683534Smrg      AM_RUN_LOG([$_am_tar --version]) && break
96677683534Smrg    done
96777683534Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
96877683534Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
96977683534Smrg    am__untar="$_am_tar -xf -"
97077683534Smrg    ;;
97177683534Smrg  plaintar)
97277683534Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
97377683534Smrg    # ustar tarball either.
97477683534Smrg    (tar --version) >/dev/null 2>&1 && continue
97577683534Smrg    am__tar='tar chf - "$$tardir"'
97677683534Smrg    am__tar_='tar chf - "$tardir"'
97777683534Smrg    am__untar='tar xf -'
97877683534Smrg    ;;
97977683534Smrg  pax)
98077683534Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
98177683534Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
98277683534Smrg    am__untar='pax -r'
98377683534Smrg    ;;
98477683534Smrg  cpio)
98577683534Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
98677683534Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
98777683534Smrg    am__untar='cpio -i -H $1 -d'
98877683534Smrg    ;;
98977683534Smrg  none)
99077683534Smrg    am__tar=false
99177683534Smrg    am__tar_=false
99277683534Smrg    am__untar=false
99377683534Smrg    ;;
99477683534Smrg  esac
99577683534Smrg
99677683534Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
99777683534Smrg  # and am__untar set.
99877683534Smrg  test -n "${am_cv_prog_tar_$1}" && break
99977683534Smrg
100077683534Smrg  # tar/untar a dummy directory, and stop if the command works
100177683534Smrg  rm -rf conftest.dir
100277683534Smrg  mkdir conftest.dir
100377683534Smrg  echo GrepMe > conftest.dir/file
100477683534Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
100577683534Smrg  rm -rf conftest.dir
100677683534Smrg  if test -s conftest.tar; then
100777683534Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
100877683534Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
100977683534Smrg  fi
101077683534Smrgdone
101177683534Smrgrm -rf conftest.dir
101277683534Smrg
101377683534SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
101477683534SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
101577683534SmrgAC_SUBST([am__tar])
101677683534SmrgAC_SUBST([am__untar])
101777683534Smrg]) # _AM_PROG_TAR
101877683534Smrg
10194ed31819Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
10204ed31819Smrg# 
10214ed31819Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
10224ed31819Smrg#
10234ed31819Smrg# This program is free software; you can redistribute it and/or modify
10244ed31819Smrg# it under the terms of the GNU General Public License as published by
10254ed31819Smrg# the Free Software Foundation; either version 2 of the License, or
10264ed31819Smrg# (at your option) any later version.
10274ed31819Smrg#
10284ed31819Smrg# This program is distributed in the hope that it will be useful, but
10294ed31819Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
10304ed31819Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10314ed31819Smrg# General Public License for more details.
10324ed31819Smrg#
10334ed31819Smrg# You should have received a copy of the GNU General Public License
10344ed31819Smrg# along with this program; if not, write to the Free Software
10354ed31819Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
10364ed31819Smrg#
10374ed31819Smrg# As a special exception to the GNU General Public License, if you
10384ed31819Smrg# distribute this file as part of a program that contains a
10394ed31819Smrg# configuration script generated by Autoconf, you may include it under
10404ed31819Smrg# the same distribution terms that you use for the rest of that program.
10414ed31819Smrg
10424ed31819Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
10434ed31819Smrg# ----------------------------------
10444ed31819SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
10454ed31819Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
10464ed31819Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
10474ed31819SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
10484ed31819Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
10494ed31819Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
10504ed31819Smrgfi
10514ed31819Smrgif test -n "$PKG_CONFIG"; then
10524ed31819Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
10534ed31819Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
10544ed31819Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
10554ed31819Smrg		AC_MSG_RESULT([yes])
10564ed31819Smrg	else
10574ed31819Smrg		AC_MSG_RESULT([no])
10584ed31819Smrg		PKG_CONFIG=""
10594ed31819Smrg	fi
10604ed31819Smrg		
10614ed31819Smrgfi[]dnl
10624ed31819Smrg])# PKG_PROG_PKG_CONFIG
10634ed31819Smrg
10644ed31819Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10654ed31819Smrg#
10664ed31819Smrg# Check to see whether a particular set of modules exists.  Similar
10674ed31819Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
10684ed31819Smrg#
10694ed31819Smrg#
10704ed31819Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
10714ed31819Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
10724ed31819Smrg# PKG_CHECK_EXISTS manually
10734ed31819Smrg# --------------------------------------------------------------
10744ed31819SmrgAC_DEFUN([PKG_CHECK_EXISTS],
10754ed31819Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
10764ed31819Smrgif test -n "$PKG_CONFIG" && \
10774ed31819Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
10784ed31819Smrg  m4_ifval([$2], [$2], [:])
10794ed31819Smrgm4_ifvaln([$3], [else
10804ed31819Smrg  $3])dnl
10814ed31819Smrgfi])
10824ed31819Smrg
10834ed31819Smrg
10844ed31819Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
10854ed31819Smrg# ---------------------------------------------
10864ed31819Smrgm4_define([_PKG_CONFIG],
10874ed31819Smrg[if test -n "$$1"; then
10884ed31819Smrg    pkg_cv_[]$1="$$1"
10894ed31819Smrg elif test -n "$PKG_CONFIG"; then
10904ed31819Smrg    PKG_CHECK_EXISTS([$3],
10914ed31819Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
10924ed31819Smrg		     [pkg_failed=yes])
10934ed31819Smrg else
10944ed31819Smrg    pkg_failed=untried
10954ed31819Smrgfi[]dnl
10964ed31819Smrg])# _PKG_CONFIG
10974ed31819Smrg
10984ed31819Smrg# _PKG_SHORT_ERRORS_SUPPORTED
10994ed31819Smrg# -----------------------------
11004ed31819SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
11014ed31819Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
11024ed31819Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
11034ed31819Smrg        _pkg_short_errors_supported=yes
11044ed31819Smrgelse
11054ed31819Smrg        _pkg_short_errors_supported=no
11064ed31819Smrgfi[]dnl
11074ed31819Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
11084ed31819Smrg
11094ed31819Smrg
11104ed31819Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
11114ed31819Smrg# [ACTION-IF-NOT-FOUND])
11124ed31819Smrg#
11134ed31819Smrg#
11144ed31819Smrg# Note that if there is a possibility the first call to
11154ed31819Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
11164ed31819Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
11174ed31819Smrg#
11184ed31819Smrg#
11194ed31819Smrg# --------------------------------------------------------------
11204ed31819SmrgAC_DEFUN([PKG_CHECK_MODULES],
11214ed31819Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
11224ed31819SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
11234ed31819SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
11244ed31819Smrg
11254ed31819Smrgpkg_failed=no
11264ed31819SmrgAC_MSG_CHECKING([for $1])
11274ed31819Smrg
11284ed31819Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
11294ed31819Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
11304ed31819Smrg
11314ed31819Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
11324ed31819Smrgand $1[]_LIBS to avoid the need to call pkg-config.
11334ed31819SmrgSee the pkg-config man page for more details.])
11344ed31819Smrg
11354ed31819Smrgif test $pkg_failed = yes; then
11364ed31819Smrg        _PKG_SHORT_ERRORS_SUPPORTED
11374ed31819Smrg        if test $_pkg_short_errors_supported = yes; then
11384ed31819Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
11394ed31819Smrg        else 
11404ed31819Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
11414ed31819Smrg        fi
11424ed31819Smrg	# Put the nasty error message in config.log where it belongs
11434ed31819Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
11444ed31819Smrg
11454ed31819Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
11464ed31819Smrg[Package requirements ($2) were not met:
11474ed31819Smrg
11484ed31819Smrg$$1_PKG_ERRORS
11494ed31819Smrg
11504ed31819SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
11514ed31819Smrginstalled software in a non-standard prefix.
11524ed31819Smrg
11534ed31819Smrg_PKG_TEXT
11544ed31819Smrg])],
11554ed31819Smrg		[AC_MSG_RESULT([no])
11564ed31819Smrg                $4])
11574ed31819Smrgelif test $pkg_failed = untried; then
11584ed31819Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
11594ed31819Smrg[The pkg-config script could not be found or is too old.  Make sure it
11604ed31819Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
11614ed31819Smrgpath to pkg-config.
11624ed31819Smrg
11634ed31819Smrg_PKG_TEXT
11644ed31819Smrg
11654ed31819SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
11664ed31819Smrg		[$4])
11674ed31819Smrgelse
11684ed31819Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
11694ed31819Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
11704ed31819Smrg        AC_MSG_RESULT([yes])
11714ed31819Smrg	ifelse([$3], , :, [$3])
11724ed31819Smrgfi[]dnl
11734ed31819Smrg])# PKG_CHECK_MODULES
11744ed31819Smrg
117577683534Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
117677683534Smrgdnl
117777683534Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
117877683534Smrgdnl 
117977683534Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
118077683534Smrgdnl copy of this software and associated documentation files (the "Software"),
118177683534Smrgdnl to deal in the Software without restriction, including without limitation
118277683534Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
118377683534Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
118477683534Smrgdnl Software is furnished to do so, subject to the following conditions:
118577683534Smrgdnl
118677683534Smrgdnl The above copyright notice and this permission notice (including the next
118777683534Smrgdnl paragraph) shall be included in all copies or substantial portions of the
118877683534Smrgdnl Software.
118977683534Smrgdnl
119077683534Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
119177683534Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
119277683534Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
119377683534Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
119477683534Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
119577683534Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
119677683534Smrgdnl DEALINGS IN THE SOFTWARE.
119777683534Smrg
119877683534Smrg# XORG_MACROS_VERSION(required-version)
119977683534Smrg# -------------------------------------
120077683534Smrg# Minimum version: 1.1.0
1201a8fdb4bcSmrg#
120277683534Smrg# If you're using a macro added in Version 1.1 or newer, include this in
120377683534Smrg# your configure.ac with the minimum required version, such as:
120477683534Smrg# XORG_MACROS_VERSION(1.1)
1205a8fdb4bcSmrg#
120677683534Smrg# To ensure that this macro is defined, also add:
120777683534Smrg# m4_ifndef([XORG_MACROS_VERSION],
120877683534Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1209a8fdb4bcSmrg#
121077683534Smrg#
121177683534Smrg# See the "minimum version" comment for each macro you use to see what 
121277683534Smrg# version you require.
121377683534Smrgm4_defun([XORG_MACROS_VERSION],[
12144ed31819Smrgm4_define([vers_have], [1.17])
121577683534Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
121677683534Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
121777683534Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
121877683534Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
121977683534Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
122077683534Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
122177683534Smrgm4_undefine([vers_have])
122277683534Smrgm4_undefine([maj_have])
122377683534Smrgm4_undefine([maj_needed])
122477683534Smrg]) # XORG_MACROS_VERSION
122577683534Smrg
122677683534Smrg# XORG_PROG_RAWCPP()
122777683534Smrg# ------------------
122877683534Smrg# Minimum version: 1.0.0
122977683534Smrg#
123077683534Smrg# Find cpp program and necessary flags for use in pre-processing text files
123177683534Smrg# such as man pages and config files
123277683534SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
123377683534SmrgAC_REQUIRE([AC_PROG_CPP])
123477683534SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
123577683534Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
123677683534Smrg
123777683534Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
123877683534Smrg# which is not the best choice for supporting other OS'es, but covers most
123977683534Smrg# of the ones we need for now.
124077683534SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
12414ed31819SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
124277683534Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
124377683534Smrg	AC_MSG_RESULT([no])
124477683534Smrgelse
124577683534Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
124677683534Smrg		RAWCPPFLAGS=-undef
124777683534Smrg		AC_MSG_RESULT([yes])
124877683534Smrg	# under Cygwin unix is still defined even with -undef
124977683534Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
125077683534Smrg		RAWCPPFLAGS="-undef -ansi"
125177683534Smrg		AC_MSG_RESULT([yes, with -ansi])
125277683534Smrg	else
125377683534Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
125477683534Smrg	fi
125577683534Smrgfi
125677683534Smrgrm -f conftest.$ac_ext
125777683534Smrg
125877683534SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
12594ed31819SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
126077683534Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
126177683534Smrg	AC_MSG_RESULT([no])
126277683534Smrgelse
126377683534Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
126477683534Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
126577683534Smrg		AC_MSG_RESULT([yes])
126677683534Smrg	else
126777683534Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
126877683534Smrg	fi
126977683534Smrgfi
127077683534Smrgrm -f conftest.$ac_ext
127177683534SmrgAC_SUBST(RAWCPPFLAGS)
127277683534Smrg]) # XORG_PROG_RAWCPP
1273a8fdb4bcSmrg
127477683534Smrg# XORG_MANPAGE_SECTIONS()
127577683534Smrg# -----------------------
127677683534Smrg# Minimum version: 1.0.0
127777683534Smrg#
127877683534Smrg# Determine which sections man pages go in for the different man page types
127977683534Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
128077683534Smrg# Not sure if there's any better way than just hardcoding by OS name.
128177683534Smrg# Override default settings by setting environment variables
128277683534Smrg# Added MAN_SUBSTS in version 1.8
128377683534Smrg# Added AC_PROG_SED in version 1.8
1284a8fdb4bcSmrg
128577683534SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
128677683534SmrgAC_REQUIRE([AC_CANONICAL_HOST])
128777683534SmrgAC_REQUIRE([AC_PROG_SED])
1288a8fdb4bcSmrg
128977683534Smrgif test x$APP_MAN_SUFFIX = x    ; then
129077683534Smrg    APP_MAN_SUFFIX=1
129177683534Smrgfi
129277683534Smrgif test x$APP_MAN_DIR = x    ; then
129377683534Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
129477683534Smrgfi
1295a8fdb4bcSmrg
129677683534Smrgif test x$LIB_MAN_SUFFIX = x    ; then
129777683534Smrg    LIB_MAN_SUFFIX=3
129877683534Smrgfi
129977683534Smrgif test x$LIB_MAN_DIR = x    ; then
130077683534Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
130177683534Smrgfi
1302a8fdb4bcSmrg
130377683534Smrgif test x$FILE_MAN_SUFFIX = x    ; then
130477683534Smrg    case $host_os in
130577683534Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
130677683534Smrg	*)		FILE_MAN_SUFFIX=5  ;;
130777683534Smrg    esac
130877683534Smrgfi
130977683534Smrgif test x$FILE_MAN_DIR = x    ; then
131077683534Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1311a8fdb4bcSmrgfi
1312a8fdb4bcSmrg
131377683534Smrgif test x$MISC_MAN_SUFFIX = x    ; then
131477683534Smrg    case $host_os in
131577683534Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
131677683534Smrg	*)		MISC_MAN_SUFFIX=7  ;;
131777683534Smrg    esac
131877683534Smrgfi
131977683534Smrgif test x$MISC_MAN_DIR = x    ; then
132077683534Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
132177683534Smrgfi
1322a8fdb4bcSmrg
132377683534Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
132477683534Smrg    case $host_os in
132577683534Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
132677683534Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
132777683534Smrg    esac
132877683534Smrgfi
132977683534Smrgif test x$DRIVER_MAN_DIR = x    ; then
133077683534Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
133177683534Smrgfi
1332a8fdb4bcSmrg
133377683534Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
133477683534Smrg    case $host_os in
133577683534Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
133677683534Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
133777683534Smrg    esac
133877683534Smrgfi
133977683534Smrgif test x$ADMIN_MAN_DIR = x    ; then
134077683534Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
134177683534Smrgfi
1342a8fdb4bcSmrg
1343a8fdb4bcSmrg
134477683534SmrgAC_SUBST([APP_MAN_SUFFIX])
134577683534SmrgAC_SUBST([LIB_MAN_SUFFIX])
134677683534SmrgAC_SUBST([FILE_MAN_SUFFIX])
134777683534SmrgAC_SUBST([MISC_MAN_SUFFIX])
134877683534SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
134977683534SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
135077683534SmrgAC_SUBST([APP_MAN_DIR])
135177683534SmrgAC_SUBST([LIB_MAN_DIR])
135277683534SmrgAC_SUBST([FILE_MAN_DIR])
135377683534SmrgAC_SUBST([MISC_MAN_DIR])
135477683534SmrgAC_SUBST([DRIVER_MAN_DIR])
135577683534SmrgAC_SUBST([ADMIN_MAN_DIR])
1356a8fdb4bcSmrg
135777683534SmrgXORG_MAN_PAGE="X Version 11"
135877683534SmrgAC_SUBST([XORG_MAN_PAGE])
135977683534SmrgMAN_SUBSTS="\
136077683534Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
136177683534Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
136277683534Smrg	-e 's|__xservername__|Xorg|g' \
136377683534Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
136477683534Smrg	-e 's|__projectroot__|\$(prefix)|g' \
136577683534Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
136677683534Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
136777683534Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
136877683534Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
136977683534Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
137077683534Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
137177683534Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
137277683534SmrgAC_SUBST([MAN_SUBSTS])
1373a8fdb4bcSmrg
137477683534Smrg]) # XORG_MANPAGE_SECTIONS
1375a8fdb4bcSmrg
137677683534Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
137777683534Smrg# ------------------------
137877683534Smrg# Minimum version: 1.7.0
137977683534Smrg#
138077683534Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
138177683534Smrg# provided by xorg-sgml-doctools, if installed.
138277683534SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
138377683534SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
138477683534SmrgXORG_SGML_PATH=
138577683534SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
138677683534Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
138777683534Smrg    [m4_ifval([$1],[:],
138877683534Smrg        [if test x"$cross_compiling" != x"yes" ; then
138977683534Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
139077683534Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
139177683534Smrg         fi])
139277683534Smrg    ])
139377683534Smrg
139477683534Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
139577683534Smrg# the path and the name of the doc stylesheet
139677683534Smrgif test "x$XORG_SGML_PATH" != "x" ; then
139777683534Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
139877683534Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
139977683534Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
140077683534Smrgelse
140177683534Smrg   AC_MSG_RESULT([no])
140277683534Smrgfi
1403dbe7da2eSmrg
140477683534SmrgAC_SUBST(XORG_SGML_PATH)
140577683534SmrgAC_SUBST(STYLESHEET_SRCDIR)
140677683534SmrgAC_SUBST(XSL_STYLESHEET)
140777683534SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
140877683534Smrg]) # XORG_CHECK_SGML_DOCTOOLS
1409a8fdb4bcSmrg
141077683534Smrg# XORG_CHECK_LINUXDOC
141177683534Smrg# -------------------
141277683534Smrg# Minimum version: 1.0.0
141377683534Smrg#
141477683534Smrg# Defines the variable MAKE_TEXT if the necessary tools and
141577683534Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
141677683534Smrg# Whether or not the necessary tools and files are found can be checked
141777683534Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
141877683534SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
141977683534SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
142077683534SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1421a8fdb4bcSmrg
142277683534SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
142377683534Smrg
142477683534SmrgAC_MSG_CHECKING([whether to build documentation])
142577683534Smrg
142677683534Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
142777683534Smrg   BUILDDOC=yes
1428a8fdb4bcSmrgelse
142977683534Smrg   BUILDDOC=no
1430a8fdb4bcSmrgfi
1431a8fdb4bcSmrg
143277683534SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1433a8fdb4bcSmrg
143477683534SmrgAC_MSG_RESULT([$BUILDDOC])
1435a8fdb4bcSmrg
143677683534SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1437a8fdb4bcSmrg
143877683534Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
143977683534Smrg   BUILDPDFDOC=yes
144077683534Smrgelse
144177683534Smrg   BUILDPDFDOC=no
1442a8fdb4bcSmrgfi
1443a8fdb4bcSmrg
144477683534SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1445a8fdb4bcSmrg
144677683534SmrgAC_MSG_RESULT([$BUILDPDFDOC])
144777683534Smrg
144877683534SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
144977683534SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
145077683534SmrgMAKE_PDF="$PS2PDF"
145177683534SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
145277683534Smrg
145377683534SmrgAC_SUBST(MAKE_TEXT)
145477683534SmrgAC_SUBST(MAKE_PS)
145577683534SmrgAC_SUBST(MAKE_PDF)
145677683534SmrgAC_SUBST(MAKE_HTML)
145777683534Smrg]) # XORG_CHECK_LINUXDOC
145877683534Smrg
145977683534Smrg# XORG_CHECK_DOCBOOK
146077683534Smrg# -------------------
146177683534Smrg# Minimum version: 1.0.0
1462a8fdb4bcSmrg#
146377683534Smrg# Checks for the ability to build output formats from SGML DocBook source.
146477683534Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
146577683534Smrg# indicates whether the necessary tools and files are found and, if set,
146677683534Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
146777683534SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
146877683534SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1469a8fdb4bcSmrg
147077683534SmrgBUILDTXTDOC=no
147177683534SmrgBUILDPDFDOC=no
147277683534SmrgBUILDPSDOC=no
147377683534SmrgBUILDHTMLDOC=no
1474a8fdb4bcSmrg
147577683534SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
147677683534SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
147777683534SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
147877683534SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
147977683534Smrg
148077683534SmrgAC_MSG_CHECKING([whether to build text documentation])
148177683534Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
148277683534Smrg   test x$BUILD_TXTDOC != xno; then
148377683534Smrg	BUILDTXTDOC=yes
148477683534Smrgfi
148577683534SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
148677683534SmrgAC_MSG_RESULT([$BUILDTXTDOC])
148777683534Smrg
148877683534SmrgAC_MSG_CHECKING([whether to build PDF documentation])
148977683534Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
149077683534Smrg   test x$BUILD_PDFDOC != xno; then
149177683534Smrg	BUILDPDFDOC=yes
149277683534Smrgfi
149377683534SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
149477683534SmrgAC_MSG_RESULT([$BUILDPDFDOC])
149577683534Smrg
149677683534SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
149777683534Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
149877683534Smrg   test x$BUILD_PSDOC != xno; then
149977683534Smrg	BUILDPSDOC=yes
150077683534Smrgfi
150177683534SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
150277683534SmrgAC_MSG_RESULT([$BUILDPSDOC])
150377683534Smrg
150477683534SmrgAC_MSG_CHECKING([whether to build HTML documentation])
150577683534Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
150677683534Smrg   test x$BUILD_HTMLDOC != xno; then
150777683534Smrg	BUILDHTMLDOC=yes
150877683534Smrgfi
150977683534SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
151077683534SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
151177683534Smrg
151277683534SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
151377683534SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
151477683534SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
151577683534SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
151677683534Smrg
151777683534SmrgAC_SUBST(MAKE_TEXT)
151877683534SmrgAC_SUBST(MAKE_PS)
151977683534SmrgAC_SUBST(MAKE_PDF)
152077683534SmrgAC_SUBST(MAKE_HTML)
152177683534Smrg]) # XORG_CHECK_DOCBOOK
152277683534Smrg
15234ed31819Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
152477683534Smrg# ----------------
152577683534Smrg# Minimum version: 1.5.0
15264ed31819Smrg# Minimum version for optional DEFAULT argument: 1.11.0
152777683534Smrg#
152877683534Smrg# Documentation tools are not always available on all platforms and sometimes
152977683534Smrg# not at the appropriate level. This macro enables a module to test for the
153077683534Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
153177683534Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
15324ed31819Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
15334ed31819Smrg# --with-xmlto assumes 'auto'.
153477683534Smrg#
153577683534Smrg# Interface to module:
153677683534Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
153777683534Smrg# XMLTO:	returns the path of the xmlto program found
153877683534Smrg#		returns the path set by the user in the environment
153977683534Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
154077683534Smrg#		'no' user instructs the module not to use xmlto
154177683534Smrg#
154277683534Smrg# Added in version 1.10.0
154377683534Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
154477683534Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
154577683534Smrg#
154677683534Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
154777683534Smrg#
154877683534SmrgAC_DEFUN([XORG_WITH_XMLTO],[
154977683534SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
15504ed31819Smrgm4_define([_defopt], m4_default([$2], [auto]))
155177683534SmrgAC_ARG_WITH(xmlto,
155277683534Smrg	AS_HELP_STRING([--with-xmlto],
15534ed31819Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
15544ed31819Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
15554ed31819Smrgm4_undefine([_defopt])
1556a8fdb4bcSmrg
155777683534Smrgif test "x$use_xmlto" = x"auto"; then
155877683534Smrg   AC_PATH_PROG([XMLTO], [xmlto])
155977683534Smrg   if test "x$XMLTO" = "x"; then
156077683534Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
156177683534Smrg	have_xmlto=no
156277683534Smrg   else
156377683534Smrg        have_xmlto=yes
156477683534Smrg   fi
156577683534Smrgelif test "x$use_xmlto" = x"yes" ; then
156677683534Smrg   AC_PATH_PROG([XMLTO], [xmlto])
156777683534Smrg   if test "x$XMLTO" = "x"; then
156877683534Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
156977683534Smrg   fi
157077683534Smrg   have_xmlto=yes
157177683534Smrgelif test "x$use_xmlto" = x"no" ; then
157277683534Smrg   if test "x$XMLTO" != "x"; then
157377683534Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
157477683534Smrg   fi
157577683534Smrg   have_xmlto=no
157677683534Smrgelse
157777683534Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
157877683534Smrgfi
157977683534Smrg
158077683534Smrg# Test for a minimum version of xmlto, if provided.
158177683534Smrgm4_ifval([$1],
158277683534Smrg[if test "$have_xmlto" = yes; then
158377683534Smrg    # scrape the xmlto version
158477683534Smrg    AC_MSG_CHECKING([the xmlto version])
158577683534Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
158677683534Smrg    AC_MSG_RESULT([$xmlto_version])
158777683534Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
158877683534Smrg        [if test "x$use_xmlto" = xauto; then
158977683534Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
159077683534Smrg            have_xmlto=no
159177683534Smrg        else
159277683534Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
159377683534Smrg        fi])
159477683534Smrgfi])
159577683534Smrg
159677683534Smrg# Test for the ability of xmlto to generate a text target
159777683534Smrghave_xmlto_text=no
159877683534Smrgcat > conftest.xml << "EOF"
159977683534SmrgEOF
160077683534SmrgAS_IF([test "$have_xmlto" = yes],
160177683534Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
160277683534Smrg             [have_xmlto_text=yes],
160377683534Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
160477683534Smrgrm -f conftest.xml
160577683534SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
160677683534SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
160777683534Smrg]) # XORG_WITH_XMLTO
160877683534Smrg
16094ed31819Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
16104ed31819Smrg# --------------------------------------------
16114ed31819Smrg# Minimum version: 1.12.0
16124ed31819Smrg# Minimum version for optional DEFAULT argument: 1.12.0
16134ed31819Smrg#
16144ed31819Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
16154ed31819Smrg# XML-based language used for the transformation of XML documents.
16164ed31819Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
16174ed31819Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
16184ed31819Smrg# The XSLT processor is often used as a standalone tool for transformations.
16194ed31819Smrg# It should not be assumed that this tool is used only to work with documnetation.
16204ed31819Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
16214ed31819Smrg#
16224ed31819Smrg# Interface to module:
16234ed31819Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
16244ed31819Smrg# XSLTPROC:	 returns the path of the xsltproc program found
16254ed31819Smrg#		 returns the path set by the user in the environment
16264ed31819Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
16274ed31819Smrg#		  'no' user instructs the module not to use xsltproc
16284ed31819Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
16294ed31819Smrg#
16304ed31819Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
16314ed31819Smrg#
16324ed31819SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
16334ed31819SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
16344ed31819Smrg# Preserves the interface, should it be implemented later
16354ed31819Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
16364ed31819Smrgm4_define([_defopt], m4_default([$2], [auto]))
16374ed31819SmrgAC_ARG_WITH(xsltproc,
16384ed31819Smrg	AS_HELP_STRING([--with-xsltproc],
16394ed31819Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
16404ed31819Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
16414ed31819Smrgm4_undefine([_defopt])
16424ed31819Smrg
16434ed31819Smrgif test "x$use_xsltproc" = x"auto"; then
16444ed31819Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
16454ed31819Smrg   if test "x$XSLTPROC" = "x"; then
16464ed31819Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
16474ed31819Smrg	have_xsltproc=no
16484ed31819Smrg   else
16494ed31819Smrg        have_xsltproc=yes
16504ed31819Smrg   fi
16514ed31819Smrgelif test "x$use_xsltproc" = x"yes" ; then
16524ed31819Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
16534ed31819Smrg   if test "x$XSLTPROC" = "x"; then
16544ed31819Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
16554ed31819Smrg   fi
16564ed31819Smrg   have_xsltproc=yes
16574ed31819Smrgelif test "x$use_xsltproc" = x"no" ; then
16584ed31819Smrg   if test "x$XSLTPROC" != "x"; then
16594ed31819Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
16604ed31819Smrg   fi
16614ed31819Smrg   have_xsltproc=no
16624ed31819Smrgelse
16634ed31819Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
16644ed31819Smrgfi
16654ed31819Smrg
16664ed31819SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
16674ed31819Smrg]) # XORG_WITH_XSLTPROC
16684ed31819Smrg
16694ed31819Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
16704ed31819Smrg# ----------------------------------------
16714ed31819Smrg# Minimum version: 1.15.0
16724ed31819Smrg#
16734ed31819Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
16744ed31819Smrg# scanning arbitrary text files, extracting information from those text files,
16754ed31819Smrg# and printing reports based on that information.
16764ed31819Smrg#
16774ed31819Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
16784ed31819Smrg#
16794ed31819Smrg# Interface to module:
16804ed31819Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
16814ed31819Smrg# PERL:	     returns the path of the perl program found
16824ed31819Smrg#	     returns the path set by the user in the environment
16834ed31819Smrg# --with-perl: 'yes' user instructs the module to use perl
16844ed31819Smrg#	       'no' user instructs the module not to use perl
16854ed31819Smrg# have_perl: returns yes if perl found in PATH or no
16864ed31819Smrg#
16874ed31819Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
16884ed31819Smrg#
16894ed31819SmrgAC_DEFUN([XORG_WITH_PERL],[
16904ed31819SmrgAC_ARG_VAR([PERL], [Path to perl command])
16914ed31819Smrg# Preserves the interface, should it be implemented later
16924ed31819Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
16934ed31819Smrgm4_define([_defopt], m4_default([$2], [auto]))
16944ed31819SmrgAC_ARG_WITH(perl,
16954ed31819Smrg	AS_HELP_STRING([--with-perl],
16964ed31819Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
16974ed31819Smrg	   [use_perl=$withval], [use_perl=]_defopt)
16984ed31819Smrgm4_undefine([_defopt])
16994ed31819Smrg
17004ed31819Smrgif test "x$use_perl" = x"auto"; then
17014ed31819Smrg   AC_PATH_PROG([PERL], [perl])
17024ed31819Smrg   if test "x$PERL" = "x"; then
17034ed31819Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
17044ed31819Smrg	have_perl=no
17054ed31819Smrg   else
17064ed31819Smrg        have_perl=yes
17074ed31819Smrg   fi
17084ed31819Smrgelif test "x$use_perl" = x"yes" ; then
17094ed31819Smrg   AC_PATH_PROG([PERL], [perl])
17104ed31819Smrg   if test "x$PERL" = "x"; then
17114ed31819Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
17124ed31819Smrg   fi
17134ed31819Smrg   have_perl=yes
17144ed31819Smrgelif test "x$use_perl" = x"no" ; then
17154ed31819Smrg   if test "x$PERL" != "x"; then
17164ed31819Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
17174ed31819Smrg   fi
17184ed31819Smrg   have_perl=no
17194ed31819Smrgelse
17204ed31819Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
17214ed31819Smrgfi
17224ed31819Smrg
17234ed31819SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
17244ed31819Smrg]) # XORG_WITH_PERL
17254ed31819Smrg
17264ed31819Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
172777683534Smrg# ----------------
172877683534Smrg# Minimum version: 1.5.0
17294ed31819Smrg# Minimum version for optional DEFAULT argument: 1.11.0
173077683534Smrg#
173177683534Smrg# Documentation tools are not always available on all platforms and sometimes
173277683534Smrg# not at the appropriate level. This macro enables a module to test for the
173377683534Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
173477683534Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
17354ed31819Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
17364ed31819Smrg# --with-asciidoc assumes 'auto'.
173777683534Smrg#
173877683534Smrg# Interface to module:
173977683534Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
174077683534Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
174177683534Smrg#		 returns the path set by the user in the environment
174277683534Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
174377683534Smrg#		  'no' user instructs the module not to use asciidoc
174477683534Smrg#
174577683534Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
174677683534Smrg#
174777683534SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
174877683534SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
17494ed31819Smrgm4_define([_defopt], m4_default([$2], [auto]))
175077683534SmrgAC_ARG_WITH(asciidoc,
175177683534Smrg	AS_HELP_STRING([--with-asciidoc],
17524ed31819Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
17534ed31819Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
17544ed31819Smrgm4_undefine([_defopt])
175577683534Smrg
175677683534Smrgif test "x$use_asciidoc" = x"auto"; then
175777683534Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
175877683534Smrg   if test "x$ASCIIDOC" = "x"; then
175977683534Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
176077683534Smrg	have_asciidoc=no
176177683534Smrg   else
176277683534Smrg        have_asciidoc=yes
176377683534Smrg   fi
176477683534Smrgelif test "x$use_asciidoc" = x"yes" ; then
176577683534Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
176677683534Smrg   if test "x$ASCIIDOC" = "x"; then
176777683534Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
176877683534Smrg   fi
176977683534Smrg   have_asciidoc=yes
177077683534Smrgelif test "x$use_asciidoc" = x"no" ; then
177177683534Smrg   if test "x$ASCIIDOC" != "x"; then
177277683534Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
177377683534Smrg   fi
177477683534Smrg   have_asciidoc=no
177577683534Smrgelse
177677683534Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
177777683534Smrgfi
177877683534Smrgm4_ifval([$1],
177977683534Smrg[if test "$have_asciidoc" = yes; then
178077683534Smrg    # scrape the asciidoc version
178177683534Smrg    AC_MSG_CHECKING([the asciidoc version])
178277683534Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
178377683534Smrg    AC_MSG_RESULT([$asciidoc_version])
178477683534Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
178577683534Smrg        [if test "x$use_asciidoc" = xauto; then
178677683534Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
178777683534Smrg            have_asciidoc=no
178877683534Smrg        else
178977683534Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
179077683534Smrg        fi])
179177683534Smrgfi])
179277683534SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
179377683534Smrg]) # XORG_WITH_ASCIIDOC
1794a8fdb4bcSmrg
17954ed31819Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
179677683534Smrg# --------------------------------
179777683534Smrg# Minimum version: 1.5.0
17984ed31819Smrg# Minimum version for optional DEFAULT argument: 1.11.0
1799a8fdb4bcSmrg#
180077683534Smrg# Documentation tools are not always available on all platforms and sometimes
180177683534Smrg# not at the appropriate level. This macro enables a module to test for the
180277683534Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
180377683534Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
18044ed31819Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
18054ed31819Smrg# --with-doxygen assumes 'auto'.
1806a8fdb4bcSmrg#
180777683534Smrg# Interface to module:
180877683534Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
180977683534Smrg# DOXYGEN:	 returns the path of the doxygen program found
181077683534Smrg#		 returns the path set by the user in the environment
181177683534Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
181277683534Smrg#		  'no' user instructs the module not to use doxygen
1813a8fdb4bcSmrg#
181477683534Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
181577683534Smrg#
181677683534SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
181777683534SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
18184ed31819Smrgm4_define([_defopt], m4_default([$2], [auto]))
181977683534SmrgAC_ARG_WITH(doxygen,
182077683534Smrg	AS_HELP_STRING([--with-doxygen],
18214ed31819Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
18224ed31819Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
18234ed31819Smrgm4_undefine([_defopt])
1824a8fdb4bcSmrg
182577683534Smrgif test "x$use_doxygen" = x"auto"; then
182677683534Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
182777683534Smrg   if test "x$DOXYGEN" = "x"; then
182877683534Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
182977683534Smrg	have_doxygen=no
183077683534Smrg   else
183177683534Smrg        have_doxygen=yes
183277683534Smrg   fi
183377683534Smrgelif test "x$use_doxygen" = x"yes" ; then
183477683534Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
183577683534Smrg   if test "x$DOXYGEN" = "x"; then
183677683534Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
183777683534Smrg   fi
183877683534Smrg   have_doxygen=yes
183977683534Smrgelif test "x$use_doxygen" = x"no" ; then
184077683534Smrg   if test "x$DOXYGEN" != "x"; then
184177683534Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
184277683534Smrg   fi
184377683534Smrg   have_doxygen=no
184477683534Smrgelse
184577683534Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1846a8fdb4bcSmrgfi
184777683534Smrgm4_ifval([$1],
184877683534Smrg[if test "$have_doxygen" = yes; then
184977683534Smrg    # scrape the doxygen version
185077683534Smrg    AC_MSG_CHECKING([the doxygen version])
185177683534Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
185277683534Smrg    AC_MSG_RESULT([$doxygen_version])
185377683534Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
185477683534Smrg        [if test "x$use_doxygen" = xauto; then
185577683534Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
185677683534Smrg            have_doxygen=no
185777683534Smrg        else
185877683534Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
185977683534Smrg        fi])
186077683534Smrgfi])
186177683534SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
186277683534Smrg]) # XORG_WITH_DOXYGEN
1863a8fdb4bcSmrg
18644ed31819Smrg# XORG_WITH_GROFF([DEFAULT])
186577683534Smrg# ----------------
186677683534Smrg# Minimum version: 1.6.0
18674ed31819Smrg# Minimum version for optional DEFAULT argument: 1.11.0
186877683534Smrg#
186977683534Smrg# Documentation tools are not always available on all platforms and sometimes
187077683534Smrg# not at the appropriate level. This macro enables a module to test for the
187177683534Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
187277683534Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
18734ed31819Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
18744ed31819Smrg# --with-groff assumes 'auto'.
187577683534Smrg#
187677683534Smrg# Interface to module:
187777683534Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
187877683534Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
187977683534Smrg# HAVE_GROFF_MS: the -ms macros package
188077683534Smrg# GROFF:	 returns the path of the groff program found
188177683534Smrg#		 returns the path set by the user in the environment
188277683534Smrg# --with-groff:	 'yes' user instructs the module to use groff
188377683534Smrg#		 'no' user instructs the module not to use groff
188477683534Smrg#
188577683534Smrg# Added in version 1.9.0:
188677683534Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
188777683534Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
188877683534Smrg#		   psselect from the psutils package.
188977683534Smrg#		   the ghostcript package. Refer to the grohtml man pages
189077683534Smrg#
189177683534Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
189277683534Smrg#
189377683534Smrg# OS and distros often splits groff in a basic and full package, the former
189477683534Smrg# having the groff program and the later having devices, fonts and macros
189577683534Smrg# Checking for the groff executable is not enough.
189677683534Smrg#
189777683534Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
189877683534Smrg# unset HAVE_GROFF or GROFF env variables.
189977683534Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
190077683534Smrg#
190177683534SmrgAC_DEFUN([XORG_WITH_GROFF],[
190277683534SmrgAC_ARG_VAR([GROFF], [Path to groff command])
19034ed31819Smrgm4_define([_defopt], m4_default([$1], [auto]))
190477683534SmrgAC_ARG_WITH(groff,
190577683534Smrg	AS_HELP_STRING([--with-groff],
19064ed31819Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
19074ed31819Smrg	   [use_groff=$withval], [use_groff=]_defopt)
19084ed31819Smrgm4_undefine([_defopt])
190977683534Smrg
191077683534Smrgif test "x$use_groff" = x"auto"; then
191177683534Smrg   AC_PATH_PROG([GROFF], [groff])
191277683534Smrg   if test "x$GROFF" = "x"; then
191377683534Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
191477683534Smrg	have_groff=no
191577683534Smrg   else
191677683534Smrg        have_groff=yes
191777683534Smrg   fi
191877683534Smrgelif test "x$use_groff" = x"yes" ; then
191977683534Smrg   AC_PATH_PROG([GROFF], [groff])
192077683534Smrg   if test "x$GROFF" = "x"; then
192177683534Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
192277683534Smrg   fi
192377683534Smrg   have_groff=yes
192477683534Smrgelif test "x$use_groff" = x"no" ; then
192577683534Smrg   if test "x$GROFF" != "x"; then
192677683534Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
192777683534Smrg   fi
192877683534Smrg   have_groff=no
192977683534Smrgelse
193077683534Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
1931a8fdb4bcSmrgfi
1932dbe7da2eSmrg
193377683534Smrg# We have groff, test for the presence of the macro packages
193477683534Smrgif test "x$have_groff" = x"yes"; then
193577683534Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
193677683534Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
193777683534Smrg        groff_ms_works=yes
193877683534Smrg    else
193977683534Smrg        groff_ms_works=no
194077683534Smrg    fi
194177683534Smrg    AC_MSG_RESULT([$groff_ms_works])
194277683534Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
194377683534Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
194477683534Smrg        groff_mm_works=yes
194577683534Smrg    else
194677683534Smrg        groff_mm_works=no
194777683534Smrg    fi
194877683534Smrg    AC_MSG_RESULT([$groff_mm_works])
194977683534Smrgfi
1950a8fdb4bcSmrg
195177683534Smrg# We have groff, test for HTML dependencies, one command per package
195277683534Smrgif test "x$have_groff" = x"yes"; then
195377683534Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
195477683534Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
195577683534Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
195677683534Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
195777683534Smrg      have_groff_html=yes
195877683534Smrg   else
195977683534Smrg      have_groff_html=no
196077683534Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
196177683534Smrg   fi
196277683534Smrgfi
1963a8fdb4bcSmrg
196477683534Smrg# Set Automake conditionals for Makefiles
196577683534SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
196677683534SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
196777683534SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
196877683534SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
196977683534Smrg]) # XORG_WITH_GROFF
1970a8fdb4bcSmrg
19714ed31819Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
19724ed31819Smrg# ---------------------------------------
197377683534Smrg# Minimum version: 1.6.0
19744ed31819Smrg# Minimum version for optional DEFAULT argument: 1.11.0
19754ed31819Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
1976a8fdb4bcSmrg#
197777683534Smrg# Documentation tools are not always available on all platforms and sometimes
197877683534Smrg# not at the appropriate level. This macro enables a module to test for the
197977683534Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
198077683534Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
19814ed31819Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
19824ed31819Smrg# --with-fop assumes 'auto'.
198377683534Smrg#
198477683534Smrg# Interface to module:
198577683534Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
198677683534Smrg# FOP:	 	returns the path of the fop program found
198777683534Smrg#		returns the path set by the user in the environment
198877683534Smrg# --with-fop: 	'yes' user instructs the module to use fop
198977683534Smrg#		'no' user instructs the module not to use fop
199077683534Smrg#
199177683534Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
199277683534Smrg#
199377683534SmrgAC_DEFUN([XORG_WITH_FOP],[
199477683534SmrgAC_ARG_VAR([FOP], [Path to fop command])
19954ed31819Smrgm4_define([_defopt], m4_default([$2], [auto]))
199677683534SmrgAC_ARG_WITH(fop,
199777683534Smrg	AS_HELP_STRING([--with-fop],
19984ed31819Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
19994ed31819Smrg	   [use_fop=$withval], [use_fop=]_defopt)
20004ed31819Smrgm4_undefine([_defopt])
200177683534Smrg
200277683534Smrgif test "x$use_fop" = x"auto"; then
200377683534Smrg   AC_PATH_PROG([FOP], [fop])
200477683534Smrg   if test "x$FOP" = "x"; then
200577683534Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
200677683534Smrg	have_fop=no
200777683534Smrg   else
200877683534Smrg        have_fop=yes
200977683534Smrg   fi
201077683534Smrgelif test "x$use_fop" = x"yes" ; then
201177683534Smrg   AC_PATH_PROG([FOP], [fop])
201277683534Smrg   if test "x$FOP" = "x"; then
201377683534Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
201477683534Smrg   fi
201577683534Smrg   have_fop=yes
201677683534Smrgelif test "x$use_fop" = x"no" ; then
201777683534Smrg   if test "x$FOP" != "x"; then
201877683534Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
201977683534Smrg   fi
202077683534Smrg   have_fop=no
202177683534Smrgelse
202277683534Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2023dbe7da2eSmrgfi
20244ed31819Smrg
20254ed31819Smrg# Test for a minimum version of fop, if provided.
20264ed31819Smrgm4_ifval([$1],
20274ed31819Smrg[if test "$have_fop" = yes; then
20284ed31819Smrg    # scrape the fop version
20294ed31819Smrg    AC_MSG_CHECKING([for fop minimum version])
20304ed31819Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
20314ed31819Smrg    AC_MSG_RESULT([$fop_version])
20324ed31819Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
20334ed31819Smrg        [if test "x$use_fop" = xauto; then
20344ed31819Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
20354ed31819Smrg            have_fop=no
20364ed31819Smrg        else
20374ed31819Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
20384ed31819Smrg        fi])
20394ed31819Smrgfi])
204077683534SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
204177683534Smrg]) # XORG_WITH_FOP
2042a8fdb4bcSmrg
20434ed31819Smrg# XORG_WITH_PS2PDF([DEFAULT])
204477683534Smrg# ----------------
204577683534Smrg# Minimum version: 1.6.0
20464ed31819Smrg# Minimum version for optional DEFAULT argument: 1.11.0
2047a8fdb4bcSmrg#
204877683534Smrg# Documentation tools are not always available on all platforms and sometimes
204977683534Smrg# not at the appropriate level. This macro enables a module to test for the
205077683534Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
205177683534Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
20524ed31819Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
20534ed31819Smrg# --with-ps2pdf assumes 'auto'.
205477683534Smrg#
205577683534Smrg# Interface to module:
205677683534Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
205777683534Smrg# PS2PDF:	returns the path of the ps2pdf program found
205877683534Smrg#		returns the path set by the user in the environment
205977683534Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
206077683534Smrg#		 'no' user instructs the module not to use ps2pdf
206177683534Smrg#
206277683534Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
206377683534Smrg#
206477683534SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
206577683534SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
20664ed31819Smrgm4_define([_defopt], m4_default([$1], [auto]))
206777683534SmrgAC_ARG_WITH(ps2pdf,
206877683534Smrg	AS_HELP_STRING([--with-ps2pdf],
20694ed31819Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
20704ed31819Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
20714ed31819Smrgm4_undefine([_defopt])
207277683534Smrg
207377683534Smrgif test "x$use_ps2pdf" = x"auto"; then
207477683534Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
207577683534Smrg   if test "x$PS2PDF" = "x"; then
207677683534Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
207777683534Smrg	have_ps2pdf=no
207877683534Smrg   else
207977683534Smrg        have_ps2pdf=yes
208077683534Smrg   fi
208177683534Smrgelif test "x$use_ps2pdf" = x"yes" ; then
208277683534Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
208377683534Smrg   if test "x$PS2PDF" = "x"; then
208477683534Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
208577683534Smrg   fi
208677683534Smrg   have_ps2pdf=yes
208777683534Smrgelif test "x$use_ps2pdf" = x"no" ; then
208877683534Smrg   if test "x$PS2PDF" != "x"; then
208977683534Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
209077683534Smrg   fi
209177683534Smrg   have_ps2pdf=no
2092a8fdb4bcSmrgelse
209377683534Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2094a8fdb4bcSmrgfi
209577683534SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
209677683534Smrg]) # XORG_WITH_PS2PDF
2097a8fdb4bcSmrg
209877683534Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
209977683534Smrg# ----------------
210077683534Smrg# Minimum version: 1.6.0
2101a8fdb4bcSmrg#
210277683534Smrg# Documentation tools are not always available on all platforms and sometimes
210377683534Smrg# not at the appropriate level. This macro enables a builder to skip all
210477683534Smrg# documentation targets except traditional man pages.
210577683534Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
210677683534Smrg# maximum flexibilty in controlling documentation building.
210777683534Smrg# Refer to:
210877683534Smrg# XORG_WITH_XMLTO         --with-xmlto
210977683534Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
211077683534Smrg# XORG_WITH_DOXYGEN       --with-doxygen
211177683534Smrg# XORG_WITH_FOP           --with-fop
211277683534Smrg# XORG_WITH_GROFF         --with-groff
211377683534Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
211477683534Smrg#
211577683534Smrg# Interface to module:
211677683534Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
211777683534Smrg# --enable-docs: 'yes' user instructs the module to generate docs
211877683534Smrg#		 'no' user instructs the module not to generate docs
211977683534Smrg# parm1:	specify the default value, yes or no.
212077683534Smrg#
212177683534SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
21224ed31819Smrgm4_define([docs_default], m4_default([$1], [yes]))
212377683534SmrgAC_ARG_ENABLE(docs,
212477683534Smrg	AS_HELP_STRING([--enable-docs],
21254ed31819Smrg	   [Enable building the documentation (default: ]docs_default[)]),
21264ed31819Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
21274ed31819Smrgm4_undefine([docs_default])
212877683534SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
212977683534SmrgAC_MSG_CHECKING([whether to build documentation])
213077683534SmrgAC_MSG_RESULT([$build_docs])
213177683534Smrg]) # XORG_ENABLE_DOCS
213277683534Smrg
213377683534Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
213477683534Smrg# ----------------
213577683534Smrg# Minimum version: 1.6.0
213677683534Smrg#
213777683534Smrg# This macro enables a builder to skip all developer documentation.
213877683534Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
213977683534Smrg# maximum flexibilty in controlling documentation building.
214077683534Smrg# Refer to:
214177683534Smrg# XORG_WITH_XMLTO         --with-xmlto
214277683534Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
214377683534Smrg# XORG_WITH_DOXYGEN       --with-doxygen
214477683534Smrg# XORG_WITH_FOP           --with-fop
214577683534Smrg# XORG_WITH_GROFF         --with-groff
214677683534Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
214777683534Smrg#
214877683534Smrg# Interface to module:
214977683534Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
215077683534Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
215177683534Smrg#			'no' user instructs the module not to generate developer docs
215277683534Smrg# parm1:		specify the default value, yes or no.
215377683534Smrg#
215477683534SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
21554ed31819Smrgm4_define([devel_default], m4_default([$1], [yes]))
215677683534SmrgAC_ARG_ENABLE(devel-docs,
215777683534Smrg	AS_HELP_STRING([--enable-devel-docs],
21584ed31819Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
21594ed31819Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
21604ed31819Smrgm4_undefine([devel_default])
216177683534SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
216277683534SmrgAC_MSG_CHECKING([whether to build developer documentation])
216377683534SmrgAC_MSG_RESULT([$build_devel_docs])
216477683534Smrg]) # XORG_ENABLE_DEVEL_DOCS
216577683534Smrg
216677683534Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
216777683534Smrg# ----------------
216877683534Smrg# Minimum version: 1.6.0
216977683534Smrg#
217077683534Smrg# This macro enables a builder to skip all functional specification targets.
217177683534Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
217277683534Smrg# maximum flexibilty in controlling documentation building.
217377683534Smrg# Refer to:
217477683534Smrg# XORG_WITH_XMLTO         --with-xmlto
217577683534Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
217677683534Smrg# XORG_WITH_DOXYGEN       --with-doxygen
217777683534Smrg# XORG_WITH_FOP           --with-fop
217877683534Smrg# XORG_WITH_GROFF         --with-groff
217977683534Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
218077683534Smrg#
218177683534Smrg# Interface to module:
218277683534Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
218377683534Smrg# --enable-specs:	'yes' user instructs the module to generate specs
218477683534Smrg#			'no' user instructs the module not to generate specs
218577683534Smrg# parm1:		specify the default value, yes or no.
218677683534Smrg#
218777683534SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
21884ed31819Smrgm4_define([spec_default], m4_default([$1], [yes]))
218977683534SmrgAC_ARG_ENABLE(specs,
219077683534Smrg	AS_HELP_STRING([--enable-specs],
21914ed31819Smrg	   [Enable building the specs (default: ]spec_default[)]),
21924ed31819Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
21934ed31819Smrgm4_undefine([spec_default])
219477683534SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
219577683534SmrgAC_MSG_CHECKING([whether to build functional specifications])
219677683534SmrgAC_MSG_RESULT([$build_specs])
219777683534Smrg]) # XORG_ENABLE_SPECS
2198a8fdb4bcSmrg
21994ed31819Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
22004ed31819Smrg# ----------------------------------------------
22014ed31819Smrg# Minimum version: 1.13.0
22024ed31819Smrg#
22034ed31819Smrg# This macro enables a builder to enable/disable unit testing
22044ed31819Smrg# It makes no assumption about the test cases implementation
22054ed31819Smrg# Test cases may or may not use Automake "Support for test suites"
22064ed31819Smrg# They may or may not use the software utility library GLib
22074ed31819Smrg#
22084ed31819Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
22094ed31819Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
22104ed31819Smrg# The variable enable_unit_tests is used by other macros in this file.
22114ed31819Smrg#
22124ed31819Smrg# Interface to module:
22134ed31819Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
22144ed31819Smrg# enable_unit_tests:    used in configure.ac for additional configuration
22154ed31819Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
22164ed31819Smrg#			'no' user instructs the module not to build tests
22174ed31819Smrg# parm1:		specify the default value, yes or no.
22184ed31819Smrg#
22194ed31819SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
22204ed31819SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
22214ed31819SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
22224ed31819SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
22234ed31819Smrgm4_define([_defopt], m4_default([$1], [auto]))
22244ed31819SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
22254ed31819Smrg	[Enable building unit test cases (default: ]_defopt[)]),
22264ed31819Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
22274ed31819Smrgm4_undefine([_defopt])
22284ed31819SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
22294ed31819SmrgAC_MSG_CHECKING([whether to build unit test cases])
22304ed31819SmrgAC_MSG_RESULT([$enable_unit_tests])
22314ed31819Smrg]) # XORG_ENABLE_UNIT_TESTS
22324ed31819Smrg
22334ed31819Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
22344ed31819Smrg# ------------------------------------------------------
22354ed31819Smrg# Minimum version: 1.17.0
22364ed31819Smrg#
22374ed31819Smrg# This macro enables a builder to enable/disable integration testing
22384ed31819Smrg# It makes no assumption about the test cases' implementation
22394ed31819Smrg# Test cases may or may not use Automake "Support for test suites"
22404ed31819Smrg#
22414ed31819Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
22424ed31819Smrg# usually requires less dependencies and may be built and run under less
22434ed31819Smrg# stringent environments than integration tests.
22444ed31819Smrg#
22454ed31819Smrg# Interface to module:
22464ed31819Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
22474ed31819Smrg# enable_integration_tests:   used in configure.ac for additional configuration
22484ed31819Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
22494ed31819Smrg#                             'no' user instructs the module not to build tests
22504ed31819Smrg# parm1:                      specify the default value, yes or no.
22514ed31819Smrg#
22524ed31819SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
22534ed31819SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
22544ed31819Smrgm4_define([_defopt], m4_default([$1], [auto]))
22554ed31819SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
22564ed31819Smrg	[Enable building integration test cases (default: ]_defopt[)]),
22574ed31819Smrg	[enable_integration_tests=$enableval],
22584ed31819Smrg	[enable_integration_tests=]_defopt)
22594ed31819Smrgm4_undefine([_defopt])
22604ed31819SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
22614ed31819Smrg	[test "x$enable_integration_tests" != xno])
22624ed31819SmrgAC_MSG_CHECKING([whether to build unit test cases])
22634ed31819SmrgAC_MSG_RESULT([$enable_integration_tests])
22644ed31819Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
22654ed31819Smrg
22664ed31819Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
22674ed31819Smrg# ----------------------------------------
22684ed31819Smrg# Minimum version: 1.13.0
22694ed31819Smrg#
22704ed31819Smrg# GLib is a library which provides advanced data structures and functions.
22714ed31819Smrg# This macro enables a module to test for the presence of Glib.
22724ed31819Smrg#
22734ed31819Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
22744ed31819Smrg# Otherwise the value of $enable_unit_tests is blank.
22754ed31819Smrg#
22764ed31819Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
22774ed31819Smrg# test support usually requires less dependencies and may be built and run under
22784ed31819Smrg# less stringent environments than integration tests.
22794ed31819Smrg#
22804ed31819Smrg# Interface to module:
22814ed31819Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
22824ed31819Smrg# with_glib: used in configure.ac to know if GLib has been found
22834ed31819Smrg# --with-glib:	'yes' user instructs the module to use glib
22844ed31819Smrg#		'no' user instructs the module not to use glib
22854ed31819Smrg#
22864ed31819SmrgAC_DEFUN([XORG_WITH_GLIB],[
22874ed31819SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
22884ed31819Smrgm4_define([_defopt], m4_default([$2], [auto]))
22894ed31819SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
22904ed31819Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
22914ed31819Smrg	[with_glib=$withval], [with_glib=]_defopt)
22924ed31819Smrgm4_undefine([_defopt])
22934ed31819Smrg
22944ed31819Smrghave_glib=no
22954ed31819Smrg# Do not probe GLib if user explicitly disabled unit testing
22964ed31819Smrgif test "x$enable_unit_tests" != x"no"; then
22974ed31819Smrg  # Do not probe GLib if user explicitly disabled it
22984ed31819Smrg  if test "x$with_glib" != x"no"; then
22994ed31819Smrg    m4_ifval(
23004ed31819Smrg      [$1],
23014ed31819Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
23024ed31819Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
23034ed31819Smrg    )
23044ed31819Smrg  fi
23054ed31819Smrgfi
23064ed31819Smrg
23074ed31819Smrg# Not having GLib when unit testing has been explicitly requested is an error
23084ed31819Smrgif test "x$enable_unit_tests" = x"yes"; then
23094ed31819Smrg  if test "x$have_glib" = x"no"; then
23104ed31819Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
23114ed31819Smrg  fi
23124ed31819Smrgfi
23134ed31819Smrg
23144ed31819Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
23154ed31819Smrgif test "x$enable_unit_tests" = x"no"; then
23164ed31819Smrg  if test "x$with_glib" = x"yes"; then
23174ed31819Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
23184ed31819Smrg  fi
23194ed31819Smrgfi
23204ed31819Smrg
23214ed31819Smrg# Not having GLib when it has been explicitly requested is an error
23224ed31819Smrgif test "x$with_glib" = x"yes"; then
23234ed31819Smrg  if test "x$have_glib" = x"no"; then
23244ed31819Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
23254ed31819Smrg  fi
23264ed31819Smrgfi
23274ed31819Smrg
23284ed31819SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
23294ed31819Smrg]) # XORG_WITH_GLIB
23304ed31819Smrg
23314ed31819Smrg# XORG_LD_WRAP([required|optional])
23324ed31819Smrg# ---------------------------------
23334ed31819Smrg# Minimum version: 1.13.0
23344ed31819Smrg#
23354ed31819Smrg# Check if linker supports -wrap, passed via compiler flags
23364ed31819Smrg#
23374ed31819Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
23384ed31819Smrg# Otherwise the value of $enable_unit_tests is blank.
23394ed31819Smrg#
23404ed31819Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
23414ed31819Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
23424ed31819Smrg# available, an argument of "optional" allows use when some unit tests require
23434ed31819Smrg# ld -wrap and others do not.
23444ed31819Smrg#
23454ed31819SmrgAC_DEFUN([XORG_LD_WRAP],[
23464ed31819SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
23474ed31819Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
23484ed31819Smrg                      void __wrap_exit(int status) { return; }],
23494ed31819Smrg                     [exit(0);])])
23504ed31819Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
23514ed31819Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
23524ed31819Smrg  if test "x$have_ld_wrap" = x"no"; then
23534ed31819Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
23544ed31819Smrg  fi
23554ed31819Smrgfi
23564ed31819SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
23574ed31819Smrg#
23584ed31819Smrg]) # XORG_LD_WRAP
23594ed31819Smrg
23604ed31819Smrg# XORG_CHECK_LINKER_FLAGS
23614ed31819Smrg# -----------------------
23624ed31819Smrg# SYNOPSIS
23634ed31819Smrg#
23644ed31819Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
23654ed31819Smrg#
23664ed31819Smrg# DESCRIPTION
23674ed31819Smrg#
23684ed31819Smrg#   Check whether the given linker FLAGS work with the current language's
23694ed31819Smrg#   linker, or whether they give an error.
23704ed31819Smrg#
23714ed31819Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
23724ed31819Smrg#   success/failure.
23734ed31819Smrg#
23744ed31819Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
23754ed31819Smrg#
23764ed31819Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
23774ed31819Smrg#
23784ed31819Smrg# LICENSE
23794ed31819Smrg#
23804ed31819Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
23814ed31819Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
23824ed31819Smrg#   Copyright (c) 2009 Matteo Frigo
23834ed31819Smrg#
23844ed31819Smrg#   This program is free software: you can redistribute it and/or modify it
23854ed31819Smrg#   under the terms of the GNU General Public License as published by the
23864ed31819Smrg#   Free Software Foundation, either version 3 of the License, or (at your
23874ed31819Smrg#   option) any later version.
23884ed31819Smrg#
23894ed31819Smrg#   This program is distributed in the hope that it will be useful, but
23904ed31819Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
23914ed31819Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
23924ed31819Smrg#   Public License for more details.
23934ed31819Smrg#
23944ed31819Smrg#   You should have received a copy of the GNU General Public License along
23954ed31819Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
23964ed31819Smrg#
23974ed31819Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
23984ed31819Smrg#   gives unlimited permission to copy, distribute and modify the configure
23994ed31819Smrg#   scripts that are the output of Autoconf when processing the Macro. You
24004ed31819Smrg#   need not follow the terms of the GNU General Public License when using
24014ed31819Smrg#   or distributing such scripts, even though portions of the text of the
24024ed31819Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
24034ed31819Smrg#   all other use of the material that constitutes the Autoconf Macro.
24044ed31819Smrg#
24054ed31819Smrg#   This special exception to the GPL applies to versions of the Autoconf
24064ed31819Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
24074ed31819Smrg#   modified version of the Autoconf Macro, you may extend this special
24084ed31819Smrg#   exception to the GPL to apply to your modified version as well.#
24094ed31819SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
24104ed31819Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
24114ed31819Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
24124ed31819SmrgAS_LITERAL_IF([$1],
24134ed31819Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
24144ed31819Smrg      ax_save_FLAGS=$LDFLAGS
24154ed31819Smrg      LDFLAGS="$1"
24164ed31819Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
24174ed31819Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
24184ed31819Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
24194ed31819Smrg      LDFLAGS=$ax_save_FLAGS])],
24204ed31819Smrg  [ax_save_FLAGS=$LDFLAGS
24214ed31819Smrg   LDFLAGS="$1"
24224ed31819Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
24234ed31819Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
24244ed31819Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
24254ed31819Smrg   LDFLAGS=$ax_save_FLAGS])
24264ed31819Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
24274ed31819SmrgAC_MSG_RESULT($xorg_check_linker_flags)
24284ed31819Smrgif test "x$xorg_check_linker_flags" = xyes; then
24294ed31819Smrg	m4_default([$2], :)
24304ed31819Smrgelse
24314ed31819Smrg	m4_default([$3], :)
24324ed31819Smrgfi
24334ed31819Smrg]) # XORG_CHECK_LINKER_FLAGS
24344ed31819Smrg
24354ed31819Smrg# XORG_MEMORY_CHECK_FLAGS
24364ed31819Smrg# -----------------------
24374ed31819Smrg# Minimum version: 1.16.0
24384ed31819Smrg#
24394ed31819Smrg# This macro attempts to find appropriate memory checking functionality
24404ed31819Smrg# for various platforms which unit testing code may use to catch various
24414ed31819Smrg# forms of memory allocation and access errors in testing.
24424ed31819Smrg#
24434ed31819Smrg# Interface to module:
24444ed31819Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
24454ed31819Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
24464ed31819Smrg#
24474ed31819Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
24484ed31819Smrg#
24494ed31819SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
24504ed31819Smrg
24514ed31819SmrgAC_REQUIRE([AC_CANONICAL_HOST])
24524ed31819SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
24534ed31819Smrg           [Environment variables to enable memory checking in tests])
24544ed31819Smrg
24554ed31819Smrg# Check for different types of support on different platforms
24564ed31819Smrgcase $host_os in
24574ed31819Smrg    solaris*)
24584ed31819Smrg        AC_CHECK_LIB([umem], [umem_alloc],
24594ed31819Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
24604ed31819Smrg        ;;
24614ed31819Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
24624ed31819Smrg        # both directly and inverted, so should not be 0 or 255.
24634ed31819Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
24644ed31819Smrg        ;;
24654ed31819Smrg    darwin*)
24664ed31819Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
24674ed31819Smrg        ;;
24684ed31819Smrg    *bsd*)
24694ed31819Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
24704ed31819Smrg        ;;
24714ed31819Smrgesac
24724ed31819Smrg
24734ed31819Smrg# User supplied flags override default flags
24744ed31819Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
24754ed31819Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
24764ed31819Smrgfi
24774ed31819Smrg
24784ed31819SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
24794ed31819Smrg]) # XORG_WITH_LINT
24804ed31819Smrg
248177683534Smrg# XORG_CHECK_MALLOC_ZERO
248277683534Smrg# ----------------------
248377683534Smrg# Minimum version: 1.0.0
2484a8fdb4bcSmrg#
248577683534Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
248677683534Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
248777683534Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
248877683534SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
248977683534SmrgAC_ARG_ENABLE(malloc0returnsnull,
249077683534Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
249177683534Smrg		       [malloc(0) returns NULL (default: auto)]),
249277683534Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
249377683534Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2494a8fdb4bcSmrg
249577683534SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
249677683534Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
24974ed31819Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
24984ed31819Smrg#include <stdlib.h>
24994ed31819Smrg],[
250077683534Smrg    char *m0, *r0, *c0, *p;
250177683534Smrg    m0 = malloc(0);
250277683534Smrg    p = malloc(10);
250377683534Smrg    r0 = realloc(p,0);
25044ed31819Smrg    c0 = calloc(0,10);
25054ed31819Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
25064ed31819Smrg])],
250777683534Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
250877683534Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
250977683534Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
251077683534Smrgfi
251177683534SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2512a8fdb4bcSmrg
251377683534Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
251477683534Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
251577683534Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
251677683534Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
251777683534Smrgelse
251877683534Smrg	MALLOC_ZERO_CFLAGS=""
251977683534Smrg	XMALLOC_ZERO_CFLAGS=""
252077683534Smrg	XTMALLOC_ZERO_CFLAGS=""
2521a8fdb4bcSmrgfi
2522a8fdb4bcSmrg
252377683534SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
252477683534SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
252577683534SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
252677683534Smrg]) # XORG_CHECK_MALLOC_ZERO
2527a8fdb4bcSmrg
252877683534Smrg# XORG_WITH_LINT()
252977683534Smrg# ----------------
253077683534Smrg# Minimum version: 1.1.0
2531a8fdb4bcSmrg#
253277683534Smrg# This macro enables the use of a tool that flags some suspicious and
253377683534Smrg# non-portable constructs (likely to be bugs) in C language source code.
253477683534Smrg# It will attempt to locate the tool and use appropriate options.
253577683534Smrg# There are various lint type tools on different platforms.
253677683534Smrg#
253777683534Smrg# Interface to module:
253877683534Smrg# LINT:		returns the path to the tool found on the platform
253977683534Smrg#		or the value set to LINT on the configure cmd line
254077683534Smrg#		also an Automake conditional
254177683534Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
254277683534Smrg#
254377683534Smrg# --with-lint:	'yes' user instructs the module to use lint
254477683534Smrg#		'no' user instructs the module not to use lint (default)
254577683534Smrg#
254677683534Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
254777683534Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
254877683534Smrg#
254977683534SmrgAC_DEFUN([XORG_WITH_LINT],[
2550a8fdb4bcSmrg
255177683534SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
255277683534SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
255377683534SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
255477683534Smrg		[Use a lint-style source code checker (default: disabled)])],
255577683534Smrg		[use_lint=$withval], [use_lint=no])
2556a8fdb4bcSmrg
255777683534Smrg# Obtain platform specific info like program name and options
255877683534Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
255977683534Smrgcase $host_os in
256077683534Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
256177683534Smrg	lint_name=splint
256277683534Smrg	lint_options="-badflag"
256377683534Smrg	;;
256477683534Smrg  *freebsd* | *netbsd*)
256577683534Smrg	lint_name=lint
256677683534Smrg	lint_options="-u -b"
256777683534Smrg	;;
256877683534Smrg  *solaris*)
256977683534Smrg	lint_name=lint
257077683534Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
257177683534Smrg	;;
257277683534Smrgesac
2573a8fdb4bcSmrg
257477683534Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
257577683534Smrgif test "x$use_lint" = x"yes" ; then
257677683534Smrg   AC_PATH_PROG([LINT], [$lint_name])
257777683534Smrg   if test "x$LINT" = "x"; then
257877683534Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
257977683534Smrg   fi
258077683534Smrgelif test "x$use_lint" = x"no" ; then
258177683534Smrg   if test "x$LINT" != "x"; then
258277683534Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
258377683534Smrg   fi
2584a8fdb4bcSmrgelse
258577683534Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2586a8fdb4bcSmrgfi
2587a8fdb4bcSmrg
258877683534Smrg# User supplied flags override default flags
258977683534Smrgif test "x$LINT_FLAGS" != "x"; then
259077683534Smrg   lint_options=$LINT_FLAGS
259177683534Smrgfi
2592a8fdb4bcSmrg
259377683534SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
259477683534SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
2595a8fdb4bcSmrg
259677683534Smrg]) # XORG_WITH_LINT
2597a8fdb4bcSmrg
259877683534Smrg# XORG_LINT_LIBRARY(LIBNAME)
259977683534Smrg# --------------------------
260077683534Smrg# Minimum version: 1.1.0
2601a8fdb4bcSmrg#
260277683534Smrg# Sets up flags for building lint libraries for checking programs that call
260377683534Smrg# functions in the library.
260477683534Smrg#
260577683534Smrg# Interface to module:
260677683534Smrg# LINTLIB		- Automake variable with the name of lint library file to make
260777683534Smrg# MAKE_LINT_LIB		- Automake conditional
260877683534Smrg#
260977683534Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
261077683534Smrg#			  - 'no' user instructs the module not to create a lint library (default)
2611a8fdb4bcSmrg
261277683534SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
261377683534SmrgAC_REQUIRE([XORG_WITH_LINT])
261477683534SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
261577683534Smrg	[Create lint library (default: disabled)])],
261677683534Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
2617a8fdb4bcSmrg
261877683534Smrgif test "x$make_lint_lib" = x"yes" ; then
261977683534Smrg   LINTLIB=llib-l$1.ln
262077683534Smrg   if test "x$LINT" = "x"; then
262177683534Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
262277683534Smrg   fi
262377683534Smrgelif test "x$make_lint_lib" != x"no" ; then
262477683534Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
262577683534Smrgfi
2626a8fdb4bcSmrg
262777683534SmrgAC_SUBST(LINTLIB)
262877683534SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2629a8fdb4bcSmrg
263077683534Smrg]) # XORG_LINT_LIBRARY
2631a8fdb4bcSmrg
26324ed31819Smrg# XORG_COMPILER_BRAND
26334ed31819Smrg# -------------------
26344ed31819Smrg# Minimum version: 1.14.0
26354ed31819Smrg#
26364ed31819Smrg# Checks for various brands of compilers and sets flags as appropriate:
26374ed31819Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
26384ed31819Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
26394ed31819Smrg#   clang compiler - sets CLANGCC to "yes"
26404ed31819Smrg#   Intel compiler - sets INTELCC to "yes"
26414ed31819Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
26424ed31819Smrg#
26434ed31819SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
26444ed31819SmrgAC_LANG_CASE(
26454ed31819Smrg	[C], [
26464ed31819Smrg		AC_REQUIRE([AC_PROG_CC_C99])
26474ed31819Smrg	],
26484ed31819Smrg	[C++], [
26494ed31819Smrg		AC_REQUIRE([AC_PROG_CXX])
26504ed31819Smrg	]
26514ed31819Smrg)
26524ed31819SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
26534ed31819SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
26544ed31819SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
26554ed31819Smrg]) # XORG_COMPILER_BRAND
26564ed31819Smrg
26574ed31819Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
26584ed31819Smrg# ---------------
26594ed31819Smrg# Minimum version: 1.16.0
26604ed31819Smrg#
26614ed31819Smrg# Test if the compiler works when passed the given flag as a command line argument.
26624ed31819Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
26634ed31819Smrg# next flag in the list until there are no more options.
26644ed31819Smrg#
26654ed31819Smrg# Note that this does not guarantee that the compiler supports the flag as some
26664ed31819Smrg# compilers will simply ignore arguments that they do not understand, but we do
26674ed31819Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
26684ed31819Smrg# -Werror=unused-command-line-argument
26694ed31819Smrg#
26704ed31819SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
26714ed31819Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
26724ed31819Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
26734ed31819Smrg
26744ed31819SmrgAC_LANG_COMPILER_REQUIRE
26754ed31819Smrg
26764ed31819SmrgAC_LANG_CASE(
26774ed31819Smrg	[C], [
26784ed31819Smrg		AC_REQUIRE([AC_PROG_CC_C99])
26794ed31819Smrg		define([PREFIX], [C])
26804ed31819Smrg		define([CACHE_PREFIX], [cc])
26814ed31819Smrg		define([COMPILER], [$CC])
26824ed31819Smrg	],
26834ed31819Smrg	[C++], [
26844ed31819Smrg		define([PREFIX], [CXX])
26854ed31819Smrg		define([CACHE_PREFIX], [cxx])
26864ed31819Smrg		define([COMPILER], [$CXX])
26874ed31819Smrg	]
26884ed31819Smrg)
26894ed31819Smrg
26904ed31819Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
26914ed31819Smrg
26924ed31819Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
26934ed31819Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
26944ed31819Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
26954ed31819Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
26964ed31819Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
26974ed31819Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
26984ed31819Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
26994ed31819Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
27004ed31819Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
27014ed31819Smrgfi
27024ed31819Smrg
27034ed31819Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
27044ed31819Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
27054ed31819Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
27064ed31819Smrg	fi
27074ed31819Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
27084ed31819Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
27094ed31819Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
27104ed31819Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
27114ed31819Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
27124ed31819Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
27134ed31819Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
27144ed31819Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
27154ed31819Smrgfi
27164ed31819Smrg
27174ed31819Smrgfound="no"
27184ed31819Smrgm4_foreach([flag], m4_cdr($@), [
27194ed31819Smrg	if test $found = "no" ; then
27204ed31819Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
27214ed31819Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
27224ed31819Smrg		fi
27234ed31819Smrg
27244ed31819Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
27254ed31819Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
27264ed31819Smrg		fi
27274ed31819Smrg
27284ed31819Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
27294ed31819Smrg
27304ed31819Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
27314ed31819Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports]flag[])
27324ed31819Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
27334ed31819Smrg		AC_CACHE_VAL($cacheid,
27344ed31819Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
27354ed31819Smrg					     [eval $cacheid=yes],
27364ed31819Smrg					     [eval $cacheid=no])])
27374ed31819Smrg
27384ed31819Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
27394ed31819Smrg
27404ed31819Smrg		eval supported=\$$cacheid
27414ed31819Smrg		AC_MSG_RESULT([$supported])
27424ed31819Smrg		if test "$supported" = "yes" ; then
27434ed31819Smrg			$1="$$1 ]flag["
27444ed31819Smrg			found="yes"
27454ed31819Smrg		fi
27464ed31819Smrg	fi
27474ed31819Smrg])
27484ed31819Smrg]) # XORG_TESTSET_CFLAG
27494ed31819Smrg
27504ed31819Smrg# XORG_COMPILER_FLAGS
27514ed31819Smrg# ---------------
27524ed31819Smrg# Minimum version: 1.16.0
27534ed31819Smrg#
27544ed31819Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
27554ed31819Smrg# arguments supported by the selected compiler which do NOT alter the generated
27564ed31819Smrg# code.  These arguments will cause the compiler to print various warnings
27574ed31819Smrg# during compilation AND turn a conservative set of warnings into errors.
27584ed31819Smrg#
27594ed31819Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
27604ed31819Smrg# future versions of util-macros as options are added to new compilers.
27614ed31819Smrg#
27624ed31819SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
27634ed31819SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
27644ed31819Smrg
27654ed31819SmrgAC_ARG_ENABLE(selective-werror,
27664ed31819Smrg              AS_HELP_STRING([--disable-selective-werror],
27674ed31819Smrg                             [Turn off selective compiler errors. (default: enabled)]),
27684ed31819Smrg              [SELECTIVE_WERROR=$enableval],
27694ed31819Smrg              [SELECTIVE_WERROR=yes])
27704ed31819Smrg
27714ed31819SmrgAC_LANG_CASE(
27724ed31819Smrg        [C], [
27734ed31819Smrg                define([PREFIX], [C])
27744ed31819Smrg        ],
27754ed31819Smrg        [C++], [
27764ed31819Smrg                define([PREFIX], [CXX])
27774ed31819Smrg        ]
27784ed31819Smrg)
27794ed31819Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
27804ed31819Smrgif test "x$SUNCC" = "xyes"; then
27814ed31819Smrg    [BASE_]PREFIX[FLAGS]="-v"
27824ed31819Smrgelse
27834ed31819Smrg    [BASE_]PREFIX[FLAGS]=""
27844ed31819Smrgfi
27854ed31819Smrg
27864ed31819Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
27874ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
27884ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
27894ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
27904ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
27914ed31819Smrg
27924ed31819SmrgAC_LANG_CASE(
27934ed31819Smrg	[C], [
27944ed31819Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
27954ed31819Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
27964ed31819Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
27974ed31819Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
27984ed31819Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
27994ed31819Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
28004ed31819Smrg	]
28014ed31819Smrg)
28024ed31819Smrg
28034ed31819Smrg# This chunk adds additional warnings that could catch undesired effects.
28044ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
28054ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
28064ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
28074ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
28084ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
28094ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
28104ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
28114ed31819Smrg
28124ed31819Smrg# These are currently disabled because they are noisy.  They will be enabled
28134ed31819Smrg# in the future once the codebase is sufficiently modernized to silence
28144ed31819Smrg# them.  For now, I don't want them to drown out the other warnings.
28154ed31819Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
28164ed31819Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
28174ed31819Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
28184ed31819Smrg
28194ed31819Smrg# Turn some warnings into errors, so we don't accidently get successful builds
28204ed31819Smrg# when there are problems that should be fixed.
28214ed31819Smrg
28224ed31819Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
28234ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
28244ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
28254ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
28264ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
28274ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
28284ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
28294ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
28304ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
28314ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
28324ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
28334ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
28344ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
28354ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
28364ed31819Smrgelse
28374ed31819SmrgAC_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])
28384ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
28394ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
28404ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
28414ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
28424ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
28434ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
28444ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
28454ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
28464ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
28474ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
28484ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
28494ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
28504ed31819SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
28514ed31819Smrgfi
28524ed31819Smrg
28534ed31819SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
28544ed31819Smrg]) # XORG_COMPILER_FLAGS
28554ed31819Smrg
285677683534Smrg# XORG_CWARNFLAGS
285777683534Smrg# ---------------
285877683534Smrg# Minimum version: 1.2.0
28594ed31819Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
286077683534Smrg#
286177683534Smrg# Defines CWARNFLAGS to enable C compiler warnings.
286277683534Smrg#
28634ed31819Smrg# This function is deprecated because it defines -fno-strict-aliasing
28644ed31819Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
28654ed31819Smrg# is needed, then it should be added explicitly in the module when
28664ed31819Smrg# it is updated to use BASE_CFLAGS.
28674ed31819Smrg#
286877683534SmrgAC_DEFUN([XORG_CWARNFLAGS], [
28694ed31819SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
28704ed31819SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
28714ed31819SmrgAC_LANG_CASE(
28724ed31819Smrg	[C], [
28734ed31819Smrg		CWARNFLAGS="$BASE_CFLAGS"
28744ed31819Smrg		if  test "x$GCC" = xyes ; then
28754ed31819Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
28764ed31819Smrg		fi
28774ed31819Smrg		AC_SUBST(CWARNFLAGS)
28784ed31819Smrg	]
28794ed31819Smrg)
288077683534Smrg]) # XORG_CWARNFLAGS
2881a8fdb4bcSmrg
288277683534Smrg# XORG_STRICT_OPTION
288377683534Smrg# -----------------------
288477683534Smrg# Minimum version: 1.3.0
288577683534Smrg#
28864ed31819Smrg# Add configure option to enable strict compilation flags, such as treating
28874ed31819Smrg# warnings as fatal errors.
28884ed31819Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
28894ed31819Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
28904ed31819Smrg#
28914ed31819Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
28924ed31819Smrg# when strict compilation is unconditionally desired.
289377683534SmrgAC_DEFUN([XORG_STRICT_OPTION], [
289477683534SmrgAC_REQUIRE([XORG_CWARNFLAGS])
28954ed31819SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
2896a8fdb4bcSmrg
289777683534SmrgAC_ARG_ENABLE(strict-compilation,
289877683534Smrg			  AS_HELP_STRING([--enable-strict-compilation],
289977683534Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
290077683534Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
29014ed31819Smrg
29024ed31819SmrgAC_LANG_CASE(
29034ed31819Smrg        [C], [
29044ed31819Smrg                define([PREFIX], [C])
29054ed31819Smrg        ],
29064ed31819Smrg        [C++], [
29074ed31819Smrg                define([PREFIX], [CXX])
29084ed31819Smrg        ]
29094ed31819Smrg)
29104ed31819Smrg
29114ed31819Smrg[STRICT_]PREFIX[FLAGS]=""
29124ed31819SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
29134ed31819SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
29144ed31819Smrg
29154ed31819Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
29164ed31819Smrg# activate it with -Werror, so we add it here explicitly.
29174ed31819SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
29184ed31819Smrg
291977683534Smrgif test "x$STRICT_COMPILE" = "xyes"; then
29204ed31819Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
29214ed31819Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
292277683534Smrgfi
29234ed31819SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
29244ed31819SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
29254ed31819SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
292677683534Smrg]) # XORG_STRICT_OPTION
292777683534Smrg
292877683534Smrg# XORG_DEFAULT_OPTIONS
292977683534Smrg# --------------------
293077683534Smrg# Minimum version: 1.3.0
2931a8fdb4bcSmrg#
293277683534Smrg# Defines default options for X.Org modules.
293377683534Smrg#
293477683534SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
293577683534SmrgAC_REQUIRE([AC_PROG_INSTALL])
29364ed31819SmrgXORG_COMPILER_FLAGS
293777683534SmrgXORG_CWARNFLAGS
293877683534SmrgXORG_STRICT_OPTION
293977683534SmrgXORG_RELEASE_VERSION
294077683534SmrgXORG_CHANGELOG
294177683534SmrgXORG_INSTALL
294277683534SmrgXORG_MANPAGE_SECTIONS
294377683534Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
294477683534Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
294577683534Smrg]) # XORG_DEFAULT_OPTIONS
2946a8fdb4bcSmrg
294777683534Smrg# XORG_INSTALL()
294877683534Smrg# ----------------
294977683534Smrg# Minimum version: 1.4.0
295077683534Smrg#
295177683534Smrg# Defines the variable INSTALL_CMD as the command to copy
295277683534Smrg# INSTALL from $prefix/share/util-macros.
295377683534Smrg#
295477683534SmrgAC_DEFUN([XORG_INSTALL], [
295577683534SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
295677683534Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
295777683534SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
295877683534Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
295977683534Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
296077683534Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
296177683534SmrgAC_SUBST([INSTALL_CMD])
296277683534Smrg]) # XORG_INSTALL
296377683534Smrgdnl Copyright 2005 Red Hat, Inc
296477683534Smrgdnl
296577683534Smrgdnl Permission to use, copy, modify, distribute, and sell this software and its
296677683534Smrgdnl documentation for any purpose is hereby granted without fee, provided that
296777683534Smrgdnl the above copyright notice appear in all copies and that both that
296877683534Smrgdnl copyright notice and this permission notice appear in supporting
296977683534Smrgdnl documentation.
297077683534Smrgdnl
297177683534Smrgdnl The above copyright notice and this permission notice shall be included
297277683534Smrgdnl in all copies or substantial portions of the Software.
297377683534Smrgdnl
297477683534Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
297577683534Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
297677683534Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
297777683534Smrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
297877683534Smrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
297977683534Smrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
298077683534Smrgdnl OTHER DEALINGS IN THE SOFTWARE.
298177683534Smrgdnl
298277683534Smrgdnl Except as contained in this notice, the name of the copyright holders shall
298377683534Smrgdnl not be used in advertising or otherwise to promote the sale, use or
298477683534Smrgdnl other dealings in this Software without prior written authorization
298577683534Smrgdnl from the copyright holders.
298677683534Smrgdnl
2987a8fdb4bcSmrg
298877683534Smrg# XORG_RELEASE_VERSION
298977683534Smrg# --------------------
299077683534Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
299177683534Smrg 
299277683534SmrgAC_DEFUN([XORG_RELEASE_VERSION],[
299377683534Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
299477683534Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
299577683534Smrg		[Major version of this package])
299677683534Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
299777683534Smrg	if test "x$PVM" = "x"; then
299877683534Smrg		PVM="0"
299977683534Smrg	fi
300077683534Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
300177683534Smrg		[$PVM],
300277683534Smrg		[Minor version of this package])
300377683534Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
300477683534Smrg	if test "x$PVP" = "x"; then
300577683534Smrg		PVP="0"
300677683534Smrg	fi
300777683534Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
300877683534Smrg		[$PVP],
300977683534Smrg		[Patch version of this package])
301077683534Smrg])
3011dbe7da2eSmrg
301277683534Smrg# XORG_CHANGELOG()
301377683534Smrg# ----------------
301477683534Smrg# Minimum version: 1.2.0
301577683534Smrg#
301677683534Smrg# Defines the variable CHANGELOG_CMD as the command to generate
301777683534Smrg# ChangeLog from git.
301877683534Smrg#
301977683534Smrg#
302077683534SmrgAC_DEFUN([XORG_CHANGELOG], [
302177683534SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
302277683534Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
302377683534Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
302477683534Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
302577683534SmrgAC_SUBST([CHANGELOG_CMD])
302677683534Smrg]) # XORG_CHANGELOG
3027a8fdb4bcSmrg
302877683534Smrgm4_include([acinclude.m4])
3029