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