1a9274bcdSmrgdnl @configure_input@
2a9274bcdSmrgdnl
3a9274bcdSmrgdnl This file comes from X.Org's @PACKAGE_STRING@
4a9274bcdSmrgdnl
522281038Smrgdnl Copyright (c) 2009, 2023, Oracle and/or its affiliates.
648af84faSmrgdnl
748af84faSmrgdnl Permission is hereby granted, free of charge, to any person obtaining a
848af84faSmrgdnl copy of this software and associated documentation files (the "Software"),
948af84faSmrgdnl to deal in the Software without restriction, including without limitation
1048af84faSmrgdnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
1148af84faSmrgdnl and/or sell copies of the Software, and to permit persons to whom the
1248af84faSmrgdnl Software is furnished to do so, subject to the following conditions:
1348af84faSmrgdnl
1448af84faSmrgdnl The above copyright notice and this permission notice (including the next
1548af84faSmrgdnl paragraph) shall be included in all copies or substantial portions of the
1648af84faSmrgdnl Software.
1748af84faSmrgdnl
1848af84faSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1948af84faSmrgdnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2048af84faSmrgdnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
2148af84faSmrgdnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2248af84faSmrgdnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2348af84faSmrgdnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2448af84faSmrgdnl DEALINGS IN THE SOFTWARE.
2548af84faSmrgdnl
2648af84faSmrgdnl --------------------------------------------------------------------
2748af84faSmrgdnl
28a9274bcdSmrgdnl Copyright 2005 Red Hat, Inc
29a9274bcdSmrgdnl
30a9274bcdSmrgdnl Permission to use, copy, modify, distribute, and sell this software and its
31a9274bcdSmrgdnl documentation for any purpose is hereby granted without fee, provided that
32a9274bcdSmrgdnl the above copyright notice appear in all copies and that both that
33a9274bcdSmrgdnl copyright notice and this permission notice appear in supporting
34a9274bcdSmrgdnl documentation.
35a9274bcdSmrgdnl
36a9274bcdSmrgdnl The above copyright notice and this permission notice shall be included
37a9274bcdSmrgdnl in all copies or substantial portions of the Software.
38a9274bcdSmrgdnl
39a9274bcdSmrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
40a9274bcdSmrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
41a9274bcdSmrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
42a9274bcdSmrgdnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
43a9274bcdSmrgdnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
44a9274bcdSmrgdnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
45a9274bcdSmrgdnl OTHER DEALINGS IN THE SOFTWARE.
46a9274bcdSmrgdnl
47a9274bcdSmrgdnl Except as contained in this notice, the name of the copyright holders shall
48a9274bcdSmrgdnl not be used in advertising or otherwise to promote the sale, use or
49a9274bcdSmrgdnl other dealings in this Software without prior written authorization
50a9274bcdSmrgdnl from the copyright holders.
51a9274bcdSmrg
52a9274bcdSmrg# XORG_FONT_MACROS_VERSION(required-version)
53a9274bcdSmrg# ------------------------------------------
54a9274bcdSmrg# Minimum version: 1.1.0
55a9274bcdSmrg#
56a9274bcdSmrg# If you're using a macro added in Version 1.1 or newer, include this in
57a9274bcdSmrg# your configure.ac with the minimum required version, such as:
58a9274bcdSmrg# XORG_FONT_MACROS_VERSION(1.1)
59a9274bcdSmrg#
60a9274bcdSmrg# To ensure that this macro is defined, also add:
61a9274bcdSmrg# m4_ifndef([XORG_FONT_MACROS_VERSION],
62a9274bcdSmrg#     [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
63a9274bcdSmrg#
64a9274bcdSmrg#
65a9274bcdSmrg# See the "minimum version" comment for each macro you use to see what
66a9274bcdSmrg# version you require.
67a9274bcdSmrgm4_defun([XORG_FONT_MACROS_VERSION],[
68a9274bcdSmrgm4_define([vers_have], [@VERSION@])
69a9274bcdSmrgm4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
70a9274bcdSmrgm4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
71a9274bcdSmrgm4_if(m4_cmp(maj_have, maj_needed), 0,,
72a9274bcdSmrg    [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
73a9274bcdSmrgm4_if(m4_version_compare(vers_have, [$1]), -1,
74a9274bcdSmrg    [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
75a9274bcdSmrgm4_undefine([vers_have])
76a9274bcdSmrgm4_undefine([maj_have])
77a9274bcdSmrgm4_undefine([maj_needed])
78a9274bcdSmrg]) # XORG_FONT_MACROS_VERSION
79a9274bcdSmrg
80a9274bcdSmrg# XORG_FONT_CHECK_{maps}()
81a9274bcdSmrg# ------------------------
82a9274bcdSmrg# Minimum version: 1.0.0
83a9274bcdSmrg# These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
84a9274bcdSmrg# JISX0201 or KOI8_R.  By default, they are all enabled.
85a9274bcdSmrg
86a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
87a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
88a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
89a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
90a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
91a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
92a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
93a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
94a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
95a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
96a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
97a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
98a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
99a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
100a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
101a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
102a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_JISX0201],  [XORG_FONT_CHECK_ENCODING(JISX0201)])
103a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_KOI8_R],    [XORG_FONT_CHECK_ENCODING(KOI8-R)])
104a9274bcdSmrg
105a9274bcdSmrg# XORG_FONT_CHECK_ENCODING(encoding)
106a9274bcdSmrg# ----------------------------------
107a9274bcdSmrg# Minimum version: 1.1.0
108a9274bcdSmrg# This macro adds --enable/disable-<encoding>, enabled by default.
109a9274bcdSmrg# It replaced individual copies of this code in the above macros in 1.1.
110a9274bcdSmrg# Currently assumes encoding names will be all upper-case - add m4_toupper
111a9274bcdSmrg# calls if this is not true in the future.
112a9274bcdSmrg
113a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING],[
114a9274bcdSmrg	AC_ARG_ENABLE(m4_tolower($1),
115a9274bcdSmrg		AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
116a9274bcdSmrg				[Build $1 fonts (default: yes)]),
11748af84faSmrg		[AS_TR_SH($1)=$enableval])
118a9274bcdSmrg	AC_MSG_CHECKING([whether to build $1 fonts])
119a9274bcdSmrg	AC_MSG_RESULT($[AS_TR_SH($1)])
120a9274bcdSmrg	AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
121a9274bcdSmrg]) # XORG_FONT_CHECK_ENCODING
122a9274bcdSmrg
123a9274bcdSmrg# XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
124a9274bcdSmrg# -----------------------------------------------------
125a9274bcdSmrg# Minimum version: 1.1.0
12648af84faSmrg# Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
12748af84faSmrg# Add a shorthand --enable/disable-all-encodings option.
128a9274bcdSmrg
129a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
13048af84faSmrg	AC_ARG_ENABLE([all-encodings],
13148af84faSmrg		AS_HELP_STRING([--disable-all-encodings],
13248af84faSmrg				[Disable building of all font encodings]),
13348af84faSmrg		[m4_foreach_w([enc], [$1], [
13448af84faSmrg			AS_TR_SH(enc)=$enableval
13548af84faSmrg		])],
13648af84faSmrg		[m4_foreach_w([enc], [$1], [
13748af84faSmrg			AS_TR_SH(enc)=yes
13848af84faSmrg		])])
139a9274bcdSmrg	m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
140a9274bcdSmrg]) # XORG_FONT_CHECK_ENCODING_LIST
141a9274bcdSmrg
142a9274bcdSmrg# XORG_FONT_REQUIRED_PROG(VARNAME, progname)
143a9274bcdSmrg# ------------------------------------------
144a9274bcdSmrg# Minimum version: 1.1.0
145a9274bcdSmrg#
146a9274bcdSmrg# Simple wrapper around AC_PATH_PROG that errors if not found
147a9274bcdSmrg#
148a9274bcdSmrg
149a9274bcdSmrgAC_DEFUN([XORG_FONT_REQUIRED_PROG],[
150a9274bcdSmrg	AC_PATH_PROG($1, $2)
15148af84faSmrg	if test x"$$1" = x; then
152a9274bcdSmrg		AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
153a9274bcdSmrg	fi
154a9274bcdSmrg])
155a9274bcdSmrg
156a9274bcdSmrg
157a9274bcdSmrg# XORG_FONT_FCCACHE()
158a9274bcdSmrg# -------------------
159a9274bcdSmrg# Minimum version: 1.1.0
160a9274bcdSmrg#
161a9274bcdSmrg# Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
162a9274bcdSmrg# Set RUN_FCCACHE to a rule suitable for substituting into a makefile
163f931275dSmrg# to run fc-cache if found and not installing to $DESTDIR and not
164f931275dSmrg# cross-compiling
165a9274bcdSmrg#
166a9274bcdSmrg# fc-cache is optional, not required, and should be skipped when making
167f931275dSmrg# packages (installing to $DESTDIR) or cross-compiling
168a9274bcdSmrg#
169a9274bcdSmrgAC_DEFUN([XORG_FONT_FCCACHE],[
170a9274bcdSmrg	AC_PATH_PROG(FCCACHE, fc-cache)
171a9274bcdSmrg	FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
172f931275dSmrg	if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then
173a9274bcdSmrg		RUN_FCCACHE="${FCCACHE_WARN}"
174a9274bcdSmrg	else
175a9274bcdSmrg		RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
176a9274bcdSmrg		RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
177a9274bcdSmrg	fi
178a9274bcdSmrg	AC_SUBST([RUN_FCCACHE])
179a9274bcdSmrg])
180a9274bcdSmrg
181f931275dSmrg# XORG_FONT_MKFONTDIR()
182f931275dSmrg# -------------------
183f931275dSmrg# Minimum version: 1.3.0
184f931275dSmrg#
185f931275dSmrg# Set MKFONTDIR to path to mkfontdir.
186f931275dSmrg#
187f931275dSmrg# If cross-compiling, and if mkdir is not found, use a shell command
188f931275dSmrg# which warns mkfontdir needs to be run on the target
189f931275dSmrg#
190f931275dSmrg# If not cross-compiling, mkfontdir must be found
191f931275dSmrg#
192f931275dSmrgAC_DEFUN([XORG_FONT_MKFONTDIR],[
193f931275dSmrg	if test x"$cross_compiling" != x"no" ; then
194f931275dSmrg		AC_PATH_PROG(MKFONTDIR, mkfontdir, "")
195f931275dSmrg		MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"'
196f931275dSmrg
197f931275dSmrg		if test x"$MKFONTDIR" = x; then
198f931275dSmrg			MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'"
199f931275dSmrg		fi
200f931275dSmrg	else
201f931275dSmrg		XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
202f931275dSmrg	fi
203f931275dSmrg
204f931275dSmrg	AC_SUBST([MKFONTDIR])
205f931275dSmrg])
206a9274bcdSmrg
207a9274bcdSmrg# XORG_FONT_COMMON_UTILS()
208a9274bcdSmrg# ------------------------
209a9274bcdSmrg# Minimum version: 1.1.0
210a9274bcdSmrg#
211a9274bcdSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
212a9274bcdSmrg
213a9274bcdSmrgAC_DEFUN([XORG_FONT_COMMON_UTILS],[
214a9274bcdSmrg	XORG_FONT_FCCACHE
215f931275dSmrg	XORG_FONT_MKFONTDIR
216a9274bcdSmrg])
217a9274bcdSmrg
218a9274bcdSmrg# XORG_FONT_SCALED_UTILS()
219a9274bcdSmrg# ------------------------
220a9274bcdSmrg# Minimum version: 1.1.0
221a9274bcdSmrg#
222a9274bcdSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
223a9274bcdSmrg# (TrueType, OpenType, Type1)
224a9274bcdSmrg
225a9274bcdSmrgAC_DEFUN([XORG_FONT_SCALED_UTILS],[
226a9274bcdSmrg	XORG_FONT_COMMON_UTILS
227a9274bcdSmrg	XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
228a9274bcdSmrg])
229a9274bcdSmrg
230a9274bcdSmrg# XORG_FONT_BDF_UTILS()
231a9274bcdSmrg# ---------------------
232a9274bcdSmrg# Minimum version: 1.1.0
233a9274bcdSmrg#
234a9274bcdSmrg# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
235a9274bcdSmrg# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
236a9274bcdSmrg# PCF output files created by bdftopcf
237a9274bcdSmrg
238a9274bcdSmrgAC_DEFUN([XORG_FONT_BDF_UTILS],[
239a9274bcdSmrg	XORG_FONT_COMMON_UTILS
240a9274bcdSmrg	XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
241a9274bcdSmrg	XORG_FONT_CHECK_COMPRESSION
242a9274bcdSmrg])
243a9274bcdSmrg
244a9274bcdSmrg# XORG_FONT_CHECK_COMPRESSION()
245a9274bcdSmrg# -----------------------------
246a9274bcdSmrg# Minimum version: 1.1.0
247a9274bcdSmrg#
248a9274bcdSmrg# Offer a --with-compression flag to control what compression method is
249a9274bcdSmrg# used for pcf font files.   Offers all the methods currently supported
250a9274bcdSmrg# by libXfont, including no compression.
251c12babebSmrg#
252c12babebSmrg# If COMPRESS_FLAGS is not set, and the compression method has flags needed
253c12babebSmrg# for reproducible builds, such as gzip -n to not record timestamp, will
254c12babebSmrg# set COMPRESS_FLAGS to those options.
255a9274bcdSmrg
256a9274bcdSmrgAC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
257a9274bcdSmrg	AC_MSG_CHECKING([font compression method])
258a9274bcdSmrg	AC_ARG_WITH(compression,
259a9274bcdSmrg	 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
260a9274bcdSmrg			 [compression method to use on pcf fonts])],
261a9274bcdSmrg         [compression="$withval"], [compression="yes"])
262a9274bcdSmrg	if test x"$compression" = "xyes" ; then
263a9274bcdSmrg		compression="gzip"
264a9274bcdSmrg	fi
265a9274bcdSmrg	AC_MSG_RESULT([${compression}])
266a9274bcdSmrg	case ${compression} in
267a9274bcdSmrg	 *compress)	COMPRESS_SUFFIX=".Z" ;;
268c12babebSmrg	 *gzip)		COMPRESS_SUFFIX=".gz" ;
269c12babebSmrg			COMPRESS_FLAGS="${COMPRESS_FLAGS--n}" ;;
270a9274bcdSmrg	 *bzip2)	COMPRESS_SUFFIX=".bz2" ;;
271a9274bcdSmrg	 no|none)	COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
272a9274bcdSmrg	 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
273a9274bcdSmrg	esac
274a9274bcdSmrg	if test x"$COMPRESS_SUFFIX" != "x" ; then
275a9274bcdSmrg	   XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
276a9274bcdSmrg	fi
277c12babebSmrg	AC_MSG_CHECKING([options to font compression command])
278c12babebSmrg	AC_MSG_RESULT([${COMPRESS_FLAGS:-none}])
279c12babebSmrg	AC_SUBST([COMPRESS_FLAGS])
280a9274bcdSmrg	AC_SUBST([COMPRESS_SUFFIX])
281a9274bcdSmrg])
282a9274bcdSmrg
283a9274bcdSmrg# XORG_FONT_UCS2ANY()
284a9274bcdSmrg# -------------------
285a9274bcdSmrg# Minimum version: 1.1.0
286a9274bcdSmrg#
287a9274bcdSmrg# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
288a9274bcdSmrg# Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
289a9274bcdSmrg# Also call pkg-config to find the directory with the encoding files needed
290a9274bcdSmrg# by ucs2any, and export it as MAPFILES_PATH to the Makefiles
291a9274bcdSmrg
292a9274bcdSmrgAC_DEFUN([XORG_FONT_UCS2ANY],[
293c6a6acfbSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
294a9274bcdSmrg	XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
295a9274bcdSmrg	PKG_CHECK_MODULES(MAPS, [fontutil])
296a9274bcdSmrg	AC_MSG_CHECKING([for ucs2any encoding data files])
297c6a6acfbSmrg	MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil`
298a9274bcdSmrg	AC_SUBST(MAPFILES_PATH)
299a9274bcdSmrg	AC_MSG_RESULT([${MAPFILES_PATH}])
300a9274bcdSmrg])
301a9274bcdSmrg
302a9274bcdSmrg
303a9274bcdSmrg
30448af84faSmrg# XORG_FONT_FC_CONFDIR()
30548af84faSmrg# --------------------
30648af84faSmrg# Minimum version: 1.2.0
30748af84faSmrg#
30848af84faSmrg# Sets FC_CONFDIR to the fontconfig config directory
30948af84faSmrg# (which should be --with-confdir=... when building fontconfig)
31048af84faSmrg# found from:
31148af84faSmrg#	--with-fc-confdir=...
31248af84faSmrg#	pkg-config --variable=confdir fontconfig
31348af84faSmrg#	${sysconfdir}/fonts
31448af84faSmrg
31548af84faSmrgAC_DEFUN([XORG_FONT_FC_CONFDIR],[
31648af84faSmrg	dnl Ensure $PKG_CONFIG is set first
31748af84faSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
31848af84faSmrg
31948af84faSmrg	AC_MSG_CHECKING([for fontconfig's configuration directory])
32048af84faSmrg	AC_ARG_WITH(fc-confdir,
32148af84faSmrg		    AS_HELP_STRING([--with-fc-confdir=DIR],
32248af84faSmrg			   [Path to fontconfig's configuration directory]),
32348af84faSmrg		    [FC_CONFDIR="$withval"])
32448af84faSmrg	# if --with-fc-confdir was not specified
32548af84faSmrg	if test "x${FC_CONFDIR}" = "x"; then
32648af84faSmrg		FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
32748af84faSmrg	fi
32848af84faSmrg	# ...and if pkg-config didn't find confdir in fontconfig.pc...
32948af84faSmrg	if test "x${FC_CONFDIR}" = "x"; then
33048af84faSmrg		FC_CONFDIR="${sysconfdir}/fonts"
33148af84faSmrg	fi
33248af84faSmrg	AC_SUBST(FC_CONFDIR)
33348af84faSmrg	AC_MSG_RESULT([${FC_CONFDIR}])
33448af84faSmrg])
33548af84faSmrg
33648af84faSmrg
33748af84faSmrg
338a9274bcdSmrg# XORG_FONTROOTDIR()
339a9274bcdSmrg# --------------------
340a9274bcdSmrg# Minimum version: 1.1.0
341a9274bcdSmrg#
342a9274bcdSmrg# Sets FONTROOTDIR to the root directory for font files.  Uses the first
343a9274bcdSmrg# found from:
344a9274bcdSmrg#	--with-fontrootdir
345a9274bcdSmrg#	pkg-config --variable=fontrootdir fontutil
346a9274bcdSmrg#	${datadir}/fonts/X11
347a9274bcdSmrg
348a9274bcdSmrgAC_DEFUN([XORG_FONTROOTDIR],[
349a9274bcdSmrg	dnl Ensure $PKG_CONFIG is set first
350a9274bcdSmrg	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
351a9274bcdSmrg
352a9274bcdSmrg	AC_MSG_CHECKING([for root directory for font files])
353a9274bcdSmrg	AC_ARG_WITH(fontrootdir,
354a9274bcdSmrg		    AS_HELP_STRING([--with-fontrootdir=DIR],
355a9274bcdSmrg			   [Path to root directory for font files]),
356a9274bcdSmrg		    [FONTROOTDIR="$withval"])
357a9274bcdSmrg	# if --with-fontrootdir not specified...
358a9274bcdSmrg	if test "x${FONTROOTDIR}" = "x"; then
359a9274bcdSmrg		FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
360a9274bcdSmrg	fi
361a9274bcdSmrg	# ...and if pkg-config didn't find fontdir in fontutil.pc...
362a9274bcdSmrg	if test "x${FONTROOTDIR}" = "x"; then
363a9274bcdSmrg		FONTROOTDIR="${datadir}/fonts/X11"
364a9274bcdSmrg	fi
365a9274bcdSmrg	AC_SUBST(FONTROOTDIR)
366a9274bcdSmrg	AC_MSG_RESULT([${FONTROOTDIR}])
367a9274bcdSmrg])
368a9274bcdSmrg
369a9274bcdSmrg# XORG_FONTSUBDIR(variable, flag, subdir)
370a9274bcdSmrg# ---------------------------------------
371a9274bcdSmrg# Minimum version: 1.1.0
372a9274bcdSmrg#
373a9274bcdSmrg# Offer a --with-<flag> flag to control directory for font installation
374a9274bcdSmrg# Default is the specified <subdir> of the font root directory.
375a9274bcdSmrg# Sets <variable> to the selected directory
376a9274bcdSmrg
377a9274bcdSmrgAC_DEFUN([XORG_FONTSUBDIR],[
378a9274bcdSmrg	AC_REQUIRE([XORG_FONTROOTDIR])
379a9274bcdSmrg
380a9274bcdSmrg	AC_MSG_CHECKING([for directory for $3 files])
381a9274bcdSmrg	AC_ARG_WITH($2,
382a9274bcdSmrg		    [AS_HELP_STRING([--with-$2=DIR],
383a9274bcdSmrg				    [Path to $3 files [FONTROOTDIR/$3]])],
384a9274bcdSmrg		    [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
385a9274bcdSmrg	AC_SUBST($1)
386a9274bcdSmrg	AC_MSG_RESULT([${$1}])
387a9274bcdSmrg]) # XORG_FONTSUBDIR
388a9274bcdSmrg
389a9274bcdSmrg# XORG_FONTDIR(subdir)
390a9274bcdSmrg# --------------------
391a9274bcdSmrg# Minimum version: 1.1.0
392a9274bcdSmrg#
393a9274bcdSmrg# Offer a --with-fontdir flag to control directory for font installation
394a9274bcdSmrg# Default is the specified subdir of the font root directory.
395a9274bcdSmrg# Sets FONTDIR to the selected directory
396a9274bcdSmrg
397a9274bcdSmrgAC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])
398