X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=m4%2Ffreetype.m4;h=f4ed0315d7b4cdeb779920306969e3472e081bfc;hp=5e956771d431e43bdd636f7434746ea5e317d098;hb=refs%2Fheads%2Fmaster;hpb=356de1faa3f444b04d1f470127587becba9ca3c0 diff --git a/m4/freetype.m4 b/m4/freetype.m4 index 5e95677..f4ed031 100644 --- a/m4/freetype.m4 +++ b/m4/freetype.m4 @@ -15,13 +15,15 @@ # Substitutes: # -AC_DEFUN(RFX_CHECK_FREETYPE, +AC_DEFUN([RFX_CHECK_FREETYPE], [ -AC_CHECK_PROGS(FREETYPE_CONFIG, freetype-config,) + +AC_PATH_PROG([FREETYPE_CONFIG], [freetype-config],, ["$PATH:/usr/local/bin:/sw/bin:/opt/local/bin"]) + OLDCPPFLAGS="${CPPFLAGS}" OLDLIBS="${LIBS}" -if test "x${FREETYPE_CONFIG}" != "x"; then - CPPFLAGS="$CPPFLAGS "`freetype-config --cflags` +if test "x${FREETYPE_CONFIG}" '!=' "x"; then + CPPFLAGS="$CPPFLAGS "`$FREETYPE_CONFIG --cflags` else if test -d /usr/include/freetype2; then CPPFLAGS="$CPPFLAGS -I/usr/include/freetype2" else if test -d /usr/local/include/freetype2; then @@ -29,29 +31,61 @@ else if test -d /usr/local/include/freetype2; then fi fi fi -AC_CHECK_LIB(freetype, FT_Init_FreeType,HAVE_LIB_FREETYPE=1,) -AC_CHECK_HEADERS(freetype/freetype.h,HAVE_FREETYPE_FREETYPE_H=1) -if test "x${HAVE_LIB_FREETYPE}" != "x";then -if test "x${HAVE_FREETYPE_FREETYPE_H}" != "x";then - HAVE_FREETYPE=1 + +if test "x${FREETYPE_CONFIG}" '=' "x";then + # if we didn't find the freetype-config program, we won't + # know where the libs are expected to be. So just blindly + # try to link against them. + AC_CHECK_LIB([freetype], [FT_Init_FreeType],[HAVE_LIB_FREETYPE=1],) fi + +AC_CHECK_HEADERS([ft2build.h],[HAVE_FT2BUILD_H=1]) +if test "x${HAVE_FT2BUILD_H}" '=' "x";then + AC_CHECK_HEADERS([freetype/freetype.h],[HAVE_FREETYPE_FREETYPE_H=1]) +fi + +if test "x${HAVE_LIB_FREETYPE}" '!=' "x" -o \ + "x${FREETYPE_CONFIG}" '!=' "x";then + if test "x${HAVE_FREETYPE_FREETYPE_H}" '!=' "x";then + HAVE_FREETYPE=1 + fi + if test "x${HAVE_FT2BUILD_H}" '!=' "x";then + HAVE_FREETYPE=1 + fi fi if test "x${HAVE_FREETYPE}" = "x1"; then - if test "x{$FREETYPE_CONFIG}" != "x"; then - LIBS="$LIBS "`freetype-config --libs` + if test "x${FREETYPE_CONFIG}" '!=' "x"; then + LIBS="$LIBS "`$FREETYPE_CONFIG --libs` else LIBS="$LIBS -lfreetype" fi + if test "x${HAVE_FT2BUILD_H}" = "x1"; then + HAVE_FT2BUILD_H_DEFINE='#define HAVE_FT2BUILD_H' + fi + AC_MSG_CHECKING([whether we can compile the freetype test program]) cat > conftest.c << EOF +$HAVE_FT2BUILD_H_DEFINE + +#ifdef HAVE_FT2BUILD_H +#include +#include FT_FREETYPE_H +#include FT_GLYPH_H +#include FT_SIZES_H +#include FT_SFNT_NAMES_H +#include FT_TRUETYPE_IDS_H +#include FT_OUTLINE_H +#else #include #include +#include #include #include #include +#endif int main() { @@ -91,20 +125,21 @@ EOF ac_link='$CC $CPPFLAGS $CFLAGS conftest.c $LDFLAGS $LIBS -o conftest${ac_exeext}' if { (eval echo freetype.m4:71: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - AC_MSG_RESULT(yes) - AC_DEFINE_UNQUOTED(HAVE_FREETYPE, 1) - AC_DEFINE_UNQUOTED(USE_FREETYPE, 1) # for ttf2tp1 + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_FREETYPE], [1], [have/use freetype library]) + AC_DEFINE([HAVE_FREETYPE_FREETYPE_H], [1], [Define if freetype headers are available]) + AC_DEFINE([USE_FREETYPE], [1], [Define if freetype is available]) # for ttf2tp1 else echo "configure: failed program was:" >&5 cat conftest.c >&5 HAVE_FREETYPE=0 - AC_MSG_RESULT(no) + AC_MSG_RESULT([no]) fi rm -f conftest* fi # if the above didn't work out, reset all changes to the compiler variables. -if test "x${HAVE_FREETYPE}" "!=" "x1"; then +if test "x${HAVE_FREETYPE}" '!=' "x1"; then CPPFLAGS=$OLDCPPFLAGS LIBS=$OLDLIBS fi