1a96d7823Smrg# Copyright © 2003 Keith Packard 2a96d7823Smrg# 3a96d7823Smrg# Permission to use, copy, modify, distribute, and sell this software and its 4a96d7823Smrg# documentation for any purpose is hereby granted without fee, provided that 5a96d7823Smrg# the above copyright notice appear in all copies and that both that 6a96d7823Smrg# copyright notice and this permission notice appear in supporting 7a96d7823Smrg# documentation, and that the name of Keith Packard not be used in 8a96d7823Smrg# advertising or publicity pertaining to distribution of the software without 9a96d7823Smrg# specific, written prior permission. Keith Packard makes no 10a96d7823Smrg# representations about the suitability of this software for any purpose. It 11a96d7823Smrg# is provided "as is" without express or implied warranty. 12a96d7823Smrg# 13a96d7823Smrg# KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 14a96d7823Smrg# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 15a96d7823Smrg# EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR 16a96d7823Smrg# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 17a96d7823Smrg# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 18a96d7823Smrg# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 19a96d7823Smrg# PERFORMANCE OF THIS SOFTWARE. 20a96d7823Smrg# 21a96d7823Smrg 22a96d7823Smrg# Initialize Autoconf 236a46240fSmrgAC_PREREQ([2.70]) 246a46240fSmrgAC_INIT([libXfont2], [2.0.7], 259c9cb266Smrg [https://gitlab.freedesktop.org/xorg/lib/libxfont/-/issues], [libXfont2]) 26a96d7823SmrgAC_CONFIG_SRCDIR([Makefile.am]) 27a96d7823SmrgAC_CONFIG_HEADERS([config.h]) 286a46240fSmrgAC_CONFIG_MACRO_DIRS([m4]) 29a96d7823Smrg 30a96d7823Smrg# Initialize Automake 319c9cb266SmrgAM_INIT_AUTOMAKE([foreign dist-xz subdir-objects]) 32a96d7823Smrg 33a96d7823Smrg# Set common system defines for POSIX extensions, such as _GNU_SOURCE 34a96d7823Smrg# Must be called before any macros that run the compiler (like 356a46240fSmrg# LT_INIT) to avoid autoconf errors. 36a96d7823SmrgAC_USE_SYSTEM_EXTENSIONS 37a96d7823Smrg 38a96d7823Smrg# Initialize libtool 396a46240fSmrgLT_INIT 40a96d7823Smrg 41a96d7823Smrg# Require xorg-macros minimum of 1.10 for DocBook XML documentation 42a96d7823Smrgm4_ifndef([XORG_MACROS_VERSION], 43a96d7823Smrg [m4_fatal([must install xorg-macros 1.10 or later before running autoconf/autogen])]) 44a96d7823SmrgXORG_MACROS_VERSION(1.10) 45a96d7823SmrgXORG_DEFAULT_OPTIONS 46a96d7823SmrgXORG_ENABLE_DEVEL_DOCS 47a96d7823SmrgXORG_WITH_XMLTO(0.0.22) 48a96d7823SmrgXORG_WITH_FOP 49a96d7823SmrgXORG_CHECK_SGML_DOCTOOLS(1.7) 50a96d7823Smrg 51a96d7823Smrg# Checks for header files. 52a96d7823SmrgAC_CHECK_HEADERS([endian.h poll.h sys/poll.h]) 53a96d7823Smrg 546a46240fSmrg# Checks for non-standard functions and fallback to libbsd if we can 556a46240fSmrgAC_LINK_IFELSE([AC_LANG_CALL([], [reallocarray])], 566a46240fSmrg [TRY_LIBBSD="no"], [TRY_LIBBSD="yes"]) 576a46240fSmrgAC_LINK_IFELSE([AC_LANG_CALL([], [strlcat])], 586a46240fSmrg [TRY_LIBBSD="no"], [TRY_LIBBSD="yes"]) 596a46240fSmrgAS_IF([test "x$TRY_LIBBSD" = "xyes"], 606a46240fSmrg [PKG_CHECK_MODULES([LIBBSD], [libbsd-overlay], [ 616a46240fSmrg CFLAGS="$CFLAGS $LIBBSD_CFLAGS" 626a46240fSmrg LIBS="$LIBS $LIBBSD_LIBS" 636a46240fSmrg], [:])]) 646a46240fSmrg 65a96d7823Smrg# Checks for library functions. 666a46240fSmrgAC_CHECK_FUNCS([poll readlink strlcat]) 67c7b4381aSmrgAC_CONFIG_LIBOBJ_DIR([src/util]) 6860da515cSmrgAC_REPLACE_FUNCS([reallocarray realpath strlcat strlcpy]) 6960da515cSmrg 706a46240fSmrg# Checks for header files. 716a46240fSmrgAC_CHECK_HEADERS([err.h float.h]) 72a96d7823Smrg 736a46240fSmrg# Checks for typedefs, structures, and compiler characteristics. 746a46240fSmrgAC_SYS_LARGEFILE 75a96d7823Smrg 76a96d7823Smrg# 77a96d7823Smrg# select libraries to include 78a96d7823Smrg# 79a96d7823Smrg 80a96d7823SmrgXFONT_FONTFILE=no 81a96d7823Smrg 82a96d7823Smrg# 83a96d7823Smrg# FreeType for all scalable (OpenType, TrueType, PostScript) and 84a96d7823Smrg# some bitmap formats (BDF & PCF) 85a96d7823Smrg# 86a96d7823SmrgAC_ARG_ENABLE(freetype, 87a96d7823Smrg AS_HELP_STRING([--disable-freetype], 88a96d7823Smrg [Build freetype backend (default: enabled)]), 89a96d7823Smrg [XFONT_FREETYPE=$enableval],[XFONT_FREETYPE=yes]) 90a96d7823SmrgAM_CONDITIONAL(XFONT_FREETYPE, [test x$XFONT_FREETYPE = xyes]) 91a96d7823Smrgif test x$XFONT_FREETYPE = xyes; then 92a96d7823Smrg AC_DEFINE(XFONT_FREETYPE,1,[Support FreeType rasterizer for nearly all font file formats]) 93a96d7823Smrg AC_ARG_WITH(freetype-config, 94a96d7823Smrg AS_HELP_STRING([--with-freetype-config=PROG], 95a96d7823Smrg [Use FreeType configuration program PROG]), 96a96d7823Smrg [freetype_config=$withval], [freetype_config=auto]) 97a96d7823Smrg 98a96d7823Smrg if test "$freetype_config" = "auto" ; then 99a96d7823Smrg PKG_CHECK_MODULES(FREETYPE, freetype2, 100a96d7823Smrg freetype_config=no, freetype_config=yes) 101a96d7823Smrg fi 102a96d7823Smrg 103a96d7823Smrg if test "$freetype_config" = "yes"; then 104a96d7823Smrg AC_PATH_PROG(ft_config,freetype-config,no) 105a96d7823Smrg if test "$ft_config" = "no"; then 106a96d7823Smrg AC_MSG_ERROR([You must have freetype installed; see http://www.freetype.org/]) 107a96d7823Smrg fi 108a96d7823Smrg else 109a96d7823Smrg ft_config="$freetype_config" 110a96d7823Smrg fi 111a96d7823Smrg 112a96d7823Smrg if test "$freetype_config" != "no"; then 113a96d7823Smrg FREETYPE_CFLAGS="`$ft_config --cflags`" 114a96d7823Smrg FREETYPE_LIBS="`$ft_config --libs`" 115a96d7823Smrg fi 116a96d7823Smrg FREETYPE_REQUIRES="freetype2" 117a96d7823Smrg XFONT_FONTFILE=yes 118a96d7823Smrgelse 119a96d7823Smrg FREETYPE_CFLAGS="" 120a96d7823Smrg FREETYPE_LIBS="" 121a96d7823Smrg FREETYPE_REQUIRES="" 122a96d7823Smrgfi 123a96d7823SmrgAC_SUBST(FREETYPE_LIBS) 124a96d7823SmrgAC_SUBST(FREETYPE_CFLAGS) 125a96d7823SmrgAC_SUBST(FREETYPE_REQUIRES) 126a96d7823Smrg 127a96d7823Smrg# 128a96d7823Smrg# Bitmap fonts in files: 129a96d7823Smrg# Builtins (gzipped pcf format in .text segment) 130a96d7823Smrg# PCF 131a96d7823Smrg# BDF 132a96d7823Smrg# SNF 133a96d7823Smrg# 134a96d7823Smrg 135a96d7823SmrgAC_DEFINE(X_GZIP_FONT_COMPRESSION,1,[Support gzip for bitmap fonts]) 136a96d7823SmrgX_GZIP_FONT_COMPRESSION=1 137a96d7823SmrgAC_SUBST(X_GZIP_FONT_COMPRESSION) 1389c9cb266SmrgPKG_CHECK_MODULES(ZLIB, [zlib], [Z_REQUIRES=zlib], [Z_REQUIRES=""]) 1399c9cb266Smrgif test "x$Z_REQUIRES" = "x"; then 1409c9cb266Smrg AC_CHECK_LIB(z, gzopen, [Z_LIBS=-lz], 1419c9cb266Smrg AC_MSG_ERROR([*** zlib is required])) 1429c9cb266Smrgfi 1439c9cb266SmrgAC_SUBST(Z_REQUIRES) 144a96d7823Smrg 145a96d7823SmrgAC_ARG_WITH(bzip2, 146a96d7823Smrg AS_HELP_STRING([--with-bzip2], 147a96d7823Smrg [Use libbz2 to support bzip2 compressed bitmap fonts (default: no)]), 148a96d7823Smrg [], [with_bzip2=no]) 149a96d7823Smrgif test "x$with_bzip2" = xyes; then 150a96d7823Smrg AC_CHECK_LIB(bz2, BZ2_bzopen, [Z_LIBS="$Z_LIBS -lbz2"], 151a96d7823Smrg AC_MSG_ERROR([*** libbz2 is required for bzip2 support])) 152a96d7823Smrg AC_DEFINE(X_BZIP2_FONT_COMPRESSION,1,[Support bzip2 for bitmap fonts]) 153a96d7823Smrgfi 154a96d7823SmrgAM_CONDITIONAL(X_BZIP2_FONT_COMPRESSION, [test "x$with_bzip2" = xyes ]) 155a96d7823SmrgAC_SUBST(Z_LIBS) 156a96d7823Smrg 157a96d7823SmrgAC_ARG_ENABLE(builtins, 158a96d7823Smrg AS_HELP_STRING([--disable-builtins], 159a96d7823Smrg [Support builtin fonts (default: enabled)]), 160a96d7823Smrg [XFONT_BUILTINS=$enableval], [XFONT_BUILTINS=yes]) 161a96d7823SmrgAM_CONDITIONAL(XFONT_BUILTINS, [test "x$XFONT_BUILTINS" = xyes ]) 162a96d7823Smrgif test "x$XFONT_BUILTINS" = xyes; then 163a96d7823Smrg AC_DEFINE(XFONT_BUILTINS,1,[Support built-in fonts]) 164a96d7823Smrg XFONT_BITMAP=yes 165a96d7823Smrgfi 166a96d7823Smrg 167a96d7823SmrgAC_ARG_ENABLE(pcfformat, 168a96d7823Smrg AS_HELP_STRING([--disable-pcfformat], 169a96d7823Smrg [Support PCF format bitmap fonts (default: enabled)]), 170a96d7823Smrg [XFONT_PCFFORMAT=$enableval], [XFONT_PCFFORMAT=yes]) 171a96d7823SmrgAM_CONDITIONAL(XFONT_PCFFORMAT, [test "x$XFONT_PCFFORMAT" = xyes]) 172a96d7823Smrgif test "x$XFONT_PCFFORMAT" = xyes; then 173a96d7823Smrg AC_DEFINE(XFONT_PCFFORMAT,1,[Support pcf format bitmap font files]) 174a96d7823Smrg XFONT_BITMAP=yes 175a96d7823Smrgfi 176a96d7823Smrg 177a96d7823SmrgAM_CONDITIONAL(XFONT_PCF_OR_BUILTIN, 178a96d7823Smrg [test "x$XFONT_PCFFORMAT" = xyes -o "x$XFONT_BUILTINS" = xyes]) 179a96d7823Smrg 180a96d7823SmrgAC_ARG_ENABLE(bdfformat, 181a96d7823Smrg AS_HELP_STRING([--disable-bdfformat], 182a96d7823Smrg [Support BDF format bitmap fonts (default: enabled)]), 183a96d7823Smrg [XFONT_BDFFORMAT=$enableval], [XFONT_BDFFORMAT=yes]) 184a96d7823SmrgAM_CONDITIONAL(XFONT_BDFFORMAT, [test "x$XFONT_BDFFORMAT" = xyes]) 185a96d7823Smrgif test "x$XFONT_BDFFORMAT" = xyes; then 186a96d7823Smrg AC_DEFINE(XFONT_BDFFORMAT,1,[Support bdf format bitmap font files]) 187a96d7823Smrg XFONT_BITMAP=yes 188a96d7823Smrgfi 189a96d7823Smrg 190a96d7823SmrgAC_ARG_ENABLE(snfformat, 191a96d7823Smrg AS_HELP_STRING([--enable-snfformat], 192a96d7823Smrg [Support SNF format bitmap fonts (default: disabled)]), 193a96d7823Smrg [XFONT_SNFFORMAT=$enableval], [XFONT_SNFFORMAT=no]) 194a96d7823SmrgAM_CONDITIONAL(XFONT_SNFFORMAT, [test "x$XFONT_SNFFORMAT" = xyes]) 195a96d7823Smrgif test "x$XFONT_SNFFORMAT" = xyes; then 196a96d7823Smrg AC_DEFINE(XFONT_SNFFORMAT,1,[Support snf format bitmap font files]) 197a96d7823Smrg XFONT_BITMAP=yes 198a96d7823Smrgfi 199a96d7823Smrg 200a96d7823SmrgAM_CONDITIONAL(XFONT_BITMAP, [test "x$XFONT_BITMAP" = xyes ]) 201a96d7823Smrgif test "x$XFONT_BITMAP" = xyes; then 202a96d7823Smrg AC_DEFINE(XFONT_BITMAP,1,[Support bitmap font files]) 203a96d7823Smrg XFONT_FONTFILE=yes 204a96d7823Smrgfi 205a96d7823Smrg 206a96d7823SmrgAM_CONDITIONAL(XFONT_FONTFILE, [test "x$XFONT_FONTFILE" = xyes]) 207a96d7823Smrgif test "x$XFONT_FONTFILE" = xyes; then 208a96d7823Smrg AC_DEFINE(XFONT_FONTFILE,1,[Support fonts in files]) 209a96d7823Smrgfi 210a96d7823Smrg 211a96d7823Smrg# 212a96d7823Smrg# Support connection to font servers? 213a96d7823Smrg# 214a96d7823Smrg 215a96d7823SmrgAC_ARG_ENABLE(fc, 216a96d7823Smrg AS_HELP_STRING([--disable-fc], 217a96d7823Smrg [Support connections to xfs servers (default: enabled)]), 218a96d7823Smrg [XFONT_FC=$enableval],[XFONT_FC=yes]) 219a96d7823SmrgAM_CONDITIONAL(XFONT_FC, [test "x$XFONT_FC" = xyes]) 220a96d7823Smrgif test "x$XFONT_FC" = xyes; then 221a96d7823Smrg AC_DEFINE(XFONT_FC,1,[Support the X Font Services Protocol]) 222a96d7823Smrgfi 223a96d7823Smrg 224a96d7823Smrg 225a96d7823SmrgAC_CHECK_LIB(m, hypot, [MATH_LIBS=-lm 226a96d7823SmrgAC_SUBST(MATH_LIBS)], AC_MSG_ERROR([*** libm is required])) 227a96d7823Smrg 228a96d7823SmrgPKG_CHECK_MODULES(XFONT, [xproto xtrans fontsproto >= 2.1.3 fontenc]) 229a96d7823Smrg 230a96d7823Smrg# Transport selection macro from xtrans.m4 231a96d7823SmrgXTRANS_CONNECTION_FLAGS 232a96d7823Smrg 233a96d7823Smrgcase $host_os in 234a96d7823Smrg linux*) 235a96d7823Smrg OS_CFLAGS="-D_XOPEN_SOURCE" 236a96d7823Smrg ;; 237a96d7823Smrg *) 238a96d7823Smrg OS_CFLAGS= 239a96d7823Smrg ;; 240a96d7823Smrgesac 241fd60135fSmrg 242fd60135fSmrgsave_CFLAGS="$CFLAGS" 243fd60135fSmrgCFLAGS="$CFLAGS -fvisibility=hidden" 244fd60135fSmrgCFLAGS_VISIBILITY= 245fd60135fSmrgAC_COMPILE_IFELSE( 246fd60135fSmrg [AC_LANG_SOURCE([[ 247fd60135fSmrg #if defined(__CYGWIN__) || defined(__MINGW32__) 248fd60135fSmrg #error No visibility support 249fd60135fSmrg #endif 250fd60135fSmrg extern __attribute__((__visibility__("default"))) int x; 251fd60135fSmrg ]])], 252fd60135fSmrg [CFLAGS_VISIBILITY=-fvisibility=hidden], 253fd60135fSmrg [] 254fd60135fSmrg) 255fd60135fSmrgCFLAGS="$save_CFLAGS" 256fd60135fSmrgOS_CFLAGS="$OS_CFLAGS $CFLAGS_VISIBILITY" 257a96d7823Smrg 258a96d7823SmrgAC_SUBST([OS_CFLAGS]) 259a96d7823Smrg 260a96d7823SmrgAC_CONFIG_FILES([Makefile 261a96d7823Smrg doc/Makefile 262a96d7823Smrg xfont2.pc]) 263a96d7823SmrgAC_OUTPUT 264