]> Dogcows Code - chaz/openbox/blob - configure.ac
better xft checks. require xft version 2
[chaz/openbox] / configure.ac
1 AC_INIT([src/main.cc])
2 AM_CONFIG_HEADER(config.h)
3 AM_INIT_AUTOMAKE([openbox], [2.90.0cvs])
4
5 AC_PREREQ([2.50])
6
7 AC_PATH_PROG([regex_cmd], [sed])
8 test -z $regex_cmd && AC_MSG_ERROR([sed not found])
9
10 AC_PROG_CC
11 AC_PROG_CXX
12 AC_PROG_LIBTOOL
13 LIBTOOL="$LIBTOOL --silent"
14 AC_PROG_INSTALL
15
16 ALL_LINGUAS=""
17 AM_GNU_GETTEXT
18
19 AC_LANG(C++)
20
21 dnl Check what compiler we are using
22 AC_MSG_CHECKING([for GCC])
23 if test "$GCC" = "yes"; then
24 AC_MSG_RESULT([yes])
25 CPPFLAGS="$CPPFLAGS -Wall -W -pedantic"
26 else
27 AC_MSG_RESULT([no, trying other compilers])
28 AC_MSG_CHECKING(for MIPSpro)
29 mips_pro_ver=`$CXX -version 2>&1 | grep -i mipspro | cut -f4 -d ' '`
30 if test -z "$mips_pro_ver"; then
31 AC_MSG_RESULT([no])
32 else
33 AC_MSG_RESULT([yes, version $mips_pro_ver.])
34 AC_MSG_CHECKING(for -LANG:std in CPPFLAGS)
35 lang_std_not_set=`echo $CPPFLAGS | grep "\-LANG:std"`
36 if test "x$lang_std_not_set" = "x"; then
37 AC_MSG_RESULT([not set, setting.])
38 CPPFLAGS="${CPPFLAGS} -LANG:std"
39 else
40 AC_MSG_RESULT([already set.])
41 fi
42 fi
43 fi
44
45 dnl Determine if maintainer portions of the Makefiles should be included.
46 AM_MAINTAINER_MODE
47
48 dnl Check for system header files
49 AC_CHECK_HEADERS(ctype.h dirent.h fcntl.h libgen.h locale.h nl_types.h process.h signal.h stdarg.h stdio.h stdlib.h string.h time.h unistd.h sys/param.h sys/select.h sys/signal.h sys/stat.h sys/time.h sys/types.h sys/wait.h)
50 AC_HEADER_TIME
51
52 dnl Determine the return type of signal handlers
53 AC_TYPE_SIGNAL
54
55 dnl Check whether to include debugging code
56 DEBUG=""
57 AC_MSG_CHECKING([whether to include verbose debugging code])
58 AC_ARG_ENABLE([debug],
59 [ --enable-debug include verbose debugging code @<:@default=no@:>@],
60 if test "$enableval" = "yes"; then
61 AC_MSG_RESULT([yes])
62 if test "$GCC" = "yes"; then
63 DEBUG="-DDEBUG -fno-inline -g"
64 else
65 DEBUG="-DDEBUG"
66 fi
67 else
68 AC_MSG_RESULT([no])
69 DEBUG="-DNDEBUG"
70 fi,
71 AC_MSG_RESULT([no])
72 DEBUG="-DNDEBUG"
73 )
74 CPPFLAGS="$CPPFLAGS $DEBUG"
75
76 dnl Check for X headers and libraries
77 AC_PATH_X
78 AC_PATH_XTRA
79 test "$no_x" = "yes" && AC_MSG_ERROR([No Xlibs found.])
80 test -z "$x_includes" && x_includes="/usr/include"
81 test -z "$x_libraries" && x_libraries="/usr/lib"
82
83 CPPFLAGS="$CPPFLAGS $X_CPPFLAGS"
84 LIBS="$LIBS $X_LIBS $X_EXTRA_LIBS"
85 LDFLAGS="$LDFLAGS $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"
86
87 dnl Check for required functions in -lX11
88 AC_CHECK_LIB([X11], [XOpenDisplay],
89 ,
90 AC_MSG_ERROR([Could not find XOpenDisplay in -lX11.])
91 )
92
93
94 dnl Check for Xft >= 2
95 XFT_MIN_MAJOR=2
96 XFT_MIN_MINOR=0
97 XFT_MIN_REVISION=0
98 XFT_MIN=$XFT_MIN_MAJOR.$XFT_MIN_MINOR.$XFT_MIN_REVISION
99 AC_MSG_CHECKING([for Xft version >= $XFT_MIN])
100 if ! pkg-config --atleast-version $XFT_MIN xft; then
101 AC_MSG_RESULT([no])
102 AC_MSG_ERROR([Openbox requires the Xft version >= $XFT_MIN font library.
103 See http://www.fontconfig.org/
104 ])
105 fi
106
107 AC_MSG_RESULT([yes])
108
109 dnl Store these
110 OLDLIBS=$LIBS
111 OLDCPPFLAGS=$CPPFLAGS
112
113 XFT_CFLAGS="`pkg-config --cflags xft`"
114 XFT_LIBS="`pkg-config --libs xft`"
115
116 dnl Set these for checking with the tests below. They'll be restored after
117 LIBS="$LIBS $XFT_LIBS"
118 CPPFLAGS="$XFT_CFLAGS $CPPFLAGS"
119
120 AC_CHECK_LIB([Xft], [XftFontOpenName],
121 AC_MSG_CHECKING([for X11/Xft/Xft.h for Xft >= $XFT_MIN])
122 AC_TRY_COMPILE(
123 [
124 #include <X11/Xlib.h>
125 #include <X11/Xft/Xft.h>
126 ],
127 [
128 #if !defined(XFT_MAJOR)
129 # error Xft.h is too old
130 #endif
131 #if XFT_MAJOR < $XFT_MIN_MAJOR
132 # error Xft.h is too old
133 #endif
134 #if XFT_MAJOR == $XFT_MIN_MAJOR
135 # if XFT_MINOR < $XFT_MIN_MINOR
136 # error Xft.h is too old
137 # endif
138 #endif
139 #if XFT_MAJOR == $XFT_MIN_MAJOR
140 # if XFT_MAJOR == $XFT_MIN_MINOR
141 # if XFT_REVISION < $XFT_MIN_REVISION
142 # error Xft.h is too old
143 # endif
144 # endif
145 #endif
146
147 int i = XFT_MAJOR;
148 XftFont foo;
149 ],
150 [
151 AC_MSG_RESULT([yes])
152 ],
153 [
154 AC_MSG_RESULT([no])
155 AC_MSG_ERROR([Openbox requires the Xft version >= $XFT_MIN font library.
156 See http://www.fontconfig.org/
157 ])
158 ]
159 )
160
161 AC_MSG_CHECKING([if we can compile with Xft])
162 AC_TRY_LINK(
163 [
164 #include <X11/Xlib.h>
165 #include <X11/Xft/Xft.h>
166 ],
167 [
168 int i = XFT_MAJOR;
169 XftFont foo
170 ],
171 [
172 AC_MSG_RESULT([yes])
173 ],
174 [
175 AC_MSG_RESULT([no])
176 AC_MSG_ERROR([Unable to compile with the Xft library.
177 ])
178 ]
179 )
180 )
181 dnl Restore the old values. Use XFT_CFLAGS and XFT_LIBS in the Makefile.am's
182 LIBS=$OLDLIBS
183 CPPFLAGS=$OLDCPPFLAGS
184
185 AC_SUBST([XFT_CFLAGS])
186 AC_SUBST([XFT_LIBS])
187
188 dnl Check for XShape extension support
189 AC_CHECK_LIB([Xext], [XShapeCombineShape],
190 AC_MSG_CHECKING([for X11/extensions/shape.h])
191 AC_TRY_LINK(
192 [
193 #include <X11/Xlib.h>
194 #include <X11/Xutil.h>
195 #include <X11/extensions/shape.h>
196 ],
197 [
198 long foo = ShapeSet
199 ],
200 [
201 AC_MSG_RESULT([yes])
202 SHAPE="yes"
203 AC_DEFINE([SHAPE], [1], [Found the XShape extension])
204 LIBS="$LIBS -lXext"
205 ],
206 [
207 AC_MSG_RESULT([no])
208 SHAPE="no"
209 ]
210 )
211 )
212 AC_MSG_CHECKING([for the XShape extension])
213 if test "$SHAPE" = "yes"; then
214 AC_MSG_RESULT([yes])
215 else
216 AC_MSG_RESULT([no])
217 fi
218
219 dnl Check for Xinerama extension support
220 AC_MSG_CHECKING([whether to build support for the Xinerama extension])
221 XINERAMA="no"
222 AC_ARG_ENABLE([xinerama],
223 [ --enable-xinerama enable support of the Xinerama extension @<:@default=no@:>@],
224 if test "$enableval" = "yes"; then
225 AC_MSG_RESULT([yes])
226
227 AC_CHECK_LIB([Xinerama], [XineramaQueryExtension],
228 [
229 AC_MSG_CHECKING([for X11/extensions/Xinerama.h])
230 AC_TRY_LINK(
231 [
232 #include <X11/Xlib.h>
233 #include <X11/extensions/Xinerama.h>
234 ],
235 [
236 XineramaScreenInfo foo
237 ],
238 [
239 AC_MSG_RESULT([yes])
240 XINERAMA="yes"
241 AC_DEFINE([XINERAMA], [1],
242 [Enable support of the Xinerama extension])
243 LIBS="$LIBS -lXinerama"
244 ],
245 [
246 AC_MSG_RESULT([no])
247 ]
248 )
249 ]
250 )
251
252 AC_MSG_CHECKING([for the Xinerama extension])
253 if test "$XINRERAMA" = "yes"; then
254 AC_MSG_RESULT([yes])
255 else
256 AC_MSG_RESULT([no])
257 fi
258 else
259 AC_MSG_RESULT([no])
260 fi,
261 AC_MSG_RESULT([no])
262 )
263
264
265
266 AC_CONFIG_FILES([Makefile
267 m4/Makefile
268 po/Makefile.in
269 intl/Makefile
270 otk/Makefile
271 src/Makefile
272 util/Makefile
273 util/epist/Makefile
274 doc/Makefile
275 doc/doxygen/Makefile
276 data/Makefile
277 data/styles/Makefile
278 version.h
279 ])
280 AC_OUTPUT
281
282 AC_MSG_RESULT
283 AC_MSG_RESULT([$PACKAGE version $VERSION configured successfully.])
284
285 AC_MSG_RESULT
286 AC_MSG_RESULT([Using '$prefix' for installation.])
287 AC_MSG_RESULT([Using '$CXX' for C++ compiler.])
288 AC_MSG_RESULT([Building with '$CPPFLAGS' for C++ compiler flags.])
289 AC_MSG_RESULT([Building with '$LIBS' for linker flags.])
290 AC_MSG_RESULT
291 AC_MSG_RESULT([configure complete, now type \"make\"])
292 AC_MSG_RESULT
This page took 0.049857 seconds and 5 git commands to generate.