configure.ac 6.69 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#  Copyright © 2003 Keith Packard
#
#  Permission to use, copy, modify, distribute, and sell this software and its
#  documentation for any purpose is hereby granted without fee, provided that
#  the above copyright notice appear in all copies and that both that
#  copyright notice and this permission notice appear in supporting
#  documentation, and that the name of Keith Packard not be used in
#  advertising or publicity pertaining to distribution of the software without
#  specific, written prior permission.  Keith Packard makes no
#  representations about the suitability of this software for any purpose.  It
#  is provided "as is" without express or implied warranty.
#
#  KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
#  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
#  EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
#  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
#  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
#  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
#  PERFORMANCE OF THIS SOFTWARE.
#
Josh Triplett's avatar
Josh Triplett committed
21

22
# Initialize Autoconf
23
AC_PREREQ([2.60])
24 25 26 27 28 29
#
# This is the package version number, not the shared library
# version.  This same version number must appear in Xfont.h
# Yes, it is a pain to synchronize version numbers.  Unfortunately, it's
# not possible to extract the version number here from Xfont.h
#
Matthieu Herrb's avatar
Matthieu Herrb committed
30
AC_INIT([libXfont], [1.4.4],
31 32
	[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXfont])
AC_CONFIG_SRCDIR([Makefile.am])
33
AC_CONFIG_HEADERS([config.h include/X11/fonts/fontconf.h])
34 35

# Initialize Automake
Josh Triplett's avatar
Josh Triplett committed
36
AM_INIT_AUTOMAKE([foreign dist-bzip2])
37
AM_MAINTAINER_MODE
Josh Triplett's avatar
Josh Triplett committed
38

39 40 41
# Initialize libtool
AC_PROG_LIBTOOL

42
# Require xorg-macros minimum of 1.10 for DocBook XML documentation
43
m4_ifndef([XORG_MACROS_VERSION],
44 45
          [m4_fatal([must install xorg-macros 1.10 or later before running autoconf/autogen])])
XORG_MACROS_VERSION(1.10)
46
XORG_DEFAULT_OPTIONS
47
XORG_ENABLE_DEVEL_DOCS
48
XORG_WITH_XMLTO(0.0.22)
49
XORG_WITH_FOP
50
XORG_CHECK_SGML_DOCTOOLS(1.7)
51

52
# Checks for header files.
53
AC_CHECK_HEADERS([endian.h poll.h sys/poll.h])
54 55

# Checks for library functions.
56
AC_CHECK_FUNCS([poll])
Josh Triplett's avatar
Josh Triplett committed
57

58 59 60 61
# If the first PKG_CHECK_MODULES appears inside a conditional, pkg-config
# must first be located explicitly.
PKG_PROG_PKG_CONFIG

Josh Triplett's avatar
Josh Triplett committed
62 63 64 65
#
# select libraries to include
#

66 67 68 69 70 71 72 73
XFONT_FONTFILE=no

#
# Scalable fonts in files:
# 	FreeType
#	Bitstream Speedo rasterizer
#
AC_ARG_ENABLE(freetype, [ --disable-freetype],[XFONT_FREETYPE=$enableval],[XFONT_FREETYPE=yes])
Josh Triplett's avatar
Josh Triplett committed
74 75
AM_CONDITIONAL(XFONT_FREETYPE, [test x$XFONT_FREETYPE = xyes])
if 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, [  --with-freetype-config=PROG   Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=auto)
Josh Triplett's avatar
Josh Triplett committed
78
	
79 80 81 82 83
	if test "$freetype_config" = "auto" ; then
		PKG_CHECK_MODULES(FREETYPE, freetype2, 
			freetype_config=no, freetype_config=yes)
	fi

