1 dnl fontutil.m4. Generated from fontutil.m4.in by configure.
3 dnl This file comes from X.Org's font-util 1.2.0
5 dnl Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
7 dnl Permission is hereby granted, free of charge, to any person obtaining a
8 dnl copy of this software and associated documentation files (the "Software"),
9 dnl to deal in the Software without restriction, including without limitation
10 dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 dnl and/or sell copies of the Software, and to permit persons to whom the
12 dnl Software is furnished to do so, subject to the following conditions:
14 dnl The above copyright notice and this permission notice (including the next
15 dnl paragraph) shall be included in all copies or substantial portions of the
18 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 dnl DEALINGS IN THE SOFTWARE.
26 dnl --------------------------------------------------------------------
28 dnl Copyright 2005 Red Hat, Inc
30 dnl Permission to use, copy, modify, distribute, and sell this software and its
31 dnl documentation for any purpose is hereby granted without fee, provided that
32 dnl the above copyright notice appear in all copies and that both that
33 dnl copyright notice and this permission notice appear in supporting
36 dnl The above copyright notice and this permission notice shall be included
37 dnl in all copies or substantial portions of the Software.
39 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
40 dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
41 dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
42 dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
43 dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
44 dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
45 dnl OTHER DEALINGS IN THE SOFTWARE.
47 dnl Except as contained in this notice, the name of the copyright holders shall
48 dnl not be used in advertising or otherwise to promote the sale, use or
49 dnl other dealings in this Software without prior written authorization
50 dnl from the copyright holders.
52 # XORG_FONT_MACROS_VERSION(required-version)
53 # ------------------------------------------
54 # Minimum version: 1.1.0
56 # If you're using a macro added in Version 1.1 or newer, include this in
57 # your configure.ac with the minimum required version, such as:
58 # XORG_FONT_MACROS_VERSION(1.1)
60 # To ensure that this macro is defined, also add:
61 # m4_ifndef([XORG_FONT_MACROS_VERSION],
62 # [m4_fatal([must install X.Org font-util 1.1 or later before running autoconf/autogen])])
65 # See the "minimum version" comment for each macro you use to see what
66 # version you require.
67 m4_defun([XORG_FONT_MACROS_VERSION],[
68 m4_define([vers_have], [1.2.0])
69 m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
70 m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
71 m4_if(m4_cmp(maj_have, maj_needed), 0,,
72 [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])])
73 m4_if(m4_version_compare(vers_have, [$1]), -1,
74 [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])])
75 m4_undefine([vers_have])
76 m4_undefine([maj_have])
77 m4_undefine([maj_needed])
78 ]) # XORG_FONT_MACROS_VERSION
80 # XORG_FONT_CHECK_{maps}()
81 # ------------------------
82 # Minimum version: 1.0.0
83 # These macros add --enable/disable-{maps} where {maps} are ISO8859-*,
84 # JISX0201 or KOI8_R. By default, they are all enabled.
86 AC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)])
87 AC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)])
88 AC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)])
89 AC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)])
90 AC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)])
91 AC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)])
92 AC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)])
93 AC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)])
94 AC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)])
95 AC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)])
96 AC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)])
97 AC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)])
98 AC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)])
99 AC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)])
100 AC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)])
101 AC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)])
102 AC_DEFUN([XORG_FONT_CHECK_JISX0201], [XORG_FONT_CHECK_ENCODING(JISX0201)])
103 AC_DEFUN([XORG_FONT_CHECK_KOI8_R], [XORG_FONT_CHECK_ENCODING(KOI8-R)])
105 # XORG_FONT_CHECK_ENCODING(encoding)
106 # ----------------------------------
107 # Minimum version: 1.1.0
108 # This macro adds --enable/disable-<encoding>, enabled by default.
109 # It replaced individual copies of this code in the above macros in 1.1.
110 # Currently assumes encoding names will be all upper-case - add m4_toupper
111 # calls if this is not true in the future.
113 AC_DEFUN([XORG_FONT_CHECK_ENCODING],[
114 AC_ARG_ENABLE(m4_tolower($1),
115 AS_HELP_STRING(m4_join([-], [--disable], m4_tolower($1)),
116 [Build $1 fonts (default: yes)]),
117 [AS_TR_SH($1)=$enableval])
118 AC_MSG_CHECKING([whether to build $1 fonts])
119 AC_MSG_RESULT($[AS_TR_SH($1)])
120 AM_CONDITIONAL(AS_TR_SH($1), [test "x$AS_TR_SH($1)" = xyes])
121 ]) # XORG_FONT_CHECK_ENCODING
123 # XORG_FONT_CHECK_ENCODING_LIST(encoding1 encoding2....)
124 # -----------------------------------------------------
125 # Minimum version: 1.1.0
126 # Call XORG_FONT_CHECK_ENCODING for multiple encodings at once.
127 # Add a shorthand --enable/disable-all-encodings option.
129 AC_DEFUN([XORG_FONT_CHECK_ENCODING_LIST],[
130 AC_ARG_ENABLE([all-encodings],
131 AS_HELP_STRING([--disable-all-encodings],
132 [Disable building of all font encodings]),
133 [m4_foreach_w([enc], [$1], [
134 AS_TR_SH(enc)=$enableval
136 [m4_foreach_w([enc], [$1], [
139 m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)])
140 ]) # XORG_FONT_CHECK_ENCODING_LIST
142 # XORG_FONT_REQUIRED_PROG(VARNAME, progname)
143 # ------------------------------------------
144 # Minimum version: 1.1.0
146 # Simple wrapper around AC_PATH_PROG that errors if not found
149 AC_DEFUN([XORG_FONT_REQUIRED_PROG],[
151 if test x"$$1" = x; then
152 AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.])
157 # XORG_FONT_FCCACHE()
158 # -------------------
159 # Minimum version: 1.1.0
161 # Set FCCACHE to path to fc-cache (fontconfig cache builder) if found
162 # Set RUN_FCCACHE to a rule suitable for substituting into a makefile
163 # to run fc-cache if found and not installing to $DESTDIR
165 # fc-cache is optional, not required, and should be skipped when making
166 # packages (installing to $DESTDIR).
168 AC_DEFUN([XORG_FONT_FCCACHE],[
169 AC_PATH_PROG(FCCACHE, fc-cache)
170 FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"'
171 if test x"$FCCACHE" = x ; then
172 RUN_FCCACHE="${FCCACHE_WARN}"
174 RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else'
175 RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)"
177 AC_SUBST([RUN_FCCACHE])
181 # XORG_FONT_COMMON_UTILS()
182 # ------------------------
183 # Minimum version: 1.1.0
185 # Call XORG_FONT_REQUIRED_PROG for programs needed for all font types
187 AC_DEFUN([XORG_FONT_COMMON_UTILS],[
189 XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir)
192 # XORG_FONT_SCALED_UTILS()
193 # ------------------------
194 # Minimum version: 1.1.0
196 # Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts
197 # (TrueType, OpenType, Type1)
199 AC_DEFUN([XORG_FONT_SCALED_UTILS],[
200 XORG_FONT_COMMON_UTILS
201 XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale)
204 # XORG_FONT_BDF_UTILS()
205 # ---------------------
206 # Minimum version: 1.1.0
208 # Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts
209 # Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the
210 # PCF output files created by bdftopcf
212 AC_DEFUN([XORG_FONT_BDF_UTILS],[
213 XORG_FONT_COMMON_UTILS
214 XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf)
215 XORG_FONT_CHECK_COMPRESSION
218 # XORG_FONT_CHECK_COMPRESSION()
219 # -----------------------------
220 # Minimum version: 1.1.0
222 # Offer a --with-compression flag to control what compression method is
223 # used for pcf font files. Offers all the methods currently supported
224 # by libXfont, including no compression.
226 AC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[
227 AC_MSG_CHECKING([font compression method])
228 AC_ARG_WITH(compression,
229 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>],
230 [compression method to use on pcf fonts])],
231 [compression="$withval"], [compression="yes"])
232 if test x"$compression" = "xyes" ; then
235 AC_MSG_RESULT([${compression}])
236 case ${compression} in
237 *compress) COMPRESS_SUFFIX=".Z" ;;
238 *gzip) COMPRESS_SUFFIX=".gz" ;;
239 *bzip2) COMPRESS_SUFFIX=".bz2" ;;
240 no|none) COMPRESS_SUFFIX="" ; COMPRESS="cat" ;;
241 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;;
243 if test x"$COMPRESS_SUFFIX" != "x" ; then
244 XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression})
246 AC_SUBST([COMPRESS_SUFFIX])
249 # XORG_FONT_UCS2ANY()
250 # -------------------
251 # Minimum version: 1.1.0
253 # Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting
254 # Unicode-encoded BDF format bitmap fonts into subsets for older encodings.
255 # Also call pkg-config to find the directory with the encoding files needed
256 # by ucs2any, and export it as MAPFILES_PATH to the Makefiles
258 AC_DEFUN([XORG_FONT_UCS2ANY],[
259 XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any)
260 PKG_CHECK_MODULES(MAPS, [fontutil])
261 AC_MSG_CHECKING([for ucs2any encoding data files])
262 MAPFILES_PATH=`pkg-config --variable=mapdir fontutil`
263 AC_SUBST(MAPFILES_PATH)
264 AC_MSG_RESULT([${MAPFILES_PATH}])
269 # XORG_FONT_FC_CONFDIR()
270 # --------------------
271 # Minimum version: 1.2.0
273 # Sets FC_CONFDIR to the fontconfig config directory
274 # (which should be --with-confdir=... when building fontconfig)
276 # --with-fc-confdir=...
277 # pkg-config --variable=confdir fontconfig
278 # ${sysconfdir}/fonts
280 AC_DEFUN([XORG_FONT_FC_CONFDIR],[
281 dnl Ensure $PKG_CONFIG is set first
282 AC_REQUIRE([PKG_PROG_PKG_CONFIG])
284 AC_MSG_CHECKING([for fontconfig's configuration directory])
285 AC_ARG_WITH(fc-confdir,
286 AS_HELP_STRING([--with-fc-confdir=DIR],
287 [Path to fontconfig's configuration directory]),
288 [FC_CONFDIR="$withval"])
289 # if --with-fc-confdir was not specified
290 if test "x${FC_CONFDIR}" = "x"; then
291 FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig`
293 # ...and if pkg-config didn't find confdir in fontconfig.pc...
294 if test "x${FC_CONFDIR}" = "x"; then
295 FC_CONFDIR="${sysconfdir}/fonts"
298 AC_MSG_RESULT([${FC_CONFDIR}])
304 # --------------------
305 # Minimum version: 1.1.0
307 # Sets FONTROOTDIR to the root directory for font files. Uses the first
310 # pkg-config --variable=fontrootdir fontutil
311 # ${datadir}/fonts/X11
313 AC_DEFUN([XORG_FONTROOTDIR],[
314 dnl Ensure $PKG_CONFIG is set first
315 AC_REQUIRE([PKG_PROG_PKG_CONFIG])
317 AC_MSG_CHECKING([for root directory for font files])
318 AC_ARG_WITH(fontrootdir,
319 AS_HELP_STRING([--with-fontrootdir=DIR],
320 [Path to root directory for font files]),
321 [FONTROOTDIR="$withval"])
322 # if --with-fontrootdir not specified...
323 if test "x${FONTROOTDIR}" = "x"; then
324 FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil`
326 # ...and if pkg-config didn't find fontdir in fontutil.pc...
327 if test "x${FONTROOTDIR}" = "x"; then
328 FONTROOTDIR="${datadir}/fonts/X11"
330 AC_SUBST(FONTROOTDIR)
331 AC_MSG_RESULT([${FONTROOTDIR}])
334 # XORG_FONTSUBDIR(variable, flag, subdir)
335 # ---------------------------------------
336 # Minimum version: 1.1.0
338 # Offer a --with-<flag> flag to control directory for font installation
339 # Default is the specified <subdir> of the font root directory.
340 # Sets <variable> to the selected directory
342 AC_DEFUN([XORG_FONTSUBDIR],[
343 AC_REQUIRE([XORG_FONTROOTDIR])
345 AC_MSG_CHECKING([for directory for $3 files])
347 [AS_HELP_STRING([--with-$2=DIR],
348 [Path to $3 files [FONTROOTDIR/$3]])],
349 [$1="${withval}"], [$1='${FONTROOTDIR}/$3'])
351 AC_MSG_RESULT([${$1}])
354 # XORG_FONTDIR(subdir)
355 # --------------------
356 # Minimum version: 1.1.0
358 # Offer a --with-fontdir flag to control directory for font installation
359 # Default is the specified subdir of the font root directory.
360 # Sets FONTDIR to the selected directory
362 AC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])])