1dnl @configure_input@ 2dnl 3dnl This file comes from X.Org's @PACKAGE_STRING@ 4dnl 5dnl Copyright (c) 2009, 2023, Oracle and/or its affiliates. 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# 252# If COMPRESS_FLAGS is not set, and the compression method has flags needed 253# for reproducible builds, such as gzip -n to not record timestamp, will 254# set COMPRESS_FLAGS to those options. 255 256AC_DEFUN([XORG_FONT_CHECK_COMPRESSION],[ 257 AC_MSG_CHECKING([font compression method]) 258 AC_ARG_WITH(compression, 259 [AS_HELP_STRING([--with-compression=<no|compress|gzip|bzip2>], 260 [compression method to use on pcf fonts])], 261 [compression="$withval"], [compression="yes"]) 262 if test x"$compression" = "xyes" ; then 263 compression="gzip" 264 fi 265 AC_MSG_RESULT([${compression}]) 266 case ${compression} in 267 *compress) COMPRESS_SUFFIX=".Z" ;; 268 *gzip) COMPRESS_SUFFIX=".gz" ; 269 COMPRESS_FLAGS="${COMPRESS_FLAGS--n}" ;; 270 *bzip2) COMPRESS_SUFFIX=".bz2" ;; 271 no|none) COMPRESS_SUFFIX="" ; COMPRESS="cat" ;; 272 *) AC_MSG_ERROR([${compression} is not a supported compression method]) ;; 273 esac 274 if test x"$COMPRESS_SUFFIX" != "x" ; then 275 XORG_FONT_REQUIRED_PROG(COMPRESS, ${compression}) 276 fi 277 AC_MSG_CHECKING([options to font compression command]) 278 AC_MSG_RESULT([${COMPRESS_FLAGS:-none}]) 279 AC_SUBST([COMPRESS_FLAGS]) 280 AC_SUBST([COMPRESS_SUFFIX]) 281]) 282 283# XORG_FONT_UCS2ANY() 284# ------------------- 285# Minimum version: 1.1.0 286# 287# Call XORG_FONT_REQUIRED_PROG for ucs2any program needed for splitting 288# Unicode-encoded BDF format bitmap fonts into subsets for older encodings. 289# Also call pkg-config to find the directory with the encoding files needed 290# by ucs2any, and export it as MAPFILES_PATH to the Makefiles 291 292AC_DEFUN([XORG_FONT_UCS2ANY],[ 293 AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 294 XORG_FONT_REQUIRED_PROG(UCS2ANY, ucs2any) 295 PKG_CHECK_MODULES(MAPS, [fontutil]) 296 AC_MSG_CHECKING([for ucs2any encoding data files]) 297 MAPFILES_PATH=`$PKG_CONFIG --variable=mapdir fontutil` 298 AC_SUBST(MAPFILES_PATH) 299 AC_MSG_RESULT([${MAPFILES_PATH}]) 300]) 301 302 303 304# XORG_FONT_FC_CONFDIR() 305# -------------------- 306# Minimum version: 1.2.0 307# 308# Sets FC_CONFDIR to the fontconfig config directory 309# (which should be --with-confdir=... when building fontconfig) 310# found from: 311# --with-fc-confdir=... 312# pkg-config --variable=confdir fontconfig 313# ${sysconfdir}/fonts 314 315AC_DEFUN([XORG_FONT_FC_CONFDIR],[ 316 dnl Ensure $PKG_CONFIG is set first 317 AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 318 319 AC_MSG_CHECKING([for fontconfig's configuration directory]) 320 AC_ARG_WITH(fc-confdir, 321 AS_HELP_STRING([--with-fc-confdir=DIR], 322 [Path to fontconfig's configuration directory]), 323 [FC_CONFDIR="$withval"]) 324 # if --with-fc-confdir was not specified 325 if test "x${FC_CONFDIR}" = "x"; then 326 FC_CONFDIR=`$PKG_CONFIG --variable=confdir fontconfig` 327 fi 328 # ...and if pkg-config didn't find confdir in fontconfig.pc... 329 if test "x${FC_CONFDIR}" = "x"; then 330 FC_CONFDIR="${sysconfdir}/fonts" 331 fi 332 AC_SUBST(FC_CONFDIR) 333 AC_MSG_RESULT([${FC_CONFDIR}]) 334]) 335 336 337 338# XORG_FONTROOTDIR() 339# -------------------- 340# Minimum version: 1.1.0 341# 342# Sets FONTROOTDIR to the root directory for font files. Uses the first 343# found from: 344# --with-fontrootdir 345# pkg-config --variable=fontrootdir fontutil 346# ${datadir}/fonts/X11 347 348AC_DEFUN([XORG_FONTROOTDIR],[ 349 dnl Ensure $PKG_CONFIG is set first 350 AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 351 352 AC_MSG_CHECKING([for root directory for font files]) 353 AC_ARG_WITH(fontrootdir, 354 AS_HELP_STRING([--with-fontrootdir=DIR], 355 [Path to root directory for font files]), 356 [FONTROOTDIR="$withval"]) 357 # if --with-fontrootdir not specified... 358 if test "x${FONTROOTDIR}" = "x"; then 359 FONTROOTDIR=`$PKG_CONFIG --variable=fontrootdir fontutil` 360 fi 361 # ...and if pkg-config didn't find fontdir in fontutil.pc... 362 if test "x${FONTROOTDIR}" = "x"; then 363 FONTROOTDIR="${datadir}/fonts/X11" 364 fi 365 AC_SUBST(FONTROOTDIR) 366 AC_MSG_RESULT([${FONTROOTDIR}]) 367]) 368 369# XORG_FONTSUBDIR(variable, flag, subdir) 370# --------------------------------------- 371# Minimum version: 1.1.0 372# 373# Offer a --with-<flag> flag to control directory for font installation 374# Default is the specified <subdir> of the font root directory. 375# Sets <variable> to the selected directory 376 377AC_DEFUN([XORG_FONTSUBDIR],[ 378 AC_REQUIRE([XORG_FONTROOTDIR]) 379 380 AC_MSG_CHECKING([for directory for $3 files]) 381 AC_ARG_WITH($2, 382 [AS_HELP_STRING([--with-$2=DIR], 383 [Path to $3 files [FONTROOTDIR/$3]])], 384 [$1="${withval}"], [$1='${FONTROOTDIR}/$3']) 385 AC_SUBST($1) 386 AC_MSG_RESULT([${$1}]) 387]) # XORG_FONTSUBDIR 388 389# XORG_FONTDIR(subdir) 390# -------------------- 391# Minimum version: 1.1.0 392# 393# Offer a --with-fontdir flag to control directory for font installation 394# Default is the specified subdir of the font root directory. 395# Sets FONTDIR to the selected directory 396 397AC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])]) 398