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