1# Copyright © 2003 Keith Packard 2# 3# Permission to use, copy, modify, distribute, and sell this software and its 4# documentation for any purpose is hereby granted without fee, provided that 5# the above copyright notice appear in all copies and that both that 6# copyright notice and this permission notice appear in supporting 7# documentation, and that the name of Keith Packard not be used in 8# advertising or publicity pertaining to distribution of the software without 9# specific, written prior permission. Keith Packard makes no 10# representations about the suitability of this software for any purpose. It 11# is provided "as is" without express or implied warranty. 12# 13# KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 14# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 15# EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR 16# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 17# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 18# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 19# PERFORMANCE OF THIS SOFTWARE. 20# 21 22# Initialize Autoconf 23AC_PREREQ([2.60]) 24AC_INIT([libXfont], [1.5.4], 25 [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXfont]) 26AC_CONFIG_SRCDIR([Makefile.am]) 27AC_CONFIG_HEADERS([config.h include/X11/fonts/fontconf.h]) 28 29# Initialize Automake 30AM_INIT_AUTOMAKE([foreign dist-bzip2]) 31 32# Set common system defines for POSIX extensions, such as _GNU_SOURCE 33# Must be called before any macros that run the compiler (like 34# AC_PROG_LIBTOOL) to avoid autoconf errors. 35AC_USE_SYSTEM_EXTENSIONS 36 37# Initialize libtool 38AC_PROG_LIBTOOL 39 40# Require xorg-macros minimum of 1.10 for DocBook XML documentation 41m4_ifndef([XORG_MACROS_VERSION], 42 [m4_fatal([must install xorg-macros 1.10 or later before running autoconf/autogen])]) 43XORG_MACROS_VERSION(1.10) 44XORG_DEFAULT_OPTIONS 45XORG_ENABLE_DEVEL_DOCS 46XORG_WITH_XMLTO(0.0.22) 47XORG_WITH_FOP 48XORG_CHECK_SGML_DOCTOOLS(1.7) 49 50# Checks for header files. 51AC_CHECK_HEADERS([endian.h poll.h sys/poll.h]) 52 53# Checks for library functions. 54AC_CHECK_FUNCS([poll readlink]) 55 56# If the first PKG_CHECK_MODULES appears inside a conditional, pkg-config 57# must first be located explicitly. 58PKG_PROG_PKG_CONFIG 59 60# 61# select libraries to include 62# 63 64XFONT_FONTFILE=no 65 66# 67# FreeType for all scalable (OpenType, TrueType, PostScript) and 68# some bitmap formats (BDF & PCF) 69# 70AC_ARG_ENABLE(freetype, 71 AS_HELP_STRING([--disable-freetype], 72 [Build freetype backend (default: enabled)]), 73 [XFONT_FREETYPE=$enableval],[XFONT_FREETYPE=yes]) 74AM_CONDITIONAL(XFONT_FREETYPE, [test x$XFONT_FREETYPE = xyes]) 75if test x$XFONT_FREETYPE = xyes; then 76 AC_DEFINE(XFONT_FREETYPE,1,[Support FreeType rasterizer for nearly all font file formats]) 77 AC_ARG_WITH(freetype-config, 78 AS_HELP_STRING([--with-freetype-config=PROG], 79 [Use FreeType configuration program PROG]), 80 [freetype_config=$withval], [freetype_config=auto]) 81 82 if test "$freetype_config" = "auto" ; then 83 PKG_CHECK_MODULES(FREETYPE, freetype2, 84 freetype_config=no, freetype_config=yes) 85 fi 86 87 if test "$freetype_config" = "yes"; then 88 AC_PATH_PROG(ft_config,freetype-config,no) 89 if test "$ft_config" = "no"; then 90 AC_MSG_ERROR([You must have freetype installed; see http://www.freetype.org/]) 91 fi 92 else 93 ft_config="$freetype_config" 94 fi 95 96 if test "$freetype_config" != "no"; then 97 FREETYPE_CFLAGS="`$ft_config --cflags`" 98 FREETYPE_LIBS="`$ft_config --libs`" 99 fi 100 FREETYPE_REQUIRES="freetype2" 101 XFONT_FONTFILE=yes 102else 103 FREETYPE_CFLAGS="" 104 FREETYPE_LIBS="" 105 FREETYPE_REQUIRES="" 106fi 107AC_SUBST(FREETYPE_LIBS) 108AC_SUBST(FREETYPE_CFLAGS) 109AC_SUBST(FREETYPE_REQUIRES) 110 111# 112# Bitmap fonts in files: 113# Builtins (gzipped pcf format in .text segment) 114# PCF 115# BDF 116# SNF 117# 118 119AC_DEFINE(X_GZIP_FONT_COMPRESSION,1,[Support gzip for bitmap fonts]) 120X_GZIP_FONT_COMPRESSION=1 121AC_SUBST(X_GZIP_FONT_COMPRESSION) 122AC_CHECK_LIB(z, gzopen, [Z_LIBS=-lz], AC_MSG_ERROR([*** zlib is required])) 123 124AC_ARG_WITH(bzip2, 125 AS_HELP_STRING([--with-bzip2], 126 [Use libbz2 to support bzip2 compressed bitmap fonts (default: no)]), 127 [], [with_bzip2=no]) 128if test "x$with_bzip2" = xyes; then 129 AC_CHECK_LIB(bz2, BZ2_bzopen, [Z_LIBS="$Z_LIBS -lbz2"], 130 AC_MSG_ERROR([*** libbz2 is required for bzip2 support])) 131 AC_DEFINE(X_BZIP2_FONT_COMPRESSION,1,[Support bzip2 for bitmap fonts]) 132fi 133AM_CONDITIONAL(X_BZIP2_FONT_COMPRESSION, [test "x$with_bzip2" = xyes ]) 134AC_SUBST(Z_LIBS) 135 136AC_ARG_ENABLE(builtins, 137 AS_HELP_STRING([--disable-builtins], 138 [Support builtin fonts (default: enabled)]), 139 [XFONT_BUILTINS=$enableval], [XFONT_BUILTINS=yes]) 140AM_CONDITIONAL(XFONT_BUILTINS, [test "x$XFONT_BUILTINS" = xyes ]) 141if test "x$XFONT_BUILTINS" = xyes; then 142 AC_DEFINE(XFONT_BUILTINS,1,[Support built-in fonts]) 143 XFONT_BITMAP=yes 144fi 145 146AC_ARG_ENABLE(pcfformat, 147 AS_HELP_STRING([--disable-pcfformat], 148 [Support PCF format bitmap fonts (default: enabled)]), 149 [XFONT_PCFFORMAT=$enableval], [XFONT_PCFFORMAT=yes]) 150AM_CONDITIONAL(XFONT_PCFFORMAT, [test "x$XFONT_PCFFORMAT" = xyes]) 151if test "x$XFONT_PCFFORMAT" = xyes; then 152 AC_DEFINE(XFONT_PCFFORMAT,1,[Support pcf format bitmap font files]) 153 XFONT_BITMAP=yes 154fi 155 156AM_CONDITIONAL(XFONT_PCF_OR_BUILTIN, 157 [test "x$XFONT_PCFFORMAT" = xyes -o "x$XFONT_BUILTINS" = xyes]) 158 159AC_ARG_ENABLE(bdfformat, 160 AS_HELP_STRING([--disable-bdfformat], 161 [Support BDF format bitmap fonts (default: enabled)]), 162 [XFONT_BDFFORMAT=$enableval], [XFONT_BDFFORMAT=yes]) 163AM_CONDITIONAL(XFONT_BDFFORMAT, [test "x$XFONT_BDFFORMAT" = xyes]) 164if test "x$XFONT_BDFFORMAT" = xyes; then 165 AC_DEFINE(XFONT_BDFFORMAT,1,[Support bdf format bitmap font files]) 166 XFONT_BITMAP=yes 167fi 168 169AC_ARG_ENABLE(snfformat, 170 AS_HELP_STRING([--enable-snfformat], 171 [Support SNF format bitmap fonts (default: disabled)]), 172 [XFONT_SNFFORMAT=$enableval], [XFONT_SNFFORMAT=no]) 173AM_CONDITIONAL(XFONT_SNFFORMAT, [test "x$XFONT_SNFFORMAT" = xyes]) 174if test "x$XFONT_SNFFORMAT" = xyes; then 175 AC_DEFINE(XFONT_SNFFORMAT,1,[Support snf format bitmap font files]) 176 XFONT_BITMAP=yes 177fi 178 179AM_CONDITIONAL(XFONT_BITMAP, [test "x$XFONT_BITMAP" = xyes ]) 180if test "x$XFONT_BITMAP" = xyes; then 181 AC_DEFINE(XFONT_BITMAP,1,[Support bitmap font files]) 182 XFONT_FONTFILE=yes 183fi 184 185AM_CONDITIONAL(XFONT_FONTFILE, [test "x$XFONT_FONTFILE" = xyes]) 186if test "x$XFONT_FONTFILE" = xyes; then 187 AC_DEFINE(XFONT_FONTFILE,1,[Support fonts in files]) 188fi 189 190# 191# Support connection to font servers? 192# 193 194AC_ARG_ENABLE(fc, 195 AS_HELP_STRING([--disable-fc], 196 [Support connections to xfs servers (default: enabled)]), 197 [XFONT_FC=$enableval],[XFONT_FC=yes]) 198AM_CONDITIONAL(XFONT_FC, [test "x$XFONT_FC" = xyes]) 199if test "x$XFONT_FC" = xyes; then 200 AC_DEFINE(XFONT_FC,1,[Support the X Font Services Protocol]) 201fi 202 203 204AC_CHECK_LIB(m, hypot, [MATH_LIBS=-lm 205AC_SUBST(MATH_LIBS)], AC_MSG_ERROR([*** libm is required])) 206 207PKG_CHECK_MODULES(XFONT, [xproto xtrans fontsproto >= 2.1.3 fontenc]) 208 209# Transport selection macro from xtrans.m4 210XTRANS_CONNECTION_FLAGS 211 212case $host_os in 213 linux*) 214 OS_CFLAGS="-D_XOPEN_SOURCE" 215 ;; 216 *) 217 OS_CFLAGS= 218 ;; 219esac 220AC_SUBST([OS_CFLAGS]) 221 222AC_CONFIG_FILES([Makefile 223 doc/Makefile 224 src/Makefile 225 src/fontfile/Makefile 226 src/FreeType/Makefile 227 src/builtins/Makefile 228 src/bitmap/Makefile 229 src/fc/Makefile 230 src/util/Makefile 231 src/stubs/Makefile 232 xfont.pc]) 233AC_OUTPUT 234