16758a055Smrg# generated automatically by aclocal 1.11.2 -*- Autoconf -*-
2cacd992dSmrg
314ddf674Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
46758a055Smrg# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
56758a055Smrg# Inc.
6cacd992dSmrg# This file is free software; the Free Software Foundation
7cacd992dSmrg# gives unlimited permission to copy and/or distribute it,
8cacd992dSmrg# with or without modifications, as long as this notice is preserved.
9cacd992dSmrg
10cacd992dSmrg# This program is distributed in the hope that it will be useful,
11cacd992dSmrg# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12cacd992dSmrg# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13cacd992dSmrg# PARTICULAR PURPOSE.
14cacd992dSmrg
1514ddf674Smrgm4_ifndef([AC_AUTOCONF_VERSION],
1614ddf674Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
176758a055Smrgm4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
186758a055Smrg[m4_warning([this file was generated for autoconf 2.68.
1914ddf674SmrgYou have another version of autoconf.  It may work, but is not guaranteed to.
2014ddf674SmrgIf you have problems, you may need to regenerate the build system entirely.
2114ddf674SmrgTo do so, use the procedure documented by the package, typically `autoreconf'.])])
22cacd992dSmrg
236758a055Smrg# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
246758a055Smrg# Foundation, Inc.
2514ddf674Smrg#
2614ddf674Smrg# This file is free software; the Free Software Foundation
2714ddf674Smrg# gives unlimited permission to copy and/or distribute it,
2814ddf674Smrg# with or without modifications, as long as this notice is preserved.
29cacd992dSmrg
306758a055Smrg# serial 1
316758a055Smrg
32cacd992dSmrg# AM_AUTOMAKE_VERSION(VERSION)
33cacd992dSmrg# ----------------------------
34cacd992dSmrg# Automake X.Y traces this macro to ensure aclocal.m4 has been
35cacd992dSmrg# generated from the m4 files accompanying Automake X.Y.
3614ddf674Smrg# (This private macro should not be called outside this file.)
3714ddf674SmrgAC_DEFUN([AM_AUTOMAKE_VERSION],
3814ddf674Smrg[am__api_version='1.11'
3914ddf674Smrgdnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
4014ddf674Smrgdnl require some minimum version.  Point them to the right macro.
416758a055Smrgm4_if([$1], [1.11.2], [],
4214ddf674Smrg      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4314ddf674Smrg])
4414ddf674Smrg
4514ddf674Smrg# _AM_AUTOCONF_VERSION(VERSION)
4614ddf674Smrg# -----------------------------
4714ddf674Smrg# aclocal traces this macro to find the Autoconf version.
4814ddf674Smrg# This is a private macro too.  Using m4_define simplifies
4914ddf674Smrg# the logic in aclocal, which can simply ignore this definition.
5014ddf674Smrgm4_define([_AM_AUTOCONF_VERSION], [])
51cacd992dSmrg
52cacd992dSmrg# AM_SET_CURRENT_AUTOMAKE_VERSION
53cacd992dSmrg# -------------------------------
5414ddf674Smrg# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5514ddf674Smrg# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
56cacd992dSmrgAC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
576758a055Smrg[AM_AUTOMAKE_VERSION([1.11.2])dnl
5814ddf674Smrgm4_ifndef([AC_AUTOCONF_VERSION],
5914ddf674Smrg  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
6014ddf674Smrg_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
61cacd992dSmrg
6214ddf674Smrg# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
63cacd992dSmrg
646758a055Smrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
65cacd992dSmrg#
6614ddf674Smrg# This file is free software; the Free Software Foundation
6714ddf674Smrg# gives unlimited permission to copy and/or distribute it,
6814ddf674Smrg# with or without modifications, as long as this notice is preserved.
69cacd992dSmrg
706758a055Smrg# serial 1
716758a055Smrg
72cacd992dSmrg# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
73cacd992dSmrg# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
74cacd992dSmrg# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
75cacd992dSmrg#
76cacd992dSmrg# Of course, Automake must honor this variable whenever it calls a
77cacd992dSmrg# tool from the auxiliary directory.  The problem is that $srcdir (and
78cacd992dSmrg# therefore $ac_aux_dir as well) can be either absolute or relative,
79cacd992dSmrg# depending on how configure is run.  This is pretty annoying, since
80cacd992dSmrg# it makes $ac_aux_dir quite unusable in subdirectories: in the top
81cacd992dSmrg# source directory, any form will work fine, but in subdirectories a
82cacd992dSmrg# relative path needs to be adjusted first.
83cacd992dSmrg#
84cacd992dSmrg# $ac_aux_dir/missing
85cacd992dSmrg#    fails when called from a subdirectory if $ac_aux_dir is relative
86cacd992dSmrg# $top_srcdir/$ac_aux_dir/missing
87cacd992dSmrg#    fails if $ac_aux_dir is absolute,
88cacd992dSmrg#    fails when called from a subdirectory in a VPATH build with
89cacd992dSmrg#          a relative $ac_aux_dir
90cacd992dSmrg#
91cacd992dSmrg# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
92cacd992dSmrg# are both prefixed by $srcdir.  In an in-source build this is usually
93cacd992dSmrg# harmless because $srcdir is `.', but things will broke when you
94cacd992dSmrg# start a VPATH build or use an absolute $srcdir.
95cacd992dSmrg#
96cacd992dSmrg# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
97cacd992dSmrg# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
98cacd992dSmrg#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
99cacd992dSmrg# and then we would define $MISSING as
100cacd992dSmrg#   MISSING="\${SHELL} $am_aux_dir/missing"
101cacd992dSmrg# This will work as long as MISSING is not called from configure, because
102cacd992dSmrg# unfortunately $(top_srcdir) has no meaning in configure.
103cacd992dSmrg# However there are other variables, like CC, which are often used in
104cacd992dSmrg# configure, and could therefore not use this "fixed" $ac_aux_dir.
105cacd992dSmrg#
106cacd992dSmrg# Another solution, used here, is to always expand $ac_aux_dir to an
107cacd992dSmrg# absolute PATH.  The drawback is that using absolute paths prevent a
108cacd992dSmrg# configured tree to be moved without reconfiguration.
109cacd992dSmrg
11014ddf674SmrgAC_DEFUN([AM_AUX_DIR_EXPAND],
11114ddf674Smrg[dnl Rely on autoconf to set up CDPATH properly.
11214ddf674SmrgAC_PREREQ([2.50])dnl
113cacd992dSmrg# expand $ac_aux_dir to an absolute path
114cacd992dSmrgam_aux_dir=`cd $ac_aux_dir && pwd`
115cacd992dSmrg])
116cacd992dSmrg
11714ddf674Smrg# AM_CONDITIONAL                                            -*- Autoconf -*-
118cacd992dSmrg
11914ddf674Smrg# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
12014ddf674Smrg# Free Software Foundation, Inc.
12114ddf674Smrg#
12214ddf674Smrg# This file is free software; the Free Software Foundation
12314ddf674Smrg# gives unlimited permission to copy and/or distribute it,
12414ddf674Smrg# with or without modifications, as long as this notice is preserved.
125cacd992dSmrg
12614ddf674Smrg# serial 9
127cacd992dSmrg
12814ddf674Smrg# AM_CONDITIONAL(NAME, SHELL-CONDITION)
12914ddf674Smrg# -------------------------------------
13014ddf674Smrg# Define a conditional.
13114ddf674SmrgAC_DEFUN([AM_CONDITIONAL],
13214ddf674Smrg[AC_PREREQ(2.52)dnl
13314ddf674Smrg ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
13414ddf674Smrg	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
13514ddf674SmrgAC_SUBST([$1_TRUE])dnl
13614ddf674SmrgAC_SUBST([$1_FALSE])dnl
13714ddf674Smrg_AM_SUBST_NOTMAKE([$1_TRUE])dnl
13814ddf674Smrg_AM_SUBST_NOTMAKE([$1_FALSE])dnl
13914ddf674Smrgm4_define([_AM_COND_VALUE_$1], [$2])dnl
14014ddf674Smrgif $2; then
14114ddf674Smrg  $1_TRUE=
14214ddf674Smrg  $1_FALSE='#'
143cacd992dSmrgelse
14414ddf674Smrg  $1_TRUE='#'
14514ddf674Smrg  $1_FALSE=
146cacd992dSmrgfi
14714ddf674SmrgAC_CONFIG_COMMANDS_PRE(
14814ddf674Smrg[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
14914ddf674Smrg  AC_MSG_ERROR([[conditional "$1" was never defined.
15014ddf674SmrgUsually this means the macro was only invoked conditionally.]])
15114ddf674Smrgfi])])
152cacd992dSmrg
1536758a055Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
1546758a055Smrg# 2010, 2011 Free Software Foundation, Inc.
15514ddf674Smrg#
15614ddf674Smrg# This file is free software; the Free Software Foundation
15714ddf674Smrg# gives unlimited permission to copy and/or distribute it,
15814ddf674Smrg# with or without modifications, as long as this notice is preserved.
159cacd992dSmrg
1606758a055Smrg# serial 12
161cacd992dSmrg
162cacd992dSmrg# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
163cacd992dSmrg# written in clear, in which case automake, when reading aclocal.m4,
164cacd992dSmrg# will think it sees a *use*, and therefore will trigger all it's
165cacd992dSmrg# C support machinery.  Also note that it means that autoscan, seeing
166cacd992dSmrg# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
167cacd992dSmrg
168cacd992dSmrg
169cacd992dSmrg# _AM_DEPENDENCIES(NAME)
170cacd992dSmrg# ----------------------
171cacd992dSmrg# See how the compiler implements dependency checking.
172cacd992dSmrg# NAME is "CC", "CXX", "GCJ", or "OBJC".
173cacd992dSmrg# We try a few techniques and use that to set a single cache variable.
174cacd992dSmrg#
175cacd992dSmrg# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
176cacd992dSmrg# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
177cacd992dSmrg# dependency, and given that the user is not expected to run this macro,
178cacd992dSmrg# just rely on AC_PROG_CC.
179cacd992dSmrgAC_DEFUN([_AM_DEPENDENCIES],
180cacd992dSmrg[AC_REQUIRE([AM_SET_DEPDIR])dnl
181cacd992dSmrgAC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
182cacd992dSmrgAC_REQUIRE([AM_MAKE_INCLUDE])dnl
183cacd992dSmrgAC_REQUIRE([AM_DEP_TRACK])dnl
184cacd992dSmrg
185cacd992dSmrgifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
186cacd992dSmrg       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
187cacd992dSmrg       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
18814ddf674Smrg       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
189cacd992dSmrg       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
190cacd992dSmrg                   [depcc="$$1"   am_compiler_list=])
191cacd992dSmrg
192cacd992dSmrgAC_CACHE_CHECK([dependency style of $depcc],
193cacd992dSmrg               [am_cv_$1_dependencies_compiler_type],
194cacd992dSmrg[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
195cacd992dSmrg  # We make a subdir and do the tests there.  Otherwise we can end up
196cacd992dSmrg  # making bogus files that we don't know about and never remove.  For
197cacd992dSmrg  # instance it was reported that on HP-UX the gcc test will end up
198cacd992dSmrg  # making a dummy file named `D' -- because `-MD' means `put the output
199cacd992dSmrg  # in D'.
2006758a055Smrg  rm -rf conftest.dir
201cacd992dSmrg  mkdir conftest.dir
202cacd992dSmrg  # Copy depcomp to subdir because otherwise we won't find it if we're
203cacd992dSmrg  # using a relative directory.
204cacd992dSmrg  cp "$am_depcomp" conftest.dir
205cacd992dSmrg  cd conftest.dir
206cacd992dSmrg  # We will build objects and dependencies in a subdirectory because
207cacd992dSmrg  # it helps to detect inapplicable dependency modes.  For instance
208cacd992dSmrg  # both Tru64's cc and ICC support -MD to output dependencies as a
209cacd992dSmrg  # side effect of compilation, but ICC will put the dependencies in
210cacd992dSmrg  # the current directory while Tru64 will put them in the object
211cacd992dSmrg  # directory.
212cacd992dSmrg  mkdir sub
213cacd992dSmrg
214cacd992dSmrg  am_cv_$1_dependencies_compiler_type=none
215cacd992dSmrg  if test "$am_compiler_list" = ""; then
216cacd992dSmrg     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
217cacd992dSmrg  fi
21814ddf674Smrg  am__universal=false
21914ddf674Smrg  m4_case([$1], [CC],
22014ddf674Smrg    [case " $depcc " in #(
22114ddf674Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
22214ddf674Smrg     esac],
22314ddf674Smrg    [CXX],
22414ddf674Smrg    [case " $depcc " in #(
22514ddf674Smrg     *\ -arch\ *\ -arch\ *) am__universal=true ;;
22614ddf674Smrg     esac])
22714ddf674Smrg
228cacd992dSmrg  for depmode in $am_compiler_list; do
229cacd992dSmrg    # Setup a source with many dependencies, because some compilers
230cacd992dSmrg    # like to wrap large dependency lists on column 80 (with \), and
231cacd992dSmrg    # we should not choose a depcomp mode which is confused by this.
232cacd992dSmrg    #
233cacd992dSmrg    # We need to recreate these files for each test, as the compiler may
234cacd992dSmrg    # overwrite some of them when testing with obscure command lines.
235cacd992dSmrg    # This happens at least with the AIX C compiler.
236cacd992dSmrg    : > sub/conftest.c
237cacd992dSmrg    for i in 1 2 3 4 5 6; do
238cacd992dSmrg      echo '#include "conftst'$i'.h"' >> sub/conftest.c
23914ddf674Smrg      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
24014ddf674Smrg      # Solaris 8's {/usr,}/bin/sh.
24114ddf674Smrg      touch sub/conftst$i.h
242cacd992dSmrg    done
243cacd992dSmrg    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
244cacd992dSmrg
24514ddf674Smrg    # We check with `-c' and `-o' for the sake of the "dashmstdout"
24614ddf674Smrg    # mode.  It turns out that the SunPro C++ compiler does not properly
24714ddf674Smrg    # handle `-M -o', and we need to detect this.  Also, some Intel
24814ddf674Smrg    # versions had trouble with output in subdirs
24914ddf674Smrg    am__obj=sub/conftest.${OBJEXT-o}
25014ddf674Smrg    am__minus_obj="-o $am__obj"
251cacd992dSmrg    case $depmode in
25214ddf674Smrg    gcc)
25314ddf674Smrg      # This depmode causes a compiler race in universal mode.
25414ddf674Smrg      test "$am__universal" = false || continue
25514ddf674Smrg      ;;
256cacd992dSmrg    nosideeffect)
257cacd992dSmrg      # after this tag, mechanisms are not by side-effect, so they'll
258cacd992dSmrg      # only be used when explicitly requested
259cacd992dSmrg      if test "x$enable_dependency_tracking" = xyes; then
260cacd992dSmrg	continue
261cacd992dSmrg      else
262cacd992dSmrg	break
263cacd992dSmrg      fi
264cacd992dSmrg      ;;
2656758a055Smrg    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
26614ddf674Smrg      # This compiler won't grok `-c -o', but also, the minuso test has
26714ddf674Smrg      # not run yet.  These depmodes are late enough in the game, and
26814ddf674Smrg      # so weak that their functioning should not be impacted.
26914ddf674Smrg      am__obj=conftest.${OBJEXT-o}
27014ddf674Smrg      am__minus_obj=
27114ddf674Smrg      ;;
272cacd992dSmrg    none) break ;;
273cacd992dSmrg    esac
274cacd992dSmrg    if depmode=$depmode \
27514ddf674Smrg       source=sub/conftest.c object=$am__obj \
276cacd992dSmrg       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
27714ddf674Smrg       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
278cacd992dSmrg         >/dev/null 2>conftest.err &&
27914ddf674Smrg       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
280cacd992dSmrg       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
28114ddf674Smrg       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
282cacd992dSmrg       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
283cacd992dSmrg      # icc doesn't choke on unknown options, it will just issue warnings
28414ddf674Smrg      # or remarks (even with -Werror).  So we grep stderr for any message
28514ddf674Smrg      # that says an option was ignored or not supported.
28614ddf674Smrg      # When given -MP, icc 7.0 and 7.1 complain thusly:
28714ddf674Smrg      #   icc: Command line warning: ignoring option '-M'; no argument required
28814ddf674Smrg      # The diagnosis changed in icc 8.0:
28914ddf674Smrg      #   icc: Command line remark: option '-MP' not supported
29014ddf674Smrg      if (grep 'ignoring option' conftest.err ||
29114ddf674Smrg          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
292cacd992dSmrg        am_cv_$1_dependencies_compiler_type=$depmode
293cacd992dSmrg        break
294cacd992dSmrg      fi
295cacd992dSmrg    fi
296cacd992dSmrg  done
297cacd992dSmrg
298cacd992dSmrg  cd ..
299cacd992dSmrg  rm -rf conftest.dir
300cacd992dSmrgelse
301cacd992dSmrg  am_cv_$1_dependencies_compiler_type=none
302cacd992dSmrgfi
303cacd992dSmrg])
304cacd992dSmrgAC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
305cacd992dSmrgAM_CONDITIONAL([am__fastdep$1], [
306cacd992dSmrg  test "x$enable_dependency_tracking" != xno \
307cacd992dSmrg  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
308cacd992dSmrg])
309cacd992dSmrg
310cacd992dSmrg
311cacd992dSmrg# AM_SET_DEPDIR
312cacd992dSmrg# -------------
313cacd992dSmrg# Choose a directory name for dependency files.
314cacd992dSmrg# This macro is AC_REQUIREd in _AM_DEPENDENCIES
315cacd992dSmrgAC_DEFUN([AM_SET_DEPDIR],
316cacd992dSmrg[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
317cacd992dSmrgAC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
318cacd992dSmrg])
319cacd992dSmrg
320cacd992dSmrg
321cacd992dSmrg# AM_DEP_TRACK
322cacd992dSmrg# ------------
323cacd992dSmrgAC_DEFUN([AM_DEP_TRACK],
324cacd992dSmrg[AC_ARG_ENABLE(dependency-tracking,
32514ddf674Smrg[  --disable-dependency-tracking  speeds up one-time build
32614ddf674Smrg  --enable-dependency-tracking   do not reject slow dependency extractors])
327cacd992dSmrgif test "x$enable_dependency_tracking" != xno; then
328cacd992dSmrg  am_depcomp="$ac_aux_dir/depcomp"
329cacd992dSmrg  AMDEPBACKSLASH='\'
3306758a055Smrg  am__nodep='_no'
331cacd992dSmrgfi
332cacd992dSmrgAM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
33314ddf674SmrgAC_SUBST([AMDEPBACKSLASH])dnl
33414ddf674Smrg_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
3356758a055SmrgAC_SUBST([am__nodep])dnl
3366758a055Smrg_AM_SUBST_NOTMAKE([am__nodep])dnl
337cacd992dSmrg])
338cacd992dSmrg
33914ddf674Smrg# Generate code to set up dependency tracking.              -*- Autoconf -*-
340cacd992dSmrg
34114ddf674Smrg# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
34214ddf674Smrg# Free Software Foundation, Inc.
34314ddf674Smrg#
34414ddf674Smrg# This file is free software; the Free Software Foundation
34514ddf674Smrg# gives unlimited permission to copy and/or distribute it,
34614ddf674Smrg# with or without modifications, as long as this notice is preserved.
347cacd992dSmrg
34814ddf674Smrg#serial 5
349cacd992dSmrg
350cacd992dSmrg# _AM_OUTPUT_DEPENDENCY_COMMANDS
351cacd992dSmrg# ------------------------------
352cacd992dSmrgAC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
35314ddf674Smrg[{
35414ddf674Smrg  # Autoconf 2.62 quotes --file arguments for eval, but not when files
35514ddf674Smrg  # are listed without --file.  Let's play safe and only enable the eval
35614ddf674Smrg  # if we detect the quoting.
35714ddf674Smrg  case $CONFIG_FILES in
35814ddf674Smrg  *\'*) eval set x "$CONFIG_FILES" ;;
35914ddf674Smrg  *)   set x $CONFIG_FILES ;;
36014ddf674Smrg  esac
36114ddf674Smrg  shift
36214ddf674Smrg  for mf
36314ddf674Smrg  do
36414ddf674Smrg    # Strip MF so we end up with the name of the file.
36514ddf674Smrg    mf=`echo "$mf" | sed -e 's/:.*$//'`
36614ddf674Smrg    # Check whether this is an Automake generated Makefile or not.
36714ddf674Smrg    # We used to match only the files named `Makefile.in', but
36814ddf674Smrg    # some people rename them; so instead we look at the file content.
36914ddf674Smrg    # Grep'ing the first line is not enough: some people post-process
37014ddf674Smrg    # each Makefile.in and add a new line on top of each file to say so.
37114ddf674Smrg    # Grep'ing the whole file is not good either: AIX grep has a line
37214ddf674Smrg    # limit of 2048, but all sed's we know have understand at least 4000.
37314ddf674Smrg    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
37414ddf674Smrg      dirpart=`AS_DIRNAME("$mf")`
37514ddf674Smrg    else
37614ddf674Smrg      continue
37714ddf674Smrg    fi
37814ddf674Smrg    # Extract the definition of DEPDIR, am__include, and am__quote
37914ddf674Smrg    # from the Makefile without running `make'.
38014ddf674Smrg    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
38114ddf674Smrg    test -z "$DEPDIR" && continue
38214ddf674Smrg    am__include=`sed -n 's/^am__include = //p' < "$mf"`
38314ddf674Smrg    test -z "am__include" && continue
38414ddf674Smrg    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
38514ddf674Smrg    # When using ansi2knr, U may be empty or an underscore; expand it
38614ddf674Smrg    U=`sed -n 's/^U = //p' < "$mf"`
38714ddf674Smrg    # Find all dependency output files, they are included files with
38814ddf674Smrg    # $(DEPDIR) in their names.  We invoke sed twice because it is the
38914ddf674Smrg    # simplest approach to changing $(DEPDIR) to its actual value in the
39014ddf674Smrg    # expansion.
39114ddf674Smrg    for file in `sed -n "
39214ddf674Smrg      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
39314ddf674Smrg	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
39414ddf674Smrg      # Make sure the directory exists.
39514ddf674Smrg      test -f "$dirpart/$file" && continue
39614ddf674Smrg      fdir=`AS_DIRNAME(["$file"])`
39714ddf674Smrg      AS_MKDIR_P([$dirpart/$fdir])
39814ddf674Smrg      # echo "creating $dirpart/$file"
39914ddf674Smrg      echo '# dummy' > "$dirpart/$file"
40014ddf674Smrg    done
401cacd992dSmrg  done
40214ddf674Smrg}
403cacd992dSmrg])# _AM_OUTPUT_DEPENDENCY_COMMANDS
404cacd992dSmrg
405cacd992dSmrg
406cacd992dSmrg# AM_OUTPUT_DEPENDENCY_COMMANDS
407cacd992dSmrg# -----------------------------
408cacd992dSmrg# This macro should only be invoked once -- use via AC_REQUIRE.
409cacd992dSmrg#
410cacd992dSmrg# This code is only required when automatic dependency tracking
411cacd992dSmrg# is enabled.  FIXME.  This creates each `.P' file that we will
412cacd992dSmrg# need in order to bootstrap the dependency handling code.
413cacd992dSmrgAC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
414cacd992dSmrg[AC_CONFIG_COMMANDS([depfiles],
415cacd992dSmrg     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
416cacd992dSmrg     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
417cacd992dSmrg])
418cacd992dSmrg
41914ddf674Smrg# Do all the work for Automake.                             -*- Autoconf -*-
420cacd992dSmrg
42114ddf674Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
42214ddf674Smrg# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
42314ddf674Smrg#
42414ddf674Smrg# This file is free software; the Free Software Foundation
42514ddf674Smrg# gives unlimited permission to copy and/or distribute it,
42614ddf674Smrg# with or without modifications, as long as this notice is preserved.
427cacd992dSmrg
42814ddf674Smrg# serial 16
429cacd992dSmrg
43014ddf674Smrg# This macro actually does too much.  Some checks are only needed if
43114ddf674Smrg# your package does certain things.  But this isn't really a big deal.
43214ddf674Smrg
43314ddf674Smrg# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
43414ddf674Smrg# AM_INIT_AUTOMAKE([OPTIONS])
43514ddf674Smrg# -----------------------------------------------
43614ddf674Smrg# The call with PACKAGE and VERSION arguments is the old style
43714ddf674Smrg# call (pre autoconf-2.50), which is being phased out.  PACKAGE
43814ddf674Smrg# and VERSION should now be passed to AC_INIT and removed from
43914ddf674Smrg# the call to AM_INIT_AUTOMAKE.
44014ddf674Smrg# We support both call styles for the transition.  After
44114ddf674Smrg# the next Automake release, Autoconf can make the AC_INIT
44214ddf674Smrg# arguments mandatory, and then we can depend on a new Autoconf
44314ddf674Smrg# release and drop the old call support.
44414ddf674SmrgAC_DEFUN([AM_INIT_AUTOMAKE],
44514ddf674Smrg[AC_PREREQ([2.62])dnl
44614ddf674Smrgdnl Autoconf wants to disallow AM_ names.  We explicitly allow
44714ddf674Smrgdnl the ones we care about.
44814ddf674Smrgm4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
44914ddf674SmrgAC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
45014ddf674SmrgAC_REQUIRE([AC_PROG_INSTALL])dnl
45114ddf674Smrgif test "`cd $srcdir && pwd`" != "`pwd`"; then
45214ddf674Smrg  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
45314ddf674Smrg  # is not polluted with repeated "-I."
45414ddf674Smrg  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
45514ddf674Smrg  # test to see if srcdir already configured
45614ddf674Smrg  if test -f $srcdir/config.status; then
45714ddf674Smrg    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
45814ddf674Smrg  fi
459cacd992dSmrgfi
46014ddf674Smrg
46114ddf674Smrg# test whether we have cygpath
46214ddf674Smrgif test -z "$CYGPATH_W"; then
46314ddf674Smrg  if (cygpath --version) >/dev/null 2>/dev/null; then
46414ddf674Smrg    CYGPATH_W='cygpath -w'
46514ddf674Smrg  else
46614ddf674Smrg    CYGPATH_W=echo
46714ddf674Smrg  fi
468cacd992dSmrgfi
46914ddf674SmrgAC_SUBST([CYGPATH_W])
470cacd992dSmrg
47114ddf674Smrg# Define the identity of the package.
47214ddf674Smrgdnl Distinguish between old-style and new-style calls.
47314ddf674Smrgm4_ifval([$2],
47414ddf674Smrg[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
47514ddf674Smrg AC_SUBST([PACKAGE], [$1])dnl
47614ddf674Smrg AC_SUBST([VERSION], [$2])],
47714ddf674Smrg[_AM_SET_OPTIONS([$1])dnl
47814ddf674Smrgdnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
47914ddf674Smrgm4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
48014ddf674Smrg  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
48114ddf674Smrg AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
48214ddf674Smrg AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
483cacd992dSmrg
48414ddf674Smrg_AM_IF_OPTION([no-define],,
48514ddf674Smrg[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
48614ddf674Smrg AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
487cacd992dSmrg
48814ddf674Smrg# Some tools Automake needs.
48914ddf674SmrgAC_REQUIRE([AM_SANITY_CHECK])dnl
49014ddf674SmrgAC_REQUIRE([AC_ARG_PROGRAM])dnl
49114ddf674SmrgAM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
49214ddf674SmrgAM_MISSING_PROG(AUTOCONF, autoconf)
49314ddf674SmrgAM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
49414ddf674SmrgAM_MISSING_PROG(AUTOHEADER, autoheader)
49514ddf674SmrgAM_MISSING_PROG(MAKEINFO, makeinfo)
49614ddf674SmrgAC_REQUIRE([AM_PROG_INSTALL_SH])dnl
49714ddf674SmrgAC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
49814ddf674SmrgAC_REQUIRE([AM_PROG_MKDIR_P])dnl
49914ddf674Smrg# We need awk for the "check" target.  The system "awk" is bad on
50014ddf674Smrg# some platforms.
50114ddf674SmrgAC_REQUIRE([AC_PROG_AWK])dnl
50214ddf674SmrgAC_REQUIRE([AC_PROG_MAKE_SET])dnl
50314ddf674SmrgAC_REQUIRE([AM_SET_LEADING_DOT])dnl
50414ddf674Smrg_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
50514ddf674Smrg	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
50614ddf674Smrg			     [_AM_PROG_TAR([v7])])])
50714ddf674Smrg_AM_IF_OPTION([no-dependencies],,
50814ddf674Smrg[AC_PROVIDE_IFELSE([AC_PROG_CC],
50914ddf674Smrg		  [_AM_DEPENDENCIES(CC)],
51014ddf674Smrg		  [define([AC_PROG_CC],
51114ddf674Smrg			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
51214ddf674SmrgAC_PROVIDE_IFELSE([AC_PROG_CXX],
51314ddf674Smrg		  [_AM_DEPENDENCIES(CXX)],
51414ddf674Smrg		  [define([AC_PROG_CXX],
51514ddf674Smrg			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
51614ddf674SmrgAC_PROVIDE_IFELSE([AC_PROG_OBJC],
51714ddf674Smrg		  [_AM_DEPENDENCIES(OBJC)],
51814ddf674Smrg		  [define([AC_PROG_OBJC],
51914ddf674Smrg			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
52014ddf674Smrg])
52114ddf674Smrg_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
52214ddf674Smrgdnl The `parallel-tests' driver may need to know about EXEEXT, so add the
52314ddf674Smrgdnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
52414ddf674Smrgdnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
52514ddf674SmrgAC_CONFIG_COMMANDS_PRE(dnl
52614ddf674Smrg[m4_provide_if([_AM_COMPILER_EXEEXT],
52714ddf674Smrg  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
52814ddf674Smrg])
529cacd992dSmrg
53014ddf674Smrgdnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
53114ddf674Smrgdnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
53214ddf674Smrgdnl mangled by Autoconf and run in a shell conditional statement.
53314ddf674Smrgm4_define([_AC_COMPILER_EXEEXT],
53414ddf674Smrgm4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
535cacd992dSmrg
536cacd992dSmrg
53714ddf674Smrg# When config.status generates a header, we must update the stamp-h file.
53814ddf674Smrg# This file resides in the same directory as the config header
53914ddf674Smrg# that is generated.  The stamp files are numbered to have different names.
54014ddf674Smrg
54114ddf674Smrg# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
54214ddf674Smrg# loop where config.status creates the headers, so we can generate
54314ddf674Smrg# our stamp files there.
54414ddf674SmrgAC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
54514ddf674Smrg[# Compute $1's index in $config_headers.
54614ddf674Smrg_am_arg=$1
54714ddf674Smrg_am_stamp_count=1
54814ddf674Smrgfor _am_header in $config_headers :; do
54914ddf674Smrg  case $_am_header in
55014ddf674Smrg    $_am_arg | $_am_arg:* )
55114ddf674Smrg      break ;;
55214ddf674Smrg    * )
55314ddf674Smrg      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
55414ddf674Smrg  esac
55514ddf674Smrgdone
55614ddf674Smrgecho "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
557cacd992dSmrg
5586758a055Smrg# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
5596758a055Smrg# Inc.
56014ddf674Smrg#
56114ddf674Smrg# This file is free software; the Free Software Foundation
56214ddf674Smrg# gives unlimited permission to copy and/or distribute it,
56314ddf674Smrg# with or without modifications, as long as this notice is preserved.
564cacd992dSmrg
5656758a055Smrg# serial 1
5666758a055Smrg
56714ddf674Smrg# AM_PROG_INSTALL_SH
56814ddf674Smrg# ------------------
56914ddf674Smrg# Define $install_sh.
57014ddf674SmrgAC_DEFUN([AM_PROG_INSTALL_SH],
57114ddf674Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
57214ddf674Smrgif test x"${install_sh}" != xset; then
57314ddf674Smrg  case $am_aux_dir in
57414ddf674Smrg  *\ * | *\	*)
57514ddf674Smrg    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
57614ddf674Smrg  *)
57714ddf674Smrg    install_sh="\${SHELL} $am_aux_dir/install-sh"
57814ddf674Smrg  esac
579cacd992dSmrgfi
58014ddf674SmrgAC_SUBST(install_sh)])
581cacd992dSmrg
58214ddf674Smrg# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
58314ddf674Smrg#
58414ddf674Smrg# This file is free software; the Free Software Foundation
58514ddf674Smrg# gives unlimited permission to copy and/or distribute it,
58614ddf674Smrg# with or without modifications, as long as this notice is preserved.
587cacd992dSmrg
58814ddf674Smrg# serial 2
589cacd992dSmrg
59014ddf674Smrg# Check whether the underlying file-system supports filenames
59114ddf674Smrg# with a leading dot.  For instance MS-DOS doesn't.
59214ddf674SmrgAC_DEFUN([AM_SET_LEADING_DOT],
59314ddf674Smrg[rm -rf .tst 2>/dev/null
59414ddf674Smrgmkdir .tst 2>/dev/null
59514ddf674Smrgif test -d .tst; then
59614ddf674Smrg  am__leading_dot=.
59714ddf674Smrgelse
59814ddf674Smrg  am__leading_dot=_
59914ddf674Smrgfi
60014ddf674Smrgrmdir .tst 2>/dev/null
60114ddf674SmrgAC_SUBST([am__leading_dot])])
602cacd992dSmrg
60314ddf674Smrg# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
60414ddf674Smrg# From Jim Meyering
605cacd992dSmrg
6066758a055Smrg# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
6076758a055Smrg# 2011 Free Software Foundation, Inc.
60814ddf674Smrg#
60914ddf674Smrg# This file is free software; the Free Software Foundation
61014ddf674Smrg# gives unlimited permission to copy and/or distribute it,
61114ddf674Smrg# with or without modifications, as long as this notice is preserved.
612cacd992dSmrg
61314ddf674Smrg# serial 5
614cacd992dSmrg
61514ddf674Smrg# AM_MAINTAINER_MODE([DEFAULT-MODE])
61614ddf674Smrg# ----------------------------------
61714ddf674Smrg# Control maintainer-specific portions of Makefiles.
61814ddf674Smrg# Default is to disable them, unless `enable' is passed literally.
61914ddf674Smrg# For symmetry, `disable' may be passed as well.  Anyway, the user
62014ddf674Smrg# can override the default with the --enable/--disable switch.
621cacd992dSmrgAC_DEFUN([AM_MAINTAINER_MODE],
62214ddf674Smrg[m4_case(m4_default([$1], [disable]),
62314ddf674Smrg       [enable], [m4_define([am_maintainer_other], [disable])],
62414ddf674Smrg       [disable], [m4_define([am_maintainer_other], [enable])],
62514ddf674Smrg       [m4_define([am_maintainer_other], [enable])
62614ddf674Smrg        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
6276758a055SmrgAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
62814ddf674Smrg  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
62914ddf674Smrg  AC_ARG_ENABLE([maintainer-mode],
63014ddf674Smrg[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
63114ddf674Smrg			  (and sometimes confusing) to the casual installer],
63214ddf674Smrg      [USE_MAINTAINER_MODE=$enableval],
63314ddf674Smrg      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
634cacd992dSmrg  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
63514ddf674Smrg  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
636cacd992dSmrg  MAINT=$MAINTAINER_MODE_TRUE
63714ddf674Smrg  AC_SUBST([MAINT])dnl
638cacd992dSmrg]
639cacd992dSmrg)
640cacd992dSmrg
641cacd992dSmrgAU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
642cacd992dSmrg
64314ddf674Smrg# Check to see how 'make' treats includes.	            -*- Autoconf -*-
644cacd992dSmrg
64514ddf674Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
64614ddf674Smrg#
64714ddf674Smrg# This file is free software; the Free Software Foundation
64814ddf674Smrg# gives unlimited permission to copy and/or distribute it,
64914ddf674Smrg# with or without modifications, as long as this notice is preserved.
650cacd992dSmrg
65114ddf674Smrg# serial 4
652cacd992dSmrg
65314ddf674Smrg# AM_MAKE_INCLUDE()
65414ddf674Smrg# -----------------
65514ddf674Smrg# Check to see how make treats includes.
65614ddf674SmrgAC_DEFUN([AM_MAKE_INCLUDE],
65714ddf674Smrg[am_make=${MAKE-make}
65814ddf674Smrgcat > confinc << 'END'
65914ddf674Smrgam__doit:
66014ddf674Smrg	@echo this is the am__doit target
66114ddf674Smrg.PHONY: am__doit
66214ddf674SmrgEND
66314ddf674Smrg# If we don't find an include directive, just comment out the code.
66414ddf674SmrgAC_MSG_CHECKING([for style of include used by $am_make])
66514ddf674Smrgam__include="#"
66614ddf674Smrgam__quote=
66714ddf674Smrg_am_result=none
66814ddf674Smrg# First try GNU make style include.
66914ddf674Smrgecho "include confinc" > confmf
67014ddf674Smrg# Ignore all kinds of additional output from `make'.
67114ddf674Smrgcase `$am_make -s -f confmf 2> /dev/null` in #(
67214ddf674Smrg*the\ am__doit\ target*)
67314ddf674Smrg  am__include=include
67414ddf674Smrg  am__quote=
67514ddf674Smrg  _am_result=GNU
67614ddf674Smrg  ;;
67714ddf674Smrgesac
67814ddf674Smrg# Now try BSD make style include.
67914ddf674Smrgif test "$am__include" = "#"; then
68014ddf674Smrg   echo '.include "confinc"' > confmf
68114ddf674Smrg   case `$am_make -s -f confmf 2> /dev/null` in #(
68214ddf674Smrg   *the\ am__doit\ target*)
68314ddf674Smrg     am__include=.include
68414ddf674Smrg     am__quote="\""
68514ddf674Smrg     _am_result=BSD
68614ddf674Smrg     ;;
68714ddf674Smrg   esac
68814ddf674Smrgfi
68914ddf674SmrgAC_SUBST([am__include])
69014ddf674SmrgAC_SUBST([am__quote])
69114ddf674SmrgAC_MSG_RESULT([$_am_result])
69214ddf674Smrgrm -f confinc confmf
69314ddf674Smrg])
694cacd992dSmrg
69514ddf674Smrg# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
696cacd992dSmrg
69714ddf674Smrg# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
69814ddf674Smrg# Free Software Foundation, Inc.
69914ddf674Smrg#
70014ddf674Smrg# This file is free software; the Free Software Foundation
70114ddf674Smrg# gives unlimited permission to copy and/or distribute it,
70214ddf674Smrg# with or without modifications, as long as this notice is preserved.
703cacd992dSmrg
704cacd992dSmrg# serial 6
705cacd992dSmrg
70614ddf674Smrg# AM_MISSING_PROG(NAME, PROGRAM)
70714ddf674Smrg# ------------------------------
70814ddf674SmrgAC_DEFUN([AM_MISSING_PROG],
70914ddf674Smrg[AC_REQUIRE([AM_MISSING_HAS_RUN])
71014ddf674Smrg$1=${$1-"${am_missing_run}$2"}
71114ddf674SmrgAC_SUBST($1)])
712cacd992dSmrg
713cacd992dSmrg
71414ddf674Smrg# AM_MISSING_HAS_RUN
71514ddf674Smrg# ------------------
71614ddf674Smrg# Define MISSING if not defined so far and test if it supports --run.
71714ddf674Smrg# If it does, set am_missing_run to use it, otherwise, to nothing.
71814ddf674SmrgAC_DEFUN([AM_MISSING_HAS_RUN],
71914ddf674Smrg[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
72014ddf674SmrgAC_REQUIRE_AUX_FILE([missing])dnl
72114ddf674Smrgif test x"${MISSING+set}" != xset; then
72214ddf674Smrg  case $am_aux_dir in
72314ddf674Smrg  *\ * | *\	*)
72414ddf674Smrg    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
72514ddf674Smrg  *)
72614ddf674Smrg    MISSING="\${SHELL} $am_aux_dir/missing" ;;
72714ddf674Smrg  esac
72814ddf674Smrgfi
72914ddf674Smrg# Use eval to expand $SHELL
73014ddf674Smrgif eval "$MISSING --run true"; then
73114ddf674Smrg  am_missing_run="$MISSING --run "
73214ddf674Smrgelse
73314ddf674Smrg  am_missing_run=
73414ddf674Smrg  AC_MSG_WARN([`missing' script is too old or missing])
73514ddf674Smrgfi
73614ddf674Smrg])
737cacd992dSmrg
7386758a055Smrg# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
7396758a055Smrg# Inc.
74014ddf674Smrg#
74114ddf674Smrg# This file is free software; the Free Software Foundation
74214ddf674Smrg# gives unlimited permission to copy and/or distribute it,
74314ddf674Smrg# with or without modifications, as long as this notice is preserved.
744cacd992dSmrg
7456758a055Smrg# serial 1
7466758a055Smrg
74714ddf674Smrg# AM_PROG_MKDIR_P
74814ddf674Smrg# ---------------
74914ddf674Smrg# Check for `mkdir -p'.
75014ddf674SmrgAC_DEFUN([AM_PROG_MKDIR_P],
75114ddf674Smrg[AC_PREREQ([2.60])dnl
75214ddf674SmrgAC_REQUIRE([AC_PROG_MKDIR_P])dnl
75314ddf674Smrgdnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
75414ddf674Smrgdnl while keeping a definition of mkdir_p for backward compatibility.
75514ddf674Smrgdnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
75614ddf674Smrgdnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
75714ddf674Smrgdnl Makefile.ins that do not define MKDIR_P, so we do our own
75814ddf674Smrgdnl adjustment using top_builddir (which is defined more often than
75914ddf674Smrgdnl MKDIR_P).
76014ddf674SmrgAC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
76114ddf674Smrgcase $mkdir_p in
76214ddf674Smrg  [[\\/$]]* | ?:[[\\/]]*) ;;
76314ddf674Smrg  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
76414ddf674Smrgesac
765cacd992dSmrg])
766cacd992dSmrg
76714ddf674Smrg# Helper functions for option handling.                     -*- Autoconf -*-
76814ddf674Smrg
7696758a055Smrg# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
7706758a055Smrg# Foundation, Inc.
771cacd992dSmrg#
77214ddf674Smrg# This file is free software; the Free Software Foundation
77314ddf674Smrg# gives unlimited permission to copy and/or distribute it,
77414ddf674Smrg# with or without modifications, as long as this notice is preserved.
775cacd992dSmrg
7766758a055Smrg# serial 5
77714ddf674Smrg
77814ddf674Smrg# _AM_MANGLE_OPTION(NAME)
77914ddf674Smrg# -----------------------
78014ddf674SmrgAC_DEFUN([_AM_MANGLE_OPTION],
78114ddf674Smrg[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
78214ddf674Smrg
78314ddf674Smrg# _AM_SET_OPTION(NAME)
7846758a055Smrg# --------------------
78514ddf674Smrg# Set option NAME.  Presently that only means defining a flag for this option.
78614ddf674SmrgAC_DEFUN([_AM_SET_OPTION],
78714ddf674Smrg[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
78814ddf674Smrg
78914ddf674Smrg# _AM_SET_OPTIONS(OPTIONS)
7906758a055Smrg# ------------------------
79114ddf674Smrg# OPTIONS is a space-separated list of Automake options.
79214ddf674SmrgAC_DEFUN([_AM_SET_OPTIONS],
79314ddf674Smrg[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
794cacd992dSmrg
79514ddf674Smrg# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
79614ddf674Smrg# -------------------------------------------
79714ddf674Smrg# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
79814ddf674SmrgAC_DEFUN([_AM_IF_OPTION],
79914ddf674Smrg[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
80014ddf674Smrg
80114ddf674Smrg# Check to make sure that the build environment is sane.    -*- Autoconf -*-
80214ddf674Smrg
80314ddf674Smrg# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
80414ddf674Smrg# Free Software Foundation, Inc.
805cacd992dSmrg#
80614ddf674Smrg# This file is free software; the Free Software Foundation
80714ddf674Smrg# gives unlimited permission to copy and/or distribute it,
80814ddf674Smrg# with or without modifications, as long as this notice is preserved.
809cacd992dSmrg
81014ddf674Smrg# serial 5
811cacd992dSmrg
81214ddf674Smrg# AM_SANITY_CHECK
81314ddf674Smrg# ---------------
81414ddf674SmrgAC_DEFUN([AM_SANITY_CHECK],
81514ddf674Smrg[AC_MSG_CHECKING([whether build environment is sane])
81614ddf674Smrg# Just in case
81714ddf674Smrgsleep 1
81814ddf674Smrgecho timestamp > conftest.file
81914ddf674Smrg# Reject unsafe characters in $srcdir or the absolute working directory
82014ddf674Smrg# name.  Accept space and tab only in the latter.
82114ddf674Smrgam_lf='
82214ddf674Smrg'
82314ddf674Smrgcase `pwd` in
82414ddf674Smrg  *[[\\\"\#\$\&\'\`$am_lf]]*)
82514ddf674Smrg    AC_MSG_ERROR([unsafe absolute working directory name]);;
82614ddf674Smrgesac
82714ddf674Smrgcase $srcdir in
82814ddf674Smrg  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
82914ddf674Smrg    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
83014ddf674Smrgesac
831cacd992dSmrg
83214ddf674Smrg# Do `set' in a subshell so we don't clobber the current shell's
83314ddf674Smrg# arguments.  Must try -L first in case configure is actually a
83414ddf674Smrg# symlink; some systems play weird games with the mod time of symlinks
83514ddf674Smrg# (eg FreeBSD returns the mod time of the symlink's containing
83614ddf674Smrg# directory).
83714ddf674Smrgif (
83814ddf674Smrg   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
83914ddf674Smrg   if test "$[*]" = "X"; then
84014ddf674Smrg      # -L didn't work.
84114ddf674Smrg      set X `ls -t "$srcdir/configure" conftest.file`
84214ddf674Smrg   fi
84314ddf674Smrg   rm -f conftest.file
84414ddf674Smrg   if test "$[*]" != "X $srcdir/configure conftest.file" \
84514ddf674Smrg      && test "$[*]" != "X conftest.file $srcdir/configure"; then
846cacd992dSmrg
84714ddf674Smrg      # If neither matched, then we have a broken ls.  This can happen
84814ddf674Smrg      # if, for instance, CONFIG_SHELL is bash and it inherits a
84914ddf674Smrg      # broken ls alias from the environment.  This has actually
85014ddf674Smrg      # happened.  Such a system could not be considered "sane".
85114ddf674Smrg      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
85214ddf674Smrgalias in your environment])
85314ddf674Smrg   fi
854cacd992dSmrg
85514ddf674Smrg   test "$[2]" = conftest.file
85614ddf674Smrg   )
85714ddf674Smrgthen
85814ddf674Smrg   # Ok.
85914ddf674Smrg   :
86014ddf674Smrgelse
86114ddf674Smrg   AC_MSG_ERROR([newly created file is older than distributed files!
86214ddf674SmrgCheck your system clock])
86314ddf674Smrgfi
86414ddf674SmrgAC_MSG_RESULT(yes)])
865cacd992dSmrg
86614ddf674Smrg# Copyright (C) 2009  Free Software Foundation, Inc.
86714ddf674Smrg#
86814ddf674Smrg# This file is free software; the Free Software Foundation
86914ddf674Smrg# gives unlimited permission to copy and/or distribute it,
87014ddf674Smrg# with or without modifications, as long as this notice is preserved.
871cacd992dSmrg
87214ddf674Smrg# serial 1
873cacd992dSmrg
87414ddf674Smrg# AM_SILENT_RULES([DEFAULT])
87514ddf674Smrg# --------------------------
87614ddf674Smrg# Enable less verbose build rules; with the default set to DEFAULT
87714ddf674Smrg# (`yes' being less verbose, `no' or empty being verbose).
87814ddf674SmrgAC_DEFUN([AM_SILENT_RULES],
87914ddf674Smrg[AC_ARG_ENABLE([silent-rules],
88014ddf674Smrg[  --enable-silent-rules          less verbose build output (undo: `make V=1')
88114ddf674Smrg  --disable-silent-rules         verbose build output (undo: `make V=0')])
88214ddf674Smrgcase $enable_silent_rules in
88314ddf674Smrgyes) AM_DEFAULT_VERBOSITY=0;;
88414ddf674Smrgno)  AM_DEFAULT_VERBOSITY=1;;
88514ddf674Smrg*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
88614ddf674Smrgesac
88714ddf674SmrgAC_SUBST([AM_DEFAULT_VERBOSITY])dnl
88814ddf674SmrgAM_BACKSLASH='\'
88914ddf674SmrgAC_SUBST([AM_BACKSLASH])dnl
89014ddf674Smrg_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
89114ddf674Smrg])
892cacd992dSmrg
8936758a055Smrg# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
89414ddf674Smrg#
89514ddf674Smrg# This file is free software; the Free Software Foundation
89614ddf674Smrg# gives unlimited permission to copy and/or distribute it,
89714ddf674Smrg# with or without modifications, as long as this notice is preserved.
898cacd992dSmrg
8996758a055Smrg# serial 1
9006758a055Smrg
90114ddf674Smrg# AM_PROG_INSTALL_STRIP
90214ddf674Smrg# ---------------------
90314ddf674Smrg# One issue with vendor `install' (even GNU) is that you can't
90414ddf674Smrg# specify the program used to strip binaries.  This is especially
90514ddf674Smrg# annoying in cross-compiling environments, where the build's strip
90614ddf674Smrg# is unlikely to handle the host's binaries.
90714ddf674Smrg# Fortunately install-sh will honor a STRIPPROG variable, so we
90814ddf674Smrg# always use install-sh in `make install-strip', and initialize
90914ddf674Smrg# STRIPPROG with the value of the STRIP variable (set by the user).
91014ddf674SmrgAC_DEFUN([AM_PROG_INSTALL_STRIP],
91114ddf674Smrg[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
91214ddf674Smrg# Installed binaries are usually stripped using `strip' when the user
91314ddf674Smrg# run `make install-strip'.  However `strip' might not be the right
91414ddf674Smrg# tool to use in cross-compilation environments, therefore Automake
91514ddf674Smrg# will honor the `STRIP' environment variable to overrule this program.
91614ddf674Smrgdnl Don't test for $cross_compiling = yes, because it might be `maybe'.
91714ddf674Smrgif test "$cross_compiling" != no; then
91814ddf674Smrg  AC_CHECK_TOOL([STRIP], [strip], :)
91914ddf674Smrgfi
92014ddf674SmrgINSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
92114ddf674SmrgAC_SUBST([INSTALL_STRIP_PROGRAM])])
922cacd992dSmrg
9236758a055Smrg# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
92414ddf674Smrg#
92514ddf674Smrg# This file is free software; the Free Software Foundation
92614ddf674Smrg# gives unlimited permission to copy and/or distribute it,
92714ddf674Smrg# with or without modifications, as long as this notice is preserved.
928cacd992dSmrg
9296758a055Smrg# serial 3
930cacd992dSmrg
93114ddf674Smrg# _AM_SUBST_NOTMAKE(VARIABLE)
93214ddf674Smrg# ---------------------------
93314ddf674Smrg# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
93414ddf674Smrg# This macro is traced by Automake.
93514ddf674SmrgAC_DEFUN([_AM_SUBST_NOTMAKE])
936cacd992dSmrg
93714ddf674Smrg# AM_SUBST_NOTMAKE(VARIABLE)
9386758a055Smrg# --------------------------
93914ddf674Smrg# Public sister of _AM_SUBST_NOTMAKE.
94014ddf674SmrgAC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
941cacd992dSmrg
94214ddf674Smrg# Check how to create a tarball.                            -*- Autoconf -*-
943cacd992dSmrg
94414ddf674Smrg# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
94514ddf674Smrg#
94614ddf674Smrg# This file is free software; the Free Software Foundation
94714ddf674Smrg# gives unlimited permission to copy and/or distribute it,
94814ddf674Smrg# with or without modifications, as long as this notice is preserved.
94914ddf674Smrg
95014ddf674Smrg# serial 2
95114ddf674Smrg
95214ddf674Smrg# _AM_PROG_TAR(FORMAT)
95314ddf674Smrg# --------------------
95414ddf674Smrg# Check how to create a tarball in format FORMAT.
95514ddf674Smrg# FORMAT should be one of `v7', `ustar', or `pax'.
95614ddf674Smrg#
95714ddf674Smrg# Substitute a variable $(am__tar) that is a command
95814ddf674Smrg# writing to stdout a FORMAT-tarball containing the directory
95914ddf674Smrg# $tardir.
96014ddf674Smrg#     tardir=directory && $(am__tar) > result.tar
96114ddf674Smrg#
96214ddf674Smrg# Substitute a variable $(am__untar) that extract such
96314ddf674Smrg# a tarball read from stdin.
96414ddf674Smrg#     $(am__untar) < result.tar
96514ddf674SmrgAC_DEFUN([_AM_PROG_TAR],
96614ddf674Smrg[# Always define AMTAR for backward compatibility.
96714ddf674SmrgAM_MISSING_PROG([AMTAR], [tar])
96814ddf674Smrgm4_if([$1], [v7],
96914ddf674Smrg     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
97014ddf674Smrg     [m4_case([$1], [ustar],, [pax],,
97114ddf674Smrg              [m4_fatal([Unknown tar format])])
97214ddf674SmrgAC_MSG_CHECKING([how to create a $1 tar archive])
97314ddf674Smrg# Loop over all known methods to create a tar archive until one works.
97414ddf674Smrg_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
97514ddf674Smrg_am_tools=${am_cv_prog_tar_$1-$_am_tools}
97614ddf674Smrg# Do not fold the above two line into one, because Tru64 sh and
97714ddf674Smrg# Solaris sh will not grok spaces in the rhs of `-'.
97814ddf674Smrgfor _am_tool in $_am_tools
97914ddf674Smrgdo
98014ddf674Smrg  case $_am_tool in
98114ddf674Smrg  gnutar)
98214ddf674Smrg    for _am_tar in tar gnutar gtar;
98314ddf674Smrg    do
98414ddf674Smrg      AM_RUN_LOG([$_am_tar --version]) && break
98514ddf674Smrg    done
98614ddf674Smrg    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
98714ddf674Smrg    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
98814ddf674Smrg    am__untar="$_am_tar -xf -"
98914ddf674Smrg    ;;
99014ddf674Smrg  plaintar)
99114ddf674Smrg    # Must skip GNU tar: if it does not support --format= it doesn't create
99214ddf674Smrg    # ustar tarball either.
99314ddf674Smrg    (tar --version) >/dev/null 2>&1 && continue
99414ddf674Smrg    am__tar='tar chf - "$$tardir"'
99514ddf674Smrg    am__tar_='tar chf - "$tardir"'
99614ddf674Smrg    am__untar='tar xf -'
99714ddf674Smrg    ;;
99814ddf674Smrg  pax)
99914ddf674Smrg    am__tar='pax -L -x $1 -w "$$tardir"'
100014ddf674Smrg    am__tar_='pax -L -x $1 -w "$tardir"'
100114ddf674Smrg    am__untar='pax -r'
100214ddf674Smrg    ;;
100314ddf674Smrg  cpio)
100414ddf674Smrg    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
100514ddf674Smrg    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
100614ddf674Smrg    am__untar='cpio -i -H $1 -d'
100714ddf674Smrg    ;;
100814ddf674Smrg  none)
100914ddf674Smrg    am__tar=false
101014ddf674Smrg    am__tar_=false
101114ddf674Smrg    am__untar=false
101214ddf674Smrg    ;;
101314ddf674Smrg  esac
101414ddf674Smrg
101514ddf674Smrg  # If the value was cached, stop now.  We just wanted to have am__tar
101614ddf674Smrg  # and am__untar set.
101714ddf674Smrg  test -n "${am_cv_prog_tar_$1}" && break
101814ddf674Smrg
101914ddf674Smrg  # tar/untar a dummy directory, and stop if the command works
102014ddf674Smrg  rm -rf conftest.dir
102114ddf674Smrg  mkdir conftest.dir
102214ddf674Smrg  echo GrepMe > conftest.dir/file
102314ddf674Smrg  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
102414ddf674Smrg  rm -rf conftest.dir
102514ddf674Smrg  if test -s conftest.tar; then
102614ddf674Smrg    AM_RUN_LOG([$am__untar <conftest.tar])
102714ddf674Smrg    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
102814ddf674Smrg  fi
102914ddf674Smrgdone
103014ddf674Smrgrm -rf conftest.dir
103114ddf674Smrg
103214ddf674SmrgAC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
103314ddf674SmrgAC_MSG_RESULT([$am_cv_prog_tar_$1])])
103414ddf674SmrgAC_SUBST([am__tar])
103514ddf674SmrgAC_SUBST([am__untar])
103614ddf674Smrg]) # _AM_PROG_TAR
103714ddf674Smrg
10386758a055Smrg# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
10396758a055Smrg# 
10406758a055Smrg# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
10416758a055Smrg#
10426758a055Smrg# This program is free software; you can redistribute it and/or modify
10436758a055Smrg# it under the terms of the GNU General Public License as published by
10446758a055Smrg# the Free Software Foundation; either version 2 of the License, or
10456758a055Smrg# (at your option) any later version.
10466758a055Smrg#
10476758a055Smrg# This program is distributed in the hope that it will be useful, but
10486758a055Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
10496758a055Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10506758a055Smrg# General Public License for more details.
10516758a055Smrg#
10526758a055Smrg# You should have received a copy of the GNU General Public License
10536758a055Smrg# along with this program; if not, write to the Free Software
10546758a055Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
10556758a055Smrg#
10566758a055Smrg# As a special exception to the GNU General Public License, if you
10576758a055Smrg# distribute this file as part of a program that contains a
10586758a055Smrg# configuration script generated by Autoconf, you may include it under
10596758a055Smrg# the same distribution terms that you use for the rest of that program.
10606758a055Smrg
10616758a055Smrg# PKG_PROG_PKG_CONFIG([MIN-VERSION])
10626758a055Smrg# ----------------------------------
10636758a055SmrgAC_DEFUN([PKG_PROG_PKG_CONFIG],
10646758a055Smrg[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
10656758a055Smrgm4_pattern_allow([^PKG_CONFIG(_PATH)?$])
10666758a055SmrgAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
10676758a055Smrgif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
10686758a055Smrg	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
10696758a055Smrgfi
10706758a055Smrgif test -n "$PKG_CONFIG"; then
10716758a055Smrg	_pkg_min_version=m4_default([$1], [0.9.0])
10726758a055Smrg	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
10736758a055Smrg	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
10746758a055Smrg		AC_MSG_RESULT([yes])
10756758a055Smrg	else
10766758a055Smrg		AC_MSG_RESULT([no])
10776758a055Smrg		PKG_CONFIG=""
10786758a055Smrg	fi
10796758a055Smrg		
10806758a055Smrgfi[]dnl
10816758a055Smrg])# PKG_PROG_PKG_CONFIG
10826758a055Smrg
10836758a055Smrg# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
10846758a055Smrg#
10856758a055Smrg# Check to see whether a particular set of modules exists.  Similar
10866758a055Smrg# to PKG_CHECK_MODULES(), but does not set variables or print errors.
10876758a055Smrg#
10886758a055Smrg#
10896758a055Smrg# Similar to PKG_CHECK_MODULES, make sure that the first instance of
10906758a055Smrg# this or PKG_CHECK_MODULES is called, or make sure to call
10916758a055Smrg# PKG_CHECK_EXISTS manually
10926758a055Smrg# --------------------------------------------------------------
10936758a055SmrgAC_DEFUN([PKG_CHECK_EXISTS],
10946758a055Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
10956758a055Smrgif test -n "$PKG_CONFIG" && \
10966758a055Smrg    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
10976758a055Smrg  m4_ifval([$2], [$2], [:])
10986758a055Smrgm4_ifvaln([$3], [else
10996758a055Smrg  $3])dnl
11006758a055Smrgfi])
11016758a055Smrg
11026758a055Smrg
11036758a055Smrg# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
11046758a055Smrg# ---------------------------------------------
11056758a055Smrgm4_define([_PKG_CONFIG],
11066758a055Smrg[if test -n "$$1"; then
11076758a055Smrg    pkg_cv_[]$1="$$1"
11086758a055Smrg elif test -n "$PKG_CONFIG"; then
11096758a055Smrg    PKG_CHECK_EXISTS([$3],
11106758a055Smrg                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
11116758a055Smrg		     [pkg_failed=yes])
11126758a055Smrg else
11136758a055Smrg    pkg_failed=untried
11146758a055Smrgfi[]dnl
11156758a055Smrg])# _PKG_CONFIG
11166758a055Smrg
11176758a055Smrg# _PKG_SHORT_ERRORS_SUPPORTED
11186758a055Smrg# -----------------------------
11196758a055SmrgAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
11206758a055Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
11216758a055Smrgif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
11226758a055Smrg        _pkg_short_errors_supported=yes
11236758a055Smrgelse
11246758a055Smrg        _pkg_short_errors_supported=no
11256758a055Smrgfi[]dnl
11266758a055Smrg])# _PKG_SHORT_ERRORS_SUPPORTED
11276758a055Smrg
11286758a055Smrg
11296758a055Smrg# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
11306758a055Smrg# [ACTION-IF-NOT-FOUND])
11316758a055Smrg#
11326758a055Smrg#
11336758a055Smrg# Note that if there is a possibility the first call to
11346758a055Smrg# PKG_CHECK_MODULES might not happen, you should be sure to include an
11356758a055Smrg# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
11366758a055Smrg#
11376758a055Smrg#
11386758a055Smrg# --------------------------------------------------------------
11396758a055SmrgAC_DEFUN([PKG_CHECK_MODULES],
11406758a055Smrg[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
11416758a055SmrgAC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
11426758a055SmrgAC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
11436758a055Smrg
11446758a055Smrgpkg_failed=no
11456758a055SmrgAC_MSG_CHECKING([for $1])
11466758a055Smrg
11476758a055Smrg_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
11486758a055Smrg_PKG_CONFIG([$1][_LIBS], [libs], [$2])
11496758a055Smrg
11506758a055Smrgm4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
11516758a055Smrgand $1[]_LIBS to avoid the need to call pkg-config.
11526758a055SmrgSee the pkg-config man page for more details.])
11536758a055Smrg
11546758a055Smrgif test $pkg_failed = yes; then
11556758a055Smrg        _PKG_SHORT_ERRORS_SUPPORTED
11566758a055Smrg        if test $_pkg_short_errors_supported = yes; then
11576758a055Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
11586758a055Smrg        else 
11596758a055Smrg	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
11606758a055Smrg        fi
11616758a055Smrg	# Put the nasty error message in config.log where it belongs
11626758a055Smrg	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
11636758a055Smrg
11646758a055Smrg	ifelse([$4], , [AC_MSG_ERROR(dnl
11656758a055Smrg[Package requirements ($2) were not met:
11666758a055Smrg
11676758a055Smrg$$1_PKG_ERRORS
11686758a055Smrg
11696758a055SmrgConsider adjusting the PKG_CONFIG_PATH environment variable if you
11706758a055Smrginstalled software in a non-standard prefix.
11716758a055Smrg
11726758a055Smrg_PKG_TEXT
11736758a055Smrg])],
11746758a055Smrg		[AC_MSG_RESULT([no])
11756758a055Smrg                $4])
11766758a055Smrgelif test $pkg_failed = untried; then
11776758a055Smrg	ifelse([$4], , [AC_MSG_FAILURE(dnl
11786758a055Smrg[The pkg-config script could not be found or is too old.  Make sure it
11796758a055Smrgis in your PATH or set the PKG_CONFIG environment variable to the full
11806758a055Smrgpath to pkg-config.
11816758a055Smrg
11826758a055Smrg_PKG_TEXT
11836758a055Smrg
11846758a055SmrgTo get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
11856758a055Smrg		[$4])
11866758a055Smrgelse
11876758a055Smrg	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
11886758a055Smrg	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
11896758a055Smrg        AC_MSG_RESULT([yes])
11906758a055Smrg	ifelse([$3], , :, [$3])
11916758a055Smrgfi[]dnl
11926758a055Smrg])# PKG_CHECK_MODULES
11936758a055Smrg
119414ddf674Smrgdnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
119514ddf674Smrgdnl
11966758a055Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1197cacd992dSmrgdnl 
119814ddf674Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
119914ddf674Smrgdnl copy of this software and associated documentation files (the "Software"),
120014ddf674Smrgdnl to deal in the Software without restriction, including without limitation
120114ddf674Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
120214ddf674Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
120314ddf674Smrgdnl Software is furnished to do so, subject to the following conditions:
120414ddf674Smrgdnl
120514ddf674Smrgdnl The above copyright notice and this permission notice (including the next
120614ddf674Smrgdnl paragraph) shall be included in all copies or substantial portions of the
120714ddf674Smrgdnl Software.
120814ddf674Smrgdnl
120914ddf674Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
121014ddf674Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
121114ddf674Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
121214ddf674Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
121314ddf674Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
121414ddf674Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
121514ddf674Smrgdnl DEALINGS IN THE SOFTWARE.
121614ddf674Smrg
121714ddf674Smrg# XORG_MACROS_VERSION(required-version)
121814ddf674Smrg# -------------------------------------
121914ddf674Smrg# Minimum version: 1.1.0
122014ddf674Smrg#
122114ddf674Smrg# If you're using a macro added in Version 1.1 or newer, include this in
122214ddf674Smrg# your configure.ac with the minimum required version, such as:
122314ddf674Smrg# XORG_MACROS_VERSION(1.1)
122414ddf674Smrg#
122514ddf674Smrg# To ensure that this macro is defined, also add:
122614ddf674Smrg# m4_ifndef([XORG_MACROS_VERSION],
122714ddf674Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
122814ddf674Smrg#
122914ddf674Smrg#
123014ddf674Smrg# See the "minimum version" comment for each macro you use to see what 
123114ddf674Smrg# version you require.
123214ddf674Smrgm4_defun([XORG_MACROS_VERSION],[
12336758a055Smrgm4_define([vers_have], [1.17])
123414ddf674Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
123514ddf674Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
123614ddf674Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
123714ddf674Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
123814ddf674Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
123914ddf674Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
124014ddf674Smrgm4_undefine([vers_have])
124114ddf674Smrgm4_undefine([maj_have])
124214ddf674Smrgm4_undefine([maj_needed])
124314ddf674Smrg]) # XORG_MACROS_VERSION
1244cacd992dSmrg
1245cacd992dSmrg# XORG_PROG_RAWCPP()
1246cacd992dSmrg# ------------------
124714ddf674Smrg# Minimum version: 1.0.0
124814ddf674Smrg#
1249cacd992dSmrg# Find cpp program and necessary flags for use in pre-processing text files
1250cacd992dSmrg# such as man pages and config files
1251cacd992dSmrgAC_DEFUN([XORG_PROG_RAWCPP],[
1252cacd992dSmrgAC_REQUIRE([AC_PROG_CPP])
1253cacd992dSmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
1254cacd992dSmrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1255cacd992dSmrg
1256cacd992dSmrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
1257cacd992dSmrg# which is not the best choice for supporting other OS'es, but covers most
1258cacd992dSmrg# of the ones we need for now.
1259cacd992dSmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
12606758a055SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1261cacd992dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1262cacd992dSmrg	AC_MSG_RESULT([no])
1263cacd992dSmrgelse
1264cacd992dSmrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1265cacd992dSmrg		RAWCPPFLAGS=-undef
1266cacd992dSmrg		AC_MSG_RESULT([yes])
126714ddf674Smrg	# under Cygwin unix is still defined even with -undef
126814ddf674Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
126914ddf674Smrg		RAWCPPFLAGS="-undef -ansi"
127014ddf674Smrg		AC_MSG_RESULT([yes, with -ansi])
1271cacd992dSmrg	else
1272cacd992dSmrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1273cacd992dSmrg	fi
1274cacd992dSmrgfi
1275cacd992dSmrgrm -f conftest.$ac_ext
1276cacd992dSmrg
1277cacd992dSmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
12786758a055SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1279cacd992dSmrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1280cacd992dSmrg	AC_MSG_RESULT([no])
1281cacd992dSmrgelse
1282cacd992dSmrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1283cacd992dSmrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1284cacd992dSmrg		AC_MSG_RESULT([yes])
1285cacd992dSmrg	else
1286cacd992dSmrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1287cacd992dSmrg	fi
1288cacd992dSmrgfi
1289cacd992dSmrgrm -f conftest.$ac_ext
1290cacd992dSmrgAC_SUBST(RAWCPPFLAGS)
1291cacd992dSmrg]) # XORG_PROG_RAWCPP
1292cacd992dSmrg
1293cacd992dSmrg# XORG_MANPAGE_SECTIONS()
1294cacd992dSmrg# -----------------------
129514ddf674Smrg# Minimum version: 1.0.0
129614ddf674Smrg#
1297cacd992dSmrg# Determine which sections man pages go in for the different man page types
1298cacd992dSmrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1299cacd992dSmrg# Not sure if there's any better way than just hardcoding by OS name.
1300cacd992dSmrg# Override default settings by setting environment variables
13016758a055Smrg# Added MAN_SUBSTS in version 1.8
13026758a055Smrg# Added AC_PROG_SED in version 1.8
1303cacd992dSmrg
1304cacd992dSmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
1305cacd992dSmrgAC_REQUIRE([AC_CANONICAL_HOST])
13066758a055SmrgAC_REQUIRE([AC_PROG_SED])
1307cacd992dSmrg
1308cacd992dSmrgif test x$APP_MAN_SUFFIX = x    ; then
130914ddf674Smrg    APP_MAN_SUFFIX=1
1310cacd992dSmrgfi
1311cacd992dSmrgif test x$APP_MAN_DIR = x    ; then
131214ddf674Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1313cacd992dSmrgfi
1314cacd992dSmrg
1315cacd992dSmrgif test x$LIB_MAN_SUFFIX = x    ; then
131614ddf674Smrg    LIB_MAN_SUFFIX=3
1317cacd992dSmrgfi
1318cacd992dSmrgif test x$LIB_MAN_DIR = x    ; then
131914ddf674Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1320cacd992dSmrgfi
1321cacd992dSmrg
1322cacd992dSmrgif test x$FILE_MAN_SUFFIX = x    ; then
1323cacd992dSmrg    case $host_os in
1324cacd992dSmrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
1325cacd992dSmrg	*)		FILE_MAN_SUFFIX=5  ;;
1326cacd992dSmrg    esac
1327cacd992dSmrgfi
1328cacd992dSmrgif test x$FILE_MAN_DIR = x    ; then
132914ddf674Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1330cacd992dSmrgfi
1331cacd992dSmrg
1332cacd992dSmrgif test x$MISC_MAN_SUFFIX = x    ; then
1333cacd992dSmrg    case $host_os in
1334cacd992dSmrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
1335cacd992dSmrg	*)		MISC_MAN_SUFFIX=7  ;;
1336cacd992dSmrg    esac
1337cacd992dSmrgfi
1338cacd992dSmrgif test x$MISC_MAN_DIR = x    ; then
133914ddf674Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1340cacd992dSmrgfi
1341cacd992dSmrg
1342cacd992dSmrgif test x$DRIVER_MAN_SUFFIX = x    ; then
1343cacd992dSmrg    case $host_os in
1344cacd992dSmrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
1345cacd992dSmrg	*)		DRIVER_MAN_SUFFIX=4  ;;
1346cacd992dSmrg    esac
1347cacd992dSmrgfi
1348cacd992dSmrgif test x$DRIVER_MAN_DIR = x    ; then
134914ddf674Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1350cacd992dSmrgfi
1351cacd992dSmrg
1352cacd992dSmrgif test x$ADMIN_MAN_SUFFIX = x    ; then
1353cacd992dSmrg    case $host_os in
1354cacd992dSmrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
1355cacd992dSmrg	*)		ADMIN_MAN_SUFFIX=8  ;;
1356cacd992dSmrg    esac
1357cacd992dSmrgfi
1358cacd992dSmrgif test x$ADMIN_MAN_DIR = x    ; then
1359cacd992dSmrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1360cacd992dSmrgfi
1361cacd992dSmrg
1362cacd992dSmrg
1363cacd992dSmrgAC_SUBST([APP_MAN_SUFFIX])
1364cacd992dSmrgAC_SUBST([LIB_MAN_SUFFIX])
1365cacd992dSmrgAC_SUBST([FILE_MAN_SUFFIX])
1366cacd992dSmrgAC_SUBST([MISC_MAN_SUFFIX])
1367cacd992dSmrgAC_SUBST([DRIVER_MAN_SUFFIX])
1368cacd992dSmrgAC_SUBST([ADMIN_MAN_SUFFIX])
1369cacd992dSmrgAC_SUBST([APP_MAN_DIR])
1370cacd992dSmrgAC_SUBST([LIB_MAN_DIR])
1371cacd992dSmrgAC_SUBST([FILE_MAN_DIR])
1372cacd992dSmrgAC_SUBST([MISC_MAN_DIR])
1373cacd992dSmrgAC_SUBST([DRIVER_MAN_DIR])
1374cacd992dSmrgAC_SUBST([ADMIN_MAN_DIR])
13756758a055Smrg
13766758a055SmrgXORG_MAN_PAGE="X Version 11"
13776758a055SmrgAC_SUBST([XORG_MAN_PAGE])
13786758a055SmrgMAN_SUBSTS="\
13796758a055Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
13806758a055Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
13816758a055Smrg	-e 's|__xservername__|Xorg|g' \
13826758a055Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
13836758a055Smrg	-e 's|__projectroot__|\$(prefix)|g' \
13846758a055Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
13856758a055Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
13866758a055Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
13876758a055Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
13886758a055Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
13896758a055Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
13906758a055Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
13916758a055SmrgAC_SUBST([MAN_SUBSTS])
13926758a055Smrg
1393cacd992dSmrg]) # XORG_MANPAGE_SECTIONS
1394cacd992dSmrg
13956758a055Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
13966758a055Smrg# ------------------------
13976758a055Smrg# Minimum version: 1.7.0
13986758a055Smrg#
13996758a055Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
14006758a055Smrg# provided by xorg-sgml-doctools, if installed.
14016758a055SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
14026758a055SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
14036758a055SmrgXORG_SGML_PATH=
14046758a055SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
14056758a055Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
14066758a055Smrg    [m4_ifval([$1],[:],
14076758a055Smrg        [if test x"$cross_compiling" != x"yes" ; then
14086758a055Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
14096758a055Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
14106758a055Smrg         fi])
14116758a055Smrg    ])
14126758a055Smrg
14136758a055Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
14146758a055Smrg# the path and the name of the doc stylesheet
14156758a055Smrgif test "x$XORG_SGML_PATH" != "x" ; then
14166758a055Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
14176758a055Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
14186758a055Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
14196758a055Smrgelse
14206758a055Smrg   AC_MSG_RESULT([no])
14216758a055Smrgfi
14226758a055Smrg
14236758a055SmrgAC_SUBST(XORG_SGML_PATH)
14246758a055SmrgAC_SUBST(STYLESHEET_SRCDIR)
14256758a055SmrgAC_SUBST(XSL_STYLESHEET)
14266758a055SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
14276758a055Smrg]) # XORG_CHECK_SGML_DOCTOOLS
14286758a055Smrg
1429cacd992dSmrg# XORG_CHECK_LINUXDOC
1430cacd992dSmrg# -------------------
143114ddf674Smrg# Minimum version: 1.0.0
143214ddf674Smrg#
1433cacd992dSmrg# Defines the variable MAKE_TEXT if the necessary tools and
1434cacd992dSmrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1435cacd992dSmrg# Whether or not the necessary tools and files are found can be checked
1436cacd992dSmrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1437cacd992dSmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
14386758a055SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
14396758a055SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
1440cacd992dSmrg
1441cacd992dSmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
1442cacd992dSmrg
14436758a055SmrgAC_MSG_CHECKING([whether to build documentation])
1444cacd992dSmrg
14456758a055Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1446cacd992dSmrg   BUILDDOC=yes
1447cacd992dSmrgelse
1448cacd992dSmrg   BUILDDOC=no
1449cacd992dSmrgfi
1450cacd992dSmrg
1451cacd992dSmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1452cacd992dSmrg
1453cacd992dSmrgAC_MSG_RESULT([$BUILDDOC])
1454cacd992dSmrg
14556758a055SmrgAC_MSG_CHECKING([whether to build pdf documentation])
1456cacd992dSmrg
14576758a055Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1458cacd992dSmrg   BUILDPDFDOC=yes
1459cacd992dSmrgelse
1460cacd992dSmrg   BUILDPDFDOC=no
1461cacd992dSmrgfi
1462cacd992dSmrg
1463cacd992dSmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1464cacd992dSmrg
1465cacd992dSmrgAC_MSG_RESULT([$BUILDPDFDOC])
1466cacd992dSmrg
14676758a055SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
146814ddf674SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1469cacd992dSmrgMAKE_PDF="$PS2PDF"
147014ddf674SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1471cacd992dSmrg
1472cacd992dSmrgAC_SUBST(MAKE_TEXT)
1473cacd992dSmrgAC_SUBST(MAKE_PS)
1474cacd992dSmrgAC_SUBST(MAKE_PDF)
1475cacd992dSmrgAC_SUBST(MAKE_HTML)
1476cacd992dSmrg]) # XORG_CHECK_LINUXDOC
1477cacd992dSmrg
147814ddf674Smrg# XORG_CHECK_DOCBOOK
147914ddf674Smrg# -------------------
148014ddf674Smrg# Minimum version: 1.0.0
148114ddf674Smrg#
148214ddf674Smrg# Checks for the ability to build output formats from SGML DocBook source.
148314ddf674Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
148414ddf674Smrg# indicates whether the necessary tools and files are found and, if set,
148514ddf674Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
148614ddf674SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
14876758a055SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
14886758a055Smrg
148914ddf674SmrgBUILDTXTDOC=no
149014ddf674SmrgBUILDPDFDOC=no
149114ddf674SmrgBUILDPSDOC=no
149214ddf674SmrgBUILDHTMLDOC=no
149314ddf674Smrg
149414ddf674SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
149514ddf674SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
149614ddf674SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
149714ddf674SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
149814ddf674Smrg
14996758a055SmrgAC_MSG_CHECKING([whether to build text documentation])
15006758a055Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
150114ddf674Smrg   test x$BUILD_TXTDOC != xno; then
150214ddf674Smrg	BUILDTXTDOC=yes
150314ddf674Smrgfi
150414ddf674SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
150514ddf674SmrgAC_MSG_RESULT([$BUILDTXTDOC])
150614ddf674Smrg
15076758a055SmrgAC_MSG_CHECKING([whether to build PDF documentation])
15086758a055Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
150914ddf674Smrg   test x$BUILD_PDFDOC != xno; then
151014ddf674Smrg	BUILDPDFDOC=yes
151114ddf674Smrgfi
151214ddf674SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
151314ddf674SmrgAC_MSG_RESULT([$BUILDPDFDOC])
151414ddf674Smrg
15156758a055SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
15166758a055Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
151714ddf674Smrg   test x$BUILD_PSDOC != xno; then
151814ddf674Smrg	BUILDPSDOC=yes
151914ddf674Smrgfi
152014ddf674SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
152114ddf674SmrgAC_MSG_RESULT([$BUILDPSDOC])
152214ddf674Smrg
15236758a055SmrgAC_MSG_CHECKING([whether to build HTML documentation])
15246758a055Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
152514ddf674Smrg   test x$BUILD_HTMLDOC != xno; then
152614ddf674Smrg	BUILDHTMLDOC=yes
152714ddf674Smrgfi
152814ddf674SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
152914ddf674SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
153014ddf674Smrg
153114ddf674SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
153214ddf674SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
153314ddf674SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
153414ddf674SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
153514ddf674Smrg
153614ddf674SmrgAC_SUBST(MAKE_TEXT)
153714ddf674SmrgAC_SUBST(MAKE_PS)
153814ddf674SmrgAC_SUBST(MAKE_PDF)
153914ddf674SmrgAC_SUBST(MAKE_HTML)
154014ddf674Smrg]) # XORG_CHECK_DOCBOOK
154114ddf674Smrg
15426758a055Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
15436758a055Smrg# ----------------
15446758a055Smrg# Minimum version: 1.5.0
15456758a055Smrg# Minimum version for optional DEFAULT argument: 1.11.0
154614ddf674Smrg#
15476758a055Smrg# Documentation tools are not always available on all platforms and sometimes
15486758a055Smrg# not at the appropriate level. This macro enables a module to test for the
15496758a055Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
15506758a055Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
15516758a055Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
15526758a055Smrg# --with-xmlto assumes 'auto'.
15536758a055Smrg#
15546758a055Smrg# Interface to module:
15556758a055Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
15566758a055Smrg# XMLTO:	returns the path of the xmlto program found
15576758a055Smrg#		returns the path set by the user in the environment
15586758a055Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
15596758a055Smrg#		'no' user instructs the module not to use xmlto
15606758a055Smrg#
15616758a055Smrg# Added in version 1.10.0
15626758a055Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
15636758a055Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
15646758a055Smrg#
15656758a055Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
15666758a055Smrg#
15676758a055SmrgAC_DEFUN([XORG_WITH_XMLTO],[
15686758a055SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
15696758a055Smrgm4_define([_defopt], m4_default([$2], [auto]))
15706758a055SmrgAC_ARG_WITH(xmlto,
15716758a055Smrg	AS_HELP_STRING([--with-xmlto],
15726758a055Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
15736758a055Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
15746758a055Smrgm4_undefine([_defopt])
15756758a055Smrg
15766758a055Smrgif test "x$use_xmlto" = x"auto"; then
15776758a055Smrg   AC_PATH_PROG([XMLTO], [xmlto])
15786758a055Smrg   if test "x$XMLTO" = "x"; then
15796758a055Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
15806758a055Smrg	have_xmlto=no
15816758a055Smrg   else
15826758a055Smrg        have_xmlto=yes
15836758a055Smrg   fi
15846758a055Smrgelif test "x$use_xmlto" = x"yes" ; then
15856758a055Smrg   AC_PATH_PROG([XMLTO], [xmlto])
15866758a055Smrg   if test "x$XMLTO" = "x"; then
15876758a055Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
15886758a055Smrg   fi
15896758a055Smrg   have_xmlto=yes
15906758a055Smrgelif test "x$use_xmlto" = x"no" ; then
15916758a055Smrg   if test "x$XMLTO" != "x"; then
15926758a055Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
15936758a055Smrg   fi
15946758a055Smrg   have_xmlto=no
15956758a055Smrgelse
15966758a055Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1597cacd992dSmrgfi
1598cacd992dSmrg
15996758a055Smrg# Test for a minimum version of xmlto, if provided.
16006758a055Smrgm4_ifval([$1],
16016758a055Smrg[if test "$have_xmlto" = yes; then
16026758a055Smrg    # scrape the xmlto version
16036758a055Smrg    AC_MSG_CHECKING([the xmlto version])
16046758a055Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
16056758a055Smrg    AC_MSG_RESULT([$xmlto_version])
16066758a055Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
16076758a055Smrg        [if test "x$use_xmlto" = xauto; then
16086758a055Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
16096758a055Smrg            have_xmlto=no
16106758a055Smrg        else
16116758a055Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
16126758a055Smrg        fi])
16136758a055Smrgfi])
16146758a055Smrg
16156758a055Smrg# Test for the ability of xmlto to generate a text target
16166758a055Smrghave_xmlto_text=no
16176758a055Smrgcat > conftest.xml << "EOF"
16186758a055SmrgEOF
16196758a055SmrgAS_IF([test "$have_xmlto" = yes],
16206758a055Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
16216758a055Smrg             [have_xmlto_text=yes],
16226758a055Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
16236758a055Smrgrm -f conftest.xml
16246758a055SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
16256758a055SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
16266758a055Smrg]) # XORG_WITH_XMLTO
16276758a055Smrg
16286758a055Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
16296758a055Smrg# --------------------------------------------
16306758a055Smrg# Minimum version: 1.12.0
16316758a055Smrg# Minimum version for optional DEFAULT argument: 1.12.0
16326758a055Smrg#
16336758a055Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
16346758a055Smrg# XML-based language used for the transformation of XML documents.
16356758a055Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
16366758a055Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
16376758a055Smrg# The XSLT processor is often used as a standalone tool for transformations.
16386758a055Smrg# It should not be assumed that this tool is used only to work with documnetation.
16396758a055Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
16406758a055Smrg#
16416758a055Smrg# Interface to module:
16426758a055Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
16436758a055Smrg# XSLTPROC:	 returns the path of the xsltproc program found
16446758a055Smrg#		 returns the path set by the user in the environment
16456758a055Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
16466758a055Smrg#		  'no' user instructs the module not to use xsltproc
16476758a055Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
16486758a055Smrg#
16496758a055Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
16506758a055Smrg#
16516758a055SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
16526758a055SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
16536758a055Smrg# Preserves the interface, should it be implemented later
16546758a055Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
16556758a055Smrgm4_define([_defopt], m4_default([$2], [auto]))
16566758a055SmrgAC_ARG_WITH(xsltproc,
16576758a055Smrg	AS_HELP_STRING([--with-xsltproc],
16586758a055Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
16596758a055Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
16606758a055Smrgm4_undefine([_defopt])
16616758a055Smrg
16626758a055Smrgif test "x$use_xsltproc" = x"auto"; then
16636758a055Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
16646758a055Smrg   if test "x$XSLTPROC" = "x"; then
16656758a055Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
16666758a055Smrg	have_xsltproc=no
16676758a055Smrg   else
16686758a055Smrg        have_xsltproc=yes
16696758a055Smrg   fi
16706758a055Smrgelif test "x$use_xsltproc" = x"yes" ; then
16716758a055Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
16726758a055Smrg   if test "x$XSLTPROC" = "x"; then
16736758a055Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
16746758a055Smrg   fi
16756758a055Smrg   have_xsltproc=yes
16766758a055Smrgelif test "x$use_xsltproc" = x"no" ; then
16776758a055Smrg   if test "x$XSLTPROC" != "x"; then
16786758a055Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
16796758a055Smrg   fi
16806758a055Smrg   have_xsltproc=no
1681cacd992dSmrgelse
16826758a055Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1683cacd992dSmrgfi
1684cacd992dSmrg
16856758a055SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
16866758a055Smrg]) # XORG_WITH_XSLTPROC
1687cacd992dSmrg
16886758a055Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
16896758a055Smrg# ----------------------------------------
16906758a055Smrg# Minimum version: 1.15.0
169114ddf674Smrg#
16926758a055Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
16936758a055Smrg# scanning arbitrary text files, extracting information from those text files,
16946758a055Smrg# and printing reports based on that information.
169514ddf674Smrg#
16966758a055Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
16976758a055Smrg#
16986758a055Smrg# Interface to module:
16996758a055Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
17006758a055Smrg# PERL:	     returns the path of the perl program found
17016758a055Smrg#	     returns the path set by the user in the environment
17026758a055Smrg# --with-perl: 'yes' user instructs the module to use perl
17036758a055Smrg#	       'no' user instructs the module not to use perl
17046758a055Smrg# have_perl: returns yes if perl found in PATH or no
17056758a055Smrg#
17066758a055Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
17076758a055Smrg#
17086758a055SmrgAC_DEFUN([XORG_WITH_PERL],[
17096758a055SmrgAC_ARG_VAR([PERL], [Path to perl command])
17106758a055Smrg# Preserves the interface, should it be implemented later
17116758a055Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
17126758a055Smrgm4_define([_defopt], m4_default([$2], [auto]))
17136758a055SmrgAC_ARG_WITH(perl,
17146758a055Smrg	AS_HELP_STRING([--with-perl],
17156758a055Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
17166758a055Smrg	   [use_perl=$withval], [use_perl=]_defopt)
17176758a055Smrgm4_undefine([_defopt])
17186758a055Smrg
17196758a055Smrgif test "x$use_perl" = x"auto"; then
17206758a055Smrg   AC_PATH_PROG([PERL], [perl])
17216758a055Smrg   if test "x$PERL" = "x"; then
17226758a055Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
17236758a055Smrg	have_perl=no
17246758a055Smrg   else
17256758a055Smrg        have_perl=yes
17266758a055Smrg   fi
17276758a055Smrgelif test "x$use_perl" = x"yes" ; then
17286758a055Smrg   AC_PATH_PROG([PERL], [perl])
17296758a055Smrg   if test "x$PERL" = "x"; then
17306758a055Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
17316758a055Smrg   fi
17326758a055Smrg   have_perl=yes
17336758a055Smrgelif test "x$use_perl" = x"no" ; then
17346758a055Smrg   if test "x$PERL" != "x"; then
17356758a055Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
17366758a055Smrg   fi
17376758a055Smrg   have_perl=no
17386758a055Smrgelse
17396758a055Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
17406758a055Smrgfi
17416758a055Smrg
17426758a055SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
17436758a055Smrg]) # XORG_WITH_PERL
17446758a055Smrg
17456758a055Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
17466758a055Smrg# ----------------
17476758a055Smrg# Minimum version: 1.5.0
17486758a055Smrg# Minimum version for optional DEFAULT argument: 1.11.0
17496758a055Smrg#
17506758a055Smrg# Documentation tools are not always available on all platforms and sometimes
17516758a055Smrg# not at the appropriate level. This macro enables a module to test for the
17526758a055Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
17536758a055Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
17546758a055Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
17556758a055Smrg# --with-asciidoc assumes 'auto'.
17566758a055Smrg#
17576758a055Smrg# Interface to module:
17586758a055Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
17596758a055Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
17606758a055Smrg#		 returns the path set by the user in the environment
17616758a055Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
17626758a055Smrg#		  'no' user instructs the module not to use asciidoc
17636758a055Smrg#
17646758a055Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
17656758a055Smrg#
17666758a055SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
17676758a055SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
17686758a055Smrgm4_define([_defopt], m4_default([$2], [auto]))
17696758a055SmrgAC_ARG_WITH(asciidoc,
17706758a055Smrg	AS_HELP_STRING([--with-asciidoc],
17716758a055Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
17726758a055Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
17736758a055Smrgm4_undefine([_defopt])
17746758a055Smrg
17756758a055Smrgif test "x$use_asciidoc" = x"auto"; then
17766758a055Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
17776758a055Smrg   if test "x$ASCIIDOC" = "x"; then
17786758a055Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
17796758a055Smrg	have_asciidoc=no
17806758a055Smrg   else
17816758a055Smrg        have_asciidoc=yes
17826758a055Smrg   fi
17836758a055Smrgelif test "x$use_asciidoc" = x"yes" ; then
17846758a055Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
17856758a055Smrg   if test "x$ASCIIDOC" = "x"; then
17866758a055Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
17876758a055Smrg   fi
17886758a055Smrg   have_asciidoc=yes
17896758a055Smrgelif test "x$use_asciidoc" = x"no" ; then
17906758a055Smrg   if test "x$ASCIIDOC" != "x"; then
17916758a055Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
17926758a055Smrg   fi
17936758a055Smrg   have_asciidoc=no
17946758a055Smrgelse
17956758a055Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
17966758a055Smrgfi
17976758a055Smrgm4_ifval([$1],
17986758a055Smrg[if test "$have_asciidoc" = yes; then
17996758a055Smrg    # scrape the asciidoc version
18006758a055Smrg    AC_MSG_CHECKING([the asciidoc version])
18016758a055Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
18026758a055Smrg    AC_MSG_RESULT([$asciidoc_version])
18036758a055Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
18046758a055Smrg        [if test "x$use_asciidoc" = xauto; then
18056758a055Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
18066758a055Smrg            have_asciidoc=no
18076758a055Smrg        else
18086758a055Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
18096758a055Smrg        fi])
18106758a055Smrgfi])
18116758a055SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
18126758a055Smrg]) # XORG_WITH_ASCIIDOC
18136758a055Smrg
18146758a055Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
18156758a055Smrg# --------------------------------
18166758a055Smrg# Minimum version: 1.5.0
18176758a055Smrg# Minimum version for optional DEFAULT argument: 1.11.0
18186758a055Smrg#
18196758a055Smrg# Documentation tools are not always available on all platforms and sometimes
18206758a055Smrg# not at the appropriate level. This macro enables a module to test for the
18216758a055Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
18226758a055Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
18236758a055Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
18246758a055Smrg# --with-doxygen assumes 'auto'.
18256758a055Smrg#
18266758a055Smrg# Interface to module:
18276758a055Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
18286758a055Smrg# DOXYGEN:	 returns the path of the doxygen program found
18296758a055Smrg#		 returns the path set by the user in the environment
18306758a055Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
18316758a055Smrg#		  'no' user instructs the module not to use doxygen
18326758a055Smrg#
18336758a055Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
18346758a055Smrg#
18356758a055SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
18366758a055SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
18376758a055Smrgm4_define([_defopt], m4_default([$2], [auto]))
18386758a055SmrgAC_ARG_WITH(doxygen,
18396758a055Smrg	AS_HELP_STRING([--with-doxygen],
18406758a055Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
18416758a055Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
18426758a055Smrgm4_undefine([_defopt])
18436758a055Smrg
18446758a055Smrgif test "x$use_doxygen" = x"auto"; then
18456758a055Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
18466758a055Smrg   if test "x$DOXYGEN" = "x"; then
18476758a055Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
18486758a055Smrg	have_doxygen=no
18496758a055Smrg   else
18506758a055Smrg        have_doxygen=yes
18516758a055Smrg   fi
18526758a055Smrgelif test "x$use_doxygen" = x"yes" ; then
18536758a055Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
18546758a055Smrg   if test "x$DOXYGEN" = "x"; then
18556758a055Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
18566758a055Smrg   fi
18576758a055Smrg   have_doxygen=yes
18586758a055Smrgelif test "x$use_doxygen" = x"no" ; then
18596758a055Smrg   if test "x$DOXYGEN" != "x"; then
18606758a055Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
18616758a055Smrg   fi
18626758a055Smrg   have_doxygen=no
18636758a055Smrgelse
18646758a055Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
18656758a055Smrgfi
18666758a055Smrgm4_ifval([$1],
18676758a055Smrg[if test "$have_doxygen" = yes; then
18686758a055Smrg    # scrape the doxygen version
18696758a055Smrg    AC_MSG_CHECKING([the doxygen version])
18706758a055Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
18716758a055Smrg    AC_MSG_RESULT([$doxygen_version])
18726758a055Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
18736758a055Smrg        [if test "x$use_doxygen" = xauto; then
18746758a055Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
18756758a055Smrg            have_doxygen=no
18766758a055Smrg        else
18776758a055Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
18786758a055Smrg        fi])
18796758a055Smrgfi])
18806758a055SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
18816758a055Smrg]) # XORG_WITH_DOXYGEN
18826758a055Smrg
18836758a055Smrg# XORG_WITH_GROFF([DEFAULT])
18846758a055Smrg# ----------------
18856758a055Smrg# Minimum version: 1.6.0
18866758a055Smrg# Minimum version for optional DEFAULT argument: 1.11.0
18876758a055Smrg#
18886758a055Smrg# Documentation tools are not always available on all platforms and sometimes
18896758a055Smrg# not at the appropriate level. This macro enables a module to test for the
18906758a055Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
18916758a055Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
18926758a055Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
18936758a055Smrg# --with-groff assumes 'auto'.
18946758a055Smrg#
18956758a055Smrg# Interface to module:
18966758a055Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
18976758a055Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
18986758a055Smrg# HAVE_GROFF_MS: the -ms macros package
18996758a055Smrg# GROFF:	 returns the path of the groff program found
19006758a055Smrg#		 returns the path set by the user in the environment
19016758a055Smrg# --with-groff:	 'yes' user instructs the module to use groff
19026758a055Smrg#		 'no' user instructs the module not to use groff
19036758a055Smrg#
19046758a055Smrg# Added in version 1.9.0:
19056758a055Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
19066758a055Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
19076758a055Smrg#		   psselect from the psutils package.
19086758a055Smrg#		   the ghostcript package. Refer to the grohtml man pages
19096758a055Smrg#
19106758a055Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
19116758a055Smrg#
19126758a055Smrg# OS and distros often splits groff in a basic and full package, the former
19136758a055Smrg# having the groff program and the later having devices, fonts and macros
19146758a055Smrg# Checking for the groff executable is not enough.
19156758a055Smrg#
19166758a055Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
19176758a055Smrg# unset HAVE_GROFF or GROFF env variables.
19186758a055Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
19196758a055Smrg#
19206758a055SmrgAC_DEFUN([XORG_WITH_GROFF],[
19216758a055SmrgAC_ARG_VAR([GROFF], [Path to groff command])
19226758a055Smrgm4_define([_defopt], m4_default([$1], [auto]))
19236758a055SmrgAC_ARG_WITH(groff,
19246758a055Smrg	AS_HELP_STRING([--with-groff],
19256758a055Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
19266758a055Smrg	   [use_groff=$withval], [use_groff=]_defopt)
19276758a055Smrgm4_undefine([_defopt])
19286758a055Smrg
19296758a055Smrgif test "x$use_groff" = x"auto"; then
19306758a055Smrg   AC_PATH_PROG([GROFF], [groff])
19316758a055Smrg   if test "x$GROFF" = "x"; then
19326758a055Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
19336758a055Smrg	have_groff=no
19346758a055Smrg   else
19356758a055Smrg        have_groff=yes
19366758a055Smrg   fi
19376758a055Smrgelif test "x$use_groff" = x"yes" ; then
19386758a055Smrg   AC_PATH_PROG([GROFF], [groff])
19396758a055Smrg   if test "x$GROFF" = "x"; then
19406758a055Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
19416758a055Smrg   fi
19426758a055Smrg   have_groff=yes
19436758a055Smrgelif test "x$use_groff" = x"no" ; then
19446758a055Smrg   if test "x$GROFF" != "x"; then
19456758a055Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
19466758a055Smrg   fi
19476758a055Smrg   have_groff=no
19486758a055Smrgelse
19496758a055Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
19506758a055Smrgfi
19516758a055Smrg
19526758a055Smrg# We have groff, test for the presence of the macro packages
19536758a055Smrgif test "x$have_groff" = x"yes"; then
19546758a055Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
19556758a055Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
19566758a055Smrg        groff_ms_works=yes
19576758a055Smrg    else
19586758a055Smrg        groff_ms_works=no
19596758a055Smrg    fi
19606758a055Smrg    AC_MSG_RESULT([$groff_ms_works])
19616758a055Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
19626758a055Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
19636758a055Smrg        groff_mm_works=yes
19646758a055Smrg    else
19656758a055Smrg        groff_mm_works=no
19666758a055Smrg    fi
19676758a055Smrg    AC_MSG_RESULT([$groff_mm_works])
19686758a055Smrgfi
19696758a055Smrg
19706758a055Smrg# We have groff, test for HTML dependencies, one command per package
19716758a055Smrgif test "x$have_groff" = x"yes"; then
19726758a055Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
19736758a055Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
19746758a055Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
19756758a055Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
19766758a055Smrg      have_groff_html=yes
19776758a055Smrg   else
19786758a055Smrg      have_groff_html=no
19796758a055Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
19806758a055Smrg   fi
19816758a055Smrgfi
19826758a055Smrg
19836758a055Smrg# Set Automake conditionals for Makefiles
19846758a055SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
19856758a055SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
19866758a055SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
19876758a055SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
19886758a055Smrg]) # XORG_WITH_GROFF
19896758a055Smrg
19906758a055Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
19916758a055Smrg# ---------------------------------------
19926758a055Smrg# Minimum version: 1.6.0
19936758a055Smrg# Minimum version for optional DEFAULT argument: 1.11.0
19946758a055Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
19956758a055Smrg#
19966758a055Smrg# Documentation tools are not always available on all platforms and sometimes
19976758a055Smrg# not at the appropriate level. This macro enables a module to test for the
19986758a055Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
19996758a055Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
20006758a055Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
20016758a055Smrg# --with-fop assumes 'auto'.
20026758a055Smrg#
20036758a055Smrg# Interface to module:
20046758a055Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
20056758a055Smrg# FOP:	 	returns the path of the fop program found
20066758a055Smrg#		returns the path set by the user in the environment
20076758a055Smrg# --with-fop: 	'yes' user instructs the module to use fop
20086758a055Smrg#		'no' user instructs the module not to use fop
20096758a055Smrg#
20106758a055Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
20116758a055Smrg#
20126758a055SmrgAC_DEFUN([XORG_WITH_FOP],[
20136758a055SmrgAC_ARG_VAR([FOP], [Path to fop command])
20146758a055Smrgm4_define([_defopt], m4_default([$2], [auto]))
20156758a055SmrgAC_ARG_WITH(fop,
20166758a055Smrg	AS_HELP_STRING([--with-fop],
20176758a055Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
20186758a055Smrg	   [use_fop=$withval], [use_fop=]_defopt)
20196758a055Smrgm4_undefine([_defopt])
20206758a055Smrg
20216758a055Smrgif test "x$use_fop" = x"auto"; then
20226758a055Smrg   AC_PATH_PROG([FOP], [fop])
20236758a055Smrg   if test "x$FOP" = "x"; then
20246758a055Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
20256758a055Smrg	have_fop=no
20266758a055Smrg   else
20276758a055Smrg        have_fop=yes
20286758a055Smrg   fi
20296758a055Smrgelif test "x$use_fop" = x"yes" ; then
20306758a055Smrg   AC_PATH_PROG([FOP], [fop])
20316758a055Smrg   if test "x$FOP" = "x"; then
20326758a055Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
20336758a055Smrg   fi
20346758a055Smrg   have_fop=yes
20356758a055Smrgelif test "x$use_fop" = x"no" ; then
20366758a055Smrg   if test "x$FOP" != "x"; then
20376758a055Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
20386758a055Smrg   fi
20396758a055Smrg   have_fop=no
20406758a055Smrgelse
20416758a055Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
20426758a055Smrgfi
20436758a055Smrg
20446758a055Smrg# Test for a minimum version of fop, if provided.
20456758a055Smrgm4_ifval([$1],
20466758a055Smrg[if test "$have_fop" = yes; then
20476758a055Smrg    # scrape the fop version
20486758a055Smrg    AC_MSG_CHECKING([for fop minimum version])
20496758a055Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
20506758a055Smrg    AC_MSG_RESULT([$fop_version])
20516758a055Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
20526758a055Smrg        [if test "x$use_fop" = xauto; then
20536758a055Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
20546758a055Smrg            have_fop=no
20556758a055Smrg        else
20566758a055Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
20576758a055Smrg        fi])
20586758a055Smrgfi])
20596758a055SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
20606758a055Smrg]) # XORG_WITH_FOP
20616758a055Smrg
20626758a055Smrg# XORG_WITH_PS2PDF([DEFAULT])
20636758a055Smrg# ----------------
20646758a055Smrg# Minimum version: 1.6.0
20656758a055Smrg# Minimum version for optional DEFAULT argument: 1.11.0
20666758a055Smrg#
20676758a055Smrg# Documentation tools are not always available on all platforms and sometimes
20686758a055Smrg# not at the appropriate level. This macro enables a module to test for the
20696758a055Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
20706758a055Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
20716758a055Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
20726758a055Smrg# --with-ps2pdf assumes 'auto'.
20736758a055Smrg#
20746758a055Smrg# Interface to module:
20756758a055Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
20766758a055Smrg# PS2PDF:	returns the path of the ps2pdf program found
20776758a055Smrg#		returns the path set by the user in the environment
20786758a055Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
20796758a055Smrg#		 'no' user instructs the module not to use ps2pdf
20806758a055Smrg#
20816758a055Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
20826758a055Smrg#
20836758a055SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
20846758a055SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
20856758a055Smrgm4_define([_defopt], m4_default([$1], [auto]))
20866758a055SmrgAC_ARG_WITH(ps2pdf,
20876758a055Smrg	AS_HELP_STRING([--with-ps2pdf],
20886758a055Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
20896758a055Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
20906758a055Smrgm4_undefine([_defopt])
20916758a055Smrg
20926758a055Smrgif test "x$use_ps2pdf" = x"auto"; then
20936758a055Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
20946758a055Smrg   if test "x$PS2PDF" = "x"; then
20956758a055Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
20966758a055Smrg	have_ps2pdf=no
20976758a055Smrg   else
20986758a055Smrg        have_ps2pdf=yes
20996758a055Smrg   fi
21006758a055Smrgelif test "x$use_ps2pdf" = x"yes" ; then
21016758a055Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
21026758a055Smrg   if test "x$PS2PDF" = "x"; then
21036758a055Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
21046758a055Smrg   fi
21056758a055Smrg   have_ps2pdf=yes
21066758a055Smrgelif test "x$use_ps2pdf" = x"no" ; then
21076758a055Smrg   if test "x$PS2PDF" != "x"; then
21086758a055Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
21096758a055Smrg   fi
21106758a055Smrg   have_ps2pdf=no
21116758a055Smrgelse
21126758a055Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
21136758a055Smrgfi
21146758a055SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
21156758a055Smrg]) # XORG_WITH_PS2PDF
21166758a055Smrg
21176758a055Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
21186758a055Smrg# ----------------
21196758a055Smrg# Minimum version: 1.6.0
21206758a055Smrg#
21216758a055Smrg# Documentation tools are not always available on all platforms and sometimes
21226758a055Smrg# not at the appropriate level. This macro enables a builder to skip all
21236758a055Smrg# documentation targets except traditional man pages.
21246758a055Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21256758a055Smrg# maximum flexibilty in controlling documentation building.
21266758a055Smrg# Refer to:
21276758a055Smrg# XORG_WITH_XMLTO         --with-xmlto
21286758a055Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21296758a055Smrg# XORG_WITH_DOXYGEN       --with-doxygen
21306758a055Smrg# XORG_WITH_FOP           --with-fop
21316758a055Smrg# XORG_WITH_GROFF         --with-groff
21326758a055Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
21336758a055Smrg#
21346758a055Smrg# Interface to module:
21356758a055Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
21366758a055Smrg# --enable-docs: 'yes' user instructs the module to generate docs
21376758a055Smrg#		 'no' user instructs the module not to generate docs
21386758a055Smrg# parm1:	specify the default value, yes or no.
21396758a055Smrg#
21406758a055SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
21416758a055Smrgm4_define([docs_default], m4_default([$1], [yes]))
21426758a055SmrgAC_ARG_ENABLE(docs,
21436758a055Smrg	AS_HELP_STRING([--enable-docs],
21446758a055Smrg	   [Enable building the documentation (default: ]docs_default[)]),
21456758a055Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
21466758a055Smrgm4_undefine([docs_default])
21476758a055SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
21486758a055SmrgAC_MSG_CHECKING([whether to build documentation])
21496758a055SmrgAC_MSG_RESULT([$build_docs])
21506758a055Smrg]) # XORG_ENABLE_DOCS
21516758a055Smrg
21526758a055Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
21536758a055Smrg# ----------------
21546758a055Smrg# Minimum version: 1.6.0
21556758a055Smrg#
21566758a055Smrg# This macro enables a builder to skip all developer documentation.
21576758a055Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21586758a055Smrg# maximum flexibilty in controlling documentation building.
21596758a055Smrg# Refer to:
21606758a055Smrg# XORG_WITH_XMLTO         --with-xmlto
21616758a055Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21626758a055Smrg# XORG_WITH_DOXYGEN       --with-doxygen
21636758a055Smrg# XORG_WITH_FOP           --with-fop
21646758a055Smrg# XORG_WITH_GROFF         --with-groff
21656758a055Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
21666758a055Smrg#
21676758a055Smrg# Interface to module:
21686758a055Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
21696758a055Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
21706758a055Smrg#			'no' user instructs the module not to generate developer docs
21716758a055Smrg# parm1:		specify the default value, yes or no.
21726758a055Smrg#
21736758a055SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
21746758a055Smrgm4_define([devel_default], m4_default([$1], [yes]))
21756758a055SmrgAC_ARG_ENABLE(devel-docs,
21766758a055Smrg	AS_HELP_STRING([--enable-devel-docs],
21776758a055Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
21786758a055Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
21796758a055Smrgm4_undefine([devel_default])
21806758a055SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
21816758a055SmrgAC_MSG_CHECKING([whether to build developer documentation])
21826758a055SmrgAC_MSG_RESULT([$build_devel_docs])
21836758a055Smrg]) # XORG_ENABLE_DEVEL_DOCS
21846758a055Smrg
21856758a055Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
21866758a055Smrg# ----------------
21876758a055Smrg# Minimum version: 1.6.0
21886758a055Smrg#
21896758a055Smrg# This macro enables a builder to skip all functional specification targets.
21906758a055Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
21916758a055Smrg# maximum flexibilty in controlling documentation building.
21926758a055Smrg# Refer to:
21936758a055Smrg# XORG_WITH_XMLTO         --with-xmlto
21946758a055Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
21956758a055Smrg# XORG_WITH_DOXYGEN       --with-doxygen
21966758a055Smrg# XORG_WITH_FOP           --with-fop
21976758a055Smrg# XORG_WITH_GROFF         --with-groff
21986758a055Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
21996758a055Smrg#
22006758a055Smrg# Interface to module:
22016758a055Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
22026758a055Smrg# --enable-specs:	'yes' user instructs the module to generate specs
22036758a055Smrg#			'no' user instructs the module not to generate specs
22046758a055Smrg# parm1:		specify the default value, yes or no.
22056758a055Smrg#
22066758a055SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
22076758a055Smrgm4_define([spec_default], m4_default([$1], [yes]))
22086758a055SmrgAC_ARG_ENABLE(specs,
22096758a055Smrg	AS_HELP_STRING([--enable-specs],
22106758a055Smrg	   [Enable building the specs (default: ]spec_default[)]),
22116758a055Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
22126758a055Smrgm4_undefine([spec_default])
22136758a055SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
22146758a055SmrgAC_MSG_CHECKING([whether to build functional specifications])
22156758a055SmrgAC_MSG_RESULT([$build_specs])
22166758a055Smrg]) # XORG_ENABLE_SPECS
22176758a055Smrg
22186758a055Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
22196758a055Smrg# ----------------------------------------------
22206758a055Smrg# Minimum version: 1.13.0
22216758a055Smrg#
22226758a055Smrg# This macro enables a builder to enable/disable unit testing
22236758a055Smrg# It makes no assumption about the test cases implementation
22246758a055Smrg# Test cases may or may not use Automake "Support for test suites"
22256758a055Smrg# They may or may not use the software utility library GLib
22266758a055Smrg#
22276758a055Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
22286758a055Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
22296758a055Smrg# The variable enable_unit_tests is used by other macros in this file.
22306758a055Smrg#
22316758a055Smrg# Interface to module:
22326758a055Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
22336758a055Smrg# enable_unit_tests:    used in configure.ac for additional configuration
22346758a055Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
22356758a055Smrg#			'no' user instructs the module not to build tests
22366758a055Smrg# parm1:		specify the default value, yes or no.
22376758a055Smrg#
22386758a055SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
22396758a055SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
22406758a055SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
22416758a055SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
22426758a055Smrgm4_define([_defopt], m4_default([$1], [auto]))
22436758a055SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
22446758a055Smrg	[Enable building unit test cases (default: ]_defopt[)]),
22456758a055Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
22466758a055Smrgm4_undefine([_defopt])
22476758a055SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
22486758a055SmrgAC_MSG_CHECKING([whether to build unit test cases])
22496758a055SmrgAC_MSG_RESULT([$enable_unit_tests])
22506758a055Smrg]) # XORG_ENABLE_UNIT_TESTS
22516758a055Smrg
22526758a055Smrg# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
22536758a055Smrg# ------------------------------------------------------
22546758a055Smrg# Minimum version: 1.17.0
22556758a055Smrg#
22566758a055Smrg# This macro enables a builder to enable/disable integration testing
22576758a055Smrg# It makes no assumption about the test cases' implementation
22586758a055Smrg# Test cases may or may not use Automake "Support for test suites"
22596758a055Smrg#
22606758a055Smrg# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
22616758a055Smrg# usually requires less dependencies and may be built and run under less
22626758a055Smrg# stringent environments than integration tests.
22636758a055Smrg#
22646758a055Smrg# Interface to module:
22656758a055Smrg# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
22666758a055Smrg# enable_integration_tests:   used in configure.ac for additional configuration
22676758a055Smrg# --enable-integration-tests: 'yes' user instructs the module to build tests
22686758a055Smrg#                             'no' user instructs the module not to build tests
22696758a055Smrg# parm1:                      specify the default value, yes or no.
22706758a055Smrg#
22716758a055SmrgAC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
22726758a055SmrgAC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
22736758a055Smrgm4_define([_defopt], m4_default([$1], [auto]))
22746758a055SmrgAC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
22756758a055Smrg	[Enable building integration test cases (default: ]_defopt[)]),
22766758a055Smrg	[enable_integration_tests=$enableval],
22776758a055Smrg	[enable_integration_tests=]_defopt)
22786758a055Smrgm4_undefine([_defopt])
22796758a055SmrgAM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
22806758a055Smrg	[test "x$enable_integration_tests" != xno])
22816758a055SmrgAC_MSG_CHECKING([whether to build unit test cases])
22826758a055SmrgAC_MSG_RESULT([$enable_integration_tests])
22836758a055Smrg]) # XORG_ENABLE_INTEGRATION_TESTS
22846758a055Smrg
22856758a055Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
22866758a055Smrg# ----------------------------------------
22876758a055Smrg# Minimum version: 1.13.0
22886758a055Smrg#
22896758a055Smrg# GLib is a library which provides advanced data structures and functions.
22906758a055Smrg# This macro enables a module to test for the presence of Glib.
22916758a055Smrg#
22926758a055Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
22936758a055Smrg# Otherwise the value of $enable_unit_tests is blank.
22946758a055Smrg#
22956758a055Smrg# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
22966758a055Smrg# test support usually requires less dependencies and may be built and run under
22976758a055Smrg# less stringent environments than integration tests.
22986758a055Smrg#
22996758a055Smrg# Interface to module:
23006758a055Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
23016758a055Smrg# with_glib: used in configure.ac to know if GLib has been found
23026758a055Smrg# --with-glib:	'yes' user instructs the module to use glib
23036758a055Smrg#		'no' user instructs the module not to use glib
23046758a055Smrg#
23056758a055SmrgAC_DEFUN([XORG_WITH_GLIB],[
23066758a055SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
23076758a055Smrgm4_define([_defopt], m4_default([$2], [auto]))
23086758a055SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
23096758a055Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
23106758a055Smrg	[with_glib=$withval], [with_glib=]_defopt)
23116758a055Smrgm4_undefine([_defopt])
23126758a055Smrg
23136758a055Smrghave_glib=no
23146758a055Smrg# Do not probe GLib if user explicitly disabled unit testing
23156758a055Smrgif test "x$enable_unit_tests" != x"no"; then
23166758a055Smrg  # Do not probe GLib if user explicitly disabled it
23176758a055Smrg  if test "x$with_glib" != x"no"; then
23186758a055Smrg    m4_ifval(
23196758a055Smrg      [$1],
23206758a055Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
23216758a055Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
23226758a055Smrg    )
23236758a055Smrg  fi
23246758a055Smrgfi
23256758a055Smrg
23266758a055Smrg# Not having GLib when unit testing has been explicitly requested is an error
23276758a055Smrgif test "x$enable_unit_tests" = x"yes"; then
23286758a055Smrg  if test "x$have_glib" = x"no"; then
23296758a055Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
23306758a055Smrg  fi
23316758a055Smrgfi
23326758a055Smrg
23336758a055Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
23346758a055Smrgif test "x$enable_unit_tests" = x"no"; then
23356758a055Smrg  if test "x$with_glib" = x"yes"; then
23366758a055Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
23376758a055Smrg  fi
23386758a055Smrgfi
23396758a055Smrg
23406758a055Smrg# Not having GLib when it has been explicitly requested is an error
23416758a055Smrgif test "x$with_glib" = x"yes"; then
23426758a055Smrg  if test "x$have_glib" = x"no"; then
23436758a055Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
23446758a055Smrg  fi
23456758a055Smrgfi
23466758a055Smrg
23476758a055SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
23486758a055Smrg]) # XORG_WITH_GLIB
23496758a055Smrg
23506758a055Smrg# XORG_LD_WRAP([required|optional])
23516758a055Smrg# ---------------------------------
23526758a055Smrg# Minimum version: 1.13.0
23536758a055Smrg#
23546758a055Smrg# Check if linker supports -wrap, passed via compiler flags
23556758a055Smrg#
23566758a055Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
23576758a055Smrg# Otherwise the value of $enable_unit_tests is blank.
23586758a055Smrg#
23596758a055Smrg# Argument added in 1.16.0 - default is "required", to match existing behavior
23606758a055Smrg# of returning an error if enable_unit_tests is yes, and ld -wrap is not
23616758a055Smrg# available, an argument of "optional" allows use when some unit tests require
23626758a055Smrg# ld -wrap and others do not.
23636758a055Smrg#
23646758a055SmrgAC_DEFUN([XORG_LD_WRAP],[
23656758a055SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
23666758a055Smrg    [AC_LANG_PROGRAM([#include <stdlib.h>
23676758a055Smrg                      void __wrap_exit(int status) { return; }],
23686758a055Smrg                     [exit(0);])])
23696758a055Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
23706758a055Smrgif test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
23716758a055Smrg  if test "x$have_ld_wrap" = x"no"; then
23726758a055Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
23736758a055Smrg  fi
23746758a055Smrgfi
23756758a055SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
23766758a055Smrg#
23776758a055Smrg]) # XORG_LD_WRAP
23786758a055Smrg
23796758a055Smrg# XORG_CHECK_LINKER_FLAGS
23806758a055Smrg# -----------------------
23816758a055Smrg# SYNOPSIS
23826758a055Smrg#
23836758a055Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
23846758a055Smrg#
23856758a055Smrg# DESCRIPTION
23866758a055Smrg#
23876758a055Smrg#   Check whether the given linker FLAGS work with the current language's
23886758a055Smrg#   linker, or whether they give an error.
23896758a055Smrg#
23906758a055Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
23916758a055Smrg#   success/failure.
23926758a055Smrg#
23936758a055Smrg#   PROGRAM-SOURCE is the program source to link with, if needed
23946758a055Smrg#
23956758a055Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
23966758a055Smrg#
23976758a055Smrg# LICENSE
23986758a055Smrg#
23996758a055Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
24006758a055Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
24016758a055Smrg#   Copyright (c) 2009 Matteo Frigo
24026758a055Smrg#
24036758a055Smrg#   This program is free software: you can redistribute it and/or modify it
24046758a055Smrg#   under the terms of the GNU General Public License as published by the
24056758a055Smrg#   Free Software Foundation, either version 3 of the License, or (at your
24066758a055Smrg#   option) any later version.
24076758a055Smrg#
24086758a055Smrg#   This program is distributed in the hope that it will be useful, but
24096758a055Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
24106758a055Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
24116758a055Smrg#   Public License for more details.
24126758a055Smrg#
24136758a055Smrg#   You should have received a copy of the GNU General Public License along
24146758a055Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
24156758a055Smrg#
24166758a055Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
24176758a055Smrg#   gives unlimited permission to copy, distribute and modify the configure
24186758a055Smrg#   scripts that are the output of Autoconf when processing the Macro. You
24196758a055Smrg#   need not follow the terms of the GNU General Public License when using
24206758a055Smrg#   or distributing such scripts, even though portions of the text of the
24216758a055Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
24226758a055Smrg#   all other use of the material that constitutes the Autoconf Macro.
24236758a055Smrg#
24246758a055Smrg#   This special exception to the GPL applies to versions of the Autoconf
24256758a055Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
24266758a055Smrg#   modified version of the Autoconf Macro, you may extend this special
24276758a055Smrg#   exception to the GPL to apply to your modified version as well.#
24286758a055SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
24296758a055Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
24306758a055Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
24316758a055SmrgAS_LITERAL_IF([$1],
24326758a055Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
24336758a055Smrg      ax_save_FLAGS=$LDFLAGS
24346758a055Smrg      LDFLAGS="$1"
24356758a055Smrg      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
24366758a055Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
24376758a055Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
24386758a055Smrg      LDFLAGS=$ax_save_FLAGS])],
24396758a055Smrg  [ax_save_FLAGS=$LDFLAGS
24406758a055Smrg   LDFLAGS="$1"
24416758a055Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
24426758a055Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
24436758a055Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
24446758a055Smrg   LDFLAGS=$ax_save_FLAGS])
24456758a055Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
24466758a055SmrgAC_MSG_RESULT($xorg_check_linker_flags)
24476758a055Smrgif test "x$xorg_check_linker_flags" = xyes; then
24486758a055Smrg	m4_default([$2], :)
24496758a055Smrgelse
24506758a055Smrg	m4_default([$3], :)
24516758a055Smrgfi
24526758a055Smrg]) # XORG_CHECK_LINKER_FLAGS
24536758a055Smrg
24546758a055Smrg# XORG_MEMORY_CHECK_FLAGS
24556758a055Smrg# -----------------------
24566758a055Smrg# Minimum version: 1.16.0
24576758a055Smrg#
24586758a055Smrg# This macro attempts to find appropriate memory checking functionality
24596758a055Smrg# for various platforms which unit testing code may use to catch various
24606758a055Smrg# forms of memory allocation and access errors in testing.
24616758a055Smrg#
24626758a055Smrg# Interface to module:
24636758a055Smrg# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
24646758a055Smrg#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
24656758a055Smrg#
24666758a055Smrg# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
24676758a055Smrg#
24686758a055SmrgAC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
24696758a055Smrg
24706758a055SmrgAC_REQUIRE([AC_CANONICAL_HOST])
24716758a055SmrgAC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
24726758a055Smrg           [Environment variables to enable memory checking in tests])
24736758a055Smrg
24746758a055Smrg# Check for different types of support on different platforms
24756758a055Smrgcase $host_os in
24766758a055Smrg    solaris*)
24776758a055Smrg        AC_CHECK_LIB([umem], [umem_alloc],
24786758a055Smrg            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
24796758a055Smrg        ;;
24806758a055Smrg    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
24816758a055Smrg        # both directly and inverted, so should not be 0 or 255.
24826758a055Smrg        malloc_debug_env='MALLOC_PERTURB_=15'
24836758a055Smrg        ;;
24846758a055Smrg    darwin*)
24856758a055Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
24866758a055Smrg        ;;
24876758a055Smrg    *bsd*)
24886758a055Smrg        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
24896758a055Smrg        ;;
24906758a055Smrgesac
24916758a055Smrg
24926758a055Smrg# User supplied flags override default flags
24936758a055Smrgif test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
24946758a055Smrg    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
24956758a055Smrgfi
24966758a055Smrg
24976758a055SmrgAC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
24986758a055Smrg]) # XORG_WITH_LINT
24996758a055Smrg
25006758a055Smrg# XORG_CHECK_MALLOC_ZERO
25016758a055Smrg# ----------------------
25026758a055Smrg# Minimum version: 1.0.0
25036758a055Smrg#
25046758a055Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
25056758a055Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
25066758a055Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
25076758a055SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
25086758a055SmrgAC_ARG_ENABLE(malloc0returnsnull,
25096758a055Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
25106758a055Smrg		       [malloc(0) returns NULL (default: auto)]),
25116758a055Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
25126758a055Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
25136758a055Smrg
25146758a055SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
25156758a055Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
25166758a055Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
25176758a055Smrg#include <stdlib.h>
25186758a055Smrg],[
25196758a055Smrg    char *m0, *r0, *c0, *p;
25206758a055Smrg    m0 = malloc(0);
25216758a055Smrg    p = malloc(10);
25226758a055Smrg    r0 = realloc(p,0);
25236758a055Smrg    c0 = calloc(0,10);
25246758a055Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
25256758a055Smrg])],
25266758a055Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
25276758a055Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
25286758a055Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
25296758a055Smrgfi
25306758a055SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
25316758a055Smrg
25326758a055Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
25336758a055Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
25346758a055Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
25356758a055Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
25366758a055Smrgelse
25376758a055Smrg	MALLOC_ZERO_CFLAGS=""
25386758a055Smrg	XMALLOC_ZERO_CFLAGS=""
25396758a055Smrg	XTMALLOC_ZERO_CFLAGS=""
25406758a055Smrgfi
25416758a055Smrg
25426758a055SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
25436758a055SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
25446758a055SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
25456758a055Smrg]) # XORG_CHECK_MALLOC_ZERO
25466758a055Smrg
25476758a055Smrg# XORG_WITH_LINT()
25486758a055Smrg# ----------------
25496758a055Smrg# Minimum version: 1.1.0
25506758a055Smrg#
25516758a055Smrg# This macro enables the use of a tool that flags some suspicious and
25526758a055Smrg# non-portable constructs (likely to be bugs) in C language source code.
25536758a055Smrg# It will attempt to locate the tool and use appropriate options.
25546758a055Smrg# There are various lint type tools on different platforms.
25556758a055Smrg#
25566758a055Smrg# Interface to module:
25576758a055Smrg# LINT:		returns the path to the tool found on the platform
25586758a055Smrg#		or the value set to LINT on the configure cmd line
25596758a055Smrg#		also an Automake conditional
25606758a055Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
25616758a055Smrg#
25626758a055Smrg# --with-lint:	'yes' user instructs the module to use lint
25636758a055Smrg#		'no' user instructs the module not to use lint (default)
25646758a055Smrg#
25656758a055Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
25666758a055Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
25676758a055Smrg#
25686758a055SmrgAC_DEFUN([XORG_WITH_LINT],[
25696758a055Smrg
25706758a055SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
25716758a055SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
257214ddf674SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
257314ddf674Smrg		[Use a lint-style source code checker (default: disabled)])],
257414ddf674Smrg		[use_lint=$withval], [use_lint=no])
25756758a055Smrg
25766758a055Smrg# Obtain platform specific info like program name and options
25776758a055Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
25786758a055Smrgcase $host_os in
25796758a055Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
25806758a055Smrg	lint_name=splint
25816758a055Smrg	lint_options="-badflag"
25826758a055Smrg	;;
25836758a055Smrg  *freebsd* | *netbsd*)
25846758a055Smrg	lint_name=lint
25856758a055Smrg	lint_options="-u -b"
25866758a055Smrg	;;
25876758a055Smrg  *solaris*)
25886758a055Smrg	lint_name=lint
25896758a055Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
25906758a055Smrg	;;
25916758a055Smrgesac
25926758a055Smrg
25936758a055Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
25946758a055Smrgif test "x$use_lint" = x"yes" ; then
25956758a055Smrg   AC_PATH_PROG([LINT], [$lint_name])
25966758a055Smrg   if test "x$LINT" = "x"; then
25976758a055Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
25986758a055Smrg   fi
25996758a055Smrgelif test "x$use_lint" = x"no" ; then
26006758a055Smrg   if test "x$LINT" != "x"; then
26016758a055Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
26026758a055Smrg   fi
260314ddf674Smrgelse
26046758a055Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
260514ddf674Smrgfi
26066758a055Smrg
26076758a055Smrg# User supplied flags override default flags
26086758a055Smrgif test "x$LINT_FLAGS" != "x"; then
26096758a055Smrg   lint_options=$LINT_FLAGS
261014ddf674Smrgfi
261114ddf674Smrg
26126758a055SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
26136758a055SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
261414ddf674Smrg
261514ddf674Smrg]) # XORG_WITH_LINT
261614ddf674Smrg
261714ddf674Smrg# XORG_LINT_LIBRARY(LIBNAME)
261814ddf674Smrg# --------------------------
261914ddf674Smrg# Minimum version: 1.1.0
262014ddf674Smrg#
262114ddf674Smrg# Sets up flags for building lint libraries for checking programs that call
262214ddf674Smrg# functions in the library.
262314ddf674Smrg#
26246758a055Smrg# Interface to module:
26256758a055Smrg# LINTLIB		- Automake variable with the name of lint library file to make
26266758a055Smrg# MAKE_LINT_LIB		- Automake conditional
26276758a055Smrg#
26286758a055Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
26296758a055Smrg#			  - 'no' user instructs the module not to create a lint library (default)
263014ddf674Smrg
263114ddf674SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
263214ddf674SmrgAC_REQUIRE([XORG_WITH_LINT])
263314ddf674SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
263414ddf674Smrg	[Create lint library (default: disabled)])],
263514ddf674Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
26366758a055Smrg
26376758a055Smrgif test "x$make_lint_lib" = x"yes" ; then
26386758a055Smrg   LINTLIB=llib-l$1.ln
26396758a055Smrg   if test "x$LINT" = "x"; then
26406758a055Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
26416758a055Smrg   fi
26426758a055Smrgelif test "x$make_lint_lib" != x"no" ; then
26436758a055Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
264414ddf674Smrgfi
26456758a055Smrg
264614ddf674SmrgAC_SUBST(LINTLIB)
264714ddf674SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
264814ddf674Smrg
264914ddf674Smrg]) # XORG_LINT_LIBRARY
265014ddf674Smrg
26516758a055Smrg# XORG_COMPILER_BRAND
26526758a055Smrg# -------------------
26536758a055Smrg# Minimum version: 1.14.0
26546758a055Smrg#
26556758a055Smrg# Checks for various brands of compilers and sets flags as appropriate:
26566758a055Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
26576758a055Smrg#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
26586758a055Smrg#   clang compiler - sets CLANGCC to "yes"
26596758a055Smrg#   Intel compiler - sets INTELCC to "yes"
26606758a055Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
26616758a055Smrg#
26626758a055SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
26636758a055SmrgAC_LANG_CASE(
26646758a055Smrg	[C], [
26656758a055Smrg		AC_REQUIRE([AC_PROG_CC_C99])
26666758a055Smrg	],
26676758a055Smrg	[C++], [
26686758a055Smrg		AC_REQUIRE([AC_PROG_CXX])
26696758a055Smrg	]
26706758a055Smrg)
26716758a055SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
26726758a055SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
26736758a055SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
26746758a055Smrg]) # XORG_COMPILER_BRAND
26756758a055Smrg
26766758a055Smrg# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
26776758a055Smrg# ---------------
26786758a055Smrg# Minimum version: 1.16.0
26796758a055Smrg#
26806758a055Smrg# Test if the compiler works when passed the given flag as a command line argument.
26816758a055Smrg# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
26826758a055Smrg# next flag in the list until there are no more options.
26836758a055Smrg#
26846758a055Smrg# Note that this does not guarantee that the compiler supports the flag as some
26856758a055Smrg# compilers will simply ignore arguments that they do not understand, but we do
26866758a055Smrg# attempt to weed out false positives by using -Werror=unknown-warning-option and
26876758a055Smrg# -Werror=unused-command-line-argument
26886758a055Smrg#
26896758a055SmrgAC_DEFUN([XORG_TESTSET_CFLAG], [
26906758a055Smrgm4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
26916758a055Smrgm4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
26926758a055Smrg
26936758a055SmrgAC_LANG_COMPILER_REQUIRE
26946758a055Smrg
26956758a055SmrgAC_LANG_CASE(
26966758a055Smrg	[C], [
26976758a055Smrg		AC_REQUIRE([AC_PROG_CC_C99])
26986758a055Smrg		define([PREFIX], [C])
26996758a055Smrg		define([CACHE_PREFIX], [cc])
27006758a055Smrg		define([COMPILER], [$CC])
27016758a055Smrg	],
27026758a055Smrg	[C++], [
27036758a055Smrg		define([PREFIX], [CXX])
27046758a055Smrg		define([CACHE_PREFIX], [cxx])
27056758a055Smrg		define([COMPILER], [$CXX])
27066758a055Smrg	]
27076758a055Smrg)
27086758a055Smrg
27096758a055Smrg[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
27106758a055Smrg
27116758a055Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
27126758a055Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
27136758a055Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
27146758a055Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
27156758a055Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
27166758a055Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
27176758a055Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
27186758a055Smrg	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
27196758a055Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
27206758a055Smrgfi
27216758a055Smrg
27226758a055Smrgif test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
27236758a055Smrg	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
27246758a055Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
27256758a055Smrg	fi
27266758a055Smrg	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
27276758a055Smrg	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
27286758a055Smrg			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
27296758a055Smrg			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
27306758a055Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
27316758a055Smrg					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
27326758a055Smrg	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
27336758a055Smrg	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
27346758a055Smrgfi
27356758a055Smrg
27366758a055Smrgfound="no"
27376758a055Smrgm4_foreach([flag], m4_cdr($@), [
27386758a055Smrg	if test $found = "no" ; then
27396758a055Smrg		if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
27406758a055Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
27416758a055Smrg		fi
27426758a055Smrg
27436758a055Smrg		if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
27446758a055Smrg			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
27456758a055Smrg		fi
27466758a055Smrg
27476758a055Smrg		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
27486758a055Smrg
27496758a055Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
27506758a055Smrg		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
27516758a055Smrg		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
27526758a055Smrg		AC_CACHE_VAL($cacheid,
27536758a055Smrg			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
27546758a055Smrg					     [eval $cacheid=yes],
27556758a055Smrg					     [eval $cacheid=no])])
27566758a055Smrg
27576758a055Smrg		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
27586758a055Smrg
27596758a055Smrg		eval supported=\$$cacheid
27606758a055Smrg		AC_MSG_RESULT([$supported])
27616758a055Smrg		if test "$supported" = "yes" ; then
27626758a055Smrg			$1="$$1 ]flag["
27636758a055Smrg			found="yes"
27646758a055Smrg		fi
27656758a055Smrg	fi
27666758a055Smrg])
27676758a055Smrg]) # XORG_TESTSET_CFLAG
27686758a055Smrg
27696758a055Smrg# XORG_COMPILER_FLAGS
27706758a055Smrg# ---------------
27716758a055Smrg# Minimum version: 1.16.0
27726758a055Smrg#
27736758a055Smrg# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
27746758a055Smrg# arguments supported by the selected compiler which do NOT alter the generated
27756758a055Smrg# code.  These arguments will cause the compiler to print various warnings
27766758a055Smrg# during compilation AND turn a conservative set of warnings into errors.
27776758a055Smrg#
27786758a055Smrg# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
27796758a055Smrg# future versions of util-macros as options are added to new compilers.
27806758a055Smrg#
27816758a055SmrgAC_DEFUN([XORG_COMPILER_FLAGS], [
27826758a055SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
27836758a055Smrg
27846758a055SmrgAC_ARG_ENABLE(selective-werror,
27856758a055Smrg              AS_HELP_STRING([--disable-selective-werror],
27866758a055Smrg                             [Turn off selective compiler errors. (default: enabled)]),
27876758a055Smrg              [SELECTIVE_WERROR=$enableval],
27886758a055Smrg              [SELECTIVE_WERROR=yes])
27896758a055Smrg
27906758a055SmrgAC_LANG_CASE(
27916758a055Smrg        [C], [
27926758a055Smrg                define([PREFIX], [C])
27936758a055Smrg        ],
27946758a055Smrg        [C++], [
27956758a055Smrg                define([PREFIX], [CXX])
27966758a055Smrg        ]
27976758a055Smrg)
27986758a055Smrg# -v is too short to test reliably with XORG_TESTSET_CFLAG
27996758a055Smrgif test "x$SUNCC" = "xyes"; then
28006758a055Smrg    [BASE_]PREFIX[FLAGS]="-v"
28016758a055Smrgelse
28026758a055Smrg    [BASE_]PREFIX[FLAGS]=""
28036758a055Smrgfi
28046758a055Smrg
28056758a055Smrg# This chunk of warnings were those that existed in the legacy CWARNFLAGS
28066758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
28076758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
28086758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
28096758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
28106758a055Smrg
28116758a055SmrgAC_LANG_CASE(
28126758a055Smrg	[C], [
28136758a055Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
28146758a055Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
28156758a055Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
28166758a055Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
28176758a055Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
28186758a055Smrg		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
28196758a055Smrg	]
28206758a055Smrg)
28216758a055Smrg
28226758a055Smrg# This chunk adds additional warnings that could catch undesired effects.
28236758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
28246758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
28256758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
28266758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
28276758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
28286758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
28296758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
28306758a055Smrg
28316758a055Smrg# These are currently disabled because they are noisy.  They will be enabled
28326758a055Smrg# in the future once the codebase is sufficiently modernized to silence
28336758a055Smrg# them.  For now, I don't want them to drown out the other warnings.
28346758a055Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
28356758a055Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
28366758a055Smrg# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
28376758a055Smrg
28386758a055Smrg# Turn some warnings into errors, so we don't accidently get successful builds
28396758a055Smrg# when there are problems that should be fixed.
28406758a055Smrg
28416758a055Smrgif test "x$SELECTIVE_WERROR" = "xyes" ; then
28426758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
28436758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
28446758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
28456758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
28466758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
28476758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
28486758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
28496758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
28506758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
28516758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
28526758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
28536758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
28546758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
28556758a055Smrgelse
28566758a055SmrgAC_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])
28576758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
28586758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
28596758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
28606758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
28616758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
28626758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
28636758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
28646758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
28656758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
28666758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
28676758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
28686758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
28696758a055SmrgXORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
28706758a055Smrgfi
28716758a055Smrg
28726758a055SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
28736758a055Smrg]) # XORG_COMPILER_FLAGS
28746758a055Smrg
287514ddf674Smrg# XORG_CWARNFLAGS
287614ddf674Smrg# ---------------
287714ddf674Smrg# Minimum version: 1.2.0
28786758a055Smrg# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
287914ddf674Smrg#
288014ddf674Smrg# Defines CWARNFLAGS to enable C compiler warnings.
288114ddf674Smrg#
28826758a055Smrg# This function is deprecated because it defines -fno-strict-aliasing
28836758a055Smrg# which alters the code generated by the compiler.  If -fno-strict-aliasing
28846758a055Smrg# is needed, then it should be added explicitly in the module when
28856758a055Smrg# it is updated to use BASE_CFLAGS.
28866758a055Smrg#
288714ddf674SmrgAC_DEFUN([XORG_CWARNFLAGS], [
28886758a055SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
28896758a055SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
28906758a055SmrgAC_LANG_CASE(
28916758a055Smrg	[C], [
28926758a055Smrg		CWARNFLAGS="$BASE_CFLAGS"
28936758a055Smrg		if  test "x$GCC" = xyes ; then
28946758a055Smrg		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
28956758a055Smrg		fi
28966758a055Smrg		AC_SUBST(CWARNFLAGS)
28976758a055Smrg	]
28986758a055Smrg)
289914ddf674Smrg]) # XORG_CWARNFLAGS
290014ddf674Smrg
290114ddf674Smrg# XORG_STRICT_OPTION
290214ddf674Smrg# -----------------------
290314ddf674Smrg# Minimum version: 1.3.0
290414ddf674Smrg#
29056758a055Smrg# Add configure option to enable strict compilation flags, such as treating
29066758a055Smrg# warnings as fatal errors.
29076758a055Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
29086758a055Smrg# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
29096758a055Smrg#
29106758a055Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
29116758a055Smrg# when strict compilation is unconditionally desired.
291214ddf674SmrgAC_DEFUN([XORG_STRICT_OPTION], [
291314ddf674SmrgAC_REQUIRE([XORG_CWARNFLAGS])
29146758a055SmrgAC_REQUIRE([XORG_COMPILER_FLAGS])
291514ddf674Smrg
291614ddf674SmrgAC_ARG_ENABLE(strict-compilation,
291714ddf674Smrg			  AS_HELP_STRING([--enable-strict-compilation],
291814ddf674Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
291914ddf674Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
29206758a055Smrg
29216758a055SmrgAC_LANG_CASE(
29226758a055Smrg        [C], [
29236758a055Smrg                define([PREFIX], [C])
29246758a055Smrg        ],
29256758a055Smrg        [C++], [
29266758a055Smrg                define([PREFIX], [CXX])
29276758a055Smrg        ]
29286758a055Smrg)
29296758a055Smrg
29306758a055Smrg[STRICT_]PREFIX[FLAGS]=""
29316758a055SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
29326758a055SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
29336758a055Smrg
29346758a055Smrg# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
29356758a055Smrg# activate it with -Werror, so we add it here explicitly.
29366758a055SmrgXORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
29376758a055Smrg
293814ddf674Smrgif test "x$STRICT_COMPILE" = "xyes"; then
29396758a055Smrg    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
29406758a055Smrg    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
294114ddf674Smrgfi
29426758a055SmrgAC_SUBST([STRICT_]PREFIX[FLAGS])
29436758a055SmrgAC_SUBST([BASE_]PREFIX[FLAGS])
29446758a055SmrgAC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
294514ddf674Smrg]) # XORG_STRICT_OPTION
294614ddf674Smrg
294714ddf674Smrg# XORG_DEFAULT_OPTIONS
294814ddf674Smrg# --------------------
294914ddf674Smrg# Minimum version: 1.3.0
295014ddf674Smrg#
295114ddf674Smrg# Defines default options for X.Org modules.
295214ddf674Smrg#
295314ddf674SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
29546758a055SmrgAC_REQUIRE([AC_PROG_INSTALL])
29556758a055SmrgXORG_COMPILER_FLAGS
295614ddf674SmrgXORG_CWARNFLAGS
295714ddf674SmrgXORG_STRICT_OPTION
295814ddf674SmrgXORG_RELEASE_VERSION
295914ddf674SmrgXORG_CHANGELOG
296014ddf674SmrgXORG_INSTALL
296114ddf674SmrgXORG_MANPAGE_SECTIONS
29626758a055Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
29636758a055Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
296414ddf674Smrg]) # XORG_DEFAULT_OPTIONS
296514ddf674Smrg
296614ddf674Smrg# XORG_INSTALL()
296714ddf674Smrg# ----------------
296814ddf674Smrg# Minimum version: 1.4.0
296914ddf674Smrg#
297014ddf674Smrg# Defines the variable INSTALL_CMD as the command to copy
297114ddf674Smrg# INSTALL from $prefix/share/util-macros.
297214ddf674Smrg#
297314ddf674SmrgAC_DEFUN([XORG_INSTALL], [
297414ddf674SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
297514ddf674Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
297614ddf674SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
297714ddf674Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
297814ddf674Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
297914ddf674Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
298014ddf674SmrgAC_SUBST([INSTALL_CMD])
298114ddf674Smrg]) # XORG_INSTALL
2982cacd992dSmrgdnl Copyright 2005 Red Hat, Inc
2983cacd992dSmrgdnl
2984cacd992dSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
2985cacd992dSmrgdnl documentation for any purpose is hereby granted without fee, provided that
2986cacd992dSmrgdnl the above copyright notice appear in all copies and that both that
2987cacd992dSmrgdnl copyright notice and this permission notice appear in supporting
2988cacd992dSmrgdnl documentation.
2989cacd992dSmrgdnl
2990cacd992dSmrgdnl The above copyright notice and this permission notice shall be included
2991cacd992dSmrgdnl in all copies or substantial portions of the Software.
2992cacd992dSmrgdnl
2993cacd992dSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2994cacd992dSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2995cacd992dSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2996cacd992dSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
2997cacd992dSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2998cacd992dSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2999cacd992dSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
3000cacd992dSmrgdnl
3001cacd992dSmrgdnl Except as contained in this notice, the name of the copyright holders shall
3002cacd992dSmrgdnl not be used in advertising or otherwise to promote the sale, use or
3003cacd992dSmrgdnl other dealings in this Software without prior written authorization
3004cacd992dSmrgdnl from the copyright holders.
3005cacd992dSmrgdnl
3006cacd992dSmrg
3007cacd992dSmrg# XORG_RELEASE_VERSION
3008cacd992dSmrg# --------------------
30096758a055Smrg# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3010cacd992dSmrg 
3011cacd992dSmrgAC_DEFUN([XORG_RELEASE_VERSION],[
301214ddf674Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
301314ddf674Smrg		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
301414ddf674Smrg		[Major version of this package])
301514ddf674Smrg	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
301614ddf674Smrg	if test "x$PVM" = "x"; then
301714ddf674Smrg		PVM="0"
301814ddf674Smrg	fi
301914ddf674Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
302014ddf674Smrg		[$PVM],
302114ddf674Smrg		[Minor version of this package])
302214ddf674Smrg	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
302314ddf674Smrg	if test "x$PVP" = "x"; then
302414ddf674Smrg		PVP="0"
302514ddf674Smrg	fi
302614ddf674Smrg	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
302714ddf674Smrg		[$PVP],
302814ddf674Smrg		[Patch version of this package])
3029cacd992dSmrg])
3030cacd992dSmrg
303114ddf674Smrg# XORG_CHANGELOG()
303214ddf674Smrg# ----------------
303314ddf674Smrg# Minimum version: 1.2.0
303414ddf674Smrg#
303514ddf674Smrg# Defines the variable CHANGELOG_CMD as the command to generate
303614ddf674Smrg# ChangeLog from git.
303714ddf674Smrg#
303814ddf674Smrg#
303914ddf674SmrgAC_DEFUN([XORG_CHANGELOG], [
304014ddf674SmrgCHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
304114ddf674Smrgmv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
304214ddf674Smrg|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
304314ddf674Smrgecho 'git directory not found: installing possibly empty changelog.' >&2)"
304414ddf674SmrgAC_SUBST([CHANGELOG_CMD])
304514ddf674Smrg]) # XORG_CHANGELOG
304614ddf674Smrg
3047