1dnl @configure_input@ 2dnl 3dnl This file comes from X.Org's @PACKAGE_STRING@ 4dnl 5dnl Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 6dnl 7dnl Permission is hereby granted, free of charge, to any person obtaining a 8dnl copy of this software and associated documentation files (the "Software"), 9dnl to deal in the Software without restriction, including without limitation 10dnl the rights to use, copy, modify, merge, publish, distribute, sublicense, 11dnl and/or sell copies of the Software, and to permit persons to whom the 12dnl Software is furnished to do so, subject to the following conditions: 13dnl 14dnl The above copyright notice and this permission notice (including the next 15dnl paragraph) shall be included in all copies or substantial portions of the 16dnl Software. 17dnl 18dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24dnl DEALINGS IN THE SOFTWARE. 25dnl 26dnl -------------------------------------------------------------------- 27dnl 28dnl Copyright 2005 Red Hat, Inc 29dnl 30dnl Permission to use, copy, modify, distribute, and sell this software and its 31dnl documentation for any purpose is hereby granted without fee, provided that 32dnl the above copyright notice appear in all copies and that both that 33dnl copyright notice and this permission notice appear in supporting 34dnl documentation. 35dnl 36dnl The above copyright notice and this permission notice shall be included 37dnl in all copies or substantial portions of the Software. 38dnl 39dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 40dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 41dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 42dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR 43dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 44dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 45dnl OTHER DEALINGS IN THE SOFTWARE. 46dnl 47dnl Except as contained in this notice, the name of the copyright holders shall 48dnl not be used in advertising or otherwise to promote the sale, use or 49dnl other dealings in this Software without prior written authorization 50dnl from the copyright holders. 51 52# XORG_FONT_MACROS_VERSION(required-version) 53# ------------------------------------------ 54# Minimum version: 1.1.0 55# 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) 59# 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])]) 63# 64# 65# See the "minimum version" comment for each macro you use to see what 66# version you require. 67m4_defun([XORG_FONT_MACROS_VERSION],[ 68m4_define([vers_have], [@VERSION@]) 69m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.]))) 70m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.]))) 71m4_if(m4_cmp(maj_have, maj_needed), 0,, 72 [m4_fatal([font-util major version ]maj_needed[ is required but ]vers_have[ found])]) 73m4_if(m4_version_compare(vers_have, [$1]), -1, 74 [m4_fatal([font-util version $1 or higher is required but ]vers_have[ found])]) 75m4_undefine([vers_have]) 76m4_undefine([maj_have]) 77m4_undefine([maj_needed]) 78]) # XORG_FONT_MACROS_VERSION 79 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. 85 86AC_DEFUN([XORG_FONT_CHECK_ISO8859_1], [XORG_FONT_CHECK_ENCODING(ISO8859-1)]) 87AC_DEFUN([XORG_FONT_CHECK_ISO8859_2], [XORG_FONT_CHECK_ENCODING(ISO8859-2)]) 88AC_DEFUN([XORG_FONT_CHECK_ISO8859_3], [XORG_FONT_CHECK_ENCODING(ISO8859-3)]) 89AC_DEFUN([XORG_FONT_CHECK_ISO8859_4], [XORG_FONT_CHECK_ENCODING(ISO8859-4)]) 90AC_DEFUN([XORG_FONT_CHECK_ISO8859_5], [XORG_FONT_CHECK_ENCODING(ISO8859-5)]) 91AC_DEFUN([XORG_FONT_CHECK_ISO8859_6], [XORG_FONT_CHECK_ENCODING(ISO8859-6)]) 92AC_DEFUN([XORG_FONT_CHECK_ISO8859_7], [XORG_FONT_CHECK_ENCODING(ISO8859-7)]) 93AC_DEFUN([XORG_FONT_CHECK_ISO8859_8], [XORG_FONT_CHECK_ENCODING(ISO8859-8)]) 94AC_DEFUN([XORG_FONT_CHECK_ISO8859_9], [XORG_FONT_CHECK_ENCODING(ISO8859-9)]) 95AC_DEFUN([XORG_FONT_CHECK_ISO8859_10],[XORG_FONT_CHECK_ENCODING(ISO8859-10)]) 96AC_DEFUN([XORG_FONT_CHECK_ISO8859_11],[XORG_FONT_CHECK_ENCODING(ISO8859-11)]) 97AC_DEFUN([XORG_FONT_CHECK_ISO8859_12],[XORG_FONT_CHECK_ENCODING(ISO8859-12)]) 98AC_DEFUN([XORG_FONT_CHECK_ISO8859_13],[XORG_FONT_CHECK_ENCODING(ISO8859-13)]) 99AC_DEFUN([XORG_FONT_CHECK_ISO8859_14],[XORG_FONT_CHECK_ENCODING(ISO8859-14)]) 100AC_DEFUN([XORG_FONT_CHECK_ISO8859_15],[XORG_FONT_CHECK_ENCODING(ISO8859-15)]) 101AC_DEFUN([XORG_FONT_CHECK_ISO8859_16],[XORG_FONT_CHECK_ENCODING(ISO8859-16)]) 102AC_DEFUN([XORG_FONT_CHECK_JISX0201], [XORG_FONT_CHECK_ENCODING(JISX0201)]) 103AC_DEFUN([XORG_FONT_CHECK_KOI8_R], [XORG_FONT_CHECK_ENCODING(KOI8-R)]) 104 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. 112 113AC_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 122 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. 128 129AC_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 135 ])], 136 [m4_foreach_w([enc], [$1], [ 137 AS_TR_SH(enc)=yes 138 ])]) 139 m4_foreach_w([enc], [$1], [XORG_FONT_CHECK_ENCODING(enc)]) 140]) # XORG_FONT_CHECK_ENCODING_LIST 141 142# XORG_FONT_REQUIRED_PROG(VARNAME, progname) 143# ------------------------------------------ 144# Minimum version: 1.1.0 145# 146# Simple wrapper around AC_PATH_PROG that errors if not found 147# 148 149AC_DEFUN([XORG_FONT_REQUIRED_PROG],[ 150 AC_PATH_PROG($1, $2) 151 if test x"$$1" = x; then 152 AC_MSG_ERROR([$2 is required to build $PACKAGE_NAME.]) 153 fi 154]) 155 156 157# XORG_FONT_FCCACHE() 158# ------------------- 159# Minimum version: 1.1.0 160# 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 and not 164# cross-compiling 165# 166# fc-cache is optional, not required, and should be skipped when making 167# packages (installing to $DESTDIR) or cross-compiling 168# 169AC_DEFUN([XORG_FONT_FCCACHE],[ 170 AC_PATH_PROG(FCCACHE, fc-cache) 171 FCCACHE_WARN='echo "** Warning: fonts.cache not built" ; echo "** Generate this file manually on host system using fc-cache"' 172 if test x"$FCCACHE" = x || test x"$cross_compiling" != x"no" ; then 173 RUN_FCCACHE="${FCCACHE_WARN}" 174 else 175 RUN_FCCACHE='@(if test -z "$(DESTDIR)"; then echo $(FCCACHE) $(fontdir); $(FCCACHE) $(fontdir); else' 176 RUN_FCCACHE="${RUN_FCCACHE} ${FCCACHE_WARN} ; fi)" 177 fi 178 AC_SUBST([RUN_FCCACHE]) 179]) 180 181# XORG_FONT_MKFONTDIR() 182# ------------------- 183# Minimum version: 1.3.0 184# 185# Set MKFONTDIR to path to mkfontdir. 186# 187# If cross-compiling, and if mkdir is not found, use a shell command 188# which warns mkfontdir needs to be run on the target 189# 190# If not cross-compiling, mkfontdir must be found 191# 192AC_DEFUN([XORG_FONT_MKFONTDIR],[ 193 if test x"$cross_compiling" != x"no" ; then 194 AC_PATH_PROG(MKFONTDIR, mkfontdir, "") 195 MKFONTDIR_WARN='echo "** Warning: mkfontdir not run" ; echo "** Run mkfontdir manually on host system"' 196 197 if test x"$MKFONTDIR" = x; then 198 MKFONTDIR="${MKFONTDIR_WARN} ; echo '** mkfontdir'" 199 fi 200 else 201 XORG_FONT_REQUIRED_PROG(MKFONTDIR, mkfontdir) 202 fi 203 204 AC_SUBST([MKFONTDIR]) 205]) 206 207# XORG_FONT_COMMON_UTILS() 208# ------------------------ 209# Minimum version: 1.1.0 210# 211# Call XORG_FONT_REQUIRED_PROG for programs needed for all font types 212 213AC_DEFUN([XORG_FONT_COMMON_UTILS],[ 214 XORG_FONT_FCCACHE 215 XORG_FONT_MKFONTDIR 216]) 217 218# XORG_FONT_SCALED_UTILS() 219# ------------------------ 220# Minimum version: 1.1.0 221# 222# Call XORG_FONT_REQUIRED_PROG for programs needed for scalable fonts 223# (TrueType, OpenType, Type1) 224 225AC_DEFUN([XORG_FONT_SCALED_UTILS],[ 226 XORG_FONT_COMMON_UTILS 227 XORG_FONT_REQUIRED_PROG(MKFONTSCALE, mkfontscale) 228]) 229 230# XORG_FONT_BDF_UTILS() 231# --------------------- 232# Minimum version: 1.1.0 233# 234# Call XORG_FONT_REQUIRED_PROG for programs needed for BDF format bitmap fonts 235# Also call XORG_FONT_CHECK_COMPRESSION to determine how to compress the 236# PCF output files created by bdftopcf 237 238AC_DEFUN([XORG_FONT_BDF_UTILS],[ 239 XORG_FONT_COMMON_UTILS 240 XORG_FONT_REQUIRED_PROG(BDFTOPCF, bdftopcf) 241 XORG_FONT_CHECK_COMPRESSION 242]) 243 244# XORG_FONT_CHECK_COMPRESSION() 245# ----------------------------- 246# Minimum version: 1.1.0 247# 248# Offer a --with-compression flag to control what compression method is 249# used for pcf font files. Offers all the methods currently supported 250# by libXfont, including no compression. 251 252AC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[ 253 AC_MSG_CHECKING([font compression method]) 254 AC_ARG_WITH(compression, 255 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>], 256 [compression method to use on pcf fonts])], 257 [compression="$withval"], [compression="yes"]) 258 if test x"$compression" = "xyes" ; then 259 compression="gzip" 260 fi 261 AC_MSG_RESULT([${compression}]) 262 case ${compression} in 263 *compress) COMPRESS_SUFFIX=".Z" ;; 264 *gzip) COMPRESS_SUFFIX=".gz" ;; 265 *bzip2) COMPRESS_SUFFIX=".bz2" ;; 266 no|none) COMPRESS_SUFFIX="" ; COMPRESS="cat" ;; 267 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;; 268 esac 269 if test x"$COMPRESS_SUFFIX" != "x" ; then 270 XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression}) 271 fi 272 AC_SUBST([COMPRESS_SUFFIX]) 273]) 274 275# XORG_FONT_UCS2ANY() 276# ------------------- 277# Minimum version: 1.1.0 278# 279# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting 280# Unicode-encoded BDF format bitmap fonts into subsets for older encodings. 281# Also call pkg-config to find the directory with the encoding files needed 282# by ucs2any, and export it as MAPFILES_PATH to the Makefiles 283 284AC_DEFUN([XORG_FONT_UCS2ANY],[ 285 AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 286 XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any) 287 PKG_CHECK_MODULES(MAPS, [fontutil]) 288 AC_MSG_CHECKING([for ucs2any encoding data files]) 289 MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil` 290 AC_SUBST(MAPFILES_PATH) 291 AC_MSG_RESULT([${MAPFILES_PATH}]) 292]) 293 294 295 296# XORG_FONT_FC_CONFDIR() 297# -------------------- 298# Minimum version: 1.2.0 299# 300# Sets FC_CONFDIR to the fontconfig config directory 301# (which should be --with-confdir=... when building fontconfig) 302# found from: 303# --with-fc-confdir=... 304# pkg-config --variable=confdir fontconfig 305# ${sysconfdir}/fonts 306 307AC_DEFUN([XORG_FONT_FC_CONFDIR],[ 308 dnl Ensure $PKG_CONFIG is set first 309 AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 310 311 AC_MSG_CHECKING([for fontconfig's configuration directory]) 312 AC_ARG_WITH(fc-confdir, 313 AS_HELP_STRING([--with-fc-confdir=DIR], 314 [Path to fontconfig's configuration directory]), 315 [FC_CONFDIR="$withval"]) 316 # if --with-fc-confdir was not specified 317 if test "x${FC_CONFDIR}" = "x"; then 318 FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig` 319 fi 320 # ...and if pkg-config didn't find confdir in fontconfig.pc... 321 if test "x${FC_CONFDIR}" = "x"; then 322 FC_CONFDIR="${sysconfdir}/fonts" 323 fi 324 AC_SUBST(FC_CONFDIR) 325 AC_MSG_RESULT([${FC_CONFDIR}]) 326]) 327 328 329 330# XORG_FONTROOTDIR() 331# -------------------- 332# Minimum version: 1.1.0 333# 334# Sets FONTROOTDIR to the root directory for font files. Uses the first 335# found from: 336# --with-fontrootdir 337# pkg-config --variable=fontrootdir fontutil 338# ${datadir}/fonts/X11 339 340AC_DEFUN([XORG_FONTROOTDIR],[ 341 dnl Ensure $PKG_CONFIG is set first 342 AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 343 344 AC_MSG_CHECKING([for root directory for font files]) 345 AC_ARG_WITH(fontrootdir, 346 AS_HELP_STRING([--with-fontrootdir=DIR], 347 [Path to root directory for font files]), 348 [FONTROOTDIR="$withval"]) 349 # if --with-fontrootdir not specified... 350 if test "x${FONTROOTDIR}" = "x"; then 351 FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil` 352 fi 353 # ...and if pkg-config didn't find fontdir in fontutil.pc... 354 if test "x${FONTROOTDIR}" = "x"; then 355 FONTROOTDIR="${datadir}/fonts/X11" 356 fi 357 AC_SUBST(FONTROOTDIR) 358 AC_MSG_RESULT([${FONTROOTDIR}]) 359]) 360 361# XORG_FONTSUBDIR(variable, flag, subdir) 362# --------------------------------------- 363# Minimum version: 1.1.0 364# 365# Offer a --with-<flag> flag to control directory for font installation 366# Default is the specified <subdir> of the font root directory. 367# Sets <variable> to the selected directory 368 369AC_DEFUN([XORG_FONTSUBDIR],[ 370 AC_REQUIRE([XORG_FONTROOTDIR]) 371 372 AC_MSG_CHECKING([for directory for $3 files]) 373 AC_ARG_WITH($2, 374 [AS_HELP_STRING([--with-$2=DIR], 375 [Path to $3 files [FONTROOTDIR/$3]])], 376 [$1="${withval}"], [$1='${FONTROOTDIR}/$3']) 377 AC_SUBST($1) 378 AC_MSG_RESULT([${$1}]) 379]) # XORG_FONTSUBDIR 380 381# XORG_FONTDIR(subdir) 382# -------------------- 383# Minimum version: 1.1.0 384# 385# Offer a --with-fontdir flag to control directory for font installation 386# Default is the specified subdir of the font root directory. 387# Sets FONTDIR to the selected directory 388 389AC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])]) 390