Josh Triplett's avatar
Josh Triplett committed
84 85 86 87 88 89 90 91
	if test "$freetype_config" = "yes"; then 
		AC_PATH_PROG(ft_config,freetype-config,no)
		if test "$ft_config" = "no"; then
			AC_MSG_ERROR([You must have freetype installed; see http://www.freetype.org/])
		fi
	else
		ft_config="$freetype_config"
	fi
92 93 94 95 96

	if test "$freetype_config" != "no"; then 	
		FREETYPE_CFLAGS="`$ft_config --cflags`"
		FREETYPE_LIBS="`$ft_config --libs`"
	fi
97
	FREETYPE_REQUIRES="freetype2"
98
	XFONT_FONTFILE=yes
Josh Triplett's avatar
Josh Triplett committed
99 100 101
else
	FREETYPE_CFLAGS=""
	FREETYPE_LIBS=""
102
	FREETYPE_REQUIRES=""
Josh Triplett's avatar
Josh Triplett committed
103 104 105
fi
AC_SUBST(FREETYPE_LIBS)
AC_SUBST(FREETYPE_CFLAGS)
106
AC_SUBST(FREETYPE_REQUIRES)
Josh Triplett's avatar
Josh Triplett committed
107

108 109 110 111 112 113 114 115 116 117 118
#
# Bitmap fonts in files:
#	Builtins (gzipped pcf format in .text segment)
#	PCF
#	BDF
#	SNF
#

AC_DEFINE(X_GZIP_FONT_COMPRESSION,1,[Support gzip for bitmap fonts])
X_GZIP_FONT_COMPRESSION=1
AC_SUBST(X_GZIP_FONT_COMPRESSION)
119 120 121 122 123 124 125 126 127 128 129 130 131
AC_CHECK_LIB(z, gzopen, [Z_LIBS=-lz], AC_MSG_ERROR([*** zlib is required]))

AC_ARG_WITH(bzip2, 
	AS_HELP_STRING([--with-bzip2], 
			[Support bzip2 compressed bitmap fonts]),
	[], [with_bzip2=no])
if test "x$with_bzip2" = xyes; then
	AC_CHECK_LIB(bz2, BZ2_bzopen, [Z_LIBS="$Z_LIBS -lbz2"],
		AC_MSG_ERROR([*** libbz2 is required for bzip2 support]))
	AC_DEFINE(X_BZIP2_FONT_COMPRESSION,1,[Support bzip2 for bitmap fonts])
fi
AM_CONDITIONAL(X_BZIP2_FONT_COMPRESSION, [test "x$with_bzip2" = xyes ])
AC_SUBST(Z_LIBS)
132

Josh Triplett's avatar
Josh Triplett committed
133 134 135 136
AC_ARG_ENABLE(builtins, [ --disable-builtins ], [XFONT_BUILTINS=$enableval], [XFONT_BUILTINS=yes])
AM_CONDITIONAL(XFONT_BUILTINS, [test "x$XFONT_BUILTINS" = xyes ])
if test "x$XFONT_BUILTINS" = xyes; then
	AC_DEFINE(XFONT_BUILTINS,1,[Support built-in fonts])
137
	XFONT_BITMAP=yes
Josh Triplett's avatar
Josh Triplett committed
138 139
fi

140 141
AC_ARG_ENABLE(pcfformat, [ --disable-pcfformat ], [XFONT_PCFFORMAT=$enableval], [XFONT_PCFFORMAT=yes])
AM_CONDITIONAL(XFONT_PCFFORMAT, [test "x$XFONT_PCFFORMAT" = xyes])
142
if test "x$XFONT_PCFFORMAT" = xyes; then
143 144
	AC_DEFINE(XFONT_PCFFORMAT,1,[Support pcf format bitmap font files])
	XFONT_BITMAP=yes
Josh Triplett's avatar
Josh Triplett committed
145 146
fi

147 148
AC_ARG_ENABLE(bdfformat, [ --disable-bdfformat ], [XFONT_BDFFORMAT=$enableval], [XFONT_BDFFORMAT=yes])
AM_CONDITIONAL(XFONT_BDFFORMAT, [test "x$XFONT_BDFFORMAT" = xyes])
149
if test "x$XFONT_BDFFORMAT" = xyes; then
150 151
	AC_DEFINE(XFONT_BDFFORMAT,1,[Support bdf format bitmap font files])
	XFONT_BITMAP=yes
152 153
fi

154 155
AC_ARG_ENABLE(snfformat, [ --disable-snfformat ], [XFONT_SNFFORMAT=$enableval], [XFONT_SNFFORMAT=yes])
AM_CONDITIONAL(XFONT_SNFFORMAT, [test "x$XFONT_SNFFORMAT" = xyes])
156
if test "x$XFONT_SNFFORMAT" = xyes; then
157 158
	AC_DEFINE(XFONT_SNFFORMAT,1,[Support snf format bitmap font files])
	XFONT_BITMAP=yes
159 160
fi

161 162 163
AM_CONDITIONAL(XFONT_BITMAP, [test "x$XFONT_BITMAP" = xyes ])
if test "x$XFONT_BITMAP" = xyes; then
	AC_DEFINE(XFONT_BITMAP,1,[Support bitmap font files])
Josh Triplett's avatar
Josh Triplett committed
164 165
	XFONT_FONTFILE=yes
fi
166

Josh Triplett's avatar
Josh Triplett committed
167 168
AM_CONDITIONAL(XFONT_FONTFILE, [test "x$XFONT_FONTFILE" = xyes])
if test "x$XFONT_FONTFILE" = xyes; then
169
	AC_DEFINE(XFONT_FONTFILE,1,[Support fonts in files])
Josh Triplett's avatar
Josh Triplett committed
170 171
fi

172 173 174 175 176 177 178 179 180 181
#
# Support connection to font servers?
#

AC_ARG_ENABLE(fc, [ --disable-fc ],[XFONT_FC=$enableval],[XFONT_FC=yes])
AM_CONDITIONAL(XFONT_FC, [test "x$XFONT_FC" = xyes])
if test "x$XFONT_FC" = xyes; then
	AC_DEFINE(XFONT_FC,1,[Support the X Font Services Protocol])
fi

Josh Triplett's avatar
Josh Triplett committed
182 183 184 185

AC_CHECK_LIB(m, hypot, [MATH_LIBS=-lm
AC_SUBST(MATH_LIBS)], AC_MSG_ERROR([*** libm is required]))

186
PKG_CHECK_MODULES(XFONT, xproto xtrans fontsproto fontenc)
Josh Triplett's avatar
Josh Triplett committed
187

188 189 190
# Transport selection macro from xtrans.m4
XTRANS_CONNECTION_FLAGS

191 192 193 194
case $host_os in
    linux*)
        OS_CFLAGS="-D_XOPEN_SOURCE"
        ;;
195 196 197
    darwin*)
        OS_CFLAGS="-Wl,-flat_namespace"
	;;
198 199 200 201
    *)
        OS_CFLAGS=
        ;;
esac
202
AC_SUBST([OS_CFLAGS])
Josh Triplett's avatar
Josh Triplett committed
203

204 205 206 207 208 209 210 211 212 213 214 215
AC_CONFIG_FILES([Makefile
		doc/Makefile
		src/Makefile
		src/fontfile/Makefile
		src/FreeType/Makefile
		src/builtins/Makefile
		src/bitmap/Makefile
		src/fc/Makefile
		src/util/Makefile
		src/stubs/Makefile
		xfont.pc])
AC_OUTPUT