xft checking
fluxgen fluxgen
1 files changed,
97 insertions(+),
0 deletions(-)
jump to
A
xft.m4
@@ -0,0 +1,97 @@
+# xft.m4 +# Copyright (c) 2002 Henrik Kinnunen (fluxgen at linuxmail.org) + +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. + +# AM_PATH_XFT1([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +AC_DEFUN(AM_PATH_XFT1, +[ + AC_CHECK_LIB(Xft, XftFontOpen, + XFT_LIBS="-lXft" + [$1], + [$2] + ) +]) + +# AM_PATH_XFT2([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +AC_DEFUN(AM_PATH_XFT2, +[ +if test x$xft_exec_prefix != x ; then + xft_args="$xft_args --exec-prefix=$xft_exec_prefix" + if test x${XFT_CONFIG+set} != xset ; then + XFT_CONFIG=$xft_exec_prefix/bin/xft-config + fi +fi + +if test x$xft_prefix != x ; then + xft_args="$xft_args --prefix=$xft_prefix" + if test x${XFT_CONFIG+set} != xset ; then + XFT_CONFIG=$xft_prefix/bin/xft-config + fi +fi + +AC_PATH_PROG(XFT_CONFIG, xft-config, no) +if test "x$XFT_CONFIG" = "xno" ; then + ifelse([$2], , :, [$2]) +else + XFT_CFLAGS=`$XFT_CONFIG $xftconf_args --cflags` + XFT_LIBS=`$XFT_CONFIG $xftconf_args --libs` + ifelse([$1], , :, [$1]) +fi + +]) + +# AM_PATH_XFT(default-value, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +# Test for Xft, and define XFT_CFLAGS and XFT_LIBS +AC_DEFUN(AM_PATH_XFT, +[ + AC_ARG_WITH(xft-prefix,[ --with-xft-prefix=path Prefix where Xft is installed (optional)], + xft_prefix="$withval", xft_prefix="") + AC_ARG_WITH(xft-exec-prefix,[ --with-xft-exec-prefix=path Exec prefix where xft-config is installed (optional)], + xft_exec_prefix="$withval", xft_exec_prefix="") + AC_ARG_ENABLE(xft, [ --enable-xft Xft (antialias) support (default=$1)], + if test "x$enableval" = "xyes"; then + TRY_XFT=yes + else + TRY_XFT=no + fi + , + TRY_XFT=$1 + ) + +if test "x$TRY_XFT" = "xyes"; then + AC_MSG_RESULT(yes) + AM_PATH_XFT2( + [$2], + # xft2 failed: try xft1 + AM_PATH_XFT1( + [$2], + [$3] + AC_MSG_RESULT([Cant find Xft libraries! Disabling Xft])) + ) +else + AC_MSG_RESULT(no) + [$3] +fi + +CFLAGS="$CFLAGS $XFT_CFLAGS" +CXXFLAGS="$CXXFLAGS $XFT_CFLAGS" +LIBS="$LIBS $XFT_LIBS" + +])