diff --git a/configure.ac b/configure.ac index 97338f3..a64f64c 100644 --- a/configure.ac +++ b/configure.ac @@ -13,19 +13,41 @@ AC_PROG_CC LT_INIT # Checks for --enable args -AC_MSG_CHECKING(whether to enable FreeType2 support) -AC_ARG_ENABLE(ttf, [ --enable-ttf enable FreeType2 support], - if [[[ "$enableval" = "yes" ]]]; then - AC_DEFINE(TTF_SUPPORT, [1], [Define to 1 to enable FreeType2 support]) - CFLAGS="$CFLAGS `freetype-config --cflags`" - FTLIB="-lfreetype" - ttf_support="yes" - else - ttf_support="no" - fi, - ttf_support="no" -) -AC_MSG_RESULT($ttf_support) +AC_ARG_ENABLE(ttf, [ --enable-ttf enable FreeType2 support],,[enable_ttf=no]) +AS_IF([test "x$enable_ttf" != "xno"], [ + m4_ifdef([PKG_PROG_PKG_CONFIG], [ + PKG_PROG_PKG_CONFIG + PKG_CHECK_MODULES(FREETYPE, freetype2, + [ + AC_DEFINE(TTF_SUPPORT, [1], [Define to 1 to enable FreeType2 support]) + CFLAGS="$CFLAGS $FREETYPE_CFLAGS" + FTLIB="$FREETYPE_LIBS" + ], [ + AS_IF([test "x$enable_ttf" = "xyes"], [ + AC_MSG_ERROR([Cannot find freetype2]) + ]) + ]) + ], [ + AC_MSG_CHECKING(whether to enable FreeType2 support) + AC_PATH_PROG([FTCONFIG], [freetype-config]) + AS_IF([test -n "$FTCONFIG" ], [ + CFLAGS="$CFLAGS `$FTCONFIG --cflags`" + FTLIB="-lfreetype" + AC_DEFINE(TTF_SUPPORT, [1]) + AC_MSG_RESULT([yes]) + ], [ + AS_IF([test "x$enable_ttf" = "xyes"], [ + AC_MSG_ERROR([Cannot find freetype-config]) + ], [ + AC_DEFINE(TTF_SUPPORT, [0]) + ]) + ]) + AC_MSG_RESULT([no]) + ] + ) +], [ + AC_MSG_RESULT(No Freetype is being used) +]) # Checks for libraries. AC_CHECK_LIB([g15], [writePixmapToLCD], ,AC_MSG_ERROR(["libg15 not found. please install it"]))