diff options
Diffstat (limited to 'xft.m4')
-rw-r--r-- | xft.m4 | 97 |
1 files changed, 97 insertions, 0 deletions
@@ -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]]]) | ||
23 | AC_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]]]) | ||
33 | AC_DEFUN(AM_PATH_XFT2, | ||
34 | [ | ||
35 | if test x$pkg_exec_prefix != x ; then | ||
36 | xft_args="$xft_args --exec-prefix=$pkg_exec_prefix" | ||
37 | if test x${PKG_CONFIG+set} != xset ; then | ||
38 | PKG_CONFIG=$pkg_exec_prefix/bin/pkg-config | ||
39 | fi | ||
40 | fi | ||
41 | |||
42 | if test x$xft_prefix != x ; then | ||
43 | xft_args="$xft_args --prefix=$xft_prefix" | ||
44 | if test x${PKG_CONFIG+set} != xset ; then | ||
45 | PKG_CONFIG=$xft_prefix/bin/pkg-config | ||
46 | fi | ||
47 | fi | ||
48 | |||
49 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) | ||
50 | if test "x$PKG_CONFIG" = "xno" ; then | ||
51 | ifelse([$2], , :, [$2]) | ||
52 | else | ||
53 | XFT_CFLAGS=`$PKG_CONFIG $xftconf_args --cflags xft` | ||
54 | XFT_LIBS=`$PKG_CONFIG $xftconf_args --libs xft` | ||
55 | ifelse([$1], , :, [$1]) | ||
56 | fi | ||
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 | ||
62 | AC_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(pkg-exec-prefix,[ --with-pkg-exec-prefix=path Exec prefix where pkg-config is installed (optional)], | ||
67 | pkg_exec_prefix="$withval", pkg_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 | |||
78 | if 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 | ) | ||
88 | else | ||
89 | AC_MSG_RESULT(no) | ||
90 | [$3] | ||
91 | fi | ||
92 | |||
93 | CFLAGS="$CFLAGS $XFT_CFLAGS" | ||
94 | CXXFLAGS="$CXXFLAGS $XFT_CFLAGS" | ||
95 | LIBS="$LIBS $XFT_LIBS" | ||
96 | |||
97 | ]) | ||