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