f35eb910916f0c87a9881ed231f3ceb81d3cf354
[framework/uifw/xorg/lib/libxft.git] / configure.ac
1 dnl 
2 dnl  Copyright © 2003 Keith Packard, Noah Levitt
3 dnl 
4 dnl  Permission to use, copy, modify, distribute, and sell this software and its
5 dnl  documentation for any purpose is hereby granted without fee, provided that
6 dnl  the above copyright notice appear in all copies and that both that
7 dnl  copyright notice and this permission notice appear in supporting
8 dnl  documentation, and that the name of Keith Packard not be used in
9 dnl  advertising or publicity pertaining to distribution of the software without
10 dnl  specific, written prior permission.  Keith Packard makes no
11 dnl  representations about the suitability of this software for any purpose.  It
12 dnl  is provided "as is" without express or implied warranty.
13 dnl 
14 dnl  KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 dnl  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 dnl  EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 dnl  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 dnl  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 dnl  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 dnl  PERFORMANCE OF THIS SOFTWARE.
21 dnl
22 dnl Process this file with autoconf to create configure.
23
24 AC_PREREQ([2.60])
25
26 dnl
27 dnl This is the package version number, not the shared library
28 dnl version.  This version number will be substituted into Xft.h
29 dnl Please bump the minor library number at each release as well.
30 dnl
31 AC_INIT([libXft], [2.2.0],
32         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXft])
33 AC_CONFIG_AUX_DIR(.)
34
35 AM_INIT_AUTOMAKE([foreign dist-bzip2])
36 AM_MAINTAINER_MODE
37
38 # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
39 m4_ifndef([XORG_MACROS_VERSION],
40           [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
41 XORG_MACROS_VERSION(1.8)
42 XORG_DEFAULT_OPTIONS
43 AM_CONFIG_HEADER(config.h)
44
45 # checks for progs
46 AC_PROG_CC
47 AC_PROG_LIBTOOL
48 AC_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
52 AC_CONFIG_HEADERS([include/X11/Xft/Xft.h])
53 AC_DEFINE_UNQUOTED([XFT_MAJOR],
54                 [`echo $PACKAGE_VERSION | cut -d . -f 1`],
55                 [Major version of Xft])
56 AC_DEFINE_UNQUOTED([XFT_MINOR],
57                 [`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1`],
58                 [Minor version of Xft])
59 AC_DEFINE_UNQUOTED([XFT_REVISION],
60                 [`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1`],
61                 [Micro revision of Xft])
62
63 XFT_LT_VERSION=`echo $PACKAGE_VERSION | tr '.' ':'`
64 AC_SUBST([XFT_LT_VERSION])
65
66 #
67 # Check for Xrender
68 #
69 PKG_CHECK_MODULES(XRENDER, xrender >= 0.8.2, [xrender_found_with_pkgconfig=yes], 
70                   [xrender_found_with_pkgconfig=no])
71 case "$xrender_found_with_pkgconfig" in
72 no)
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         ;;
98 esac
99
100 # Check freetype configuration
101 AC_ARG_WITH(freetype-config, [  --with-freetype-config=PROG   Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=auto)
102         
103 if test "$freetype_config" = "auto"; then
104         PKG_CHECK_MODULES(FREETYPE, freetype2, 
105                 freetype_config=no, freetype_config=yes)
106 fi
107
108 if 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
113 else
114         ft_config="$freetype_config"
115 fi
116
117 if test "$freetype_config" != "no"; then        
118         FREETYPE_CFLAGS="`$ft_config --cflags`"
119         FREETYPE_LIBS="`$ft_config --libs`"
120 fi
121
122 # Check fontconfig configuration
123 PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.2)
124
125 AC_SUBST(XRENDER_CFLAGS)
126 AC_SUBST(XRENDER_LIBS)
127 AC_SUBST(FREETYPE_CFLAGS)
128 AC_SUBST(FREETYPE_LIBS)
129 AC_SUBST(FONTCONFIG_CFLAGS)
130 AC_SUBST(FONTCONFIG_LIBS)
131
132 fontconfig_save_libs="$LIBS"
133 fontconfig_save_cflags="$CFLAGS"
134 LIBS="$LIBS $FREETYPE_LIBS"
135 CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
136 AC_CHECK_FUNCS(FT_Get_Next_Char FT_Get_BDF_Property FT_Get_PS_Font_Info FT_Has_PS_Glyph_Names FT_GlyphSlot_Embolden)
137 AC_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])
142 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM,
143                    [FT_Bitmap_Size structure includes y_ppem field])
144
145 LIBS="$fontconfig_save_libs"
146 CFLAGS="$fontconfig_save_cflags"
147
148 if test "$VERSION" = "" ; then
149        VERSION=$PACKAGE_VERSION;
150 fi
151
152 AC_OUTPUT([Makefile
153            xft.pc
154            src/Makefile
155            man/Makefile])