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