aclocal.m4 revision f9c28e31
1# generated automatically by aclocal 1.16.2 -*- Autoconf -*-
2
3# Copyright (C) 1996-2020 Free Software Foundation, Inc.
4
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
13
14m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15m4_ifndef([AC_AUTOCONF_VERSION],
16  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
17m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
18[m4_warning([this file was generated for autoconf 2.69.
19You have another version of autoconf.  It may work, but is not guaranteed to.
20If you have problems, you may need to regenerate the build system entirely.
21To do so, use the procedure documented by the package, typically 'autoreconf'.])])
22
23# Copyright (C) 2002-2020 Free Software Foundation, Inc.
24#
25# This file is free software; the Free Software Foundation
26# gives unlimited permission to copy and/or distribute it,
27# with or without modifications, as long as this notice is preserved.
28
29# AM_AUTOMAKE_VERSION(VERSION)
30# ----------------------------
31# Automake X.Y traces this macro to ensure aclocal.m4 has been
32# generated from the m4 files accompanying Automake X.Y.
33# (This private macro should not be called outside this file.)
34AC_DEFUN([AM_AUTOMAKE_VERSION],
35[am__api_version='1.16'
36dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37dnl require some minimum version.  Point them to the right macro.
38m4_if([$1], [1.16.2], [],
39      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40])
41
42# _AM_AUTOCONF_VERSION(VERSION)
43# -----------------------------
44# aclocal traces this macro to find the Autoconf version.
45# This is a private macro too.  Using m4_define simplifies
46# the logic in aclocal, which can simply ignore this definition.
47m4_define([_AM_AUTOCONF_VERSION], [])
48
49# AM_SET_CURRENT_AUTOMAKE_VERSION
50# -------------------------------
51# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54[AM_AUTOMAKE_VERSION([1.16.2])dnl
55m4_ifndef([AC_AUTOCONF_VERSION],
56  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58
59# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60
61# Copyright (C) 2001-2020 Free Software Foundation, Inc.
62#
63# This file is free software; the Free Software Foundation
64# gives unlimited permission to copy and/or distribute it,
65# with or without modifications, as long as this notice is preserved.
66
67# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
68# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
69# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
70#
71# Of course, Automake must honor this variable whenever it calls a
72# tool from the auxiliary directory.  The problem is that $srcdir (and
73# therefore $ac_aux_dir as well) can be either absolute or relative,
74# depending on how configure is run.  This is pretty annoying, since
75# it makes $ac_aux_dir quite unusable in subdirectories: in the top
76# source directory, any form will work fine, but in subdirectories a
77# relative path needs to be adjusted first.
78#
79# $ac_aux_dir/missing
80#    fails when called from a subdirectory if $ac_aux_dir is relative
81# $top_srcdir/$ac_aux_dir/missing
82#    fails if $ac_aux_dir is absolute,
83#    fails when called from a subdirectory in a VPATH build with
84#          a relative $ac_aux_dir
85#
86# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
87# are both prefixed by $srcdir.  In an in-source build this is usually
88# harmless because $srcdir is '.', but things will broke when you
89# start a VPATH build or use an absolute $srcdir.
90#
91# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
92# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
93#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
94# and then we would define $MISSING as
95#   MISSING="\${SHELL} $am_aux_dir/missing"
96# This will work as long as MISSING is not called from configure, because
97# unfortunately $(top_srcdir) has no meaning in configure.
98# However there are other variables, like CC, which are often used in
99# configure, and could therefore not use this "fixed" $ac_aux_dir.
100#
101# Another solution, used here, is to always expand $ac_aux_dir to an
102# absolute PATH.  The drawback is that using absolute paths prevent a
103# configured tree to be moved without reconfiguration.
104
105AC_DEFUN([AM_AUX_DIR_EXPAND],
106[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107# Expand $ac_aux_dir to an absolute path.
108am_aux_dir=`cd "$ac_aux_dir" && pwd`
109])
110
111# AM_CONDITIONAL                                            -*- Autoconf -*-
112
113# Copyright (C) 1997-2020 Free Software Foundation, Inc.
114#
115# This file is free software; the Free Software Foundation
116# gives unlimited permission to copy and/or distribute it,
117# with or without modifications, as long as this notice is preserved.
118
119# AM_CONDITIONAL(NAME, SHELL-CONDITION)
120# -------------------------------------
121# Define a conditional.
122AC_DEFUN([AM_CONDITIONAL],
123[AC_PREREQ([2.52])dnl
124 m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
125       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
126AC_SUBST([$1_TRUE])dnl
127AC_SUBST([$1_FALSE])dnl
128_AM_SUBST_NOTMAKE([$1_TRUE])dnl
129_AM_SUBST_NOTMAKE([$1_FALSE])dnl
130m4_define([_AM_COND_VALUE_$1], [$2])dnl
131if $2; then
132  $1_TRUE=
133  $1_FALSE='#'
134else
135  $1_TRUE='#'
136  $1_FALSE=
137fi
138AC_CONFIG_COMMANDS_PRE(
139[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
140  AC_MSG_ERROR([[conditional "$1" was never defined.
141Usually this means the macro was only invoked conditionally.]])
142fi])])
143
144# Copyright (C) 1999-2020 Free Software Foundation, Inc.
145#
146# This file is free software; the Free Software Foundation
147# gives unlimited permission to copy and/or distribute it,
148# with or without modifications, as long as this notice is preserved.
149
150
151# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
152# written in clear, in which case automake, when reading aclocal.m4,
153# will think it sees a *use*, and therefore will trigger all it's
154# C support machinery.  Also note that it means that autoscan, seeing
155# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
156
157
158# _AM_DEPENDENCIES(NAME)
159# ----------------------
160# See how the compiler implements dependency checking.
161# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
162# We try a few techniques and use that to set a single cache variable.
163#
164# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
165# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
166# dependency, and given that the user is not expected to run this macro,
167# just rely on AC_PROG_CC.
168AC_DEFUN([_AM_DEPENDENCIES],
169[AC_REQUIRE([AM_SET_DEPDIR])dnl
170AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
171AC_REQUIRE([AM_MAKE_INCLUDE])dnl
172AC_REQUIRE([AM_DEP_TRACK])dnl
173
174m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
175      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
176      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
177      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
178      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
179      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
180                    [depcc="$$1"   am_compiler_list=])
181
182AC_CACHE_CHECK([dependency style of $depcc],
183               [am_cv_$1_dependencies_compiler_type],
184[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
185  # We make a subdir and do the tests there.  Otherwise we can end up
186  # making bogus files that we don't know about and never remove.  For
187  # instance it was reported that on HP-UX the gcc test will end up
188  # making a dummy file named 'D' -- because '-MD' means "put the output
189  # in D".
190  rm -rf conftest.dir
191  mkdir conftest.dir
192  # Copy depcomp to subdir because otherwise we won't find it if we're
193  # using a relative directory.
194  cp "$am_depcomp" conftest.dir
195  cd conftest.dir
196  # We will build objects and dependencies in a subdirectory because
197  # it helps to detect inapplicable dependency modes.  For instance
198  # both Tru64's cc and ICC support -MD to output dependencies as a
199  # side effect of compilation, but ICC will put the dependencies in
200  # the current directory while Tru64 will put them in the object
201  # directory.
202  mkdir sub
203
204  am_cv_$1_dependencies_compiler_type=none
205  if test "$am_compiler_list" = ""; then
206     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
207  fi
208  am__universal=false
209  m4_case([$1], [CC],
210    [case " $depcc " in #(
211     *\ -arch\ *\ -arch\ *) am__universal=true ;;
212     esac],
213    [CXX],
214    [case " $depcc " in #(
215     *\ -arch\ *\ -arch\ *) am__universal=true ;;
216     esac])
217
218  for depmode in $am_compiler_list; do
219    # Setup a source with many dependencies, because some compilers
220    # like to wrap large dependency lists on column 80 (with \), and
221    # we should not choose a depcomp mode which is confused by this.
222    #
223    # We need to recreate these files for each test, as the compiler may
224    # overwrite some of them when testing with obscure command lines.
225    # This happens at least with the AIX C compiler.
226    : > sub/conftest.c
227    for i in 1 2 3 4 5 6; do
228      echo '#include "conftst'$i'.h"' >> sub/conftest.c
229      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
230      # Solaris 10 /bin/sh.
231      echo '/* dummy */' > sub/conftst$i.h
232    done
233    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
234
235    # We check with '-c' and '-o' for the sake of the "dashmstdout"
236    # mode.  It turns out that the SunPro C++ compiler does not properly
237    # handle '-M -o', and we need to detect this.  Also, some Intel
238    # versions had trouble with output in subdirs.
239    am__obj=sub/conftest.${OBJEXT-o}
240    am__minus_obj="-o $am__obj"
241    case $depmode in
242    gcc)
243      # This depmode causes a compiler race in universal mode.
244      test "$am__universal" = false || continue
245      ;;
246    nosideeffect)
247      # After this tag, mechanisms are not by side-effect, so they'll
248      # only be used when explicitly requested.
249      if test "x$enable_dependency_tracking" = xyes; then
250	continue
251      else
252	break
253      fi
254      ;;
255    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
256      # This compiler won't grok '-c -o', but also, the minuso test has
257      # not run yet.  These depmodes are late enough in the game, and
258      # so weak that their functioning should not be impacted.
259      am__obj=conftest.${OBJEXT-o}
260      am__minus_obj=
261      ;;
262    none) break ;;
263    esac
264    if depmode=$depmode \
265       source=sub/conftest.c object=$am__obj \
266       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
267       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
268         >/dev/null 2>conftest.err &&
269       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
270       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
271       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
272       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
273      # icc doesn't choke on unknown options, it will just issue warnings
274      # or remarks (even with -Werror).  So we grep stderr for any message
275      # that says an option was ignored or not supported.
276      # When given -MP, icc 7.0 and 7.1 complain thusly:
277      #   icc: Command line warning: ignoring option '-M'; no argument required
278      # The diagnosis changed in icc 8.0:
279      #   icc: Command line remark: option '-MP' not supported
280      if (grep 'ignoring option' conftest.err ||
281          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
282        am_cv_$1_dependencies_compiler_type=$depmode
283        break
284      fi
285    fi
286  done
287
288  cd ..
289  rm -rf conftest.dir
290else
291  am_cv_$1_dependencies_compiler_type=none
292fi
293])
294AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
295AM_CONDITIONAL([am__fastdep$1], [
296  test "x$enable_dependency_tracking" != xno \
297  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
298])
299
300
301# AM_SET_DEPDIR
302# -------------
303# Choose a directory name for dependency files.
304# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
305AC_DEFUN([AM_SET_DEPDIR],
306[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
307AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
308])
309
310
311# AM_DEP_TRACK
312# ------------
313AC_DEFUN([AM_DEP_TRACK],
314[AC_ARG_ENABLE([dependency-tracking], [dnl
315AS_HELP_STRING(
316  [--enable-dependency-tracking],
317  [do not reject slow dependency extractors])
318AS_HELP_STRING(
319  [--disable-dependency-tracking],
320  [speeds up one-time build])])
321if test "x$enable_dependency_tracking" != xno; then
322  am_depcomp="$ac_aux_dir/depcomp"
323  AMDEPBACKSLASH='\'
324  am__nodep='_no'
325fi
326AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
327AC_SUBST([AMDEPBACKSLASH])dnl
328_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
329AC_SUBST([am__nodep])dnl
330_AM_SUBST_NOTMAKE([am__nodep])dnl
331])
332
333# Generate code to set up dependency tracking.              -*- Autoconf -*-
334
335# Copyright (C) 1999-2020 Free Software Foundation, Inc.
336#
337# This file is free software; the Free Software Foundation
338# gives unlimited permission to copy and/or distribute it,
339# with or without modifications, as long as this notice is preserved.
340
341# _AM_OUTPUT_DEPENDENCY_COMMANDS
342# ------------------------------
343AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
344[{
345  # Older Autoconf quotes --file arguments for eval, but not when files
346  # are listed without --file.  Let's play safe and only enable the eval
347  # if we detect the quoting.
348  # TODO: see whether this extra hack can be removed once we start
349  # requiring Autoconf 2.70 or later.
350  AS_CASE([$CONFIG_FILES],
351          [*\'*], [eval set x "$CONFIG_FILES"],
352          [*], [set x $CONFIG_FILES])
353  shift
354  # Used to flag and report bootstrapping failures.
355  am_rc=0
356  for am_mf
357  do
358    # Strip MF so we end up with the name of the file.
359    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
360    # Check whether this is an Automake generated Makefile which includes
361    # dependency-tracking related rules and includes.
362    # Grep'ing the whole file directly is not great: AIX grep has a line
363    # limit of 2048, but all sed's we know have understand at least 4000.
364    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
365      || continue
366    am_dirpart=`AS_DIRNAME(["$am_mf"])`
367    am_filepart=`AS_BASENAME(["$am_mf"])`
368    AM_RUN_LOG([cd "$am_dirpart" \
369      && sed -e '/# am--include-marker/d' "$am_filepart" \
370        | $MAKE -f - am--depfiles]) || am_rc=$?
371  done
372  if test $am_rc -ne 0; then
373    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
374    for automatic dependency tracking.  If GNU make was not used, consider
375    re-running the configure script with MAKE="gmake" (or whatever is
376    necessary).  You can also try re-running configure with the
377    '--disable-dependency-tracking' option to at least be able to build
378    the package (albeit without support for automatic dependency tracking).])
379  fi
380  AS_UNSET([am_dirpart])
381  AS_UNSET([am_filepart])
382  AS_UNSET([am_mf])
383  AS_UNSET([am_rc])
384  rm -f conftest-deps.mk
385}
386])# _AM_OUTPUT_DEPENDENCY_COMMANDS
387
388
389# AM_OUTPUT_DEPENDENCY_COMMANDS
390# -----------------------------
391# This macro should only be invoked once -- use via AC_REQUIRE.
392#
393# This code is only required when automatic dependency tracking is enabled.
394# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
395# order to bootstrap the dependency handling code.
396AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
397[AC_CONFIG_COMMANDS([depfiles],
398     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
399     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
400
401# Do all the work for Automake.                             -*- Autoconf -*-
402
403# Copyright (C) 1996-2020 Free Software Foundation, Inc.
404#
405# This file is free software; the Free Software Foundation
406# gives unlimited permission to copy and/or distribute it,
407# with or without modifications, as long as this notice is preserved.
408
409# This macro actually does too much.  Some checks are only needed if
410# your package does certain things.  But this isn't really a big deal.
411
412dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
413m4_define([AC_PROG_CC],
414m4_defn([AC_PROG_CC])
415[_AM_PROG_CC_C_O
416])
417
418# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
419# AM_INIT_AUTOMAKE([OPTIONS])
420# -----------------------------------------------
421# The call with PACKAGE and VERSION arguments is the old style
422# call (pre autoconf-2.50), which is being phased out.  PACKAGE
423# and VERSION should now be passed to AC_INIT and removed from
424# the call to AM_INIT_AUTOMAKE.
425# We support both call styles for the transition.  After
426# the next Automake release, Autoconf can make the AC_INIT
427# arguments mandatory, and then we can depend on a new Autoconf
428# release and drop the old call support.
429AC_DEFUN([AM_INIT_AUTOMAKE],
430[AC_PREREQ([2.65])dnl
431dnl Autoconf wants to disallow AM_ names.  We explicitly allow
432dnl the ones we care about.
433m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
434AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
435AC_REQUIRE([AC_PROG_INSTALL])dnl
436if test "`cd $srcdir && pwd`" != "`pwd`"; then
437  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
438  # is not polluted with repeated "-I."
439  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
440  # test to see if srcdir already configured
441  if test -f $srcdir/config.status; then
442    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
443  fi
444fi
445
446# test whether we have cygpath
447if test -z "$CYGPATH_W"; then
448  if (cygpath --version) >/dev/null 2>/dev/null; then
449    CYGPATH_W='cygpath -w'
450  else
451    CYGPATH_W=echo
452  fi
453fi
454AC_SUBST([CYGPATH_W])
455
456# Define the identity of the package.
457dnl Distinguish between old-style and new-style calls.
458m4_ifval([$2],
459[AC_DIAGNOSE([obsolete],
460             [$0: two- and three-arguments forms are deprecated.])
461m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
462 AC_SUBST([PACKAGE], [$1])dnl
463 AC_SUBST([VERSION], [$2])],
464[_AM_SET_OPTIONS([$1])dnl
465dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
466m4_if(
467  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
468  [ok:ok],,
469  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
470 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
471 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
472
473_AM_IF_OPTION([no-define],,
474[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
475 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
476
477# Some tools Automake needs.
478AC_REQUIRE([AM_SANITY_CHECK])dnl
479AC_REQUIRE([AC_ARG_PROGRAM])dnl
480AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
481AM_MISSING_PROG([AUTOCONF], [autoconf])
482AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
483AM_MISSING_PROG([AUTOHEADER], [autoheader])
484AM_MISSING_PROG([MAKEINFO], [makeinfo])
485AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
486AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
487AC_REQUIRE([AC_PROG_MKDIR_P])dnl
488# For better backward compatibility.  To be removed once Automake 1.9.x
489# dies out for good.  For more background, see:
490# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
491# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
492AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
493# We need awk for the "check" target (and possibly the TAP driver).  The
494# system "awk" is bad on some platforms.
495AC_REQUIRE([AC_PROG_AWK])dnl
496AC_REQUIRE([AC_PROG_MAKE_SET])dnl
497AC_REQUIRE([AM_SET_LEADING_DOT])dnl
498_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
499	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
500			     [_AM_PROG_TAR([v7])])])
501_AM_IF_OPTION([no-dependencies],,
502[AC_PROVIDE_IFELSE([AC_PROG_CC],
503		  [_AM_DEPENDENCIES([CC])],
504		  [m4_define([AC_PROG_CC],
505			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
506AC_PROVIDE_IFELSE([AC_PROG_CXX],
507		  [_AM_DEPENDENCIES([CXX])],
508		  [m4_define([AC_PROG_CXX],
509			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
510AC_PROVIDE_IFELSE([AC_PROG_OBJC],
511		  [_AM_DEPENDENCIES([OBJC])],
512		  [m4_define([AC_PROG_OBJC],
513			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
514AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
515		  [_AM_DEPENDENCIES([OBJCXX])],
516		  [m4_define([AC_PROG_OBJCXX],
517			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
518])
519AC_REQUIRE([AM_SILENT_RULES])dnl
520dnl The testsuite driver may need to know about EXEEXT, so add the
521dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
522dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
523AC_CONFIG_COMMANDS_PRE(dnl
524[m4_provide_if([_AM_COMPILER_EXEEXT],
525  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
526
527# POSIX will say in a future version that running "rm -f" with no argument
528# is OK; and we want to be able to make that assumption in our Makefile
529# recipes.  So use an aggressive probe to check that the usage we want is
530# actually supported "in the wild" to an acceptable degree.
531# See automake bug#10828.
532# To make any issue more visible, cause the running configure to be aborted
533# by default if the 'rm' program in use doesn't match our expectations; the
534# user can still override this though.
535if rm -f && rm -fr && rm -rf; then : OK; else
536  cat >&2 <<'END'
537Oops!
538
539Your 'rm' program seems unable to run without file operands specified
540on the command line, even when the '-f' option is present.  This is contrary
541to the behaviour of most rm programs out there, and not conforming with
542the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
543
544Please tell bug-automake@gnu.org about your system, including the value
545of your $PATH and any error possibly output before this message.  This
546can help us improve future automake versions.
547
548END
549  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
550    echo 'Configuration will proceed anyway, since you have set the' >&2
551    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
552    echo >&2
553  else
554    cat >&2 <<'END'
555Aborting the configuration process, to ensure you take notice of the issue.
556
557You can download and install GNU coreutils to get an 'rm' implementation
558that behaves properly: <https://www.gnu.org/software/coreutils/>.
559
560If you want to complete the configuration process using your problematic
561'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
562to "yes", and re-run configure.
563
564END
565    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
566  fi
567fi
568dnl The trailing newline in this macro's definition is deliberate, for
569dnl backward compatibility and to allow trailing 'dnl'-style comments
570dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
571])
572
573dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
574dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
575dnl mangled by Autoconf and run in a shell conditional statement.
576m4_define([_AC_COMPILER_EXEEXT],
577m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
578
579# When config.status generates a header, we must update the stamp-h file.
580# This file resides in the same directory as the config header
581# that is generated.  The stamp files are numbered to have different names.
582
583# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
584# loop where config.status creates the headers, so we can generate
585# our stamp files there.
586AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
587[# Compute $1's index in $config_headers.
588_am_arg=$1
589_am_stamp_count=1
590for _am_header in $config_headers :; do
591  case $_am_header in
592    $_am_arg | $_am_arg:* )
593      break ;;
594    * )
595      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
596  esac
597done
598echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
599
600# Copyright (C) 2001-2020 Free Software Foundation, Inc.
601#
602# This file is free software; the Free Software Foundation
603# gives unlimited permission to copy and/or distribute it,
604# with or without modifications, as long as this notice is preserved.
605
606# AM_PROG_INSTALL_SH
607# ------------------
608# Define $install_sh.
609AC_DEFUN([AM_PROG_INSTALL_SH],
610[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
611if test x"${install_sh+set}" != xset; then
612  case $am_aux_dir in
613  *\ * | *\	*)
614    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
615  *)
616    install_sh="\${SHELL} $am_aux_dir/install-sh"
617  esac
618fi
619AC_SUBST([install_sh])])
620
621# Copyright (C) 2003-2020 Free Software Foundation, Inc.
622#
623# This file is free software; the Free Software Foundation
624# gives unlimited permission to copy and/or distribute it,
625# with or without modifications, as long as this notice is preserved.
626
627# Check whether the underlying file-system supports filenames
628# with a leading dot.  For instance MS-DOS doesn't.
629AC_DEFUN([AM_SET_LEADING_DOT],
630[rm -rf .tst 2>/dev/null
631mkdir .tst 2>/dev/null
632if test -d .tst; then
633  am__leading_dot=.
634else
635  am__leading_dot=_
636fi
637rmdir .tst 2>/dev/null
638AC_SUBST([am__leading_dot])])
639
640# Check to see how 'make' treats includes.	            -*- Autoconf -*-
641
642# Copyright (C) 2001-2020 Free Software Foundation, Inc.
643#
644# This file is free software; the Free Software Foundation
645# gives unlimited permission to copy and/or distribute it,
646# with or without modifications, as long as this notice is preserved.
647
648# AM_MAKE_INCLUDE()
649# -----------------
650# Check whether make has an 'include' directive that can support all
651# the idioms we need for our automatic dependency tracking code.
652AC_DEFUN([AM_MAKE_INCLUDE],
653[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
654cat > confinc.mk << 'END'
655am__doit:
656	@echo this is the am__doit target >confinc.out
657.PHONY: am__doit
658END
659am__include="#"
660am__quote=
661# BSD make does it like this.
662echo '.include "confinc.mk" # ignored' > confmf.BSD
663# Other make implementations (GNU, Solaris 10, AIX) do it like this.
664echo 'include confinc.mk # ignored' > confmf.GNU
665_am_result=no
666for s in GNU BSD; do
667  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
668  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
669      ['0:this is the am__doit target'],
670      [AS_CASE([$s],
671          [BSD], [am__include='.include' am__quote='"'],
672          [am__include='include' am__quote=''])])
673  if test "$am__include" != "#"; then
674    _am_result="yes ($s style)"
675    break
676  fi
677done
678rm -f confinc.* confmf.*
679AC_MSG_RESULT([${_am_result}])
680AC_SUBST([am__include])])
681AC_SUBST([am__quote])])
682
683# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
684
685# Copyright (C) 1997-2020 Free Software Foundation, Inc.
686#
687# This file is free software; the Free Software Foundation
688# gives unlimited permission to copy and/or distribute it,
689# with or without modifications, as long as this notice is preserved.
690
691# AM_MISSING_PROG(NAME, PROGRAM)
692# ------------------------------
693AC_DEFUN([AM_MISSING_PROG],
694[AC_REQUIRE([AM_MISSING_HAS_RUN])
695$1=${$1-"${am_missing_run}$2"}
696AC_SUBST($1)])
697
698# AM_MISSING_HAS_RUN
699# ------------------
700# Define MISSING if not defined so far and test if it is modern enough.
701# If it is, set am_missing_run to use it, otherwise, to nothing.
702AC_DEFUN([AM_MISSING_HAS_RUN],
703[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
704AC_REQUIRE_AUX_FILE([missing])dnl
705if test x"${MISSING+set}" != xset; then
706  case $am_aux_dir in
707  *\ * | *\	*)
708    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
709  *)
710    MISSING="\${SHELL} $am_aux_dir/missing" ;;
711  esac
712fi
713# Use eval to expand $SHELL
714if eval "$MISSING --is-lightweight"; then
715  am_missing_run="$MISSING "
716else
717  am_missing_run=
718  AC_MSG_WARN(['missing' script is too old or missing])
719fi
720])
721
722# Helper functions for option handling.                     -*- Autoconf -*-
723
724# Copyright (C) 2001-2020 Free Software Foundation, Inc.
725#
726# This file is free software; the Free Software Foundation
727# gives unlimited permission to copy and/or distribute it,
728# with or without modifications, as long as this notice is preserved.
729
730# _AM_MANGLE_OPTION(NAME)
731# -----------------------
732AC_DEFUN([_AM_MANGLE_OPTION],
733[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
734
735# _AM_SET_OPTION(NAME)
736# --------------------
737# Set option NAME.  Presently that only means defining a flag for this option.
738AC_DEFUN([_AM_SET_OPTION],
739[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
740
741# _AM_SET_OPTIONS(OPTIONS)
742# ------------------------
743# OPTIONS is a space-separated list of Automake options.
744AC_DEFUN([_AM_SET_OPTIONS],
745[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
746
747# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
748# -------------------------------------------
749# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
750AC_DEFUN([_AM_IF_OPTION],
751[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
752
753# Copyright (C) 1999-2020 Free Software Foundation, Inc.
754#
755# This file is free software; the Free Software Foundation
756# gives unlimited permission to copy and/or distribute it,
757# with or without modifications, as long as this notice is preserved.
758
759# _AM_PROG_CC_C_O
760# ---------------
761# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
762# to automatically call this.
763AC_DEFUN([_AM_PROG_CC_C_O],
764[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
765AC_REQUIRE_AUX_FILE([compile])dnl
766AC_LANG_PUSH([C])dnl
767AC_CACHE_CHECK(
768  [whether $CC understands -c and -o together],
769  [am_cv_prog_cc_c_o],
770  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
771  # Make sure it works both with $CC and with simple cc.
772  # Following AC_PROG_CC_C_O, we do the test twice because some
773  # compilers refuse to overwrite an existing .o file with -o,
774  # though they will create one.
775  am_cv_prog_cc_c_o=yes
776  for am_i in 1 2; do
777    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
778         && test -f conftest2.$ac_objext; then
779      : OK
780    else
781      am_cv_prog_cc_c_o=no
782      break
783    fi
784  done
785  rm -f core conftest*
786  unset am_i])
787if test "$am_cv_prog_cc_c_o" != yes; then
788   # Losing compiler, so override with the script.
789   # FIXME: It is wrong to rewrite CC.
790   # But if we don't then we get into trouble of one sort or another.
791   # A longer-term fix would be to have automake use am__CC in this case,
792   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
793   CC="$am_aux_dir/compile $CC"
794fi
795AC_LANG_POP([C])])
796
797# For backward compatibility.
798AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
799
800# Copyright (C) 2001-2020 Free Software Foundation, Inc.
801#
802# This file is free software; the Free Software Foundation
803# gives unlimited permission to copy and/or distribute it,
804# with or without modifications, as long as this notice is preserved.
805
806# AM_RUN_LOG(COMMAND)
807# -------------------
808# Run COMMAND, save the exit status in ac_status, and log it.
809# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
810AC_DEFUN([AM_RUN_LOG],
811[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
812   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
813   ac_status=$?
814   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
815   (exit $ac_status); }])
816
817# Check to make sure that the build environment is sane.    -*- Autoconf -*-
818
819# Copyright (C) 1996-2020 Free Software Foundation, Inc.
820#
821# This file is free software; the Free Software Foundation
822# gives unlimited permission to copy and/or distribute it,
823# with or without modifications, as long as this notice is preserved.
824
825# AM_SANITY_CHECK
826# ---------------
827AC_DEFUN([AM_SANITY_CHECK],
828[AC_MSG_CHECKING([whether build environment is sane])
829# Reject unsafe characters in $srcdir or the absolute working directory
830# name.  Accept space and tab only in the latter.
831am_lf='
832'
833case `pwd` in
834  *[[\\\"\#\$\&\'\`$am_lf]]*)
835    AC_MSG_ERROR([unsafe absolute working directory name]);;
836esac
837case $srcdir in
838  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
839    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
840esac
841
842# Do 'set' in a subshell so we don't clobber the current shell's
843# arguments.  Must try -L first in case configure is actually a
844# symlink; some systems play weird games with the mod time of symlinks
845# (eg FreeBSD returns the mod time of the symlink's containing
846# directory).
847if (
848   am_has_slept=no
849   for am_try in 1 2; do
850     echo "timestamp, slept: $am_has_slept" > conftest.file
851     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
852     if test "$[*]" = "X"; then
853	# -L didn't work.
854	set X `ls -t "$srcdir/configure" conftest.file`
855     fi
856     if test "$[*]" != "X $srcdir/configure conftest.file" \
857	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
858
859	# If neither matched, then we have a broken ls.  This can happen
860	# if, for instance, CONFIG_SHELL is bash and it inherits a
861	# broken ls alias from the environment.  This has actually
862	# happened.  Such a system could not be considered "sane".
863	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
864  alias in your environment])
865     fi
866     if test "$[2]" = conftest.file || test $am_try -eq 2; then
867       break
868     fi
869     # Just in case.
870     sleep 1
871     am_has_slept=yes
872   done
873   test "$[2]" = conftest.file
874   )
875then
876   # Ok.
877   :
878else
879   AC_MSG_ERROR([newly created file is older than distributed files!
880Check your system clock])
881fi
882AC_MSG_RESULT([yes])
883# If we didn't sleep, we still need to ensure time stamps of config.status and
884# generated files are strictly newer.
885am_sleep_pid=
886if grep 'slept: no' conftest.file >/dev/null 2>&1; then
887  ( sleep 1 ) &
888  am_sleep_pid=$!
889fi
890AC_CONFIG_COMMANDS_PRE(
891  [AC_MSG_CHECKING([that generated files are newer than configure])
892   if test -n "$am_sleep_pid"; then
893     # Hide warnings about reused PIDs.
894     wait $am_sleep_pid 2>/dev/null
895   fi
896   AC_MSG_RESULT([done])])
897rm -f conftest.file
898])
899
900# Copyright (C) 2009-2020 Free Software Foundation, Inc.
901#
902# This file is free software; the Free Software Foundation
903# gives unlimited permission to copy and/or distribute it,
904# with or without modifications, as long as this notice is preserved.
905
906# AM_SILENT_RULES([DEFAULT])
907# --------------------------
908# Enable less verbose build rules; with the default set to DEFAULT
909# ("yes" being less verbose, "no" or empty being verbose).
910AC_DEFUN([AM_SILENT_RULES],
911[AC_ARG_ENABLE([silent-rules], [dnl
912AS_HELP_STRING(
913  [--enable-silent-rules],
914  [less verbose build output (undo: "make V=1")])
915AS_HELP_STRING(
916  [--disable-silent-rules],
917  [verbose build output (undo: "make V=0")])dnl
918])
919case $enable_silent_rules in @%:@ (((
920  yes) AM_DEFAULT_VERBOSITY=0;;
921   no) AM_DEFAULT_VERBOSITY=1;;
922    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
923esac
924dnl
925dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
926dnl do not support nested variable expansions.
927dnl See automake bug#9928 and bug#10237.
928am_make=${MAKE-make}
929AC_CACHE_CHECK([whether $am_make supports nested variables],
930   [am_cv_make_support_nested_variables],
931   [if AS_ECHO([['TRUE=$(BAR$(V))
932BAR0=false
933BAR1=true
934V=1
935am__doit:
936	@$(TRUE)
937.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
938  am_cv_make_support_nested_variables=yes
939else
940  am_cv_make_support_nested_variables=no
941fi])
942if test $am_cv_make_support_nested_variables = yes; then
943  dnl Using '$V' instead of '$(V)' breaks IRIX make.
944  AM_V='$(V)'
945  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
946else
947  AM_V=$AM_DEFAULT_VERBOSITY
948  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
949fi
950AC_SUBST([AM_V])dnl
951AM_SUBST_NOTMAKE([AM_V])dnl
952AC_SUBST([AM_DEFAULT_V])dnl
953AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
954AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
955AM_BACKSLASH='\'
956AC_SUBST([AM_BACKSLASH])dnl
957_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
958])
959
960# Copyright (C) 2001-2020 Free Software Foundation, Inc.
961#
962# This file is free software; the Free Software Foundation
963# gives unlimited permission to copy and/or distribute it,
964# with or without modifications, as long as this notice is preserved.
965
966# AM_PROG_INSTALL_STRIP
967# ---------------------
968# One issue with vendor 'install' (even GNU) is that you can't
969# specify the program used to strip binaries.  This is especially
970# annoying in cross-compiling environments, where the build's strip
971# is unlikely to handle the host's binaries.
972# Fortunately install-sh will honor a STRIPPROG variable, so we
973# always use install-sh in "make install-strip", and initialize
974# STRIPPROG with the value of the STRIP variable (set by the user).
975AC_DEFUN([AM_PROG_INSTALL_STRIP],
976[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
977# Installed binaries are usually stripped using 'strip' when the user
978# run "make install-strip".  However 'strip' might not be the right
979# tool to use in cross-compilation environments, therefore Automake
980# will honor the 'STRIP' environment variable to overrule this program.
981dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
982if test "$cross_compiling" != no; then
983  AC_CHECK_TOOL([STRIP], [strip], :)
984fi
985INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
986AC_SUBST([INSTALL_STRIP_PROGRAM])])
987
988# Copyright (C) 2006-2020 Free Software Foundation, Inc.
989#
990# This file is free software; the Free Software Foundation
991# gives unlimited permission to copy and/or distribute it,
992# with or without modifications, as long as this notice is preserved.
993
994# _AM_SUBST_NOTMAKE(VARIABLE)
995# ---------------------------
996# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
997# This macro is traced by Automake.
998AC_DEFUN([_AM_SUBST_NOTMAKE])
999
1000# AM_SUBST_NOTMAKE(VARIABLE)
1001# --------------------------
1002# Public sister of _AM_SUBST_NOTMAKE.
1003AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1004
1005# Check how to create a tarball.                            -*- Autoconf -*-
1006
1007# Copyright (C) 2004-2020 Free Software Foundation, Inc.
1008#
1009# This file is free software; the Free Software Foundation
1010# gives unlimited permission to copy and/or distribute it,
1011# with or without modifications, as long as this notice is preserved.
1012
1013# _AM_PROG_TAR(FORMAT)
1014# --------------------
1015# Check how to create a tarball in format FORMAT.
1016# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1017#
1018# Substitute a variable $(am__tar) that is a command
1019# writing to stdout a FORMAT-tarball containing the directory
1020# $tardir.
1021#     tardir=directory && $(am__tar) > result.tar
1022#
1023# Substitute a variable $(am__untar) that extract such
1024# a tarball read from stdin.
1025#     $(am__untar) < result.tar
1026#
1027AC_DEFUN([_AM_PROG_TAR],
1028[# Always define AMTAR for backward compatibility.  Yes, it's still used
1029# in the wild :-(  We should find a proper way to deprecate it ...
1030AC_SUBST([AMTAR], ['$${TAR-tar}'])
1031
1032# We'll loop over all known methods to create a tar archive until one works.
1033_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1034
1035m4_if([$1], [v7],
1036  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1037
1038  [m4_case([$1],
1039    [ustar],
1040     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1041      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1042      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1043      # and bug#13588).
1044      am_max_uid=2097151 # 2^21 - 1
1045      am_max_gid=$am_max_uid
1046      # The $UID and $GID variables are not portable, so we need to resort
1047      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1048      # below are definitely unexpected, so allow the users to see them
1049      # (that is, avoid stderr redirection).
1050      am_uid=`id -u || echo unknown`
1051      am_gid=`id -g || echo unknown`
1052      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1053      if test $am_uid -le $am_max_uid; then
1054         AC_MSG_RESULT([yes])
1055      else
1056         AC_MSG_RESULT([no])
1057         _am_tools=none
1058      fi
1059      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1060      if test $am_gid -le $am_max_gid; then
1061         AC_MSG_RESULT([yes])
1062      else
1063        AC_MSG_RESULT([no])
1064        _am_tools=none
1065      fi],
1066
1067  [pax],
1068    [],
1069
1070  [m4_fatal([Unknown tar format])])
1071
1072  AC_MSG_CHECKING([how to create a $1 tar archive])
1073
1074  # Go ahead even if we have the value already cached.  We do so because we
1075  # need to set the values for the 'am__tar' and 'am__untar' variables.
1076  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1077
1078  for _am_tool in $_am_tools; do
1079    case $_am_tool in
1080    gnutar)
1081      for _am_tar in tar gnutar gtar; do
1082        AM_RUN_LOG([$_am_tar --version]) && break
1083      done
1084      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1085      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1086      am__untar="$_am_tar -xf -"
1087      ;;
1088    plaintar)
1089      # Must skip GNU tar: if it does not support --format= it doesn't create
1090      # ustar tarball either.
1091      (tar --version) >/dev/null 2>&1 && continue
1092      am__tar='tar chf - "$$tardir"'
1093      am__tar_='tar chf - "$tardir"'
1094      am__untar='tar xf -'
1095      ;;
1096    pax)
1097      am__tar='pax -L -x $1 -w "$$tardir"'
1098      am__tar_='pax -L -x $1 -w "$tardir"'
1099      am__untar='pax -r'
1100      ;;
1101    cpio)
1102      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1103      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1104      am__untar='cpio -i -H $1 -d'
1105      ;;
1106    none)
1107      am__tar=false
1108      am__tar_=false
1109      am__untar=false
1110      ;;
1111    esac
1112
1113    # If the value was cached, stop now.  We just wanted to have am__tar
1114    # and am__untar set.
1115    test -n "${am_cv_prog_tar_$1}" && break
1116
1117    # tar/untar a dummy directory, and stop if the command works.
1118    rm -rf conftest.dir
1119    mkdir conftest.dir
1120    echo GrepMe > conftest.dir/file
1121    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1122    rm -rf conftest.dir
1123    if test -s conftest.tar; then
1124      AM_RUN_LOG([$am__untar <conftest.tar])
1125      AM_RUN_LOG([cat conftest.dir/file])
1126      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1127    fi
1128  done
1129  rm -rf conftest.dir
1130
1131  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1132  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1133
1134AC_SUBST([am__tar])
1135AC_SUBST([am__untar])
1136]) # _AM_PROG_TAR
1137
1138# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
1139# serial 1 (pkg-config-0.24)
1140# 
1141# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1142#
1143# This program is free software; you can redistribute it and/or modify
1144# it under the terms of the GNU General Public License as published by
1145# the Free Software Foundation; either version 2 of the License, or
1146# (at your option) any later version.
1147#
1148# This program is distributed in the hope that it will be useful, but
1149# WITHOUT ANY WARRANTY; without even the implied warranty of
1150# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1151# General Public License for more details.
1152#
1153# You should have received a copy of the GNU General Public License
1154# along with this program; if not, write to the Free Software
1155# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1156#
1157# As a special exception to the GNU General Public License, if you
1158# distribute this file as part of a program that contains a
1159# configuration script generated by Autoconf, you may include it under
1160# the same distribution terms that you use for the rest of that program.
1161
1162# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1163# ----------------------------------
1164AC_DEFUN([PKG_PROG_PKG_CONFIG],
1165[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1166m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1167m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1168AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1169AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1170AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1171
1172if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1173	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1174fi
1175if test -n "$PKG_CONFIG"; then
1176	_pkg_min_version=m4_default([$1], [0.9.0])
1177	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1178	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1179		AC_MSG_RESULT([yes])
1180	else
1181		AC_MSG_RESULT([no])
1182		PKG_CONFIG=""
1183	fi
1184fi[]dnl
1185])# PKG_PROG_PKG_CONFIG
1186
1187# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1188#
1189# Check to see whether a particular set of modules exists.  Similar
1190# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1191#
1192# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1193# only at the first occurence in configure.ac, so if the first place
1194# it's called might be skipped (such as if it is within an "if", you
1195# have to call PKG_CHECK_EXISTS manually
1196# --------------------------------------------------------------
1197AC_DEFUN([PKG_CHECK_EXISTS],
1198[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1199if test -n "$PKG_CONFIG" && \
1200    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1201  m4_default([$2], [:])
1202m4_ifvaln([$3], [else
1203  $3])dnl
1204fi])
1205
1206# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1207# ---------------------------------------------
1208m4_define([_PKG_CONFIG],
1209[if test -n "$$1"; then
1210    pkg_cv_[]$1="$$1"
1211 elif test -n "$PKG_CONFIG"; then
1212    PKG_CHECK_EXISTS([$3],
1213                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1214		      test "x$?" != "x0" && pkg_failed=yes ],
1215		     [pkg_failed=yes])
1216 else
1217    pkg_failed=untried
1218fi[]dnl
1219])# _PKG_CONFIG
1220
1221# _PKG_SHORT_ERRORS_SUPPORTED
1222# -----------------------------
1223AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1224[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1225if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1226        _pkg_short_errors_supported=yes
1227else
1228        _pkg_short_errors_supported=no
1229fi[]dnl
1230])# _PKG_SHORT_ERRORS_SUPPORTED
1231
1232
1233# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1234# [ACTION-IF-NOT-FOUND])
1235#
1236#
1237# Note that if there is a possibility the first call to
1238# PKG_CHECK_MODULES might not happen, you should be sure to include an
1239# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1240#
1241#
1242# --------------------------------------------------------------
1243AC_DEFUN([PKG_CHECK_MODULES],
1244[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1245AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1246AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1247
1248pkg_failed=no
1249AC_MSG_CHECKING([for $1])
1250
1251_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1252_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1253
1254m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1255and $1[]_LIBS to avoid the need to call pkg-config.
1256See the pkg-config man page for more details.])
1257
1258if test $pkg_failed = yes; then
1259   	AC_MSG_RESULT([no])
1260        _PKG_SHORT_ERRORS_SUPPORTED
1261        if test $_pkg_short_errors_supported = yes; then
1262	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1263        else 
1264	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1265        fi
1266	# Put the nasty error message in config.log where it belongs
1267	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1268
1269	m4_default([$4], [AC_MSG_ERROR(
1270[Package requirements ($2) were not met:
1271
1272$$1_PKG_ERRORS
1273
1274Consider adjusting the PKG_CONFIG_PATH environment variable if you
1275installed software in a non-standard prefix.
1276
1277_PKG_TEXT])[]dnl
1278        ])
1279elif test $pkg_failed = untried; then
1280     	AC_MSG_RESULT([no])
1281	m4_default([$4], [AC_MSG_FAILURE(
1282[The pkg-config script could not be found or is too old.  Make sure it
1283is in your PATH or set the PKG_CONFIG environment variable to the full
1284path to pkg-config.
1285
1286_PKG_TEXT
1287
1288To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1289        ])
1290else
1291	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1292	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1293        AC_MSG_RESULT([yes])
1294	$3
1295fi[]dnl
1296])# PKG_CHECK_MODULES
1297
1298dnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1299dnl
1300dnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
1301dnl
1302dnl Permission is hereby granted, free of charge, to any person obtaining a
1303dnl copy of this software and associated documentation files (the "Software"),
1304dnl to deal in the Software without restriction, including without limitation
1305dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1306dnl and/or sell copies of the Software, and to permit persons to whom the
1307dnl Software is furnished to do so, subject to the following conditions:
1308dnl
1309dnl The above copyright notice and this permission notice (including the next
1310dnl paragraph) shall be included in all copies or substantial portions of the
1311dnl Software.
1312dnl
1313dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1314dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1315dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1316dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1317dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1318dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1319dnl DEALINGS IN THE SOFTWARE.
1320
1321# XORG_MACROS_VERSION(required-version)
1322# -------------------------------------
1323# Minimum version: 1.1.0
1324#
1325# If you're using a macro added in Version 1.1 or newer, include this in
1326# your configure.ac with the minimum required version, such as:
1327# XORG_MACROS_VERSION(1.1)
1328#
1329# To ensure that this macro is defined, also add:
1330# m4_ifndef([XORG_MACROS_VERSION],
1331#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1332#
1333#
1334# See the "minimum version" comment for each macro you use to see what
1335# version you require.
1336m4_defun([XORG_MACROS_VERSION],[
1337m4_define([vers_have], [1.19.2])
1338m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1339m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1340m4_if(m4_cmp(maj_have, maj_needed), 0,,
1341    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1342m4_if(m4_version_compare(vers_have, [$1]), -1,
1343    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1344m4_undefine([vers_have])
1345m4_undefine([maj_have])
1346m4_undefine([maj_needed])
1347]) # XORG_MACROS_VERSION
1348
1349# XORG_PROG_RAWCPP()
1350# ------------------
1351# Minimum version: 1.0.0
1352#
1353# Find cpp program and necessary flags for use in pre-processing text files
1354# such as man pages and config files
1355AC_DEFUN([XORG_PROG_RAWCPP],[
1356AC_REQUIRE([AC_PROG_CPP])
1357AC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1358   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1359
1360# Check for flag to avoid builtin definitions - assumes unix is predefined,
1361# which is not the best choice for supporting other OS'es, but covers most
1362# of the ones we need for now.
1363AC_MSG_CHECKING([if $RAWCPP requires -undef])
1364AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1365if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1366	AC_MSG_RESULT([no])
1367else
1368	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1369		RAWCPPFLAGS=-undef
1370		AC_MSG_RESULT([yes])
1371	# under Cygwin unix is still defined even with -undef
1372	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1373		RAWCPPFLAGS="-undef -ansi"
1374		AC_MSG_RESULT([yes, with -ansi])
1375	else
1376		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1377	fi
1378fi
1379rm -f conftest.$ac_ext
1380
1381AC_MSG_CHECKING([if $RAWCPP requires -traditional])
1382AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1383if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1384	AC_MSG_RESULT([no])
1385else
1386	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1387		TRADITIONALCPPFLAGS="-traditional"
1388		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1389		AC_MSG_RESULT([yes])
1390	else
1391		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1392	fi
1393fi
1394rm -f conftest.$ac_ext
1395AC_SUBST(RAWCPPFLAGS)
1396AC_SUBST(TRADITIONALCPPFLAGS)
1397]) # XORG_PROG_RAWCPP
1398
1399# XORG_MANPAGE_SECTIONS()
1400# -----------------------
1401# Minimum version: 1.0.0
1402#
1403# Determine which sections man pages go in for the different man page types
1404# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1405# Not sure if there's any better way than just hardcoding by OS name.
1406# Override default settings by setting environment variables
1407# Added MAN_SUBSTS in version 1.8
1408# Added AC_PROG_SED in version 1.8
1409
1410AC_DEFUN([XORG_MANPAGE_SECTIONS],[
1411AC_REQUIRE([AC_CANONICAL_HOST])
1412AC_REQUIRE([AC_PROG_SED])
1413
1414case $host_os in
1415    solaris*)
1416        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1417        # check for a man page file found in later versions that use
1418        # traditional section numbers instead
1419        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1420                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1421        ;;
1422    *) SYSV_MAN_SECTIONS=false ;;
1423esac
1424
1425if test x$APP_MAN_SUFFIX = x    ; then
1426    APP_MAN_SUFFIX=1
1427fi
1428if test x$APP_MAN_DIR = x    ; then
1429    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1430fi
1431
1432if test x$LIB_MAN_SUFFIX = x    ; then
1433    LIB_MAN_SUFFIX=3
1434fi
1435if test x$LIB_MAN_DIR = x    ; then
1436    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1437fi
1438
1439if test x$FILE_MAN_SUFFIX = x    ; then
1440    case $SYSV_MAN_SECTIONS in
1441	true)				FILE_MAN_SUFFIX=4  ;;
1442	*)				FILE_MAN_SUFFIX=5  ;;
1443    esac
1444fi
1445if test x$FILE_MAN_DIR = x    ; then
1446    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1447fi
1448
1449if test x$MISC_MAN_SUFFIX = x    ; then
1450    case $SYSV_MAN_SECTIONS in
1451	true)				MISC_MAN_SUFFIX=5  ;;
1452	*)				MISC_MAN_SUFFIX=7  ;;
1453    esac
1454fi
1455if test x$MISC_MAN_DIR = x    ; then
1456    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1457fi
1458
1459if test x$DRIVER_MAN_SUFFIX = x    ; then
1460    case $SYSV_MAN_SECTIONS in
1461	true)				DRIVER_MAN_SUFFIX=7  ;;
1462	*)				DRIVER_MAN_SUFFIX=4  ;;
1463    esac
1464fi
1465if test x$DRIVER_MAN_DIR = x    ; then
1466    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1467fi
1468
1469if test x$ADMIN_MAN_SUFFIX = x    ; then
1470    case $SYSV_MAN_SECTIONS in
1471	true)				ADMIN_MAN_SUFFIX=1m ;;
1472	*)				ADMIN_MAN_SUFFIX=8  ;;
1473    esac
1474fi
1475if test x$ADMIN_MAN_DIR = x    ; then
1476    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1477fi
1478
1479
1480AC_SUBST([APP_MAN_SUFFIX])
1481AC_SUBST([LIB_MAN_SUFFIX])
1482AC_SUBST([FILE_MAN_SUFFIX])
1483AC_SUBST([MISC_MAN_SUFFIX])
1484AC_SUBST([DRIVER_MAN_SUFFIX])
1485AC_SUBST([ADMIN_MAN_SUFFIX])
1486AC_SUBST([APP_MAN_DIR])
1487AC_SUBST([LIB_MAN_DIR])
1488AC_SUBST([FILE_MAN_DIR])
1489AC_SUBST([MISC_MAN_DIR])
1490AC_SUBST([DRIVER_MAN_DIR])
1491AC_SUBST([ADMIN_MAN_DIR])
1492
1493XORG_MAN_PAGE="X Version 11"
1494AC_SUBST([XORG_MAN_PAGE])
1495MAN_SUBSTS="\
1496	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1497	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
1498	-e 's|__xservername__|Xorg|g' \
1499	-e 's|__xconfigfile__|xorg.conf|g' \
1500	-e 's|__projectroot__|\$(prefix)|g' \
1501	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
1502	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
1503	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
1504	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
1505	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
1506	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
1507	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
1508AC_SUBST([MAN_SUBSTS])
1509
1510]) # XORG_MANPAGE_SECTIONS
1511
1512# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
1513# ------------------------
1514# Minimum version: 1.7.0
1515#
1516# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
1517# provided by xorg-sgml-doctools, if installed.
1518AC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
1519AC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
1520XORG_SGML_PATH=
1521PKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
1522    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
1523    [m4_ifval([$1],[:],
1524        [if test x"$cross_compiling" != x"yes" ; then
1525            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
1526                          [XORG_SGML_PATH=$prefix/share/sgml])
1527         fi])
1528    ])
1529
1530# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
1531# the path and the name of the doc stylesheet
1532if test "x$XORG_SGML_PATH" != "x" ; then
1533   AC_MSG_RESULT([$XORG_SGML_PATH])
1534   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
1535   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
1536else
1537   AC_MSG_RESULT([no])
1538fi
1539
1540AC_SUBST(XORG_SGML_PATH)
1541AC_SUBST(STYLESHEET_SRCDIR)
1542AC_SUBST(XSL_STYLESHEET)
1543AM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
1544]) # XORG_CHECK_SGML_DOCTOOLS
1545
1546# XORG_CHECK_LINUXDOC
1547# -------------------
1548# Minimum version: 1.0.0
1549#
1550# Defines the variable MAKE_TEXT if the necessary tools and
1551# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
1552# Whether or not the necessary tools and files are found can be checked
1553# with the AM_CONDITIONAL "BUILD_LINUXDOC"
1554AC_DEFUN([XORG_CHECK_LINUXDOC],[
1555AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1556AC_REQUIRE([XORG_WITH_PS2PDF])
1557
1558AC_PATH_PROG(LINUXDOC, linuxdoc)
1559
1560AC_MSG_CHECKING([whether to build documentation])
1561
1562if test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
1563   BUILDDOC=yes
1564else
1565   BUILDDOC=no
1566fi
1567
1568AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
1569
1570AC_MSG_RESULT([$BUILDDOC])
1571
1572AC_MSG_CHECKING([whether to build pdf documentation])
1573
1574if test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
1575   BUILDPDFDOC=yes
1576else
1577   BUILDPDFDOC=no
1578fi
1579
1580AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1581
1582AC_MSG_RESULT([$BUILDPDFDOC])
1583
1584MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
1585MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
1586MAKE_PDF="$PS2PDF"
1587MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
1588
1589AC_SUBST(MAKE_TEXT)
1590AC_SUBST(MAKE_PS)
1591AC_SUBST(MAKE_PDF)
1592AC_SUBST(MAKE_HTML)
1593]) # XORG_CHECK_LINUXDOC
1594
1595# XORG_CHECK_DOCBOOK
1596# -------------------
1597# Minimum version: 1.0.0
1598#
1599# Checks for the ability to build output formats from SGML DocBook source.
1600# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
1601# indicates whether the necessary tools and files are found and, if set,
1602# $(MAKE_XXX) blah.sgml will produce blah.xxx.
1603AC_DEFUN([XORG_CHECK_DOCBOOK],[
1604AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
1605
1606BUILDTXTDOC=no
1607BUILDPDFDOC=no
1608BUILDPSDOC=no
1609BUILDHTMLDOC=no
1610
1611AC_PATH_PROG(DOCBOOKPS, docbook2ps)
1612AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
1613AC_PATH_PROG(DOCBOOKHTML, docbook2html)
1614AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
1615
1616AC_MSG_CHECKING([whether to build text documentation])
1617if test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
1618   test x$BUILD_TXTDOC != xno; then
1619	BUILDTXTDOC=yes
1620fi
1621AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
1622AC_MSG_RESULT([$BUILDTXTDOC])
1623
1624AC_MSG_CHECKING([whether to build PDF documentation])
1625if test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
1626   test x$BUILD_PDFDOC != xno; then
1627	BUILDPDFDOC=yes
1628fi
1629AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
1630AC_MSG_RESULT([$BUILDPDFDOC])
1631
1632AC_MSG_CHECKING([whether to build PostScript documentation])
1633if test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
1634   test x$BUILD_PSDOC != xno; then
1635	BUILDPSDOC=yes
1636fi
1637AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
1638AC_MSG_RESULT([$BUILDPSDOC])
1639
1640AC_MSG_CHECKING([whether to build HTML documentation])
1641if test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
1642   test x$BUILD_HTMLDOC != xno; then
1643	BUILDHTMLDOC=yes
1644fi
1645AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
1646AC_MSG_RESULT([$BUILDHTMLDOC])
1647
1648MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
1649MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
1650MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
1651MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
1652
1653AC_SUBST(MAKE_TEXT)
1654AC_SUBST(MAKE_PS)
1655AC_SUBST(MAKE_PDF)
1656AC_SUBST(MAKE_HTML)
1657]) # XORG_CHECK_DOCBOOK
1658
1659# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
1660# ----------------
1661# Minimum version: 1.5.0
1662# Minimum version for optional DEFAULT argument: 1.11.0
1663#
1664# Documentation tools are not always available on all platforms and sometimes
1665# not at the appropriate level. This macro enables a module to test for the
1666# presence of the tool and obtain it's path in separate variables. Coupled with
1667# the --with-xmlto option, it allows maximum flexibilty in making decisions
1668# as whether or not to use the xmlto package. When DEFAULT is not specified,
1669# --with-xmlto assumes 'auto'.
1670#
1671# Interface to module:
1672# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
1673# XMLTO:	returns the path of the xmlto program found
1674#		returns the path set by the user in the environment
1675# --with-xmlto:	'yes' user instructs the module to use xmlto
1676#		'no' user instructs the module not to use xmlto
1677#
1678# Added in version 1.10.0
1679# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
1680#                  xmlto for text output requires either lynx, links, or w3m browsers
1681#
1682# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
1683#
1684AC_DEFUN([XORG_WITH_XMLTO],[
1685AC_ARG_VAR([XMLTO], [Path to xmlto command])
1686m4_define([_defopt], m4_default([$2], [auto]))
1687AC_ARG_WITH(xmlto,
1688	AS_HELP_STRING([--with-xmlto],
1689	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
1690	   [use_xmlto=$withval], [use_xmlto=]_defopt)
1691m4_undefine([_defopt])
1692
1693if test "x$use_xmlto" = x"auto"; then
1694   AC_PATH_PROG([XMLTO], [xmlto])
1695   if test "x$XMLTO" = "x"; then
1696        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
1697	have_xmlto=no
1698   else
1699        have_xmlto=yes
1700   fi
1701elif test "x$use_xmlto" = x"yes" ; then
1702   AC_PATH_PROG([XMLTO], [xmlto])
1703   if test "x$XMLTO" = "x"; then
1704        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
1705   fi
1706   have_xmlto=yes
1707elif test "x$use_xmlto" = x"no" ; then
1708   if test "x$XMLTO" != "x"; then
1709      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
1710   fi
1711   have_xmlto=no
1712else
1713   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
1714fi
1715
1716# Test for a minimum version of xmlto, if provided.
1717m4_ifval([$1],
1718[if test "$have_xmlto" = yes; then
1719    # scrape the xmlto version
1720    AC_MSG_CHECKING([the xmlto version])
1721    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
1722    AC_MSG_RESULT([$xmlto_version])
1723    AS_VERSION_COMPARE([$xmlto_version], [$1],
1724        [if test "x$use_xmlto" = xauto; then
1725            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
1726            have_xmlto=no
1727        else
1728            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
1729        fi])
1730fi])
1731
1732# Test for the ability of xmlto to generate a text target
1733#
1734# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
1735# following test for empty XML docbook files.
1736# For compatibility reasons use the following empty XML docbook file and if
1737# it fails try it again with a non-empty XML file.
1738have_xmlto_text=no
1739cat > conftest.xml << "EOF"
1740EOF
1741AS_IF([test "$have_xmlto" = yes],
1742      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1743             [have_xmlto_text=yes],
1744             [# Try it again with a non-empty XML file.
1745              cat > conftest.xml << "EOF"
1746<x></x>
1747EOF
1748              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
1749                    [have_xmlto_text=yes],
1750                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
1751rm -f conftest.xml
1752AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
1753AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
1754]) # XORG_WITH_XMLTO
1755
1756# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
1757# --------------------------------------------
1758# Minimum version: 1.12.0
1759# Minimum version for optional DEFAULT argument: 1.12.0
1760#
1761# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
1762# XML-based language used for the transformation of XML documents.
1763# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
1764# It is used under the cover by xmlto to generate html files from DocBook/XML.
1765# The XSLT processor is often used as a standalone tool for transformations.
1766# It should not be assumed that this tool is used only to work with documnetation.
1767# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
1768#
1769# Interface to module:
1770# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
1771# XSLTPROC:	 returns the path of the xsltproc program found
1772#		 returns the path set by the user in the environment
1773# --with-xsltproc: 'yes' user instructs the module to use xsltproc
1774#		  'no' user instructs the module not to use xsltproc
1775# have_xsltproc: returns yes if xsltproc found in PATH or no
1776#
1777# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
1778#
1779AC_DEFUN([XORG_WITH_XSLTPROC],[
1780AC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
1781# Preserves the interface, should it be implemented later
1782m4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
1783m4_define([_defopt], m4_default([$2], [auto]))
1784AC_ARG_WITH(xsltproc,
1785	AS_HELP_STRING([--with-xsltproc],
1786	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
1787	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
1788m4_undefine([_defopt])
1789
1790if test "x$use_xsltproc" = x"auto"; then
1791   AC_PATH_PROG([XSLTPROC], [xsltproc])
1792   if test "x$XSLTPROC" = "x"; then
1793        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
1794	have_xsltproc=no
1795   else
1796        have_xsltproc=yes
1797   fi
1798elif test "x$use_xsltproc" = x"yes" ; then
1799   AC_PATH_PROG([XSLTPROC], [xsltproc])
1800   if test "x$XSLTPROC" = "x"; then
1801        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
1802   fi
1803   have_xsltproc=yes
1804elif test "x$use_xsltproc" = x"no" ; then
1805   if test "x$XSLTPROC" != "x"; then
1806      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
1807   fi
1808   have_xsltproc=no
1809else
1810   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
1811fi
1812
1813AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
1814]) # XORG_WITH_XSLTPROC
1815
1816# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
1817# ----------------------------------------
1818# Minimum version: 1.15.0
1819#
1820# PERL (Practical Extraction and Report Language) is a language optimized for
1821# scanning arbitrary text files, extracting information from those text files,
1822# and printing reports based on that information.
1823#
1824# When DEFAULT is not specified, --with-perl assumes 'auto'.
1825#
1826# Interface to module:
1827# HAVE_PERL: used in makefiles to conditionally scan text files
1828# PERL:	     returns the path of the perl program found
1829#	     returns the path set by the user in the environment
1830# --with-perl: 'yes' user instructs the module to use perl
1831#	       'no' user instructs the module not to use perl
1832# have_perl: returns yes if perl found in PATH or no
1833#
1834# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
1835#
1836AC_DEFUN([XORG_WITH_PERL],[
1837AC_ARG_VAR([PERL], [Path to perl command])
1838# Preserves the interface, should it be implemented later
1839m4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
1840m4_define([_defopt], m4_default([$2], [auto]))
1841AC_ARG_WITH(perl,
1842	AS_HELP_STRING([--with-perl],
1843	   [Use perl for extracting information from files (default: ]_defopt[)]),
1844	   [use_perl=$withval], [use_perl=]_defopt)
1845m4_undefine([_defopt])
1846
1847if test "x$use_perl" = x"auto"; then
1848   AC_PATH_PROG([PERL], [perl])
1849   if test "x$PERL" = "x"; then
1850        AC_MSG_WARN([perl not found - cannot extract information and report])
1851	have_perl=no
1852   else
1853        have_perl=yes
1854   fi
1855elif test "x$use_perl" = x"yes" ; then
1856   AC_PATH_PROG([PERL], [perl])
1857   if test "x$PERL" = "x"; then
1858        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
1859   fi
1860   have_perl=yes
1861elif test "x$use_perl" = x"no" ; then
1862   if test "x$PERL" != "x"; then
1863      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
1864   fi
1865   have_perl=no
1866else
1867   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
1868fi
1869
1870AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
1871]) # XORG_WITH_PERL
1872
1873# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
1874# ----------------
1875# Minimum version: 1.5.0
1876# Minimum version for optional DEFAULT argument: 1.11.0
1877#
1878# Documentation tools are not always available on all platforms and sometimes
1879# not at the appropriate level. This macro enables a module to test for the
1880# presence of the tool and obtain it's path in separate variables. Coupled with
1881# the --with-asciidoc option, it allows maximum flexibilty in making decisions
1882# as whether or not to use the asciidoc package. When DEFAULT is not specified,
1883# --with-asciidoc assumes 'auto'.
1884#
1885# Interface to module:
1886# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
1887# ASCIIDOC:	 returns the path of the asciidoc program found
1888#		 returns the path set by the user in the environment
1889# --with-asciidoc: 'yes' user instructs the module to use asciidoc
1890#		  'no' user instructs the module not to use asciidoc
1891#
1892# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
1893#
1894AC_DEFUN([XORG_WITH_ASCIIDOC],[
1895AC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
1896m4_define([_defopt], m4_default([$2], [auto]))
1897AC_ARG_WITH(asciidoc,
1898	AS_HELP_STRING([--with-asciidoc],
1899	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
1900	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
1901m4_undefine([_defopt])
1902
1903if test "x$use_asciidoc" = x"auto"; then
1904   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1905   if test "x$ASCIIDOC" = "x"; then
1906        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
1907	have_asciidoc=no
1908   else
1909        have_asciidoc=yes
1910   fi
1911elif test "x$use_asciidoc" = x"yes" ; then
1912   AC_PATH_PROG([ASCIIDOC], [asciidoc])
1913   if test "x$ASCIIDOC" = "x"; then
1914        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
1915   fi
1916   have_asciidoc=yes
1917elif test "x$use_asciidoc" = x"no" ; then
1918   if test "x$ASCIIDOC" != "x"; then
1919      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
1920   fi
1921   have_asciidoc=no
1922else
1923   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
1924fi
1925m4_ifval([$1],
1926[if test "$have_asciidoc" = yes; then
1927    # scrape the asciidoc version
1928    AC_MSG_CHECKING([the asciidoc version])
1929    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
1930    AC_MSG_RESULT([$asciidoc_version])
1931    AS_VERSION_COMPARE([$asciidoc_version], [$1],
1932        [if test "x$use_asciidoc" = xauto; then
1933            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
1934            have_asciidoc=no
1935        else
1936            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
1937        fi])
1938fi])
1939AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
1940]) # XORG_WITH_ASCIIDOC
1941
1942# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
1943# -------------------------------------------
1944# Minimum version: 1.5.0
1945# Minimum version for optional DEFAULT argument: 1.11.0
1946# Minimum version for optional DOT checking: 1.18.0
1947#
1948# Documentation tools are not always available on all platforms and sometimes
1949# not at the appropriate level. This macro enables a module to test for the
1950# presence of the tool and obtain it's path in separate variables. Coupled with
1951# the --with-doxygen option, it allows maximum flexibilty in making decisions
1952# as whether or not to use the doxygen package. When DEFAULT is not specified,
1953# --with-doxygen assumes 'auto'.
1954#
1955# Interface to module:
1956# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
1957# DOXYGEN:	 returns the path of the doxygen program found
1958#		 returns the path set by the user in the environment
1959# --with-doxygen: 'yes' user instructs the module to use doxygen
1960#		  'no' user instructs the module not to use doxygen
1961#
1962# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
1963#
1964AC_DEFUN([XORG_WITH_DOXYGEN],[
1965AC_ARG_VAR([DOXYGEN], [Path to doxygen command])
1966AC_ARG_VAR([DOT], [Path to the dot graphics utility])
1967m4_define([_defopt], m4_default([$2], [auto]))
1968AC_ARG_WITH(doxygen,
1969	AS_HELP_STRING([--with-doxygen],
1970	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
1971	   [use_doxygen=$withval], [use_doxygen=]_defopt)
1972m4_undefine([_defopt])
1973
1974if test "x$use_doxygen" = x"auto"; then
1975   AC_PATH_PROG([DOXYGEN], [doxygen])
1976   if test "x$DOXYGEN" = "x"; then
1977        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
1978	have_doxygen=no
1979   else
1980        have_doxygen=yes
1981   fi
1982elif test "x$use_doxygen" = x"yes" ; then
1983   AC_PATH_PROG([DOXYGEN], [doxygen])
1984   if test "x$DOXYGEN" = "x"; then
1985        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
1986   fi
1987   have_doxygen=yes
1988elif test "x$use_doxygen" = x"no" ; then
1989   if test "x$DOXYGEN" != "x"; then
1990      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
1991   fi
1992   have_doxygen=no
1993else
1994   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
1995fi
1996m4_ifval([$1],
1997[if test "$have_doxygen" = yes; then
1998    # scrape the doxygen version
1999    AC_MSG_CHECKING([the doxygen version])
2000    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2001    AC_MSG_RESULT([$doxygen_version])
2002    AS_VERSION_COMPARE([$doxygen_version], [$1],
2003        [if test "x$use_doxygen" = xauto; then
2004            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2005            have_doxygen=no
2006        else
2007            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2008        fi])
2009fi])
2010
2011dnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2012dnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2013dnl 	HAVE_DOT = @HAVE_DOT@
2014HAVE_DOT=no
2015if test "x$have_doxygen" = "xyes"; then
2016  AC_PATH_PROG([DOT], [dot])
2017    if test "x$DOT" != "x"; then
2018      HAVE_DOT=yes
2019    fi
2020fi
2021
2022AC_SUBST([HAVE_DOT])
2023AM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2024AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2025]) # XORG_WITH_DOXYGEN
2026
2027# XORG_WITH_GROFF([DEFAULT])
2028# ----------------
2029# Minimum version: 1.6.0
2030# Minimum version for optional DEFAULT argument: 1.11.0
2031#
2032# Documentation tools are not always available on all platforms and sometimes
2033# not at the appropriate level. This macro enables a module to test for the
2034# presence of the tool and obtain it's path in separate variables. Coupled with
2035# the --with-groff option, it allows maximum flexibilty in making decisions
2036# as whether or not to use the groff package. When DEFAULT is not specified,
2037# --with-groff assumes 'auto'.
2038#
2039# Interface to module:
2040# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2041# HAVE_GROFF_MM: the memorandum macros (-mm) package
2042# HAVE_GROFF_MS: the -ms macros package
2043# GROFF:	 returns the path of the groff program found
2044#		 returns the path set by the user in the environment
2045# --with-groff:	 'yes' user instructs the module to use groff
2046#		 'no' user instructs the module not to use groff
2047#
2048# Added in version 1.9.0:
2049# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2050#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2051#		   psselect from the psutils package.
2052#		   the ghostcript package. Refer to the grohtml man pages
2053#
2054# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2055#
2056# OS and distros often splits groff in a basic and full package, the former
2057# having the groff program and the later having devices, fonts and macros
2058# Checking for the groff executable is not enough.
2059#
2060# If macros are missing, we cannot assume that groff is useless, so we don't
2061# unset HAVE_GROFF or GROFF env variables.
2062# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2063#
2064AC_DEFUN([XORG_WITH_GROFF],[
2065AC_ARG_VAR([GROFF], [Path to groff command])
2066m4_define([_defopt], m4_default([$1], [auto]))
2067AC_ARG_WITH(groff,
2068	AS_HELP_STRING([--with-groff],
2069	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2070	   [use_groff=$withval], [use_groff=]_defopt)
2071m4_undefine([_defopt])
2072
2073if test "x$use_groff" = x"auto"; then
2074   AC_PATH_PROG([GROFF], [groff])
2075   if test "x$GROFF" = "x"; then
2076        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2077	have_groff=no
2078   else
2079        have_groff=yes
2080   fi
2081elif test "x$use_groff" = x"yes" ; then
2082   AC_PATH_PROG([GROFF], [groff])
2083   if test "x$GROFF" = "x"; then
2084        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2085   fi
2086   have_groff=yes
2087elif test "x$use_groff" = x"no" ; then
2088   if test "x$GROFF" != "x"; then
2089      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2090   fi
2091   have_groff=no
2092else
2093   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2094fi
2095
2096# We have groff, test for the presence of the macro packages
2097if test "x$have_groff" = x"yes"; then
2098    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2099    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2100        groff_ms_works=yes
2101    else
2102        groff_ms_works=no
2103    fi
2104    AC_MSG_RESULT([$groff_ms_works])
2105    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2106    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2107        groff_mm_works=yes
2108    else
2109        groff_mm_works=no
2110    fi
2111    AC_MSG_RESULT([$groff_mm_works])
2112fi
2113
2114# We have groff, test for HTML dependencies, one command per package
2115if test "x$have_groff" = x"yes"; then
2116   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2117   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2118   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2119   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2120      have_groff_html=yes
2121   else
2122      have_groff_html=no
2123      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2124   fi
2125fi
2126
2127# Set Automake conditionals for Makefiles
2128AM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2129AM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2130AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2131AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2132]) # XORG_WITH_GROFF
2133
2134# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2135# ---------------------------------------
2136# Minimum version: 1.6.0
2137# Minimum version for optional DEFAULT argument: 1.11.0
2138# Minimum version for optional MIN-VERSION argument: 1.15.0
2139#
2140# Documentation tools are not always available on all platforms and sometimes
2141# not at the appropriate level. This macro enables a module to test for the
2142# presence of the tool and obtain it's path in separate variables. Coupled with
2143# the --with-fop option, it allows maximum flexibilty in making decisions
2144# as whether or not to use the fop package. When DEFAULT is not specified,
2145# --with-fop assumes 'auto'.
2146#
2147# Interface to module:
2148# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2149# FOP:	 	returns the path of the fop program found
2150#		returns the path set by the user in the environment
2151# --with-fop: 	'yes' user instructs the module to use fop
2152#		'no' user instructs the module not to use fop
2153#
2154# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2155#
2156AC_DEFUN([XORG_WITH_FOP],[
2157AC_ARG_VAR([FOP], [Path to fop command])
2158m4_define([_defopt], m4_default([$2], [auto]))
2159AC_ARG_WITH(fop,
2160	AS_HELP_STRING([--with-fop],
2161	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2162	   [use_fop=$withval], [use_fop=]_defopt)
2163m4_undefine([_defopt])
2164
2165if test "x$use_fop" = x"auto"; then
2166   AC_PATH_PROG([FOP], [fop])
2167   if test "x$FOP" = "x"; then
2168        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2169	have_fop=no
2170   else
2171        have_fop=yes
2172   fi
2173elif test "x$use_fop" = x"yes" ; then
2174   AC_PATH_PROG([FOP], [fop])
2175   if test "x$FOP" = "x"; then
2176        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2177   fi
2178   have_fop=yes
2179elif test "x$use_fop" = x"no" ; then
2180   if test "x$FOP" != "x"; then
2181      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2182   fi
2183   have_fop=no
2184else
2185   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2186fi
2187
2188# Test for a minimum version of fop, if provided.
2189m4_ifval([$1],
2190[if test "$have_fop" = yes; then
2191    # scrape the fop version
2192    AC_MSG_CHECKING([for fop minimum version])
2193    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2194    AC_MSG_RESULT([$fop_version])
2195    AS_VERSION_COMPARE([$fop_version], [$1],
2196        [if test "x$use_fop" = xauto; then
2197            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2198            have_fop=no
2199        else
2200            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2201        fi])
2202fi])
2203AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2204]) # XORG_WITH_FOP
2205
2206# XORG_WITH_M4([MIN-VERSION])
2207# ---------------------------
2208# Minimum version: 1.19.0
2209#
2210# This macro attempts to locate an m4 macro processor which supports
2211# -I option and is only useful for modules relying on M4 in order to
2212# expand macros in source code files.
2213#
2214# Interface to module:
2215# M4:	 	returns the path of the m4 program found
2216#		returns the path set by the user in the environment
2217#
2218AC_DEFUN([XORG_WITH_M4], [
2219AC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2220   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2221       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2222         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2223   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2224   [$PATH:/usr/gnu/bin])])
2225
2226AC_SUBST([M4], [$ac_cv_path_M4])
2227]) # XORG_WITH_M4
2228
2229# XORG_WITH_PS2PDF([DEFAULT])
2230# ----------------
2231# Minimum version: 1.6.0
2232# Minimum version for optional DEFAULT argument: 1.11.0
2233#
2234# Documentation tools are not always available on all platforms and sometimes
2235# not at the appropriate level. This macro enables a module to test for the
2236# presence of the tool and obtain it's path in separate variables. Coupled with
2237# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2238# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2239# --with-ps2pdf assumes 'auto'.
2240#
2241# Interface to module:
2242# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2243# PS2PDF:	returns the path of the ps2pdf program found
2244#		returns the path set by the user in the environment
2245# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2246#		 'no' user instructs the module not to use ps2pdf
2247#
2248# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2249#
2250AC_DEFUN([XORG_WITH_PS2PDF],[
2251AC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2252m4_define([_defopt], m4_default([$1], [auto]))
2253AC_ARG_WITH(ps2pdf,
2254	AS_HELP_STRING([--with-ps2pdf],
2255	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2256	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2257m4_undefine([_defopt])
2258
2259if test "x$use_ps2pdf" = x"auto"; then
2260   AC_PATH_PROG([PS2PDF], [ps2pdf])
2261   if test "x$PS2PDF" = "x"; then
2262        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2263	have_ps2pdf=no
2264   else
2265        have_ps2pdf=yes
2266   fi
2267elif test "x$use_ps2pdf" = x"yes" ; then
2268   AC_PATH_PROG([PS2PDF], [ps2pdf])
2269   if test "x$PS2PDF" = "x"; then
2270        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2271   fi
2272   have_ps2pdf=yes
2273elif test "x$use_ps2pdf" = x"no" ; then
2274   if test "x$PS2PDF" != "x"; then
2275      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2276   fi
2277   have_ps2pdf=no
2278else
2279   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2280fi
2281AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2282]) # XORG_WITH_PS2PDF
2283
2284# XORG_ENABLE_DOCS (enable_docs=yes)
2285# ----------------
2286# Minimum version: 1.6.0
2287#
2288# Documentation tools are not always available on all platforms and sometimes
2289# not at the appropriate level. This macro enables a builder to skip all
2290# documentation targets except traditional man pages.
2291# Combined with the specific tool checking macros XORG_WITH_*, it provides
2292# maximum flexibilty in controlling documentation building.
2293# Refer to:
2294# XORG_WITH_XMLTO         --with-xmlto
2295# XORG_WITH_ASCIIDOC      --with-asciidoc
2296# XORG_WITH_DOXYGEN       --with-doxygen
2297# XORG_WITH_FOP           --with-fop
2298# XORG_WITH_GROFF         --with-groff
2299# XORG_WITH_PS2PDF        --with-ps2pdf
2300#
2301# Interface to module:
2302# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2303# --enable-docs: 'yes' user instructs the module to generate docs
2304#		 'no' user instructs the module not to generate docs
2305# parm1:	specify the default value, yes or no.
2306#
2307AC_DEFUN([XORG_ENABLE_DOCS],[
2308m4_define([docs_default], m4_default([$1], [yes]))
2309AC_ARG_ENABLE(docs,
2310	AS_HELP_STRING([--enable-docs],
2311	   [Enable building the documentation (default: ]docs_default[)]),
2312	   [build_docs=$enableval], [build_docs=]docs_default)
2313m4_undefine([docs_default])
2314AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2315AC_MSG_CHECKING([whether to build documentation])
2316AC_MSG_RESULT([$build_docs])
2317]) # XORG_ENABLE_DOCS
2318
2319# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2320# ----------------
2321# Minimum version: 1.6.0
2322#
2323# This macro enables a builder to skip all developer documentation.
2324# Combined with the specific tool checking macros XORG_WITH_*, it provides
2325# maximum flexibilty in controlling documentation building.
2326# Refer to:
2327# XORG_WITH_XMLTO         --with-xmlto
2328# XORG_WITH_ASCIIDOC      --with-asciidoc
2329# XORG_WITH_DOXYGEN       --with-doxygen
2330# XORG_WITH_FOP           --with-fop
2331# XORG_WITH_GROFF         --with-groff
2332# XORG_WITH_PS2PDF        --with-ps2pdf
2333#
2334# Interface to module:
2335# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2336# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2337#			'no' user instructs the module not to generate developer docs
2338# parm1:		specify the default value, yes or no.
2339#
2340AC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2341m4_define([devel_default], m4_default([$1], [yes]))
2342AC_ARG_ENABLE(devel-docs,
2343	AS_HELP_STRING([--enable-devel-docs],
2344	   [Enable building the developer documentation (default: ]devel_default[)]),
2345	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2346m4_undefine([devel_default])
2347AM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2348AC_MSG_CHECKING([whether to build developer documentation])
2349AC_MSG_RESULT([$build_devel_docs])
2350]) # XORG_ENABLE_DEVEL_DOCS
2351
2352# XORG_ENABLE_SPECS (enable_specs=yes)
2353# ----------------
2354# Minimum version: 1.6.0
2355#
2356# This macro enables a builder to skip all functional specification targets.
2357# Combined with the specific tool checking macros XORG_WITH_*, it provides
2358# maximum flexibilty in controlling documentation building.
2359# Refer to:
2360# XORG_WITH_XMLTO         --with-xmlto
2361# XORG_WITH_ASCIIDOC      --with-asciidoc
2362# XORG_WITH_DOXYGEN       --with-doxygen
2363# XORG_WITH_FOP           --with-fop
2364# XORG_WITH_GROFF         --with-groff
2365# XORG_WITH_PS2PDF        --with-ps2pdf
2366#
2367# Interface to module:
2368# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2369# --enable-specs:	'yes' user instructs the module to generate specs
2370#			'no' user instructs the module not to generate specs
2371# parm1:		specify the default value, yes or no.
2372#
2373AC_DEFUN([XORG_ENABLE_SPECS],[
2374m4_define([spec_default], m4_default([$1], [yes]))
2375AC_ARG_ENABLE(specs,
2376	AS_HELP_STRING([--enable-specs],
2377	   [Enable building the specs (default: ]spec_default[)]),
2378	   [build_specs=$enableval], [build_specs=]spec_default)
2379m4_undefine([spec_default])
2380AM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2381AC_MSG_CHECKING([whether to build functional specifications])
2382AC_MSG_RESULT([$build_specs])
2383]) # XORG_ENABLE_SPECS
2384
2385# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2386# ----------------------------------------------
2387# Minimum version: 1.13.0
2388#
2389# This macro enables a builder to enable/disable unit testing
2390# It makes no assumption about the test cases implementation
2391# Test cases may or may not use Automake "Support for test suites"
2392# They may or may not use the software utility library GLib
2393#
2394# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2395# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2396# The variable enable_unit_tests is used by other macros in this file.
2397#
2398# Interface to module:
2399# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2400# enable_unit_tests:    used in configure.ac for additional configuration
2401# --enable-unit-tests:	'yes' user instructs the module to build tests
2402#			'no' user instructs the module not to build tests
2403# parm1:		specify the default value, yes or no.
2404#
2405AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2406AC_BEFORE([$0], [XORG_WITH_GLIB])
2407AC_BEFORE([$0], [XORG_LD_WRAP])
2408AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2409m4_define([_defopt], m4_default([$1], [auto]))
2410AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2411	[Enable building unit test cases (default: ]_defopt[)]),
2412	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2413m4_undefine([_defopt])
2414AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2415AC_MSG_CHECKING([whether to build unit test cases])
2416AC_MSG_RESULT([$enable_unit_tests])
2417]) # XORG_ENABLE_UNIT_TESTS
2418
2419# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2420# ------------------------------------------------------
2421# Minimum version: 1.17.0
2422#
2423# This macro enables a builder to enable/disable integration testing
2424# It makes no assumption about the test cases' implementation
2425# Test cases may or may not use Automake "Support for test suites"
2426#
2427# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2428# usually requires less dependencies and may be built and run under less
2429# stringent environments than integration tests.
2430#
2431# Interface to module:
2432# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2433# enable_integration_tests:   used in configure.ac for additional configuration
2434# --enable-integration-tests: 'yes' user instructs the module to build tests
2435#                             'no' user instructs the module not to build tests
2436# parm1:                      specify the default value, yes or no.
2437#
2438AC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2439AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2440m4_define([_defopt], m4_default([$1], [auto]))
2441AC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2442	[Enable building integration test cases (default: ]_defopt[)]),
2443	[enable_integration_tests=$enableval],
2444	[enable_integration_tests=]_defopt)
2445m4_undefine([_defopt])
2446AM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2447	[test "x$enable_integration_tests" != xno])
2448AC_MSG_CHECKING([whether to build unit test cases])
2449AC_MSG_RESULT([$enable_integration_tests])
2450]) # XORG_ENABLE_INTEGRATION_TESTS
2451
2452# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2453# ----------------------------------------
2454# Minimum version: 1.13.0
2455#
2456# GLib is a library which provides advanced data structures and functions.
2457# This macro enables a module to test for the presence of Glib.
2458#
2459# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2460# Otherwise the value of $enable_unit_tests is blank.
2461#
2462# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2463# test support usually requires less dependencies and may be built and run under
2464# less stringent environments than integration tests.
2465#
2466# Interface to module:
2467# HAVE_GLIB: used in makefiles to conditionally build targets
2468# with_glib: used in configure.ac to know if GLib has been found
2469# --with-glib:	'yes' user instructs the module to use glib
2470#		'no' user instructs the module not to use glib
2471#
2472AC_DEFUN([XORG_WITH_GLIB],[
2473AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2474m4_define([_defopt], m4_default([$2], [auto]))
2475AC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2476	[Use GLib library for unit testing (default: ]_defopt[)]),
2477	[with_glib=$withval], [with_glib=]_defopt)
2478m4_undefine([_defopt])
2479
2480have_glib=no
2481# Do not probe GLib if user explicitly disabled unit testing
2482if test "x$enable_unit_tests" != x"no"; then
2483  # Do not probe GLib if user explicitly disabled it
2484  if test "x$with_glib" != x"no"; then
2485    m4_ifval(
2486      [$1],
2487      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
2488      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
2489    )
2490  fi
2491fi
2492
2493# Not having GLib when unit testing has been explicitly requested is an error
2494if test "x$enable_unit_tests" = x"yes"; then
2495  if test "x$have_glib" = x"no"; then
2496    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2497  fi
2498fi
2499
2500# Having unit testing disabled when GLib has been explicitly requested is an error
2501if test "x$enable_unit_tests" = x"no"; then
2502  if test "x$with_glib" = x"yes"; then
2503    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
2504  fi
2505fi
2506
2507# Not having GLib when it has been explicitly requested is an error
2508if test "x$with_glib" = x"yes"; then
2509  if test "x$have_glib" = x"no"; then
2510    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
2511  fi
2512fi
2513
2514AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2515]) # XORG_WITH_GLIB
2516
2517# XORG_LD_WRAP([required|optional])
2518# ---------------------------------
2519# Minimum version: 1.13.0
2520#
2521# Check if linker supports -wrap, passed via compiler flags
2522#
2523# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2524# Otherwise the value of $enable_unit_tests is blank.
2525#
2526# Argument added in 1.16.0 - default is "required", to match existing behavior
2527# of returning an error if enable_unit_tests is yes, and ld -wrap is not
2528# available, an argument of "optional" allows use when some unit tests require
2529# ld -wrap and others do not.
2530#
2531AC_DEFUN([XORG_LD_WRAP],[
2532XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
2533    [AC_LANG_PROGRAM([#include <stdlib.h>
2534                      void __wrap_exit(int status) { return; }],
2535                     [exit(0);])])
2536# Not having ld wrap when unit testing has been explicitly requested is an error
2537if test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2538  if test "x$have_ld_wrap" = x"no"; then
2539    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2540  fi
2541fi
2542AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
2543#
2544]) # XORG_LD_WRAP
2545
2546# XORG_CHECK_LINKER_FLAGS
2547# -----------------------
2548# SYNOPSIS
2549#
2550#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2551#
2552# DESCRIPTION
2553#
2554#   Check whether the given linker FLAGS work with the current language's
2555#   linker, or whether they give an error.
2556#
2557#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2558#   success/failure.
2559#
2560#   PROGRAM-SOURCE is the program source to link with, if needed
2561#
2562#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2563#
2564# LICENSE
2565#
2566#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
2567#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
2568#   Copyright (c) 2009 Matteo Frigo
2569#
2570#   This program is free software: you can redistribute it and/or modify it
2571#   under the terms of the GNU General Public License as published by the
2572#   Free Software Foundation, either version 3 of the License, or (at your
2573#   option) any later version.
2574#
2575#   This program is distributed in the hope that it will be useful, but
2576#   WITHOUT ANY WARRANTY; without even the implied warranty of
2577#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
2578#   Public License for more details.
2579#
2580#   You should have received a copy of the GNU General Public License along
2581#   with this program. If not, see <http://www.gnu.org/licenses/>.
2582#
2583#   As a special exception, the respective Autoconf Macro's copyright owner
2584#   gives unlimited permission to copy, distribute and modify the configure
2585#   scripts that are the output of Autoconf when processing the Macro. You
2586#   need not follow the terms of the GNU General Public License when using
2587#   or distributing such scripts, even though portions of the text of the
2588#   Macro appear in them. The GNU General Public License (GPL) does govern
2589#   all other use of the material that constitutes the Autoconf Macro.
2590#
2591#   This special exception to the GPL applies to versions of the Autoconf
2592#   Macro released by the Autoconf Archive. When you make and distribute a
2593#   modified version of the Autoconf Macro, you may extend this special
2594#   exception to the GPL to apply to your modified version as well.#
2595AC_DEFUN([XORG_CHECK_LINKER_FLAGS],
2596[AC_MSG_CHECKING([whether the linker accepts $1])
2597dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
2598AS_LITERAL_IF([$1],
2599  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2600      ax_save_FLAGS=$LDFLAGS
2601      LDFLAGS="$1"
2602      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2603        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2604        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2605      LDFLAGS=$ax_save_FLAGS])],
2606  [ax_save_FLAGS=$LDFLAGS
2607   LDFLAGS="$1"
2608   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
2609     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2610     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2611   LDFLAGS=$ax_save_FLAGS])
2612eval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
2613AC_MSG_RESULT($xorg_check_linker_flags)
2614if test "x$xorg_check_linker_flags" = xyes; then
2615	m4_default([$2], :)
2616else
2617	m4_default([$3], :)
2618fi
2619]) # XORG_CHECK_LINKER_FLAGS
2620
2621# XORG_MEMORY_CHECK_FLAGS
2622# -----------------------
2623# Minimum version: 1.16.0
2624#
2625# This macro attempts to find appropriate memory checking functionality
2626# for various platforms which unit testing code may use to catch various
2627# forms of memory allocation and access errors in testing.
2628#
2629# Interface to module:
2630# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
2631#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
2632#
2633# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
2634#
2635AC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
2636
2637AC_REQUIRE([AC_CANONICAL_HOST])
2638AC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
2639           [Environment variables to enable memory checking in tests])
2640
2641# Check for different types of support on different platforms
2642case $host_os in
2643    solaris*)
2644        AC_CHECK_LIB([umem], [umem_alloc],
2645            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
2646        ;;
2647    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
2648        # both directly and inverted, so should not be 0 or 255.
2649        malloc_debug_env='MALLOC_PERTURB_=15'
2650        ;;
2651    darwin*)
2652        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
2653        ;;
2654    *bsd*)
2655        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
2656        ;;
2657esac
2658
2659# User supplied flags override default flags
2660if test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
2661    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
2662fi
2663
2664AC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
2665]) # XORG_WITH_LINT
2666
2667# XORG_CHECK_MALLOC_ZERO
2668# ----------------------
2669# Minimum version: 1.0.0
2670#
2671# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
2672# malloc(0) returns NULL.  Packages should add one of these cflags to
2673# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
2674AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
2675AC_ARG_ENABLE(malloc0returnsnull,
2676	AS_HELP_STRING([--enable-malloc0returnsnull],
2677		       [malloc(0) returns NULL (default: auto)]),
2678	[MALLOC_ZERO_RETURNS_NULL=$enableval],
2679	[MALLOC_ZERO_RETURNS_NULL=auto])
2680
2681AC_MSG_CHECKING([whether malloc(0) returns NULL])
2682if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
2683AC_CACHE_VAL([xorg_cv_malloc0_returns_null],
2684	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
2685#include <stdlib.h>
2686],[
2687    char *m0, *r0, *c0, *p;
2688    m0 = malloc(0);
2689    p = malloc(10);
2690    r0 = realloc(p,0);
2691    c0 = calloc(0,10);
2692    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
2693])],
2694		[xorg_cv_malloc0_returns_null=yes],
2695		[xorg_cv_malloc0_returns_null=no])])
2696MALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
2697fi
2698AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
2699
2700if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
2701	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
2702	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
2703	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
2704else
2705	MALLOC_ZERO_CFLAGS=""
2706	XMALLOC_ZERO_CFLAGS=""
2707	XTMALLOC_ZERO_CFLAGS=""
2708fi
2709
2710AC_SUBST([MALLOC_ZERO_CFLAGS])
2711AC_SUBST([XMALLOC_ZERO_CFLAGS])
2712AC_SUBST([XTMALLOC_ZERO_CFLAGS])
2713]) # XORG_CHECK_MALLOC_ZERO
2714
2715# XORG_WITH_LINT()
2716# ----------------
2717# Minimum version: 1.1.0
2718#
2719# This macro enables the use of a tool that flags some suspicious and
2720# non-portable constructs (likely to be bugs) in C language source code.
2721# It will attempt to locate the tool and use appropriate options.
2722# There are various lint type tools on different platforms.
2723#
2724# Interface to module:
2725# LINT:		returns the path to the tool found on the platform
2726#		or the value set to LINT on the configure cmd line
2727#		also an Automake conditional
2728# LINT_FLAGS:	an Automake variable with appropriate flags
2729#
2730# --with-lint:	'yes' user instructs the module to use lint
2731#		'no' user instructs the module not to use lint (default)
2732#
2733# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
2734# If the user sets the value of LINT_FLAGS, they are used verbatim.
2735#
2736AC_DEFUN([XORG_WITH_LINT],[
2737
2738AC_ARG_VAR([LINT], [Path to a lint-style command])
2739AC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
2740AC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
2741		[Use a lint-style source code checker (default: disabled)])],
2742		[use_lint=$withval], [use_lint=no])
2743
2744# Obtain platform specific info like program name and options
2745# The lint program on FreeBSD and NetBSD is different from the one on Solaris
2746case $host_os in
2747  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
2748	lint_name=splint
2749	lint_options="-badflag"
2750	;;
2751  *freebsd* | *netbsd*)
2752	lint_name=lint
2753	lint_options="-u -b"
2754	;;
2755  *solaris*)
2756	lint_name=lint
2757	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
2758	;;
2759esac
2760
2761# Test for the presence of the program (either guessed by the code or spelled out by the user)
2762if test "x$use_lint" = x"yes" ; then
2763   AC_PATH_PROG([LINT], [$lint_name])
2764   if test "x$LINT" = "x"; then
2765        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
2766   fi
2767elif test "x$use_lint" = x"no" ; then
2768   if test "x$LINT" != "x"; then
2769      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
2770   fi
2771else
2772   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
2773fi
2774
2775# User supplied flags override default flags
2776if test "x$LINT_FLAGS" != "x"; then
2777   lint_options=$LINT_FLAGS
2778fi
2779
2780AC_SUBST([LINT_FLAGS],[$lint_options])
2781AM_CONDITIONAL(LINT, [test "x$LINT" != x])
2782
2783]) # XORG_WITH_LINT
2784
2785# XORG_LINT_LIBRARY(LIBNAME)
2786# --------------------------
2787# Minimum version: 1.1.0
2788#
2789# Sets up flags for building lint libraries for checking programs that call
2790# functions in the library.
2791#
2792# Interface to module:
2793# LINTLIB		- Automake variable with the name of lint library file to make
2794# MAKE_LINT_LIB		- Automake conditional
2795#
2796# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
2797#			  - 'no' user instructs the module not to create a lint library (default)
2798
2799AC_DEFUN([XORG_LINT_LIBRARY],[
2800AC_REQUIRE([XORG_WITH_LINT])
2801AC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
2802	[Create lint library (default: disabled)])],
2803	[make_lint_lib=$enableval], [make_lint_lib=no])
2804
2805if test "x$make_lint_lib" = x"yes" ; then
2806   LINTLIB=llib-l$1.ln
2807   if test "x$LINT" = "x"; then
2808        AC_MSG_ERROR([Cannot make lint library without --with-lint])
2809   fi
2810elif test "x$make_lint_lib" != x"no" ; then
2811   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
2812fi
2813
2814AC_SUBST(LINTLIB)
2815AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
2816
2817]) # XORG_LINT_LIBRARY
2818
2819# XORG_COMPILER_BRAND
2820# -------------------
2821# Minimum version: 1.14.0
2822#
2823# Checks for various brands of compilers and sets flags as appropriate:
2824#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
2825#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
2826#   clang compiler - sets CLANGCC to "yes"
2827#   Intel compiler - sets INTELCC to "yes"
2828#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
2829#
2830AC_DEFUN([XORG_COMPILER_BRAND], [
2831AC_LANG_CASE(
2832	[C], [
2833		AC_REQUIRE([AC_PROG_CC_C99])
2834	],
2835	[C++], [
2836		AC_REQUIRE([AC_PROG_CXX])
2837	]
2838)
2839AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
2840AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
2841AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2842]) # XORG_COMPILER_BRAND
2843
2844# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2845# ---------------
2846# Minimum version: 1.16.0
2847#
2848# Test if the compiler works when passed the given flag as a command line argument.
2849# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
2850# next flag in the list until there are no more options.
2851#
2852# Note that this does not guarantee that the compiler supports the flag as some
2853# compilers will simply ignore arguments that they do not understand, but we do
2854# attempt to weed out false positives by using -Werror=unknown-warning-option and
2855# -Werror=unused-command-line-argument
2856#
2857AC_DEFUN([XORG_TESTSET_CFLAG], [
2858m4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2859m4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2860
2861AC_LANG_COMPILER_REQUIRE
2862
2863AC_LANG_CASE(
2864	[C], [
2865		AC_REQUIRE([AC_PROG_CC_C99])
2866		define([PREFIX], [C])
2867		define([CACHE_PREFIX], [cc])
2868		define([COMPILER], [$CC])
2869	],
2870	[C++], [
2871		define([PREFIX], [CXX])
2872		define([CACHE_PREFIX], [cxx])
2873		define([COMPILER], [$CXX])
2874	]
2875)
2876
2877[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
2878
2879if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
2880	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2881	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
2882			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
2883			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2884					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
2885					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
2886	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
2887	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2888fi
2889
2890if test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
2891	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
2892		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2893	fi
2894	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2895	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
2896			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
2897			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2898					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
2899					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
2900	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
2901	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2902fi
2903
2904found="no"
2905m4_foreach([flag], m4_cdr($@), [
2906	if test $found = "no" ; then
2907		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
2908			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
2909		fi
2910
2911		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
2912			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
2913		fi
2914
2915		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
2916
2917dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2918		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
2919		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
2920		AC_CACHE_VAL($cacheid,
2921			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2922					     [eval $cacheid=yes],
2923					     [eval $cacheid=no])])
2924
2925		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
2926
2927		eval supported=\$$cacheid
2928		AC_MSG_RESULT([$supported])
2929		if test "$supported" = "yes" ; then
2930			$1="$$1 ]flag["
2931			found="yes"
2932		fi
2933	fi
2934])
2935]) # XORG_TESTSET_CFLAG
2936
2937# XORG_COMPILER_FLAGS
2938# ---------------
2939# Minimum version: 1.16.0
2940#
2941# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
2942# arguments supported by the selected compiler which do NOT alter the generated
2943# code.  These arguments will cause the compiler to print various warnings
2944# during compilation AND turn a conservative set of warnings into errors.
2945#
2946# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
2947# future versions of util-macros as options are added to new compilers.
2948#
2949AC_DEFUN([XORG_COMPILER_FLAGS], [
2950AC_REQUIRE([XORG_COMPILER_BRAND])
2951
2952AC_ARG_ENABLE(selective-werror,
2953              AS_HELP_STRING([--disable-selective-werror],
2954                             [Turn off selective compiler errors. (default: enabled)]),
2955              [SELECTIVE_WERROR=$enableval],
2956              [SELECTIVE_WERROR=yes])
2957
2958AC_LANG_CASE(
2959        [C], [
2960                define([PREFIX], [C])
2961        ],
2962        [C++], [
2963                define([PREFIX], [CXX])
2964        ]
2965)
2966# -v is too short to test reliably with XORG_TESTSET_CFLAG
2967if test "x$SUNCC" = "xyes"; then
2968    [BASE_]PREFIX[FLAGS]="-v"
2969else
2970    [BASE_]PREFIX[FLAGS]=""
2971fi
2972
2973# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2974XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
2975XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
2976XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
2977XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
2978
2979AC_LANG_CASE(
2980	[C], [
2981		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
2982		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
2983		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
2984		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
2985		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
2986		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
2987	]
2988)
2989
2990# This chunk adds additional warnings that could catch undesired effects.
2991XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
2992XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
2993XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
2994XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
2995XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
2996XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
2997XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
2998
2999# These are currently disabled because they are noisy.  They will be enabled
3000# in the future once the codebase is sufficiently modernized to silence
3001# them.  For now, I don't want them to drown out the other warnings.
3002# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3003# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3004# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3005
3006# Turn some warnings into errors, so we don't accidently get successful builds
3007# when there are problems that should be fixed.
3008
3009if test "x$SELECTIVE_WERROR" = "xyes" ; then
3010XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3011XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3012XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3013XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3014XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3015XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3016XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3017XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3018XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3019XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3020XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3021XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3022XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3023else
3024AC_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])
3025XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3026XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3027XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3028XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3029XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3030XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3031XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3032XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3033XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3034XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3035XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3036XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3037XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3038fi
3039
3040AC_SUBST([BASE_]PREFIX[FLAGS])
3041]) # XORG_COMPILER_FLAGS
3042
3043# XORG_CWARNFLAGS
3044# ---------------
3045# Minimum version: 1.2.0
3046# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3047#
3048# Defines CWARNFLAGS to enable C compiler warnings.
3049#
3050# This function is deprecated because it defines -fno-strict-aliasing
3051# which alters the code generated by the compiler.  If -fno-strict-aliasing
3052# is needed, then it should be added explicitly in the module when
3053# it is updated to use BASE_CFLAGS.
3054#
3055AC_DEFUN([XORG_CWARNFLAGS], [
3056AC_REQUIRE([XORG_COMPILER_FLAGS])
3057AC_REQUIRE([XORG_COMPILER_BRAND])
3058AC_LANG_CASE(
3059	[C], [
3060		CWARNFLAGS="$BASE_CFLAGS"
3061		if  test "x$GCC" = xyes ; then
3062		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3063		fi
3064		AC_SUBST(CWARNFLAGS)
3065	]
3066)
3067]) # XORG_CWARNFLAGS
3068
3069# XORG_STRICT_OPTION
3070# -----------------------
3071# Minimum version: 1.3.0
3072#
3073# Add configure option to enable strict compilation flags, such as treating
3074# warnings as fatal errors.
3075# If --enable-strict-compilation is passed to configure, adds strict flags to
3076# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3077#
3078# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3079# when strict compilation is unconditionally desired.
3080AC_DEFUN([XORG_STRICT_OPTION], [
3081AC_REQUIRE([XORG_CWARNFLAGS])
3082AC_REQUIRE([XORG_COMPILER_FLAGS])
3083
3084AC_ARG_ENABLE(strict-compilation,
3085			  AS_HELP_STRING([--enable-strict-compilation],
3086			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3087			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3088
3089AC_LANG_CASE(
3090        [C], [
3091                define([PREFIX], [C])
3092        ],
3093        [C++], [
3094                define([PREFIX], [CXX])
3095        ]
3096)
3097
3098[STRICT_]PREFIX[FLAGS]=""
3099XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3100XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3101
3102# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3103# activate it with -Werror, so we add it here explicitly.
3104XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3105
3106if test "x$STRICT_COMPILE" = "xyes"; then
3107    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3108    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3109fi
3110AC_SUBST([STRICT_]PREFIX[FLAGS])
3111AC_SUBST([BASE_]PREFIX[FLAGS])
3112AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3113]) # XORG_STRICT_OPTION
3114
3115# XORG_DEFAULT_OPTIONS
3116# --------------------
3117# Minimum version: 1.3.0
3118#
3119# Defines default options for X.Org modules.
3120#
3121AC_DEFUN([XORG_DEFAULT_OPTIONS], [
3122AC_REQUIRE([AC_PROG_INSTALL])
3123XORG_COMPILER_FLAGS
3124XORG_CWARNFLAGS
3125XORG_STRICT_OPTION
3126XORG_RELEASE_VERSION
3127XORG_CHANGELOG
3128XORG_INSTALL
3129XORG_MANPAGE_SECTIONS
3130m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3131    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3132]) # XORG_DEFAULT_OPTIONS
3133
3134# XORG_INSTALL()
3135# ----------------
3136# Minimum version: 1.4.0
3137#
3138# Defines the variable INSTALL_CMD as the command to copy
3139# INSTALL from $prefix/share/util-macros.
3140#
3141AC_DEFUN([XORG_INSTALL], [
3142AC_REQUIRE([PKG_PROG_PKG_CONFIG])
3143macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3144INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3145mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3146|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3147touch \$(top_srcdir)/INSTALL; \
3148echo 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3149AC_SUBST([INSTALL_CMD])
3150]) # XORG_INSTALL
3151dnl Copyright 2005 Red Hat, Inc
3152dnl
3153dnl Permission to use, copy, modify, distribute, and sell this software and its
3154dnl documentation for any purpose is hereby granted without fee, provided that
3155dnl the above copyright notice appear in all copies and that both that
3156dnl copyright notice and this permission notice appear in supporting
3157dnl documentation.
3158dnl
3159dnl The above copyright notice and this permission notice shall be included
3160dnl in all copies or substantial portions of the Software.
3161dnl
3162dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3163dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3164dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3165dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3166dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3167dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3168dnl OTHER DEALINGS IN THE SOFTWARE.
3169dnl
3170dnl Except as contained in this notice, the name of the copyright holders shall
3171dnl not be used in advertising or otherwise to promote the sale, use or
3172dnl other dealings in this Software without prior written authorization
3173dnl from the copyright holders.
3174dnl
3175
3176# XORG_RELEASE_VERSION
3177# --------------------
3178# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3179
3180AC_DEFUN([XORG_RELEASE_VERSION],[
3181	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3182		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3183		[Major version of this package])
3184	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3185	if test "x$PVM" = "x"; then
3186		PVM="0"
3187	fi
3188	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3189		[$PVM],
3190		[Minor version of this package])
3191	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3192	if test "x$PVP" = "x"; then
3193		PVP="0"
3194	fi
3195	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3196		[$PVP],
3197		[Patch version of this package])
3198])
3199
3200# XORG_CHANGELOG()
3201# ----------------
3202# Minimum version: 1.2.0
3203#
3204# Defines the variable CHANGELOG_CMD as the command to generate
3205# ChangeLog from git.
3206#
3207#
3208AC_DEFUN([XORG_CHANGELOG], [
3209CHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3210mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3211|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3212touch \$(top_srcdir)/ChangeLog; \
3213echo 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3214AC_SUBST([CHANGELOG_CMD])
3215]) # XORG_CHANGELOG
3216
3217