aclocal.m4 revision b8df70be
1# generated automatically by aclocal 1.16.4 -*- Autoconf -*-
2
3# Copyright (C) 1996-2021 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.71],,
18[m4_warning([this file was generated for autoconf 2.71.
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-2021 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.4], [],
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.4])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-2021 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-2021 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-2021 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-2021 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-2021 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_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([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])
519# Variables for tags utilities; see am/tags.am
520if test -z "$CTAGS"; then
521  CTAGS=ctags
522fi
523AC_SUBST([CTAGS])
524if test -z "$ETAGS"; then
525  ETAGS=etags
526fi
527AC_SUBST([ETAGS])
528if test -z "$CSCOPE"; then
529  CSCOPE=cscope
530fi
531AC_SUBST([CSCOPE])
532
533AC_REQUIRE([AM_SILENT_RULES])dnl
534dnl The testsuite driver may need to know about EXEEXT, so add the
535dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
536dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
537AC_CONFIG_COMMANDS_PRE(dnl
538[m4_provide_if([_AM_COMPILER_EXEEXT],
539  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
540
541# POSIX will say in a future version that running "rm -f" with no argument
542# is OK; and we want to be able to make that assumption in our Makefile
543# recipes.  So use an aggressive probe to check that the usage we want is
544# actually supported "in the wild" to an acceptable degree.
545# See automake bug#10828.
546# To make any issue more visible, cause the running configure to be aborted
547# by default if the 'rm' program in use doesn't match our expectations; the
548# user can still override this though.
549if rm -f && rm -fr && rm -rf; then : OK; else
550  cat >&2 <<'END'
551Oops!
552
553Your 'rm' program seems unable to run without file operands specified
554on the command line, even when the '-f' option is present.  This is contrary
555to the behaviour of most rm programs out there, and not conforming with
556the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
557
558Please tell bug-automake@gnu.org about your system, including the value
559of your $PATH and any error possibly output before this message.  This
560can help us improve future automake versions.
561
562END
563  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
564    echo 'Configuration will proceed anyway, since you have set the' >&2
565    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
566    echo >&2
567  else
568    cat >&2 <<'END'
569Aborting the configuration process, to ensure you take notice of the issue.
570
571You can download and install GNU coreutils to get an 'rm' implementation
572that behaves properly: <https://www.gnu.org/software/coreutils/>.
573
574If you want to complete the configuration process using your problematic
575'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
576to "yes", and re-run configure.
577
578END
579    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
580  fi
581fi
582dnl The trailing newline in this macro's definition is deliberate, for
583dnl backward compatibility and to allow trailing 'dnl'-style comments
584dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
585])
586
587dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
588dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
589dnl mangled by Autoconf and run in a shell conditional statement.
590m4_define([_AC_COMPILER_EXEEXT],
591m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
592
593# When config.status generates a header, we must update the stamp-h file.
594# This file resides in the same directory as the config header
595# that is generated.  The stamp files are numbered to have different names.
596
597# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
598# loop where config.status creates the headers, so we can generate
599# our stamp files there.
600AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
601[# Compute $1's index in $config_headers.
602_am_arg=$1
603_am_stamp_count=1
604for _am_header in $config_headers :; do
605  case $_am_header in
606    $_am_arg | $_am_arg:* )
607      break ;;
608    * )
609      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
610  esac
611done
612echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
613
614# Copyright (C) 2001-2021 Free Software Foundation, Inc.
615#
616# This file is free software; the Free Software Foundation
617# gives unlimited permission to copy and/or distribute it,
618# with or without modifications, as long as this notice is preserved.
619
620# AM_PROG_INSTALL_SH
621# ------------------
622# Define $install_sh.
623AC_DEFUN([AM_PROG_INSTALL_SH],
624[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
625if test x"${install_sh+set}" != xset; then
626  case $am_aux_dir in
627  *\ * | *\	*)
628    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
629  *)
630    install_sh="\${SHELL} $am_aux_dir/install-sh"
631  esac
632fi
633AC_SUBST([install_sh])])
634
635# Copyright (C) 2003-2021 Free Software Foundation, Inc.
636#
637# This file is free software; the Free Software Foundation
638# gives unlimited permission to copy and/or distribute it,
639# with or without modifications, as long as this notice is preserved.
640
641# Check whether the underlying file-system supports filenames
642# with a leading dot.  For instance MS-DOS doesn't.
643AC_DEFUN([AM_SET_LEADING_DOT],
644[rm -rf .tst 2>/dev/null
645mkdir .tst 2>/dev/null
646if test -d .tst; then
647  am__leading_dot=.
648else
649  am__leading_dot=_
650fi
651rmdir .tst 2>/dev/null
652AC_SUBST([am__leading_dot])])
653
654# Check to see how 'make' treats includes.	            -*- Autoconf -*-
655
656# Copyright (C) 2001-2021 Free Software Foundation, Inc.
657#
658# This file is free software; the Free Software Foundation
659# gives unlimited permission to copy and/or distribute it,
660# with or without modifications, as long as this notice is preserved.
661
662# AM_MAKE_INCLUDE()
663# -----------------
664# Check whether make has an 'include' directive that can support all
665# the idioms we need for our automatic dependency tracking code.
666AC_DEFUN([AM_MAKE_INCLUDE],
667[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
668cat > confinc.mk << 'END'
669am__doit:
670	@echo this is the am__doit target >confinc.out
671.PHONY: am__doit
672END
673am__include="#"
674am__quote=
675# BSD make does it like this.
676echo '.include "confinc.mk" # ignored' > confmf.BSD
677# Other make implementations (GNU, Solaris 10, AIX) do it like this.
678echo 'include confinc.mk # ignored' > confmf.GNU
679_am_result=no
680for s in GNU BSD; do
681  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
682  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
683      ['0:this is the am__doit target'],
684      [AS_CASE([$s],
685          [BSD], [am__include='.include' am__quote='"'],
686          [am__include='include' am__quote=''])])
687  if test "$am__include" != "#"; then
688    _am_result="yes ($s style)"
689    break
690  fi
691done
692rm -f confinc.* confmf.*
693AC_MSG_RESULT([${_am_result}])
694AC_SUBST([am__include])])
695AC_SUBST([am__quote])])
696
697# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
698
699# Copyright (C) 1997-2021 Free Software Foundation, Inc.
700#
701# This file is free software; the Free Software Foundation
702# gives unlimited permission to copy and/or distribute it,
703# with or without modifications, as long as this notice is preserved.
704
705# AM_MISSING_PROG(NAME, PROGRAM)
706# ------------------------------
707AC_DEFUN([AM_MISSING_PROG],
708[AC_REQUIRE([AM_MISSING_HAS_RUN])
709$1=${$1-"${am_missing_run}$2"}
710AC_SUBST($1)])
711
712# AM_MISSING_HAS_RUN
713# ------------------
714# Define MISSING if not defined so far and test if it is modern enough.
715# If it is, set am_missing_run to use it, otherwise, to nothing.
716AC_DEFUN([AM_MISSING_HAS_RUN],
717[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
718AC_REQUIRE_AUX_FILE([missing])dnl
719if test x"${MISSING+set}" != xset; then
720  MISSING="\${SHELL} '$am_aux_dir/missing'"
721fi
722# Use eval to expand $SHELL
723if eval "$MISSING --is-lightweight"; then
724  am_missing_run="$MISSING "
725else
726  am_missing_run=
727  AC_MSG_WARN(['missing' script is too old or missing])
728fi
729])
730
731# Helper functions for option handling.                     -*- Autoconf -*-
732
733# Copyright (C) 2001-2021 Free Software Foundation, Inc.
734#
735# This file is free software; the Free Software Foundation
736# gives unlimited permission to copy and/or distribute it,
737# with or without modifications, as long as this notice is preserved.
738
739# _AM_MANGLE_OPTION(NAME)
740# -----------------------
741AC_DEFUN([_AM_MANGLE_OPTION],
742[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
743
744# _AM_SET_OPTION(NAME)
745# --------------------
746# Set option NAME.  Presently that only means defining a flag for this option.
747AC_DEFUN([_AM_SET_OPTION],
748[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
749
750# _AM_SET_OPTIONS(OPTIONS)
751# ------------------------
752# OPTIONS is a space-separated list of Automake options.
753AC_DEFUN([_AM_SET_OPTIONS],
754[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
755
756# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
757# -------------------------------------------
758# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
759AC_DEFUN([_AM_IF_OPTION],
760[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
761
762# Copyright (C) 1999-2021 Free Software Foundation, Inc.
763#
764# This file is free software; the Free Software Foundation
765# gives unlimited permission to copy and/or distribute it,
766# with or without modifications, as long as this notice is preserved.
767
768# _AM_PROG_CC_C_O
769# ---------------
770# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
771# to automatically call this.
772AC_DEFUN([_AM_PROG_CC_C_O],
773[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
774AC_REQUIRE_AUX_FILE([compile])dnl
775AC_LANG_PUSH([C])dnl
776AC_CACHE_CHECK(
777  [whether $CC understands -c and -o together],
778  [am_cv_prog_cc_c_o],
779  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
780  # Make sure it works both with $CC and with simple cc.
781  # Following AC_PROG_CC_C_O, we do the test twice because some
782  # compilers refuse to overwrite an existing .o file with -o,
783  # though they will create one.
784  am_cv_prog_cc_c_o=yes
785  for am_i in 1 2; do
786    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
787         && test -f conftest2.$ac_objext; then
788      : OK
789    else
790      am_cv_prog_cc_c_o=no
791      break
792    fi
793  done
794  rm -f core conftest*
795  unset am_i])
796if test "$am_cv_prog_cc_c_o" != yes; then
797   # Losing compiler, so override with the script.
798   # FIXME: It is wrong to rewrite CC.
799   # But if we don't then we get into trouble of one sort or another.
800   # A longer-term fix would be to have automake use am__CC in this case,
801   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
802   CC="$am_aux_dir/compile $CC"
803fi
804AC_LANG_POP([C])])
805
806# For backward compatibility.
807AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
808
809# Copyright (C) 2001-2021 Free Software Foundation, Inc.
810#
811# This file is free software; the Free Software Foundation
812# gives unlimited permission to copy and/or distribute it,
813# with or without modifications, as long as this notice is preserved.
814
815# AM_RUN_LOG(COMMAND)
816# -------------------
817# Run COMMAND, save the exit status in ac_status, and log it.
818# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
819AC_DEFUN([AM_RUN_LOG],
820[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
821   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
822   ac_status=$?
823   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
824   (exit $ac_status); }])
825
826# Check to make sure that the build environment is sane.    -*- Autoconf -*-
827
828# Copyright (C) 1996-2021 Free Software Foundation, Inc.
829#
830# This file is free software; the Free Software Foundation
831# gives unlimited permission to copy and/or distribute it,
832# with or without modifications, as long as this notice is preserved.
833
834# AM_SANITY_CHECK
835# ---------------
836AC_DEFUN([AM_SANITY_CHECK],
837[AC_MSG_CHECKING([whether build environment is sane])
838# Reject unsafe characters in $srcdir or the absolute working directory
839# name.  Accept space and tab only in the latter.
840am_lf='
841'
842case `pwd` in
843  *[[\\\"\#\$\&\'\`$am_lf]]*)
844    AC_MSG_ERROR([unsafe absolute working directory name]);;
845esac
846case $srcdir in
847  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
848    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
849esac
850
851# Do 'set' in a subshell so we don't clobber the current shell's
852# arguments.  Must try -L first in case configure is actually a
853# symlink; some systems play weird games with the mod time of symlinks
854# (eg FreeBSD returns the mod time of the symlink's containing
855# directory).
856if (
857   am_has_slept=no
858   for am_try in 1 2; do
859     echo "timestamp, slept: $am_has_slept" > conftest.file
860     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
861     if test "$[*]" = "X"; then
862	# -L didn't work.
863	set X `ls -t "$srcdir/configure" conftest.file`
864     fi
865     if test "$[*]" != "X $srcdir/configure conftest.file" \
866	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
867
868	# If neither matched, then we have a broken ls.  This can happen
869	# if, for instance, CONFIG_SHELL is bash and it inherits a
870	# broken ls alias from the environment.  This has actually
871	# happened.  Such a system could not be considered "sane".
872	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
873  alias in your environment])
874     fi
875     if test "$[2]" = conftest.file || test $am_try -eq 2; then
876       break
877     fi
878     # Just in case.
879     sleep 1
880     am_has_slept=yes
881   done
882   test "$[2]" = conftest.file
883   )
884then
885   # Ok.
886   :
887else
888   AC_MSG_ERROR([newly created file is older than distributed files!
889Check your system clock])
890fi
891AC_MSG_RESULT([yes])
892# If we didn't sleep, we still need to ensure time stamps of config.status and
893# generated files are strictly newer.
894am_sleep_pid=
895if grep 'slept: no' conftest.file >/dev/null 2>&1; then
896  ( sleep 1 ) &
897  am_sleep_pid=$!
898fi
899AC_CONFIG_COMMANDS_PRE(
900  [AC_MSG_CHECKING([that generated files are newer than configure])
901   if test -n "$am_sleep_pid"; then
902     # Hide warnings about reused PIDs.
903     wait $am_sleep_pid 2>/dev/null
904   fi
905   AC_MSG_RESULT([done])])
906rm -f conftest.file
907])
908
909# Copyright (C) 2009-2021 Free Software Foundation, Inc.
910#
911# This file is free software; the Free Software Foundation
912# gives unlimited permission to copy and/or distribute it,
913# with or without modifications, as long as this notice is preserved.
914
915# AM_SILENT_RULES([DEFAULT])
916# --------------------------
917# Enable less verbose build rules; with the default set to DEFAULT
918# ("yes" being less verbose, "no" or empty being verbose).
919AC_DEFUN([AM_SILENT_RULES],
920[AC_ARG_ENABLE([silent-rules], [dnl
921AS_HELP_STRING(
922  [--enable-silent-rules],
923  [less verbose build output (undo: "make V=1")])
924AS_HELP_STRING(
925  [--disable-silent-rules],
926  [verbose build output (undo: "make V=0")])dnl
927])
928case $enable_silent_rules in @%:@ (((
929  yes) AM_DEFAULT_VERBOSITY=0;;
930   no) AM_DEFAULT_VERBOSITY=1;;
931    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
932esac
933dnl
934dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
935dnl do not support nested variable expansions.
936dnl See automake bug#9928 and bug#10237.
937am_make=${MAKE-make}
938AC_CACHE_CHECK([whether $am_make supports nested variables],
939   [am_cv_make_support_nested_variables],
940   [if AS_ECHO([['TRUE=$(BAR$(V))
941BAR0=false
942BAR1=true
943V=1
944am__doit:
945	@$(TRUE)
946.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
947  am_cv_make_support_nested_variables=yes
948else
949  am_cv_make_support_nested_variables=no
950fi])
951if test $am_cv_make_support_nested_variables = yes; then
952  dnl Using '$V' instead of '$(V)' breaks IRIX make.
953  AM_V='$(V)'
954  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
955else
956  AM_V=$AM_DEFAULT_VERBOSITY
957  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
958fi
959AC_SUBST([AM_V])dnl
960AM_SUBST_NOTMAKE([AM_V])dnl
961AC_SUBST([AM_DEFAULT_V])dnl
962AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
963AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
964AM_BACKSLASH='\'
965AC_SUBST([AM_BACKSLASH])dnl
966_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
967])
968
969# Copyright (C) 2001-2021 Free Software Foundation, Inc.
970#
971# This file is free software; the Free Software Foundation
972# gives unlimited permission to copy and/or distribute it,
973# with or without modifications, as long as this notice is preserved.
974
975# AM_PROG_INSTALL_STRIP
976# ---------------------
977# One issue with vendor 'install' (even GNU) is that you can't
978# specify the program used to strip binaries.  This is especially
979# annoying in cross-compiling environments, where the build's strip
980# is unlikely to handle the host's binaries.
981# Fortunately install-sh will honor a STRIPPROG variable, so we
982# always use install-sh in "make install-strip", and initialize
983# STRIPPROG with the value of the STRIP variable (set by the user).
984AC_DEFUN([AM_PROG_INSTALL_STRIP],
985[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
986# Installed binaries are usually stripped using 'strip' when the user
987# run "make install-strip".  However 'strip' might not be the right
988# tool to use in cross-compilation environments, therefore Automake
989# will honor the 'STRIP' environment variable to overrule this program.
990dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
991if test "$cross_compiling" != no; then
992  AC_CHECK_TOOL([STRIP], [strip], :)
993fi
994INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
995AC_SUBST([INSTALL_STRIP_PROGRAM])])
996
997# Copyright (C) 2006-2021 Free Software Foundation, Inc.
998#
999# This file is free software; the Free Software Foundation
1000# gives unlimited permission to copy and/or distribute it,
1001# with or without modifications, as long as this notice is preserved.
1002
1003# _AM_SUBST_NOTMAKE(VARIABLE)
1004# ---------------------------
1005# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1006# This macro is traced by Automake.
1007AC_DEFUN([_AM_SUBST_NOTMAKE])
1008
1009# AM_SUBST_NOTMAKE(VARIABLE)
1010# --------------------------
1011# Public sister of _AM_SUBST_NOTMAKE.
1012AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1013
1014# Check how to create a tarball.                            -*- Autoconf -*-
1015
1016# Copyright (C) 2004-2021 Free Software Foundation, Inc.
1017#
1018# This file is free software; the Free Software Foundation
1019# gives unlimited permission to copy and/or distribute it,
1020# with or without modifications, as long as this notice is preserved.
1021
1022# _AM_PROG_TAR(FORMAT)
1023# --------------------
1024# Check how to create a tarball in format FORMAT.
1025# FORMAT should be one of 'v7', 'ustar', or 'pax'.
1026#
1027# Substitute a variable $(am__tar) that is a command
1028# writing to stdout a FORMAT-tarball containing the directory
1029# $tardir.
1030#     tardir=directory && $(am__tar) > result.tar
1031#
1032# Substitute a variable $(am__untar) that extract such
1033# a tarball read from stdin.
1034#     $(am__untar) < result.tar
1035#
1036AC_DEFUN([_AM_PROG_TAR],
1037[# Always define AMTAR for backward compatibility.  Yes, it's still used
1038# in the wild :-(  We should find a proper way to deprecate it ...
1039AC_SUBST([AMTAR], ['$${TAR-tar}'])
1040
1041# We'll loop over all known methods to create a tar archive until one works.
1042_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1043
1044m4_if([$1], [v7],
1045  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1046
1047  [m4_case([$1],
1048    [ustar],
1049     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1050      # There is notably a 21 bits limit for the UID and the GID.  In fact,
1051      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1052      # and bug#13588).
1053      am_max_uid=2097151 # 2^21 - 1
1054      am_max_gid=$am_max_uid
1055      # The $UID and $GID variables are not portable, so we need to resort
1056      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
1057      # below are definitely unexpected, so allow the users to see them
1058      # (that is, avoid stderr redirection).
1059      am_uid=`id -u || echo unknown`
1060      am_gid=`id -g || echo unknown`
1061      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1062      if test $am_uid -le $am_max_uid; then
1063         AC_MSG_RESULT([yes])
1064      else
1065         AC_MSG_RESULT([no])
1066         _am_tools=none
1067      fi
1068      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1069      if test $am_gid -le $am_max_gid; then
1070         AC_MSG_RESULT([yes])
1071      else
1072        AC_MSG_RESULT([no])
1073        _am_tools=none
1074      fi],
1075
1076  [pax],
1077    [],
1078
1079  [m4_fatal([Unknown tar format])])
1080
1081  AC_MSG_CHECKING([how to create a $1 tar archive])
1082
1083  # Go ahead even if we have the value already cached.  We do so because we
1084  # need to set the values for the 'am__tar' and 'am__untar' variables.
1085  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1086
1087  for _am_tool in $_am_tools; do
1088    case $_am_tool in
1089    gnutar)
1090      for _am_tar in tar gnutar gtar; do
1091        AM_RUN_LOG([$_am_tar --version]) && break
1092      done
1093      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1094      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1095      am__untar="$_am_tar -xf -"
1096      ;;
1097    plaintar)
1098      # Must skip GNU tar: if it does not support --format= it doesn't create
1099      # ustar tarball either.
1100      (tar --version) >/dev/null 2>&1 && continue
1101      am__tar='tar chf - "$$tardir"'
1102      am__tar_='tar chf - "$tardir"'
1103      am__untar='tar xf -'
1104      ;;
1105    pax)
1106      am__tar='pax -L -x $1 -w "$$tardir"'
1107      am__tar_='pax -L -x $1 -w "$tardir"'
1108      am__untar='pax -r'
1109      ;;
1110    cpio)
1111      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1112      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1113      am__untar='cpio -i -H $1 -d'
1114      ;;
1115    none)
1116      am__tar=false
1117      am__tar_=false
1118      am__untar=false
1119      ;;
1120    esac
1121
1122    # If the value was cached, stop now.  We just wanted to have am__tar
1123    # and am__untar set.
1124    test -n "${am_cv_prog_tar_$1}" && break
1125
1126    # tar/untar a dummy directory, and stop if the command works.
1127    rm -rf conftest.dir
1128    mkdir conftest.dir
1129    echo GrepMe > conftest.dir/file
1130    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1131    rm -rf conftest.dir
1132    if test -s conftest.tar; then
1133      AM_RUN_LOG([$am__untar <conftest.tar])
1134      AM_RUN_LOG([cat conftest.dir/file])
1135      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1136    fi
1137  done
1138  rm -rf conftest.dir
1139
1140  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1141  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1142
1143AC_SUBST([am__tar])
1144AC_SUBST([am__untar])
1145]) # _AM_PROG_TAR
1146
1147dnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
1148dnl serial 11 (pkg-config-0.29)
1149dnl
1150dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1151dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
1152dnl
1153dnl This program is free software; you can redistribute it and/or modify
1154dnl it under the terms of the GNU General Public License as published by
1155dnl the Free Software Foundation; either version 2 of the License, or
1156dnl (at your option) any later version.
1157dnl
1158dnl This program is distributed in the hope that it will be useful, but
1159dnl WITHOUT ANY WARRANTY; without even the implied warranty of
1160dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1161dnl General Public License for more details.
1162dnl
1163dnl You should have received a copy of the GNU General Public License
1164dnl along with this program; if not, write to the Free Software
1165dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1166dnl 02111-1307, USA.
1167dnl
1168dnl As a special exception to the GNU General Public License, if you
1169dnl distribute this file as part of a program that contains a
1170dnl configuration script generated by Autoconf, you may include it under
1171dnl the same distribution terms that you use for the rest of that
1172dnl program.
1173
1174dnl PKG_PREREQ(MIN-VERSION)
1175dnl -----------------------
1176dnl Since: 0.29
1177dnl
1178dnl Verify that the version of the pkg-config macros are at least
1179dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
1180dnl installed version of pkg-config, this checks the developer's version
1181dnl of pkg.m4 when generating configure.
1182dnl
1183dnl To ensure that this macro is defined, also add:
1184dnl m4_ifndef([PKG_PREREQ],
1185dnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
1186dnl
1187dnl See the "Since" comment for each macro you use to see what version
1188dnl of the macros you require.
1189m4_defun([PKG_PREREQ],
1190[m4_define([PKG_MACROS_VERSION], [0.29])
1191m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
1192    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
1193])dnl PKG_PREREQ
1194
1195dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
1196dnl ----------------------------------
1197dnl Since: 0.16
1198dnl
1199dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
1200dnl first found in the path. Checks that the version of pkg-config found
1201dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
1202dnl used since that's the first version where most current features of
1203dnl pkg-config existed.
1204AC_DEFUN([PKG_PROG_PKG_CONFIG],
1205[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1206m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
1207m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
1208AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
1209AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
1210AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
1211
1212if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1213	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1214fi
1215if test -n "$PKG_CONFIG"; then
1216	_pkg_min_version=m4_default([$1], [0.9.0])
1217	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1218	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1219		AC_MSG_RESULT([yes])
1220	else
1221		AC_MSG_RESULT([no])
1222		PKG_CONFIG=""
1223	fi
1224fi[]dnl
1225])dnl PKG_PROG_PKG_CONFIG
1226
1227dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1228dnl -------------------------------------------------------------------
1229dnl Since: 0.18
1230dnl
1231dnl Check to see whether a particular set of modules exists. Similar to
1232dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
1233dnl
1234dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1235dnl only at the first occurence in configure.ac, so if the first place
1236dnl it's called might be skipped (such as if it is within an "if", you
1237dnl have to call PKG_CHECK_EXISTS manually
1238AC_DEFUN([PKG_CHECK_EXISTS],
1239[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1240if test -n "$PKG_CONFIG" && \
1241    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1242  m4_default([$2], [:])
1243m4_ifvaln([$3], [else
1244  $3])dnl
1245fi])
1246
1247dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1248dnl ---------------------------------------------
1249dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
1250dnl pkg_failed based on the result.
1251m4_define([_PKG_CONFIG],
1252[if test -n "$$1"; then
1253    pkg_cv_[]$1="$$1"
1254 elif test -n "$PKG_CONFIG"; then
1255    PKG_CHECK_EXISTS([$3],
1256                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
1257		      test "x$?" != "x0" && pkg_failed=yes ],
1258		     [pkg_failed=yes])
1259 else
1260    pkg_failed=untried
1261fi[]dnl
1262])dnl _PKG_CONFIG
1263
1264dnl _PKG_SHORT_ERRORS_SUPPORTED
1265dnl ---------------------------
1266dnl Internal check to see if pkg-config supports short errors.
1267AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1268[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1269if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1270        _pkg_short_errors_supported=yes
1271else
1272        _pkg_short_errors_supported=no
1273fi[]dnl
1274])dnl _PKG_SHORT_ERRORS_SUPPORTED
1275
1276
1277dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1278dnl   [ACTION-IF-NOT-FOUND])
1279dnl --------------------------------------------------------------
1280dnl Since: 0.4.0
1281dnl
1282dnl Note that if there is a possibility the first call to
1283dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
1284dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1285AC_DEFUN([PKG_CHECK_MODULES],
1286[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1287AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1288AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1289
1290pkg_failed=no
1291AC_MSG_CHECKING([for $1])
1292
1293_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1294_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1295
1296m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1297and $1[]_LIBS to avoid the need to call pkg-config.
1298See the pkg-config man page for more details.])
1299
1300if test $pkg_failed = yes; then
1301   	AC_MSG_RESULT([no])
1302        _PKG_SHORT_ERRORS_SUPPORTED
1303        if test $_pkg_short_errors_supported = yes; then
1304	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
1305        else 
1306	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
1307        fi
1308	# Put the nasty error message in config.log where it belongs
1309	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1310
1311	m4_default([$4], [AC_MSG_ERROR(
1312[Package requirements ($2) were not met:
1313
1314$$1_PKG_ERRORS
1315
1316Consider adjusting the PKG_CONFIG_PATH environment variable if you
1317installed software in a non-standard prefix.
1318
1319_PKG_TEXT])[]dnl
1320        ])
1321elif test $pkg_failed = untried; then
1322     	AC_MSG_RESULT([no])
1323	m4_default([$4], [AC_MSG_FAILURE(
1324[The pkg-config script could not be found or is too old.  Make sure it
1325is in your PATH or set the PKG_CONFIG environment variable to the full
1326path to pkg-config.
1327
1328_PKG_TEXT
1329
1330To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
1331        ])
1332else
1333	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1334	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1335        AC_MSG_RESULT([yes])
1336	$3
1337fi[]dnl
1338])dnl PKG_CHECK_MODULES
1339
1340
1341dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1342dnl   [ACTION-IF-NOT-FOUND])
1343dnl ---------------------------------------------------------------------
1344dnl Since: 0.29
1345dnl
1346dnl Checks for existence of MODULES and gathers its build flags with
1347dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
1348dnl and VARIABLE-PREFIX_LIBS from --libs.
1349dnl
1350dnl Note that if there is a possibility the first call to
1351dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
1352dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
1353dnl configure.ac.
1354AC_DEFUN([PKG_CHECK_MODULES_STATIC],
1355[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1356_save_PKG_CONFIG=$PKG_CONFIG
1357PKG_CONFIG="$PKG_CONFIG --static"
1358PKG_CHECK_MODULES($@)
1359PKG_CONFIG=$_save_PKG_CONFIG[]dnl
1360])dnl PKG_CHECK_MODULES_STATIC
1361
1362
1363dnl PKG_INSTALLDIR([DIRECTORY])
1364dnl -------------------------
1365dnl Since: 0.27
1366dnl
1367dnl Substitutes the variable pkgconfigdir as the location where a module
1368dnl should install pkg-config .pc files. By default the directory is
1369dnl $libdir/pkgconfig, but the default can be changed by passing
1370dnl DIRECTORY. The user can override through the --with-pkgconfigdir
1371dnl parameter.
1372AC_DEFUN([PKG_INSTALLDIR],
1373[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
1374m4_pushdef([pkg_description],
1375    [pkg-config installation directory @<:@]pkg_default[@:>@])
1376AC_ARG_WITH([pkgconfigdir],
1377    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
1378    [with_pkgconfigdir=]pkg_default)
1379AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
1380m4_popdef([pkg_default])
1381m4_popdef([pkg_description])
1382])dnl PKG_INSTALLDIR
1383
1384
1385dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
1386dnl --------------------------------
1387dnl Since: 0.27
1388dnl
1389dnl Substitutes the variable noarch_pkgconfigdir as the location where a
1390dnl module should install arch-independent pkg-config .pc files. By
1391dnl default the directory is $datadir/pkgconfig, but the default can be
1392dnl changed by passing DIRECTORY. The user can override through the
1393dnl --with-noarch-pkgconfigdir parameter.
1394AC_DEFUN([PKG_NOARCH_INSTALLDIR],
1395[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
1396m4_pushdef([pkg_description],
1397    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
1398AC_ARG_WITH([noarch-pkgconfigdir],
1399    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
1400    [with_noarch_pkgconfigdir=]pkg_default)
1401AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
1402m4_popdef([pkg_default])
1403m4_popdef([pkg_description])
1404])dnl PKG_NOARCH_INSTALLDIR
1405
1406
1407dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
1408dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1409dnl -------------------------------------------
1410dnl Since: 0.28
1411dnl
1412dnl Retrieves the value of the pkg-config variable for the given module.
1413AC_DEFUN([PKG_CHECK_VAR],
1414[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1415AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
1416
1417_PKG_CONFIG([$1], [variable="][$3]["], [$2])
1418AS_VAR_COPY([$1], [pkg_cv_][$1])
1419
1420AS_VAR_IF([$1], [""], [$5], [$4])dnl
1421])dnl PKG_CHECK_VAR
1422
1423dnl fontutil.m4.  Generated from fontutil.m4.in by configure.
1424dnl
1425dnl This file comes from X.Org's font-util 1.3.2
1426dnl
1427dnl Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
1428dnl
1429dnl Permission is hereby granted, free of charge, to any person obtaining a
1430dnl copy of this software and associated documentation files (the "Software"),
1431dnl to deal in the Software without restriction, including without limitation
1432dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1433dnl and/or sell copies of the Software, and to permit persons to whom the
1434dnl Software is furnished to do so, subject to the following conditions:
1435dnl
1436dnl The above copyright notice and this permission notice (including the next
1437dnl paragraph) shall be included in all copies or substantial portions of the
1438dnl Software.
1439dnl
1440dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1441dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1442dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1443dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1444dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1445dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1446dnl DEALINGS IN THE SOFTWARE.
1447dnl
1448dnl --------------------------------------------------------------------
1449dnl
1450dnl Copyright 2005 Red Hat, Inc
1451dnl
1452dnl Permission to use, copy, modify, distribute, and sell this software and its
1453dnl documentation for any purpose is hereby granted without fee, provided that
1454dnl the above copyright notice appear in all copies and that both that
1455dnl copyright notice and this permission notice appear in supporting
1456dnl documentation.
1457dnl
1458dnl The above copyright notice and this permission notice shall be included
1459dnl in all copies or substantial portions of the Software.
1460dnl
1461dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1462dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1463dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1464dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
1465dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1466dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1467dnl OTHER DEALINGS IN THE SOFTWARE.
1468dnl
1469dnl Except as contained in this notice, the name of the copyright holders shall
1470dnl not be used in advertising or otherwise to promote the sale, use or
1471dnl other dealings in this Software without prior written authorization
1472dnl from the copyright holders.
1473
1474# XORG_FONT_MACROS_VERSION(required-version)
1475# ------------------------------------------
1476# Minimum version: 1.1.0
1477#
1478# If you're using a macro added in Version 1.1 or newer, include this in
1479# your configure.ac with the minimum required version, such as:
1480# XORG_FONT_MACROS_VERSION(1.1)
1481#
1482# To ensure that this macro is defined, also add:
1483# m4_ifndef([XORG_FONT_MACROS_VERSION],
1484#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
1485#
1486#
1487# See the "minimum version" comment for each macro you use to see what
1488# version you require.
1489m4_defun([XORG_FONT_MACROS_VERSION],[
1490m4_define([vers_have], [1.3.2])
1491m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1492m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1493m4_if(m4_cmp(maj_have, maj_needed), 0,,
1494    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
1495m4_if(m4_version_compare(vers_have, [$1]), -1,
1496    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
1497m4_undefine([vers_have])
1498m4_undefine([maj_have])
1499m4_undefine([maj_needed])
1500]) # XORG_FONT_MACROS_VERSION
1501
1502# XORG_FONT_CHECK_{maps}()
1503# ------------------------
1504# Minimum version: 1.0.0
1505# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
1506# JISX0201 or KOI8_R.  By default, they are all enabled.
1507
1508AC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
1509AC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
1510AC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
1511AC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
1512AC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
1513AC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
1514AC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
1515AC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
1516AC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
1517AC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
1518AC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
1519AC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
1520AC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
1521AC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
1522AC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
1523AC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
1524AC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
1525AC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
1526
1527# XORG_FONT_CHECK_ENCODING(encoding)
1528# ----------------------------------
1529# Minimum version: 1.1.0
1530# This macro adds --enable/disable-<encoding>, enabled by default.
1531# It replaced individual copies of this code in the above macros in 1.1.
1532# Currently assumes encoding names will be all upper-case - add m4_toupper
1533# calls if this is not true in the future.
1534
1535AC_DEFUN([XORG_FONT_CHECK_ENCODING],[
1536	AC_ARG_ENABLE(m4_tolower($1),
1537		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
1538				[Build $1 fonts (default: yes)]),
1539		[AS_TR_SH($1)=$enableval])
1540	AC_MSG_CHECKING([whether to build $1 fonts])
1541	AC_MSG_RESULT($[AS_TR_SH($1)])
1542	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
1543]) # XORG_FONT_CHECK_ENCODING
1544
1545# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
1546# -----------------------------------------------------
1547# Minimum version: 1.1.0
1548# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
1549# Add a shorthand --enable/disable-all-encodings option.
1550
1551AC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
1552	AC_ARG_ENABLE([all-encodings],
1553		AS_HELP_STRING([--disable-all-encodings],
1554				[Disable building of all font encodings]),
1555		[m4_foreach_w([enc], [$1], [
1556			AS_TR_SH(enc)=$enableval
1557		])],
1558		[m4_foreach_w([enc], [$1], [
1559			AS_TR_SH(enc)=yes
1560		])])
1561	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
1562]) # XORG_FONT_CHECK_ENCODING_LIST
1563
1564# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
1565# ------------------------------------------
1566# Minimum version: 1.1.0
1567#
1568# Simple wrapper around AC_PATH_PROG that errors if not found
1569#
1570
1571AC_DEFUN([XORG_FONT_REQUIRED_PROG],[
1572	AC_PATH_PROG($1, $2)
1573	if test x"$$1" = x; then
1574		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
1575	fi
1576])
1577
1578
1579# XORG_FONT_FCCACHE()
1580# -------------------
1581# Minimum version: 1.1.0
1582#
1583# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
1584# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
1585# to run fc-cache if found and not installing to $DESTDIR and not
1586# cross-compiling
1587#
1588# fc-cache is optional, not required, and should be skipped when making
1589# packages (installing to $DESTDIR) or cross-compiling
1590#
1591AC_DEFUN([XORG_FONT_FCCACHE],[
1592	AC_PATH_PROG(FCCACHE, fc-cache)
1593	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
1594	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
1595		RUN_FCCACHE="${FCCACHE_WARN}"
1596	else
1597		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
1598		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
1599	fi
1600	AC_SUBST([RUN_FCCACHE])
1601])
1602
1603# XORG_FONT_MKFONTDIR()
1604# -------------------
1605# Minimum version: 1.3.0
1606#
1607# Set MKFONTDIR to path to mkfontdir.
1608#
1609# If cross-compiling, and if mkdir is not found, use a shell command
1610# which warns mkfontdir needs to be run on the target
1611#
1612# If not cross-compiling, mkfontdir must be found
1613#
1614AC_DEFUN([XORG_FONT_MKFONTDIR],[
1615	if test x"$cross_compiling" != x"no" ; then
1616		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
1617		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
1618
1619		if test x"$MKFONTDIR" = x; then
1620			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
1621		fi
1622	else
1623		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
1624	fi
1625
1626	AC_SUBST([MKFONTDIR])
1627])
1628
1629# XORG_FONT_COMMON_UTILS()
1630# ------------------------
1631# Minimum version: 1.1.0
1632#
1633# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
1634
1635AC_DEFUN([XORG_FONT_COMMON_UTILS],[
1636	XORG_FONT_FCCACHE
1637	XORG_FONT_MKFONTDIR
1638])
1639
1640# XORG_FONT_SCALED_UTILS()
1641# ------------------------
1642# Minimum version: 1.1.0
1643#
1644# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
1645# (TrueType, OpenType, Type1)
1646
1647AC_DEFUN([XORG_FONT_SCALED_UTILS],[
1648	XORG_FONT_COMMON_UTILS
1649	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
1650])
1651
1652# XORG_FONT_BDF_UTILS()
1653# ---------------------
1654# Minimum version: 1.1.0
1655#
1656# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
1657# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
1658# PCF output files created by bdftopcf
1659
1660AC_DEFUN([XORG_FONT_BDF_UTILS],[
1661	XORG_FONT_COMMON_UTILS
1662	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
1663	XORG_FONT_CHECK_COMPRESSION
1664])
1665
1666# XORG_FONT_CHECK_COMPRESSION()
1667# -----------------------------
1668# Minimum version: 1.1.0
1669#
1670# Offer a --with-compression flag to control what compression method is
1671# used for pcf font files.   Offers all the methods currently supported
1672# by libXfont, including no compression.
1673
1674AC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
1675	AC_MSG_CHECKING([font compression method])
1676	AC_ARG_WITH(compression,
1677	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
1678			 [compression method to use on pcf fonts])],
1679         [compression="$withval"], [compression="yes"])
1680	if test x"$compression" = "xyes" ; then
1681		compression="gzip"
1682	fi
1683	AC_MSG_RESULT([${compression}])
1684	case ${compression} in
1685	 *compress)	COMPRESS_SUFFIX=".Z" ;;
1686	 *gzip)		COMPRESS_SUFFIX=".gz" ;;
1687	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
1688	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
1689	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
1690	esac
1691	if test x"$COMPRESS_SUFFIX" != "x" ; then
1692	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
1693	fi
1694	AC_SUBST([COMPRESS_SUFFIX])
1695])
1696
1697# XORG_FONT_UCS2ANY()
1698# -------------------
1699# Minimum version: 1.1.0
1700#
1701# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
1702# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
1703# Also call pkg-config to find the directory with the encoding files needed
1704# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
1705
1706AC_DEFUN([XORG_FONT_UCS2ANY],[
1707	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1708	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
1709	PKG_CHECK_MODULES(MAPS, [fontutil])
1710	AC_MSG_CHECKING([for ucs2any encoding data files])
1711	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
1712	AC_SUBST(MAPFILES_PATH)
1713	AC_MSG_RESULT([${MAPFILES_PATH}])
1714])
1715
1716
1717
1718# XORG_FONT_FC_CONFDIR()
1719# --------------------
1720# Minimum version: 1.2.0
1721#
1722# Sets FC_CONFDIR to the fontconfig config directory
1723# (which should be --with-confdir=... when building fontconfig)
1724# found from:
1725#	--with-fc-confdir=...
1726#	pkg-config --variable=confdir fontconfig
1727#	${sysconfdir}/fonts
1728
1729AC_DEFUN([XORG_FONT_FC_CONFDIR],[
1730	dnl Ensure $PKG_CONFIG is set first
1731	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1732
1733	AC_MSG_CHECKING([for fontconfig's configuration directory])
1734	AC_ARG_WITH(fc-confdir,
1735		    AS_HELP_STRING([--with-fc-confdir=DIR],
1736			   [Path to fontconfig's configuration directory]),
1737		    [FC_CONFDIR="$withval"])
1738	# if --with-fc-confdir was not specified
1739	if test "x${FC_CONFDIR}" = "x"; then
1740		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
1741	fi
1742	# ...and if pkg-config didn't find confdir in fontconfig.pc...
1743	if test "x${FC_CONFDIR}" = "x"; then
1744		FC_CONFDIR="${sysconfdir}/fonts"
1745	fi
1746	AC_SUBST(FC_CONFDIR)
1747	AC_MSG_RESULT([${FC_CONFDIR}])
1748])
1749
1750
1751
1752# XORG_FONTROOTDIR()
1753# --------------------
1754# Minimum version: 1.1.0
1755#
1756# Sets FONTROOTDIR to the root directory for font files.  Uses the first
1757# found from:
1758#	--with-fontrootdir
1759#	pkg-config --variable=fontrootdir fontutil
1760#	${datadir}/fonts/X11
1761
1762AC_DEFUN([XORG_FONTROOTDIR],[
1763	dnl Ensure $PKG_CONFIG is set first
1764	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1765
1766	AC_MSG_CHECKING([for root directory for font files])
1767	AC_ARG_WITH(fontrootdir,
1768		    AS_HELP_STRING([--with-fontrootdir=DIR],
1769			   [Path to root directory for font files]),
1770		    [FONTROOTDIR="$withval"])
1771	# if --with-fontrootdir not specified...
1772	if test "x${FONTROOTDIR}" = "x"; then
1773		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
1774	fi
1775	# ...and if pkg-config didn't find fontdir in fontutil.pc...
1776	if test "x${FONTROOTDIR}" = "x"; then
1777		FONTROOTDIR="${datadir}/fonts/X11"
1778	fi
1779	AC_SUBST(FONTROOTDIR)
1780	AC_MSG_RESULT([${FONTROOTDIR}])
1781])
1782
1783# XORG_FONTSUBDIR(variable, flag, subdir)
1784# ---------------------------------------
1785# Minimum version: 1.1.0
1786#
1787# Offer a --with-<flag> flag to control directory for font installation
1788# Default is the specified <subdir> of the font root directory.
1789# Sets <variable> to the selected directory
1790
1791AC_DEFUN([XORG_FONTSUBDIR],[
1792	AC_REQUIRE([XORG_FONTROOTDIR])
1793
1794	AC_MSG_CHECKING([for directory for $3 files])
1795	AC_ARG_WITH($2,
1796		    [AS_HELP_STRING([--with-$2=DIR],
1797				    [Path to $3 files [FONTROOTDIR/$3]])],
1798		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
1799	AC_SUBST($1)
1800	AC_MSG_RESULT([${$1}])
1801]) # XORG_FONTSUBDIR
1802
1803# XORG_FONTDIR(subdir)
1804# --------------------
1805# Minimum version: 1.1.0
1806#
1807# Offer a --with-fontdir flag to control directory for font installation
1808# Default is the specified subdir of the font root directory.
1809# Sets FONTDIR to the selected directory
1810
1811AC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
1812
1813dnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1814dnl
1815dnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
1816dnl
1817dnl Permission is hereby granted, free of charge, to any person obtaining a
1818dnl copy of this software and associated documentation files (the "Software"),
1819dnl to deal in the Software without restriction, including without limitation
1820dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1821dnl and/or sell copies of the Software, and to permit persons to whom the
1822dnl Software is furnished to do so, subject to the following conditions:
1823dnl
1824dnl The above copyright notice and this permission notice (including the next
1825dnl paragraph) shall be included in all copies or substantial portions of the
1826dnl Software.
1827dnl
1828dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1829dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1830dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1831dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1832dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1833dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1834dnl DEALINGS IN THE SOFTWARE.
1835
1836# XORG_MACROS_VERSION(required-version)
1837# -------------------------------------
1838# Minimum version: 1.1.0
1839#
1840# If you're using a macro added in Version 1.1 or newer, include this in
1841# your configure.ac with the minimum required version, such as:
1842# XORG_MACROS_VERSION(1.1)
1843#
1844# To ensure that this macro is defined, also add:
1845# m4_ifndef([XORG_MACROS_VERSION],
1846#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
1847#
1848#
1849# See the "minimum version" comment for each macro you use to see what
1850# version you require.
1851m4_defun([XORG_MACROS_VERSION],[
1852m4_define([vers_have], [1.19.3])
1853m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1854m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1855m4_if(m4_cmp(maj_have, maj_needed), 0,,
1856    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
1857m4_if(m4_version_compare(vers_have, [$1]), -1,
1858    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
1859m4_undefine([vers_have])
1860m4_undefine([maj_have])
1861m4_undefine([maj_needed])
1862]) # XORG_MACROS_VERSION
1863
1864# XORG_PROG_RAWCPP()
1865# ------------------
1866# Minimum version: 1.0.0
1867#
1868# Find cpp program and necessary flags for use in pre-processing text files
1869# such as man pages and config files
1870AC_DEFUN([XORG_PROG_RAWCPP],[
1871AC_REQUIRE([AC_PROG_CPP])
1872AC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
1873   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
1874
1875# Check for flag to avoid builtin definitions - assumes unix is predefined,
1876# which is not the best choice for supporting other OS'es, but covers most
1877# of the ones we need for now.
1878AC_MSG_CHECKING([if $RAWCPP requires -undef])
1879AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
1880if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1881	AC_MSG_RESULT([no])
1882else
1883	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1884		RAWCPPFLAGS=-undef
1885		AC_MSG_RESULT([yes])
1886	# under Cygwin unix is still defined even with -undef
1887	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
1888		RAWCPPFLAGS="-undef -ansi"
1889		AC_MSG_RESULT([yes, with -ansi])
1890	else
1891		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
1892	fi
1893fi
1894rm -f conftest.$ac_ext
1895
1896AC_MSG_CHECKING([if $RAWCPP requires -traditional])
1897AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
1898if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1899	AC_MSG_RESULT([no])
1900else
1901	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
1902		TRADITIONALCPPFLAGS="-traditional"
1903		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
1904		AC_MSG_RESULT([yes])
1905	else
1906		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
1907	fi
1908fi
1909rm -f conftest.$ac_ext
1910AC_SUBST(RAWCPPFLAGS)
1911AC_SUBST(TRADITIONALCPPFLAGS)
1912]) # XORG_PROG_RAWCPP
1913
1914# XORG_MANPAGE_SECTIONS()
1915# -----------------------
1916# Minimum version: 1.0.0
1917#
1918# Determine which sections man pages go in for the different man page types
1919# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
1920# Not sure if there's any better way than just hardcoding by OS name.
1921# Override default settings by setting environment variables
1922# Added MAN_SUBSTS in version 1.8
1923# Added AC_PROG_SED in version 1.8
1924
1925AC_DEFUN([XORG_MANPAGE_SECTIONS],[
1926AC_REQUIRE([AC_CANONICAL_HOST])
1927AC_REQUIRE([AC_PROG_SED])
1928
1929case $host_os in
1930    solaris*)
1931        # Solaris 2.0 - 11.3 use SysV man page section numbers, so we
1932        # check for a man page file found in later versions that use
1933        # traditional section numbers instead
1934        AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
1935                [SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
1936        ;;
1937    *) SYSV_MAN_SECTIONS=false ;;
1938esac
1939
1940if test x$APP_MAN_SUFFIX = x    ; then
1941    APP_MAN_SUFFIX=1
1942fi
1943if test x$APP_MAN_DIR = x    ; then
1944    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
1945fi
1946
1947if test x$LIB_MAN_SUFFIX = x    ; then
1948    LIB_MAN_SUFFIX=3
1949fi
1950if test x$LIB_MAN_DIR = x    ; then
1951    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
1952fi
1953
1954if test x$FILE_MAN_SUFFIX = x    ; then
1955    case $SYSV_MAN_SECTIONS in
1956	true)				FILE_MAN_SUFFIX=4  ;;
1957	*)				FILE_MAN_SUFFIX=5  ;;
1958    esac
1959fi
1960if test x$FILE_MAN_DIR = x    ; then
1961    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
1962fi
1963
1964if test x$MISC_MAN_SUFFIX = x    ; then
1965    case $SYSV_MAN_SECTIONS in
1966	true)				MISC_MAN_SUFFIX=5  ;;
1967	*)				MISC_MAN_SUFFIX=7  ;;
1968    esac
1969fi
1970if test x$MISC_MAN_DIR = x    ; then
1971    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
1972fi
1973
1974if test x$DRIVER_MAN_SUFFIX = x    ; then
1975    case $SYSV_MAN_SECTIONS in
1976	true)				DRIVER_MAN_SUFFIX=7  ;;
1977	*)				DRIVER_MAN_SUFFIX=4  ;;
1978    esac
1979fi
1980if test x$DRIVER_MAN_DIR = x    ; then
1981    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
1982fi
1983
1984if test x$ADMIN_MAN_SUFFIX = x    ; then
1985    case $SYSV_MAN_SECTIONS in
1986	true)				ADMIN_MAN_SUFFIX=1m ;;
1987	*)				ADMIN_MAN_SUFFIX=8  ;;
1988    esac
1989fi
1990if test x$ADMIN_MAN_DIR = x    ; then
1991    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
1992fi
1993
1994
1995AC_SUBST([APP_MAN_SUFFIX])
1996AC_SUBST([LIB_MAN_SUFFIX])
1997AC_SUBST([FILE_MAN_SUFFIX])
1998AC_SUBST([MISC_MAN_SUFFIX])
1999AC_SUBST([DRIVER_MAN_SUFFIX])
2000AC_SUBST([ADMIN_MAN_SUFFIX])
2001AC_SUBST([APP_MAN_DIR])
2002AC_SUBST([LIB_MAN_DIR])
2003AC_SUBST([FILE_MAN_DIR])
2004AC_SUBST([MISC_MAN_DIR])
2005AC_SUBST([DRIVER_MAN_DIR])
2006AC_SUBST([ADMIN_MAN_DIR])
2007
2008XORG_MAN_PAGE="X Version 11"
2009AC_SUBST([XORG_MAN_PAGE])
2010MAN_SUBSTS="\
2011	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
2012	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
2013	-e 's|__xservername__|Xorg|g' \
2014	-e 's|__xconfigfile__|xorg.conf|g' \
2015	-e 's|__projectroot__|\$(prefix)|g' \
2016	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
2017	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
2018	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
2019	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
2020	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
2021	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
2022	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
2023AC_SUBST([MAN_SUBSTS])
2024
2025]) # XORG_MANPAGE_SECTIONS
2026
2027# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
2028# ------------------------
2029# Minimum version: 1.7.0
2030#
2031# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
2032# provided by xorg-sgml-doctools, if installed.
2033AC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
2034AC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
2035XORG_SGML_PATH=
2036PKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
2037    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
2038    [m4_ifval([$1],[:],
2039        [if test x"$cross_compiling" != x"yes" ; then
2040            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
2041                          [XORG_SGML_PATH=$prefix/share/sgml])
2042         fi])
2043    ])
2044
2045# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
2046# the path and the name of the doc stylesheet
2047if test "x$XORG_SGML_PATH" != "x" ; then
2048   AC_MSG_RESULT([$XORG_SGML_PATH])
2049   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
2050   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
2051else
2052   AC_MSG_RESULT([no])
2053fi
2054
2055AC_SUBST(XORG_SGML_PATH)
2056AC_SUBST(STYLESHEET_SRCDIR)
2057AC_SUBST(XSL_STYLESHEET)
2058AM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
2059]) # XORG_CHECK_SGML_DOCTOOLS
2060
2061# XORG_CHECK_LINUXDOC
2062# -------------------
2063# Minimum version: 1.0.0
2064#
2065# Defines the variable MAKE_TEXT if the necessary tools and
2066# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
2067# Whether or not the necessary tools and files are found can be checked
2068# with the AM_CONDITIONAL "BUILD_LINUXDOC"
2069AC_DEFUN([XORG_CHECK_LINUXDOC],[
2070AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
2071AC_REQUIRE([XORG_WITH_PS2PDF])
2072
2073AC_PATH_PROG(LINUXDOC, linuxdoc)
2074
2075AC_MSG_CHECKING([whether to build documentation])
2076
2077if test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
2078   BUILDDOC=yes
2079else
2080   BUILDDOC=no
2081fi
2082
2083AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
2084
2085AC_MSG_RESULT([$BUILDDOC])
2086
2087AC_MSG_CHECKING([whether to build pdf documentation])
2088
2089if test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
2090   BUILDPDFDOC=yes
2091else
2092   BUILDPDFDOC=no
2093fi
2094
2095AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
2096
2097AC_MSG_RESULT([$BUILDPDFDOC])
2098
2099MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
2100MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
2101MAKE_PDF="$PS2PDF"
2102MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
2103
2104AC_SUBST(MAKE_TEXT)
2105AC_SUBST(MAKE_PS)
2106AC_SUBST(MAKE_PDF)
2107AC_SUBST(MAKE_HTML)
2108]) # XORG_CHECK_LINUXDOC
2109
2110# XORG_CHECK_DOCBOOK
2111# -------------------
2112# Minimum version: 1.0.0
2113#
2114# Checks for the ability to build output formats from SGML DocBook source.
2115# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
2116# indicates whether the necessary tools and files are found and, if set,
2117# $(MAKE_XXX) blah.sgml will produce blah.xxx.
2118AC_DEFUN([XORG_CHECK_DOCBOOK],[
2119AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
2120
2121BUILDTXTDOC=no
2122BUILDPDFDOC=no
2123BUILDPSDOC=no
2124BUILDHTMLDOC=no
2125
2126AC_PATH_PROG(DOCBOOKPS, docbook2ps)
2127AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
2128AC_PATH_PROG(DOCBOOKHTML, docbook2html)
2129AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
2130
2131AC_MSG_CHECKING([whether to build text documentation])
2132if test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
2133   test x$BUILD_TXTDOC != xno; then
2134	BUILDTXTDOC=yes
2135fi
2136AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
2137AC_MSG_RESULT([$BUILDTXTDOC])
2138
2139AC_MSG_CHECKING([whether to build PDF documentation])
2140if test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
2141   test x$BUILD_PDFDOC != xno; then
2142	BUILDPDFDOC=yes
2143fi
2144AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
2145AC_MSG_RESULT([$BUILDPDFDOC])
2146
2147AC_MSG_CHECKING([whether to build PostScript documentation])
2148if test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
2149   test x$BUILD_PSDOC != xno; then
2150	BUILDPSDOC=yes
2151fi
2152AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
2153AC_MSG_RESULT([$BUILDPSDOC])
2154
2155AC_MSG_CHECKING([whether to build HTML documentation])
2156if test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
2157   test x$BUILD_HTMLDOC != xno; then
2158	BUILDHTMLDOC=yes
2159fi
2160AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
2161AC_MSG_RESULT([$BUILDHTMLDOC])
2162
2163MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
2164MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
2165MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
2166MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
2167
2168AC_SUBST(MAKE_TEXT)
2169AC_SUBST(MAKE_PS)
2170AC_SUBST(MAKE_PDF)
2171AC_SUBST(MAKE_HTML)
2172]) # XORG_CHECK_DOCBOOK
2173
2174# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
2175# ----------------
2176# Minimum version: 1.5.0
2177# Minimum version for optional DEFAULT argument: 1.11.0
2178#
2179# Documentation tools are not always available on all platforms and sometimes
2180# not at the appropriate level. This macro enables a module to test for the
2181# presence of the tool and obtain it's path in separate variables. Coupled with
2182# the --with-xmlto option, it allows maximum flexibilty in making decisions
2183# as whether or not to use the xmlto package. When DEFAULT is not specified,
2184# --with-xmlto assumes 'auto'.
2185#
2186# Interface to module:
2187# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
2188# XMLTO:	returns the path of the xmlto program found
2189#		returns the path set by the user in the environment
2190# --with-xmlto:	'yes' user instructs the module to use xmlto
2191#		'no' user instructs the module not to use xmlto
2192#
2193# Added in version 1.10.0
2194# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
2195#                  xmlto for text output requires either lynx, links, or w3m browsers
2196#
2197# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
2198#
2199AC_DEFUN([XORG_WITH_XMLTO],[
2200AC_ARG_VAR([XMLTO], [Path to xmlto command])
2201m4_define([_defopt], m4_default([$2], [auto]))
2202AC_ARG_WITH(xmlto,
2203	AS_HELP_STRING([--with-xmlto],
2204	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
2205	   [use_xmlto=$withval], [use_xmlto=]_defopt)
2206m4_undefine([_defopt])
2207
2208if test "x$use_xmlto" = x"auto"; then
2209   AC_PATH_PROG([XMLTO], [xmlto])
2210   if test "x$XMLTO" = "x"; then
2211        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
2212	have_xmlto=no
2213   else
2214        have_xmlto=yes
2215   fi
2216elif test "x$use_xmlto" = x"yes" ; then
2217   AC_PATH_PROG([XMLTO], [xmlto])
2218   if test "x$XMLTO" = "x"; then
2219        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
2220   fi
2221   have_xmlto=yes
2222elif test "x$use_xmlto" = x"no" ; then
2223   if test "x$XMLTO" != "x"; then
2224      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
2225   fi
2226   have_xmlto=no
2227else
2228   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
2229fi
2230
2231# Test for a minimum version of xmlto, if provided.
2232m4_ifval([$1],
2233[if test "$have_xmlto" = yes; then
2234    # scrape the xmlto version
2235    AC_MSG_CHECKING([the xmlto version])
2236    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
2237    AC_MSG_RESULT([$xmlto_version])
2238    AS_VERSION_COMPARE([$xmlto_version], [$1],
2239        [if test "x$use_xmlto" = xauto; then
2240            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
2241            have_xmlto=no
2242        else
2243            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
2244        fi])
2245fi])
2246
2247# Test for the ability of xmlto to generate a text target
2248#
2249# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
2250# following test for empty XML docbook files.
2251# For compatibility reasons use the following empty XML docbook file and if
2252# it fails try it again with a non-empty XML file.
2253have_xmlto_text=no
2254cat > conftest.xml << "EOF"
2255EOF
2256AS_IF([test "$have_xmlto" = yes],
2257      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2258             [have_xmlto_text=yes],
2259             [# Try it again with a non-empty XML file.
2260              cat > conftest.xml << "EOF"
2261<x></x>
2262EOF
2263              AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
2264                    [have_xmlto_text=yes],
2265                    [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
2266rm -f conftest.xml
2267AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
2268AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
2269]) # XORG_WITH_XMLTO
2270
2271# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
2272# --------------------------------------------
2273# Minimum version: 1.12.0
2274# Minimum version for optional DEFAULT argument: 1.12.0
2275#
2276# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
2277# XML-based language used for the transformation of XML documents.
2278# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
2279# It is used under the cover by xmlto to generate html files from DocBook/XML.
2280# The XSLT processor is often used as a standalone tool for transformations.
2281# It should not be assumed that this tool is used only to work with documnetation.
2282# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
2283#
2284# Interface to module:
2285# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
2286# XSLTPROC:	 returns the path of the xsltproc program found
2287#		 returns the path set by the user in the environment
2288# --with-xsltproc: 'yes' user instructs the module to use xsltproc
2289#		  'no' user instructs the module not to use xsltproc
2290# have_xsltproc: returns yes if xsltproc found in PATH or no
2291#
2292# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
2293#
2294AC_DEFUN([XORG_WITH_XSLTPROC],[
2295AC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
2296# Preserves the interface, should it be implemented later
2297m4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
2298m4_define([_defopt], m4_default([$2], [auto]))
2299AC_ARG_WITH(xsltproc,
2300	AS_HELP_STRING([--with-xsltproc],
2301	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
2302	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
2303m4_undefine([_defopt])
2304
2305if test "x$use_xsltproc" = x"auto"; then
2306   AC_PATH_PROG([XSLTPROC], [xsltproc])
2307   if test "x$XSLTPROC" = "x"; then
2308        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
2309	have_xsltproc=no
2310   else
2311        have_xsltproc=yes
2312   fi
2313elif test "x$use_xsltproc" = x"yes" ; then
2314   AC_PATH_PROG([XSLTPROC], [xsltproc])
2315   if test "x$XSLTPROC" = "x"; then
2316        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
2317   fi
2318   have_xsltproc=yes
2319elif test "x$use_xsltproc" = x"no" ; then
2320   if test "x$XSLTPROC" != "x"; then
2321      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
2322   fi
2323   have_xsltproc=no
2324else
2325   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
2326fi
2327
2328AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
2329]) # XORG_WITH_XSLTPROC
2330
2331# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
2332# ----------------------------------------
2333# Minimum version: 1.15.0
2334#
2335# PERL (Practical Extraction and Report Language) is a language optimized for
2336# scanning arbitrary text files, extracting information from those text files,
2337# and printing reports based on that information.
2338#
2339# When DEFAULT is not specified, --with-perl assumes 'auto'.
2340#
2341# Interface to module:
2342# HAVE_PERL: used in makefiles to conditionally scan text files
2343# PERL:	     returns the path of the perl program found
2344#	     returns the path set by the user in the environment
2345# --with-perl: 'yes' user instructs the module to use perl
2346#	       'no' user instructs the module not to use perl
2347# have_perl: returns yes if perl found in PATH or no
2348#
2349# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
2350#
2351AC_DEFUN([XORG_WITH_PERL],[
2352AC_ARG_VAR([PERL], [Path to perl command])
2353# Preserves the interface, should it be implemented later
2354m4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
2355m4_define([_defopt], m4_default([$2], [auto]))
2356AC_ARG_WITH(perl,
2357	AS_HELP_STRING([--with-perl],
2358	   [Use perl for extracting information from files (default: ]_defopt[)]),
2359	   [use_perl=$withval], [use_perl=]_defopt)
2360m4_undefine([_defopt])
2361
2362if test "x$use_perl" = x"auto"; then
2363   AC_PATH_PROG([PERL], [perl])
2364   if test "x$PERL" = "x"; then
2365        AC_MSG_WARN([perl not found - cannot extract information and report])
2366	have_perl=no
2367   else
2368        have_perl=yes
2369   fi
2370elif test "x$use_perl" = x"yes" ; then
2371   AC_PATH_PROG([PERL], [perl])
2372   if test "x$PERL" = "x"; then
2373        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
2374   fi
2375   have_perl=yes
2376elif test "x$use_perl" = x"no" ; then
2377   if test "x$PERL" != "x"; then
2378      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
2379   fi
2380   have_perl=no
2381else
2382   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
2383fi
2384
2385AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
2386]) # XORG_WITH_PERL
2387
2388# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
2389# ----------------
2390# Minimum version: 1.5.0
2391# Minimum version for optional DEFAULT argument: 1.11.0
2392#
2393# Documentation tools are not always available on all platforms and sometimes
2394# not at the appropriate level. This macro enables a module to test for the
2395# presence of the tool and obtain it's path in separate variables. Coupled with
2396# the --with-asciidoc option, it allows maximum flexibilty in making decisions
2397# as whether or not to use the asciidoc package. When DEFAULT is not specified,
2398# --with-asciidoc assumes 'auto'.
2399#
2400# Interface to module:
2401# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
2402# ASCIIDOC:	 returns the path of the asciidoc program found
2403#		 returns the path set by the user in the environment
2404# --with-asciidoc: 'yes' user instructs the module to use asciidoc
2405#		  'no' user instructs the module not to use asciidoc
2406#
2407# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
2408#
2409AC_DEFUN([XORG_WITH_ASCIIDOC],[
2410AC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
2411m4_define([_defopt], m4_default([$2], [auto]))
2412AC_ARG_WITH(asciidoc,
2413	AS_HELP_STRING([--with-asciidoc],
2414	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
2415	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
2416m4_undefine([_defopt])
2417
2418if test "x$use_asciidoc" = x"auto"; then
2419   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2420   if test "x$ASCIIDOC" = "x"; then
2421        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
2422	have_asciidoc=no
2423   else
2424        have_asciidoc=yes
2425   fi
2426elif test "x$use_asciidoc" = x"yes" ; then
2427   AC_PATH_PROG([ASCIIDOC], [asciidoc])
2428   if test "x$ASCIIDOC" = "x"; then
2429        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
2430   fi
2431   have_asciidoc=yes
2432elif test "x$use_asciidoc" = x"no" ; then
2433   if test "x$ASCIIDOC" != "x"; then
2434      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
2435   fi
2436   have_asciidoc=no
2437else
2438   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
2439fi
2440m4_ifval([$1],
2441[if test "$have_asciidoc" = yes; then
2442    # scrape the asciidoc version
2443    AC_MSG_CHECKING([the asciidoc version])
2444    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
2445    AC_MSG_RESULT([$asciidoc_version])
2446    AS_VERSION_COMPARE([$asciidoc_version], [$1],
2447        [if test "x$use_asciidoc" = xauto; then
2448            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
2449            have_asciidoc=no
2450        else
2451            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
2452        fi])
2453fi])
2454AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
2455]) # XORG_WITH_ASCIIDOC
2456
2457# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
2458# -------------------------------------------
2459# Minimum version: 1.5.0
2460# Minimum version for optional DEFAULT argument: 1.11.0
2461# Minimum version for optional DOT checking: 1.18.0
2462#
2463# Documentation tools are not always available on all platforms and sometimes
2464# not at the appropriate level. This macro enables a module to test for the
2465# presence of the tool and obtain it's path in separate variables. Coupled with
2466# the --with-doxygen option, it allows maximum flexibilty in making decisions
2467# as whether or not to use the doxygen package. When DEFAULT is not specified,
2468# --with-doxygen assumes 'auto'.
2469#
2470# Interface to module:
2471# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
2472# DOXYGEN:	 returns the path of the doxygen program found
2473#		 returns the path set by the user in the environment
2474# --with-doxygen: 'yes' user instructs the module to use doxygen
2475#		  'no' user instructs the module not to use doxygen
2476#
2477# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
2478#
2479AC_DEFUN([XORG_WITH_DOXYGEN],[
2480AC_ARG_VAR([DOXYGEN], [Path to doxygen command])
2481AC_ARG_VAR([DOT], [Path to the dot graphics utility])
2482m4_define([_defopt], m4_default([$2], [auto]))
2483AC_ARG_WITH(doxygen,
2484	AS_HELP_STRING([--with-doxygen],
2485	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
2486	   [use_doxygen=$withval], [use_doxygen=]_defopt)
2487m4_undefine([_defopt])
2488
2489if test "x$use_doxygen" = x"auto"; then
2490   AC_PATH_PROG([DOXYGEN], [doxygen])
2491   if test "x$DOXYGEN" = "x"; then
2492        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
2493	have_doxygen=no
2494   else
2495        have_doxygen=yes
2496   fi
2497elif test "x$use_doxygen" = x"yes" ; then
2498   AC_PATH_PROG([DOXYGEN], [doxygen])
2499   if test "x$DOXYGEN" = "x"; then
2500        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
2501   fi
2502   have_doxygen=yes
2503elif test "x$use_doxygen" = x"no" ; then
2504   if test "x$DOXYGEN" != "x"; then
2505      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
2506   fi
2507   have_doxygen=no
2508else
2509   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
2510fi
2511m4_ifval([$1],
2512[if test "$have_doxygen" = yes; then
2513    # scrape the doxygen version
2514    AC_MSG_CHECKING([the doxygen version])
2515    doxygen_version=`$DOXYGEN --version 2>/dev/null`
2516    AC_MSG_RESULT([$doxygen_version])
2517    AS_VERSION_COMPARE([$doxygen_version], [$1],
2518        [if test "x$use_doxygen" = xauto; then
2519            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
2520            have_doxygen=no
2521        else
2522            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
2523        fi])
2524fi])
2525
2526dnl Check for DOT if we have doxygen. The caller decides if it is mandatory
2527dnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
2528dnl 	HAVE_DOT = @HAVE_DOT@
2529HAVE_DOT=no
2530if test "x$have_doxygen" = "xyes"; then
2531  AC_PATH_PROG([DOT], [dot])
2532    if test "x$DOT" != "x"; then
2533      HAVE_DOT=yes
2534    fi
2535fi
2536
2537AC_SUBST([HAVE_DOT])
2538AM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
2539AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
2540]) # XORG_WITH_DOXYGEN
2541
2542# XORG_WITH_GROFF([DEFAULT])
2543# ----------------
2544# Minimum version: 1.6.0
2545# Minimum version for optional DEFAULT argument: 1.11.0
2546#
2547# Documentation tools are not always available on all platforms and sometimes
2548# not at the appropriate level. This macro enables a module to test for the
2549# presence of the tool and obtain it's path in separate variables. Coupled with
2550# the --with-groff option, it allows maximum flexibilty in making decisions
2551# as whether or not to use the groff package. When DEFAULT is not specified,
2552# --with-groff assumes 'auto'.
2553#
2554# Interface to module:
2555# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
2556# HAVE_GROFF_MM: the memorandum macros (-mm) package
2557# HAVE_GROFF_MS: the -ms macros package
2558# GROFF:	 returns the path of the groff program found
2559#		 returns the path set by the user in the environment
2560# --with-groff:	 'yes' user instructs the module to use groff
2561#		 'no' user instructs the module not to use groff
2562#
2563# Added in version 1.9.0:
2564# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
2565#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
2566#		   psselect from the psutils package.
2567#		   the ghostcript package. Refer to the grohtml man pages
2568#
2569# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
2570#
2571# OS and distros often splits groff in a basic and full package, the former
2572# having the groff program and the later having devices, fonts and macros
2573# Checking for the groff executable is not enough.
2574#
2575# If macros are missing, we cannot assume that groff is useless, so we don't
2576# unset HAVE_GROFF or GROFF env variables.
2577# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
2578#
2579AC_DEFUN([XORG_WITH_GROFF],[
2580AC_ARG_VAR([GROFF], [Path to groff command])
2581m4_define([_defopt], m4_default([$1], [auto]))
2582AC_ARG_WITH(groff,
2583	AS_HELP_STRING([--with-groff],
2584	   [Use groff to regenerate documentation (default: ]_defopt[)]),
2585	   [use_groff=$withval], [use_groff=]_defopt)
2586m4_undefine([_defopt])
2587
2588if test "x$use_groff" = x"auto"; then
2589   AC_PATH_PROG([GROFF], [groff])
2590   if test "x$GROFF" = "x"; then
2591        AC_MSG_WARN([groff not found - documentation targets will be skipped])
2592	have_groff=no
2593   else
2594        have_groff=yes
2595   fi
2596elif test "x$use_groff" = x"yes" ; then
2597   AC_PATH_PROG([GROFF], [groff])
2598   if test "x$GROFF" = "x"; then
2599        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
2600   fi
2601   have_groff=yes
2602elif test "x$use_groff" = x"no" ; then
2603   if test "x$GROFF" != "x"; then
2604      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
2605   fi
2606   have_groff=no
2607else
2608   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
2609fi
2610
2611# We have groff, test for the presence of the macro packages
2612if test "x$have_groff" = x"yes"; then
2613    AC_MSG_CHECKING([for ${GROFF} -ms macros])
2614    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
2615        groff_ms_works=yes
2616    else
2617        groff_ms_works=no
2618    fi
2619    AC_MSG_RESULT([$groff_ms_works])
2620    AC_MSG_CHECKING([for ${GROFF} -mm macros])
2621    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
2622        groff_mm_works=yes
2623    else
2624        groff_mm_works=no
2625    fi
2626    AC_MSG_RESULT([$groff_mm_works])
2627fi
2628
2629# We have groff, test for HTML dependencies, one command per package
2630if test "x$have_groff" = x"yes"; then
2631   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
2632   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
2633   AC_PATH_PROG(PSSELECT_PATH, [psselect])
2634   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
2635      have_groff_html=yes
2636   else
2637      have_groff_html=no
2638      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
2639   fi
2640fi
2641
2642# Set Automake conditionals for Makefiles
2643AM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
2644AM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
2645AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
2646AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
2647]) # XORG_WITH_GROFF
2648
2649# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
2650# ---------------------------------------
2651# Minimum version: 1.6.0
2652# Minimum version for optional DEFAULT argument: 1.11.0
2653# Minimum version for optional MIN-VERSION argument: 1.15.0
2654#
2655# Documentation tools are not always available on all platforms and sometimes
2656# not at the appropriate level. This macro enables a module to test for the
2657# presence of the tool and obtain it's path in separate variables. Coupled with
2658# the --with-fop option, it allows maximum flexibilty in making decisions
2659# as whether or not to use the fop package. When DEFAULT is not specified,
2660# --with-fop assumes 'auto'.
2661#
2662# Interface to module:
2663# HAVE_FOP: 	used in makefiles to conditionally generate documentation
2664# FOP:	 	returns the path of the fop program found
2665#		returns the path set by the user in the environment
2666# --with-fop: 	'yes' user instructs the module to use fop
2667#		'no' user instructs the module not to use fop
2668#
2669# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
2670#
2671AC_DEFUN([XORG_WITH_FOP],[
2672AC_ARG_VAR([FOP], [Path to fop command])
2673m4_define([_defopt], m4_default([$2], [auto]))
2674AC_ARG_WITH(fop,
2675	AS_HELP_STRING([--with-fop],
2676	   [Use fop to regenerate documentation (default: ]_defopt[)]),
2677	   [use_fop=$withval], [use_fop=]_defopt)
2678m4_undefine([_defopt])
2679
2680if test "x$use_fop" = x"auto"; then
2681   AC_PATH_PROG([FOP], [fop])
2682   if test "x$FOP" = "x"; then
2683        AC_MSG_WARN([fop not found - documentation targets will be skipped])
2684	have_fop=no
2685   else
2686        have_fop=yes
2687   fi
2688elif test "x$use_fop" = x"yes" ; then
2689   AC_PATH_PROG([FOP], [fop])
2690   if test "x$FOP" = "x"; then
2691        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
2692   fi
2693   have_fop=yes
2694elif test "x$use_fop" = x"no" ; then
2695   if test "x$FOP" != "x"; then
2696      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
2697   fi
2698   have_fop=no
2699else
2700   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
2701fi
2702
2703# Test for a minimum version of fop, if provided.
2704m4_ifval([$1],
2705[if test "$have_fop" = yes; then
2706    # scrape the fop version
2707    AC_MSG_CHECKING([for fop minimum version])
2708    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
2709    AC_MSG_RESULT([$fop_version])
2710    AS_VERSION_COMPARE([$fop_version], [$1],
2711        [if test "x$use_fop" = xauto; then
2712            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
2713            have_fop=no
2714        else
2715            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
2716        fi])
2717fi])
2718AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
2719]) # XORG_WITH_FOP
2720
2721# XORG_WITH_M4([MIN-VERSION])
2722# ---------------------------
2723# Minimum version: 1.19.0
2724#
2725# This macro attempts to locate an m4 macro processor which supports
2726# -I option and is only useful for modules relying on M4 in order to
2727# expand macros in source code files.
2728#
2729# Interface to module:
2730# M4:	 	returns the path of the m4 program found
2731#		returns the path set by the user in the environment
2732#
2733AC_DEFUN([XORG_WITH_M4], [
2734AC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
2735   [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
2736       [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
2737         ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
2738   [AC_MSG_ERROR([could not find m4 that supports -I option])],
2739   [$PATH:/usr/gnu/bin])])
2740
2741AC_SUBST([M4], [$ac_cv_path_M4])
2742]) # XORG_WITH_M4
2743
2744# XORG_WITH_PS2PDF([DEFAULT])
2745# ----------------
2746# Minimum version: 1.6.0
2747# Minimum version for optional DEFAULT argument: 1.11.0
2748#
2749# Documentation tools are not always available on all platforms and sometimes
2750# not at the appropriate level. This macro enables a module to test for the
2751# presence of the tool and obtain it's path in separate variables. Coupled with
2752# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
2753# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
2754# --with-ps2pdf assumes 'auto'.
2755#
2756# Interface to module:
2757# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
2758# PS2PDF:	returns the path of the ps2pdf program found
2759#		returns the path set by the user in the environment
2760# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
2761#		 'no' user instructs the module not to use ps2pdf
2762#
2763# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
2764#
2765AC_DEFUN([XORG_WITH_PS2PDF],[
2766AC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
2767m4_define([_defopt], m4_default([$1], [auto]))
2768AC_ARG_WITH(ps2pdf,
2769	AS_HELP_STRING([--with-ps2pdf],
2770	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
2771	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
2772m4_undefine([_defopt])
2773
2774if test "x$use_ps2pdf" = x"auto"; then
2775   AC_PATH_PROG([PS2PDF], [ps2pdf])
2776   if test "x$PS2PDF" = "x"; then
2777        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
2778	have_ps2pdf=no
2779   else
2780        have_ps2pdf=yes
2781   fi
2782elif test "x$use_ps2pdf" = x"yes" ; then
2783   AC_PATH_PROG([PS2PDF], [ps2pdf])
2784   if test "x$PS2PDF" = "x"; then
2785        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
2786   fi
2787   have_ps2pdf=yes
2788elif test "x$use_ps2pdf" = x"no" ; then
2789   if test "x$PS2PDF" != "x"; then
2790      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
2791   fi
2792   have_ps2pdf=no
2793else
2794   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
2795fi
2796AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
2797]) # XORG_WITH_PS2PDF
2798
2799# XORG_ENABLE_DOCS (enable_docs=yes)
2800# ----------------
2801# Minimum version: 1.6.0
2802#
2803# Documentation tools are not always available on all platforms and sometimes
2804# not at the appropriate level. This macro enables a builder to skip all
2805# documentation targets except traditional man pages.
2806# Combined with the specific tool checking macros XORG_WITH_*, it provides
2807# maximum flexibilty in controlling documentation building.
2808# Refer to:
2809# XORG_WITH_XMLTO         --with-xmlto
2810# XORG_WITH_ASCIIDOC      --with-asciidoc
2811# XORG_WITH_DOXYGEN       --with-doxygen
2812# XORG_WITH_FOP           --with-fop
2813# XORG_WITH_GROFF         --with-groff
2814# XORG_WITH_PS2PDF        --with-ps2pdf
2815#
2816# Interface to module:
2817# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
2818# --enable-docs: 'yes' user instructs the module to generate docs
2819#		 'no' user instructs the module not to generate docs
2820# parm1:	specify the default value, yes or no.
2821#
2822AC_DEFUN([XORG_ENABLE_DOCS],[
2823m4_define([docs_default], m4_default([$1], [yes]))
2824AC_ARG_ENABLE(docs,
2825	AS_HELP_STRING([--enable-docs],
2826	   [Enable building the documentation (default: ]docs_default[)]),
2827	   [build_docs=$enableval], [build_docs=]docs_default)
2828m4_undefine([docs_default])
2829AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
2830AC_MSG_CHECKING([whether to build documentation])
2831AC_MSG_RESULT([$build_docs])
2832]) # XORG_ENABLE_DOCS
2833
2834# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
2835# ----------------
2836# Minimum version: 1.6.0
2837#
2838# This macro enables a builder to skip all developer documentation.
2839# Combined with the specific tool checking macros XORG_WITH_*, it provides
2840# maximum flexibilty in controlling documentation building.
2841# Refer to:
2842# XORG_WITH_XMLTO         --with-xmlto
2843# XORG_WITH_ASCIIDOC      --with-asciidoc
2844# XORG_WITH_DOXYGEN       --with-doxygen
2845# XORG_WITH_FOP           --with-fop
2846# XORG_WITH_GROFF         --with-groff
2847# XORG_WITH_PS2PDF        --with-ps2pdf
2848#
2849# Interface to module:
2850# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
2851# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
2852#			'no' user instructs the module not to generate developer docs
2853# parm1:		specify the default value, yes or no.
2854#
2855AC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
2856m4_define([devel_default], m4_default([$1], [yes]))
2857AC_ARG_ENABLE(devel-docs,
2858	AS_HELP_STRING([--enable-devel-docs],
2859	   [Enable building the developer documentation (default: ]devel_default[)]),
2860	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
2861m4_undefine([devel_default])
2862AM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
2863AC_MSG_CHECKING([whether to build developer documentation])
2864AC_MSG_RESULT([$build_devel_docs])
2865]) # XORG_ENABLE_DEVEL_DOCS
2866
2867# XORG_ENABLE_SPECS (enable_specs=yes)
2868# ----------------
2869# Minimum version: 1.6.0
2870#
2871# This macro enables a builder to skip all functional specification targets.
2872# Combined with the specific tool checking macros XORG_WITH_*, it provides
2873# maximum flexibilty in controlling documentation building.
2874# Refer to:
2875# XORG_WITH_XMLTO         --with-xmlto
2876# XORG_WITH_ASCIIDOC      --with-asciidoc
2877# XORG_WITH_DOXYGEN       --with-doxygen
2878# XORG_WITH_FOP           --with-fop
2879# XORG_WITH_GROFF         --with-groff
2880# XORG_WITH_PS2PDF        --with-ps2pdf
2881#
2882# Interface to module:
2883# ENABLE_SPECS:		used in makefiles to conditionally generate specs
2884# --enable-specs:	'yes' user instructs the module to generate specs
2885#			'no' user instructs the module not to generate specs
2886# parm1:		specify the default value, yes or no.
2887#
2888AC_DEFUN([XORG_ENABLE_SPECS],[
2889m4_define([spec_default], m4_default([$1], [yes]))
2890AC_ARG_ENABLE(specs,
2891	AS_HELP_STRING([--enable-specs],
2892	   [Enable building the specs (default: ]spec_default[)]),
2893	   [build_specs=$enableval], [build_specs=]spec_default)
2894m4_undefine([spec_default])
2895AM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
2896AC_MSG_CHECKING([whether to build functional specifications])
2897AC_MSG_RESULT([$build_specs])
2898]) # XORG_ENABLE_SPECS
2899
2900# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
2901# ----------------------------------------------
2902# Minimum version: 1.13.0
2903#
2904# This macro enables a builder to enable/disable unit testing
2905# It makes no assumption about the test cases implementation
2906# Test cases may or may not use Automake "Support for test suites"
2907# They may or may not use the software utility library GLib
2908#
2909# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
2910# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
2911# The variable enable_unit_tests is used by other macros in this file.
2912#
2913# Interface to module:
2914# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
2915# enable_unit_tests:    used in configure.ac for additional configuration
2916# --enable-unit-tests:	'yes' user instructs the module to build tests
2917#			'no' user instructs the module not to build tests
2918# parm1:		specify the default value, yes or no.
2919#
2920AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2921AC_BEFORE([$0], [XORG_WITH_GLIB])
2922AC_BEFORE([$0], [XORG_LD_WRAP])
2923AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2924m4_define([_defopt], m4_default([$1], [auto]))
2925AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2926	[Enable building unit test cases (default: ]_defopt[)]),
2927	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
2928m4_undefine([_defopt])
2929AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
2930AC_MSG_CHECKING([whether to build unit test cases])
2931AC_MSG_RESULT([$enable_unit_tests])
2932]) # XORG_ENABLE_UNIT_TESTS
2933
2934# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
2935# ------------------------------------------------------
2936# Minimum version: 1.17.0
2937#
2938# This macro enables a builder to enable/disable integration testing
2939# It makes no assumption about the test cases' implementation
2940# Test cases may or may not use Automake "Support for test suites"
2941#
2942# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
2943# usually requires less dependencies and may be built and run under less
2944# stringent environments than integration tests.
2945#
2946# Interface to module:
2947# ENABLE_INTEGRATION_TESTS:   used in makefiles to conditionally build tests
2948# enable_integration_tests:   used in configure.ac for additional configuration
2949# --enable-integration-tests: 'yes' user instructs the module to build tests
2950#                             'no' user instructs the module not to build tests
2951# parm1:                      specify the default value, yes or no.
2952#
2953AC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
2954AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2955m4_define([_defopt], m4_default([$1], [auto]))
2956AC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
2957	[Enable building integration test cases (default: ]_defopt[)]),
2958	[enable_integration_tests=$enableval],
2959	[enable_integration_tests=]_defopt)
2960m4_undefine([_defopt])
2961AM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
2962	[test "x$enable_integration_tests" != xno])
2963AC_MSG_CHECKING([whether to build unit test cases])
2964AC_MSG_RESULT([$enable_integration_tests])
2965]) # XORG_ENABLE_INTEGRATION_TESTS
2966
2967# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
2968# ----------------------------------------
2969# Minimum version: 1.13.0
2970#
2971# GLib is a library which provides advanced data structures and functions.
2972# This macro enables a module to test for the presence of Glib.
2973#
2974# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
2975# Otherwise the value of $enable_unit_tests is blank.
2976#
2977# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
2978# test support usually requires less dependencies and may be built and run under
2979# less stringent environments than integration tests.
2980#
2981# Interface to module:
2982# HAVE_GLIB: used in makefiles to conditionally build targets
2983# with_glib: used in configure.ac to know if GLib has been found
2984# --with-glib:	'yes' user instructs the module to use glib
2985#		'no' user instructs the module not to use glib
2986#
2987AC_DEFUN([XORG_WITH_GLIB],[
2988AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2989m4_define([_defopt], m4_default([$2], [auto]))
2990AC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
2991	[Use GLib library for unit testing (default: ]_defopt[)]),
2992	[with_glib=$withval], [with_glib=]_defopt)
2993m4_undefine([_defopt])
2994
2995have_glib=no
2996# Do not probe GLib if user explicitly disabled unit testing
2997if test "x$enable_unit_tests" != x"no"; then
2998  # Do not probe GLib if user explicitly disabled it
2999  if test "x$with_glib" != x"no"; then
3000    m4_ifval(
3001      [$1],
3002      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
3003      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
3004    )
3005  fi
3006fi
3007
3008# Not having GLib when unit testing has been explicitly requested is an error
3009if test "x$enable_unit_tests" = x"yes"; then
3010  if test "x$have_glib" = x"no"; then
3011    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
3012  fi
3013fi
3014
3015# Having unit testing disabled when GLib has been explicitly requested is an error
3016if test "x$enable_unit_tests" = x"no"; then
3017  if test "x$with_glib" = x"yes"; then
3018    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
3019  fi
3020fi
3021
3022# Not having GLib when it has been explicitly requested is an error
3023if test "x$with_glib" = x"yes"; then
3024  if test "x$have_glib" = x"no"; then
3025    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
3026  fi
3027fi
3028
3029AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
3030]) # XORG_WITH_GLIB
3031
3032# XORG_LD_WRAP([required|optional])
3033# ---------------------------------
3034# Minimum version: 1.13.0
3035#
3036# Check if linker supports -wrap, passed via compiler flags
3037#
3038# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
3039# Otherwise the value of $enable_unit_tests is blank.
3040#
3041# Argument added in 1.16.0 - default is "required", to match existing behavior
3042# of returning an error if enable_unit_tests is yes, and ld -wrap is not
3043# available, an argument of "optional" allows use when some unit tests require
3044# ld -wrap and others do not.
3045#
3046AC_DEFUN([XORG_LD_WRAP],[
3047XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
3048    [AC_LANG_PROGRAM([#include <stdlib.h>
3049                      void __wrap_exit(int status) { return; }],
3050                     [exit(0);])])
3051# Not having ld wrap when unit testing has been explicitly requested is an error
3052if test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
3053  if test "x$have_ld_wrap" = x"no"; then
3054    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
3055  fi
3056fi
3057AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
3058#
3059]) # XORG_LD_WRAP
3060
3061# XORG_CHECK_LINKER_FLAGS
3062# -----------------------
3063# SYNOPSIS
3064#
3065#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
3066#
3067# DESCRIPTION
3068#
3069#   Check whether the given linker FLAGS work with the current language's
3070#   linker, or whether they give an error.
3071#
3072#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
3073#   success/failure.
3074#
3075#   PROGRAM-SOURCE is the program source to link with, if needed
3076#
3077#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
3078#
3079# LICENSE
3080#
3081#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
3082#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
3083#   Copyright (c) 2009 Matteo Frigo
3084#
3085#   This program is free software: you can redistribute it and/or modify it
3086#   under the terms of the GNU General Public License as published by the
3087#   Free Software Foundation, either version 3 of the License, or (at your
3088#   option) any later version.
3089#
3090#   This program is distributed in the hope that it will be useful, but
3091#   WITHOUT ANY WARRANTY; without even the implied warranty of
3092#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
3093#   Public License for more details.
3094#
3095#   You should have received a copy of the GNU General Public License along
3096#   with this program. If not, see <http://www.gnu.org/licenses/>.
3097#
3098#   As a special exception, the respective Autoconf Macro's copyright owner
3099#   gives unlimited permission to copy, distribute and modify the configure
3100#   scripts that are the output of Autoconf when processing the Macro. You
3101#   need not follow the terms of the GNU General Public License when using
3102#   or distributing such scripts, even though portions of the text of the
3103#   Macro appear in them. The GNU General Public License (GPL) does govern
3104#   all other use of the material that constitutes the Autoconf Macro.
3105#
3106#   This special exception to the GPL applies to versions of the Autoconf
3107#   Macro released by the Autoconf Archive. When you make and distribute a
3108#   modified version of the Autoconf Macro, you may extend this special
3109#   exception to the GPL to apply to your modified version as well.#
3110AC_DEFUN([XORG_CHECK_LINKER_FLAGS],
3111[AC_MSG_CHECKING([whether the linker accepts $1])
3112dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
3113AS_LITERAL_IF([$1],
3114  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
3115      ax_save_FLAGS=$LDFLAGS
3116      LDFLAGS="$1"
3117      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
3118        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
3119        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
3120      LDFLAGS=$ax_save_FLAGS])],
3121  [ax_save_FLAGS=$LDFLAGS
3122   LDFLAGS="$1"
3123   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
3124     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
3125     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
3126   LDFLAGS=$ax_save_FLAGS])
3127eval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
3128AC_MSG_RESULT($xorg_check_linker_flags)
3129if test "x$xorg_check_linker_flags" = xyes; then
3130	m4_default([$2], :)
3131else
3132	m4_default([$3], :)
3133fi
3134]) # XORG_CHECK_LINKER_FLAGS
3135
3136# XORG_MEMORY_CHECK_FLAGS
3137# -----------------------
3138# Minimum version: 1.16.0
3139#
3140# This macro attempts to find appropriate memory checking functionality
3141# for various platforms which unit testing code may use to catch various
3142# forms of memory allocation and access errors in testing.
3143#
3144# Interface to module:
3145# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
3146#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
3147#
3148# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
3149#
3150AC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
3151
3152AC_REQUIRE([AC_CANONICAL_HOST])
3153AC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
3154           [Environment variables to enable memory checking in tests])
3155
3156# Check for different types of support on different platforms
3157case $host_os in
3158    solaris*)
3159        AC_CHECK_LIB([umem], [umem_alloc],
3160            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
3161        ;;
3162    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
3163        # both directly and inverted, so should not be 0 or 255.
3164        malloc_debug_env='MALLOC_PERTURB_=15'
3165        ;;
3166    darwin*)
3167        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
3168        ;;
3169    *bsd*)
3170        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
3171        ;;
3172esac
3173
3174# User supplied flags override default flags
3175if test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
3176    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
3177fi
3178
3179AC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
3180]) # XORG_WITH_LINT
3181
3182# XORG_CHECK_MALLOC_ZERO
3183# ----------------------
3184# Minimum version: 1.0.0
3185#
3186# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
3187# malloc(0) returns NULL.  Packages should add one of these cflags to
3188# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
3189AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
3190AC_ARG_ENABLE(malloc0returnsnull,
3191	AS_HELP_STRING([--enable-malloc0returnsnull],
3192		       [malloc(0) returns NULL (default: auto)]),
3193	[MALLOC_ZERO_RETURNS_NULL=$enableval],
3194	[MALLOC_ZERO_RETURNS_NULL=auto])
3195
3196AC_MSG_CHECKING([whether malloc(0) returns NULL])
3197if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
3198AC_CACHE_VAL([xorg_cv_malloc0_returns_null],
3199	[AC_RUN_IFELSE([AC_LANG_PROGRAM([
3200#include <stdlib.h>
3201],[
3202    char *m0, *r0, *c0, *p;
3203    m0 = malloc(0);
3204    p = malloc(10);
3205    r0 = realloc(p,0);
3206    c0 = calloc(0,10);
3207    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
3208])],
3209		[xorg_cv_malloc0_returns_null=yes],
3210		[xorg_cv_malloc0_returns_null=no])])
3211MALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
3212fi
3213AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
3214
3215if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
3216	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
3217	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
3218	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
3219else
3220	MALLOC_ZERO_CFLAGS=""
3221	XMALLOC_ZERO_CFLAGS=""
3222	XTMALLOC_ZERO_CFLAGS=""
3223fi
3224
3225AC_SUBST([MALLOC_ZERO_CFLAGS])
3226AC_SUBST([XMALLOC_ZERO_CFLAGS])
3227AC_SUBST([XTMALLOC_ZERO_CFLAGS])
3228]) # XORG_CHECK_MALLOC_ZERO
3229
3230# XORG_WITH_LINT()
3231# ----------------
3232# Minimum version: 1.1.0
3233#
3234# This macro enables the use of a tool that flags some suspicious and
3235# non-portable constructs (likely to be bugs) in C language source code.
3236# It will attempt to locate the tool and use appropriate options.
3237# There are various lint type tools on different platforms.
3238#
3239# Interface to module:
3240# LINT:		returns the path to the tool found on the platform
3241#		or the value set to LINT on the configure cmd line
3242#		also an Automake conditional
3243# LINT_FLAGS:	an Automake variable with appropriate flags
3244#
3245# --with-lint:	'yes' user instructs the module to use lint
3246#		'no' user instructs the module not to use lint (default)
3247#
3248# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
3249# If the user sets the value of LINT_FLAGS, they are used verbatim.
3250#
3251AC_DEFUN([XORG_WITH_LINT],[
3252
3253AC_ARG_VAR([LINT], [Path to a lint-style command])
3254AC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
3255AC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
3256		[Use a lint-style source code checker (default: disabled)])],
3257		[use_lint=$withval], [use_lint=no])
3258
3259# Obtain platform specific info like program name and options
3260# The lint program on FreeBSD and NetBSD is different from the one on Solaris
3261case $host_os in
3262  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
3263	lint_name=splint
3264	lint_options="-badflag"
3265	;;
3266  *freebsd* | *netbsd*)
3267	lint_name=lint
3268	lint_options="-u -b"
3269	;;
3270  *solaris*)
3271	lint_name=lint
3272	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
3273	;;
3274esac
3275
3276# Test for the presence of the program (either guessed by the code or spelled out by the user)
3277if test "x$use_lint" = x"yes" ; then
3278   AC_PATH_PROG([LINT], [$lint_name])
3279   if test "x$LINT" = "x"; then
3280        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
3281   fi
3282elif test "x$use_lint" = x"no" ; then
3283   if test "x$LINT" != "x"; then
3284      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
3285   fi
3286else
3287   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
3288fi
3289
3290# User supplied flags override default flags
3291if test "x$LINT_FLAGS" != "x"; then
3292   lint_options=$LINT_FLAGS
3293fi
3294
3295AC_SUBST([LINT_FLAGS],[$lint_options])
3296AM_CONDITIONAL(LINT, [test "x$LINT" != x])
3297
3298]) # XORG_WITH_LINT
3299
3300# XORG_LINT_LIBRARY(LIBNAME)
3301# --------------------------
3302# Minimum version: 1.1.0
3303#
3304# Sets up flags for building lint libraries for checking programs that call
3305# functions in the library.
3306#
3307# Interface to module:
3308# LINTLIB		- Automake variable with the name of lint library file to make
3309# MAKE_LINT_LIB		- Automake conditional
3310#
3311# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
3312#			  - 'no' user instructs the module not to create a lint library (default)
3313
3314AC_DEFUN([XORG_LINT_LIBRARY],[
3315AC_REQUIRE([XORG_WITH_LINT])
3316AC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
3317	[Create lint library (default: disabled)])],
3318	[make_lint_lib=$enableval], [make_lint_lib=no])
3319
3320if test "x$make_lint_lib" = x"yes" ; then
3321   LINTLIB=llib-l$1.ln
3322   if test "x$LINT" = "x"; then
3323        AC_MSG_ERROR([Cannot make lint library without --with-lint])
3324   fi
3325elif test "x$make_lint_lib" != x"no" ; then
3326   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
3327fi
3328
3329AC_SUBST(LINTLIB)
3330AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
3331
3332]) # XORG_LINT_LIBRARY
3333
3334# XORG_COMPILER_BRAND
3335# -------------------
3336# Minimum version: 1.14.0
3337#
3338# Checks for various brands of compilers and sets flags as appropriate:
3339#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
3340#   GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
3341#   clang compiler - sets CLANGCC to "yes"
3342#   Intel compiler - sets INTELCC to "yes"
3343#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
3344#
3345AC_DEFUN([XORG_COMPILER_BRAND], [
3346AC_LANG_CASE(
3347	[C], [
3348		AC_REQUIRE([AC_PROG_CC_C99])
3349	],
3350	[C++], [
3351		AC_REQUIRE([AC_PROG_CXX])
3352	]
3353)
3354AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
3355AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
3356AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
3357]) # XORG_COMPILER_BRAND
3358
3359# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
3360# ---------------
3361# Minimum version: 1.16.0
3362#
3363# Test if the compiler works when passed the given flag as a command line argument.
3364# If it succeeds, the flag is appeneded to the given variable.  If not, it tries the
3365# next flag in the list until there are no more options.
3366#
3367# Note that this does not guarantee that the compiler supports the flag as some
3368# compilers will simply ignore arguments that they do not understand, but we do
3369# attempt to weed out false positives by using -Werror=unknown-warning-option and
3370# -Werror=unused-command-line-argument
3371#
3372AC_DEFUN([XORG_TESTSET_CFLAG], [
3373m4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3374m4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
3375
3376AC_LANG_COMPILER_REQUIRE
3377
3378AC_LANG_CASE(
3379	[C], [
3380		AC_REQUIRE([AC_PROG_CC_C99])
3381		define([PREFIX], [C])
3382		define([CACHE_PREFIX], [cc])
3383		define([COMPILER], [$CC])
3384	],
3385	[C++], [
3386		define([PREFIX], [CXX])
3387		define([CACHE_PREFIX], [cxx])
3388		define([COMPILER], [$CXX])
3389	]
3390)
3391
3392[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
3393
3394if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
3395	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3396	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
3397			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
3398			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3399					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
3400					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
3401	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
3402	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3403fi
3404
3405if test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
3406	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
3407		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3408	fi
3409	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3410	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
3411			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
3412			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
3413					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
3414					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
3415	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
3416	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3417fi
3418
3419found="no"
3420m4_foreach([flag], m4_cdr($@), [
3421	if test $found = "no" ; then
3422		if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
3423			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
3424		fi
3425
3426		if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
3427			PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
3428		fi
3429
3430		PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
3431
3432dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
3433		AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
3434		cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
3435		AC_CACHE_VAL($cacheid,
3436			     [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
3437					     [eval $cacheid=yes],
3438					     [eval $cacheid=no])])
3439
3440		PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
3441
3442		eval supported=\$$cacheid
3443		AC_MSG_RESULT([$supported])
3444		if test "$supported" = "yes" ; then
3445			$1="$$1 ]flag["
3446			found="yes"
3447		fi
3448	fi
3449])
3450]) # XORG_TESTSET_CFLAG
3451
3452# XORG_COMPILER_FLAGS
3453# ---------------
3454# Minimum version: 1.16.0
3455#
3456# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
3457# arguments supported by the selected compiler which do NOT alter the generated
3458# code.  These arguments will cause the compiler to print various warnings
3459# during compilation AND turn a conservative set of warnings into errors.
3460#
3461# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
3462# future versions of util-macros as options are added to new compilers.
3463#
3464AC_DEFUN([XORG_COMPILER_FLAGS], [
3465AC_REQUIRE([XORG_COMPILER_BRAND])
3466
3467AC_ARG_ENABLE(selective-werror,
3468              AS_HELP_STRING([--disable-selective-werror],
3469                             [Turn off selective compiler errors. (default: enabled)]),
3470              [SELECTIVE_WERROR=$enableval],
3471              [SELECTIVE_WERROR=yes])
3472
3473AC_LANG_CASE(
3474        [C], [
3475                define([PREFIX], [C])
3476        ],
3477        [C++], [
3478                define([PREFIX], [CXX])
3479        ]
3480)
3481# -v is too short to test reliably with XORG_TESTSET_CFLAG
3482if test "x$SUNCC" = "xyes"; then
3483    [BASE_]PREFIX[FLAGS]="-v"
3484else
3485    [BASE_]PREFIX[FLAGS]=""
3486fi
3487
3488# This chunk of warnings were those that existed in the legacy CWARNFLAGS
3489XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
3490XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
3491XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
3492XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
3493
3494AC_LANG_CASE(
3495	[C], [
3496		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
3497		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
3498		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
3499		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
3500		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
3501		XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
3502	]
3503)
3504
3505# This chunk adds additional warnings that could catch undesired effects.
3506XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
3507XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
3508XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
3509XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
3510XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
3511XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
3512XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
3513
3514# These are currently disabled because they are noisy.  They will be enabled
3515# in the future once the codebase is sufficiently modernized to silence
3516# them.  For now, I don't want them to drown out the other warnings.
3517# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
3518# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
3519# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
3520
3521# Turn some warnings into errors, so we don't accidently get successful builds
3522# when there are problems that should be fixed.
3523
3524if test "x$SELECTIVE_WERROR" = "xyes" ; then
3525XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
3526XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
3527XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
3528XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
3529XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
3530XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
3531XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
3532XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
3533XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
3534XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
3535XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
3536XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
3537XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
3538else
3539AC_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])
3540XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
3541XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
3542XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
3543XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
3544XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
3545XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
3546XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
3547XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
3548XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
3549XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
3550XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
3551XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
3552XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
3553fi
3554
3555AC_SUBST([BASE_]PREFIX[FLAGS])
3556]) # XORG_COMPILER_FLAGS
3557
3558# XORG_CWARNFLAGS
3559# ---------------
3560# Minimum version: 1.2.0
3561# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
3562#
3563# Defines CWARNFLAGS to enable C compiler warnings.
3564#
3565# This function is deprecated because it defines -fno-strict-aliasing
3566# which alters the code generated by the compiler.  If -fno-strict-aliasing
3567# is needed, then it should be added explicitly in the module when
3568# it is updated to use BASE_CFLAGS.
3569#
3570AC_DEFUN([XORG_CWARNFLAGS], [
3571AC_REQUIRE([XORG_COMPILER_FLAGS])
3572AC_REQUIRE([XORG_COMPILER_BRAND])
3573AC_LANG_CASE(
3574	[C], [
3575		CWARNFLAGS="$BASE_CFLAGS"
3576		if  test "x$GCC" = xyes ; then
3577		    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
3578		fi
3579		AC_SUBST(CWARNFLAGS)
3580	]
3581)
3582]) # XORG_CWARNFLAGS
3583
3584# XORG_STRICT_OPTION
3585# -----------------------
3586# Minimum version: 1.3.0
3587#
3588# Add configure option to enable strict compilation flags, such as treating
3589# warnings as fatal errors.
3590# If --enable-strict-compilation is passed to configure, adds strict flags to
3591# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
3592#
3593# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
3594# when strict compilation is unconditionally desired.
3595AC_DEFUN([XORG_STRICT_OPTION], [
3596AC_REQUIRE([XORG_CWARNFLAGS])
3597AC_REQUIRE([XORG_COMPILER_FLAGS])
3598
3599AC_ARG_ENABLE(strict-compilation,
3600			  AS_HELP_STRING([--enable-strict-compilation],
3601			  [Enable all warnings from compiler and make them errors (default: disabled)]),
3602			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
3603
3604AC_LANG_CASE(
3605        [C], [
3606                define([PREFIX], [C])
3607        ],
3608        [C++], [
3609                define([PREFIX], [CXX])
3610        ]
3611)
3612
3613[STRICT_]PREFIX[FLAGS]=""
3614XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
3615XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
3616
3617# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
3618# activate it with -Werror, so we add it here explicitly.
3619XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
3620
3621if test "x$STRICT_COMPILE" = "xyes"; then
3622    [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
3623    AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
3624fi
3625AC_SUBST([STRICT_]PREFIX[FLAGS])
3626AC_SUBST([BASE_]PREFIX[FLAGS])
3627AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
3628]) # XORG_STRICT_OPTION
3629
3630# XORG_DEFAULT_OPTIONS
3631# --------------------
3632# Minimum version: 1.3.0
3633#
3634# Defines default options for X.Org modules.
3635#
3636AC_DEFUN([XORG_DEFAULT_OPTIONS], [
3637AC_REQUIRE([AC_PROG_INSTALL])
3638XORG_COMPILER_FLAGS
3639XORG_CWARNFLAGS
3640XORG_STRICT_OPTION
3641XORG_RELEASE_VERSION
3642XORG_CHANGELOG
3643XORG_INSTALL
3644XORG_MANPAGE_SECTIONS
3645m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
3646    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
3647]) # XORG_DEFAULT_OPTIONS
3648
3649# XORG_INSTALL()
3650# ----------------
3651# Minimum version: 1.4.0
3652#
3653# Defines the variable INSTALL_CMD as the command to copy
3654# INSTALL from $prefix/share/util-macros.
3655#
3656AC_DEFUN([XORG_INSTALL], [
3657AC_REQUIRE([PKG_PROG_PKG_CONFIG])
3658macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
3659INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
3660mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
3661|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
3662touch \$(top_srcdir)/INSTALL; \
3663echo 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
3664AC_SUBST([INSTALL_CMD])
3665]) # XORG_INSTALL
3666dnl Copyright 2005 Red Hat, Inc
3667dnl
3668dnl Permission to use, copy, modify, distribute, and sell this software and its
3669dnl documentation for any purpose is hereby granted without fee, provided that
3670dnl the above copyright notice appear in all copies and that both that
3671dnl copyright notice and this permission notice appear in supporting
3672dnl documentation.
3673dnl
3674dnl The above copyright notice and this permission notice shall be included
3675dnl in all copies or substantial portions of the Software.
3676dnl
3677dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
3678dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3679dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3680dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
3681dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
3682dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3683dnl OTHER DEALINGS IN THE SOFTWARE.
3684dnl
3685dnl Except as contained in this notice, the name of the copyright holders shall
3686dnl not be used in advertising or otherwise to promote the sale, use or
3687dnl other dealings in this Software without prior written authorization
3688dnl from the copyright holders.
3689dnl
3690
3691# XORG_RELEASE_VERSION
3692# --------------------
3693# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
3694
3695AC_DEFUN([XORG_RELEASE_VERSION],[
3696	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
3697		[`echo $PACKAGE_VERSION | cut -d . -f 1`],
3698		[Major version of this package])
3699	PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`
3700	if test "x$PVM" = "x"; then
3701		PVM="0"
3702	fi
3703	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],
3704		[$PVM],
3705		[Minor version of this package])
3706	PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`
3707	if test "x$PVP" = "x"; then
3708		PVP="0"
3709	fi
3710	AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
3711		[$PVP],
3712		[Patch version of this package])
3713])
3714
3715# XORG_CHANGELOG()
3716# ----------------
3717# Minimum version: 1.2.0
3718#
3719# Defines the variable CHANGELOG_CMD as the command to generate
3720# ChangeLog from git.
3721#
3722#
3723AC_DEFUN([XORG_CHANGELOG], [
3724CHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
3725mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
3726|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
3727touch \$(top_srcdir)/ChangeLog; \
3728echo 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
3729AC_SUBST([CHANGELOG_CMD])
3730]) # XORG_CHANGELOG
3731
3732