xorg-macros.m4.in revision 62044635
1ffab5952Smrgdnl @configure_input@
2ffab5952Smrgdnl
3ffab5952Smrgdnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
4ffab5952Smrgdnl 
5ffab5952Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a
6ffab5952Smrgdnl copy of this software and associated documentation files (the "Software"),
7ffab5952Smrgdnl to deal in the Software without restriction, including without limitation
8ffab5952Smrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
9ffab5952Smrgdnl and/or sell copies of the Software, and to permit persons to whom the
10ffab5952Smrgdnl Software is furnished to do so, subject to the following conditions:
11ffab5952Smrgdnl
12ffab5952Smrgdnl The above copyright notice and this permission notice (including the next
13ffab5952Smrgdnl paragraph) shall be included in all copies or substantial portions of the
14ffab5952Smrgdnl Software.
15ffab5952Smrgdnl
16ffab5952Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17ffab5952Smrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18ffab5952Smrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19ffab5952Smrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20ffab5952Smrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21ffab5952Smrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22ffab5952Smrgdnl DEALINGS IN THE SOFTWARE.
23ffab5952Smrg
24ffab5952Smrg# XORG_MACROS_VERSION(required-version)
25ffab5952Smrg# -------------------------------------
26ffab5952Smrg# Minimum version: 1.1.0
27ffab5952Smrg#
28ffab5952Smrg# If you're using a macro added in Version 1.1 or newer, include this in
29ffab5952Smrg# your configure.ac with the minimum required version, such as:
30ffab5952Smrg# XORG_MACROS_VERSION(1.1)
31ffab5952Smrg#
32ffab5952Smrg# To ensure that this macro is defined, also add:
33ffab5952Smrg# m4_ifndef([XORG_MACROS_VERSION],
34ffab5952Smrg#     [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
35ffab5952Smrg#
36ffab5952Smrg#
37ffab5952Smrg# See the "minimum version" comment for each macro you use to see what 
38ffab5952Smrg# version you require.
39ffab5952Smrgm4_defun([XORG_MACROS_VERSION],[
40ffab5952Smrgm4_define([vers_have], [@VERSION@])
41ffab5952Smrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
42ffab5952Smrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
43ffab5952Smrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
44ffab5952Smrg    [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])])
45ffab5952Smrgm4_if(m4_version_compare(vers_have, [$1]), -1,
46ffab5952Smrg    [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])])
47ffab5952Smrgm4_undefine([vers_have])
48ffab5952Smrgm4_undefine([maj_have])
49ffab5952Smrgm4_undefine([maj_needed])
50ffab5952Smrg]) # XORG_MACROS_VERSION
51ffab5952Smrg
52ffab5952Smrg# XORG_PROG_RAWCPP()
53ffab5952Smrg# ------------------
54ffab5952Smrg# Minimum version: 1.0.0
55ffab5952Smrg#
56ffab5952Smrg# Find cpp program and necessary flags for use in pre-processing text files
57ffab5952Smrg# such as man pages and config files
58ffab5952SmrgAC_DEFUN([XORG_PROG_RAWCPP],[
59ffab5952SmrgAC_REQUIRE([AC_PROG_CPP])
60ffab5952SmrgAC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], 
61ffab5952Smrg   [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
62ffab5952Smrg
63ffab5952Smrg# Check for flag to avoid builtin definitions - assumes unix is predefined,
64ffab5952Smrg# which is not the best choice for supporting other OS'es, but covers most
65ffab5952Smrg# of the ones we need for now.
66ffab5952SmrgAC_MSG_CHECKING([if $RAWCPP requires -undef])
6762044635SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
68ffab5952Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
69ffab5952Smrg	AC_MSG_RESULT([no])
70ffab5952Smrgelse
71ffab5952Smrg	if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
72ffab5952Smrg		RAWCPPFLAGS=-undef
73ffab5952Smrg		AC_MSG_RESULT([yes])
74ffab5952Smrg	# under Cygwin unix is still defined even with -undef
75ffab5952Smrg	elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
76ffab5952Smrg		RAWCPPFLAGS="-undef -ansi"
77ffab5952Smrg		AC_MSG_RESULT([yes, with -ansi])
78ffab5952Smrg	else
79ffab5952Smrg		AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef.  I don't know what to do.])
80ffab5952Smrg	fi
81ffab5952Smrgfi
82ffab5952Smrgrm -f conftest.$ac_ext
83ffab5952Smrg
84ffab5952SmrgAC_MSG_CHECKING([if $RAWCPP requires -traditional])
8562044635SmrgAC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve   "whitespace"?]])])
86ffab5952Smrgif test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
87ffab5952Smrg	AC_MSG_RESULT([no])
88ffab5952Smrgelse
89ffab5952Smrg	if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve   \"'` -eq 1 ; then
90ffab5952Smrg		RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
91ffab5952Smrg		AC_MSG_RESULT([yes])
92ffab5952Smrg	else
93ffab5952Smrg		AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional.  I don't know what to do.])
94ffab5952Smrg	fi
95ffab5952Smrgfi
96ffab5952Smrgrm -f conftest.$ac_ext
97ffab5952SmrgAC_SUBST(RAWCPPFLAGS)
98ffab5952Smrg]) # XORG_PROG_RAWCPP
99ffab5952Smrg
100ffab5952Smrg# XORG_MANPAGE_SECTIONS()
101ffab5952Smrg# -----------------------
102ffab5952Smrg# Minimum version: 1.0.0
103ffab5952Smrg#
104ffab5952Smrg# Determine which sections man pages go in for the different man page types
105ffab5952Smrg# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
106ffab5952Smrg# Not sure if there's any better way than just hardcoding by OS name.
107ffab5952Smrg# Override default settings by setting environment variables
108ffab5952Smrg# Added MAN_SUBSTS in version 1.8
109ffab5952Smrg# Added AC_PROG_SED in version 1.8
110ffab5952Smrg
111ffab5952SmrgAC_DEFUN([XORG_MANPAGE_SECTIONS],[
112ffab5952SmrgAC_REQUIRE([AC_CANONICAL_HOST])
113ffab5952SmrgAC_REQUIRE([AC_PROG_SED])
114ffab5952Smrg
115ffab5952Smrgif test x$APP_MAN_SUFFIX = x    ; then
116ffab5952Smrg    APP_MAN_SUFFIX=1
117ffab5952Smrgfi
118ffab5952Smrgif test x$APP_MAN_DIR = x    ; then
119ffab5952Smrg    APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
120ffab5952Smrgfi
121ffab5952Smrg
122ffab5952Smrgif test x$LIB_MAN_SUFFIX = x    ; then
123ffab5952Smrg    LIB_MAN_SUFFIX=3
124ffab5952Smrgfi
125ffab5952Smrgif test x$LIB_MAN_DIR = x    ; then
126ffab5952Smrg    LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
127ffab5952Smrgfi
128ffab5952Smrg
129ffab5952Smrgif test x$FILE_MAN_SUFFIX = x    ; then
130ffab5952Smrg    case $host_os in
131ffab5952Smrg	solaris*)	FILE_MAN_SUFFIX=4  ;;
132ffab5952Smrg	*)		FILE_MAN_SUFFIX=5  ;;
133ffab5952Smrg    esac
134ffab5952Smrgfi
135ffab5952Smrgif test x$FILE_MAN_DIR = x    ; then
136ffab5952Smrg    FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
137ffab5952Smrgfi
138ffab5952Smrg
139ffab5952Smrgif test x$MISC_MAN_SUFFIX = x    ; then
140ffab5952Smrg    case $host_os in
141ffab5952Smrg	solaris*)	MISC_MAN_SUFFIX=5  ;;
142ffab5952Smrg	*)		MISC_MAN_SUFFIX=7  ;;
143ffab5952Smrg    esac
144ffab5952Smrgfi
145ffab5952Smrgif test x$MISC_MAN_DIR = x    ; then
146ffab5952Smrg    MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
147ffab5952Smrgfi
148ffab5952Smrg
149ffab5952Smrgif test x$DRIVER_MAN_SUFFIX = x    ; then
150ffab5952Smrg    case $host_os in
151ffab5952Smrg	solaris*)	DRIVER_MAN_SUFFIX=7  ;;
152ffab5952Smrg	*)		DRIVER_MAN_SUFFIX=4  ;;
153ffab5952Smrg    esac
154ffab5952Smrgfi
155ffab5952Smrgif test x$DRIVER_MAN_DIR = x    ; then
156ffab5952Smrg    DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
157ffab5952Smrgfi
158ffab5952Smrg
159ffab5952Smrgif test x$ADMIN_MAN_SUFFIX = x    ; then
160ffab5952Smrg    case $host_os in
161ffab5952Smrg	solaris*)	ADMIN_MAN_SUFFIX=1m ;;
162ffab5952Smrg	*)		ADMIN_MAN_SUFFIX=8  ;;
163ffab5952Smrg    esac
164ffab5952Smrgfi
165ffab5952Smrgif test x$ADMIN_MAN_DIR = x    ; then
166ffab5952Smrg    ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
167ffab5952Smrgfi
168ffab5952Smrg
169ffab5952Smrg
170ffab5952SmrgAC_SUBST([APP_MAN_SUFFIX])
171ffab5952SmrgAC_SUBST([LIB_MAN_SUFFIX])
172ffab5952SmrgAC_SUBST([FILE_MAN_SUFFIX])
173ffab5952SmrgAC_SUBST([MISC_MAN_SUFFIX])
174ffab5952SmrgAC_SUBST([DRIVER_MAN_SUFFIX])
175ffab5952SmrgAC_SUBST([ADMIN_MAN_SUFFIX])
176ffab5952SmrgAC_SUBST([APP_MAN_DIR])
177ffab5952SmrgAC_SUBST([LIB_MAN_DIR])
178ffab5952SmrgAC_SUBST([FILE_MAN_DIR])
179ffab5952SmrgAC_SUBST([MISC_MAN_DIR])
180ffab5952SmrgAC_SUBST([DRIVER_MAN_DIR])
181ffab5952SmrgAC_SUBST([ADMIN_MAN_DIR])
182ffab5952Smrg
183ffab5952SmrgXORG_MAN_PAGE="X Version 11"
184ffab5952SmrgAC_SUBST([XORG_MAN_PAGE])
185ffab5952SmrgMAN_SUBSTS="\
186ffab5952Smrg	-e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
187ffab5952Smrg	-e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \
188ffab5952Smrg	-e 's|__xservername__|Xorg|g' \
189ffab5952Smrg	-e 's|__xconfigfile__|xorg.conf|g' \
190ffab5952Smrg	-e 's|__projectroot__|\$(prefix)|g' \
191ffab5952Smrg	-e 's|__apploaddir__|\$(appdefaultdir)|g' \
192ffab5952Smrg	-e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \
193ffab5952Smrg	-e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \
194ffab5952Smrg	-e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \
195ffab5952Smrg	-e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \
196ffab5952Smrg	-e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \
197ffab5952Smrg	-e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'"
198ffab5952SmrgAC_SUBST([MAN_SUBSTS])
199ffab5952Smrg
200ffab5952Smrg]) # XORG_MANPAGE_SECTIONS
201ffab5952Smrg
202ffab5952Smrg# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION])
203ffab5952Smrg# ------------------------
204ffab5952Smrg# Minimum version: 1.7.0
205ffab5952Smrg#
206ffab5952Smrg# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent
207ffab5952Smrg# provided by xorg-sgml-doctools, if installed.
208ffab5952SmrgAC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[
209ffab5952SmrgAC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])])
210ffab5952SmrgXORG_SGML_PATH=
211ffab5952SmrgPKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])],
212ffab5952Smrg    [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`],
213ffab5952Smrg    [m4_ifval([$1],[:],
214ffab5952Smrg        [if test x"$cross_compiling" != x"yes" ; then
215ffab5952Smrg            AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent],
216ffab5952Smrg                          [XORG_SGML_PATH=$prefix/share/sgml])
217ffab5952Smrg         fi])
218ffab5952Smrg    ])
219ffab5952Smrg
220ffab5952Smrg# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing
221ffab5952Smrg# the path and the name of the doc stylesheet
222ffab5952Smrgif test "x$XORG_SGML_PATH" != "x" ; then
223ffab5952Smrg   AC_MSG_RESULT([$XORG_SGML_PATH])
224ffab5952Smrg   STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11
225ffab5952Smrg   XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl
226ffab5952Smrgelse
227ffab5952Smrg   AC_MSG_RESULT([no])
228ffab5952Smrgfi
229ffab5952Smrg
230ffab5952SmrgAC_SUBST(XORG_SGML_PATH)
231ffab5952SmrgAC_SUBST(STYLESHEET_SRCDIR)
232ffab5952SmrgAC_SUBST(XSL_STYLESHEET)
233ffab5952SmrgAM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"])
234ffab5952Smrg]) # XORG_CHECK_SGML_DOCTOOLS
235ffab5952Smrg
236ffab5952Smrg# XORG_CHECK_LINUXDOC
237ffab5952Smrg# -------------------
238ffab5952Smrg# Minimum version: 1.0.0
239ffab5952Smrg#
240ffab5952Smrg# Defines the variable MAKE_TEXT if the necessary tools and
241ffab5952Smrg# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
242ffab5952Smrg# Whether or not the necessary tools and files are found can be checked
243ffab5952Smrg# with the AM_CONDITIONAL "BUILD_LINUXDOC"
244ffab5952SmrgAC_DEFUN([XORG_CHECK_LINUXDOC],[
245ffab5952SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
246ffab5952SmrgAC_REQUIRE([XORG_WITH_PS2PDF])
247ffab5952Smrg
248ffab5952SmrgAC_PATH_PROG(LINUXDOC, linuxdoc)
249ffab5952Smrg
250ffab5952SmrgAC_MSG_CHECKING([whether to build documentation])
251ffab5952Smrg
252ffab5952Smrgif test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then
253ffab5952Smrg   BUILDDOC=yes
254ffab5952Smrgelse
255ffab5952Smrg   BUILDDOC=no
256ffab5952Smrgfi
257ffab5952Smrg
258ffab5952SmrgAM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
259ffab5952Smrg
260ffab5952SmrgAC_MSG_RESULT([$BUILDDOC])
261ffab5952Smrg
262ffab5952SmrgAC_MSG_CHECKING([whether to build pdf documentation])
263ffab5952Smrg
264ffab5952Smrgif test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then
265ffab5952Smrg   BUILDPDFDOC=yes
266ffab5952Smrgelse
267ffab5952Smrg   BUILDPDFDOC=no
268ffab5952Smrgfi
269ffab5952Smrg
270ffab5952SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
271ffab5952Smrg
272ffab5952SmrgAC_MSG_RESULT([$BUILDPDFDOC])
273ffab5952Smrg
274ffab5952SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f"
275ffab5952SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
276ffab5952SmrgMAKE_PDF="$PS2PDF"
277ffab5952SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC  -B html --split=0"
278ffab5952Smrg
279ffab5952SmrgAC_SUBST(MAKE_TEXT)
280ffab5952SmrgAC_SUBST(MAKE_PS)
281ffab5952SmrgAC_SUBST(MAKE_PDF)
282ffab5952SmrgAC_SUBST(MAKE_HTML)
283ffab5952Smrg]) # XORG_CHECK_LINUXDOC
284ffab5952Smrg
285ffab5952Smrg# XORG_CHECK_DOCBOOK
286ffab5952Smrg# -------------------
287ffab5952Smrg# Minimum version: 1.0.0
288ffab5952Smrg#
289ffab5952Smrg# Checks for the ability to build output formats from SGML DocBook source.
290ffab5952Smrg# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
291ffab5952Smrg# indicates whether the necessary tools and files are found and, if set,
292ffab5952Smrg# $(MAKE_XXX) blah.sgml will produce blah.xxx.
293ffab5952SmrgAC_DEFUN([XORG_CHECK_DOCBOOK],[
294ffab5952SmrgAC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS])
295ffab5952Smrg
296ffab5952SmrgBUILDTXTDOC=no
297ffab5952SmrgBUILDPDFDOC=no
298ffab5952SmrgBUILDPSDOC=no
299ffab5952SmrgBUILDHTMLDOC=no
300ffab5952Smrg
301ffab5952SmrgAC_PATH_PROG(DOCBOOKPS, docbook2ps)
302ffab5952SmrgAC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
303ffab5952SmrgAC_PATH_PROG(DOCBOOKHTML, docbook2html)
304ffab5952SmrgAC_PATH_PROG(DOCBOOKTXT, docbook2txt)
305ffab5952Smrg
306ffab5952SmrgAC_MSG_CHECKING([whether to build text documentation])
307ffab5952Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x &&
308ffab5952Smrg   test x$BUILD_TXTDOC != xno; then
309ffab5952Smrg	BUILDTXTDOC=yes
310ffab5952Smrgfi
311ffab5952SmrgAM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
312ffab5952SmrgAC_MSG_RESULT([$BUILDTXTDOC])
313ffab5952Smrg
314ffab5952SmrgAC_MSG_CHECKING([whether to build PDF documentation])
315ffab5952Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x &&
316ffab5952Smrg   test x$BUILD_PDFDOC != xno; then
317ffab5952Smrg	BUILDPDFDOC=yes
318ffab5952Smrgfi
319ffab5952SmrgAM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
320ffab5952SmrgAC_MSG_RESULT([$BUILDPDFDOC])
321ffab5952Smrg
322ffab5952SmrgAC_MSG_CHECKING([whether to build PostScript documentation])
323ffab5952Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x &&
324ffab5952Smrg   test x$BUILD_PSDOC != xno; then
325ffab5952Smrg	BUILDPSDOC=yes
326ffab5952Smrgfi
327ffab5952SmrgAM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
328ffab5952SmrgAC_MSG_RESULT([$BUILDPSDOC])
329ffab5952Smrg
330ffab5952SmrgAC_MSG_CHECKING([whether to build HTML documentation])
331ffab5952Smrgif test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x &&
332ffab5952Smrg   test x$BUILD_HTMLDOC != xno; then
333ffab5952Smrg	BUILDHTMLDOC=yes
334ffab5952Smrgfi
335ffab5952SmrgAM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
336ffab5952SmrgAC_MSG_RESULT([$BUILDHTMLDOC])
337ffab5952Smrg
338ffab5952SmrgMAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
339ffab5952SmrgMAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
340ffab5952SmrgMAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
341ffab5952SmrgMAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
342ffab5952Smrg
343ffab5952SmrgAC_SUBST(MAKE_TEXT)
344ffab5952SmrgAC_SUBST(MAKE_PS)
345ffab5952SmrgAC_SUBST(MAKE_PDF)
346ffab5952SmrgAC_SUBST(MAKE_HTML)
347ffab5952Smrg]) # XORG_CHECK_DOCBOOK
348ffab5952Smrg
349ffab5952Smrg# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT])
350ffab5952Smrg# ----------------
351ffab5952Smrg# Minimum version: 1.5.0
352ffab5952Smrg# Minimum version for optional DEFAULT argument: 1.11.0
353ffab5952Smrg#
354ffab5952Smrg# Documentation tools are not always available on all platforms and sometimes
355ffab5952Smrg# not at the appropriate level. This macro enables a module to test for the
356ffab5952Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
357ffab5952Smrg# the --with-xmlto option, it allows maximum flexibilty in making decisions
358ffab5952Smrg# as whether or not to use the xmlto package. When DEFAULT is not specified,
359ffab5952Smrg# --with-xmlto assumes 'auto'.
360ffab5952Smrg#
361ffab5952Smrg# Interface to module:
362ffab5952Smrg# HAVE_XMLTO: 	used in makefiles to conditionally generate documentation
363ffab5952Smrg# XMLTO:	returns the path of the xmlto program found
364ffab5952Smrg#		returns the path set by the user in the environment
365ffab5952Smrg# --with-xmlto:	'yes' user instructs the module to use xmlto
366ffab5952Smrg#		'no' user instructs the module not to use xmlto
367ffab5952Smrg#
368ffab5952Smrg# Added in version 1.10.0
369ffab5952Smrg# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation
370ffab5952Smrg#                  xmlto for text output requires either lynx, links, or w3m browsers
371ffab5952Smrg#
372ffab5952Smrg# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path.
373ffab5952Smrg#
374ffab5952SmrgAC_DEFUN([XORG_WITH_XMLTO],[
375ffab5952SmrgAC_ARG_VAR([XMLTO], [Path to xmlto command])
376ffab5952Smrgm4_define([_defopt], m4_default([$2], [auto]))
377ffab5952SmrgAC_ARG_WITH(xmlto,
378ffab5952Smrg	AS_HELP_STRING([--with-xmlto],
379ffab5952Smrg	   [Use xmlto to regenerate documentation (default: ]_defopt[)]),
380ffab5952Smrg	   [use_xmlto=$withval], [use_xmlto=]_defopt)
381ffab5952Smrgm4_undefine([_defopt])
382ffab5952Smrg
383ffab5952Smrgif test "x$use_xmlto" = x"auto"; then
384ffab5952Smrg   AC_PATH_PROG([XMLTO], [xmlto])
385ffab5952Smrg   if test "x$XMLTO" = "x"; then
386ffab5952Smrg        AC_MSG_WARN([xmlto not found - documentation targets will be skipped])
387ffab5952Smrg	have_xmlto=no
388ffab5952Smrg   else
389ffab5952Smrg        have_xmlto=yes
390ffab5952Smrg   fi
391ffab5952Smrgelif test "x$use_xmlto" = x"yes" ; then
392ffab5952Smrg   AC_PATH_PROG([XMLTO], [xmlto])
393ffab5952Smrg   if test "x$XMLTO" = "x"; then
394ffab5952Smrg        AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH])
395ffab5952Smrg   fi
396ffab5952Smrg   have_xmlto=yes
397ffab5952Smrgelif test "x$use_xmlto" = x"no" ; then
398ffab5952Smrg   if test "x$XMLTO" != "x"; then
399ffab5952Smrg      AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified])
400ffab5952Smrg   fi
401ffab5952Smrg   have_xmlto=no
402ffab5952Smrgelse
403ffab5952Smrg   AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
404ffab5952Smrgfi
405ffab5952Smrg
406ffab5952Smrg# Test for a minimum version of xmlto, if provided.
407ffab5952Smrgm4_ifval([$1],
408ffab5952Smrg[if test "$have_xmlto" = yes; then
409ffab5952Smrg    # scrape the xmlto version
410ffab5952Smrg    AC_MSG_CHECKING([the xmlto version])
411ffab5952Smrg    xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
412ffab5952Smrg    AC_MSG_RESULT([$xmlto_version])
413ffab5952Smrg    AS_VERSION_COMPARE([$xmlto_version], [$1],
414ffab5952Smrg        [if test "x$use_xmlto" = xauto; then
415ffab5952Smrg            AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
416ffab5952Smrg            have_xmlto=no
417ffab5952Smrg        else
418ffab5952Smrg            AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
419ffab5952Smrg        fi])
420ffab5952Smrgfi])
421ffab5952Smrg
422ffab5952Smrg# Test for the ability of xmlto to generate a text target
423ffab5952Smrghave_xmlto_text=no
424ffab5952Smrgcat > conftest.xml << "EOF"
425ffab5952SmrgEOF
426ffab5952SmrgAS_IF([test "$have_xmlto" = yes],
427ffab5952Smrg      [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
428ffab5952Smrg             [have_xmlto_text=yes],
429ffab5952Smrg             [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
430ffab5952Smrgrm -f conftest.xml
431ffab5952SmrgAM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
432ffab5952SmrgAM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
433ffab5952Smrg]) # XORG_WITH_XMLTO
434ffab5952Smrg
43562044635Smrg# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
43662044635Smrg# --------------------------------------------
43762044635Smrg# Minimum version: 1.12.0
43862044635Smrg# Minimum version for optional DEFAULT argument: 1.12.0
43962044635Smrg#
44062044635Smrg# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
44162044635Smrg# XML-based language used for the transformation of XML documents.
44262044635Smrg# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
44362044635Smrg# It is used under the cover by xmlto to generate html files from DocBook/XML.
44462044635Smrg# The XSLT processor is often used as a standalone tool for transformations.
44562044635Smrg# It should not be assumed that this tool is used only to work with documnetation.
44662044635Smrg# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
44762044635Smrg#
44862044635Smrg# Interface to module:
44962044635Smrg# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
45062044635Smrg# XSLTPROC:	 returns the path of the xsltproc program found
45162044635Smrg#		 returns the path set by the user in the environment
45262044635Smrg# --with-xsltproc: 'yes' user instructs the module to use xsltproc
45362044635Smrg#		  'no' user instructs the module not to use xsltproc
45462044635Smrg# have_xsltproc: returns yes if xsltproc found in PATH or no
45562044635Smrg#
45662044635Smrg# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
45762044635Smrg#
45862044635SmrgAC_DEFUN([XORG_WITH_XSLTPROC],[
45962044635SmrgAC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
46062044635Smrg# Preserves the interface, should it be implemented later
46162044635Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
46262044635Smrgm4_define([_defopt], m4_default([$2], [auto]))
46362044635SmrgAC_ARG_WITH(xsltproc,
46462044635Smrg	AS_HELP_STRING([--with-xsltproc],
46562044635Smrg	   [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
46662044635Smrg	   [use_xsltproc=$withval], [use_xsltproc=]_defopt)
46762044635Smrgm4_undefine([_defopt])
46862044635Smrg
46962044635Smrgif test "x$use_xsltproc" = x"auto"; then
47062044635Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
47162044635Smrg   if test "x$XSLTPROC" = "x"; then
47262044635Smrg        AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
47362044635Smrg	have_xsltproc=no
47462044635Smrg   else
47562044635Smrg        have_xsltproc=yes
47662044635Smrg   fi
47762044635Smrgelif test "x$use_xsltproc" = x"yes" ; then
47862044635Smrg   AC_PATH_PROG([XSLTPROC], [xsltproc])
47962044635Smrg   if test "x$XSLTPROC" = "x"; then
48062044635Smrg        AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
48162044635Smrg   fi
48262044635Smrg   have_xsltproc=yes
48362044635Smrgelif test "x$use_xsltproc" = x"no" ; then
48462044635Smrg   if test "x$XSLTPROC" != "x"; then
48562044635Smrg      AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
48662044635Smrg   fi
48762044635Smrg   have_xsltproc=no
48862044635Smrgelse
48962044635Smrg   AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
49062044635Smrgfi
49162044635Smrg
49262044635SmrgAM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
49362044635Smrg]) # XORG_WITH_XSLTPROC
49462044635Smrg
49562044635Smrg# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
49662044635Smrg# ----------------------------------------
49762044635Smrg# Minimum version: 1.15.0
49862044635Smrg#
49962044635Smrg# PERL (Practical Extraction and Report Language) is a language optimized for
50062044635Smrg# scanning arbitrary text files, extracting information from those text files,
50162044635Smrg# and printing reports based on that information.
50262044635Smrg#
50362044635Smrg# When DEFAULT is not specified, --with-perl assumes 'auto'.
50462044635Smrg#
50562044635Smrg# Interface to module:
50662044635Smrg# HAVE_PERL: used in makefiles to conditionally scan text files
50762044635Smrg# PERL:	     returns the path of the perl program found
50862044635Smrg#	     returns the path set by the user in the environment
50962044635Smrg# --with-perl: 'yes' user instructs the module to use perl
51062044635Smrg#	       'no' user instructs the module not to use perl
51162044635Smrg# have_perl: returns yes if perl found in PATH or no
51262044635Smrg#
51362044635Smrg# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
51462044635Smrg#
51562044635SmrgAC_DEFUN([XORG_WITH_PERL],[
51662044635SmrgAC_ARG_VAR([PERL], [Path to perl command])
51762044635Smrg# Preserves the interface, should it be implemented later
51862044635Smrgm4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
51962044635Smrgm4_define([_defopt], m4_default([$2], [auto]))
52062044635SmrgAC_ARG_WITH(perl,
52162044635Smrg	AS_HELP_STRING([--with-perl],
52262044635Smrg	   [Use perl for extracting information from files (default: ]_defopt[)]),
52362044635Smrg	   [use_perl=$withval], [use_perl=]_defopt)
52462044635Smrgm4_undefine([_defopt])
52562044635Smrg
52662044635Smrgif test "x$use_perl" = x"auto"; then
52762044635Smrg   AC_PATH_PROG([PERL], [perl])
52862044635Smrg   if test "x$PERL" = "x"; then
52962044635Smrg        AC_MSG_WARN([perl not found - cannot extract information and report])
53062044635Smrg	have_perl=no
53162044635Smrg   else
53262044635Smrg        have_perl=yes
53362044635Smrg   fi
53462044635Smrgelif test "x$use_perl" = x"yes" ; then
53562044635Smrg   AC_PATH_PROG([PERL], [perl])
53662044635Smrg   if test "x$PERL" = "x"; then
53762044635Smrg        AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
53862044635Smrg   fi
53962044635Smrg   have_perl=yes
54062044635Smrgelif test "x$use_perl" = x"no" ; then
54162044635Smrg   if test "x$PERL" != "x"; then
54262044635Smrg      AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
54362044635Smrg   fi
54462044635Smrg   have_perl=no
54562044635Smrgelse
54662044635Smrg   AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
54762044635Smrgfi
54862044635Smrg
54962044635SmrgAM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
55062044635Smrg]) # XORG_WITH_PERL
55162044635Smrg
552ffab5952Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
553ffab5952Smrg# ----------------
554ffab5952Smrg# Minimum version: 1.5.0
555ffab5952Smrg# Minimum version for optional DEFAULT argument: 1.11.0
556ffab5952Smrg#
557ffab5952Smrg# Documentation tools are not always available on all platforms and sometimes
558ffab5952Smrg# not at the appropriate level. This macro enables a module to test for the
559ffab5952Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
560ffab5952Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
561ffab5952Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
562ffab5952Smrg# --with-asciidoc assumes 'auto'.
563ffab5952Smrg#
564ffab5952Smrg# Interface to module:
565ffab5952Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
566ffab5952Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
567ffab5952Smrg#		 returns the path set by the user in the environment
568ffab5952Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
569ffab5952Smrg#		  'no' user instructs the module not to use asciidoc
570ffab5952Smrg#
571ffab5952Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
572ffab5952Smrg#
573ffab5952SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
574ffab5952SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
575ffab5952Smrgm4_define([_defopt], m4_default([$2], [auto]))
576ffab5952SmrgAC_ARG_WITH(asciidoc,
577ffab5952Smrg	AS_HELP_STRING([--with-asciidoc],
578ffab5952Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
579ffab5952Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
580ffab5952Smrgm4_undefine([_defopt])
581ffab5952Smrg
582ffab5952Smrgif test "x$use_asciidoc" = x"auto"; then
583ffab5952Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
584ffab5952Smrg   if test "x$ASCIIDOC" = "x"; then
585ffab5952Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
586ffab5952Smrg	have_asciidoc=no
587ffab5952Smrg   else
588ffab5952Smrg        have_asciidoc=yes
589ffab5952Smrg   fi
590ffab5952Smrgelif test "x$use_asciidoc" = x"yes" ; then
591ffab5952Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
592ffab5952Smrg   if test "x$ASCIIDOC" = "x"; then
593ffab5952Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
594ffab5952Smrg   fi
595ffab5952Smrg   have_asciidoc=yes
596ffab5952Smrgelif test "x$use_asciidoc" = x"no" ; then
597ffab5952Smrg   if test "x$ASCIIDOC" != "x"; then
598ffab5952Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
599ffab5952Smrg   fi
600ffab5952Smrg   have_asciidoc=no
601ffab5952Smrgelse
602ffab5952Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
603ffab5952Smrgfi
604ffab5952Smrgm4_ifval([$1],
605ffab5952Smrg[if test "$have_asciidoc" = yes; then
606ffab5952Smrg    # scrape the asciidoc version
607ffab5952Smrg    AC_MSG_CHECKING([the asciidoc version])
608ffab5952Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
609ffab5952Smrg    AC_MSG_RESULT([$asciidoc_version])
610ffab5952Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
611ffab5952Smrg        [if test "x$use_asciidoc" = xauto; then
612ffab5952Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
613ffab5952Smrg            have_asciidoc=no
614ffab5952Smrg        else
615ffab5952Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
616ffab5952Smrg        fi])
617ffab5952Smrgfi])
618ffab5952SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
619ffab5952Smrg]) # XORG_WITH_ASCIIDOC
620ffab5952Smrg
621ffab5952Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
622ffab5952Smrg# --------------------------------
623ffab5952Smrg# Minimum version: 1.5.0
624ffab5952Smrg# Minimum version for optional DEFAULT argument: 1.11.0
625ffab5952Smrg#
626ffab5952Smrg# Documentation tools are not always available on all platforms and sometimes
627ffab5952Smrg# not at the appropriate level. This macro enables a module to test for the
628ffab5952Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
629ffab5952Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
630ffab5952Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
631ffab5952Smrg# --with-doxygen assumes 'auto'.
632ffab5952Smrg#
633ffab5952Smrg# Interface to module:
634ffab5952Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
635ffab5952Smrg# DOXYGEN:	 returns the path of the doxygen program found
636ffab5952Smrg#		 returns the path set by the user in the environment
637ffab5952Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
638ffab5952Smrg#		  'no' user instructs the module not to use doxygen
639ffab5952Smrg#
640ffab5952Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
641ffab5952Smrg#
642ffab5952SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
643ffab5952SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
644ffab5952Smrgm4_define([_defopt], m4_default([$2], [auto]))
645ffab5952SmrgAC_ARG_WITH(doxygen,
646ffab5952Smrg	AS_HELP_STRING([--with-doxygen],
647ffab5952Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
648ffab5952Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
649ffab5952Smrgm4_undefine([_defopt])
650ffab5952Smrg
651ffab5952Smrgif test "x$use_doxygen" = x"auto"; then
652ffab5952Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
653ffab5952Smrg   if test "x$DOXYGEN" = "x"; then
654ffab5952Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
655ffab5952Smrg	have_doxygen=no
656ffab5952Smrg   else
657ffab5952Smrg        have_doxygen=yes
658ffab5952Smrg   fi
659ffab5952Smrgelif test "x$use_doxygen" = x"yes" ; then
660ffab5952Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
661ffab5952Smrg   if test "x$DOXYGEN" = "x"; then
662ffab5952Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
663ffab5952Smrg   fi
664ffab5952Smrg   have_doxygen=yes
665ffab5952Smrgelif test "x$use_doxygen" = x"no" ; then
666ffab5952Smrg   if test "x$DOXYGEN" != "x"; then
667ffab5952Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
668ffab5952Smrg   fi
669ffab5952Smrg   have_doxygen=no
670ffab5952Smrgelse
671ffab5952Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
672ffab5952Smrgfi
673ffab5952Smrgm4_ifval([$1],
674ffab5952Smrg[if test "$have_doxygen" = yes; then
675ffab5952Smrg    # scrape the doxygen version
676ffab5952Smrg    AC_MSG_CHECKING([the doxygen version])
677ffab5952Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
678ffab5952Smrg    AC_MSG_RESULT([$doxygen_version])
679ffab5952Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
680ffab5952Smrg        [if test "x$use_doxygen" = xauto; then
681ffab5952Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
682ffab5952Smrg            have_doxygen=no
683ffab5952Smrg        else
684ffab5952Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
685ffab5952Smrg        fi])
686ffab5952Smrgfi])
687ffab5952SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
688ffab5952Smrg]) # XORG_WITH_DOXYGEN
689ffab5952Smrg
690ffab5952Smrg# XORG_WITH_GROFF([DEFAULT])
691ffab5952Smrg# ----------------
692ffab5952Smrg# Minimum version: 1.6.0
693ffab5952Smrg# Minimum version for optional DEFAULT argument: 1.11.0
694ffab5952Smrg#
695ffab5952Smrg# Documentation tools are not always available on all platforms and sometimes
696ffab5952Smrg# not at the appropriate level. This macro enables a module to test for the
697ffab5952Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
698ffab5952Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
699ffab5952Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
700ffab5952Smrg# --with-groff assumes 'auto'.
701ffab5952Smrg#
702ffab5952Smrg# Interface to module:
703ffab5952Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
704ffab5952Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
705ffab5952Smrg# HAVE_GROFF_MS: the -ms macros package
706ffab5952Smrg# GROFF:	 returns the path of the groff program found
707ffab5952Smrg#		 returns the path set by the user in the environment
708ffab5952Smrg# --with-groff:	 'yes' user instructs the module to use groff
709ffab5952Smrg#		 'no' user instructs the module not to use groff
710ffab5952Smrg#
711ffab5952Smrg# Added in version 1.9.0:
712ffab5952Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
713ffab5952Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
714ffab5952Smrg#		   psselect from the psutils package.
715ffab5952Smrg#		   the ghostcript package. Refer to the grohtml man pages
716ffab5952Smrg#
717ffab5952Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
718ffab5952Smrg#
719ffab5952Smrg# OS and distros often splits groff in a basic and full package, the former
720ffab5952Smrg# having the groff program and the later having devices, fonts and macros
721ffab5952Smrg# Checking for the groff executable is not enough.
722ffab5952Smrg#
723ffab5952Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
724ffab5952Smrg# unset HAVE_GROFF or GROFF env variables.
725ffab5952Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
726ffab5952Smrg#
727ffab5952SmrgAC_DEFUN([XORG_WITH_GROFF],[
728ffab5952SmrgAC_ARG_VAR([GROFF], [Path to groff command])
729ffab5952Smrgm4_define([_defopt], m4_default([$1], [auto]))
730ffab5952SmrgAC_ARG_WITH(groff,
731ffab5952Smrg	AS_HELP_STRING([--with-groff],
732ffab5952Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
733ffab5952Smrg	   [use_groff=$withval], [use_groff=]_defopt)
734ffab5952Smrgm4_undefine([_defopt])
735ffab5952Smrg
736ffab5952Smrgif test "x$use_groff" = x"auto"; then
737ffab5952Smrg   AC_PATH_PROG([GROFF], [groff])
738ffab5952Smrg   if test "x$GROFF" = "x"; then
739ffab5952Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
740ffab5952Smrg	have_groff=no
741ffab5952Smrg   else
742ffab5952Smrg        have_groff=yes
743ffab5952Smrg   fi
744ffab5952Smrgelif test "x$use_groff" = x"yes" ; then
745ffab5952Smrg   AC_PATH_PROG([GROFF], [groff])
746ffab5952Smrg   if test "x$GROFF" = "x"; then
747ffab5952Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
748ffab5952Smrg   fi
749ffab5952Smrg   have_groff=yes
750ffab5952Smrgelif test "x$use_groff" = x"no" ; then
751ffab5952Smrg   if test "x$GROFF" != "x"; then
752ffab5952Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
753ffab5952Smrg   fi
754ffab5952Smrg   have_groff=no
755ffab5952Smrgelse
756ffab5952Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
757ffab5952Smrgfi
758ffab5952Smrg
759ffab5952Smrg# We have groff, test for the presence of the macro packages
760ffab5952Smrgif test "x$have_groff" = x"yes"; then
761ffab5952Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
762ffab5952Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
763ffab5952Smrg        groff_ms_works=yes
764ffab5952Smrg    else
765ffab5952Smrg        groff_ms_works=no
766ffab5952Smrg    fi
767ffab5952Smrg    AC_MSG_RESULT([$groff_ms_works])
768ffab5952Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
769ffab5952Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
770ffab5952Smrg        groff_mm_works=yes
771ffab5952Smrg    else
772ffab5952Smrg        groff_mm_works=no
773ffab5952Smrg    fi
774ffab5952Smrg    AC_MSG_RESULT([$groff_mm_works])
775ffab5952Smrgfi
776ffab5952Smrg
777ffab5952Smrg# We have groff, test for HTML dependencies, one command per package
778ffab5952Smrgif test "x$have_groff" = x"yes"; then
779ffab5952Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
780ffab5952Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
781ffab5952Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
782ffab5952Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
783ffab5952Smrg      have_groff_html=yes
784ffab5952Smrg   else
785ffab5952Smrg      have_groff_html=no
786ffab5952Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
787ffab5952Smrg   fi
788ffab5952Smrgfi
789ffab5952Smrg
790ffab5952Smrg# Set Automake conditionals for Makefiles
791ffab5952SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
792ffab5952SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
793ffab5952SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
794ffab5952SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
795ffab5952Smrg]) # XORG_WITH_GROFF
796ffab5952Smrg
79762044635Smrg# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
79862044635Smrg# ---------------------------------------
799ffab5952Smrg# Minimum version: 1.6.0
800ffab5952Smrg# Minimum version for optional DEFAULT argument: 1.11.0
80162044635Smrg# Minimum version for optional MIN-VERSION argument: 1.15.0
802ffab5952Smrg#
803ffab5952Smrg# Documentation tools are not always available on all platforms and sometimes
804ffab5952Smrg# not at the appropriate level. This macro enables a module to test for the
805ffab5952Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
806ffab5952Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
807ffab5952Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
808ffab5952Smrg# --with-fop assumes 'auto'.
809ffab5952Smrg#
810ffab5952Smrg# Interface to module:
811ffab5952Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
812ffab5952Smrg# FOP:	 	returns the path of the fop program found
813ffab5952Smrg#		returns the path set by the user in the environment
814ffab5952Smrg# --with-fop: 	'yes' user instructs the module to use fop
815ffab5952Smrg#		'no' user instructs the module not to use fop
816ffab5952Smrg#
817ffab5952Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
818ffab5952Smrg#
819ffab5952SmrgAC_DEFUN([XORG_WITH_FOP],[
820ffab5952SmrgAC_ARG_VAR([FOP], [Path to fop command])
82162044635Smrgm4_define([_defopt], m4_default([$2], [auto]))
822ffab5952SmrgAC_ARG_WITH(fop,
823ffab5952Smrg	AS_HELP_STRING([--with-fop],
824ffab5952Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
825ffab5952Smrg	   [use_fop=$withval], [use_fop=]_defopt)
826ffab5952Smrgm4_undefine([_defopt])
827ffab5952Smrg
828ffab5952Smrgif test "x$use_fop" = x"auto"; then
829ffab5952Smrg   AC_PATH_PROG([FOP], [fop])
830ffab5952Smrg   if test "x$FOP" = "x"; then
831ffab5952Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
832ffab5952Smrg	have_fop=no
833ffab5952Smrg   else
834ffab5952Smrg        have_fop=yes
835ffab5952Smrg   fi
836ffab5952Smrgelif test "x$use_fop" = x"yes" ; then
837ffab5952Smrg   AC_PATH_PROG([FOP], [fop])
838ffab5952Smrg   if test "x$FOP" = "x"; then
839ffab5952Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
840ffab5952Smrg   fi
841ffab5952Smrg   have_fop=yes
842ffab5952Smrgelif test "x$use_fop" = x"no" ; then
843ffab5952Smrg   if test "x$FOP" != "x"; then
844ffab5952Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
845ffab5952Smrg   fi
846ffab5952Smrg   have_fop=no
847ffab5952Smrgelse
848ffab5952Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
849ffab5952Smrgfi
85062044635Smrg
85162044635Smrg# Test for a minimum version of fop, if provided.
85262044635Smrgm4_ifval([$1],
85362044635Smrg[if test "$have_fop" = yes; then
85462044635Smrg    # scrape the fop version
85562044635Smrg    AC_MSG_CHECKING([for fop minimum version])
85662044635Smrg    fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
85762044635Smrg    AC_MSG_RESULT([$fop_version])
85862044635Smrg    AS_VERSION_COMPARE([$fop_version], [$1],
85962044635Smrg        [if test "x$use_fop" = xauto; then
86062044635Smrg            AC_MSG_WARN([fop version $fop_version found, but $1 needed])
86162044635Smrg            have_fop=no
86262044635Smrg        else
86362044635Smrg            AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
86462044635Smrg        fi])
86562044635Smrgfi])
866ffab5952SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
867ffab5952Smrg]) # XORG_WITH_FOP
868ffab5952Smrg
869ffab5952Smrg# XORG_WITH_PS2PDF([DEFAULT])
870ffab5952Smrg# ----------------
871ffab5952Smrg# Minimum version: 1.6.0
872ffab5952Smrg# Minimum version for optional DEFAULT argument: 1.11.0
873ffab5952Smrg#
874ffab5952Smrg# Documentation tools are not always available on all platforms and sometimes
875ffab5952Smrg# not at the appropriate level. This macro enables a module to test for the
876ffab5952Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
877ffab5952Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
878ffab5952Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
879ffab5952Smrg# --with-ps2pdf assumes 'auto'.
880ffab5952Smrg#
881ffab5952Smrg# Interface to module:
882ffab5952Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
883ffab5952Smrg# PS2PDF:	returns the path of the ps2pdf program found
884ffab5952Smrg#		returns the path set by the user in the environment
885ffab5952Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
886ffab5952Smrg#		 'no' user instructs the module not to use ps2pdf
887ffab5952Smrg#
888ffab5952Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
889ffab5952Smrg#
890ffab5952SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
891ffab5952SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
892ffab5952Smrgm4_define([_defopt], m4_default([$1], [auto]))
893ffab5952SmrgAC_ARG_WITH(ps2pdf,
894ffab5952Smrg	AS_HELP_STRING([--with-ps2pdf],
895ffab5952Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
896ffab5952Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
897ffab5952Smrgm4_undefine([_defopt])
898ffab5952Smrg
899ffab5952Smrgif test "x$use_ps2pdf" = x"auto"; then
900ffab5952Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
901ffab5952Smrg   if test "x$PS2PDF" = "x"; then
902ffab5952Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
903ffab5952Smrg	have_ps2pdf=no
904ffab5952Smrg   else
905ffab5952Smrg        have_ps2pdf=yes
906ffab5952Smrg   fi
907ffab5952Smrgelif test "x$use_ps2pdf" = x"yes" ; then
908ffab5952Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
909ffab5952Smrg   if test "x$PS2PDF" = "x"; then
910ffab5952Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
911ffab5952Smrg   fi
912ffab5952Smrg   have_ps2pdf=yes
913ffab5952Smrgelif test "x$use_ps2pdf" = x"no" ; then
914ffab5952Smrg   if test "x$PS2PDF" != "x"; then
915ffab5952Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
916ffab5952Smrg   fi
917ffab5952Smrg   have_ps2pdf=no
918ffab5952Smrgelse
919ffab5952Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
920ffab5952Smrgfi
921ffab5952SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
922ffab5952Smrg]) # XORG_WITH_PS2PDF
923ffab5952Smrg
924ffab5952Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
925ffab5952Smrg# ----------------
926ffab5952Smrg# Minimum version: 1.6.0
927ffab5952Smrg#
928ffab5952Smrg# Documentation tools are not always available on all platforms and sometimes
929ffab5952Smrg# not at the appropriate level. This macro enables a builder to skip all
930ffab5952Smrg# documentation targets except traditional man pages.
931ffab5952Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
932ffab5952Smrg# maximum flexibilty in controlling documentation building.
933ffab5952Smrg# Refer to:
934ffab5952Smrg# XORG_WITH_XMLTO         --with-xmlto
935ffab5952Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
936ffab5952Smrg# XORG_WITH_DOXYGEN       --with-doxygen
937ffab5952Smrg# XORG_WITH_FOP           --with-fop
938ffab5952Smrg# XORG_WITH_GROFF         --with-groff
939ffab5952Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
940ffab5952Smrg#
941ffab5952Smrg# Interface to module:
942ffab5952Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
943ffab5952Smrg# --enable-docs: 'yes' user instructs the module to generate docs
944ffab5952Smrg#		 'no' user instructs the module not to generate docs
945ffab5952Smrg# parm1:	specify the default value, yes or no.
946ffab5952Smrg#
947ffab5952SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
94862044635Smrgm4_define([docs_default], m4_default([$1], [yes]))
949ffab5952SmrgAC_ARG_ENABLE(docs,
950ffab5952Smrg	AS_HELP_STRING([--enable-docs],
95162044635Smrg	   [Enable building the documentation (default: ]docs_default[)]),
95262044635Smrg	   [build_docs=$enableval], [build_docs=]docs_default)
95362044635Smrgm4_undefine([docs_default])
954ffab5952SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
955ffab5952SmrgAC_MSG_CHECKING([whether to build documentation])
956ffab5952SmrgAC_MSG_RESULT([$build_docs])
957ffab5952Smrg]) # XORG_ENABLE_DOCS
958ffab5952Smrg
959ffab5952Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
960ffab5952Smrg# ----------------
961ffab5952Smrg# Minimum version: 1.6.0
962ffab5952Smrg#
963ffab5952Smrg# This macro enables a builder to skip all developer documentation.
964ffab5952Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
965ffab5952Smrg# maximum flexibilty in controlling documentation building.
966ffab5952Smrg# Refer to:
967ffab5952Smrg# XORG_WITH_XMLTO         --with-xmlto
968ffab5952Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
969ffab5952Smrg# XORG_WITH_DOXYGEN       --with-doxygen
970ffab5952Smrg# XORG_WITH_FOP           --with-fop
971ffab5952Smrg# XORG_WITH_GROFF         --with-groff
972ffab5952Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
973ffab5952Smrg#
974ffab5952Smrg# Interface to module:
975ffab5952Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
976ffab5952Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
977ffab5952Smrg#			'no' user instructs the module not to generate developer docs
978ffab5952Smrg# parm1:		specify the default value, yes or no.
979ffab5952Smrg#
980ffab5952SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
981ffab5952Smrgm4_define([devel_default], m4_default([$1], [yes]))
982ffab5952SmrgAC_ARG_ENABLE(devel-docs,
983ffab5952Smrg	AS_HELP_STRING([--enable-devel-docs],
984ffab5952Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
985ffab5952Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
986ffab5952Smrgm4_undefine([devel_default])
987ffab5952SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
988ffab5952SmrgAC_MSG_CHECKING([whether to build developer documentation])
989ffab5952SmrgAC_MSG_RESULT([$build_devel_docs])
990ffab5952Smrg]) # XORG_ENABLE_DEVEL_DOCS
991ffab5952Smrg
992ffab5952Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
993ffab5952Smrg# ----------------
994ffab5952Smrg# Minimum version: 1.6.0
995ffab5952Smrg#
996ffab5952Smrg# This macro enables a builder to skip all functional specification targets.
997ffab5952Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
998ffab5952Smrg# maximum flexibilty in controlling documentation building.
999ffab5952Smrg# Refer to:
1000ffab5952Smrg# XORG_WITH_XMLTO         --with-xmlto
1001ffab5952Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
1002ffab5952Smrg# XORG_WITH_DOXYGEN       --with-doxygen
1003ffab5952Smrg# XORG_WITH_FOP           --with-fop
1004ffab5952Smrg# XORG_WITH_GROFF         --with-groff
1005ffab5952Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
1006ffab5952Smrg#
1007ffab5952Smrg# Interface to module:
1008ffab5952Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
1009ffab5952Smrg# --enable-specs:	'yes' user instructs the module to generate specs
1010ffab5952Smrg#			'no' user instructs the module not to generate specs
1011ffab5952Smrg# parm1:		specify the default value, yes or no.
1012ffab5952Smrg#
1013ffab5952SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
1014ffab5952Smrgm4_define([spec_default], m4_default([$1], [yes]))
1015ffab5952SmrgAC_ARG_ENABLE(specs,
1016ffab5952Smrg	AS_HELP_STRING([--enable-specs],
1017ffab5952Smrg	   [Enable building the specs (default: ]spec_default[)]),
1018ffab5952Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
1019ffab5952Smrgm4_undefine([spec_default])
1020ffab5952SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
1021ffab5952SmrgAC_MSG_CHECKING([whether to build functional specifications])
1022ffab5952SmrgAC_MSG_RESULT([$build_specs])
1023ffab5952Smrg]) # XORG_ENABLE_SPECS
1024ffab5952Smrg
102562044635Smrg# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
102662044635Smrg# ----------------------------------------------
102762044635Smrg# Minimum version: 1.13.0
102862044635Smrg#
102962044635Smrg# This macro enables a builder to enable/disable unit testing
103062044635Smrg# It makes no assumption about the test cases implementation
103162044635Smrg# Test cases may or may not use Automake "Support for test suites"
103262044635Smrg# They may or may not use the software utility library GLib
103362044635Smrg#
103462044635Smrg# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
103562044635Smrg# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
103662044635Smrg# The variable enable_unit_tests is used by other macros in this file.
103762044635Smrg#
103862044635Smrg# Interface to module:
103962044635Smrg# ENABLE_UNIT_TESTS:	used in makefiles to conditionally build tests
104062044635Smrg# enable_unit_tests:    used in configure.ac for additional configuration
104162044635Smrg# --enable-unit-tests:	'yes' user instructs the module to build tests
104262044635Smrg#			'no' user instructs the module not to build tests
104362044635Smrg# parm1:		specify the default value, yes or no.
104462044635Smrg#
104562044635SmrgAC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
104662044635SmrgAC_BEFORE([$0], [XORG_WITH_GLIB])
104762044635SmrgAC_BEFORE([$0], [XORG_LD_WRAP])
104862044635Smrgm4_define([_defopt], m4_default([$1], [auto]))
104962044635SmrgAC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
105062044635Smrg	[Enable building unit test cases (default: ]_defopt[)]),
105162044635Smrg	[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
105262044635Smrgm4_undefine([_defopt])
105362044635SmrgAM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
105462044635SmrgAC_MSG_CHECKING([whether to build unit test cases])
105562044635SmrgAC_MSG_RESULT([$enable_unit_tests])
105662044635Smrg]) # XORG_ENABLE_UNIT_TESTS
105762044635Smrg
105862044635Smrg# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
105962044635Smrg# ----------------------------------------
106062044635Smrg# Minimum version: 1.13.0
106162044635Smrg#
106262044635Smrg# GLib is a library which provides advanced data structures and functions.
106362044635Smrg# This macro enables a module to test for the presence of Glib.
106462044635Smrg#
106562044635Smrg# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
106662044635Smrg# Otherwise the value of $enable_unit_tests is blank.
106762044635Smrg#
106862044635Smrg# Interface to module:
106962044635Smrg# HAVE_GLIB: used in makefiles to conditionally build targets
107062044635Smrg# with_glib: used in configure.ac to know if GLib has been found
107162044635Smrg# --with-glib:	'yes' user instructs the module to use glib
107262044635Smrg#		'no' user instructs the module not to use glib
107362044635Smrg#
107462044635SmrgAC_DEFUN([XORG_WITH_GLIB],[
107562044635SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
107662044635Smrgm4_define([_defopt], m4_default([$2], [auto]))
107762044635SmrgAC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
107862044635Smrg	[Use GLib library for unit testing (default: ]_defopt[)]),
107962044635Smrg	[with_glib=$withval], [with_glib=]_defopt)
108062044635Smrgm4_undefine([_defopt])
108162044635Smrg
108262044635Smrghave_glib=no
108362044635Smrg# Do not probe GLib if user explicitly disabled unit testing
108462044635Smrgif test "x$enable_unit_tests" != x"no"; then
108562044635Smrg  # Do not probe GLib if user explicitly disabled it
108662044635Smrg  if test "x$with_glib" != x"no"; then
108762044635Smrg    m4_ifval(
108862044635Smrg      [$1],
108962044635Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
109062044635Smrg      [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
109162044635Smrg    )
109262044635Smrg  fi
109362044635Smrgfi
109462044635Smrg
109562044635Smrg# Not having GLib when unit testing has been explicitly requested is an error
109662044635Smrgif test "x$enable_unit_tests" = x"yes"; then
109762044635Smrg  if test "x$have_glib" = x"no"; then
109862044635Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
109962044635Smrg  fi
110062044635Smrgfi
110162044635Smrg
110262044635Smrg# Having unit testing disabled when GLib has been explicitly requested is an error
110362044635Smrgif test "x$enable_unit_tests" = x"no"; then
110462044635Smrg  if test "x$with_glib" = x"yes"; then
110562044635Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
110662044635Smrg  fi
110762044635Smrgfi
110862044635Smrg
110962044635Smrg# Not having GLib when it has been explicitly requested is an error
111062044635Smrgif test "x$with_glib" = x"yes"; then
111162044635Smrg  if test "x$have_glib" = x"no"; then
111262044635Smrg    AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
111362044635Smrg  fi
111462044635Smrgfi
111562044635Smrg
111662044635SmrgAM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
111762044635Smrg]) # XORG_WITH_GLIB
111862044635Smrg
111962044635Smrg# XORG_LD_WRAP
112062044635Smrg# ------------
112162044635Smrg# Minimum version: 1.13.0
112262044635Smrg#
112362044635Smrg# Check if linker supports -wrap, passed via compiler flags
112462044635Smrg#
112562044635Smrg# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
112662044635Smrg# Otherwise the value of $enable_unit_tests is blank.
112762044635Smrg#
112862044635SmrgAC_DEFUN([XORG_LD_WRAP],[
112962044635SmrgXORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no])
113062044635Smrg# Not having ld wrap when unit testing has been explicitly requested is an error
113162044635Smrgif test "x$enable_unit_tests" = x"yes"; then
113262044635Smrg  if test "x$have_ld_wrap" = x"no"; then
113362044635Smrg    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
113462044635Smrg  fi
113562044635Smrgfi
113662044635SmrgAM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
113762044635Smrg#
113862044635Smrg]) # XORG_LD_WRAP
113962044635Smrg
114062044635Smrg# XORG_CHECK_LINKER_FLAGS
114162044635Smrg# -----------------------
114262044635Smrg# SYNOPSIS
114362044635Smrg#
114462044635Smrg#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE])
114562044635Smrg#
114662044635Smrg# DESCRIPTION
114762044635Smrg#
114862044635Smrg#   Check whether the given linker FLAGS work with the current language's
114962044635Smrg#   linker, or whether they give an error.
115062044635Smrg#
115162044635Smrg#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
115262044635Smrg#   success/failure.
115362044635Smrg#
115462044635Smrg#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
115562044635Smrg#
115662044635Smrg# LICENSE
115762044635Smrg#
115862044635Smrg#   Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
115962044635Smrg#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
116062044635Smrg#   Copyright (c) 2009 Matteo Frigo
116162044635Smrg#
116262044635Smrg#   This program is free software: you can redistribute it and/or modify it
116362044635Smrg#   under the terms of the GNU General Public License as published by the
116462044635Smrg#   Free Software Foundation, either version 3 of the License, or (at your
116562044635Smrg#   option) any later version.
116662044635Smrg#
116762044635Smrg#   This program is distributed in the hope that it will be useful, but
116862044635Smrg#   WITHOUT ANY WARRANTY; without even the implied warranty of
116962044635Smrg#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
117062044635Smrg#   Public License for more details.
117162044635Smrg#
117262044635Smrg#   You should have received a copy of the GNU General Public License along
117362044635Smrg#   with this program. If not, see <http://www.gnu.org/licenses/>.
117462044635Smrg#
117562044635Smrg#   As a special exception, the respective Autoconf Macro's copyright owner
117662044635Smrg#   gives unlimited permission to copy, distribute and modify the configure
117762044635Smrg#   scripts that are the output of Autoconf when processing the Macro. You
117862044635Smrg#   need not follow the terms of the GNU General Public License when using
117962044635Smrg#   or distributing such scripts, even though portions of the text of the
118062044635Smrg#   Macro appear in them. The GNU General Public License (GPL) does govern
118162044635Smrg#   all other use of the material that constitutes the Autoconf Macro.
118262044635Smrg#
118362044635Smrg#   This special exception to the GPL applies to versions of the Autoconf
118462044635Smrg#   Macro released by the Autoconf Archive. When you make and distribute a
118562044635Smrg#   modified version of the Autoconf Macro, you may extend this special
118662044635Smrg#   exception to the GPL to apply to your modified version as well.#
118762044635SmrgAC_DEFUN([XORG_CHECK_LINKER_FLAGS],
118862044635Smrg[AC_MSG_CHECKING([whether the linker accepts $1])
118962044635Smrgdnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
119062044635SmrgAS_LITERAL_IF([$1],
119162044635Smrg  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
119262044635Smrg      ax_save_FLAGS=$LDFLAGS
119362044635Smrg      LDFLAGS="$1"
119462044635Smrg      AC_LINK_IFELSE([AC_LANG_PROGRAM()],
119562044635Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
119662044635Smrg        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
119762044635Smrg      LDFLAGS=$ax_save_FLAGS])],
119862044635Smrg  [ax_save_FLAGS=$LDFLAGS
119962044635Smrg   LDFLAGS="$1"
120062044635Smrg   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
120162044635Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
120262044635Smrg     eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
120362044635Smrg   LDFLAGS=$ax_save_FLAGS])
120462044635Smrgeval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
120562044635SmrgAC_MSG_RESULT($xorg_check_linker_flags)
120662044635Smrgif test "x$xorg_check_linker_flags" = xyes; then
120762044635Smrg	m4_default([$2], :)
120862044635Smrgelse
120962044635Smrg	m4_default([$3], :)
121062044635Smrgfi
121162044635Smrg]) # XORG_CHECK_LINKER_FLAGS
121262044635Smrg
1213ffab5952Smrg# XORG_CHECK_MALLOC_ZERO
1214ffab5952Smrg# ----------------------
1215ffab5952Smrg# Minimum version: 1.0.0
1216ffab5952Smrg#
1217ffab5952Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
1218ffab5952Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
1219ffab5952Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
1220ffab5952SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
1221ffab5952SmrgAC_ARG_ENABLE(malloc0returnsnull,
1222ffab5952Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
1223ffab5952Smrg		       [malloc(0) returns NULL (default: auto)]),
1224ffab5952Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
1225ffab5952Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
1226ffab5952Smrg
1227ffab5952SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
1228ffab5952Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
122962044635Smrg	AC_RUN_IFELSE([AC_LANG_PROGRAM([
123062044635Smrg#include <stdlib.h>
123162044635Smrg],[
1232ffab5952Smrg    char *m0, *r0, *c0, *p;
1233ffab5952Smrg    m0 = malloc(0);
1234ffab5952Smrg    p = malloc(10);
1235ffab5952Smrg    r0 = realloc(p,0);
123662044635Smrg    c0 = calloc(0,10);
123762044635Smrg    exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
123862044635Smrg])],
1239ffab5952Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
1240ffab5952Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
1241ffab5952Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
1242ffab5952Smrgfi
1243ffab5952SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
1244ffab5952Smrg
1245ffab5952Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
1246ffab5952Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
1247ffab5952Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
1248ffab5952Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
1249ffab5952Smrgelse
1250ffab5952Smrg	MALLOC_ZERO_CFLAGS=""
1251ffab5952Smrg	XMALLOC_ZERO_CFLAGS=""
1252ffab5952Smrg	XTMALLOC_ZERO_CFLAGS=""
1253ffab5952Smrgfi
1254ffab5952Smrg
1255ffab5952SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
1256ffab5952SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
1257ffab5952SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
1258ffab5952Smrg]) # XORG_CHECK_MALLOC_ZERO
1259ffab5952Smrg
1260ffab5952Smrg# XORG_WITH_LINT()
1261ffab5952Smrg# ----------------
1262ffab5952Smrg# Minimum version: 1.1.0
1263ffab5952Smrg#
1264ffab5952Smrg# This macro enables the use of a tool that flags some suspicious and
1265ffab5952Smrg# non-portable constructs (likely to be bugs) in C language source code.
1266ffab5952Smrg# It will attempt to locate the tool and use appropriate options.
1267ffab5952Smrg# There are various lint type tools on different platforms.
1268ffab5952Smrg#
1269ffab5952Smrg# Interface to module:
1270ffab5952Smrg# LINT:		returns the path to the tool found on the platform
1271ffab5952Smrg#		or the value set to LINT on the configure cmd line
1272ffab5952Smrg#		also an Automake conditional
1273ffab5952Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
1274ffab5952Smrg#
1275ffab5952Smrg# --with-lint:	'yes' user instructs the module to use lint
1276ffab5952Smrg#		'no' user instructs the module not to use lint (default)
1277ffab5952Smrg#
1278ffab5952Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
1279ffab5952Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
1280ffab5952Smrg#
1281ffab5952SmrgAC_DEFUN([XORG_WITH_LINT],[
1282ffab5952Smrg
1283ffab5952SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
1284ffab5952SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
1285ffab5952SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
1286ffab5952Smrg		[Use a lint-style source code checker (default: disabled)])],
1287ffab5952Smrg		[use_lint=$withval], [use_lint=no])
1288ffab5952Smrg
1289ffab5952Smrg# Obtain platform specific info like program name and options
1290ffab5952Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
1291ffab5952Smrgcase $host_os in
1292ffab5952Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
1293ffab5952Smrg	lint_name=splint
1294ffab5952Smrg	lint_options="-badflag"
1295ffab5952Smrg	;;
1296ffab5952Smrg  *freebsd* | *netbsd*)
1297ffab5952Smrg	lint_name=lint
1298ffab5952Smrg	lint_options="-u -b"
1299ffab5952Smrg	;;
1300ffab5952Smrg  *solaris*)
1301ffab5952Smrg	lint_name=lint
1302ffab5952Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
1303ffab5952Smrg	;;
1304ffab5952Smrgesac
1305ffab5952Smrg
1306ffab5952Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
1307ffab5952Smrgif test "x$use_lint" = x"yes" ; then
1308ffab5952Smrg   AC_PATH_PROG([LINT], [$lint_name])
1309ffab5952Smrg   if test "x$LINT" = "x"; then
1310ffab5952Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
1311ffab5952Smrg   fi
1312ffab5952Smrgelif test "x$use_lint" = x"no" ; then
1313ffab5952Smrg   if test "x$LINT" != "x"; then
1314ffab5952Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
1315ffab5952Smrg   fi
1316ffab5952Smrgelse
1317ffab5952Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
1318ffab5952Smrgfi
1319ffab5952Smrg
1320ffab5952Smrg# User supplied flags override default flags
1321ffab5952Smrgif test "x$LINT_FLAGS" != "x"; then
1322ffab5952Smrg   lint_options=$LINT_FLAGS
1323ffab5952Smrgfi
1324ffab5952Smrg
1325ffab5952SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
1326ffab5952SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1327ffab5952Smrg
1328ffab5952Smrg]) # XORG_WITH_LINT
1329ffab5952Smrg
1330ffab5952Smrg# XORG_LINT_LIBRARY(LIBNAME)
1331ffab5952Smrg# --------------------------
1332ffab5952Smrg# Minimum version: 1.1.0
1333ffab5952Smrg#
1334ffab5952Smrg# Sets up flags for building lint libraries for checking programs that call
1335ffab5952Smrg# functions in the library.
1336ffab5952Smrg#
1337ffab5952Smrg# Interface to module:
1338ffab5952Smrg# LINTLIB		- Automake variable with the name of lint library file to make
1339ffab5952Smrg# MAKE_LINT_LIB		- Automake conditional
1340ffab5952Smrg#
1341ffab5952Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
1342ffab5952Smrg#			  - 'no' user instructs the module not to create a lint library (default)
1343ffab5952Smrg
1344ffab5952SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
1345ffab5952SmrgAC_REQUIRE([XORG_WITH_LINT])
1346ffab5952SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
1347ffab5952Smrg	[Create lint library (default: disabled)])],
1348ffab5952Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
1349ffab5952Smrg
1350ffab5952Smrgif test "x$make_lint_lib" = x"yes" ; then
1351ffab5952Smrg   LINTLIB=llib-l$1.ln
1352ffab5952Smrg   if test "x$LINT" = "x"; then
1353ffab5952Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
1354ffab5952Smrg   fi
1355ffab5952Smrgelif test "x$make_lint_lib" != x"no" ; then
1356ffab5952Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
1357ffab5952Smrgfi
1358ffab5952Smrg
1359ffab5952SmrgAC_SUBST(LINTLIB)
1360ffab5952SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
1361ffab5952Smrg
1362ffab5952Smrg]) # XORG_LINT_LIBRARY
1363ffab5952Smrg
136462044635Smrg# XORG_COMPILER_BRAND
136562044635Smrg# -------------------
136662044635Smrg# Minimum version: 1.14.0
136762044635Smrg#
136862044635Smrg# Checks for various brands of compilers and sets flags as appropriate:
136962044635Smrg#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
137062044635Smrg#   clang compiler - sets CLANGCC to "yes"
137162044635Smrg#   Intel compiler - sets INTELCC to "yes"
137262044635Smrg#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
137362044635Smrg#
137462044635SmrgAC_DEFUN([XORG_COMPILER_BRAND], [
137562044635SmrgAC_REQUIRE([AC_PROG_CC_C99])
137662044635SmrgAC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
137762044635SmrgAC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
137862044635SmrgAC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
137962044635Smrg]) # XORG_COMPILER_BRAND
138062044635Smrg
1381ffab5952Smrg# XORG_CWARNFLAGS
1382ffab5952Smrg# ---------------
1383ffab5952Smrg# Minimum version: 1.2.0
1384ffab5952Smrg#
1385ffab5952Smrg# Defines CWARNFLAGS to enable C compiler warnings.
1386ffab5952Smrg#
1387ffab5952SmrgAC_DEFUN([XORG_CWARNFLAGS], [
1388ffab5952SmrgAC_REQUIRE([AC_PROG_CC_C99])
138962044635SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
1390ffab5952Smrgif  test "x$GCC" = xyes ; then
1391ffab5952Smrg    CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
1392ffab5952Smrg-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
1393ffab5952Smrg-Wbad-function-cast -Wformat=2"
1394ffab5952Smrg    case `$CC -dumpversion` in
1395ffab5952Smrg    3.4.* | 4.*)
1396ffab5952Smrg	CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
1397ffab5952Smrg	;;
1398ffab5952Smrg    esac
1399ffab5952Smrgelse
1400ffab5952Smrg    if test "x$SUNCC" = "xyes"; then
1401ffab5952Smrg	CWARNFLAGS="-v"
1402ffab5952Smrg    fi
1403ffab5952Smrgfi
1404ffab5952SmrgAC_SUBST(CWARNFLAGS)
1405ffab5952Smrg]) # XORG_CWARNFLAGS
1406ffab5952Smrg
1407ffab5952Smrg# XORG_STRICT_OPTION
1408ffab5952Smrg# -----------------------
1409ffab5952Smrg# Minimum version: 1.3.0
1410ffab5952Smrg#
141162044635Smrg# Add configure option to enable strict compilation flags, such as treating
141262044635Smrg# warnings as fatal errors.
141362044635Smrg# If --enable-strict-compilation is passed to configure, adds strict flags to
141462044635Smrg# $CWARNFLAGS.
141562044635Smrg#
141662044635Smrg# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
141762044635Smrg# when strict compilation is unconditionally desired.
1418ffab5952SmrgAC_DEFUN([XORG_STRICT_OPTION], [
1419ffab5952Smrg# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
1420ffab5952SmrgAC_REQUIRE([AC_PROG_CC_C99])
142162044635SmrgAC_REQUIRE([XORG_COMPILER_BRAND])
1422ffab5952SmrgAC_REQUIRE([XORG_CWARNFLAGS])
1423ffab5952Smrg
1424ffab5952SmrgAC_ARG_ENABLE(strict-compilation,
1425ffab5952Smrg			  AS_HELP_STRING([--enable-strict-compilation],
1426ffab5952Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
1427ffab5952Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
142862044635Smrgif test "x$GCC" = xyes ; then
142962044635Smrg    STRICT_CFLAGS="-pedantic -Werror"
143062044635Smrg    # Add -Werror=attributes if supported (gcc 4.2 & later)
143162044635Smrg    AC_MSG_CHECKING([if $CC supports -Werror=attributes])
143262044635Smrg    save_CFLAGS="$CFLAGS"
143362044635Smrg    CFLAGS="$CFLAGS $STRICT_CFLAGS -Werror=attributes"
143462044635Smrg    AC_COMPILE_IFELSE([AC_LANG_SOURCE([return 0;])],
143562044635Smrg		      [STRICT_CFLAGS="$STRICT_CFLAGS -Werror=attributes"
143662044635Smrg		       AC_MSG_RESULT([yes])],
143762044635Smrg		      [AC_MSG_RESULT([no])])
143862044635Smrg    CFLAGS="$save_CFLAGS"
143962044635Smrgelif test "x$SUNCC" = "xyes"; then
144062044635Smrg    STRICT_CFLAGS="-errwarn"
144162044635Smrgelif test "x$INTELCC" = "xyes"; then
144262044635Smrg    STRICT_CFLAGS="-Werror"
144362044635Smrgfi
1444ffab5952Smrgif test "x$STRICT_COMPILE" = "xyes"; then
144562044635Smrg    CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
1446ffab5952Smrgfi
144762044635SmrgAC_SUBST([STRICT_CFLAGS])
1448ffab5952SmrgAC_SUBST([CWARNFLAGS])
1449ffab5952Smrg]) # XORG_STRICT_OPTION
1450ffab5952Smrg
1451ffab5952Smrg# XORG_DEFAULT_OPTIONS
1452ffab5952Smrg# --------------------
1453ffab5952Smrg# Minimum version: 1.3.0
1454ffab5952Smrg#
1455ffab5952Smrg# Defines default options for X.Org modules.
1456ffab5952Smrg#
1457ffab5952SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
1458ffab5952SmrgAC_REQUIRE([AC_PROG_INSTALL])
1459ffab5952SmrgXORG_CWARNFLAGS
1460ffab5952SmrgXORG_STRICT_OPTION
1461ffab5952SmrgXORG_RELEASE_VERSION
1462ffab5952SmrgXORG_CHANGELOG
1463ffab5952SmrgXORG_INSTALL
1464ffab5952SmrgXORG_MANPAGE_SECTIONS
1465ffab5952Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
1466ffab5952Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
1467ffab5952Smrg]) # XORG_DEFAULT_OPTIONS
1468ffab5952Smrg
1469ffab5952Smrg# XORG_INSTALL()
1470ffab5952Smrg# ----------------
1471ffab5952Smrg# Minimum version: 1.4.0
1472ffab5952Smrg#
1473ffab5952Smrg# Defines the variable INSTALL_CMD as the command to copy
1474ffab5952Smrg# INSTALL from $prefix/share/util-macros.
1475ffab5952Smrg#
1476ffab5952SmrgAC_DEFUN([XORG_INSTALL], [
1477ffab5952SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
1478ffab5952Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
1479ffab5952SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
1480ffab5952Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
1481ffab5952Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
1482ffab5952Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
1483ffab5952SmrgAC_SUBST([INSTALL_CMD])
1484ffab5952Smrg]) # XORG_INSTALL
1485