| 1 |
# Configure paths for FreeType2 |
| 2 |
# Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor |
| 3 |
|
| 4 |
dnl AC_CHECK_FT2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) |
| 5 |
dnl Test for FreeType2, and define FT2_CFLAGS and FT2_LIBS |
| 6 |
dnl |
| 7 |
AC_DEFUN([AC_CHECK_FT2], |
| 8 |
[dnl |
| 9 |
dnl Get the cflags and libraries from the freetype-config script |
| 10 |
dnl |
| 11 |
AC_ARG_WITH(ft-prefix, |
| 12 |
[ --with-ft-prefix=PREFIX prefix where FreeType is installed], |
| 13 |
ft_config_prefix="$withval", ft_config_prefix="") |
| 14 |
AC_ARG_WITH(ft-exec-prefix, |
| 15 |
[ --with-ft-exec-prefix=PFX exec prefix where FreeType is installed], |
| 16 |
ft_config_exec_prefix="$withval", ft_config_exec_prefix="") |
| 17 |
AC_ARG_ENABLE(freetypetest, |
| 18 |
[ --disable-freetypetest do not try to compile and run a test FT2 program.], |
| 19 |
[], enable_fttest=yes) |
| 20 |
|
| 21 |
if test x$ft_config_exec_prefix != x ; then |
| 22 |
ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix" |
| 23 |
if test x${FT2_CONFIG+set} != xset ; then |
| 24 |
FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config |
| 25 |
fi |
| 26 |
fi |
| 27 |
if test x$ft_config_prefix != x ; then |
| 28 |
ft_config_args="$ft_config_args --prefix=$ft_config_prefix" |
| 29 |
if test x${FT2_CONFIG+set} != xset ; then |
| 30 |
FT2_CONFIG=$ft_config_prefix/bin/freetype-config |
| 31 |
fi |
| 32 |
fi |
| 33 |
AC_PATH_PROG(FT2_CONFIG, freetype-config, no) |
| 34 |
|
| 35 |
min_ft_version=ifelse([$1], ,6.1.0,$1) |
| 36 |
AC_MSG_CHECKING(for FreeType - version >= $min_ft_version) |
| 37 |
no_ft="" |
| 38 |
if test "$FT2_CONFIG" = "no" ; then |
| 39 |
no_ft=yes |
| 40 |
else |
| 41 |
FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags` |
| 42 |
FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs` |
| 43 |
ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \ |
| 44 |
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
| 45 |
ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \ |
| 46 |
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
| 47 |
ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \ |
| 48 |
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
| 49 |
ft_min_major_version=`echo $min_ft_version | \ |
| 50 |
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
| 51 |
ft_min_minor_version=`echo $min_ft_version | \ |
| 52 |
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
| 53 |
ft_min_micro_version=`echo $min_ft_version | \ |
| 54 |
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
| 55 |
if test x$enable_fttest = xyes ; then |
| 56 |
ft_config_is_lt="" |
| 57 |
if test $ft_config_major_version -lt $ft_min_major_version ; then |
| 58 |
ft_config_is_lt=yes |
| 59 |
else |
| 60 |
if test $ft_config_major_version -eq $ft_min_major_version ; then |
| 61 |
if test $ft_config_minor_version -lt $ft_min_minor_version ; then |
| 62 |
ft_config_is_lt=yes |
| 63 |
else |
| 64 |
if test $ft_config_minor_version -eq $ft_min_minor_version ; then |
| 65 |
if test $ft_config_micro_version -lt $ft_min_micro_version ; then |
| 66 |
ft_config_is_lt=yes |
| 67 |
fi |
| 68 |
fi |
| 69 |
fi |
| 70 |
fi |
| 71 |
fi |
| 72 |
if test x$ft_config_is_lt = xyes ; then |
| 73 |
no_ft=yes |
| 74 |
else |
| 75 |
ac_save_CFLAGS="$CFLAGS" |
| 76 |
ac_save_LIBS="$LIBS" |
| 77 |
CFLAGS="$CFLAGS $FT2_CFLAGS" |
| 78 |
LIBS="$FT2_LIBS $LIBS" |
| 79 |
dnl |
| 80 |
dnl Sanity checks for the results of freetype-config to some extent |
| 81 |
dnl |
| 82 |
AC_RUN_IFELSE(AC_LANG_SOURCE([ |
| 83 |
#include <ft2build.h> |
| 84 |
#include FT_FREETYPE_H |
| 85 |
#include <stdio.h> |
| 86 |
#include <stdlib.h> |
| 87 |
|
| 88 |
int |
| 89 |
main() |
| 90 |
{ |
| 91 |
FT_Library library; |
| 92 |
FT_Error error; |
| 93 |
|
| 94 |
error = FT_Init_FreeType(&library); |
| 95 |
|
| 96 |
if (error) |
| 97 |
return 1; |
| 98 |
else |
| 99 |
{ |
| 100 |
FT_Done_FreeType(library); |
| 101 |
return 0; |
| 102 |
} |
| 103 |
} |
| 104 |
]), [], no_ft=yes, [echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
| 105 |
CFLAGS="$ac_save_CFLAGS" |
| 106 |
LIBS="$ac_save_LIBS" |
| 107 |
fi # test $ft_config_version -lt $ft_min_version |
| 108 |
fi # test x$enable_fttest = xyes |
| 109 |
fi # test "$FT2_CONFIG" = "no" |
| 110 |
if test x$no_ft = x ; then |
| 111 |
AC_MSG_RESULT(yes) |
| 112 |
ifelse([$2], , :, [$2]) |
| 113 |
else |
| 114 |
AC_MSG_RESULT(no) |
| 115 |
if test "$FT2_CONFIG" = "no" ; then |
| 116 |
echo "*** The freetype-config script installed by FreeType 2 could not be found." |
| 117 |
echo "*** If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in" |
| 118 |
echo "*** your path, or set the FT2_CONFIG environment variable to the" |
| 119 |
echo "*** full path to freetype-config." |
| 120 |
else |
| 121 |
if test x$ft_config_is_lt = xyes ; then |
| 122 |
echo "*** Your installed version of the FreeType 2 library is too old." |
| 123 |
echo "*** If you have different versions of FreeType 2, make sure that" |
| 124 |
echo "*** correct values for --with-ft-prefix or --with-ft-exec-prefix" |
| 125 |
echo "*** are used, or set the FT2_CONFIG environment variable to the" |
| 126 |
echo "*** full path to freetype-config." |
| 127 |
else |
| 128 |
echo "*** The FreeType test program failed to run. If your system uses" |
| 129 |
echo "*** shared libraries and they are installed outside the normal" |
| 130 |
echo "*** system library path, make sure the variable LD_LIBRARY_PATH" |
| 131 |
echo "*** (or whatever is appropiate for your system) is correctly set." |
| 132 |
fi |
| 133 |
fi |
| 134 |
FT2_CFLAGS="" |
| 135 |
FT2_LIBS="" |
| 136 |
ifelse([$3], , :, [$3]) |
| 137 |
fi |
| 138 |
AC_SUBST(FT2_CFLAGS) |
| 139 |
AC_SUBST(FT2_LIBS) |
| 140 |
]) |
| 141 |
|