aclocal.m4 revision 1afad795
11afad795Smrg# generated automatically by aclocal 1.14 -*- Autoconf -*-
21afad795Smrg
31afad795Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
4492e1cfeSmrg
5492e1cfeSmrg# This file is free software; the Free Software Foundation
6492e1cfeSmrg# gives unlimited permission to copy and/or distribute it,
7492e1cfeSmrg# with or without modifications, as long as this notice is preserved.
8492e1cfeSmrg
9492e1cfeSmrg# This program is distributed in the hope that it will be useful,
10492e1cfeSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11492e1cfeSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12492e1cfeSmrg# PARTICULAR PURPOSE.
13492e1cfeSmrg
141afad795Smrgm4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
159e0146f7Smrgm4_ifndef([AC_AUTOCONF_VERSION],
169e0146f7Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
179e0146f7Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
189e0146f7Smrg[m4_warning([this file was generated for autoconf 2.68.
199e0146f7SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
209e0146f7SmrgIf you have problems, you may need to regenerate the build system entirely.
211afad795SmrgTo do so, use the procedure documented by the package, typically 'autoreconf'.])])
22492e1cfeSmrg
231afad795Smrg# Copyright (C) 2002-2013 Free Software Foundation, Inc.
249e0146f7Smrg#
259e0146f7Smrg# This file is free software; the Free Software Foundation
269e0146f7Smrg# gives unlimited permission to copy and/or distribute it,
279e0146f7Smrg# with or without modifications, as long as this notice is preserved.
28492e1cfeSmrg
29492e1cfeSmrg# AM_AUTOMAKE_VERSION(VERSION)
30492e1cfeSmrg# ----------------------------
31492e1cfeSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
32492e1cfeSmrg# generated from the m4 files accompanying Automake X.Y.
339e0146f7Smrg# (This private macro should not be called outside this file.)
349e0146f7SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
351afad795Smrg[am__api_version='1.14'
369e0146f7Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
379e0146f7Smrgdnl require some minimum version.  Point them to the right macro.
381afad795Smrgm4_if([$1], [1.14], [],
399e0146f7Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
409e0146f7Smrg])
419e0146f7Smrg
429e0146f7Smrg# _AM_AUTOCONF_VERSION(VERSION)
439e0146f7Smrg# -----------------------------
449e0146f7Smrg# aclocal traces this macro to find the Autoconf version.
459e0146f7Smrg# This is a private macro too.  Using m4_define simplifies
469e0146f7Smrg# the logic in aclocal, which can simply ignore this definition.
479e0146f7Smrgm4_define([_AM_AUTOCONF_VERSION], [])
48492e1cfeSmrg
49492e1cfeSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
50492e1cfeSmrg# -------------------------------
519e0146f7Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
529e0146f7Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53492e1cfeSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
541afad795Smrg[AM_AUTOMAKE_VERSION([1.14])dnl
559e0146f7Smrgm4_ifndef([AC_AUTOCONF_VERSION],
569e0146f7Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
579e0146f7Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58492e1cfeSmrg
599e0146f7Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60492e1cfeSmrg
611afad795Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
62492e1cfeSmrg#
639e0146f7Smrg# This file is free software; the Free Software Foundation
649e0146f7Smrg# gives unlimited permission to copy and/or distribute it,
659e0146f7Smrg# with or without modifications, as long as this notice is preserved.
66492e1cfeSmrg
67492e1cfeSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
681afad795Smrg# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
691afad795Smrg# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70492e1cfeSmrg#
71492e1cfeSmrg# Of course, Automake must honor this variable whenever it calls a
72492e1cfeSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
73492e1cfeSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
74492e1cfeSmrg# depending on how configure is run.  This is pretty annoying, since
75492e1cfeSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76492e1cfeSmrg# source directory, any form will work fine, but in subdirectories a
77492e1cfeSmrg# relative path needs to be adjusted first.
78492e1cfeSmrg#
79492e1cfeSmrg# $ac_aux_dir/missing
80492e1cfeSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
81492e1cfeSmrg# $top_srcdir/$ac_aux_dir/missing
82492e1cfeSmrg#    fails if $ac_aux_dir is absolute,
83492e1cfeSmrg#    fails when called from a subdirectory in a VPATH build with
84492e1cfeSmrg#          a relative $ac_aux_dir
85492e1cfeSmrg#
86492e1cfeSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87492e1cfeSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
881afad795Smrg# harmless because $srcdir is '.', but things will broke when you
89492e1cfeSmrg# start a VPATH build or use an absolute $srcdir.
90492e1cfeSmrg#
91492e1cfeSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92492e1cfeSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93492e1cfeSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94492e1cfeSmrg# and then we would define $MISSING as
95492e1cfeSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
96492e1cfeSmrg# This will work as long as MISSING is not called from configure, because
97492e1cfeSmrg# unfortunately $(top_srcdir) has no meaning in configure.
98492e1cfeSmrg# However there are other variables, like CC, which are often used in
99492e1cfeSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
100492e1cfeSmrg#
101492e1cfeSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
102492e1cfeSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
103492e1cfeSmrg# configured tree to be moved without reconfiguration.
104492e1cfeSmrg
1059e0146f7SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
1069e0146f7Smrg[dnl Rely on autoconf to set up CDPATH properly.
1079e0146f7SmrgAC_PREREQ([2.50])dnl
108492e1cfeSmrg# expand $ac_aux_dir to an absolute path
109492e1cfeSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
110492e1cfeSmrg])
111492e1cfeSmrg
1129e0146f7Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
113492e1cfeSmrg
1141afad795Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
1159e0146f7Smrg#
1169e0146f7Smrg# This file is free software; the Free Software Foundation
1179e0146f7Smrg# gives unlimited permission to copy and/or distribute it,
1189e0146f7Smrg# with or without modifications, as long as this notice is preserved.
119492e1cfeSmrg
1209e0146f7Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
1219e0146f7Smrg# -------------------------------------
1229e0146f7Smrg# Define a conditional.
1239e0146f7SmrgAC_DEFUN([AM_CONDITIONAL],
1241afad795Smrg[AC_PREREQ([2.52])dnl
1251afad795Smrg m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1261afad795Smrg       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1279e0146f7SmrgAC_SUBST([$1_TRUE])dnl
1289e0146f7SmrgAC_SUBST([$1_FALSE])dnl
1299e0146f7Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
1309e0146f7Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
1319e0146f7Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
1329e0146f7Smrgif $2; then
1339e0146f7Smrg  $1_TRUE=
1349e0146f7Smrg  $1_FALSE='#'
135492e1cfeSmrgelse
1369e0146f7Smrg  $1_TRUE='#'
1379e0146f7Smrg  $1_FALSE=
138492e1cfeSmrgfi
1399e0146f7SmrgAC_CONFIG_COMMANDS_PRE(
1409e0146f7Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1419e0146f7Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
1429e0146f7SmrgUsually this means the macro was only invoked conditionally.]])
1439e0146f7Smrgfi])])
144492e1cfeSmrg
1451afad795Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
1469e0146f7Smrg#
1479e0146f7Smrg# This file is free software; the Free Software Foundation
1489e0146f7Smrg# gives unlimited permission to copy and/or distribute it,
1499e0146f7Smrg# with or without modifications, as long as this notice is preserved.
150492e1cfeSmrg
151492e1cfeSmrg
1521afad795Smrg# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
153492e1cfeSmrg# written in clear, in which case automake, when reading aclocal.m4,
154492e1cfeSmrg# will think it sees a *use*, and therefore will trigger all it's
155492e1cfeSmrg# C support machinery.  Also note that it means that autoscan, seeing
156492e1cfeSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
157492e1cfeSmrg
158492e1cfeSmrg
159492e1cfeSmrg# _AM_DEPENDENCIES(NAME)
160492e1cfeSmrg# ----------------------
161492e1cfeSmrg# See how the compiler implements dependency checking.
1621afad795Smrg# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
163492e1cfeSmrg# We try a few techniques and use that to set a single cache variable.
164492e1cfeSmrg#
165492e1cfeSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
166492e1cfeSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
167492e1cfeSmrg# dependency, and given that the user is not expected to run this macro,
168492e1cfeSmrg# just rely on AC_PROG_CC.
169492e1cfeSmrgAC_DEFUN([_AM_DEPENDENCIES],
170492e1cfeSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
171492e1cfeSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
172492e1cfeSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
173492e1cfeSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
174492e1cfeSmrg
1751afad795Smrgm4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
1761afad795Smrg      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
1771afad795Smrg      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
1781afad795Smrg      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
1791afad795Smrg      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
1801afad795Smrg      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1811afad795Smrg                    [depcc="$$1"   am_compiler_list=])
182492e1cfeSmrg
183492e1cfeSmrgAC_CACHE_CHECK([dependency style of $depcc],
184492e1cfeSmrg               [am_cv_$1_dependencies_compiler_type],
185492e1cfeSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
186492e1cfeSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
187492e1cfeSmrg  # making bogus files that we don't know about and never remove.  For
188492e1cfeSmrg  # instance it was reported that on HP-UX the gcc test will end up
1891afad795Smrg  # making a dummy file named 'D' -- because '-MD' means "put the output
1901afad795Smrg  # in D".
1911afad795Smrg  rm -rf conftest.dir
192492e1cfeSmrg  mkdir conftest.dir
193492e1cfeSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
194492e1cfeSmrg  # using a relative directory.
195492e1cfeSmrg  cp "$am_depcomp" conftest.dir
196492e1cfeSmrg  cd conftest.dir
197492e1cfeSmrg  # We will build objects and dependencies in a subdirectory because
198492e1cfeSmrg  # it helps to detect inapplicable dependency modes.  For instance
199492e1cfeSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
200492e1cfeSmrg  # side effect of compilation, but ICC will put the dependencies in
201492e1cfeSmrg  # the current directory while Tru64 will put them in the object
202492e1cfeSmrg  # directory.
203492e1cfeSmrg  mkdir sub
204492e1cfeSmrg
205492e1cfeSmrg  am_cv_$1_dependencies_compiler_type=none
206492e1cfeSmrg  if test "$am_compiler_list" = ""; then
207492e1cfeSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
208492e1cfeSmrg  fi
2099e0146f7Smrg  am__universal=false
2109e0146f7Smrg  m4_case([$1], [CC],
2119e0146f7Smrg    [case " $depcc " in #(
2129e0146f7Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2139e0146f7Smrg     esac],
2149e0146f7Smrg    [CXX],
2159e0146f7Smrg    [case " $depcc " in #(
2169e0146f7Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
2179e0146f7Smrg     esac])
2189e0146f7Smrg
219492e1cfeSmrg  for depmode in $am_compiler_list; do
220492e1cfeSmrg    # Setup a source with many dependencies, because some compilers
221492e1cfeSmrg    # like to wrap large dependency lists on column 80 (with \), and
222492e1cfeSmrg    # we should not choose a depcomp mode which is confused by this.
223492e1cfeSmrg    #
224492e1cfeSmrg    # We need to recreate these files for each test, as the compiler may
225492e1cfeSmrg    # overwrite some of them when testing with obscure command lines.
226492e1cfeSmrg    # This happens at least with the AIX C compiler.
227492e1cfeSmrg    : > sub/conftest.c
228492e1cfeSmrg    for i in 1 2 3 4 5 6; do
229492e1cfeSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
2301afad795Smrg      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
2311afad795Smrg      # Solaris 10 /bin/sh.
2321afad795Smrg      echo '/* dummy */' > sub/conftst$i.h
233492e1cfeSmrg    done
234492e1cfeSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
235492e1cfeSmrg
2361afad795Smrg    # We check with '-c' and '-o' for the sake of the "dashmstdout"
2379e0146f7Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
2381afad795Smrg    # handle '-M -o', and we need to detect this.  Also, some Intel
2391afad795Smrg    # versions had trouble with output in subdirs.
2409e0146f7Smrg    am__obj=sub/conftest.${OBJEXT-o}
2419e0146f7Smrg    am__minus_obj="-o $am__obj"
242492e1cfeSmrg    case $depmode in
2439e0146f7Smrg    gcc)
2449e0146f7Smrg      # This depmode causes a compiler race in universal mode.
2459e0146f7Smrg      test "$am__universal" = false || continue
2469e0146f7Smrg      ;;
247492e1cfeSmrg    nosideeffect)
2481afad795Smrg      # After this tag, mechanisms are not by side-effect, so they'll
2491afad795Smrg      # only be used when explicitly requested.
250492e1cfeSmrg      if test "x$enable_dependency_tracking" = xyes; then
251492e1cfeSmrg	continue
252492e1cfeSmrg      else
253492e1cfeSmrg	break
254492e1cfeSmrg      fi
255492e1cfeSmrg      ;;
2561afad795Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
2571afad795Smrg      # This compiler won't grok '-c -o', but also, the minuso test has
2589e0146f7Smrg      # not run yet.  These depmodes are late enough in the game, and
2599e0146f7Smrg      # so weak that their functioning should not be impacted.
2609e0146f7Smrg      am__obj=conftest.${OBJEXT-o}
2619e0146f7Smrg      am__minus_obj=
2629e0146f7Smrg      ;;
263492e1cfeSmrg    none) break ;;
264492e1cfeSmrg    esac
265492e1cfeSmrg    if depmode=$depmode \
2669e0146f7Smrg       source=sub/conftest.c object=$am__obj \
267492e1cfeSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2689e0146f7Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
269492e1cfeSmrg         >/dev/null 2>conftest.err &&
2709e0146f7Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
271492e1cfeSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2729e0146f7Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
273492e1cfeSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
274492e1cfeSmrg      # icc doesn't choke on unknown options, it will just issue warnings
2759e0146f7Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
2769e0146f7Smrg      # that says an option was ignored or not supported.
2779e0146f7Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
2789e0146f7Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
2799e0146f7Smrg      # The diagnosis changed in icc 8.0:
2809e0146f7Smrg      #   icc: Command line remark: option '-MP' not supported
2819e0146f7Smrg      if (grep 'ignoring option' conftest.err ||
2829e0146f7Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
283492e1cfeSmrg        am_cv_$1_dependencies_compiler_type=$depmode
284492e1cfeSmrg        break
285492e1cfeSmrg      fi
286492e1cfeSmrg    fi
287492e1cfeSmrg  done
288492e1cfeSmrg
289492e1cfeSmrg  cd ..
290492e1cfeSmrg  rm -rf conftest.dir
291492e1cfeSmrgelse
292492e1cfeSmrg  am_cv_$1_dependencies_compiler_type=none
293492e1cfeSmrgfi
294492e1cfeSmrg])
295492e1cfeSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
296492e1cfeSmrgAM_CONDITIONAL([am__fastdep$1], [
297492e1cfeSmrg  test "x$enable_dependency_tracking" != xno \
298492e1cfeSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
299492e1cfeSmrg])
300492e1cfeSmrg
301492e1cfeSmrg
302492e1cfeSmrg# AM_SET_DEPDIR
303492e1cfeSmrg# -------------
304492e1cfeSmrg# Choose a directory name for dependency files.
3051afad795Smrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
306492e1cfeSmrgAC_DEFUN([AM_SET_DEPDIR],
307492e1cfeSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
308492e1cfeSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
309492e1cfeSmrg])
310492e1cfeSmrg
311492e1cfeSmrg
312492e1cfeSmrg# AM_DEP_TRACK
313492e1cfeSmrg# ------------
314492e1cfeSmrgAC_DEFUN([AM_DEP_TRACK],
3151afad795Smrg[AC_ARG_ENABLE([dependency-tracking], [dnl
3161afad795SmrgAS_HELP_STRING(
3171afad795Smrg  [--enable-dependency-tracking],
3181afad795Smrg  [do not reject slow dependency extractors])
3191afad795SmrgAS_HELP_STRING(
3201afad795Smrg  [--disable-dependency-tracking],
3211afad795Smrg  [speeds up one-time build])])
322492e1cfeSmrgif test "x$enable_dependency_tracking" != xno; then
323492e1cfeSmrg  am_depcomp="$ac_aux_dir/depcomp"
324492e1cfeSmrg  AMDEPBACKSLASH='\'
3251afad795Smrg  am__nodep='_no'
326492e1cfeSmrgfi
327492e1cfeSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
3289e0146f7SmrgAC_SUBST([AMDEPBACKSLASH])dnl
3299e0146f7Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3301afad795SmrgAC_SUBST([am__nodep])dnl
3311afad795Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
332492e1cfeSmrg])
333492e1cfeSmrg
3349e0146f7Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
335492e1cfeSmrg
3361afad795Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
3379e0146f7Smrg#
3389e0146f7Smrg# This file is free software; the Free Software Foundation
3399e0146f7Smrg# gives unlimited permission to copy and/or distribute it,
3409e0146f7Smrg# with or without modifications, as long as this notice is preserved.
341492e1cfeSmrg
342492e1cfeSmrg
343492e1cfeSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
344492e1cfeSmrg# ------------------------------
345492e1cfeSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
3469e0146f7Smrg[{
3471afad795Smrg  # Older Autoconf quotes --file arguments for eval, but not when files
3489e0146f7Smrg  # are listed without --file.  Let's play safe and only enable the eval
3499e0146f7Smrg  # if we detect the quoting.
3509e0146f7Smrg  case $CONFIG_FILES in
3519e0146f7Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
3529e0146f7Smrg  *)   set x $CONFIG_FILES ;;
3539e0146f7Smrg  esac
3549e0146f7Smrg  shift
3559e0146f7Smrg  for mf
3569e0146f7Smrg  do
3579e0146f7Smrg    # Strip MF so we end up with the name of the file.
3589e0146f7Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
3599e0146f7Smrg    # Check whether this is an Automake generated Makefile or not.
3601afad795Smrg    # We used to match only the files named 'Makefile.in', but
3619e0146f7Smrg    # some people rename them; so instead we look at the file content.
3629e0146f7Smrg    # Grep'ing the first line is not enough: some people post-process
3639e0146f7Smrg    # each Makefile.in and add a new line on top of each file to say so.
3649e0146f7Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
3659e0146f7Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
3669e0146f7Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
3679e0146f7Smrg      dirpart=`AS_DIRNAME("$mf")`
3689e0146f7Smrg    else
3699e0146f7Smrg      continue
3709e0146f7Smrg    fi
3719e0146f7Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
3721afad795Smrg    # from the Makefile without running 'make'.
3739e0146f7Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
3749e0146f7Smrg    test -z "$DEPDIR" && continue
3759e0146f7Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
3761afad795Smrg    test -z "$am__include" && continue
3779e0146f7Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
3789e0146f7Smrg    # Find all dependency output files, they are included files with
3799e0146f7Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
3809e0146f7Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
3819e0146f7Smrg    # expansion.
3829e0146f7Smrg    for file in `sed -n "
3839e0146f7Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
3841afad795Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
3859e0146f7Smrg      # Make sure the directory exists.
3869e0146f7Smrg      test -f "$dirpart/$file" && continue
3879e0146f7Smrg      fdir=`AS_DIRNAME(["$file"])`
3889e0146f7Smrg      AS_MKDIR_P([$dirpart/$fdir])
3899e0146f7Smrg      # echo "creating $dirpart/$file"
3909e0146f7Smrg      echo '# dummy' > "$dirpart/$file"
3919e0146f7Smrg    done
392492e1cfeSmrg  done
3939e0146f7Smrg}
394492e1cfeSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
395492e1cfeSmrg
396492e1cfeSmrg
397492e1cfeSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
398492e1cfeSmrg# -----------------------------
399492e1cfeSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
400492e1cfeSmrg#
401492e1cfeSmrg# This code is only required when automatic dependency tracking
4021afad795Smrg# is enabled.  FIXME.  This creates each '.P' file that we will
403492e1cfeSmrg# need in order to bootstrap the dependency handling code.
404492e1cfeSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
405492e1cfeSmrg[AC_CONFIG_COMMANDS([depfiles],
406492e1cfeSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
407492e1cfeSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
408492e1cfeSmrg])
409492e1cfeSmrg
4109e0146f7Smrg# Do all the work for Automake.                             -*- Autoconf -*-
411492e1cfeSmrg
4121afad795Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
4139e0146f7Smrg#
4149e0146f7Smrg# This file is free software; the Free Software Foundation
4159e0146f7Smrg# gives unlimited permission to copy and/or distribute it,
4169e0146f7Smrg# with or without modifications, as long as this notice is preserved.
4179e0146f7Smrg
4189e0146f7Smrg# This macro actually does too much.  Some checks are only needed if
4199e0146f7Smrg# your package does certain things.  But this isn't really a big deal.
4209e0146f7Smrg
4211afad795Smrgdnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
4221afad795Smrgm4_define([AC_PROG_CC],
4231afad795Smrgm4_defn([AC_PROG_CC])
4241afad795Smrg[_AM_PROG_CC_C_O
4251afad795Smrg])
4261afad795Smrg
4279e0146f7Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4289e0146f7Smrg# AM_INIT_AUTOMAKE([OPTIONS])
4299e0146f7Smrg# -----------------------------------------------
4309e0146f7Smrg# The call with PACKAGE and VERSION arguments is the old style
4319e0146f7Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4329e0146f7Smrg# and VERSION should now be passed to AC_INIT and removed from
4339e0146f7Smrg# the call to AM_INIT_AUTOMAKE.
4349e0146f7Smrg# We support both call styles for the transition.  After
4359e0146f7Smrg# the next Automake release, Autoconf can make the AC_INIT
4369e0146f7Smrg# arguments mandatory, and then we can depend on a new Autoconf
4379e0146f7Smrg# release and drop the old call support.
4389e0146f7SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
4391afad795Smrg[AC_PREREQ([2.65])dnl
4409e0146f7Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
4419e0146f7Smrgdnl the ones we care about.
4429e0146f7Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4439e0146f7SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4449e0146f7SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
4459e0146f7Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
4469e0146f7Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4479e0146f7Smrg  # is not polluted with repeated "-I."
4489e0146f7Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4499e0146f7Smrg  # test to see if srcdir already configured
4509e0146f7Smrg  if test -f $srcdir/config.status; then
4519e0146f7Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4529e0146f7Smrg  fi
4539e0146f7Smrgfi
4549e0146f7Smrg
4559e0146f7Smrg# test whether we have cygpath
4569e0146f7Smrgif test -z "$CYGPATH_W"; then
4579e0146f7Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
4589e0146f7Smrg    CYGPATH_W='cygpath -w'
4599e0146f7Smrg  else
4609e0146f7Smrg    CYGPATH_W=echo
4619e0146f7Smrg  fi
4629e0146f7Smrgfi
4639e0146f7SmrgAC_SUBST([CYGPATH_W])
4649e0146f7Smrg
4659e0146f7Smrg# Define the identity of the package.
4669e0146f7Smrgdnl Distinguish between old-style and new-style calls.
4679e0146f7Smrgm4_ifval([$2],
4681afad795Smrg[AC_DIAGNOSE([obsolete],
4691afad795Smrg             [$0: two- and three-arguments forms are deprecated.])
4701afad795Smrgm4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4719e0146f7Smrg AC_SUBST([PACKAGE], [$1])dnl
4729e0146f7Smrg AC_SUBST([VERSION], [$2])],
4739e0146f7Smrg[_AM_SET_OPTIONS([$1])dnl
4749e0146f7Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4751afad795Smrgm4_if(
4761afad795Smrg  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
4771afad795Smrg  [ok:ok],,
4789e0146f7Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4799e0146f7Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4809e0146f7Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4819e0146f7Smrg
4829e0146f7Smrg_AM_IF_OPTION([no-define],,
4831afad795Smrg[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
4841afad795Smrg AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
4859e0146f7Smrg
4869e0146f7Smrg# Some tools Automake needs.
4879e0146f7SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
4889e0146f7SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
4891afad795SmrgAM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
4901afad795SmrgAM_MISSING_PROG([AUTOCONF], [autoconf])
4911afad795SmrgAM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
4921afad795SmrgAM_MISSING_PROG([AUTOHEADER], [autoheader])
4931afad795SmrgAM_MISSING_PROG([MAKEINFO], [makeinfo])
4949e0146f7SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4959e0146f7SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4961afad795SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
4971afad795Smrg# For better backward compatibility.  To be removed once Automake 1.9.x
4981afad795Smrg# dies out for good.  For more background, see:
4991afad795Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
5001afad795Smrg# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
5011afad795SmrgAC_SUBST([mkdir_p], ['$(MKDIR_P)'])
5029e0146f7Smrg# We need awk for the "check" target.  The system "awk" is bad on
5039e0146f7Smrg# some platforms.
5049e0146f7SmrgAC_REQUIRE([AC_PROG_AWK])dnl
5059e0146f7SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
5069e0146f7SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
5079e0146f7Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5089e0146f7Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5099e0146f7Smrg			     [_AM_PROG_TAR([v7])])])
5109e0146f7Smrg_AM_IF_OPTION([no-dependencies],,
5119e0146f7Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
5121afad795Smrg		  [_AM_DEPENDENCIES([CC])],
5131afad795Smrg		  [m4_define([AC_PROG_CC],
5141afad795Smrg			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
5159e0146f7SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
5161afad795Smrg		  [_AM_DEPENDENCIES([CXX])],
5171afad795Smrg		  [m4_define([AC_PROG_CXX],
5181afad795Smrg			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
5199e0146f7SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
5201afad795Smrg		  [_AM_DEPENDENCIES([OBJC])],
5211afad795Smrg		  [m4_define([AC_PROG_OBJC],
5221afad795Smrg			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
5231afad795SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
5241afad795Smrg		  [_AM_DEPENDENCIES([OBJCXX])],
5251afad795Smrg		  [m4_define([AC_PROG_OBJCXX],
5261afad795Smrg			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
5279e0146f7Smrg])
5281afad795SmrgAC_REQUIRE([AM_SILENT_RULES])dnl
5291afad795Smrgdnl The testsuite driver may need to know about EXEEXT, so add the
5301afad795Smrgdnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
5311afad795Smrgdnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
5329e0146f7SmrgAC_CONFIG_COMMANDS_PRE(dnl
5339e0146f7Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
5349e0146f7Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
5359e0146f7Smrg
5361afad795Smrg# POSIX will say in a future version that running "rm -f" with no argument
5371afad795Smrg# is OK; and we want to be able to make that assumption in our Makefile
5381afad795Smrg# recipes.  So use an aggressive probe to check that the usage we want is
5391afad795Smrg# actually supported "in the wild" to an acceptable degree.
5401afad795Smrg# See automake bug#10828.
5411afad795Smrg# To make any issue more visible, cause the running configure to be aborted
5421afad795Smrg# by default if the 'rm' program in use doesn't match our expectations; the
5431afad795Smrg# user can still override this though.
5441afad795Smrgif rm -f && rm -fr && rm -rf; then : OK; else
5451afad795Smrg  cat >&2 <<'END'
5461afad795SmrgOops!
5471afad795Smrg
5481afad795SmrgYour 'rm' program seems unable to run without file operands specified
5491afad795Smrgon the command line, even when the '-f' option is present.  This is contrary
5501afad795Smrgto the behaviour of most rm programs out there, and not conforming with
5511afad795Smrgthe upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
5521afad795Smrg
5531afad795SmrgPlease tell bug-automake@gnu.org about your system, including the value
5541afad795Smrgof your $PATH and any error possibly output before this message.  This
5551afad795Smrgcan help us improve future automake versions.
5561afad795Smrg
5571afad795SmrgEND
5581afad795Smrg  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
5591afad795Smrg    echo 'Configuration will proceed anyway, since you have set the' >&2
5601afad795Smrg    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
5611afad795Smrg    echo >&2
5621afad795Smrg  else
5631afad795Smrg    cat >&2 <<'END'
5641afad795SmrgAborting the configuration process, to ensure you take notice of the issue.
5651afad795Smrg
5661afad795SmrgYou can download and install GNU coreutils to get an 'rm' implementation
5671afad795Smrgthat behaves properly: <http://www.gnu.org/software/coreutils/>.
5681afad795Smrg
5691afad795SmrgIf you want to complete the configuration process using your problematic
5701afad795Smrg'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
5711afad795Smrgto "yes", and re-run configure.
5721afad795Smrg
5731afad795SmrgEND
5741afad795Smrg    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
5751afad795Smrg  fi
5761afad795Smrgfi])
5771afad795Smrg
5781afad795Smrgdnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
5799e0146f7Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
5809e0146f7Smrgdnl mangled by Autoconf and run in a shell conditional statement.
5819e0146f7Smrgm4_define([_AC_COMPILER_EXEEXT],
5829e0146f7Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
5839e0146f7Smrg
5849e0146f7Smrg# When config.status generates a header, we must update the stamp-h file.
5859e0146f7Smrg# This file resides in the same directory as the config header
5869e0146f7Smrg# that is generated.  The stamp files are numbered to have different names.
5879e0146f7Smrg
5889e0146f7Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5899e0146f7Smrg# loop where config.status creates the headers, so we can generate
5909e0146f7Smrg# our stamp files there.
5919e0146f7SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5929e0146f7Smrg[# Compute $1's index in $config_headers.
5939e0146f7Smrg_am_arg=$1
5949e0146f7Smrg_am_stamp_count=1
5959e0146f7Smrgfor _am_header in $config_headers :; do
5969e0146f7Smrg  case $_am_header in
5979e0146f7Smrg    $_am_arg | $_am_arg:* )
5989e0146f7Smrg      break ;;
5999e0146f7Smrg    * )
6009e0146f7Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
6019e0146f7Smrg  esac
6029e0146f7Smrgdone
6039e0146f7Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
6049e0146f7Smrg
6051afad795Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
6069e0146f7Smrg#
6079e0146f7Smrg# This file is free software; the Free Software Foundation
6089e0146f7Smrg# gives unlimited permission to copy and/or distribute it,
6099e0146f7Smrg# with or without modifications, as long as this notice is preserved.
6109e0146f7Smrg
6119e0146f7Smrg# AM_PROG_INSTALL_SH
6129e0146f7Smrg# ------------------
6139e0146f7Smrg# Define $install_sh.
6149e0146f7SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
6159e0146f7Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
6169e0146f7Smrgif test x"${install_sh}" != xset; then
6179e0146f7Smrg  case $am_aux_dir in
6189e0146f7Smrg  *\ * | *\	*)
6199e0146f7Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
6209e0146f7Smrg  *)
6219e0146f7Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
6229e0146f7Smrg  esac
6239e0146f7Smrgfi
6241afad795SmrgAC_SUBST([install_sh])])
6259e0146f7Smrg
6261afad795Smrg# Copyright (C) 2003-2013 Free Software Foundation, Inc.
6279e0146f7Smrg#
6289e0146f7Smrg# This file is free software; the Free Software Foundation
6299e0146f7Smrg# gives unlimited permission to copy and/or distribute it,
6309e0146f7Smrg# with or without modifications, as long as this notice is preserved.
631492e1cfeSmrg
6329e0146f7Smrg# Check whether the underlying file-system supports filenames
6339e0146f7Smrg# with a leading dot.  For instance MS-DOS doesn't.
6349e0146f7SmrgAC_DEFUN([AM_SET_LEADING_DOT],
6359e0146f7Smrg[rm -rf .tst 2>/dev/null
6369e0146f7Smrgmkdir .tst 2>/dev/null
6379e0146f7Smrgif test -d .tst; then
6389e0146f7Smrg  am__leading_dot=.
6399e0146f7Smrgelse
6409e0146f7Smrg  am__leading_dot=_
6419e0146f7Smrgfi
6429e0146f7Smrgrmdir .tst 2>/dev/null
6439e0146f7SmrgAC_SUBST([am__leading_dot])])
6449e0146f7Smrg
6459e0146f7Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
6469e0146f7Smrg# From Jim Meyering
6479e0146f7Smrg
6481afad795Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
6499e0146f7Smrg#
6509e0146f7Smrg# This file is free software; the Free Software Foundation
6519e0146f7Smrg# gives unlimited permission to copy and/or distribute it,
6529e0146f7Smrg# with or without modifications, as long as this notice is preserved.
6539e0146f7Smrg
6549e0146f7Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
6559e0146f7Smrg# ----------------------------------
6569e0146f7Smrg# Control maintainer-specific portions of Makefiles.
6571afad795Smrg# Default is to disable them, unless 'enable' is passed literally.
6581afad795Smrg# For symmetry, 'disable' may be passed as well.  Anyway, the user
6599e0146f7Smrg# can override the default with the --enable/--disable switch.
6609e0146f7SmrgAC_DEFUN([AM_MAINTAINER_MODE],
6619e0146f7Smrg[m4_case(m4_default([$1], [disable]),
6629e0146f7Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
6639e0146f7Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
6649e0146f7Smrg       [m4_define([am_maintainer_other], [enable])
6659e0146f7Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
6661afad795SmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
6679e0146f7Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
6689e0146f7Smrg  AC_ARG_ENABLE([maintainer-mode],
6691afad795Smrg    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
6701afad795Smrg      am_maintainer_other[ make rules and dependencies not useful
6711afad795Smrg      (and sometimes confusing) to the casual installer])],
6721afad795Smrg    [USE_MAINTAINER_MODE=$enableval],
6731afad795Smrg    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
6749e0146f7Smrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
6759e0146f7Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
6769e0146f7Smrg  MAINT=$MAINTAINER_MODE_TRUE
6779e0146f7Smrg  AC_SUBST([MAINT])dnl
6789e0146f7Smrg]
6799e0146f7Smrg)
6809e0146f7Smrg
6819e0146f7Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
6829e0146f7Smrg
6831afad795Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
6849e0146f7Smrg#
6859e0146f7Smrg# This file is free software; the Free Software Foundation
6869e0146f7Smrg# gives unlimited permission to copy and/or distribute it,
6879e0146f7Smrg# with or without modifications, as long as this notice is preserved.
6889e0146f7Smrg
689492e1cfeSmrg# AM_MAKE_INCLUDE()
690492e1cfeSmrg# -----------------
691492e1cfeSmrg# Check to see how make treats includes.
692492e1cfeSmrgAC_DEFUN([AM_MAKE_INCLUDE],
693492e1cfeSmrg[am_make=${MAKE-make}
694492e1cfeSmrgcat > confinc << 'END'
695492e1cfeSmrgam__doit:
6969e0146f7Smrg	@echo this is the am__doit target
697492e1cfeSmrg.PHONY: am__doit
698492e1cfeSmrgEND
699492e1cfeSmrg# If we don't find an include directive, just comment out the code.
700492e1cfeSmrgAC_MSG_CHECKING([for style of include used by $am_make])
701492e1cfeSmrgam__include="#"
702492e1cfeSmrgam__quote=
703492e1cfeSmrg_am_result=none
704492e1cfeSmrg# First try GNU make style include.
705492e1cfeSmrgecho "include confinc" > confmf
7061afad795Smrg# Ignore all kinds of additional output from 'make'.
7079e0146f7Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
7089e0146f7Smrg*the\ am__doit\ target*)
7099e0146f7Smrg  am__include=include
7109e0146f7Smrg  am__quote=
7119e0146f7Smrg  _am_result=GNU
7129e0146f7Smrg  ;;
7139e0146f7Smrgesac
714492e1cfeSmrg# Now try BSD make style include.
715492e1cfeSmrgif test "$am__include" = "#"; then
716492e1cfeSmrg   echo '.include "confinc"' > confmf
7179e0146f7Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
7189e0146f7Smrg   *the\ am__doit\ target*)
7199e0146f7Smrg     am__include=.include
7209e0146f7Smrg     am__quote="\""
7219e0146f7Smrg     _am_result=BSD
7229e0146f7Smrg     ;;
7239e0146f7Smrg   esac
724492e1cfeSmrgfi
725492e1cfeSmrgAC_SUBST([am__include])
726492e1cfeSmrgAC_SUBST([am__quote])
727492e1cfeSmrgAC_MSG_RESULT([$_am_result])
728492e1cfeSmrgrm -f confinc confmf
729492e1cfeSmrg])
730492e1cfeSmrg
7319e0146f7Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
732492e1cfeSmrg
7331afad795Smrg# Copyright (C) 1997-2013 Free Software Foundation, Inc.
7349e0146f7Smrg#
7359e0146f7Smrg# This file is free software; the Free Software Foundation
7369e0146f7Smrg# gives unlimited permission to copy and/or distribute it,
7379e0146f7Smrg# with or without modifications, as long as this notice is preserved.
738492e1cfeSmrg
7399e0146f7Smrg# AM_MISSING_PROG(NAME, PROGRAM)
7409e0146f7Smrg# ------------------------------
7419e0146f7SmrgAC_DEFUN([AM_MISSING_PROG],
7429e0146f7Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
7439e0146f7Smrg$1=${$1-"${am_missing_run}$2"}
7449e0146f7SmrgAC_SUBST($1)])
745492e1cfeSmrg
7469e0146f7Smrg# AM_MISSING_HAS_RUN
7479e0146f7Smrg# ------------------
7481afad795Smrg# Define MISSING if not defined so far and test if it is modern enough.
7491afad795Smrg# If it is, set am_missing_run to use it, otherwise, to nothing.
7509e0146f7SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
7519e0146f7Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
7529e0146f7SmrgAC_REQUIRE_AUX_FILE([missing])dnl
7539e0146f7Smrgif test x"${MISSING+set}" != xset; then
7549e0146f7Smrg  case $am_aux_dir in
7559e0146f7Smrg  *\ * | *\	*)
7569e0146f7Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
7579e0146f7Smrg  *)
7589e0146f7Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
7599e0146f7Smrg  esac
7609e0146f7Smrgfi
7619e0146f7Smrg# Use eval to expand $SHELL
7621afad795Smrgif eval "$MISSING --is-lightweight"; then
7631afad795Smrg  am_missing_run="$MISSING "
764492e1cfeSmrgelse
7659e0146f7Smrg  am_missing_run=
7661afad795Smrg  AC_MSG_WARN(['missing' script is too old or missing])
767492e1cfeSmrgfi
7689e0146f7Smrg])
769492e1cfeSmrg
7709e0146f7Smrg# Helper functions for option handling.                     -*- Autoconf -*-
771492e1cfeSmrg
7721afad795Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
7739e0146f7Smrg#
7749e0146f7Smrg# This file is free software; the Free Software Foundation
7759e0146f7Smrg# gives unlimited permission to copy and/or distribute it,
7769e0146f7Smrg# with or without modifications, as long as this notice is preserved.
777492e1cfeSmrg
7789e0146f7Smrg# _AM_MANGLE_OPTION(NAME)
7799e0146f7Smrg# -----------------------
7809e0146f7SmrgAC_DEFUN([_AM_MANGLE_OPTION],
7819e0146f7Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
782492e1cfeSmrg
7839e0146f7Smrg# _AM_SET_OPTION(NAME)
7841afad795Smrg# --------------------
7859e0146f7Smrg# Set option NAME.  Presently that only means defining a flag for this option.
7869e0146f7SmrgAC_DEFUN([_AM_SET_OPTION],
7871afad795Smrg[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
788492e1cfeSmrg
7899e0146f7Smrg# _AM_SET_OPTIONS(OPTIONS)
7901afad795Smrg# ------------------------
7919e0146f7Smrg# OPTIONS is a space-separated list of Automake options.
7929e0146f7SmrgAC_DEFUN([_AM_SET_OPTIONS],
7939e0146f7Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
794492e1cfeSmrg
7959e0146f7Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
7969e0146f7Smrg# -------------------------------------------
7979e0146f7Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
7989e0146f7SmrgAC_DEFUN([_AM_IF_OPTION],
7999e0146f7Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
800492e1cfeSmrg
8011afad795Smrg# Copyright (C) 1999-2013 Free Software Foundation, Inc.
8021afad795Smrg#
8031afad795Smrg# This file is free software; the Free Software Foundation
8041afad795Smrg# gives unlimited permission to copy and/or distribute it,
8051afad795Smrg# with or without modifications, as long as this notice is preserved.
806492e1cfeSmrg
8071afad795Smrg# _AM_PROG_CC_C_O
8081afad795Smrg# ---------------
8091afad795Smrg# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
8101afad795Smrg# to automatically call this.
8111afad795SmrgAC_DEFUN([_AM_PROG_CC_C_O],
8121afad795Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
8131afad795SmrgAC_REQUIRE_AUX_FILE([compile])dnl
8141afad795SmrgAC_LANG_PUSH([C])dnl
8151afad795SmrgAC_CACHE_CHECK(
8161afad795Smrg  [whether $CC understands -c and -o together],
8171afad795Smrg  [am_cv_prog_cc_c_o],
8181afad795Smrg  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
8191afad795Smrg  # Make sure it works both with $CC and with simple cc.
8201afad795Smrg  # Following AC_PROG_CC_C_O, we do the test twice because some
8211afad795Smrg  # compilers refuse to overwrite an existing .o file with -o,
8221afad795Smrg  # though they will create one.
8231afad795Smrg  am_cv_prog_cc_c_o=yes
8241afad795Smrg  for am_i in 1 2; do
8251afad795Smrg    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
8261afad795Smrg         && test -f conftest2.$ac_objext; then
8271afad795Smrg      : OK
8281afad795Smrg    else
8291afad795Smrg      am_cv_prog_cc_c_o=no
8301afad795Smrg      break
8311afad795Smrg    fi
8321afad795Smrg  done
8331afad795Smrg  rm -f core conftest*
8341afad795Smrg  unset am_i])
8351afad795Smrgif test "$am_cv_prog_cc_c_o" != yes; then
8361afad795Smrg   # Losing compiler, so override with the script.
8371afad795Smrg   # FIXME: It is wrong to rewrite CC.
8381afad795Smrg   # But if we don't then we get into trouble of one sort or another.
8391afad795Smrg   # A longer-term fix would be to have automake use am__CC in this case,
8401afad795Smrg   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
8411afad795Smrg   CC="$am_aux_dir/compile $CC"
8421afad795Smrgfi
8431afad795SmrgAC_LANG_POP([C])])
8441afad795Smrg
8451afad795Smrg# For backward compatibility.
8461afad795SmrgAC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
8471afad795Smrg
8481afad795Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
849492e1cfeSmrg#
8509e0146f7Smrg# This file is free software; the Free Software Foundation
8519e0146f7Smrg# gives unlimited permission to copy and/or distribute it,
8529e0146f7Smrg# with or without modifications, as long as this notice is preserved.
853492e1cfeSmrg
8541afad795Smrg# AM_RUN_LOG(COMMAND)
8551afad795Smrg# -------------------
8561afad795Smrg# Run COMMAND, save the exit status in ac_status, and log it.
8571afad795Smrg# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
8581afad795SmrgAC_DEFUN([AM_RUN_LOG],
8591afad795Smrg[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
8601afad795Smrg   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
8611afad795Smrg   ac_status=$?
8621afad795Smrg   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
8631afad795Smrg   (exit $ac_status); }])
8641afad795Smrg
8651afad795Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
8661afad795Smrg
8671afad795Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc.
8681afad795Smrg#
8691afad795Smrg# This file is free software; the Free Software Foundation
8701afad795Smrg# gives unlimited permission to copy and/or distribute it,
8711afad795Smrg# with or without modifications, as long as this notice is preserved.
872492e1cfeSmrg
8739e0146f7Smrg# AM_SANITY_CHECK
8749e0146f7Smrg# ---------------
8759e0146f7SmrgAC_DEFUN([AM_SANITY_CHECK],
8769e0146f7Smrg[AC_MSG_CHECKING([whether build environment is sane])
8779e0146f7Smrg# Reject unsafe characters in $srcdir or the absolute working directory
8789e0146f7Smrg# name.  Accept space and tab only in the latter.
8799e0146f7Smrgam_lf='
8809e0146f7Smrg'
8819e0146f7Smrgcase `pwd` in
8829e0146f7Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
8839e0146f7Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
8849e0146f7Smrgesac
8859e0146f7Smrgcase $srcdir in
8869e0146f7Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
8871afad795Smrg    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
8889e0146f7Smrgesac
889492e1cfeSmrg
8901afad795Smrg# Do 'set' in a subshell so we don't clobber the current shell's
8919e0146f7Smrg# arguments.  Must try -L first in case configure is actually a
8929e0146f7Smrg# symlink; some systems play weird games with the mod time of symlinks
8939e0146f7Smrg# (eg FreeBSD returns the mod time of the symlink's containing
8949e0146f7Smrg# directory).
8959e0146f7Smrgif (
8961afad795Smrg   am_has_slept=no
8971afad795Smrg   for am_try in 1 2; do
8981afad795Smrg     echo "timestamp, slept: $am_has_slept" > conftest.file
8991afad795Smrg     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
9001afad795Smrg     if test "$[*]" = "X"; then
9011afad795Smrg	# -L didn't work.
9021afad795Smrg	set X `ls -t "$srcdir/configure" conftest.file`
9031afad795Smrg     fi
9041afad795Smrg     if test "$[*]" != "X $srcdir/configure conftest.file" \
9051afad795Smrg	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
9061afad795Smrg
9071afad795Smrg	# If neither matched, then we have a broken ls.  This can happen
9081afad795Smrg	# if, for instance, CONFIG_SHELL is bash and it inherits a
9091afad795Smrg	# broken ls alias from the environment.  This has actually
9101afad795Smrg	# happened.  Such a system could not be considered "sane".
9111afad795Smrg	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
9121afad795Smrg  alias in your environment])
9131afad795Smrg     fi
9141afad795Smrg     if test "$[2]" = conftest.file || test $am_try -eq 2; then
9151afad795Smrg       break
9161afad795Smrg     fi
9171afad795Smrg     # Just in case.
9181afad795Smrg     sleep 1
9191afad795Smrg     am_has_slept=yes
9201afad795Smrg   done
9219e0146f7Smrg   test "$[2]" = conftest.file
9229e0146f7Smrg   )
9239e0146f7Smrgthen
9249e0146f7Smrg   # Ok.
9259e0146f7Smrg   :
926492e1cfeSmrgelse
9279e0146f7Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
9289e0146f7SmrgCheck your system clock])
9299e0146f7Smrgfi
9301afad795SmrgAC_MSG_RESULT([yes])
9311afad795Smrg# If we didn't sleep, we still need to ensure time stamps of config.status and
9321afad795Smrg# generated files are strictly newer.
9331afad795Smrgam_sleep_pid=
9341afad795Smrgif grep 'slept: no' conftest.file >/dev/null 2>&1; then
9351afad795Smrg  ( sleep 1 ) &
9361afad795Smrg  am_sleep_pid=$!
9371afad795Smrgfi
9381afad795SmrgAC_CONFIG_COMMANDS_PRE(
9391afad795Smrg  [AC_MSG_CHECKING([that generated files are newer than configure])
9401afad795Smrg   if test -n "$am_sleep_pid"; then
9411afad795Smrg     # Hide warnings about reused PIDs.
9421afad795Smrg     wait $am_sleep_pid 2>/dev/null
9431afad795Smrg   fi
9441afad795Smrg   AC_MSG_RESULT([done])])
9451afad795Smrgrm -f conftest.file
9461afad795Smrg])
947492e1cfeSmrg
9481afad795Smrg# Copyright (C) 2009-2013 Free Software Foundation, Inc.
9499e0146f7Smrg#
9509e0146f7Smrg# This file is free software; the Free Software Foundation
9519e0146f7Smrg# gives unlimited permission to copy and/or distribute it,
9529e0146f7Smrg# with or without modifications, as long as this notice is preserved.
953492e1cfeSmrg
9549e0146f7Smrg# AM_SILENT_RULES([DEFAULT])
9559e0146f7Smrg# --------------------------
9569e0146f7Smrg# Enable less verbose build rules; with the default set to DEFAULT
9571afad795Smrg# ("yes" being less verbose, "no" or empty being verbose).
9589e0146f7SmrgAC_DEFUN([AM_SILENT_RULES],
9591afad795Smrg[AC_ARG_ENABLE([silent-rules], [dnl
9601afad795SmrgAS_HELP_STRING(
9611afad795Smrg  [--enable-silent-rules],
9621afad795Smrg  [less verbose build output (undo: "make V=1")])
9631afad795SmrgAS_HELP_STRING(
9641afad795Smrg  [--disable-silent-rules],
9651afad795Smrg  [verbose build output (undo: "make V=0")])dnl
9661afad795Smrg])
9671afad795Smrgcase $enable_silent_rules in @%:@ (((
9681afad795Smrg  yes) AM_DEFAULT_VERBOSITY=0;;
9691afad795Smrg   no) AM_DEFAULT_VERBOSITY=1;;
9701afad795Smrg    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
9719e0146f7Smrgesac
9721afad795Smrgdnl
9731afad795Smrgdnl A few 'make' implementations (e.g., NonStop OS and NextStep)
9741afad795Smrgdnl do not support nested variable expansions.
9751afad795Smrgdnl See automake bug#9928 and bug#10237.
9761afad795Smrgam_make=${MAKE-make}
9771afad795SmrgAC_CACHE_CHECK([whether $am_make supports nested variables],
9781afad795Smrg   [am_cv_make_support_nested_variables],
9791afad795Smrg   [if AS_ECHO([['TRUE=$(BAR$(V))
9801afad795SmrgBAR0=false
9811afad795SmrgBAR1=true
9821afad795SmrgV=1
9831afad795Smrgam__doit:
9841afad795Smrg	@$(TRUE)
9851afad795Smrg.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
9861afad795Smrg  am_cv_make_support_nested_variables=yes
9871afad795Smrgelse
9881afad795Smrg  am_cv_make_support_nested_variables=no
9891afad795Smrgfi])
9901afad795Smrgif test $am_cv_make_support_nested_variables = yes; then
9911afad795Smrg  dnl Using '$V' instead of '$(V)' breaks IRIX make.
9921afad795Smrg  AM_V='$(V)'
9931afad795Smrg  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
9941afad795Smrgelse
9951afad795Smrg  AM_V=$AM_DEFAULT_VERBOSITY
9961afad795Smrg  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
9971afad795Smrgfi
9981afad795SmrgAC_SUBST([AM_V])dnl
9991afad795SmrgAM_SUBST_NOTMAKE([AM_V])dnl
10001afad795SmrgAC_SUBST([AM_DEFAULT_V])dnl
10011afad795SmrgAM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
10029e0146f7SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
10039e0146f7SmrgAM_BACKSLASH='\'
10049e0146f7SmrgAC_SUBST([AM_BACKSLASH])dnl
10059e0146f7Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
10069e0146f7Smrg])
10079e0146f7Smrg
10081afad795Smrg# Copyright (C) 2001-2013 Free Software Foundation, Inc.
1009492e1cfeSmrg#
10109e0146f7Smrg# This file is free software; the Free Software Foundation
10119e0146f7Smrg# gives unlimited permission to copy and/or distribute it,
10129e0146f7Smrg# with or without modifications, as long as this notice is preserved.
10139e0146f7Smrg
10149e0146f7Smrg# AM_PROG_INSTALL_STRIP
10159e0146f7Smrg# ---------------------
10161afad795Smrg# One issue with vendor 'install' (even GNU) is that you can't
10179e0146f7Smrg# specify the program used to strip binaries.  This is especially
10189e0146f7Smrg# annoying in cross-compiling environments, where the build's strip
10199e0146f7Smrg# is unlikely to handle the host's binaries.
10209e0146f7Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
10211afad795Smrg# always use install-sh in "make install-strip", and initialize
10229e0146f7Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
10239e0146f7SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
10249e0146f7Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
10251afad795Smrg# Installed binaries are usually stripped using 'strip' when the user
10261afad795Smrg# run "make install-strip".  However 'strip' might not be the right
10279e0146f7Smrg# tool to use in cross-compilation environments, therefore Automake
10281afad795Smrg# will honor the 'STRIP' environment variable to overrule this program.
10291afad795Smrgdnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
10309e0146f7Smrgif test "$cross_compiling" != no; then
10319e0146f7Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
10329e0146f7Smrgfi
10339e0146f7SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
10349e0146f7SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
10359e0146f7Smrg
10361afad795Smrg# Copyright (C) 2006-2013 Free Software Foundation, Inc.
1037492e1cfeSmrg#
10389e0146f7Smrg# This file is free software; the Free Software Foundation
10399e0146f7Smrg# gives unlimited permission to copy and/or distribute it,
10409e0146f7Smrg# with or without modifications, as long as this notice is preserved.
1041492e1cfeSmrg
10429e0146f7Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
10439e0146f7Smrg# ---------------------------
10449e0146f7Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
10459e0146f7Smrg# This macro is traced by Automake.
10469e0146f7SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
1047492e1cfeSmrg
10489e0146f7Smrg# AM_SUBST_NOTMAKE(VARIABLE)
10491afad795Smrg# --------------------------
10509e0146f7Smrg# Public sister of _AM_SUBST_NOTMAKE.
10519e0146f7SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1052492e1cfeSmrg
10539e0146f7Smrg# Check how to create a tarball.                            -*- Autoconf -*-
1054492e1cfeSmrg
10551afad795Smrg# Copyright (C) 2004-2013 Free Software Foundation, Inc.
10569e0146f7Smrg#
10579e0146f7Smrg# This file is free software; the Free Software Foundation
10589e0146f7Smrg# gives unlimited permission to copy and/or distribute it,
10599e0146f7Smrg# with or without modifications, as long as this notice is preserved.
1060492e1cfeSmrg
10619e0146f7Smrg# _AM_PROG_TAR(FORMAT)
10629e0146f7Smrg# --------------------
10639e0146f7Smrg# Check how to create a tarball in format FORMAT.
10641afad795Smrg# FORMAT should be one of 'v7', 'ustar', or 'pax'.
10659e0146f7Smrg#
10669e0146f7Smrg# Substitute a variable $(am__tar) that is a command
10679e0146f7Smrg# writing to stdout a FORMAT-tarball containing the directory
10689e0146f7Smrg# $tardir.
10699e0146f7Smrg#     tardir=directory && $(am__tar) > result.tar
10709e0146f7Smrg#
10719e0146f7Smrg# Substitute a variable $(am__untar) that extract such
10729e0146f7Smrg# a tarball read from stdin.
10739e0146f7Smrg#     $(am__untar) < result.tar
10741afad795Smrg#
10759e0146f7SmrgAC_DEFUN([_AM_PROG_TAR],
10761afad795Smrg[# Always define AMTAR for backward compatibility.  Yes, it's still used
10771afad795Smrg# in the wild :-(  We should find a proper way to deprecate it ...
10781afad795SmrgAC_SUBST([AMTAR], ['$${TAR-tar}'])
10791afad795Smrg
10801afad795Smrg# We'll loop over all known methods to create a tar archive until one works.
10819e0146f7Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1082492e1cfeSmrg
10831afad795Smrgm4_if([$1], [v7],
10841afad795Smrg  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
10851afad795Smrg
10861afad795Smrg  [m4_case([$1],
10871afad795Smrg    [ustar],
10881afad795Smrg     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
10891afad795Smrg      # There is notably a 21 bits limit for the UID and the GID.  In fact,
10901afad795Smrg      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
10911afad795Smrg      # and bug#13588).
10921afad795Smrg      am_max_uid=2097151 # 2^21 - 1
10931afad795Smrg      am_max_gid=$am_max_uid
10941afad795Smrg      # The $UID and $GID variables are not portable, so we need to resort
10951afad795Smrg      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
10961afad795Smrg      # below are definitely unexpected, so allow the users to see them
10971afad795Smrg      # (that is, avoid stderr redirection).
10981afad795Smrg      am_uid=`id -u || echo unknown`
10991afad795Smrg      am_gid=`id -g || echo unknown`
11001afad795Smrg      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
11011afad795Smrg      if test $am_uid -le $am_max_uid; then
11021afad795Smrg         AC_MSG_RESULT([yes])
11031afad795Smrg      else
11041afad795Smrg         AC_MSG_RESULT([no])
11051afad795Smrg         _am_tools=none
11061afad795Smrg      fi
11071afad795Smrg      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
11081afad795Smrg      if test $am_gid -le $am_max_gid; then
11091afad795Smrg         AC_MSG_RESULT([yes])
11101afad795Smrg      else
11111afad795Smrg        AC_MSG_RESULT([no])
11121afad795Smrg        _am_tools=none
11131afad795Smrg      fi],
11141afad795Smrg
11151afad795Smrg  [pax],
11161afad795Smrg    [],
11171afad795Smrg
11181afad795Smrg  [m4_fatal([Unknown tar format])])
11191afad795Smrg
11201afad795Smrg  AC_MSG_CHECKING([how to create a $1 tar archive])
11211afad795Smrg
11221afad795Smrg  # Go ahead even if we have the value already cached.  We do so because we
11231afad795Smrg  # need to set the values for the 'am__tar' and 'am__untar' variables.
11241afad795Smrg  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
11251afad795Smrg
11261afad795Smrg  for _am_tool in $_am_tools; do
11271afad795Smrg    case $_am_tool in
11281afad795Smrg    gnutar)
11291afad795Smrg      for _am_tar in tar gnutar gtar; do
11301afad795Smrg        AM_RUN_LOG([$_am_tar --version]) && break
11311afad795Smrg      done
11321afad795Smrg      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
11331afad795Smrg      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
11341afad795Smrg      am__untar="$_am_tar -xf -"
11351afad795Smrg      ;;
11361afad795Smrg    plaintar)
11371afad795Smrg      # Must skip GNU tar: if it does not support --format= it doesn't create
11381afad795Smrg      # ustar tarball either.
11391afad795Smrg      (tar --version) >/dev/null 2>&1 && continue
11401afad795Smrg      am__tar='tar chf - "$$tardir"'
11411afad795Smrg      am__tar_='tar chf - "$tardir"'
11421afad795Smrg      am__untar='tar xf -'
11431afad795Smrg      ;;
11441afad795Smrg    pax)
11451afad795Smrg      am__tar='pax -L -x $1 -w "$$tardir"'
11461afad795Smrg      am__tar_='pax -L -x $1 -w "$tardir"'
11471afad795Smrg      am__untar='pax -r'
11481afad795Smrg      ;;
11491afad795Smrg    cpio)
11501afad795Smrg      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
11511afad795Smrg      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
11521afad795Smrg      am__untar='cpio -i -H $1 -d'
11531afad795Smrg      ;;
11541afad795Smrg    none)
11551afad795Smrg      am__tar=false
11561afad795Smrg      am__tar_=false
11571afad795Smrg      am__untar=false
11581afad795Smrg      ;;
11591afad795Smrg    esac
1160492e1cfeSmrg
11611afad795Smrg    # If the value was cached, stop now.  We just wanted to have am__tar
11621afad795Smrg    # and am__untar set.
11631afad795Smrg    test -n "${am_cv_prog_tar_$1}" && break
11641afad795Smrg
11651afad795Smrg    # tar/untar a dummy directory, and stop if the command works.
11661afad795Smrg    rm -rf conftest.dir
11671afad795Smrg    mkdir conftest.dir
11681afad795Smrg    echo GrepMe > conftest.dir/file
11691afad795Smrg    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
11701afad795Smrg    rm -rf conftest.dir
11711afad795Smrg    if test -s conftest.tar; then
11721afad795Smrg      AM_RUN_LOG([$am__untar <conftest.tar])
11731afad795Smrg      AM_RUN_LOG([cat conftest.dir/file])
11741afad795Smrg      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
11751afad795Smrg    fi
11761afad795Smrg  done
11779e0146f7Smrg  rm -rf conftest.dir
1178492e1cfeSmrg
11791afad795Smrg  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
11801afad795Smrg  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
11811afad795Smrg
11829e0146f7SmrgAC_SUBST([am__tar])
11839e0146f7SmrgAC_SUBST([am__untar])
11849e0146f7Smrg]) # _AM_PROG_TAR
1185492e1cfeSmrg
11863538fbe3Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
11873538fbe3Smrg# 
11883538fbe3Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
11893538fbe3Smrg#
11903538fbe3Smrg# This program is free software; you can redistribute it and/or modify
11913538fbe3Smrg# it under the terms of the GNU General Public License as published by
11923538fbe3Smrg# the Free Software Foundation; either version 2 of the License, or
11933538fbe3Smrg# (at your option) any later version.
11943538fbe3Smrg#
11953538fbe3Smrg# This program is distributed in the hope that it will be useful, but
11963538fbe3Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
11973538fbe3Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11983538fbe3Smrg# General Public License for more details.
11993538fbe3Smrg#
12003538fbe3Smrg# You should have received a copy of the GNU General Public License
12013538fbe3Smrg# along with this program; if not, write to the Free Software
12023538fbe3Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
12033538fbe3Smrg#
12043538fbe3Smrg# As a special exception to the GNU General Public License, if you
12053538fbe3Smrg# distribute this file as part of a program that contains a
12063538fbe3Smrg# configuration script generated by Autoconf, you may include it under
12073538fbe3Smrg# the same distribution terms that you use for the rest of that program.
12083538fbe3Smrg
12093538fbe3Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
12103538fbe3Smrg# ----------------------------------
12113538fbe3SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
12123538fbe3Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
12133538fbe3Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
12143538fbe3SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
12153538fbe3Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
12163538fbe3Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
12173538fbe3Smrgfi
12183538fbe3Smrgif test -n "$PKG_CONFIG"; then
12193538fbe3Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
12203538fbe3Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
12213538fbe3Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
12223538fbe3Smrg		AC_MSG_RESULT([yes])
12233538fbe3Smrg	else
12243538fbe3Smrg		AC_MSG_RESULT([no])
12253538fbe3Smrg		PKG_CONFIG=""
12263538fbe3Smrg	fi
12273538fbe3Smrg		
12283538fbe3Smrgfi[]dnl
12293538fbe3Smrg])# PKG_PROG_PKG_CONFIG
12303538fbe3Smrg
12313538fbe3Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
12323538fbe3Smrg#
12333538fbe3Smrg# Check to see whether a particular set of modules exists.  Similar
12343538fbe3Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
12353538fbe3Smrg#
12363538fbe3Smrg#
12373538fbe3Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
12383538fbe3Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
12393538fbe3Smrg# PKG_CHECK_EXISTS manually
12403538fbe3Smrg# --------------------------------------------------------------
12413538fbe3SmrgAC_DEFUN([PKG_CHECK_EXISTS],
12423538fbe3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12433538fbe3Smrgif test -n "$PKG_CONFIG" && \
12443538fbe3Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
12453538fbe3Smrg  m4_ifval([$2], [$2], [:])
12463538fbe3Smrgm4_ifvaln([$3], [else
12473538fbe3Smrg  $3])dnl
12483538fbe3Smrgfi])
12493538fbe3Smrg
12503538fbe3Smrg
12513538fbe3Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
12523538fbe3Smrg# ---------------------------------------------
12533538fbe3Smrgm4_define([_PKG_CONFIG],
12543538fbe3Smrg[if test -n "$$1"; then
12553538fbe3Smrg    pkg_cv_[]$1="$$1"
12563538fbe3Smrg elif test -n "$PKG_CONFIG"; then
12573538fbe3Smrg    PKG_CHECK_EXISTS([$3],
12583538fbe3Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
12593538fbe3Smrg		     [pkg_failed=yes])
12603538fbe3Smrg else
12613538fbe3Smrg    pkg_failed=untried
12623538fbe3Smrgfi[]dnl
12633538fbe3Smrg])# _PKG_CONFIG
12643538fbe3Smrg
12653538fbe3Smrg# _PKG_SHORT_ERRORS_SUPPORTED
12663538fbe3Smrg# -----------------------------
12673538fbe3SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
12683538fbe3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
12693538fbe3Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
12703538fbe3Smrg        _pkg_short_errors_supported=yes
12713538fbe3Smrgelse
12723538fbe3Smrg        _pkg_short_errors_supported=no
12733538fbe3Smrgfi[]dnl
12743538fbe3Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
12753538fbe3Smrg
12763538fbe3Smrg
12773538fbe3Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
12783538fbe3Smrg# [ACTION-IF-NOT-FOUND])
12793538fbe3Smrg#
12803538fbe3Smrg#
12813538fbe3Smrg# Note that if there is a possibility the first call to
12823538fbe3Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
12833538fbe3Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
12843538fbe3Smrg#
12853538fbe3Smrg#
12863538fbe3Smrg# --------------------------------------------------------------
12873538fbe3SmrgAC_DEFUN([PKG_CHECK_MODULES],
12883538fbe3Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
12893538fbe3SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
12903538fbe3SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
12913538fbe3Smrg
12923538fbe3Smrgpkg_failed=no
12933538fbe3SmrgAC_MSG_CHECKING([for $1])
12943538fbe3Smrg
12953538fbe3Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
12963538fbe3Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
12973538fbe3Smrg
12983538fbe3Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
12993538fbe3Smrgand $1[]_LIBS to avoid the need to call pkg-config.
13003538fbe3SmrgSee the pkg-config man page for more details.])
13013538fbe3Smrg
13023538fbe3Smrgif test $pkg_failed = yes; then
13033538fbe3Smrg        _PKG_SHORT_ERRORS_SUPPORTED
13043538fbe3Smrg        if test $_pkg_short_errors_supported = yes; then
13053538fbe3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
13063538fbe3Smrg        else 
13073538fbe3Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
13083538fbe3Smrg        fi
13093538fbe3Smrg	# Put the nasty error message in config.log where it belongs
13103538fbe3Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
13113538fbe3Smrg
13123538fbe3Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
13133538fbe3Smrg[Package requirements ($2) were not met:
13143538fbe3Smrg
13153538fbe3Smrg$$1_PKG_ERRORS
13163538fbe3Smrg
13173538fbe3SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
13183538fbe3Smrginstalled software in a non-standard prefix.
13193538fbe3Smrg
13203538fbe3Smrg_PKG_TEXT
13213538fbe3Smrg])],
13223538fbe3Smrg		[AC_MSG_RESULT([no])
13233538fbe3Smrg                $4])
13243538fbe3Smrgelif test $pkg_failed = untried; then
13253538fbe3Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
13263538fbe3Smrg[The pkg-config script could not be found or is too old.  Make sure it
13273538fbe3Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
13283538fbe3Smrgpath to pkg-config.
13293538fbe3Smrg
13303538fbe3Smrg_PKG_TEXT
13313538fbe3Smrg
13323538fbe3SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
13333538fbe3Smrg		[$4])
13343538fbe3Smrgelse
13353538fbe3Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
13363538fbe3Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
13373538fbe3Smrg        AC_MSG_RESULT([yes])
13383538fbe3Smrg	ifelse([$3], , :, [$3])
13393538fbe3Smrgfi[]dnl
13403538fbe3Smrg])# PKG_CHECK_MODULES
13413538fbe3Smrg
13429e0146f7Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1343492e1cfeSmrgdnl
13449e0146f7Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1345492e1cfeSmrgdnl 
13469e0146f7Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
13479e0146f7Smrgdnl copy of this software and associated documentation files (the "Software"),
13489e0146f7Smrgdnl to deal in the Software without restriction, including without limitation
13499e0146f7Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
13509e0146f7Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
13519e0146f7Smrgdnl Software is furnished to do so, subject to the following conditions:
13529e0146f7Smrgdnl
13539e0146f7Smrgdnl The above copyright notice and this permission notice (including the next
13549e0146f7Smrgdnl paragraph) shall be included in all copies or substantial portions of the
13559e0146f7Smrgdnl Software.
13569e0146f7Smrgdnl
13579e0146f7Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13589e0146f7Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13599e0146f7Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
13609e0146f7Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13619e0146f7Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13629e0146f7Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
13639e0146f7Smrgdnl DEALINGS IN THE SOFTWARE.
13649e0146f7Smrg
13659e0146f7Smrg# XORG_MACROS_VERSION(required-version)
13669e0146f7Smrg# -------------------------------------
13679e0146f7Smrg# Minimum version: 1.1.0
13689e0146f7Smrg#
13699e0146f7Smrg# If you're using a macro added in Version 1.1 or newer, include this in
13709e0146f7Smrg# your configure.ac with the minimum required version, such as:
13719e0146f7Smrg# XORG_MACROS_VERSION(1.1)
13729e0146f7Smrg#
13739e0146f7Smrg# To ensure that this macro is defined, also add:
13749e0146f7Smrg# m4_ifndef([XORG_MACROS_VERSION],
13759e0146f7Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
13769e0146f7Smrg#
13779e0146f7Smrg#
13789e0146f7Smrg# See the "minimum version" comment for each macro you use to see what 
13799e0146f7Smrg# version you require.
13809e0146f7Smrgm4_defun([XORG_MACROS_VERSION],[
13811afad795Smrgm4_define([vers_have], [1.17])
13829e0146f7Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
13839e0146f7Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
13849e0146f7Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
13859e0146f7Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
13869e0146f7Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
13879e0146f7Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
13889e0146f7Smrgm4_undefine([vers_have])
13899e0146f7Smrgm4_undefine([maj_have])
13909e0146f7Smrgm4_undefine([maj_needed])
13919e0146f7Smrg]) # XORG_MACROS_VERSION
1392492e1cfeSmrg
1393492e1cfeSmrg# XORG_PROG_RAWCPP()
1394492e1cfeSmrg# ------------------
13959e0146f7Smrg# Minimum version: 1.0.0
13969e0146f7Smrg#
1397492e1cfeSmrg# Find cpp program and necessary flags for use in pre-processing text files
1398492e1cfeSmrg# such as man pages and config files
1399492e1cfeSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1400492e1cfeSmrgAC_REQUIRE([AC_PROG_CPP])
1401492e1cfeSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1402492e1cfeSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1403492e1cfeSmrg
1404492e1cfeSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1405492e1cfeSmrg# which is not the best choice for supporting other OS'es, but covers most
1406492e1cfeSmrg# of the ones we need for now.
1407492e1cfeSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
14083538fbe3SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1409492e1cfeSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1410492e1cfeSmrg	AC_MSG_RESULT([no])
1411492e1cfeSmrgelse
1412492e1cfeSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1413492e1cfeSmrg		RAWCPPFLAGS=-undef
1414492e1cfeSmrg		AC_MSG_RESULT([yes])
14159e0146f7Smrg	# under Cygwin unix is still defined even with -undef
14169e0146f7Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
14179e0146f7Smrg		RAWCPPFLAGS="-undef -ansi"
14189e0146f7Smrg		AC_MSG_RESULT([yes, with -ansi])
1419492e1cfeSmrg	else
1420492e1cfeSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1421492e1cfeSmrg	fi
1422492e1cfeSmrgfi
1423492e1cfeSmrgrm -f conftest.$ac_ext
1424492e1cfeSmrg
1425492e1cfeSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
14263538fbe3SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1427492e1cfeSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1428492e1cfeSmrg	AC_MSG_RESULT([no])
1429492e1cfeSmrgelse
1430492e1cfeSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1431492e1cfeSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1432492e1cfeSmrg		AC_MSG_RESULT([yes])
1433492e1cfeSmrg	else
1434492e1cfeSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1435492e1cfeSmrg	fi
1436492e1cfeSmrgfi
1437492e1cfeSmrgrm -f conftest.$ac_ext
1438492e1cfeSmrgAC_SUBST(RAWCPPFLAGS)
1439492e1cfeSmrg]) # XORG_PROG_RAWCPP
1440492e1cfeSmrg
1441492e1cfeSmrg# XORG_MANPAGE_SECTIONS()
1442492e1cfeSmrg# -----------------------
14439e0146f7Smrg# Minimum version: 1.0.0
14449e0146f7Smrg#
1445492e1cfeSmrg# Determine which sections man pages go in for the different man page types
1446492e1cfeSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1447492e1cfeSmrg# Not sure if there's any better way than just hardcoding by OS name.
1448492e1cfeSmrg# Override default settings by setting environment variables
14499e0146f7Smrg# Added MAN_SUBSTS in version 1.8
14509e0146f7Smrg# Added AC_PROG_SED in version 1.8
1451492e1cfeSmrg
1452492e1cfeSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1453492e1cfeSmrgAC_REQUIRE([AC_CANONICAL_HOST])
14549e0146f7SmrgAC_REQUIRE([AC_PROG_SED])
1455492e1cfeSmrg
1456492e1cfeSmrgif test x$APP_MAN_SUFFIX = x    ; then
14579e0146f7Smrg    APP_MAN_SUFFIX=1
1458492e1cfeSmrgfi
1459492e1cfeSmrgif test x$APP_MAN_DIR = x    ; then
14609e0146f7Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1461492e1cfeSmrgfi
1462492e1cfeSmrg
1463492e1cfeSmrgif test x$LIB_MAN_SUFFIX = x    ; then
14649e0146f7Smrg    LIB_MAN_SUFFIX=3
1465492e1cfeSmrgfi
1466492e1cfeSmrgif test x$LIB_MAN_DIR = x    ; then
14679e0146f7Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1468492e1cfeSmrgfi
1469492e1cfeSmrg
1470492e1cfeSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1471492e1cfeSmrg    case $host_os in
1472492e1cfeSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1473492e1cfeSmrg	*)		FILE_MAN_SUFFIX=5  ;;
1474492e1cfeSmrg    esac
1475492e1cfeSmrgfi
1476492e1cfeSmrgif test x$FILE_MAN_DIR = x    ; then
14779e0146f7Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1478492e1cfeSmrgfi
1479492e1cfeSmrg
1480492e1cfeSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1481492e1cfeSmrg    case $host_os in
1482492e1cfeSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1483492e1cfeSmrg	*)		MISC_MAN_SUFFIX=7  ;;
1484492e1cfeSmrg    esac
1485492e1cfeSmrgfi
1486492e1cfeSmrgif test x$MISC_MAN_DIR = x    ; then
14879e0146f7Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1488492e1cfeSmrgfi
1489492e1cfeSmrg
1490492e1cfeSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1491492e1cfeSmrg    case $host_os in
1492492e1cfeSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1493492e1cfeSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1494492e1cfeSmrg    esac
1495492e1cfeSmrgfi
1496492e1cfeSmrgif test x$DRIVER_MAN_DIR = x    ; then
14979e0146f7Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1498492e1cfeSmrgfi
1499492e1cfeSmrg
1500492e1cfeSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1501492e1cfeSmrg    case $host_os in
1502492e1cfeSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1503492e1cfeSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1504492e1cfeSmrg    esac
1505492e1cfeSmrgfi
1506492e1cfeSmrgif test x$ADMIN_MAN_DIR = x    ; then
1507492e1cfeSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1508492e1cfeSmrgfi
1509492e1cfeSmrg
1510492e1cfeSmrg
1511492e1cfeSmrgAC_SUBST([APP_MAN_SUFFIX])
1512492e1cfeSmrgAC_SUBST([LIB_MAN_SUFFIX])
1513492e1cfeSmrgAC_SUBST([FILE_MAN_SUFFIX])
1514492e1cfeSmrgAC_SUBST([MISC_MAN_SUFFIX])
1515492e1cfeSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1516492e1cfeSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1517492e1cfeSmrgAC_SUBST([APP_MAN_DIR])
1518492e1cfeSmrgAC_SUBST([LIB_MAN_DIR])
1519492e1cfeSmrgAC_SUBST([FILE_MAN_DIR])
1520492e1cfeSmrgAC_SUBST([MISC_MAN_DIR])
1521492e1cfeSmrgAC_SUBST([DRIVER_MAN_DIR])
1522492e1cfeSmrgAC_SUBST([ADMIN_MAN_DIR])
15239e0146f7Smrg
15249e0146f7SmrgXORG_MAN_PAGE="X Version 11"
15259e0146f7SmrgAC_SUBST([XORG_MAN_PAGE])
15269e0146f7SmrgMAN_SUBSTS="\
15279e0146f7Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
15289e0146f7Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
15299e0146f7Smrg	-e 's|__xservername__|Xorg|g' \
15309e0146f7Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
15319e0146f7Smrg	-e 's|__projectroot__|\$(prefix)|g' \
15329e0146f7Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
15339e0146f7Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
15349e0146f7Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
15359e0146f7Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
15369e0146f7Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
15379e0146f7Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
15389e0146f7Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
15399e0146f7SmrgAC_SUBST([MAN_SUBSTS])
15409e0146f7Smrg
1541492e1cfeSmrg]) # XORG_MANPAGE_SECTIONS
1542492e1cfeSmrg
15439e0146f7Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
15449e0146f7Smrg# ------------------------
15459e0146f7Smrg# Minimum version: 1.7.0
15469e0146f7Smrg#
15479e0146f7Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
15489e0146f7Smrg# provided by xorg-sgml-doctools, if installed.
15499e0146f7SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
15509e0146f7SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
15519e0146f7SmrgXORG_SGML_PATH=
15529e0146f7SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
15539e0146f7Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
15549e0146f7Smrg    [m4_ifval([$1],[:],
15559e0146f7Smrg        [if test x"$cross_compiling" != x"yes" ; then
15569e0146f7Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
15579e0146f7Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
15589e0146f7Smrg         fi])
15599e0146f7Smrg    ])
15609e0146f7Smrg
15619e0146f7Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
15629e0146f7Smrg# the path and the name of the doc stylesheet
15639e0146f7Smrgif test "x$XORG_SGML_PATH" != "x" ; then
15649e0146f7Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
15659e0146f7Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
15669e0146f7Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
15679e0146f7Smrgelse
15689e0146f7Smrg   AC_MSG_RESULT([no])
15699e0146f7Smrgfi
15709e0146f7Smrg
15719e0146f7SmrgAC_SUBST(XORG_SGML_PATH)
15729e0146f7SmrgAC_SUBST(STYLESHEET_SRCDIR)
15739e0146f7SmrgAC_SUBST(XSL_STYLESHEET)
15749e0146f7SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
15759e0146f7Smrg]) # XORG_CHECK_SGML_DOCTOOLS
15769e0146f7Smrg
1577492e1cfeSmrg# XORG_CHECK_LINUXDOC
1578492e1cfeSmrg# -------------------
15799e0146f7Smrg# Minimum version: 1.0.0
15809e0146f7Smrg#
1581492e1cfeSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1582492e1cfeSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1583492e1cfeSmrg# Whether or not the necessary tools and files are found can be checked
1584492e1cfeSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1585492e1cfeSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
15869e0146f7SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
15879e0146f7SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1588492e1cfeSmrg
1589492e1cfeSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1590492e1cfeSmrg
15919e0146f7SmrgAC_MSG_CHECKING([whether to build documentation])
15929e0146f7Smrg
15939e0146f7Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
15949e0146f7Smrg   BUILDDOC=yes
15959e0146f7Smrgelse
15969e0146f7Smrg   BUILDDOC=no
15979e0146f7Smrgfi
15989e0146f7Smrg
15999e0146f7SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
16009e0146f7Smrg
16019e0146f7SmrgAC_MSG_RESULT([$BUILDDOC])
16029e0146f7Smrg
16039e0146f7SmrgAC_MSG_CHECKING([whether to build pdf documentation])
16049e0146f7Smrg
16059e0146f7Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
16069e0146f7Smrg   BUILDPDFDOC=yes
16079e0146f7Smrgelse
16089e0146f7Smrg   BUILDPDFDOC=no
16099e0146f7Smrgfi
16109e0146f7Smrg
16119e0146f7SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16129e0146f7Smrg
16139e0146f7SmrgAC_MSG_RESULT([$BUILDPDFDOC])
16149e0146f7Smrg
16159e0146f7SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
16169e0146f7SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
16179e0146f7SmrgMAKE_PDF="$PS2PDF"
16189e0146f7SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
16199e0146f7Smrg
16209e0146f7SmrgAC_SUBST(MAKE_TEXT)
16219e0146f7SmrgAC_SUBST(MAKE_PS)
16229e0146f7SmrgAC_SUBST(MAKE_PDF)
16239e0146f7SmrgAC_SUBST(MAKE_HTML)
16249e0146f7Smrg]) # XORG_CHECK_LINUXDOC
16259e0146f7Smrg
16269e0146f7Smrg# XORG_CHECK_DOCBOOK
16279e0146f7Smrg# -------------------
16289e0146f7Smrg# Minimum version: 1.0.0
16299e0146f7Smrg#
16309e0146f7Smrg# Checks for the ability to build output formats from SGML DocBook source.
16319e0146f7Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
16329e0146f7Smrg# indicates whether the necessary tools and files are found and, if set,
16339e0146f7Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
16349e0146f7SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
16359e0146f7SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
16369e0146f7Smrg
16379e0146f7SmrgBUILDTXTDOC=no
16389e0146f7SmrgBUILDPDFDOC=no
16399e0146f7SmrgBUILDPSDOC=no
16409e0146f7SmrgBUILDHTMLDOC=no
16419e0146f7Smrg
16429e0146f7SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
16439e0146f7SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
16449e0146f7SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
16459e0146f7SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
16469e0146f7Smrg
16479e0146f7SmrgAC_MSG_CHECKING([whether to build text documentation])
16489e0146f7Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
16499e0146f7Smrg   test x$BUILD_TXTDOC != xno; then
16509e0146f7Smrg	BUILDTXTDOC=yes
16519e0146f7Smrgfi
16529e0146f7SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
16539e0146f7SmrgAC_MSG_RESULT([$BUILDTXTDOC])
16549e0146f7Smrg
16559e0146f7SmrgAC_MSG_CHECKING([whether to build PDF documentation])
16569e0146f7Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
16579e0146f7Smrg   test x$BUILD_PDFDOC != xno; then
16589e0146f7Smrg	BUILDPDFDOC=yes
16599e0146f7Smrgfi
16609e0146f7SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
16619e0146f7SmrgAC_MSG_RESULT([$BUILDPDFDOC])
16629e0146f7Smrg
16639e0146f7SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
16649e0146f7Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
16659e0146f7Smrg   test x$BUILD_PSDOC != xno; then
16669e0146f7Smrg	BUILDPSDOC=yes
16679e0146f7Smrgfi
16689e0146f7SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
16699e0146f7SmrgAC_MSG_RESULT([$BUILDPSDOC])
16709e0146f7Smrg
16719e0146f7SmrgAC_MSG_CHECKING([whether to build HTML documentation])
16729e0146f7Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
16739e0146f7Smrg   test x$BUILD_HTMLDOC != xno; then
16749e0146f7Smrg	BUILDHTMLDOC=yes
16759e0146f7Smrgfi
16769e0146f7SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
16779e0146f7SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
16789e0146f7Smrg
16799e0146f7SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
16809e0146f7SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
16819e0146f7SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
16829e0146f7SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
16839e0146f7Smrg
16849e0146f7SmrgAC_SUBST(MAKE_TEXT)
16859e0146f7SmrgAC_SUBST(MAKE_PS)
16869e0146f7SmrgAC_SUBST(MAKE_PDF)
16879e0146f7SmrgAC_SUBST(MAKE_HTML)
16889e0146f7Smrg]) # XORG_CHECK_DOCBOOK
16899e0146f7Smrg
16903538fbe3Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
16919e0146f7Smrg# ----------------
16929e0146f7Smrg# Minimum version: 1.5.0
16933538fbe3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
16949e0146f7Smrg#
16959e0146f7Smrg# Documentation tools are not always available on all platforms and sometimes
16969e0146f7Smrg# not at the appropriate level. This macro enables a module to test for the
16979e0146f7Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
16989e0146f7Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
16993538fbe3Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
17003538fbe3Smrg# --with-xmlto assumes 'auto'.
17019e0146f7Smrg#
17029e0146f7Smrg# Interface to module:
17039e0146f7Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
17049e0146f7Smrg# XMLTO:	returns the path of the xmlto program found
17059e0146f7Smrg#		returns the path set by the user in the environment
17069e0146f7Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
17079e0146f7Smrg#		'no' user instructs the module not to use xmlto
17089e0146f7Smrg#
17099e0146f7Smrg# Added in version 1.10.0
17109e0146f7Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
17119e0146f7Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
17129e0146f7Smrg#
17139e0146f7Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
17149e0146f7Smrg#
17159e0146f7SmrgAC_DEFUN([XORG_WITH_XMLTO],[
17169e0146f7SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
17173538fbe3Smrgm4_define([_defopt], m4_default([$2], [auto]))
17189e0146f7SmrgAC_ARG_WITH(xmlto,
17199e0146f7Smrg	AS_HELP_STRING([--with-xmlto],
17203538fbe3Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
17213538fbe3Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
17223538fbe3Smrgm4_undefine([_defopt])
17239e0146f7Smrg
17249e0146f7Smrgif test "x$use_xmlto" = x"auto"; then
17259e0146f7Smrg   AC_PATH_PROG([XMLTO], [xmlto])
17269e0146f7Smrg   if test "x$XMLTO" = "x"; then
17279e0146f7Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
17289e0146f7Smrg	have_xmlto=no
17299e0146f7Smrg   else
17309e0146f7Smrg        have_xmlto=yes
17319e0146f7Smrg   fi
17329e0146f7Smrgelif test "x$use_xmlto" = x"yes" ; then
17339e0146f7Smrg   AC_PATH_PROG([XMLTO], [xmlto])
17349e0146f7Smrg   if test "x$XMLTO" = "x"; then
17359e0146f7Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
17369e0146f7Smrg   fi
17379e0146f7Smrg   have_xmlto=yes
17389e0146f7Smrgelif test "x$use_xmlto" = x"no" ; then
17399e0146f7Smrg   if test "x$XMLTO" != "x"; then
17409e0146f7Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
17419e0146f7Smrg   fi
17429e0146f7Smrg   have_xmlto=no
17439e0146f7Smrgelse
17449e0146f7Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
17459e0146f7Smrgfi
17469e0146f7Smrg
17479e0146f7Smrg# Test for a minimum version of xmlto, if provided.
17489e0146f7Smrgm4_ifval([$1],
17499e0146f7Smrg[if test "$have_xmlto" = yes; then
17509e0146f7Smrg    # scrape the xmlto version
17519e0146f7Smrg    AC_MSG_CHECKING([the xmlto version])
17529e0146f7Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
17539e0146f7Smrg    AC_MSG_RESULT([$xmlto_version])
17549e0146f7Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
17559e0146f7Smrg        [if test "x$use_xmlto" = xauto; then
17569e0146f7Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
17579e0146f7Smrg            have_xmlto=no
17589e0146f7Smrg        else
17599e0146f7Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
17609e0146f7Smrg        fi])
17619e0146f7Smrgfi])
17629e0146f7Smrg
17639e0146f7Smrg# Test for the ability of xmlto to generate a text target
17649e0146f7Smrghave_xmlto_text=no
17659e0146f7Smrgcat > conftest.xml << "EOF"
17669e0146f7SmrgEOF
17679e0146f7SmrgAS_IF([test "$have_xmlto" = yes],
17689e0146f7Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
17699e0146f7Smrg             [have_xmlto_text=yes],
17709e0146f7Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
17719e0146f7Smrgrm -f conftest.xml
17729e0146f7SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
17739e0146f7SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
17749e0146f7Smrg]) # XORG_WITH_XMLTO
17759e0146f7Smrg
17763538fbe3Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
17773538fbe3Smrg# --------------------------------------------
17783538fbe3Smrg# Minimum version: 1.12.0
17793538fbe3Smrg# Minimum version for optional DEFAULT argument: 1.12.0
17803538fbe3Smrg#
17813538fbe3Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
17823538fbe3Smrg# XML-based language used for the transformation of XML documents.
17833538fbe3Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
17843538fbe3Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
17853538fbe3Smrg# The XSLT processor is often used as a standalone tool for transformations.
17863538fbe3Smrg# It should not be assumed that this tool is used only to work with documnetation.
17873538fbe3Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
17883538fbe3Smrg#
17893538fbe3Smrg# Interface to module:
17903538fbe3Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
17913538fbe3Smrg# XSLTPROC:	 returns the path of the xsltproc program found
17923538fbe3Smrg#		 returns the path set by the user in the environment
17933538fbe3Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
17943538fbe3Smrg#		  'no' user instructs the module not to use xsltproc
17953538fbe3Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
17963538fbe3Smrg#
17973538fbe3Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
17983538fbe3Smrg#
17993538fbe3SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
18003538fbe3SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
18013538fbe3Smrg# Preserves the interface, should it be implemented later
18023538fbe3Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
18033538fbe3Smrgm4_define([_defopt], m4_default([$2], [auto]))
18043538fbe3SmrgAC_ARG_WITH(xsltproc,
18053538fbe3Smrg	AS_HELP_STRING([--with-xsltproc],
18063538fbe3Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
18073538fbe3Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
18083538fbe3Smrgm4_undefine([_defopt])
18093538fbe3Smrg
18103538fbe3Smrgif test "x$use_xsltproc" = x"auto"; then
18113538fbe3Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
18123538fbe3Smrg   if test "x$XSLTPROC" = "x"; then
18133538fbe3Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
18143538fbe3Smrg	have_xsltproc=no
18153538fbe3Smrg   else
18163538fbe3Smrg        have_xsltproc=yes
18173538fbe3Smrg   fi
18183538fbe3Smrgelif test "x$use_xsltproc" = x"yes" ; then
18193538fbe3Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
18203538fbe3Smrg   if test "x$XSLTPROC" = "x"; then
18213538fbe3Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
18223538fbe3Smrg   fi
18233538fbe3Smrg   have_xsltproc=yes
18243538fbe3Smrgelif test "x$use_xsltproc" = x"no" ; then
18253538fbe3Smrg   if test "x$XSLTPROC" != "x"; then
18263538fbe3Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
18273538fbe3Smrg   fi
18283538fbe3Smrg   have_xsltproc=no
18293538fbe3Smrgelse
18303538fbe3Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
18313538fbe3Smrgfi
18323538fbe3Smrg
18333538fbe3SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
18343538fbe3Smrg]) # XORG_WITH_XSLTPROC
18353538fbe3Smrg
18363538fbe3Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
18373538fbe3Smrg# ----------------------------------------
18383538fbe3Smrg# Minimum version: 1.15.0
18393538fbe3Smrg#
18403538fbe3Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
18413538fbe3Smrg# scanning arbitrary text files, extracting information from those text files,
18423538fbe3Smrg# and printing reports based on that information.
18433538fbe3Smrg#
18443538fbe3Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
18453538fbe3Smrg#
18463538fbe3Smrg# Interface to module:
18473538fbe3Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
18483538fbe3Smrg# PERL:	     returns the path of the perl program found
18493538fbe3Smrg#	     returns the path set by the user in the environment
18503538fbe3Smrg# --with-perl: 'yes' user instructs the module to use perl
18513538fbe3Smrg#	       'no' user instructs the module not to use perl
18523538fbe3Smrg# have_perl: returns yes if perl found in PATH or no
18533538fbe3Smrg#
18543538fbe3Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
18553538fbe3Smrg#
18563538fbe3SmrgAC_DEFUN([XORG_WITH_PERL],[
18573538fbe3SmrgAC_ARG_VAR([PERL], [Path to perl command])
18583538fbe3Smrg# Preserves the interface, should it be implemented later
18593538fbe3Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
18603538fbe3Smrgm4_define([_defopt], m4_default([$2], [auto]))
18613538fbe3SmrgAC_ARG_WITH(perl,
18623538fbe3Smrg	AS_HELP_STRING([--with-perl],
18633538fbe3Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
18643538fbe3Smrg	   [use_perl=$withval], [use_perl=]_defopt)
18653538fbe3Smrgm4_undefine([_defopt])
18663538fbe3Smrg
18673538fbe3Smrgif test "x$use_perl" = x"auto"; then
18683538fbe3Smrg   AC_PATH_PROG([PERL], [perl])
18693538fbe3Smrg   if test "x$PERL" = "x"; then
18703538fbe3Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
18713538fbe3Smrg	have_perl=no
18723538fbe3Smrg   else
18733538fbe3Smrg        have_perl=yes
18743538fbe3Smrg   fi
18753538fbe3Smrgelif test "x$use_perl" = x"yes" ; then
18763538fbe3Smrg   AC_PATH_PROG([PERL], [perl])
18773538fbe3Smrg   if test "x$PERL" = "x"; then
18783538fbe3Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
18793538fbe3Smrg   fi
18803538fbe3Smrg   have_perl=yes
18813538fbe3Smrgelif test "x$use_perl" = x"no" ; then
18823538fbe3Smrg   if test "x$PERL" != "x"; then
18833538fbe3Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
18843538fbe3Smrg   fi
18853538fbe3Smrg   have_perl=no
18863538fbe3Smrgelse
18873538fbe3Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
18883538fbe3Smrgfi
18893538fbe3Smrg
18903538fbe3SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
18913538fbe3Smrg]) # XORG_WITH_PERL
18923538fbe3Smrg
18933538fbe3Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
18949e0146f7Smrg# ----------------
18959e0146f7Smrg# Minimum version: 1.5.0
18963538fbe3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
18979e0146f7Smrg#
18989e0146f7Smrg# Documentation tools are not always available on all platforms and sometimes
18999e0146f7Smrg# not at the appropriate level. This macro enables a module to test for the
19009e0146f7Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
19019e0146f7Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
19023538fbe3Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
19033538fbe3Smrg# --with-asciidoc assumes 'auto'.
19049e0146f7Smrg#
19059e0146f7Smrg# Interface to module:
19069e0146f7Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
19079e0146f7Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
19089e0146f7Smrg#		 returns the path set by the user in the environment
19099e0146f7Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
19109e0146f7Smrg#		  'no' user instructs the module not to use asciidoc
19119e0146f7Smrg#
19129e0146f7Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
19139e0146f7Smrg#
19149e0146f7SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
19159e0146f7SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
19163538fbe3Smrgm4_define([_defopt], m4_default([$2], [auto]))
19179e0146f7SmrgAC_ARG_WITH(asciidoc,
19189e0146f7Smrg	AS_HELP_STRING([--with-asciidoc],
19193538fbe3Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
19203538fbe3Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
19213538fbe3Smrgm4_undefine([_defopt])
19229e0146f7Smrg
19239e0146f7Smrgif test "x$use_asciidoc" = x"auto"; then
19249e0146f7Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
19259e0146f7Smrg   if test "x$ASCIIDOC" = "x"; then
19269e0146f7Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
19279e0146f7Smrg	have_asciidoc=no
19289e0146f7Smrg   else
19299e0146f7Smrg        have_asciidoc=yes
19309e0146f7Smrg   fi
19319e0146f7Smrgelif test "x$use_asciidoc" = x"yes" ; then
19329e0146f7Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
19339e0146f7Smrg   if test "x$ASCIIDOC" = "x"; then
19349e0146f7Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
19359e0146f7Smrg   fi
19369e0146f7Smrg   have_asciidoc=yes
19379e0146f7Smrgelif test "x$use_asciidoc" = x"no" ; then
19389e0146f7Smrg   if test "x$ASCIIDOC" != "x"; then
19399e0146f7Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
19409e0146f7Smrg   fi
19419e0146f7Smrg   have_asciidoc=no
19429e0146f7Smrgelse
19439e0146f7Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
19449e0146f7Smrgfi
19459e0146f7Smrgm4_ifval([$1],
19469e0146f7Smrg[if test "$have_asciidoc" = yes; then
19479e0146f7Smrg    # scrape the asciidoc version
19489e0146f7Smrg    AC_MSG_CHECKING([the asciidoc version])
19499e0146f7Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
19509e0146f7Smrg    AC_MSG_RESULT([$asciidoc_version])
19519e0146f7Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
19529e0146f7Smrg        [if test "x$use_asciidoc" = xauto; then
19539e0146f7Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
19549e0146f7Smrg            have_asciidoc=no
19559e0146f7Smrg        else
19569e0146f7Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
19579e0146f7Smrg        fi])
19589e0146f7Smrgfi])
19599e0146f7SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
19609e0146f7Smrg]) # XORG_WITH_ASCIIDOC
19619e0146f7Smrg
19623538fbe3Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
19639e0146f7Smrg# --------------------------------
19649e0146f7Smrg# Minimum version: 1.5.0
19653538fbe3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
19669e0146f7Smrg#
19679e0146f7Smrg# Documentation tools are not always available on all platforms and sometimes
19689e0146f7Smrg# not at the appropriate level. This macro enables a module to test for the
19699e0146f7Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
19709e0146f7Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
19713538fbe3Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
19723538fbe3Smrg# --with-doxygen assumes 'auto'.
19739e0146f7Smrg#
19749e0146f7Smrg# Interface to module:
19759e0146f7Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
19769e0146f7Smrg# DOXYGEN:	 returns the path of the doxygen program found
19779e0146f7Smrg#		 returns the path set by the user in the environment
19789e0146f7Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
19799e0146f7Smrg#		  'no' user instructs the module not to use doxygen
19809e0146f7Smrg#
19819e0146f7Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
19829e0146f7Smrg#
19839e0146f7SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
19849e0146f7SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
19853538fbe3Smrgm4_define([_defopt], m4_default([$2], [auto]))
19869e0146f7SmrgAC_ARG_WITH(doxygen,
19879e0146f7Smrg	AS_HELP_STRING([--with-doxygen],
19883538fbe3Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
19893538fbe3Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
19903538fbe3Smrgm4_undefine([_defopt])
19919e0146f7Smrg
19929e0146f7Smrgif test "x$use_doxygen" = x"auto"; then
19939e0146f7Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
19949e0146f7Smrg   if test "x$DOXYGEN" = "x"; then
19959e0146f7Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
19969e0146f7Smrg	have_doxygen=no
19979e0146f7Smrg   else
19989e0146f7Smrg        have_doxygen=yes
19999e0146f7Smrg   fi
20009e0146f7Smrgelif test "x$use_doxygen" = x"yes" ; then
20019e0146f7Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
20029e0146f7Smrg   if test "x$DOXYGEN" = "x"; then
20039e0146f7Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
20049e0146f7Smrg   fi
20059e0146f7Smrg   have_doxygen=yes
20069e0146f7Smrgelif test "x$use_doxygen" = x"no" ; then
20079e0146f7Smrg   if test "x$DOXYGEN" != "x"; then
20089e0146f7Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
20099e0146f7Smrg   fi
20109e0146f7Smrg   have_doxygen=no
20119e0146f7Smrgelse
20129e0146f7Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
20139e0146f7Smrgfi
20149e0146f7Smrgm4_ifval([$1],
20159e0146f7Smrg[if test "$have_doxygen" = yes; then
20169e0146f7Smrg    # scrape the doxygen version
20179e0146f7Smrg    AC_MSG_CHECKING([the doxygen version])
20189e0146f7Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
20199e0146f7Smrg    AC_MSG_RESULT([$doxygen_version])
20209e0146f7Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
20219e0146f7Smrg        [if test "x$use_doxygen" = xauto; then
20229e0146f7Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
20239e0146f7Smrg            have_doxygen=no
20249e0146f7Smrg        else
20259e0146f7Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
20269e0146f7Smrg        fi])
20279e0146f7Smrgfi])
20289e0146f7SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
20299e0146f7Smrg]) # XORG_WITH_DOXYGEN
2030492e1cfeSmrg
20313538fbe3Smrg# XORG_WITH_GROFF([DEFAULT])
20329e0146f7Smrg# ----------------
20339e0146f7Smrg# Minimum version: 1.6.0
20343538fbe3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20359e0146f7Smrg#
20369e0146f7Smrg# Documentation tools are not always available on all platforms and sometimes
20379e0146f7Smrg# not at the appropriate level. This macro enables a module to test for the
20389e0146f7Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20399e0146f7Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
20403538fbe3Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
20413538fbe3Smrg# --with-groff assumes 'auto'.
20429e0146f7Smrg#
20439e0146f7Smrg# Interface to module:
20449e0146f7Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
20459e0146f7Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
20469e0146f7Smrg# HAVE_GROFF_MS: the -ms macros package
20479e0146f7Smrg# GROFF:	 returns the path of the groff program found
20489e0146f7Smrg#		 returns the path set by the user in the environment
20499e0146f7Smrg# --with-groff:	 'yes' user instructs the module to use groff
20509e0146f7Smrg#		 'no' user instructs the module not to use groff
20519e0146f7Smrg#
20529e0146f7Smrg# Added in version 1.9.0:
20539e0146f7Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
20549e0146f7Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
20559e0146f7Smrg#		   psselect from the psutils package.
20569e0146f7Smrg#		   the ghostcript package. Refer to the grohtml man pages
20579e0146f7Smrg#
20589e0146f7Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
20599e0146f7Smrg#
20609e0146f7Smrg# OS and distros often splits groff in a basic and full package, the former
20619e0146f7Smrg# having the groff program and the later having devices, fonts and macros
20629e0146f7Smrg# Checking for the groff executable is not enough.
20639e0146f7Smrg#
20649e0146f7Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
20659e0146f7Smrg# unset HAVE_GROFF or GROFF env variables.
20669e0146f7Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
20679e0146f7Smrg#
20689e0146f7SmrgAC_DEFUN([XORG_WITH_GROFF],[
20699e0146f7SmrgAC_ARG_VAR([GROFF], [Path to groff command])
20703538fbe3Smrgm4_define([_defopt], m4_default([$1], [auto]))
20719e0146f7SmrgAC_ARG_WITH(groff,
20729e0146f7Smrg	AS_HELP_STRING([--with-groff],
20733538fbe3Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
20743538fbe3Smrg	   [use_groff=$withval], [use_groff=]_defopt)
20753538fbe3Smrgm4_undefine([_defopt])
20769e0146f7Smrg
20779e0146f7Smrgif test "x$use_groff" = x"auto"; then
20789e0146f7Smrg   AC_PATH_PROG([GROFF], [groff])
20799e0146f7Smrg   if test "x$GROFF" = "x"; then
20809e0146f7Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
20819e0146f7Smrg	have_groff=no
20829e0146f7Smrg   else
20839e0146f7Smrg        have_groff=yes
20849e0146f7Smrg   fi
20859e0146f7Smrgelif test "x$use_groff" = x"yes" ; then
20869e0146f7Smrg   AC_PATH_PROG([GROFF], [groff])
20879e0146f7Smrg   if test "x$GROFF" = "x"; then
20889e0146f7Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
20899e0146f7Smrg   fi
20909e0146f7Smrg   have_groff=yes
20919e0146f7Smrgelif test "x$use_groff" = x"no" ; then
20929e0146f7Smrg   if test "x$GROFF" != "x"; then
20939e0146f7Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
20949e0146f7Smrg   fi
20959e0146f7Smrg   have_groff=no
2096492e1cfeSmrgelse
20979e0146f7Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2098492e1cfeSmrgfi
2099492e1cfeSmrg
21009e0146f7Smrg# We have groff, test for the presence of the macro packages
21019e0146f7Smrgif test "x$have_groff" = x"yes"; then
21029e0146f7Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
21039e0146f7Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
21049e0146f7Smrg        groff_ms_works=yes
21059e0146f7Smrg    else
21069e0146f7Smrg        groff_ms_works=no
21079e0146f7Smrg    fi
21089e0146f7Smrg    AC_MSG_RESULT([$groff_ms_works])
21099e0146f7Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
21109e0146f7Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
21119e0146f7Smrg        groff_mm_works=yes
21129e0146f7Smrg    else
21139e0146f7Smrg        groff_mm_works=no
21149e0146f7Smrg    fi
21159e0146f7Smrg    AC_MSG_RESULT([$groff_mm_works])
21169e0146f7Smrgfi
2117492e1cfeSmrg
21189e0146f7Smrg# We have groff, test for HTML dependencies, one command per package
21199e0146f7Smrgif test "x$have_groff" = x"yes"; then
21209e0146f7Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
21219e0146f7Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
21229e0146f7Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
21239e0146f7Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
21249e0146f7Smrg      have_groff_html=yes
21259e0146f7Smrg   else
21269e0146f7Smrg      have_groff_html=no
21279e0146f7Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
21289e0146f7Smrg   fi
21299e0146f7Smrgfi
2130492e1cfeSmrg
21319e0146f7Smrg# Set Automake conditionals for Makefiles
21329e0146f7SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
21339e0146f7SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
21349e0146f7SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
21359e0146f7SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
21369e0146f7Smrg]) # XORG_WITH_GROFF
2137492e1cfeSmrg
21383538fbe3Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
21393538fbe3Smrg# ---------------------------------------
21409e0146f7Smrg# Minimum version: 1.6.0
21413538fbe3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
21423538fbe3Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
21439e0146f7Smrg#
21449e0146f7Smrg# Documentation tools are not always available on all platforms and sometimes
21459e0146f7Smrg# not at the appropriate level. This macro enables a module to test for the
21469e0146f7Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
21479e0146f7Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
21483538fbe3Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
21493538fbe3Smrg# --with-fop assumes 'auto'.
21509e0146f7Smrg#
21519e0146f7Smrg# Interface to module:
21529e0146f7Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
21539e0146f7Smrg# FOP:	 	returns the path of the fop program found
21549e0146f7Smrg#		returns the path set by the user in the environment
21559e0146f7Smrg# --with-fop: 	'yes' user instructs the module to use fop
21569e0146f7Smrg#		'no' user instructs the module not to use fop
21579e0146f7Smrg#
21589e0146f7Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
21599e0146f7Smrg#
21609e0146f7SmrgAC_DEFUN([XORG_WITH_FOP],[
21619e0146f7SmrgAC_ARG_VAR([FOP], [Path to fop command])
21623538fbe3Smrgm4_define([_defopt], m4_default([$2], [auto]))
21639e0146f7SmrgAC_ARG_WITH(fop,
21649e0146f7Smrg	AS_HELP_STRING([--with-fop],
21653538fbe3Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
21663538fbe3Smrg	   [use_fop=$withval], [use_fop=]_defopt)
21673538fbe3Smrgm4_undefine([_defopt])
21689e0146f7Smrg
21699e0146f7Smrgif test "x$use_fop" = x"auto"; then
21709e0146f7Smrg   AC_PATH_PROG([FOP], [fop])
21719e0146f7Smrg   if test "x$FOP" = "x"; then
21729e0146f7Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
21739e0146f7Smrg	have_fop=no
21749e0146f7Smrg   else
21759e0146f7Smrg        have_fop=yes
21769e0146f7Smrg   fi
21779e0146f7Smrgelif test "x$use_fop" = x"yes" ; then
21789e0146f7Smrg   AC_PATH_PROG([FOP], [fop])
21799e0146f7Smrg   if test "x$FOP" = "x"; then
21809e0146f7Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
21819e0146f7Smrg   fi
21829e0146f7Smrg   have_fop=yes
21839e0146f7Smrgelif test "x$use_fop" = x"no" ; then
21849e0146f7Smrg   if test "x$FOP" != "x"; then
21859e0146f7Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
21869e0146f7Smrg   fi
21879e0146f7Smrg   have_fop=no
2188492e1cfeSmrgelse
21899e0146f7Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2190492e1cfeSmrgfi
21913538fbe3Smrg
21923538fbe3Smrg# Test for a minimum version of fop, if provided.
21933538fbe3Smrgm4_ifval([$1],
21943538fbe3Smrg[if test "$have_fop" = yes; then
21953538fbe3Smrg    # scrape the fop version
21963538fbe3Smrg    AC_MSG_CHECKING([for fop minimum version])
21973538fbe3Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
21983538fbe3Smrg    AC_MSG_RESULT([$fop_version])
21993538fbe3Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
22003538fbe3Smrg        [if test "x$use_fop" = xauto; then
22013538fbe3Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
22023538fbe3Smrg            have_fop=no
22033538fbe3Smrg        else
22043538fbe3Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
22053538fbe3Smrg        fi])
22063538fbe3Smrgfi])
22079e0146f7SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
22089e0146f7Smrg]) # XORG_WITH_FOP
2209492e1cfeSmrg
22103538fbe3Smrg# XORG_WITH_PS2PDF([DEFAULT])
22119e0146f7Smrg# ----------------
22129e0146f7Smrg# Minimum version: 1.6.0
22133538fbe3Smrg# Minimum version for optional DEFAULT argument: 1.11.0
22149e0146f7Smrg#
22159e0146f7Smrg# Documentation tools are not always available on all platforms and sometimes
22169e0146f7Smrg# not at the appropriate level. This macro enables a module to test for the
22179e0146f7Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
22189e0146f7Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
22193538fbe3Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
22203538fbe3Smrg# --with-ps2pdf assumes 'auto'.
22219e0146f7Smrg#
22229e0146f7Smrg# Interface to module:
22239e0146f7Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
22249e0146f7Smrg# PS2PDF:	returns the path of the ps2pdf program found
22259e0146f7Smrg#		returns the path set by the user in the environment
22269e0146f7Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
22279e0146f7Smrg#		 'no' user instructs the module not to use ps2pdf
22289e0146f7Smrg#
22299e0146f7Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
22309e0146f7Smrg#
22319e0146f7SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
22329e0146f7SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
22333538fbe3Smrgm4_define([_defopt], m4_default([$1], [auto]))
22349e0146f7SmrgAC_ARG_WITH(ps2pdf,
22359e0146f7Smrg	AS_HELP_STRING([--with-ps2pdf],
22363538fbe3Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
22373538fbe3Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
22383538fbe3Smrgm4_undefine([_defopt])
22399e0146f7Smrg
22409e0146f7Smrgif test "x$use_ps2pdf" = x"auto"; then
22419e0146f7Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
22429e0146f7Smrg   if test "x$PS2PDF" = "x"; then
22439e0146f7Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
22449e0146f7Smrg	have_ps2pdf=no
22459e0146f7Smrg   else
22469e0146f7Smrg        have_ps2pdf=yes
22479e0146f7Smrg   fi
22489e0146f7Smrgelif test "x$use_ps2pdf" = x"yes" ; then
22499e0146f7Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
22509e0146f7Smrg   if test "x$PS2PDF" = "x"; then
22519e0146f7Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
22529e0146f7Smrg   fi
22539e0146f7Smrg   have_ps2pdf=yes
22549e0146f7Smrgelif test "x$use_ps2pdf" = x"no" ; then
22559e0146f7Smrg   if test "x$PS2PDF" != "x"; then
22569e0146f7Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
22579e0146f7Smrg   fi
22589e0146f7Smrg   have_ps2pdf=no
22599e0146f7Smrgelse
22609e0146f7Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
22619e0146f7Smrgfi
22629e0146f7SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
22639e0146f7Smrg]) # XORG_WITH_PS2PDF
2264492e1cfeSmrg
22659e0146f7Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
22669e0146f7Smrg# ----------------
22679e0146f7Smrg# Minimum version: 1.6.0
22689e0146f7Smrg#
22699e0146f7Smrg# Documentation tools are not always available on all platforms and sometimes
22709e0146f7Smrg# not at the appropriate level. This macro enables a builder to skip all
22719e0146f7Smrg# documentation targets except traditional man pages.
22729e0146f7Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
22739e0146f7Smrg# maximum flexibilty in controlling documentation building.
22749e0146f7Smrg# Refer to:
22759e0146f7Smrg# XORG_WITH_XMLTO         --with-xmlto
22769e0146f7Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
22779e0146f7Smrg# XORG_WITH_DOXYGEN       --with-doxygen
22789e0146f7Smrg# XORG_WITH_FOP           --with-fop
22799e0146f7Smrg# XORG_WITH_GROFF         --with-groff
22809e0146f7Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
22819e0146f7Smrg#
22829e0146f7Smrg# Interface to module:
22839e0146f7Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
22849e0146f7Smrg# --enable-docs: 'yes' user instructs the module to generate docs
22859e0146f7Smrg#		 'no' user instructs the module not to generate docs
22869e0146f7Smrg# parm1:	specify the default value, yes or no.
22879e0146f7Smrg#
22889e0146f7SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
22893538fbe3Smrgm4_define([docs_default], m4_default([$1], [yes]))
22909e0146f7SmrgAC_ARG_ENABLE(docs,
22919e0146f7Smrg	AS_HELP_STRING([--enable-docs],
22923538fbe3Smrg	   [Enable building the documentation (default: ]docs_default[)]),
22933538fbe3Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
22943538fbe3Smrgm4_undefine([docs_default])
22959e0146f7SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
22969e0146f7SmrgAC_MSG_CHECKING([whether to build documentation])
22979e0146f7SmrgAC_MSG_RESULT([$build_docs])
22989e0146f7Smrg]) # XORG_ENABLE_DOCS
22999e0146f7Smrg
23009e0146f7Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
23019e0146f7Smrg# ----------------
23029e0146f7Smrg# Minimum version: 1.6.0
23039e0146f7Smrg#
23049e0146f7Smrg# This macro enables a builder to skip all developer documentation.
23059e0146f7Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
23069e0146f7Smrg# maximum flexibilty in controlling documentation building.
23079e0146f7Smrg# Refer to:
23089e0146f7Smrg# XORG_WITH_XMLTO         --with-xmlto
23099e0146f7Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
23109e0146f7Smrg# XORG_WITH_DOXYGEN       --with-doxygen
23119e0146f7Smrg# XORG_WITH_FOP           --with-fop
23129e0146f7Smrg# XORG_WITH_GROFF         --with-groff
23139e0146f7Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
23149e0146f7Smrg#
23159e0146f7Smrg# Interface to module:
23169e0146f7Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
23179e0146f7Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
23189e0146f7Smrg#			'no' user instructs the module not to generate developer docs
23199e0146f7Smrg# parm1:		specify the default value, yes or no.
23209e0146f7Smrg#
23219e0146f7SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
23223538fbe3Smrgm4_define([devel_default], m4_default([$1], [yes]))
23239e0146f7SmrgAC_ARG_ENABLE(devel-docs,
23249e0146f7Smrg	AS_HELP_STRING([--enable-devel-docs],
23253538fbe3Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
23263538fbe3Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
23273538fbe3Smrgm4_undefine([devel_default])
23289e0146f7SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
23299e0146f7SmrgAC_MSG_CHECKING([whether to build developer documentation])
23309e0146f7SmrgAC_MSG_RESULT([$build_devel_docs])
23319e0146f7Smrg]) # XORG_ENABLE_DEVEL_DOCS
23329e0146f7Smrg
23339e0146f7Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
23349e0146f7Smrg# ----------------
23359e0146f7Smrg# Minimum version: 1.6.0
23369e0146f7Smrg#
23379e0146f7Smrg# This macro enables a builder to skip all functional specification targets.
23389e0146f7Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
23399e0146f7Smrg# maximum flexibilty in controlling documentation building.
23409e0146f7Smrg# Refer to:
23419e0146f7Smrg# XORG_WITH_XMLTO         --with-xmlto
23429e0146f7Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
23439e0146f7Smrg# XORG_WITH_DOXYGEN       --with-doxygen
23449e0146f7Smrg# XORG_WITH_FOP           --with-fop
23459e0146f7Smrg# XORG_WITH_GROFF         --with-groff
23469e0146f7Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
23479e0146f7Smrg#
23489e0146f7Smrg# Interface to module:
23499e0146f7Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
23509e0146f7Smrg# --enable-specs:	'yes' user instructs the module to generate specs
23519e0146f7Smrg#			'no' user instructs the module not to generate specs
23529e0146f7Smrg# parm1:		specify the default value, yes or no.
23539e0146f7Smrg#
23549e0146f7SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
23553538fbe3Smrgm4_define([spec_default], m4_default([$1], [yes]))
23569e0146f7SmrgAC_ARG_ENABLE(specs,
23579e0146f7Smrg	AS_HELP_STRING([--enable-specs],
23583538fbe3Smrg	   [Enable building the specs (default: ]spec_default[)]),
23593538fbe3Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
23603538fbe3Smrgm4_undefine([spec_default])
23619e0146f7SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
23629e0146f7SmrgAC_MSG_CHECKING([whether to build functional specifications])
23639e0146f7SmrgAC_MSG_RESULT([$build_specs])
23649e0146f7Smrg]) # XORG_ENABLE_SPECS
2365492e1cfeSmrg
23663538fbe3Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
23673538fbe3Smrg# ----------------------------------------------
23683538fbe3Smrg# Minimum version: 1.13.0
23693538fbe3Smrg#
23703538fbe3Smrg# This macro enables a builder to enable/disable unit testing
23713538fbe3Smrg# It makes no assumption about the test cases implementation
23723538fbe3Smrg# Test cases may or may not use Automake "Support for test suites"
23733538fbe3Smrg# They may or may not use the software utility library GLib
23743538fbe3Smrg#
23753538fbe3Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
23763538fbe3Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
23773538fbe3Smrg# The variable enable_unit_tests is used by other macros in this file.
23783538fbe3Smrg#
23793538fbe3Smrg# Interface to module:
23803538fbe3Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
23813538fbe3Smrg# enable_unit_tests:    used in configure.ac for additional configuration
23823538fbe3Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
23833538fbe3Smrg#			'no' user instructs the module not to build tests
23843538fbe3Smrg# parm1:		specify the default value, yes or no.
23853538fbe3Smrg#
23863538fbe3SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
23873538fbe3SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
23883538fbe3SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
23893538fbe3SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
23903538fbe3Smrgm4_define([_defopt], m4_default([$1], [auto]))
23913538fbe3SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
23923538fbe3Smrg	[Enable building unit test cases (default: ]_defopt[)]),
23933538fbe3Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
23943538fbe3Smrgm4_undefine([_defopt])
23953538fbe3SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
23963538fbe3SmrgAC_MSG_CHECKING([whether to build unit test cases])
23973538fbe3SmrgAC_MSG_RESULT([$enable_unit_tests])
23983538fbe3Smrg]) # XORG_ENABLE_UNIT_TESTS
23993538fbe3Smrg
24001afad795Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
24011afad795Smrg# ------------------------------------------------------
24021afad795Smrg# Minimum version: 1.17.0
24031afad795Smrg#
24041afad795Smrg# This macro enables a builder to enable/disable integration testing
24051afad795Smrg# It makes no assumption about the test cases' implementation
24061afad795Smrg# Test cases may or may not use Automake "Support for test suites"
24071afad795Smrg#
24081afad795Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
24091afad795Smrg# usually requires less dependencies and may be built and run under less
24101afad795Smrg# stringent environments than integration tests.
24111afad795Smrg#
24121afad795Smrg# Interface to module:
24131afad795Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
24141afad795Smrg# enable_integration_tests:   used in configure.ac for additional configuration
24151afad795Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
24161afad795Smrg#                             'no' user instructs the module not to build tests
24171afad795Smrg# parm1:                      specify the default value, yes or no.
24181afad795Smrg#
24191afad795SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
24201afad795SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
24211afad795Smrgm4_define([_defopt], m4_default([$1], [auto]))
24221afad795SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
24231afad795Smrg	[Enable building integration test cases (default: ]_defopt[)]),
24241afad795Smrg	[enable_integration_tests=$enableval],
24251afad795Smrg	[enable_integration_tests=]_defopt)
24261afad795Smrgm4_undefine([_defopt])
24271afad795SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
24281afad795Smrg	[test "x$enable_integration_tests" != xno])
24291afad795SmrgAC_MSG_CHECKING([whether to build unit test cases])
24301afad795SmrgAC_MSG_RESULT([$enable_integration_tests])
24311afad795Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
24321afad795Smrg
24333538fbe3Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
24343538fbe3Smrg# ----------------------------------------
24353538fbe3Smrg# Minimum version: 1.13.0
24363538fbe3Smrg#
24373538fbe3Smrg# GLib is a library which provides advanced data structures and functions.
24383538fbe3Smrg# This macro enables a module to test for the presence of Glib.
24393538fbe3Smrg#
24403538fbe3Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
24413538fbe3Smrg# Otherwise the value of $enable_unit_tests is blank.
24423538fbe3Smrg#
24431afad795Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
24441afad795Smrg# test support usually requires less dependencies and may be built and run under
24451afad795Smrg# less stringent environments than integration tests.
24461afad795Smrg#
24473538fbe3Smrg# Interface to module:
24483538fbe3Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
24493538fbe3Smrg# with_glib: used in configure.ac to know if GLib has been found
24503538fbe3Smrg# --with-glib:	'yes' user instructs the module to use glib
24513538fbe3Smrg#		'no' user instructs the module not to use glib
24523538fbe3Smrg#
24533538fbe3SmrgAC_DEFUN([XORG_WITH_GLIB],[
24543538fbe3SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
24553538fbe3Smrgm4_define([_defopt], m4_default([$2], [auto]))
24563538fbe3SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
24573538fbe3Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
24583538fbe3Smrg	[with_glib=$withval], [with_glib=]_defopt)
24593538fbe3Smrgm4_undefine([_defopt])
24603538fbe3Smrg
24613538fbe3Smrghave_glib=no
24623538fbe3Smrg# Do not probe GLib if user explicitly disabled unit testing
24633538fbe3Smrgif test "x$enable_unit_tests" != x"no"; then
24643538fbe3Smrg  # Do not probe GLib if user explicitly disabled it
24653538fbe3Smrg  if test "x$with_glib" != x"no"; then
24663538fbe3Smrg    m4_ifval(
24673538fbe3Smrg      [$1],
24683538fbe3Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
24693538fbe3Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
24703538fbe3Smrg    )
24713538fbe3Smrg  fi
24723538fbe3Smrgfi
24733538fbe3Smrg
24743538fbe3Smrg# Not having GLib when unit testing has been explicitly requested is an error
24753538fbe3Smrgif test "x$enable_unit_tests" = x"yes"; then
24763538fbe3Smrg  if test "x$have_glib" = x"no"; then
24773538fbe3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
24783538fbe3Smrg  fi
24793538fbe3Smrgfi
24803538fbe3Smrg
24813538fbe3Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
24823538fbe3Smrgif test "x$enable_unit_tests" = x"no"; then
24833538fbe3Smrg  if test "x$with_glib" = x"yes"; then
24843538fbe3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
24853538fbe3Smrg  fi
24863538fbe3Smrgfi
24873538fbe3Smrg
24883538fbe3Smrg# Not having GLib when it has been explicitly requested is an error
24893538fbe3Smrgif test "x$with_glib" = x"yes"; then
24903538fbe3Smrg  if test "x$have_glib" = x"no"; then
24913538fbe3Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
24923538fbe3Smrg  fi
24933538fbe3Smrgfi
24943538fbe3Smrg
24953538fbe3SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
24963538fbe3Smrg]) # XORG_WITH_GLIB
24973538fbe3Smrg
24983538fbe3Smrg# XORG_LD_WRAP([required|optional])
24993538fbe3Smrg# ---------------------------------
25003538fbe3Smrg# Minimum version: 1.13.0
25013538fbe3Smrg#
25023538fbe3Smrg# Check if linker supports -wrap, passed via compiler flags
25033538fbe3Smrg#
25043538fbe3Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
25053538fbe3Smrg# Otherwise the value of $enable_unit_tests is blank.
25063538fbe3Smrg#
25073538fbe3Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
25083538fbe3Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
25093538fbe3Smrg# available, an argument of "optional" allows use when some unit tests require
25103538fbe3Smrg# ld -wrap and others do not.
25113538fbe3Smrg#
25123538fbe3SmrgAC_DEFUN([XORG_LD_WRAP],[
25133538fbe3SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
25143538fbe3Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
25153538fbe3Smrg                      void __wrap_exit(int status) { return; }],
25163538fbe3Smrg                     [exit(0);])])
25173538fbe3Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
25183538fbe3Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
25193538fbe3Smrg  if test "x$have_ld_wrap" = x"no"; then
25203538fbe3Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
25213538fbe3Smrg  fi
25223538fbe3Smrgfi
25233538fbe3SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
25243538fbe3Smrg#
25253538fbe3Smrg]) # XORG_LD_WRAP
25263538fbe3Smrg
25273538fbe3Smrg# XORG_CHECK_LINKER_FLAGS
25283538fbe3Smrg# -----------------------
25293538fbe3Smrg# SYNOPSIS
25303538fbe3Smrg#
25313538fbe3Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
25323538fbe3Smrg#
25333538fbe3Smrg# DESCRIPTION
25343538fbe3Smrg#
25353538fbe3Smrg#   Check whether the given linker FLAGS work with the current language's
25363538fbe3Smrg#   linker, or whether they give an error.
25373538fbe3Smrg#
25383538fbe3Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
25393538fbe3Smrg#   success/failure.
25403538fbe3Smrg#
25413538fbe3Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
25423538fbe3Smrg#
25433538fbe3Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
25443538fbe3Smrg#
25453538fbe3Smrg# LICENSE
25463538fbe3Smrg#
25473538fbe3Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
25483538fbe3Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
25493538fbe3Smrg#   Copyright (c) 2009 Matteo Frigo
25503538fbe3Smrg#
25513538fbe3Smrg#   This program is free software: you can redistribute it and/or modify it
25523538fbe3Smrg#   under the terms of the GNU General Public License as published by the
25533538fbe3Smrg#   Free Software Foundation, either version 3 of the License, or (at your
25543538fbe3Smrg#   option) any later version.
25553538fbe3Smrg#
25563538fbe3Smrg#   This program is distributed in the hope that it will be useful, but
25573538fbe3Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
25583538fbe3Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
25593538fbe3Smrg#   Public License for more details.
25603538fbe3Smrg#
25613538fbe3Smrg#   You should have received a copy of the GNU General Public License along
25623538fbe3Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
25633538fbe3Smrg#
25643538fbe3Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
25653538fbe3Smrg#   gives unlimited permission to copy, distribute and modify the configure
25663538fbe3Smrg#   scripts that are the output of Autoconf when processing the Macro. You
25673538fbe3Smrg#   need not follow the terms of the GNU General Public License when using
25683538fbe3Smrg#   or distributing such scripts, even though portions of the text of the
25693538fbe3Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
25703538fbe3Smrg#   all other use of the material that constitutes the Autoconf Macro.
25713538fbe3Smrg#
25723538fbe3Smrg#   This special exception to the GPL applies to versions of the Autoconf
25733538fbe3Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
25743538fbe3Smrg#   modified version of the Autoconf Macro, you may extend this special
25753538fbe3Smrg#   exception to the GPL to apply to your modified version as well.#
25763538fbe3SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
25773538fbe3Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
25783538fbe3Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
25793538fbe3SmrgAS_LITERAL_IF([$1],
25803538fbe3Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
25813538fbe3Smrg      ax_save_FLAGS=$LDFLAGS
25823538fbe3Smrg      LDFLAGS="$1"
25833538fbe3Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
25843538fbe3Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
25853538fbe3Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
25863538fbe3Smrg      LDFLAGS=$ax_save_FLAGS])],
25873538fbe3Smrg  [ax_save_FLAGS=$LDFLAGS
25883538fbe3Smrg   LDFLAGS="$1"
25893538fbe3Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
25903538fbe3Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
25913538fbe3Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
25923538fbe3Smrg   LDFLAGS=$ax_save_FLAGS])
25933538fbe3Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
25943538fbe3SmrgAC_MSG_RESULT($xorg_check_linker_flags)
25953538fbe3Smrgif test "x$xorg_check_linker_flags" = xyes; then
25963538fbe3Smrg	m4_default([$2], :)
25973538fbe3Smrgelse
25983538fbe3Smrg	m4_default([$3], :)
25993538fbe3Smrgfi
26003538fbe3Smrg]) # XORG_CHECK_LINKER_FLAGS
26013538fbe3Smrg
26023538fbe3Smrg# XORG_MEMORY_CHECK_FLAGS
26033538fbe3Smrg# -----------------------
26043538fbe3Smrg# Minimum version: 1.16.0
26053538fbe3Smrg#
26063538fbe3Smrg# This macro attempts to find appropriate memory checking functionality
26073538fbe3Smrg# for various platforms which unit testing code may use to catch various
26083538fbe3Smrg# forms of memory allocation and access errors in testing.
26093538fbe3Smrg#
26103538fbe3Smrg# Interface to module:
26113538fbe3Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
26123538fbe3Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
26133538fbe3Smrg#
26143538fbe3Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
26153538fbe3Smrg#
26163538fbe3SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
26173538fbe3Smrg
26183538fbe3SmrgAC_REQUIRE([AC_CANONICAL_HOST])
26193538fbe3SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
26203538fbe3Smrg           [Environment variables to enable memory checking in tests])
26213538fbe3Smrg
26223538fbe3Smrg# Check for different types of support on different platforms
26233538fbe3Smrgcase $host_os in
26243538fbe3Smrg    solaris*)
26253538fbe3Smrg        AC_CHECK_LIB([umem], [umem_alloc],
26263538fbe3Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
26273538fbe3Smrg        ;;
26283538fbe3Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
26293538fbe3Smrg        # both directly and inverted, so should not be 0 or 255.
26303538fbe3Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
26313538fbe3Smrg        ;;
26323538fbe3Smrg    darwin*)
26333538fbe3Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
26343538fbe3Smrg        ;;
26353538fbe3Smrg    *bsd*)
26363538fbe3Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
26373538fbe3Smrg        ;;
26383538fbe3Smrgesac
26393538fbe3Smrg
26403538fbe3Smrg# User supplied flags override default flags
26413538fbe3Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
26423538fbe3Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
26433538fbe3Smrgfi
26443538fbe3Smrg
26453538fbe3SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
26463538fbe3Smrg]) # XORG_WITH_LINT
26473538fbe3Smrg
2648492e1cfeSmrg# XORG_CHECK_MALLOC_ZERO
2649492e1cfeSmrg# ----------------------
26509e0146f7Smrg# Minimum version: 1.0.0
26519e0146f7Smrg#
2652492e1cfeSmrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2653492e1cfeSmrg# malloc(0) returns NULL.  Packages should add one of these cflags to
2654492e1cfeSmrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2655492e1cfeSmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2656492e1cfeSmrgAC_ARG_ENABLE(malloc0returnsnull,
26579e0146f7Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
2658492e1cfeSmrg		       [malloc(0) returns NULL (default: auto)]),
2659492e1cfeSmrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2660492e1cfeSmrg	[MALLOC_ZERO_RETURNS_NULL=auto])
2661492e1cfeSmrg
2662492e1cfeSmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
2663492e1cfeSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
26643538fbe3Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
26653538fbe3Smrg#include <stdlib.h>
26663538fbe3Smrg],[
2667492e1cfeSmrg    char *m0, *r0, *c0, *p;
2668492e1cfeSmrg    m0 = malloc(0);
2669492e1cfeSmrg    p = malloc(10);
2670492e1cfeSmrg    r0 = realloc(p,0);
26713538fbe3Smrg    c0 = calloc(0,10);
26723538fbe3Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
26733538fbe3Smrg])],
2674492e1cfeSmrg		[MALLOC_ZERO_RETURNS_NULL=yes],
26759e0146f7Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
26769e0146f7Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
2677492e1cfeSmrgfi
2678492e1cfeSmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2679492e1cfeSmrg
2680492e1cfeSmrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2681492e1cfeSmrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2682492e1cfeSmrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2683492e1cfeSmrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2684492e1cfeSmrgelse
2685492e1cfeSmrg	MALLOC_ZERO_CFLAGS=""
2686492e1cfeSmrg	XMALLOC_ZERO_CFLAGS=""
2687492e1cfeSmrg	XTMALLOC_ZERO_CFLAGS=""
2688492e1cfeSmrgfi
2689492e1cfeSmrg
2690492e1cfeSmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
2691492e1cfeSmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
2692492e1cfeSmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
2693492e1cfeSmrg]) # XORG_CHECK_MALLOC_ZERO
2694492e1cfeSmrg
26959e0146f7Smrg# XORG_WITH_LINT()
26969e0146f7Smrg# ----------------
26979e0146f7Smrg# Minimum version: 1.1.0
26989e0146f7Smrg#
26999e0146f7Smrg# This macro enables the use of a tool that flags some suspicious and
27009e0146f7Smrg# non-portable constructs (likely to be bugs) in C language source code.
27019e0146f7Smrg# It will attempt to locate the tool and use appropriate options.
27029e0146f7Smrg# There are various lint type tools on different platforms.
27039e0146f7Smrg#
27049e0146f7Smrg# Interface to module:
27059e0146f7Smrg# LINT:		returns the path to the tool found on the platform
27069e0146f7Smrg#		or the value set to LINT on the configure cmd line
27079e0146f7Smrg#		also an Automake conditional
27089e0146f7Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
27099e0146f7Smrg#
27109e0146f7Smrg# --with-lint:	'yes' user instructs the module to use lint
27119e0146f7Smrg#		'no' user instructs the module not to use lint (default)
27129e0146f7Smrg#
27139e0146f7Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
27149e0146f7Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
27159e0146f7Smrg#
27169e0146f7SmrgAC_DEFUN([XORG_WITH_LINT],[
27179e0146f7Smrg
27189e0146f7SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
27199e0146f7SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
27209e0146f7SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
27219e0146f7Smrg		[Use a lint-style source code checker (default: disabled)])],
27229e0146f7Smrg		[use_lint=$withval], [use_lint=no])
27239e0146f7Smrg
27249e0146f7Smrg# Obtain platform specific info like program name and options
27259e0146f7Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
27269e0146f7Smrgcase $host_os in
27279e0146f7Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
27289e0146f7Smrg	lint_name=splint
27299e0146f7Smrg	lint_options="-badflag"
27309e0146f7Smrg	;;
27319e0146f7Smrg  *freebsd* | *netbsd*)
27329e0146f7Smrg	lint_name=lint
27339e0146f7Smrg	lint_options="-u -b"
27349e0146f7Smrg	;;
27359e0146f7Smrg  *solaris*)
27369e0146f7Smrg	lint_name=lint
27379e0146f7Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
27389e0146f7Smrg	;;
27399e0146f7Smrgesac
27409e0146f7Smrg
27419e0146f7Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
27429e0146f7Smrgif test "x$use_lint" = x"yes" ; then
27439e0146f7Smrg   AC_PATH_PROG([LINT], [$lint_name])
27449e0146f7Smrg   if test "x$LINT" = "x"; then
27459e0146f7Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
27469e0146f7Smrg   fi
27479e0146f7Smrgelif test "x$use_lint" = x"no" ; then
27489e0146f7Smrg   if test "x$LINT" != "x"; then
27499e0146f7Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
27509e0146f7Smrg   fi
27519e0146f7Smrgelse
27529e0146f7Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
27539e0146f7Smrgfi
27549e0146f7Smrg
27559e0146f7Smrg# User supplied flags override default flags
27569e0146f7Smrgif test "x$LINT_FLAGS" != "x"; then
27579e0146f7Smrg   lint_options=$LINT_FLAGS
27589e0146f7Smrgfi
27599e0146f7Smrg
27609e0146f7SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
27619e0146f7SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
27629e0146f7Smrg
27639e0146f7Smrg]) # XORG_WITH_LINT
27649e0146f7Smrg
27659e0146f7Smrg# XORG_LINT_LIBRARY(LIBNAME)
27669e0146f7Smrg# --------------------------
27679e0146f7Smrg# Minimum version: 1.1.0
27689e0146f7Smrg#
27699e0146f7Smrg# Sets up flags for building lint libraries for checking programs that call
27709e0146f7Smrg# functions in the library.
27719e0146f7Smrg#
27729e0146f7Smrg# Interface to module:
27739e0146f7Smrg# LINTLIB		- Automake variable with the name of lint library file to make
27749e0146f7Smrg# MAKE_LINT_LIB		- Automake conditional
27759e0146f7Smrg#
27769e0146f7Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
27779e0146f7Smrg#			  - 'no' user instructs the module not to create a lint library (default)
27789e0146f7Smrg
27799e0146f7SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
27809e0146f7SmrgAC_REQUIRE([XORG_WITH_LINT])
27819e0146f7SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
27829e0146f7Smrg	[Create lint library (default: disabled)])],
27839e0146f7Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
27849e0146f7Smrg
27859e0146f7Smrgif test "x$make_lint_lib" = x"yes" ; then
27869e0146f7Smrg   LINTLIB=llib-l$1.ln
27879e0146f7Smrg   if test "x$LINT" = "x"; then
27889e0146f7Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
27899e0146f7Smrg   fi
27909e0146f7Smrgelif test "x$make_lint_lib" != x"no" ; then
27919e0146f7Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
27929e0146f7Smrgfi
27939e0146f7Smrg
27949e0146f7SmrgAC_SUBST(LINTLIB)
27959e0146f7SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
27969e0146f7Smrg
27979e0146f7Smrg]) # XORG_LINT_LIBRARY
27989e0146f7Smrg
27993538fbe3Smrg# XORG_COMPILER_BRAND
28003538fbe3Smrg# -------------------
28013538fbe3Smrg# Minimum version: 1.14.0
28023538fbe3Smrg#
28033538fbe3Smrg# Checks for various brands of compilers and sets flags as appropriate:
28043538fbe3Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
28051afad795Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
28063538fbe3Smrg#   clang compiler - sets CLANGCC to "yes"
28073538fbe3Smrg#   Intel compiler - sets INTELCC to "yes"
28083538fbe3Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
28093538fbe3Smrg#
28103538fbe3SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
28111afad795SmrgAC_LANG_CASE(
28121afad795Smrg	[C], [
28131afad795Smrg		AC_REQUIRE([AC_PROG_CC_C99])
28141afad795Smrg	],
28151afad795Smrg	[C++], [
28161afad795Smrg		AC_REQUIRE([AC_PROG_CXX])
28171afad795Smrg	]
28181afad795Smrg)
28193538fbe3SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
28203538fbe3SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
28213538fbe3SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
28223538fbe3Smrg]) # XORG_COMPILER_BRAND
28233538fbe3Smrg
28243538fbe3Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
28253538fbe3Smrg# ---------------
28263538fbe3Smrg# Minimum version: 1.16.0
28273538fbe3Smrg#
28283538fbe3Smrg# Test if the compiler works when passed the given flag as a command line argument.
28293538fbe3Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
28303538fbe3Smrg# next flag in the list until there are no more options.
28313538fbe3Smrg#
28323538fbe3Smrg# Note that this does not guarantee that the compiler supports the flag as some
28333538fbe3Smrg# compilers will simply ignore arguments that they do not understand, but we do
28343538fbe3Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
28353538fbe3Smrg# -Werror=unused-command-line-argument
28363538fbe3Smrg#
28373538fbe3SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
28383538fbe3Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
28393538fbe3Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
28403538fbe3Smrg
28411afad795SmrgAC_LANG_COMPILER_REQUIRE
28421afad795Smrg
28431afad795SmrgAC_LANG_CASE(
28441afad795Smrg	[C], [
28451afad795Smrg		AC_REQUIRE([AC_PROG_CC_C99])
28461afad795Smrg		define([PREFIX], [C])
28471afad795Smrg		define([CACHE_PREFIX], [cc])
28481afad795Smrg		define([COMPILER], [$CC])
28491afad795Smrg	],
28501afad795Smrg	[C++], [
28511afad795Smrg		define([PREFIX], [CXX])
28521afad795Smrg		define([CACHE_PREFIX], [cxx])
28531afad795Smrg		define([COMPILER], [$CXX])
28541afad795Smrg	]
28551afad795Smrg)
28561afad795Smrg
28571afad795Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
28583538fbe3Smrg
28591afad795Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
28601afad795Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28611afad795Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
28621afad795Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
28633538fbe3Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
28641afad795Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
28651afad795Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
28661afad795Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
28671afad795Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
28683538fbe3Smrgfi
28693538fbe3Smrg
28701afad795Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
28711afad795Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
28721afad795Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28733538fbe3Smrg	fi
28741afad795Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
28751afad795Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
28761afad795Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
28773538fbe3Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
28781afad795Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
28791afad795Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
28801afad795Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
28811afad795Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
28823538fbe3Smrgfi
28833538fbe3Smrg
28843538fbe3Smrgfound="no"
28853538fbe3Smrgm4_foreach([flag], m4_cdr($@), [
28863538fbe3Smrg	if test $found = "no" ; then
28873538fbe3Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
28881afad795Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
28893538fbe3Smrg		fi
28903538fbe3Smrg
28913538fbe3Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
28921afad795Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
28933538fbe3Smrg		fi
28943538fbe3Smrg
28951afad795Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
28963538fbe3Smrg
28973538fbe3Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
28981afad795Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
28991afad795Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
29001afad795Smrg		AC_CACHE_VAL($cacheid,
29013538fbe3Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
29021afad795Smrg					     [eval $cacheid=yes],
29031afad795Smrg					     [eval $cacheid=no])])
29043538fbe3Smrg
29051afad795Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
29063538fbe3Smrg
29071afad795Smrg		eval supported=\$$cacheid
29083538fbe3Smrg		AC_MSG_RESULT([$supported])
29093538fbe3Smrg		if test "$supported" = "yes" ; then
29103538fbe3Smrg			$1="$$1 ]flag["
29113538fbe3Smrg			found="yes"
29123538fbe3Smrg		fi
29133538fbe3Smrg	fi
29143538fbe3Smrg])
29153538fbe3Smrg]) # XORG_TESTSET_CFLAG
29163538fbe3Smrg
29173538fbe3Smrg# XORG_COMPILER_FLAGS
29183538fbe3Smrg# ---------------
29193538fbe3Smrg# Minimum version: 1.16.0
29203538fbe3Smrg#
29211afad795Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
29221afad795Smrg# arguments supported by the selected compiler which do NOT alter the generated
29231afad795Smrg# code.  These arguments will cause the compiler to print various warnings
29241afad795Smrg# during compilation AND turn a conservative set of warnings into errors.
29253538fbe3Smrg#
29261afad795Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
29271afad795Smrg# future versions of util-macros as options are added to new compilers.
29283538fbe3Smrg#
29293538fbe3SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
29303538fbe3SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
29313538fbe3Smrg
29323538fbe3SmrgAC_ARG_ENABLE(selective-werror,
29333538fbe3Smrg              AS_HELP_STRING([--disable-selective-werror],
29343538fbe3Smrg                             [Turn off selective compiler errors. (default: enabled)]),
29353538fbe3Smrg              [SELECTIVE_WERROR=$enableval],
29363538fbe3Smrg              [SELECTIVE_WERROR=yes])
29373538fbe3Smrg
29381afad795SmrgAC_LANG_CASE(
29391afad795Smrg        [C], [
29401afad795Smrg                define([PREFIX], [C])
29411afad795Smrg        ],
29421afad795Smrg        [C++], [
29431afad795Smrg                define([PREFIX], [CXX])
29441afad795Smrg        ]
29451afad795Smrg)
29463538fbe3Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
29473538fbe3Smrgif test "x$SUNCC" = "xyes"; then
29481afad795Smrg    [BASE_]PREFIX[FLAGS]="-v"
29493538fbe3Smrgelse
29501afad795Smrg    [BASE_]PREFIX[FLAGS]=""
29513538fbe3Smrgfi
29523538fbe3Smrg
29533538fbe3Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
29541afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
29551afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
29561afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
29571afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
29581afad795Smrg
29591afad795SmrgAC_LANG_CASE(
29601afad795Smrg	[C], [
29611afad795Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
29621afad795Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
29631afad795Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
29641afad795Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
29651afad795Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
29661afad795Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
29671afad795Smrg	]
29681afad795Smrg)
29693538fbe3Smrg
29703538fbe3Smrg# This chunk adds additional warnings that could catch undesired effects.
29711afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
29721afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
29731afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
29741afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
29751afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
29761afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
29771afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
29783538fbe3Smrg
29793538fbe3Smrg# These are currently disabled because they are noisy.  They will be enabled
29803538fbe3Smrg# in the future once the codebase is sufficiently modernized to silence
29813538fbe3Smrg# them.  For now, I don't want them to drown out the other warnings.
29821afad795Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
29831afad795Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
29841afad795Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
29853538fbe3Smrg
29863538fbe3Smrg# Turn some warnings into errors, so we don't accidently get successful builds
29873538fbe3Smrg# when there are problems that should be fixed.
29883538fbe3Smrg
29893538fbe3Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
29901afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
29911afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
29921afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
29931afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
29941afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
29951afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
29961afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
29971afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
29981afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
29991afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
30001afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
30011afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
30021afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
30033538fbe3Smrgelse
30043538fbe3SmrgAC_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])
30051afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
30061afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
30071afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
30081afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
30091afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
30101afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
30111afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
30121afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
30131afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
30141afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
30151afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
30161afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
30171afad795SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
30181afad795Smrgfi
30191afad795Smrg
30201afad795SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
30213538fbe3Smrg]) # XORG_COMPILER_FLAGS
30223538fbe3Smrg
30239e0146f7Smrg# XORG_CWARNFLAGS
30249e0146f7Smrg# ---------------
30259e0146f7Smrg# Minimum version: 1.2.0
30263538fbe3Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
30279e0146f7Smrg#
30289e0146f7Smrg# Defines CWARNFLAGS to enable C compiler warnings.
30299e0146f7Smrg#
30303538fbe3Smrg# This function is deprecated because it defines -fno-strict-aliasing
30313538fbe3Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
30323538fbe3Smrg# is needed, then it should be added explicitly in the module when
30333538fbe3Smrg# it is updated to use BASE_CFLAGS.
30343538fbe3Smrg#
30359e0146f7SmrgAC_DEFUN([XORG_CWARNFLAGS], [
30363538fbe3SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
30373538fbe3SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
30381afad795SmrgAC_LANG_CASE(
30391afad795Smrg	[C], [
30401afad795Smrg		CWARNFLAGS="$BASE_CFLAGS"
30411afad795Smrg		if  test "x$GCC" = xyes ; then
30421afad795Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
30431afad795Smrg		fi
30441afad795Smrg		AC_SUBST(CWARNFLAGS)
30451afad795Smrg	]
30461afad795Smrg)
30479e0146f7Smrg]) # XORG_CWARNFLAGS
30489e0146f7Smrg
30499e0146f7Smrg# XORG_STRICT_OPTION
30509e0146f7Smrg# -----------------------
30519e0146f7Smrg# Minimum version: 1.3.0
30529e0146f7Smrg#
30533538fbe3Smrg# Add configure option to enable strict compilation flags, such as treating
30543538fbe3Smrg# warnings as fatal errors.
30553538fbe3Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
30561afad795Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
30573538fbe3Smrg#
30583538fbe3Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
30593538fbe3Smrg# when strict compilation is unconditionally desired.
30609e0146f7SmrgAC_DEFUN([XORG_STRICT_OPTION], [
30619e0146f7SmrgAC_REQUIRE([XORG_CWARNFLAGS])
30623538fbe3SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
30639e0146f7Smrg
30649e0146f7SmrgAC_ARG_ENABLE(strict-compilation,
30659e0146f7Smrg			  AS_HELP_STRING([--enable-strict-compilation],
30669e0146f7Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
30679e0146f7Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
30683538fbe3Smrg
30691afad795SmrgAC_LANG_CASE(
30701afad795Smrg        [C], [
30711afad795Smrg                define([PREFIX], [C])
30721afad795Smrg        ],
30731afad795Smrg        [C++], [
30741afad795Smrg                define([PREFIX], [CXX])
30751afad795Smrg        ]
30761afad795Smrg)
30771afad795Smrg
30781afad795Smrg[STRICT_]PREFIX[FLAGS]=""
30791afad795SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
30801afad795SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
30813538fbe3Smrg
30823538fbe3Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
30833538fbe3Smrg# activate it with -Werror, so we add it here explicitly.
30841afad795SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
30853538fbe3Smrg
30869e0146f7Smrgif test "x$STRICT_COMPILE" = "xyes"; then
30871afad795Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
30881afad795Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
30899e0146f7Smrgfi
30901afad795SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
30911afad795SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
30921afad795SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
30939e0146f7Smrg]) # XORG_STRICT_OPTION
30949e0146f7Smrg
30959e0146f7Smrg# XORG_DEFAULT_OPTIONS
30969e0146f7Smrg# --------------------
30979e0146f7Smrg# Minimum version: 1.3.0
30989e0146f7Smrg#
30999e0146f7Smrg# Defines default options for X.Org modules.
31009e0146f7Smrg#
31019e0146f7SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
31029e0146f7SmrgAC_REQUIRE([AC_PROG_INSTALL])
31033538fbe3SmrgXORG_COMPILER_FLAGS
31049e0146f7SmrgXORG_CWARNFLAGS
31059e0146f7SmrgXORG_STRICT_OPTION
31069e0146f7SmrgXORG_RELEASE_VERSION
31079e0146f7SmrgXORG_CHANGELOG
31089e0146f7SmrgXORG_INSTALL
31099e0146f7SmrgXORG_MANPAGE_SECTIONS
31109e0146f7Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
31119e0146f7Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
31129e0146f7Smrg]) # XORG_DEFAULT_OPTIONS
31139e0146f7Smrg
31149e0146f7Smrg# XORG_INSTALL()
31159e0146f7Smrg# ----------------
31169e0146f7Smrg# Minimum version: 1.4.0
31179e0146f7Smrg#
31189e0146f7Smrg# Defines the variable INSTALL_CMD as the command to copy
31199e0146f7Smrg# INSTALL from $prefix/share/util-macros.
31209e0146f7Smrg#
31219e0146f7SmrgAC_DEFUN([XORG_INSTALL], [
31229e0146f7SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
31239e0146f7Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
31249e0146f7SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
31259e0146f7Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
31269e0146f7Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
31279e0146f7Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
31289e0146f7SmrgAC_SUBST([INSTALL_CMD])
31299e0146f7Smrg]) # XORG_INSTALL
3130492e1cfeSmrgdnl Copyright 2005 Red Hat, Inc
3131492e1cfeSmrgdnl
3132492e1cfeSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
3133492e1cfeSmrgdnl documentation for any purpose is hereby granted without fee, provided that
3134492e1cfeSmrgdnl the above copyright notice appear in all copies and that both that
3135492e1cfeSmrgdnl copyright notice and this permission notice appear in supporting
3136492e1cfeSmrgdnl documentation.
3137492e1cfeSmrgdnl
3138492e1cfeSmrgdnl The above copyright notice and this permission notice shall be included
3139492e1cfeSmrgdnl in all copies or substantial portions of the Software.
3140492e1cfeSmrgdnl
3141492e1cfeSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3142492e1cfeSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3143492e1cfeSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3144492e1cfeSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3145492e1cfeSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3146492e1cfeSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3147492e1cfeSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
3148492e1cfeSmrgdnl
3149492e1cfeSmrgdnl Except as contained in this notice, the name of the copyright holders shall
3150492e1cfeSmrgdnl not be used in advertising or otherwise to promote the sale, use or
3151492e1cfeSmrgdnl other dealings in this Software without prior written authorization
3152492e1cfeSmrgdnl from the copyright holders.
3153492e1cfeSmrgdnl
3154492e1cfeSmrg
3155492e1cfeSmrg# XORG_RELEASE_VERSION
3156492e1cfeSmrg# --------------------
31579e0146f7Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3158492e1cfeSmrg 
3159492e1cfeSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
31609e0146f7Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
31619e0146f7Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
31629e0146f7Smrg		[Major version of this package])
31639e0146f7Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
31649e0146f7Smrg	if test "x$PVM" = "x"; then
31659e0146f7Smrg		PVM="0"
3166492e1cfeSmrg	fi
31679e0146f7Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
31689e0146f7Smrg		[$PVM],
31699e0146f7Smrg		[Minor version of this package])
31709e0146f7Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
31719e0146f7Smrg	if test "x$PVP" = "x"; then
31729e0146f7Smrg		PVP="0"
31739e0146f7Smrg	fi
31749e0146f7Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
31759e0146f7Smrg		[$PVP],
31769e0146f7Smrg		[Patch version of this package])
3177492e1cfeSmrg])
3178492e1cfeSmrg
31799e0146f7Smrg# XORG_CHANGELOG()
31809e0146f7Smrg# ----------------
31819e0146f7Smrg# Minimum version: 1.2.0
31829e0146f7Smrg#
31839e0146f7Smrg# Defines the variable CHANGELOG_CMD as the command to generate
31849e0146f7Smrg# ChangeLog from git.
31859e0146f7Smrg#
31869e0146f7Smrg#
31879e0146f7SmrgAC_DEFUN([XORG_CHANGELOG], [
31889e0146f7SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
31899e0146f7Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
31909e0146f7Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
31919e0146f7Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
31929e0146f7SmrgAC_SUBST([CHANGELOG_CMD])
31939e0146f7Smrg]) # XORG_CHANGELOG
31949e0146f7Smrg
3195