PageRenderTime 23ms CodeModel.GetById 17ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/freetype2/builds/unix/freetype2.m4

http://github.com/zpao/v8monkey
m4 | 194 lines | 141 code | 21 blank | 32 comment | 0 complexity | ba2aae62133a468c368632952020db8c MD5 | raw file
  1# Configure paths for FreeType2
  2# Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor
  3#
  4# Copyright 2001, 2003, 2007, 2009 by
  5# David Turner, Robert Wilhelm, and Werner Lemberg.
  6#
  7# This file is part of the FreeType project, and may only be used, modified,
  8# and distributed under the terms of the FreeType project license,
  9# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
 10# indicate that you have read the license and understand and accept it
 11# fully.
 12#
 13# As a special exception to the FreeType project license, this file may be
 14# distributed as part of a program that contains a configuration script
 15# generated by Autoconf, under the same distribution terms as the rest of
 16# that program.
 17#
 18# serial 3
 19
 20# AC_CHECK_FT2([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
 21# Test for FreeType 2, and define FT2_CFLAGS and FT2_LIBS.
 22# MINIMUM-VERSION is what libtool reports; the default is `7.0.1' (this is
 23# FreeType 2.0.4).
 24#
 25AC_DEFUN([AC_CHECK_FT2],
 26  [# Get the cflags and libraries from the freetype-config script
 27   #
 28   AC_ARG_WITH([ft-prefix],
 29     dnl don't quote AS_HELP_STRING!
 30     AS_HELP_STRING([--with-ft-prefix=PREFIX],
 31                    [Prefix where FreeType is installed (optional)]),
 32     [ft_config_prefix="$withval"],
 33     [ft_config_prefix=""])
 34
 35   AC_ARG_WITH([ft-exec-prefix],
 36     dnl don't quote AS_HELP_STRING!
 37     AS_HELP_STRING([--with-ft-exec-prefix=PREFIX],
 38                    [Exec prefix where FreeType is installed (optional)]),
 39     [ft_config_exec_prefix="$withval"],
 40     [ft_config_exec_prefix=""])
 41
 42   AC_ARG_ENABLE([freetypetest],
 43     dnl don't quote AS_HELP_STRING!
 44     AS_HELP_STRING([--disable-freetypetest],
 45                    [Do not try to compile and run a test FreeType program]),
 46     [],
 47     [enable_fttest=yes])
 48
 49   if test x$ft_config_exec_prefix != x ; then
 50     ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix"
 51     if test x${FT2_CONFIG+set} != xset ; then
 52       FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config
 53     fi
 54   fi
 55
 56   if test x$ft_config_prefix != x ; then
 57     ft_config_args="$ft_config_args --prefix=$ft_config_prefix"
 58     if test x${FT2_CONFIG+set} != xset ; then
 59       FT2_CONFIG=$ft_config_prefix/bin/freetype-config
 60     fi
 61   fi
 62
 63   if test "x$FT2_CONFIG" = x ; then
 64     AC_PATH_PROG([FT2_CONFIG], [freetype-config], [no])
 65   fi
 66
 67   min_ft_version=m4_if([$1], [], [7.0.1], [$1])
 68   AC_MSG_CHECKING([for FreeType -- version >= $min_ft_version])
 69   no_ft=""
 70   if test "$FT2_CONFIG" = "no" ; then
 71     no_ft=yes
 72   else
 73     FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags`
 74     FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs`
 75     ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \
 76       sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
 77     ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \
 78       sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
 79     ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \
 80       sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
 81     ft_min_major_version=`echo $min_ft_version | \
 82       sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
 83     ft_min_minor_version=`echo $min_ft_version | \
 84       sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
 85     ft_min_micro_version=`echo $min_ft_version | \
 86       sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
 87     if test x$enable_fttest = xyes ; then
 88       ft_config_is_lt=""
 89       if test $ft_config_major_version -lt $ft_min_major_version ; then
 90         ft_config_is_lt=yes
 91       else
 92         if test $ft_config_major_version -eq $ft_min_major_version ; then
 93           if test $ft_config_minor_version -lt $ft_min_minor_version ; then
 94             ft_config_is_lt=yes
 95           else
 96             if test $ft_config_minor_version -eq $ft_min_minor_version ; then
 97               if test $ft_config_micro_version -lt $ft_min_micro_version ; then
 98                 ft_config_is_lt=yes
 99               fi
100             fi
101           fi
102         fi
103       fi
104       if test x$ft_config_is_lt = xyes ; then
105         no_ft=yes
106       else
107         ac_save_CFLAGS="$CFLAGS"
108         ac_save_LIBS="$LIBS"
109         CFLAGS="$CFLAGS $FT2_CFLAGS"
110         LIBS="$FT2_LIBS $LIBS"
111
112         #
113         # Sanity checks for the results of freetype-config to some extent.
114         #
115         AC_RUN_IFELSE([
116             AC_LANG_SOURCE([[
117
118#include <ft2build.h>
119#include FT_FREETYPE_H
120#include <stdio.h>
121#include <stdlib.h>
122
123int
124main()
125{
126  FT_Library library;
127  FT_Error  error;
128
129  error = FT_Init_FreeType(&library);
130
131  if (error)
132    return 1;
133  else
134  {
135    FT_Done_FreeType(library);
136    return 0;
137  }
138}
139
140             ]])
141           ],
142           [],
143           [no_ft=yes],
144           [echo $ECHO_N "cross compiling; assuming OK... $ECHO_C"])
145
146         CFLAGS="$ac_save_CFLAGS"
147         LIBS="$ac_save_LIBS"
148       fi             # test $ft_config_version -lt $ft_min_version
149     fi               # test x$enable_fttest = xyes
150   fi                 # test "$FT2_CONFIG" = "no"
151
152   if test x$no_ft = x ; then
153     AC_MSG_RESULT([yes])
154     m4_if([$2], [], [:], [$2])
155   else
156     AC_MSG_RESULT([no])
157     if test "$FT2_CONFIG" = "no" ; then
158       AC_MSG_WARN([
159
160  The freetype-config script installed by FreeType 2 could not be found.
161  If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in
162  your path, or set the FT2_CONFIG environment variable to the
163  full path to freetype-config.
164       ])
165     else
166       if test x$ft_config_is_lt = xyes ; then
167         AC_MSG_WARN([
168
169  Your installed version of the FreeType 2 library is too old.
170  If you have different versions of FreeType 2, make sure that
171  correct values for --with-ft-prefix or --with-ft-exec-prefix
172  are used, or set the FT2_CONFIG environment variable to the
173  full path to freetype-config.
174         ])
175       else
176         AC_MSG_WARN([
177
178  The FreeType test program failed to run.  If your system uses
179  shared libraries and they are installed outside the normal
180  system library path, make sure the variable LD_LIBRARY_PATH
181  (or whatever is appropriate for your system) is correctly set.
182         ])
183       fi
184     fi
185
186     FT2_CFLAGS=""
187     FT2_LIBS=""
188     m4_if([$3], [], [:], [$3])
189   fi
190
191   AC_SUBST([FT2_CFLAGS])
192   AC_SUBST([FT2_LIBS])])
193
194# end of freetype2.m4