configure.ac revision c2939121
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.60])
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.2.0],
32        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXft])
33AC_CONFIG_AUX_DIR(.)
34
35AM_INIT_AUTOMAKE([foreign dist-bzip2])
36AM_MAINTAINER_MODE
37
38# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
39m4_ifndef([XORG_MACROS_VERSION],
40          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
41XORG_MACROS_VERSION(1.8)
42XORG_DEFAULT_OPTIONS
43AM_CONFIG_HEADER(config.h)
44
45# checks for progs
46AC_PROG_CC
47AC_PROG_LIBTOOL
48AC_PROG_SED
49
50# Set library version for Xft.h from package version set in AC_INIT
51# copied from PACKAGE_VERSION_* settings in XORG_VERSION
52AC_CONFIG_HEADERS([include/X11/Xft/Xft.h])
53AC_DEFINE_UNQUOTED([XFT_MAJOR],
54                [`echo $PACKAGE_VERSION | cut -d . -f 1`],
55                [Major version of Xft])
56AC_DEFINE_UNQUOTED([XFT_MINOR],
57                [`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`],
58                [Minor version of Xft])
59AC_DEFINE_UNQUOTED([XFT_REVISION],
60                [`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`],
61                [Micro revision of Xft])
62
63XFT_LT_VERSION=`echo $PACKAGE_VERSION | tr '.' ':'`
64AC_SUBST([XFT_LT_VERSION])
65
66#
67# Check for Xrender
68#
69PKG_CHECK_MODULES(XRENDER, xrender >= 0.8.2, [xrender_found_with_pkgconfig=yes], 
70                  [xrender_found_with_pkgconfig=no])
71case "$xrender_found_with_pkgconfig" in
72no)
73	PKG_CHECK_MODULES(XRENDER, xrender >= 0, [old_xrender_found_with_pkgconfig=yes], 
74			  [old_xrender_found_with_pkgconfig=no])
75	case "$old_xrender_found_with_pkgconfig" in
76	yes)
77		XRENDER_LIBS="$XRENDER_LIBS -lXext -lX11"
78		;;
79	*)
80	        # checks for X
81	        AC_PATH_X
82
83	        XRENDER_CFLAGS="-I$x_includes"
84	        XRENDER_LIBS="-L$x_libraries -lXrender -lXext -lX11"
85
86	        saved_CPPFLAGS="$CPPFLAGS"
87	        CPPFLAGS="$CPPFLAGS $XRENDER_CFLAGS"
88	        AC_CHECK_HEADERS([X11/extensions/Xrender.h], [], [AC_MSG_ERROR([Xrender.h not found.])])
89	        CPPFLAGS="$saved_CPPFLAGS"
90
91	        saved_LIBS="$LIBS"
92	        LIBS="$LIBS $XRENDER_LIBS"
93	        AC_CHECK_FUNCS([XRenderFindStandardFormat], [], [AC_MSG_ERROR([libXrender not found or too old.])])
94	        LIBS="$saved_LIBS"
95		;;
96	esac
97        ;;
98esac
99
100# Check freetype configuration
101AC_ARG_WITH(freetype-config, [  --with-freetype-config=PROG   Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=auto)
102	
103if test "$freetype_config" = "auto"; then
104	PKG_CHECK_MODULES(FREETYPE, freetype2, 
105		freetype_config=no, freetype_config=yes)
106fi
107
108if test "$freetype_config" = "yes"; then 
109	AC_PATH_PROG(ft_config,freetype-config,no)
110	if test "$ft_config" = "no"; then
111		AC_MSG_ERROR([You must have freetype installed; see http://www.freetype.org/])
112	fi
113else
114	ft_config="$freetype_config"
115fi
116
117if test "$freetype_config" != "no"; then 	
118	FREETYPE_CFLAGS="`$ft_config --cflags`"
119	FREETYPE_LIBS="`$ft_config --libs`"
120fi
121
122# Check fontconfig configuration
123PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.2)
124
125AC_SUBST(XRENDER_CFLAGS)
126AC_SUBST(XRENDER_LIBS)
127AC_SUBST(FREETYPE_CFLAGS)
128AC_SUBST(FREETYPE_LIBS)
129AC_SUBST(FONTCONFIG_CFLAGS)
130AC_SUBST(FONTCONFIG_LIBS)
131
132fontconfig_save_libs="$LIBS"
133fontconfig_save_cflags="$CFLAGS"
134LIBS="$LIBS $FREETYPE_LIBS"
135CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
136AC_CHECK_FUNCS(FT_Get_Next_Char FT_Get_BDF_Property FT_Get_PS_Font_Info FT_Has_PS_Glyph_Names FT_GlyphSlot_Embolden)
137AC_CHECK_MEMBER(FT_Bitmap_Size.y_ppem,
138		HAVE_FT_BITMAP_SIZE_Y_PPEM=1,
139		HAVE_FT_BITMAP_SIZE_Y_PPEM=0,
140[#include <ft2build.h>
141#include FT_FREETYPE_H])
142AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM,
143		   [FT_Bitmap_Size structure includes y_ppem field])
144
145LIBS="$fontconfig_save_libs"
146CFLAGS="$fontconfig_save_cflags"
147
148if test "$VERSION" = "" ; then
149       VERSION=$PACKAGE_VERSION;
150fi
151
152AC_OUTPUT([Makefile
153	   xft.pc
154	   src/Makefile
155	   man/Makefile])
156