configure.ac revision 0d590c07
1dnl 
2dnl  Copyright © 2003 Keith Packard, Noah Levitt
3dnl 
4dnl  Permission to use, copy, modify, distribute, and sell this software and its
5dnl  documentation for any purpose is hereby granted without fee, provided that
6dnl  the above copyright notice appear in all copies and that both that
7dnl  copyright notice and this permission notice appear in supporting
8dnl  documentation, and that the name of Keith Packard not be used in
9dnl  advertising or publicity pertaining to distribution of the software without
10dnl  specific, written prior permission.  Keith Packard makes no
11dnl  representations about the suitability of this software for any purpose.  It
12dnl  is provided "as is" without express or implied warranty.
13dnl 
14dnl  KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15dnl  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16dnl  EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17dnl  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18dnl  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19dnl  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20dnl  PERFORMANCE OF THIS SOFTWARE.
21dnl
22dnl Process this file with autoconf to create configure.
23
24AC_PREREQ([2.57])
25
26dnl
27dnl This is the package version number, not the shared library
28dnl version.  This version number will be substituted into Xft.h
29dnl Please bump the minor library number at each release as well.
30dnl
31AC_INIT(libXft, 2.1.14, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXft)
32AC_CONFIG_AUX_DIR(.)
33
34AM_INIT_AUTOMAKE([dist-bzip2])
35AM_MAINTAINER_MODE
36
37# Require xorg-macros: XORG_DEFAULT_OPTIONS
38m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.3 or later before running autoconf/autogen])])
39XORG_MACROS_VERSION(1.3)
40AM_CONFIG_HEADER(config.h)
41
42# checks for progs
43AC_PROG_CC
44AC_PROG_LIBTOOL
45XORG_DEFAULT_OPTIONS
46
47# Set library version for Xft.h from package version set in AC_INIT
48# copied from PACKAGE_VERSION_* settings in XORG_VERSION
49AC_CONFIG_HEADERS([include/X11/Xft/Xft.h])
50AC_DEFINE_UNQUOTED([XFT_MAJOR],
51                [`echo $PACKAGE_VERSION | cut -d . -f 1`],
52                [Major version of Xft])
53AC_DEFINE_UNQUOTED([XFT_MINOR],
54                [`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`],
55                [Minor version of Xft])
56AC_DEFINE_UNQUOTED([XFT_REVISION],
57                [`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`],
58                [Micro revision of Xft])
59
60#
61# Check for Xrender
62#
63PKG_CHECK_MODULES(XRENDER, xrender >= 0.8.2, [xrender_found_with_pkgconfig=yes], 
64                  [xrender_found_with_pkgconfig=no])
65case "$xrender_found_with_pkgconfig" in
66no)
67	PKG_CHECK_MODULES(XRENDER, xrender >= 0, [old_xrender_found_with_pkgconfig=yes], 
68			  [old_xrender_found_with_pkgconfig=no])
69	case "$old_xrender_found_with_pkgconfig" in
70	yes)
71		XRENDER_LIBS="$XRENDER_LIBS -lXext -lX11"
72		;;
73	*)
74	        # checks for X
75	        AC_PATH_X
76
77	        XRENDER_CFLAGS="-I$x_includes"
78	        XRENDER_LIBS="-L$x_libraries -lXrender -lXext -lX11"
79
80	        saved_CPPFLAGS="$CPPFLAGS"
81	        CPPFLAGS="$CPPFLAGS $XRENDER_CFLAGS"
82	        AC_CHECK_HEADERS([X11/extensions/Xrender.h], [], [AC_MSG_ERROR([Xrender.h not found.])])
83	        CPPFLAGS="$saved_CPPFLAGS"
84
85	        saved_LIBS="$LIBS"
86	        LIBS="$LIBS $XRENDER_LIBS"
87	        AC_CHECK_FUNCS([XRenderFindStandardFormat], [], [AC_MSG_ERROR([libXrender not found or too old.])])
88	        LIBS="$saved_LIBS"
89		;;
90	esac
91        ;;
92esac
93
94# Check freetype configuration
95AC_ARG_WITH(freetype-config, [  --with-freetype-config=PROG   Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=auto)
96	
97if test "$freetype_config" = "auto"; then
98	PKG_CHECK_MODULES(FREETYPE, freetype2, 
99		freetype_config=no, freetype_config=yes)
100fi
101
102if test "$freetype_config" = "yes"; then 
103	AC_PATH_PROG(ft_config,freetype-config,no)
104	if test "$ft_config" = "no"; then
105		AC_MSG_ERROR([You must have freetype installed; see http://www.freetype.org/])
106	fi
107else
108	ft_config="$freetype_config"
109fi
110
111if test "$freetype_config" != "no"; then 	
112	FREETYPE_CFLAGS="`$ft_config --cflags`"
113	FREETYPE_LIBS="`$ft_config --libs`"
114fi
115
116# Check fontconfig configuration
117PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.2)
118
119AC_SUBST(XRENDER_CFLAGS)
120AC_SUBST(XRENDER_LIBS)
121AC_SUBST(FREETYPE_CFLAGS)
122AC_SUBST(FREETYPE_LIBS)
123AC_SUBST(FONTCONFIG_CFLAGS)
124AC_SUBST(FONTCONFIG_LIBS)
125
126fontconfig_save_libs="$LIBS"
127fontconfig_save_cflags="$CFLAGS"
128LIBS="$LIBS $FREETYPE_LIBS"
129CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
130AC_CHECK_FUNCS(FT_Get_Next_Char FT_Get_BDF_Property FT_Get_PS_Font_Info FT_Has_PS_Glyph_Names FT_GlyphSlot_Embolden)
131AC_CHECK_MEMBER(FT_Bitmap_Size.y_ppem,
132		HAVE_FT_BITMAP_SIZE_Y_PPEM=1,
133		HAVE_FT_BITMAP_SIZE_Y_PPEM=0,
134[#include <ft2build.h>
135#include FT_FREETYPE_H])
136AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM,
137		   [FT_Bitmap_Size structure includes y_ppem field])
138
139LIBS="$fontconfig_save_libs"
140CFLAGS="$fontconfig_save_cflags"
141
142if test "$VERSION" = "" ; then
143       VERSION=$PACKAGE_VERSION;
144fi
145
146AC_OUTPUT([Makefile
147	   xft.pc
148	   xft-config
149	   src/Makefile
150	   man/Makefile
151	   man/xft-config.1
152	   man/Xft.3])
153