aboutsummaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorSami Kerola <kerolasa@iki.fi>2013-02-13 20:51:26 (GMT)
committerSami Kerola <kerolasa@iki.fi>2013-05-26 09:38:10 (GMT)
commit22ddf8fd3650072c6243941f27617158e111b236 (patch)
tree71293ad3c7ac9c47112abe7671186bb326b81779 /m4
parent47b978653358e3cde5eb1432efd5eb05a096f83c (diff)
downloadfluxbox-22ddf8fd3650072c6243941f27617158e111b236.zip
fluxbox-22ddf8fd3650072c6243941f27617158e111b236.tar.bz2
build-sys: move autotools files to subdirectories
Diffstat (limited to 'm4')
-rw-r--r--m4/acinclude.m4231
1 files changed, 231 insertions, 0 deletions
diff --git a/m4/acinclude.m4 b/m4/acinclude.m4
new file mode 100644
index 0000000..a233530
--- /dev/null
+++ b/m4/acinclude.m4
@@ -0,0 +1,231 @@
1dnl @synopsis AC_PATH_GENERIC(LIBRARY [, MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
2dnl
3dnl Runs a LIBRARY-config script and defines LIBRARY_CFLAGS and LIBRARY_LIBS
4dnl
5dnl The script must support `--cflags' and `--libs' args.
6dnl If MINIMUM-VERSION is specified, the script must also support the
7dnl `--version' arg.
8dnl If the `--with-library-[exec-]prefix' arguments to ./configure are given,
9dnl it must also support `--prefix' and `--exec-prefix'.
10dnl (In other words, it must be like gtk-config.)
11dnl
12dnl For example:
13dnl
14dnl AC_PATH_GENERIC(Foo, 1.0.0)
15dnl
16dnl would run `foo-config --version' and check that it is at least 1.0.0
17dnl
18dnl If so, the following would then be defined:
19dnl
20dnl FOO_CFLAGS to `foo-config --cflags`
21dnl FOO_LIBS to `foo-config --libs`
22dnl
23dnl At present there is no support for additional "MODULES" (see AM_PATH_GTK)
24dnl (shamelessly stolen from gtk.m4 and then hacked around a fair amount)
25dnl
26dnl @author Angus Lees <gusl@cse.unsw.edu.au>
27dnl @version $Id: ac_path_generic.m4,v 1.1.1.1 2001/07/26 00:46:28 guidod Exp $
28
29AC_DEFUN([AC_PATH_GENERIC],
30[dnl
31dnl we're going to need uppercase, lowercase and user-friendly versions of the
32dnl string `LIBRARY'
33pushdef([UP], translit([$1], [a-z], [A-Z]))dnl
34pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl
35
36dnl
37dnl Get the cflags and libraries from the LIBRARY-config script
38dnl
39AC_ARG_WITH(DOWN-prefix,[ --with-]DOWN[-prefix=PFX Prefix where $1 is installed (optional)],
40 DOWN[]_config_prefix="$withval", DOWN[]_config_prefix="")
41AC_ARG_WITH(DOWN-exec-prefix,[ --with-]DOWN[-exec-prefix=PFX Exec prefix where $1 is installed (optional)],
42 DOWN[]_config_exec_prefix="$withval", DOWN[]_config_exec_prefix="")
43
44 if test x$DOWN[]_config_exec_prefix != x ; then
45 DOWN[]_config_args="$DOWN[]_config_args --exec-prefix=$DOWN[]_config_exec_prefix"
46 if test x${UP[]_CONFIG+set} != xset ; then
47 UP[]_CONFIG=$DOWN[]_config_exec_prefix/bin/DOWN-config
48 fi
49 fi
50 if test x$DOWN[]_config_prefix != x ; then
51 DOWN[]_config_args="$DOWN[]_config_args --prefix=$DOWN[]_config_prefix"
52 if test x${UP[]_CONFIG+set} != xset ; then
53 UP[]_CONFIG=$DOWN[]_config_prefix/bin/DOWN-config
54 fi
55 fi
56
57 AC_PATH_PROG(UP[]_CONFIG, DOWN-config, no)
58 ifelse([$2], ,
59 AC_MSG_CHECKING(for $1),
60 AC_MSG_CHECKING(for $1 - version >= $2)
61 )
62 no_[]DOWN=""
63 if test "$UP[]_CONFIG" = "no" ; then
64 no_[]DOWN=yes
65 else
66 UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args --cflags`"
67 UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args --libs`"
68 ifelse([$2], , ,[
69 DOWN[]_config_major_version=`$UP[]_CONFIG $DOWN[]_config_args \
70 --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
71 DOWN[]_config_minor_version=`$UP[]_CONFIG $DOWN[]_config_args \
72 --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
73 DOWN[]_config_micro_version=`$UP[]_CONFIG $DOWN[]_config_args \
74 --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
75 DOWN[]_wanted_major_version="regexp($2, [\<\([0-9]*\)], [\1])"
76 DOWN[]_wanted_minor_version="regexp($2, [\<\([0-9]*\)\.\([0-9]*\)], [\2])"
77 DOWN[]_wanted_micro_version="regexp($2, [\<\([0-9]*\).\([0-9]*\).\([0-9]*\)], [\3])"
78
79 # Compare wanted version to what config script returned.
80 # If I knew what library was being run, i'd probably also compile
81 # a test program at this point (which also extracted and tested
82 # the version in some library-specific way)
83 if test "$DOWN[]_config_major_version" -lt \
84 "$DOWN[]_wanted_major_version" \
85 -o \( "$DOWN[]_config_major_version" -eq \
86 "$DOWN[]_wanted_major_version" \
87 -a "$DOWN[]_config_minor_version" -lt \
88 "$DOWN[]_wanted_minor_version" \) \
89 -o \( "$DOWN[]_config_major_version" -eq \
90 "$DOWN[]_wanted_major_version" \
91 -a "$DOWN[]_config_minor_version" -eq \
92 "$DOWN[]_wanted_minor_version" \
93 -a "$DOWN[]_config_micro_version" -lt \
94 "$DOWN[]_wanted_micro_version" \) ; then
95 # older version found
96 no_[]DOWN=yes
97 echo -n "*** An old version of $1 "
98 echo -n "($DOWN[]_config_major_version"
99 echo -n ".$DOWN[]_config_minor_version"
100 echo ".$DOWN[]_config_micro_version) was found."
101 echo -n "*** You need a version of $1 newer than "
102 echo -n "$DOWN[]_wanted_major_version"
103 echo -n ".$DOWN[]_wanted_minor_version"
104 echo ".$DOWN[]_wanted_micro_version."
105 echo "***"
106 echo "*** If you have already installed a sufficiently new version, this error"
107 echo "*** probably means that the wrong copy of the DOWN-config shell script is"
108 echo "*** being found. The easiest way to fix this is to remove the old version"
109 echo "*** of $1, but you can also set the UP[]_CONFIG environment to point to the"
110 echo "*** correct copy of DOWN-config. (In this case, you will have to"
111 echo "*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf"
112 echo "*** so that the correct libraries are found at run-time)"
113 fi
114 ])
115 fi
116 if test "x$no_[]DOWN" = x ; then
117 AC_MSG_RESULT(yes)
118 ifelse([$3], , :, [$3])
119 else
120 AC_MSG_RESULT(no)
121 if test "$UP[]_CONFIG" = "no" ; then
122 echo "*** The DOWN-config script installed by $1 could not be found"
123 echo "*** If $1 was installed in PREFIX, make sure PREFIX/bin is in"
124 echo "*** your path, or set the UP[]_CONFIG environment variable to the"
125 echo "*** full path to DOWN-config."
126 fi
127 UP[]_CFLAGS=""
128 UP[]_LIBS=""
129 ifelse([$4], , :, [$4])
130 fi
131 AC_SUBST(UP[]_CFLAGS)
132 AC_SUBST(UP[]_LIBS)
133
134 popdef([UP])
135 popdef([DOWN])
136])
137# xft.m4
138# Copyright (c) 2002 Henrik Kinnunen (fluxgen at linuxmail.org)
139
140# Permission is hereby granted, free of charge, to any person obtaining a
141# copy of this software and associated documentation files (the "Software"),
142# to deal in the Software without restriction, including without limitation
143# the rights to use, copy, modify, merge, publish, distribute, sublicense,
144# and/or sell copies of the Software, and to permit persons to whom the
145# Software is furnished to do so, subject to the following conditions:
146
147# The above copyright notice and this permission notice shall be included in
148# all copies or substantial portions of the Software.
149
150# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
151# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
152# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
153# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
154# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
155# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
156# DEALINGS IN THE SOFTWARE.
157
158# AM_PATH_XFT1([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
159AC_DEFUN([AM_PATH_XFT1],
160[
161 AC_CHECK_LIB(Xft, XftFontOpen,
162 XFT_LIBS="-lXft"
163 [$1],
164 [$2]
165 )
166])
167
168# AM_PATH_XFT2([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
169AC_DEFUN([AM_PATH_XFT2],
170[
171 if test x$pkg_exec_prefix != x ; then
172 xft_args="$xft_args --exec-prefix=$pkg_exec_prefix"
173 if test x${PKG_CONFIG+set} != xset ; then
174 PKG_CONFIG=$pkg_exec_prefix/bin/pkg-config
175 fi
176 fi
177
178 if test x$xft_prefix != x ; then
179 xft_args="$xft_args --prefix=$xft_prefix"
180 if test x${PKG_CONFIG+set} != xset ; then
181 PKG_CONFIG=$xft_prefix/bin/pkg-config
182 fi
183 fi
184
185 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
186 if test "x$PKG_CONFIG" = "xno" ; then
187 ifelse([$2], , :, [$2])
188 else
189 XFT_CFLAGS=`$PKG_CONFIG $xftconf_args --cflags xft fontconfig`
190 XFT_LIBS=`$PKG_CONFIG $xftconf_args --libs xft fontconfig`
191 ifelse([$1], , :, [$1])
192 fi
193])
194
195# AM_PATH_XFT(default-value, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
196# Test for Xft, and define XFT_CFLAGS and XFT_LIBS
197AC_DEFUN([AM_PATH_XFT],
198[
199 AC_ARG_WITH(xft-prefix,[ --with-xft-prefix=path Prefix where Xft is installed (optional)],
200 xft_prefix="$withval", xft_prefix="")
201 AC_ARG_WITH(pkg-exec-prefix,[ --with-pkg-exec-prefix=path Exec prefix where pkg-config is installed (optional)],
202 pkg_exec_prefix="$withval", pkg_exec_prefix="")
203 AC_ARG_ENABLE(xft, [ --enable-xft Xft (antialias) support (default=$1)],
204 if test "x$enableval" = "xyes"; then
205 TRY_XFT=yes
206 else
207 TRY_XFT=no
208 fi
209 ,
210 TRY_XFT=$1
211 )
212
213 if test "x$TRY_XFT" = "xyes"; then
214 AC_MSG_RESULT(yes)
215 AM_PATH_XFT2(
216 [$2],
217 # xft2 failed: try xft1
218 AM_PATH_XFT1(
219 [$2],
220 [$3]
221 AC_MSG_RESULT([Cant find Xft libraries! Disabling Xft]))
222 )
223 else
224 AC_MSG_RESULT(no)
225 [$3]
226 fi
227
228 CFLAGS="$CFLAGS $XFT_CFLAGS"
229 CXXFLAGS="$CXXFLAGS $XFT_CFLAGS"
230 LIBS="$XFT_LIBS $LIBS"
231])