]> Dogcows Code - chaz/openbox/blob - configure.ac
draw only when needed
[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 "$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_VERSION(0.11.5)
18 AM_GNU_GETTEXT([external])
19
20 AC_LANG(C++)
21
22 # Check what compiler we are using
23 AC_MSG_CHECKING([for GCC])
24 if test "$GCC" = "yes"; then
25 AC_MSG_RESULT([yes])
26 CXXFLAGS="$CXXFLAGS -Wall -W"
27 # -pedantic"
28 else
29 AC_MSG_RESULT([no, trying other compilers])
30 AC_MSG_CHECKING(for MIPSpro)
31 mips_pro_ver=`$CXX -version 2>&1 | grep -i mipspro | cut -f4 -d ' '`
32 if test -z "$mips_pro_ver"; then
33 AC_MSG_RESULT([no])
34 else
35 AC_MSG_RESULT([yes, version $mips_pro_ver.])
36 AC_MSG_CHECKING(for -LANG:std in CXXFLAGS)
37 lang_std_not_set=`echo $CXXFLAGS | grep "\-LANG:std"`
38 if test "x$lang_std_not_set" = "x"; then
39 AC_MSG_RESULT([not set, setting.])
40 CXXFLAGS="${CXXFLAGS} -LANG:std"
41 else
42 AC_MSG_RESULT([already set.])
43 fi
44 fi
45 fi
46
47 # Determine if maintainer portions of the Makefiles should be included.
48 AM_MAINTAINER_MODE
49
50 # Check for system header files
51 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)
52 AC_HEADER_TIME
53
54 # Determine the return type of signal handlers
55 # AC_TYPE_SIGNAL
56
57 # Check whether to include debugging code
58 DEBUG=""
59 AC_MSG_CHECKING([whether to include verbose debugging code])
60 AC_ARG_ENABLE([debug],
61 [ --enable-debug include verbose debugging code @<:@default=no@:>@],
62 if test "$enableval" = "yes"; then
63 AC_MSG_RESULT([yes])
64 if test "$GCC" = "yes"; then
65 DEBUG="-DDEBUG -fno-inline -g"
66 else
67 DEBUG="-DDEBUG"
68 fi
69 else
70 AC_MSG_RESULT([no])
71 DEBUG="-DNDEBUG"
72 fi,
73 AC_MSG_RESULT([no])
74 DEBUG="-DNDEBUG"
75 )
76 CXXFLAGS="$CXXFLAGS $DEBUG"
77
78 # Check for Python
79 AC_ARG_WITH([python],
80 [ --with-python=path Set location of Python executable],
81 [PYTHON="$withval"],
82 [PYTHON=])
83
84 # Find the python bin
85 if ! test "$PYTHON"; then
86 AC_CHECK_PROGS(PYTHON, $prefix/bin/python python python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python1.4)
87 fi
88 if ! test "$PYTHON"; then
89 AC_MSG_ERROR([Openbox requires the use of Python. This is its secret special formula for extreme sexiness.
90 See http://www.python.org
91 ])
92 fi
93
94 # Find our python paths
95 AC_MSG_CHECKING([for Python version])
96 # Need to do this hack since autoconf replaces __file__ with the name of the configure file
97 filehack="file__"
98 PYVERSION=`($PYTHON -c "import string,operator; print operator.getitem(string.split(string.__$filehack,'/'),-2)")`
99 AC_MSG_RESULT([$PYVERSION])
100
101 AC_MSG_CHECKING([for Python prefix])
102 PYPREFIX=`($PYTHON -c "import sys; print sys.prefix") 2>/dev/null`
103 AC_MSG_RESULT([$PYPREFIX])
104 AC_MSG_CHECKING([for Python exec-prefix])
105 PYEPREFIX=`($PYTHON -c "import sys; print sys.exec_prefix") 2>/dev/null`
106 AC_MSG_RESULT([$PYEPREFIX])
107
108 # Find the include directory
109 AC_MSG_CHECKING([for Python header files])
110 if test -r "$PYPREFIX/include/$PYVERSION/Python.h"; then
111 PYTHON_CFLAGS="-I$PYPREFIX/include/$PYVERSION"
112 fi
113 if test -z "$PYTHON_CFLAGS"; then
114 if test -r "$PYPREFIX/include/Py/Python.h"; then
115 PYTHON_CFLAGS="-I$PYPREFIX/include/Py"
116 fi
117 fi
118 if ! test "$PYTHON_CFLAGS"; then
119 AC_MSG_ERROR([Not found])
120 else
121 AC_MSG_RESULT([$PYTHON_CFLAGS])
122 fi
123
124 # Set the library directory blindly. This probably won't work with older versions
125 AC_MSG_CHECKING([for Python library])
126 dirs="$PYVERSION/config $PYVERSION/lib python/lib"
127 for i in $dirs; do
128 if test -d "$PYEPREFIX/lib/$i"; then
129 PYLIB="$PYEPREFIX/lib/$i"
130 break
131 fi
132 done
133 if ! test "$PYLIB"; then
134 AC_MSG_ERROR([Not found])
135 else
136 AC_MSG_RESULT([$PYLIB])
137 fi
138
139 # Check for really old versions
140 if test -r "$PYLIB/libPython.a"; then
141 PYTHON_LIBS="-L$PYLIB -lModules -lPython -lObjects -lParser"
142 else
143 PYTHON_LIBS="-L$PYLIB -l$PYVERSION"
144 fi
145
146 AC_SUBST([PYTHON_CFLAGS])
147 AC_SUBST([PYTHON_LIBS])
148
149 # Check for X headers and libraries
150 AC_PATH_X
151 AC_PATH_XTRA
152 test "$no_x" = "yes" && AC_MSG_ERROR([No Xlibs found.])
153 test -z "$x_includes" && x_includes="/usr/include"
154 test -z "$x_libraries" && x_libraries="/usr/lib"
155
156 CXXFLAGS="$CXXFLAGS $X_CFLAGS"
157 LIBS="$LIBS $X_LIBS $X_EXTRA_LIBS"
158 LDFLAGS="$LDFLAGS $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"
159
160 # Check for required functions in -lX11
161 AC_CHECK_LIB([X11], [XOpenDisplay],
162 ,
163 AC_MSG_ERROR([Could not find XOpenDisplay in -lX11.])
164 )
165
166
167 # Check for Xft >= 2
168 XFT_MIN_MAJOR=2
169 XFT_MIN_MINOR=0
170 XFT_MIN_REVISION=0
171 XFT_MIN=$XFT_MIN_MAJOR.$XFT_MIN_MINOR.$XFT_MIN_REVISION
172 AC_MSG_CHECKING([for Xft version >= $XFT_MIN])
173 if ! pkg-config --atleast-version $XFT_MIN xft; then
174 AC_MSG_RESULT([no])
175 AC_MSG_ERROR([Openbox requires the Xft version >= $XFT_MIN font library.
176 See http://www.fontconfig.org/
177 ])
178 fi
179
180 AC_MSG_RESULT([yes])
181
182 # Store these
183 OLDLIBS=$LIBS
184 OLDCXXFLAGS=$CXXFLAGS
185
186 XFT_CFLAGS="`pkg-config --cflags xft`"
187 XFT_LIBS="`pkg-config --libs xft`"
188
189 # Set these for checking with the tests below. They'll be restored after
190 LIBS="$LIBS $XFT_LIBS"
191 CXXFLAGS="$XFT_CFLAGS $CXXFLAGS"
192
193 AC_CHECK_LIB([Xft], [XftFontOpenName],
194 AC_MSG_CHECKING([for X11/Xft/Xft.h for Xft >= $XFT_MIN])
195 AC_TRY_COMPILE(
196 [
197 #include <X11/Xlib.h>
198 #include <X11/Xft/Xft.h>
199 ],
200 [
201 #if !defined(XFT_MAJOR)
202 # error Xft.h is too old
203 #endif
204 #if XFT_MAJOR < $XFT_MIN_MAJOR
205 # error Xft.h is too old
206 #endif
207 #if XFT_MAJOR == $XFT_MIN_MAJOR
208 # if XFT_MINOR < $XFT_MIN_MINOR
209 # error Xft.h is too old
210 # endif
211 #endif
212 #if XFT_MAJOR == $XFT_MIN_MAJOR
213 # if XFT_MAJOR == $XFT_MIN_MINOR
214 # if XFT_REVISION < $XFT_MIN_REVISION
215 # error Xft.h is too old
216 # endif
217 # endif
218 #endif
219
220 int i = XFT_MAJOR;
221 XftFont foo;
222 ],
223 [
224 AC_MSG_RESULT([yes])
225 ],
226 [
227 AC_MSG_RESULT([no])
228 AC_MSG_ERROR([Openbox requires the Xft version >= $XFT_MIN font library.
229 See http://www.fontconfig.org/
230 ])
231 ]
232 )
233
234 AC_MSG_CHECKING([if we can compile with Xft])
235 AC_TRY_LINK(
236 [
237 #include <X11/Xlib.h>
238 #include <X11/Xft/Xft.h>
239 ],
240 [
241 int i = XFT_MAJOR;
242 XftFont foo
243 ],
244 [
245 AC_MSG_RESULT([yes])
246 ],
247 [
248 AC_MSG_RESULT([no])
249 AC_MSG_ERROR([Unable to compile with the Xft library.
250 ])
251 ]
252 )
253 )
254 # Restore the old values. Use XFT_CFLAGS and XFT_LIBS in the Makefile.am's
255 LIBS=$OLDLIBS
256 CXXFLAGS=$OLDCXXFLAGS
257
258 AC_SUBST([XFT_CFLAGS])
259 AC_SUBST([XFT_LIBS])
260
261 # Check for XShape extension support
262 AC_CHECK_LIB([Xext], [XShapeCombineShape],
263 AC_MSG_CHECKING([for X11/extensions/shape.h])
264 AC_TRY_LINK(
265 [
266 #include <X11/Xlib.h>
267 #include <X11/Xutil.h>
268 #include <X11/extensions/shape.h>
269 ],
270 [
271 long foo = ShapeSet
272 ],
273 [
274 AC_MSG_RESULT([yes])
275 SHAPE="yes"
276 AC_DEFINE([SHAPE], [1], [Found the XShape extension])
277 LIBS="$LIBS -lXext"
278 ],
279 [
280 AC_MSG_RESULT([no])
281 SHAPE="no"
282 ]
283 )
284 )
285 AC_MSG_CHECKING([for the XShape extension])
286 if test "$SHAPE" = "yes"; then
287 AC_MSG_RESULT([yes])
288 else
289 AC_MSG_RESULT([no])
290 fi
291
292 # Check for Xinerama extension support
293 AC_MSG_CHECKING([whether to build support for the Xinerama extension])
294 XINERAMA="no"
295 AC_ARG_ENABLE([xinerama],
296 [ --enable-xinerama enable support of the Xinerama extension @<:@default=no@:>@],
297 if test "$enableval" = "yes"; then
298 AC_MSG_RESULT([yes])
299
300 AC_CHECK_LIB([Xinerama], [XineramaQueryExtension],
301 [
302 AC_MSG_CHECKING([for X11/extensions/Xinerama.h])
303 AC_TRY_LINK(
304 [
305 #include <X11/Xlib.h>
306 #include <X11/extensions/Xinerama.h>
307 ],
308 [
309 XineramaScreenInfo foo
310 ],
311 [
312 AC_MSG_RESULT([yes])
313 XINERAMA="yes"
314 AC_DEFINE([XINERAMA], [1],
315 [Enable support of the Xinerama extension])
316 LIBS="$LIBS -lXinerama"
317 ],
318 [
319 AC_MSG_RESULT([no])
320 ]
321 )
322 ]
323 )
324
325 AC_MSG_CHECKING([for the Xinerama extension])
326 if test "$XINRERAMA" = "yes"; then
327 AC_MSG_RESULT([yes])
328 else
329 AC_MSG_RESULT([no])
330 fi
331 else
332 AC_MSG_RESULT([no])
333 fi,
334 AC_MSG_RESULT([no])
335 )
336
337 AC_CONFIG_FILES([Makefile po/Makefile.in
338 otk/Makefile
339 src/Makefile
340 scripts/Makefile
341 util/Makefile
342 util/epist/Makefile
343 doc/Makefile
344 doc/doxygen/Makefile
345 data/Makefile
346 data/styles/Makefile
347 version.h
348 ])
349 AC_OUTPUT
350
351 AC_MSG_RESULT
352 AC_MSG_RESULT([$PACKAGE version $VERSION configured successfully.])
353
354 AC_MSG_RESULT
355 AC_MSG_RESULT([Using '$prefix' for installation.])
356 AC_MSG_RESULT([Using '$CXX' for C++ compiler.])
357 AC_MSG_RESULT([Building with '$CXXFLAGS' for C++ compiler flags.])
358 AC_MSG_RESULT([Building with '$LIBS' for linker flags.])
359 AC_MSG_RESULT
360 AC_MSG_RESULT([configure complete, now type \"make\"])
361 AC_MSG_RESULT
This page took 0.051077 seconds and 4 git commands to generate.