summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xft.m497
1 files changed, 97 insertions, 0 deletions
diff --git a/xft.m4 b/xft.m4
new file mode 100644
index 0000000..ee6b5da
--- /dev/null
+++ b/xft.m4
@@ -0,0 +1,97 @@
1# xft.m4
2# Copyright (c) 2002 Henrik Kinnunen (fluxgen at linuxmail.org)
3
4# Permission is hereby granted, free of charge, to any person obtaining a
5# copy of this software and associated documentation files (the "Software"),
6# to deal in the Software without restriction, including without limitation
7# the rights to use, copy, modify, merge, publish, distribute, sublicense,
8# and/or sell copies of the Software, and to permit persons to whom the
9# Software is furnished to do so, subject to the following conditions:
10
11# The above copyright notice and this permission notice shall be included in
12# all copies or substantial portions of the Software.
13
14# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20# DEALINGS IN THE SOFTWARE.
21
22# AM_PATH_XFT1([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
23AC_DEFUN(AM_PATH_XFT1,
24[
25 AC_CHECK_LIB(Xft, XftFontOpen,
26 XFT_LIBS="-lXft"
27 [$1],
28 [$2]
29 )
30])
31
32# AM_PATH_XFT2([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
33AC_DEFUN(AM_PATH_XFT2,
34[
35if test x$xft_exec_prefix != x ; then
36 xft_args="$xft_args --exec-prefix=$xft_exec_prefix"
37 if test x${XFT_CONFIG+set} != xset ; then
38 XFT_CONFIG=$xft_exec_prefix/bin/xft-config
39 fi
40fi
41
42if test x$xft_prefix != x ; then
43 xft_args="$xft_args --prefix=$xft_prefix"
44 if test x${XFT_CONFIG+set} != xset ; then
45 XFT_CONFIG=$xft_prefix/bin/xft-config
46 fi
47fi
48
49AC_PATH_PROG(XFT_CONFIG, xft-config, no)
50if test "x$XFT_CONFIG" = "xno" ; then
51 ifelse([$2], , :, [$2])
52else
53 XFT_CFLAGS=`$XFT_CONFIG $xftconf_args --cflags`
54 XFT_LIBS=`$XFT_CONFIG $xftconf_args --libs`
55 ifelse([$1], , :, [$1])
56fi
57
58])
59
60# AM_PATH_XFT(default-value, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
61# Test for Xft, and define XFT_CFLAGS and XFT_LIBS
62AC_DEFUN(AM_PATH_XFT,
63[
64 AC_ARG_WITH(xft-prefix,[ --with-xft-prefix=path Prefix where Xft is installed (optional)],
65 xft_prefix="$withval", xft_prefix="")
66 AC_ARG_WITH(xft-exec-prefix,[ --with-xft-exec-prefix=path Exec prefix where xft-config is installed (optional)],
67 xft_exec_prefix="$withval", xft_exec_prefix="")
68 AC_ARG_ENABLE(xft, [ --enable-xft Xft (antialias) support (default=$1)],
69 if test "x$enableval" = "xyes"; then
70 TRY_XFT=yes
71 else
72 TRY_XFT=no
73 fi
74 ,
75 TRY_XFT=$1
76 )
77
78if test "x$TRY_XFT" = "xyes"; then
79 AC_MSG_RESULT(yes)
80 AM_PATH_XFT2(
81 [$2],
82 # xft2 failed: try xft1
83 AM_PATH_XFT1(
84 [$2],
85 [$3]
86 AC_MSG_RESULT([Cant find Xft libraries! Disabling Xft]))
87 )
88else
89 AC_MSG_RESULT(no)
90 [$3]
91fi
92
93CFLAGS="$CFLAGS $XFT_CFLAGS"
94CXXFLAGS="$CXXFLAGS $XFT_CFLAGS"
95LIBS="$LIBS $XFT_LIBS"
96
97])