1
# Configure paths for FreeType2
2
# Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor
6
# AC_CHECK_FT2([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
7
# Test for FreeType 2, and define FT2_CFLAGS and FT2_LIBS.
8
# MINIMUM-VERSION is what libtool reports; the default is `7.0.1' (this is
11
AC_DEFUN([AC_CHECK_FT2],
12
[# Get the cflags and libraries from the freetype-config script
14
AC_ARG_WITH([ft-prefix],
15
dnl don't quote AS_HELP_STRING!
16
AS_HELP_STRING([--with-ft-prefix=PREFIX],
17
[Prefix where FreeType is installed (optional)]),
18
[ft_config_prefix="$withval"],
19
[ft_config_prefix=""])
21
AC_ARG_WITH([ft-exec-prefix],
22
dnl don't quote AS_HELP_STRING!
23
AS_HELP_STRING([--with-ft-exec-prefix=PREFIX],
24
[Exec prefix where FreeType is installed (optional)]),
25
[ft_config_exec_prefix="$withval"],
26
[ft_config_exec_prefix=""])
28
AC_ARG_ENABLE([freetypetest],
29
dnl don't quote AS_HELP_STRING!
30
AS_HELP_STRING([--disable-freetypetest],
31
[Do not try to compile and run a test FreeType program]),
35
if test x$ft_config_exec_prefix != x ; then
36
ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix"
37
if test x${FT2_CONFIG+set} != xset ; then
38
FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config
42
if test x$ft_config_prefix != x ; then
43
ft_config_args="$ft_config_args --prefix=$ft_config_prefix"
44
if test x${FT2_CONFIG+set} != xset ; then
45
FT2_CONFIG=$ft_config_prefix/bin/freetype-config
49
AC_PATH_PROG([FT2_CONFIG], [freetype-config], [no])
51
min_ft_version=m4_if([$1], [], [7.0.1], [$1])
52
AC_MSG_CHECKING([for FreeType -- version >= $min_ft_version])
54
if test "$FT2_CONFIG" = "no" ; then
57
FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags`
58
FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs`
59
ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \
60
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
61
ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \
62
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
63
ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \
64
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
65
ft_min_major_version=`echo $min_ft_version | \
66
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
67
ft_min_minor_version=`echo $min_ft_version | \
68
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
69
ft_min_micro_version=`echo $min_ft_version | \
70
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
71
if test x$enable_fttest = xyes ; then
73
if test $ft_config_major_version -lt $ft_min_major_version ; then
76
if test $ft_config_major_version -eq $ft_min_major_version ; then
77
if test $ft_config_minor_version -lt $ft_min_minor_version ; then
80
if test $ft_config_minor_version -eq $ft_min_minor_version ; then
81
if test $ft_config_micro_version -lt $ft_min_micro_version ; then
88
if test x$ft_config_is_lt = xyes ; then
91
ac_save_CFLAGS="$CFLAGS"
93
CFLAGS="$CFLAGS $FT2_CFLAGS"
94
LIBS="$FT2_LIBS $LIBS"
97
# Sanity checks for the results of freetype-config to some extent.
102
#include <ft2build.h>
103
#include FT_FREETYPE_H
113
error = FT_Init_FreeType(&library);
119
FT_Done_FreeType(library);
128
[echo $ECHO_N "cross compiling; assuming OK... $ECHO_C"])
130
CFLAGS="$ac_save_CFLAGS"
132
fi # test $ft_config_version -lt $ft_min_version
133
fi # test x$enable_fttest = xyes
134
fi # test "$FT2_CONFIG" = "no"
136
if test x$no_ft = x ; then
138
m4_if([$2], [], [:], [$2])
141
if test "$FT2_CONFIG" = "no" ; then
144
The freetype-config script installed by FreeType 2 could not be found.
145
If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in
146
your path, or set the FT2_CONFIG environment variable to the
147
full path to freetype-config.
150
if test x$ft_config_is_lt = xyes ; then
153
Your installed version of the FreeType 2 library is too old.
154
If you have different versions of FreeType 2, make sure that
155
correct values for --with-ft-prefix or --with-ft-exec-prefix
156
are used, or set the FT2_CONFIG environment variable to the
157
full path to freetype-config.
162
The FreeType test program failed to run. If your system uses
163
shared libraries and they are installed outside the normal
164
system library path, make sure the variable LD_LIBRARY_PATH
165
(or whatever is appropiate for your system) is correctly set.
172
m4_if([$3], [], [:], [$3])
175
AC_SUBST([FT2_CFLAGS])
176
AC_SUBST([FT2_LIBS])])
178
# end of freetype2.m4