xorg-macros.m4.in revision ffab5952
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])
67ffab5952SmrgAC_LANG_CONFTEST([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])
85ffab5952SmrgAC_LANG_CONFTEST([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
435ffab5952Smrg# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
436ffab5952Smrg# ----------------
437ffab5952Smrg# Minimum version: 1.5.0
438ffab5952Smrg# Minimum version for optional DEFAULT argument: 1.11.0
439ffab5952Smrg#
440ffab5952Smrg# Documentation tools are not always available on all platforms and sometimes
441ffab5952Smrg# not at the appropriate level. This macro enables a module to test for the
442ffab5952Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
443ffab5952Smrg# the --with-asciidoc option, it allows maximum flexibilty in making decisions
444ffab5952Smrg# as whether or not to use the asciidoc package. When DEFAULT is not specified,
445ffab5952Smrg# --with-asciidoc assumes 'auto'.
446ffab5952Smrg#
447ffab5952Smrg# Interface to module:
448ffab5952Smrg# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation
449ffab5952Smrg# ASCIIDOC:	 returns the path of the asciidoc program found
450ffab5952Smrg#		 returns the path set by the user in the environment
451ffab5952Smrg# --with-asciidoc: 'yes' user instructs the module to use asciidoc
452ffab5952Smrg#		  'no' user instructs the module not to use asciidoc
453ffab5952Smrg#
454ffab5952Smrg# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path.
455ffab5952Smrg#
456ffab5952SmrgAC_DEFUN([XORG_WITH_ASCIIDOC],[
457ffab5952SmrgAC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
458ffab5952Smrgm4_define([_defopt], m4_default([$2], [auto]))
459ffab5952SmrgAC_ARG_WITH(asciidoc,
460ffab5952Smrg	AS_HELP_STRING([--with-asciidoc],
461ffab5952Smrg	   [Use asciidoc to regenerate documentation (default: ]_defopt[)]),
462ffab5952Smrg	   [use_asciidoc=$withval], [use_asciidoc=]_defopt)
463ffab5952Smrgm4_undefine([_defopt])
464ffab5952Smrg
465ffab5952Smrgif test "x$use_asciidoc" = x"auto"; then
466ffab5952Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
467ffab5952Smrg   if test "x$ASCIIDOC" = "x"; then
468ffab5952Smrg        AC_MSG_WARN([asciidoc not found - documentation targets will be skipped])
469ffab5952Smrg	have_asciidoc=no
470ffab5952Smrg   else
471ffab5952Smrg        have_asciidoc=yes
472ffab5952Smrg   fi
473ffab5952Smrgelif test "x$use_asciidoc" = x"yes" ; then
474ffab5952Smrg   AC_PATH_PROG([ASCIIDOC], [asciidoc])
475ffab5952Smrg   if test "x$ASCIIDOC" = "x"; then
476ffab5952Smrg        AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH])
477ffab5952Smrg   fi
478ffab5952Smrg   have_asciidoc=yes
479ffab5952Smrgelif test "x$use_asciidoc" = x"no" ; then
480ffab5952Smrg   if test "x$ASCIIDOC" != "x"; then
481ffab5952Smrg      AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified])
482ffab5952Smrg   fi
483ffab5952Smrg   have_asciidoc=no
484ffab5952Smrgelse
485ffab5952Smrg   AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
486ffab5952Smrgfi
487ffab5952Smrgm4_ifval([$1],
488ffab5952Smrg[if test "$have_asciidoc" = yes; then
489ffab5952Smrg    # scrape the asciidoc version
490ffab5952Smrg    AC_MSG_CHECKING([the asciidoc version])
491ffab5952Smrg    asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
492ffab5952Smrg    AC_MSG_RESULT([$asciidoc_version])
493ffab5952Smrg    AS_VERSION_COMPARE([$asciidoc_version], [$1],
494ffab5952Smrg        [if test "x$use_asciidoc" = xauto; then
495ffab5952Smrg            AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
496ffab5952Smrg            have_asciidoc=no
497ffab5952Smrg        else
498ffab5952Smrg            AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
499ffab5952Smrg        fi])
500ffab5952Smrgfi])
501ffab5952SmrgAM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
502ffab5952Smrg]) # XORG_WITH_ASCIIDOC
503ffab5952Smrg
504ffab5952Smrg# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
505ffab5952Smrg# --------------------------------
506ffab5952Smrg# Minimum version: 1.5.0
507ffab5952Smrg# Minimum version for optional DEFAULT argument: 1.11.0
508ffab5952Smrg#
509ffab5952Smrg# Documentation tools are not always available on all platforms and sometimes
510ffab5952Smrg# not at the appropriate level. This macro enables a module to test for the
511ffab5952Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
512ffab5952Smrg# the --with-doxygen option, it allows maximum flexibilty in making decisions
513ffab5952Smrg# as whether or not to use the doxygen package. When DEFAULT is not specified,
514ffab5952Smrg# --with-doxygen assumes 'auto'.
515ffab5952Smrg#
516ffab5952Smrg# Interface to module:
517ffab5952Smrg# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation
518ffab5952Smrg# DOXYGEN:	 returns the path of the doxygen program found
519ffab5952Smrg#		 returns the path set by the user in the environment
520ffab5952Smrg# --with-doxygen: 'yes' user instructs the module to use doxygen
521ffab5952Smrg#		  'no' user instructs the module not to use doxygen
522ffab5952Smrg#
523ffab5952Smrg# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path.
524ffab5952Smrg#
525ffab5952SmrgAC_DEFUN([XORG_WITH_DOXYGEN],[
526ffab5952SmrgAC_ARG_VAR([DOXYGEN], [Path to doxygen command])
527ffab5952Smrgm4_define([_defopt], m4_default([$2], [auto]))
528ffab5952SmrgAC_ARG_WITH(doxygen,
529ffab5952Smrg	AS_HELP_STRING([--with-doxygen],
530ffab5952Smrg	   [Use doxygen to regenerate documentation (default: ]_defopt[)]),
531ffab5952Smrg	   [use_doxygen=$withval], [use_doxygen=]_defopt)
532ffab5952Smrgm4_undefine([_defopt])
533ffab5952Smrg
534ffab5952Smrgif test "x$use_doxygen" = x"auto"; then
535ffab5952Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
536ffab5952Smrg   if test "x$DOXYGEN" = "x"; then
537ffab5952Smrg        AC_MSG_WARN([doxygen not found - documentation targets will be skipped])
538ffab5952Smrg	have_doxygen=no
539ffab5952Smrg   else
540ffab5952Smrg        have_doxygen=yes
541ffab5952Smrg   fi
542ffab5952Smrgelif test "x$use_doxygen" = x"yes" ; then
543ffab5952Smrg   AC_PATH_PROG([DOXYGEN], [doxygen])
544ffab5952Smrg   if test "x$DOXYGEN" = "x"; then
545ffab5952Smrg        AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH])
546ffab5952Smrg   fi
547ffab5952Smrg   have_doxygen=yes
548ffab5952Smrgelif test "x$use_doxygen" = x"no" ; then
549ffab5952Smrg   if test "x$DOXYGEN" != "x"; then
550ffab5952Smrg      AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified])
551ffab5952Smrg   fi
552ffab5952Smrg   have_doxygen=no
553ffab5952Smrgelse
554ffab5952Smrg   AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
555ffab5952Smrgfi
556ffab5952Smrgm4_ifval([$1],
557ffab5952Smrg[if test "$have_doxygen" = yes; then
558ffab5952Smrg    # scrape the doxygen version
559ffab5952Smrg    AC_MSG_CHECKING([the doxygen version])
560ffab5952Smrg    doxygen_version=`$DOXYGEN --version 2>/dev/null`
561ffab5952Smrg    AC_MSG_RESULT([$doxygen_version])
562ffab5952Smrg    AS_VERSION_COMPARE([$doxygen_version], [$1],
563ffab5952Smrg        [if test "x$use_doxygen" = xauto; then
564ffab5952Smrg            AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
565ffab5952Smrg            have_doxygen=no
566ffab5952Smrg        else
567ffab5952Smrg            AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
568ffab5952Smrg        fi])
569ffab5952Smrgfi])
570ffab5952SmrgAM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
571ffab5952Smrg]) # XORG_WITH_DOXYGEN
572ffab5952Smrg
573ffab5952Smrg# XORG_WITH_GROFF([DEFAULT])
574ffab5952Smrg# ----------------
575ffab5952Smrg# Minimum version: 1.6.0
576ffab5952Smrg# Minimum version for optional DEFAULT argument: 1.11.0
577ffab5952Smrg#
578ffab5952Smrg# Documentation tools are not always available on all platforms and sometimes
579ffab5952Smrg# not at the appropriate level. This macro enables a module to test for the
580ffab5952Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
581ffab5952Smrg# the --with-groff option, it allows maximum flexibilty in making decisions
582ffab5952Smrg# as whether or not to use the groff package. When DEFAULT is not specified,
583ffab5952Smrg# --with-groff assumes 'auto'.
584ffab5952Smrg#
585ffab5952Smrg# Interface to module:
586ffab5952Smrg# HAVE_GROFF:	 used in makefiles to conditionally generate documentation
587ffab5952Smrg# HAVE_GROFF_MM: the memorandum macros (-mm) package
588ffab5952Smrg# HAVE_GROFF_MS: the -ms macros package
589ffab5952Smrg# GROFF:	 returns the path of the groff program found
590ffab5952Smrg#		 returns the path set by the user in the environment
591ffab5952Smrg# --with-groff:	 'yes' user instructs the module to use groff
592ffab5952Smrg#		 'no' user instructs the module not to use groff
593ffab5952Smrg#
594ffab5952Smrg# Added in version 1.9.0:
595ffab5952Smrg# HAVE_GROFF_HTML: groff has dependencies to output HTML format:
596ffab5952Smrg#		   pnmcut pnmcrop pnmtopng pnmtops from the netpbm package.
597ffab5952Smrg#		   psselect from the psutils package.
598ffab5952Smrg#		   the ghostcript package. Refer to the grohtml man pages
599ffab5952Smrg#
600ffab5952Smrg# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
601ffab5952Smrg#
602ffab5952Smrg# OS and distros often splits groff in a basic and full package, the former
603ffab5952Smrg# having the groff program and the later having devices, fonts and macros
604ffab5952Smrg# Checking for the groff executable is not enough.
605ffab5952Smrg#
606ffab5952Smrg# If macros are missing, we cannot assume that groff is useless, so we don't
607ffab5952Smrg# unset HAVE_GROFF or GROFF env variables.
608ffab5952Smrg# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
609ffab5952Smrg#
610ffab5952SmrgAC_DEFUN([XORG_WITH_GROFF],[
611ffab5952SmrgAC_ARG_VAR([GROFF], [Path to groff command])
612ffab5952Smrgm4_define([_defopt], m4_default([$1], [auto]))
613ffab5952SmrgAC_ARG_WITH(groff,
614ffab5952Smrg	AS_HELP_STRING([--with-groff],
615ffab5952Smrg	   [Use groff to regenerate documentation (default: ]_defopt[)]),
616ffab5952Smrg	   [use_groff=$withval], [use_groff=]_defopt)
617ffab5952Smrgm4_undefine([_defopt])
618ffab5952Smrg
619ffab5952Smrgif test "x$use_groff" = x"auto"; then
620ffab5952Smrg   AC_PATH_PROG([GROFF], [groff])
621ffab5952Smrg   if test "x$GROFF" = "x"; then
622ffab5952Smrg        AC_MSG_WARN([groff not found - documentation targets will be skipped])
623ffab5952Smrg	have_groff=no
624ffab5952Smrg   else
625ffab5952Smrg        have_groff=yes
626ffab5952Smrg   fi
627ffab5952Smrgelif test "x$use_groff" = x"yes" ; then
628ffab5952Smrg   AC_PATH_PROG([GROFF], [groff])
629ffab5952Smrg   if test "x$GROFF" = "x"; then
630ffab5952Smrg        AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
631ffab5952Smrg   fi
632ffab5952Smrg   have_groff=yes
633ffab5952Smrgelif test "x$use_groff" = x"no" ; then
634ffab5952Smrg   if test "x$GROFF" != "x"; then
635ffab5952Smrg      AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
636ffab5952Smrg   fi
637ffab5952Smrg   have_groff=no
638ffab5952Smrgelse
639ffab5952Smrg   AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
640ffab5952Smrgfi
641ffab5952Smrg
642ffab5952Smrg# We have groff, test for the presence of the macro packages
643ffab5952Smrgif test "x$have_groff" = x"yes"; then
644ffab5952Smrg    AC_MSG_CHECKING([for ${GROFF} -ms macros])
645ffab5952Smrg    if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
646ffab5952Smrg        groff_ms_works=yes
647ffab5952Smrg    else
648ffab5952Smrg        groff_ms_works=no
649ffab5952Smrg    fi
650ffab5952Smrg    AC_MSG_RESULT([$groff_ms_works])
651ffab5952Smrg    AC_MSG_CHECKING([for ${GROFF} -mm macros])
652ffab5952Smrg    if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
653ffab5952Smrg        groff_mm_works=yes
654ffab5952Smrg    else
655ffab5952Smrg        groff_mm_works=no
656ffab5952Smrg    fi
657ffab5952Smrg    AC_MSG_RESULT([$groff_mm_works])
658ffab5952Smrgfi
659ffab5952Smrg
660ffab5952Smrg# We have groff, test for HTML dependencies, one command per package
661ffab5952Smrgif test "x$have_groff" = x"yes"; then
662ffab5952Smrg   AC_PATH_PROGS(GS_PATH, [gs gswin32c])
663ffab5952Smrg   AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng])
664ffab5952Smrg   AC_PATH_PROG(PSSELECT_PATH, [psselect])
665ffab5952Smrg   if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then
666ffab5952Smrg      have_groff_html=yes
667ffab5952Smrg   else
668ffab5952Smrg      have_groff_html=no
669ffab5952Smrg      AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages])
670ffab5952Smrg   fi
671ffab5952Smrgfi
672ffab5952Smrg
673ffab5952Smrg# Set Automake conditionals for Makefiles
674ffab5952SmrgAM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
675ffab5952SmrgAM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
676ffab5952SmrgAM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
677ffab5952SmrgAM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
678ffab5952Smrg]) # XORG_WITH_GROFF
679ffab5952Smrg
680ffab5952Smrg# XORG_WITH_FOP([DEFAULT])
681ffab5952Smrg# ----------------
682ffab5952Smrg# Minimum version: 1.6.0
683ffab5952Smrg# Minimum version for optional DEFAULT argument: 1.11.0
684ffab5952Smrg#
685ffab5952Smrg# Documentation tools are not always available on all platforms and sometimes
686ffab5952Smrg# not at the appropriate level. This macro enables a module to test for the
687ffab5952Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
688ffab5952Smrg# the --with-fop option, it allows maximum flexibilty in making decisions
689ffab5952Smrg# as whether or not to use the fop package. When DEFAULT is not specified,
690ffab5952Smrg# --with-fop assumes 'auto'.
691ffab5952Smrg#
692ffab5952Smrg# Interface to module:
693ffab5952Smrg# HAVE_FOP: 	used in makefiles to conditionally generate documentation
694ffab5952Smrg# FOP:	 	returns the path of the fop program found
695ffab5952Smrg#		returns the path set by the user in the environment
696ffab5952Smrg# --with-fop: 	'yes' user instructs the module to use fop
697ffab5952Smrg#		'no' user instructs the module not to use fop
698ffab5952Smrg#
699ffab5952Smrg# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
700ffab5952Smrg#
701ffab5952SmrgAC_DEFUN([XORG_WITH_FOP],[
702ffab5952SmrgAC_ARG_VAR([FOP], [Path to fop command])
703ffab5952Smrgm4_define([_defopt], m4_default([$1], [auto]))
704ffab5952SmrgAC_ARG_WITH(fop,
705ffab5952Smrg	AS_HELP_STRING([--with-fop],
706ffab5952Smrg	   [Use fop to regenerate documentation (default: ]_defopt[)]),
707ffab5952Smrg	   [use_fop=$withval], [use_fop=]_defopt)
708ffab5952Smrgm4_undefine([_defopt])
709ffab5952Smrg
710ffab5952Smrgif test "x$use_fop" = x"auto"; then
711ffab5952Smrg   AC_PATH_PROG([FOP], [fop])
712ffab5952Smrg   if test "x$FOP" = "x"; then
713ffab5952Smrg        AC_MSG_WARN([fop not found - documentation targets will be skipped])
714ffab5952Smrg	have_fop=no
715ffab5952Smrg   else
716ffab5952Smrg        have_fop=yes
717ffab5952Smrg   fi
718ffab5952Smrgelif test "x$use_fop" = x"yes" ; then
719ffab5952Smrg   AC_PATH_PROG([FOP], [fop])
720ffab5952Smrg   if test "x$FOP" = "x"; then
721ffab5952Smrg        AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
722ffab5952Smrg   fi
723ffab5952Smrg   have_fop=yes
724ffab5952Smrgelif test "x$use_fop" = x"no" ; then
725ffab5952Smrg   if test "x$FOP" != "x"; then
726ffab5952Smrg      AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
727ffab5952Smrg   fi
728ffab5952Smrg   have_fop=no
729ffab5952Smrgelse
730ffab5952Smrg   AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
731ffab5952Smrgfi
732ffab5952SmrgAM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
733ffab5952Smrg]) # XORG_WITH_FOP
734ffab5952Smrg
735ffab5952Smrg# XORG_WITH_PS2PDF([DEFAULT])
736ffab5952Smrg# ----------------
737ffab5952Smrg# Minimum version: 1.6.0
738ffab5952Smrg# Minimum version for optional DEFAULT argument: 1.11.0
739ffab5952Smrg#
740ffab5952Smrg# Documentation tools are not always available on all platforms and sometimes
741ffab5952Smrg# not at the appropriate level. This macro enables a module to test for the
742ffab5952Smrg# presence of the tool and obtain it's path in separate variables. Coupled with
743ffab5952Smrg# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
744ffab5952Smrg# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
745ffab5952Smrg# --with-ps2pdf assumes 'auto'.
746ffab5952Smrg#
747ffab5952Smrg# Interface to module:
748ffab5952Smrg# HAVE_PS2PDF: 	used in makefiles to conditionally generate documentation
749ffab5952Smrg# PS2PDF:	returns the path of the ps2pdf program found
750ffab5952Smrg#		returns the path set by the user in the environment
751ffab5952Smrg# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
752ffab5952Smrg#		 'no' user instructs the module not to use ps2pdf
753ffab5952Smrg#
754ffab5952Smrg# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
755ffab5952Smrg#
756ffab5952SmrgAC_DEFUN([XORG_WITH_PS2PDF],[
757ffab5952SmrgAC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
758ffab5952Smrgm4_define([_defopt], m4_default([$1], [auto]))
759ffab5952SmrgAC_ARG_WITH(ps2pdf,
760ffab5952Smrg	AS_HELP_STRING([--with-ps2pdf],
761ffab5952Smrg	   [Use ps2pdf to regenerate documentation (default: ]_defopt[)]),
762ffab5952Smrg	   [use_ps2pdf=$withval], [use_ps2pdf=]_defopt)
763ffab5952Smrgm4_undefine([_defopt])
764ffab5952Smrg
765ffab5952Smrgif test "x$use_ps2pdf" = x"auto"; then
766ffab5952Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
767ffab5952Smrg   if test "x$PS2PDF" = "x"; then
768ffab5952Smrg        AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
769ffab5952Smrg	have_ps2pdf=no
770ffab5952Smrg   else
771ffab5952Smrg        have_ps2pdf=yes
772ffab5952Smrg   fi
773ffab5952Smrgelif test "x$use_ps2pdf" = x"yes" ; then
774ffab5952Smrg   AC_PATH_PROG([PS2PDF], [ps2pdf])
775ffab5952Smrg   if test "x$PS2PDF" = "x"; then
776ffab5952Smrg        AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
777ffab5952Smrg   fi
778ffab5952Smrg   have_ps2pdf=yes
779ffab5952Smrgelif test "x$use_ps2pdf" = x"no" ; then
780ffab5952Smrg   if test "x$PS2PDF" != "x"; then
781ffab5952Smrg      AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
782ffab5952Smrg   fi
783ffab5952Smrg   have_ps2pdf=no
784ffab5952Smrgelse
785ffab5952Smrg   AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
786ffab5952Smrgfi
787ffab5952SmrgAM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
788ffab5952Smrg]) # XORG_WITH_PS2PDF
789ffab5952Smrg
790ffab5952Smrg# XORG_ENABLE_DOCS (enable_docs=yes)
791ffab5952Smrg# ----------------
792ffab5952Smrg# Minimum version: 1.6.0
793ffab5952Smrg#
794ffab5952Smrg# Documentation tools are not always available on all platforms and sometimes
795ffab5952Smrg# not at the appropriate level. This macro enables a builder to skip all
796ffab5952Smrg# documentation targets except traditional man pages.
797ffab5952Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
798ffab5952Smrg# maximum flexibilty in controlling documentation building.
799ffab5952Smrg# Refer to:
800ffab5952Smrg# XORG_WITH_XMLTO         --with-xmlto
801ffab5952Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
802ffab5952Smrg# XORG_WITH_DOXYGEN       --with-doxygen
803ffab5952Smrg# XORG_WITH_FOP           --with-fop
804ffab5952Smrg# XORG_WITH_GROFF         --with-groff
805ffab5952Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
806ffab5952Smrg#
807ffab5952Smrg# Interface to module:
808ffab5952Smrg# ENABLE_DOCS: 	  used in makefiles to conditionally generate documentation
809ffab5952Smrg# --enable-docs: 'yes' user instructs the module to generate docs
810ffab5952Smrg#		 'no' user instructs the module not to generate docs
811ffab5952Smrg# parm1:	specify the default value, yes or no.
812ffab5952Smrg#
813ffab5952SmrgAC_DEFUN([XORG_ENABLE_DOCS],[
814ffab5952Smrgm4_define([default], m4_default([$1], [yes]))
815ffab5952SmrgAC_ARG_ENABLE(docs,
816ffab5952Smrg	AS_HELP_STRING([--enable-docs],
817ffab5952Smrg	   [Enable building the documentation (default: ]default[)]),
818ffab5952Smrg	   [build_docs=$enableval], [build_docs=]default)
819ffab5952Smrgm4_undefine([default])
820ffab5952SmrgAM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
821ffab5952SmrgAC_MSG_CHECKING([whether to build documentation])
822ffab5952SmrgAC_MSG_RESULT([$build_docs])
823ffab5952Smrg]) # XORG_ENABLE_DOCS
824ffab5952Smrg
825ffab5952Smrg# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
826ffab5952Smrg# ----------------
827ffab5952Smrg# Minimum version: 1.6.0
828ffab5952Smrg#
829ffab5952Smrg# This macro enables a builder to skip all developer documentation.
830ffab5952Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
831ffab5952Smrg# maximum flexibilty in controlling documentation building.
832ffab5952Smrg# Refer to:
833ffab5952Smrg# XORG_WITH_XMLTO         --with-xmlto
834ffab5952Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
835ffab5952Smrg# XORG_WITH_DOXYGEN       --with-doxygen
836ffab5952Smrg# XORG_WITH_FOP           --with-fop
837ffab5952Smrg# XORG_WITH_GROFF         --with-groff
838ffab5952Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
839ffab5952Smrg#
840ffab5952Smrg# Interface to module:
841ffab5952Smrg# ENABLE_DEVEL_DOCS:	used in makefiles to conditionally generate developer docs
842ffab5952Smrg# --enable-devel-docs:	'yes' user instructs the module to generate developer docs
843ffab5952Smrg#			'no' user instructs the module not to generate developer docs
844ffab5952Smrg# parm1:		specify the default value, yes or no.
845ffab5952Smrg#
846ffab5952SmrgAC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
847ffab5952Smrgm4_define([devel_default], m4_default([$1], [yes]))
848ffab5952SmrgAC_ARG_ENABLE(devel-docs,
849ffab5952Smrg	AS_HELP_STRING([--enable-devel-docs],
850ffab5952Smrg	   [Enable building the developer documentation (default: ]devel_default[)]),
851ffab5952Smrg	   [build_devel_docs=$enableval], [build_devel_docs=]devel_default)
852ffab5952Smrgm4_undefine([devel_default])
853ffab5952SmrgAM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
854ffab5952SmrgAC_MSG_CHECKING([whether to build developer documentation])
855ffab5952SmrgAC_MSG_RESULT([$build_devel_docs])
856ffab5952Smrg]) # XORG_ENABLE_DEVEL_DOCS
857ffab5952Smrg
858ffab5952Smrg# XORG_ENABLE_SPECS (enable_specs=yes)
859ffab5952Smrg# ----------------
860ffab5952Smrg# Minimum version: 1.6.0
861ffab5952Smrg#
862ffab5952Smrg# This macro enables a builder to skip all functional specification targets.
863ffab5952Smrg# Combined with the specific tool checking macros XORG_WITH_*, it provides
864ffab5952Smrg# maximum flexibilty in controlling documentation building.
865ffab5952Smrg# Refer to:
866ffab5952Smrg# XORG_WITH_XMLTO         --with-xmlto
867ffab5952Smrg# XORG_WITH_ASCIIDOC      --with-asciidoc
868ffab5952Smrg# XORG_WITH_DOXYGEN       --with-doxygen
869ffab5952Smrg# XORG_WITH_FOP           --with-fop
870ffab5952Smrg# XORG_WITH_GROFF         --with-groff
871ffab5952Smrg# XORG_WITH_PS2PDF        --with-ps2pdf
872ffab5952Smrg#
873ffab5952Smrg# Interface to module:
874ffab5952Smrg# ENABLE_SPECS:		used in makefiles to conditionally generate specs
875ffab5952Smrg# --enable-specs:	'yes' user instructs the module to generate specs
876ffab5952Smrg#			'no' user instructs the module not to generate specs
877ffab5952Smrg# parm1:		specify the default value, yes or no.
878ffab5952Smrg#
879ffab5952SmrgAC_DEFUN([XORG_ENABLE_SPECS],[
880ffab5952Smrgm4_define([spec_default], m4_default([$1], [yes]))
881ffab5952SmrgAC_ARG_ENABLE(specs,
882ffab5952Smrg	AS_HELP_STRING([--enable-specs],
883ffab5952Smrg	   [Enable building the specs (default: ]spec_default[)]),
884ffab5952Smrg	   [build_specs=$enableval], [build_specs=]spec_default)
885ffab5952Smrgm4_undefine([spec_default])
886ffab5952SmrgAM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
887ffab5952SmrgAC_MSG_CHECKING([whether to build functional specifications])
888ffab5952SmrgAC_MSG_RESULT([$build_specs])
889ffab5952Smrg]) # XORG_ENABLE_SPECS
890ffab5952Smrg
891ffab5952Smrg# XORG_CHECK_MALLOC_ZERO
892ffab5952Smrg# ----------------------
893ffab5952Smrg# Minimum version: 1.0.0
894ffab5952Smrg#
895ffab5952Smrg# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
896ffab5952Smrg# malloc(0) returns NULL.  Packages should add one of these cflags to
897ffab5952Smrg# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
898ffab5952SmrgAC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
899ffab5952SmrgAC_ARG_ENABLE(malloc0returnsnull,
900ffab5952Smrg	AS_HELP_STRING([--enable-malloc0returnsnull],
901ffab5952Smrg		       [malloc(0) returns NULL (default: auto)]),
902ffab5952Smrg	[MALLOC_ZERO_RETURNS_NULL=$enableval],
903ffab5952Smrg	[MALLOC_ZERO_RETURNS_NULL=auto])
904ffab5952Smrg
905ffab5952SmrgAC_MSG_CHECKING([whether malloc(0) returns NULL])
906ffab5952Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
907ffab5952Smrg	AC_RUN_IFELSE([
908ffab5952Smrgchar *malloc();
909ffab5952Smrgchar *realloc();
910ffab5952Smrgchar *calloc();
911ffab5952Smrgmain() {
912ffab5952Smrg    char *m0, *r0, *c0, *p;
913ffab5952Smrg    m0 = malloc(0);
914ffab5952Smrg    p = malloc(10);
915ffab5952Smrg    r0 = realloc(p,0);
916ffab5952Smrg    c0 = calloc(0);
917ffab5952Smrg    exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
918ffab5952Smrg}],
919ffab5952Smrg		[MALLOC_ZERO_RETURNS_NULL=yes],
920ffab5952Smrg		[MALLOC_ZERO_RETURNS_NULL=no],
921ffab5952Smrg		[MALLOC_ZERO_RETURNS_NULL=yes])
922ffab5952Smrgfi
923ffab5952SmrgAC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
924ffab5952Smrg
925ffab5952Smrgif test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
926ffab5952Smrg	MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
927ffab5952Smrg	XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
928ffab5952Smrg	XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
929ffab5952Smrgelse
930ffab5952Smrg	MALLOC_ZERO_CFLAGS=""
931ffab5952Smrg	XMALLOC_ZERO_CFLAGS=""
932ffab5952Smrg	XTMALLOC_ZERO_CFLAGS=""
933ffab5952Smrgfi
934ffab5952Smrg
935ffab5952SmrgAC_SUBST([MALLOC_ZERO_CFLAGS])
936ffab5952SmrgAC_SUBST([XMALLOC_ZERO_CFLAGS])
937ffab5952SmrgAC_SUBST([XTMALLOC_ZERO_CFLAGS])
938ffab5952Smrg]) # XORG_CHECK_MALLOC_ZERO
939ffab5952Smrg
940ffab5952Smrg# XORG_WITH_LINT()
941ffab5952Smrg# ----------------
942ffab5952Smrg# Minimum version: 1.1.0
943ffab5952Smrg#
944ffab5952Smrg# This macro enables the use of a tool that flags some suspicious and
945ffab5952Smrg# non-portable constructs (likely to be bugs) in C language source code.
946ffab5952Smrg# It will attempt to locate the tool and use appropriate options.
947ffab5952Smrg# There are various lint type tools on different platforms.
948ffab5952Smrg#
949ffab5952Smrg# Interface to module:
950ffab5952Smrg# LINT:		returns the path to the tool found on the platform
951ffab5952Smrg#		or the value set to LINT on the configure cmd line
952ffab5952Smrg#		also an Automake conditional
953ffab5952Smrg# LINT_FLAGS:	an Automake variable with appropriate flags
954ffab5952Smrg#
955ffab5952Smrg# --with-lint:	'yes' user instructs the module to use lint
956ffab5952Smrg#		'no' user instructs the module not to use lint (default)
957ffab5952Smrg#
958ffab5952Smrg# If the user sets the value of LINT, AC_PATH_PROG skips testing the path.
959ffab5952Smrg# If the user sets the value of LINT_FLAGS, they are used verbatim.
960ffab5952Smrg#
961ffab5952SmrgAC_DEFUN([XORG_WITH_LINT],[
962ffab5952Smrg
963ffab5952SmrgAC_ARG_VAR([LINT], [Path to a lint-style command])
964ffab5952SmrgAC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command])
965ffab5952SmrgAC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint],
966ffab5952Smrg		[Use a lint-style source code checker (default: disabled)])],
967ffab5952Smrg		[use_lint=$withval], [use_lint=no])
968ffab5952Smrg
969ffab5952Smrg# Obtain platform specific info like program name and options
970ffab5952Smrg# The lint program on FreeBSD and NetBSD is different from the one on Solaris
971ffab5952Smrgcase $host_os in
972ffab5952Smrg  *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*)
973ffab5952Smrg	lint_name=splint
974ffab5952Smrg	lint_options="-badflag"
975ffab5952Smrg	;;
976ffab5952Smrg  *freebsd* | *netbsd*)
977ffab5952Smrg	lint_name=lint
978ffab5952Smrg	lint_options="-u -b"
979ffab5952Smrg	;;
980ffab5952Smrg  *solaris*)
981ffab5952Smrg	lint_name=lint
982ffab5952Smrg	lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
983ffab5952Smrg	;;
984ffab5952Smrgesac
985ffab5952Smrg
986ffab5952Smrg# Test for the presence of the program (either guessed by the code or spelled out by the user)
987ffab5952Smrgif test "x$use_lint" = x"yes" ; then
988ffab5952Smrg   AC_PATH_PROG([LINT], [$lint_name])
989ffab5952Smrg   if test "x$LINT" = "x"; then
990ffab5952Smrg        AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH])
991ffab5952Smrg   fi
992ffab5952Smrgelif test "x$use_lint" = x"no" ; then
993ffab5952Smrg   if test "x$LINT" != "x"; then
994ffab5952Smrg      AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified])
995ffab5952Smrg   fi
996ffab5952Smrgelse
997ffab5952Smrg   AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.])
998ffab5952Smrgfi
999ffab5952Smrg
1000ffab5952Smrg# User supplied flags override default flags
1001ffab5952Smrgif test "x$LINT_FLAGS" != "x"; then
1002ffab5952Smrg   lint_options=$LINT_FLAGS
1003ffab5952Smrgfi
1004ffab5952Smrg
1005ffab5952SmrgAC_SUBST([LINT_FLAGS],[$lint_options])
1006ffab5952SmrgAM_CONDITIONAL(LINT, [test "x$LINT" != x])
1007ffab5952Smrg
1008ffab5952Smrg]) # XORG_WITH_LINT
1009ffab5952Smrg
1010ffab5952Smrg# XORG_LINT_LIBRARY(LIBNAME)
1011ffab5952Smrg# --------------------------
1012ffab5952Smrg# Minimum version: 1.1.0
1013ffab5952Smrg#
1014ffab5952Smrg# Sets up flags for building lint libraries for checking programs that call
1015ffab5952Smrg# functions in the library.
1016ffab5952Smrg#
1017ffab5952Smrg# Interface to module:
1018ffab5952Smrg# LINTLIB		- Automake variable with the name of lint library file to make
1019ffab5952Smrg# MAKE_LINT_LIB		- Automake conditional
1020ffab5952Smrg#
1021ffab5952Smrg# --enable-lint-library:  - 'yes' user instructs the module to created a lint library
1022ffab5952Smrg#			  - 'no' user instructs the module not to create a lint library (default)
1023ffab5952Smrg
1024ffab5952SmrgAC_DEFUN([XORG_LINT_LIBRARY],[
1025ffab5952SmrgAC_REQUIRE([XORG_WITH_LINT])
1026ffab5952SmrgAC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library],
1027ffab5952Smrg	[Create lint library (default: disabled)])],
1028ffab5952Smrg	[make_lint_lib=$enableval], [make_lint_lib=no])
1029ffab5952Smrg
1030ffab5952Smrgif test "x$make_lint_lib" = x"yes" ; then
1031ffab5952Smrg   LINTLIB=llib-l$1.ln
1032ffab5952Smrg   if test "x$LINT" = "x"; then
1033ffab5952Smrg        AC_MSG_ERROR([Cannot make lint library without --with-lint])
1034ffab5952Smrg   fi
1035ffab5952Smrgelif test "x$make_lint_lib" != x"no" ; then
1036ffab5952Smrg   AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.])
1037ffab5952Smrgfi
1038ffab5952Smrg
1039ffab5952SmrgAC_SUBST(LINTLIB)
1040ffab5952SmrgAM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
1041ffab5952Smrg
1042ffab5952Smrg]) # XORG_LINT_LIBRARY
1043ffab5952Smrg
1044ffab5952Smrg# XORG_CWARNFLAGS
1045ffab5952Smrg# ---------------
1046ffab5952Smrg# Minimum version: 1.2.0
1047ffab5952Smrg#
1048ffab5952Smrg# Defines CWARNFLAGS to enable C compiler warnings.
1049ffab5952Smrg#
1050ffab5952SmrgAC_DEFUN([XORG_CWARNFLAGS], [
1051ffab5952SmrgAC_REQUIRE([AC_PROG_CC_C99])
1052ffab5952Smrgif  test "x$GCC" = xyes ; then
1053ffab5952Smrg    CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
1054ffab5952Smrg-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
1055ffab5952Smrg-Wbad-function-cast -Wformat=2"
1056ffab5952Smrg    case `$CC -dumpversion` in
1057ffab5952Smrg    3.4.* | 4.*)
1058ffab5952Smrg	CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
1059ffab5952Smrg	;;
1060ffab5952Smrg    esac
1061ffab5952Smrgelse
1062ffab5952Smrg    AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
1063ffab5952Smrg    if test "x$SUNCC" = "xyes"; then
1064ffab5952Smrg	CWARNFLAGS="-v"
1065ffab5952Smrg    fi
1066ffab5952Smrgfi
1067ffab5952SmrgAC_SUBST(CWARNFLAGS)
1068ffab5952Smrg]) # XORG_CWARNFLAGS
1069ffab5952Smrg
1070ffab5952Smrg# XORG_STRICT_OPTION
1071ffab5952Smrg# -----------------------
1072ffab5952Smrg# Minimum version: 1.3.0
1073ffab5952Smrg#
1074ffab5952Smrg# Add configure option to enable strict compilation
1075ffab5952SmrgAC_DEFUN([XORG_STRICT_OPTION], [
1076ffab5952Smrg# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
1077ffab5952SmrgAC_REQUIRE([AC_PROG_CC_C99])
1078ffab5952SmrgAC_REQUIRE([XORG_CWARNFLAGS])
1079ffab5952Smrg
1080ffab5952SmrgAC_ARG_ENABLE(strict-compilation,
1081ffab5952Smrg			  AS_HELP_STRING([--enable-strict-compilation],
1082ffab5952Smrg			  [Enable all warnings from compiler and make them errors (default: disabled)]),
1083ffab5952Smrg			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
1084ffab5952Smrgif test "x$STRICT_COMPILE" = "xyes"; then
1085ffab5952Smrg	AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
1086ffab5952Smrg	AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
1087ffab5952Smrg	if test "x$GCC" = xyes ; then
1088ffab5952Smrg		STRICT_CFLAGS="-pedantic -Werror"
1089ffab5952Smrg	elif test "x$SUNCC" = "xyes"; then
1090ffab5952Smrg		STRICT_CFLAGS="-errwarn"
1091ffab5952Smrg    elif test "x$INTELCC" = "xyes"; then
1092ffab5952Smrg		STRICT_CFLAGS="-Werror"
1093ffab5952Smrg	fi
1094ffab5952Smrgfi
1095ffab5952SmrgCWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
1096ffab5952SmrgAC_SUBST([CWARNFLAGS])
1097ffab5952Smrg]) # XORG_STRICT_OPTION
1098ffab5952Smrg
1099ffab5952Smrg# XORG_DEFAULT_OPTIONS
1100ffab5952Smrg# --------------------
1101ffab5952Smrg# Minimum version: 1.3.0
1102ffab5952Smrg#
1103ffab5952Smrg# Defines default options for X.Org modules.
1104ffab5952Smrg#
1105ffab5952SmrgAC_DEFUN([XORG_DEFAULT_OPTIONS], [
1106ffab5952SmrgAC_REQUIRE([AC_PROG_INSTALL])
1107ffab5952SmrgXORG_CWARNFLAGS
1108ffab5952SmrgXORG_STRICT_OPTION
1109ffab5952SmrgXORG_RELEASE_VERSION
1110ffab5952SmrgXORG_CHANGELOG
1111ffab5952SmrgXORG_INSTALL
1112ffab5952SmrgXORG_MANPAGE_SECTIONS
1113ffab5952Smrgm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
1114ffab5952Smrg    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
1115ffab5952Smrg]) # XORG_DEFAULT_OPTIONS
1116ffab5952Smrg
1117ffab5952Smrg# XORG_INSTALL()
1118ffab5952Smrg# ----------------
1119ffab5952Smrg# Minimum version: 1.4.0
1120ffab5952Smrg#
1121ffab5952Smrg# Defines the variable INSTALL_CMD as the command to copy
1122ffab5952Smrg# INSTALL from $prefix/share/util-macros.
1123ffab5952Smrg#
1124ffab5952SmrgAC_DEFUN([XORG_INSTALL], [
1125ffab5952SmrgAC_REQUIRE([PKG_PROG_PKG_CONFIG])
1126ffab5952Smrgmacros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
1127ffab5952SmrgINSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
1128ffab5952Smrgmv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
1129ffab5952Smrg|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
1130ffab5952Smrgecho 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
1131ffab5952SmrgAC_SUBST([INSTALL_CMD])
1132ffab5952Smrg]) # XORG_INSTALL
1133