]> icculus.org git repositories - dana/openbox.git/blob - configure.ac
check for python. not for guile.
[dana/openbox.git] / 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 dnl 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   CFLAGS="$CFLAGS -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 CFLAGS)
35     lang_std_not_set=`echo $CFLAGS | grep "\-LANG:std"`
36     if test "x$lang_std_not_set" = "x"; then
37       AC_MSG_RESULT([not set, setting.])
38       CFLAGS="${CFLAGS} -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 CFLAGS="$CFLAGS $DEBUG"
75
76 dnl Check for Python
77 AC_CHECK_HEADER([python2.2/Python.h],
78   PYTHON_CFLAGS="-Ipython2.2",
79   AC_MSG_ERROR([Openbox requires the use of Python 2.2. This is its secret special formula for extreme sexiness.
80 See http://www.python.org
81 ]))
82 AC_CHECK_LIB([python2.2], [Py_Initialize],
83   PYTHON_LDFLAGS="-lpython2.2 -Xlinker -export-dynamic",
84   AC_MSG_ERROR([Openbox requires the use of Python 2.2. This is its secret special formula for extreme sexiness.
85 See http://www.python.org
86 ]))
87 AC_SUBST([PYTHON_CFLAGS])
88 AC_SUBST([PYTHON_LDFLAGS])
89
90 dnl Check for X headers and libraries
91 AC_PATH_X
92 AC_PATH_XTRA
93 test "$no_x" = "yes" && AC_MSG_ERROR([No Xlibs found.])
94 test -z "$x_includes" && x_includes="/usr/include"
95 test -z "$x_libraries" && x_libraries="/usr/lib"
96      
97 CFLAGS="$CFLAGS $X_CFLAGS"
98 LIBS="$LIBS $X_LIBS $X_EXTRA_LIBS"
99 LDFLAGS="$LDFLAGS $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"
100
101 dnl Check for required functions in -lX11
102 AC_CHECK_LIB([X11], [XOpenDisplay],
103   ,
104   AC_MSG_ERROR([Could not find XOpenDisplay in -lX11.])
105 )
106
107
108 dnl Check for Xft >= 2
109 XFT_MIN_MAJOR=2
110 XFT_MIN_MINOR=0
111 XFT_MIN_REVISION=0
112 XFT_MIN=$XFT_MIN_MAJOR.$XFT_MIN_MINOR.$XFT_MIN_REVISION
113 AC_MSG_CHECKING([for Xft version >= $XFT_MIN])
114 if ! pkg-config --atleast-version $XFT_MIN xft; then
115   AC_MSG_RESULT([no])
116   AC_MSG_ERROR([Openbox requires the Xft version >= $XFT_MIN font library.
117 See http://www.fontconfig.org/
118 ])
119 fi
120
121 AC_MSG_RESULT([yes])
122
123 dnl Store these
124 OLDLIBS=$LIBS
125 OLDCFLAGS=$CFLAGS
126
127 XFT_CFLAGS="`pkg-config --cflags xft`"
128 XFT_LIBS="`pkg-config --libs xft`"
129
130 dnl Set these for checking with the tests below. They'll be restored after
131 LIBS="$LIBS $XFT_LIBS"
132 CFLAGS="$XFT_CFLAGS $CFLAGS"
133
134 AC_CHECK_LIB([Xft], [XftFontOpenName],
135   AC_MSG_CHECKING([for X11/Xft/Xft.h for Xft >= $XFT_MIN])
136   AC_TRY_COMPILE(
137     [
138       #include <X11/Xlib.h>
139       #include <X11/Xft/Xft.h>
140     ],
141     [
142       #if !defined(XFT_MAJOR)
143       # error Xft.h is too old
144       #endif
145       #if XFT_MAJOR < $XFT_MIN_MAJOR
146       # error Xft.h is too old
147       #endif
148       #if XFT_MAJOR == $XFT_MIN_MAJOR
149       # if XFT_MINOR < $XFT_MIN_MINOR
150       #  error Xft.h is too old
151       # endif
152       #endif
153       #if XFT_MAJOR == $XFT_MIN_MAJOR
154       # if XFT_MAJOR == $XFT_MIN_MINOR
155       #  if XFT_REVISION < $XFT_MIN_REVISION
156       #   error Xft.h is too old
157       #  endif
158       # endif
159       #endif
160       
161       int i = XFT_MAJOR;
162       XftFont foo;
163     ],
164     [
165       AC_MSG_RESULT([yes])
166     ],
167     [
168       AC_MSG_RESULT([no])
169       AC_MSG_ERROR([Openbox requires the Xft version >= $XFT_MIN font library.
170 See http://www.fontconfig.org/
171 ])
172     ]
173   )
174
175   AC_MSG_CHECKING([if we can compile with Xft])
176   AC_TRY_LINK(
177     [
178       #include <X11/Xlib.h>
179       #include <X11/Xft/Xft.h>
180     ],
181     [
182       int i = XFT_MAJOR;
183       XftFont foo
184     ],
185     [
186       AC_MSG_RESULT([yes])
187     ],
188     [ 
189       AC_MSG_RESULT([no])
190       AC_MSG_ERROR([Unable to compile with the Xft library.
191 ])
192     ]
193   )
194 )
195 dnl Restore the old values. Use XFT_CFLAGS and XFT_LIBS in the Makefile.am's
196 LIBS=$OLDLIBS
197 CFLAGS=$OLDCFLAGS
198
199 AC_SUBST([XFT_CFLAGS])
200 AC_SUBST([XFT_LIBS])
201
202 dnl Check for XShape extension support
203 AC_CHECK_LIB([Xext], [XShapeCombineShape],
204   AC_MSG_CHECKING([for X11/extensions/shape.h])
205   AC_TRY_LINK(
206     [
207       #include <X11/Xlib.h>
208       #include <X11/Xutil.h>
209       #include <X11/extensions/shape.h>
210     ],
211     [
212       long foo = ShapeSet
213     ],
214     [
215       AC_MSG_RESULT([yes])
216       SHAPE="yes"
217       AC_DEFINE([SHAPE], [1], [Found the XShape extension])
218       LIBS="$LIBS -lXext"
219     ],
220     [ 
221       AC_MSG_RESULT([no])
222       SHAPE="no"
223     ]
224   )
225 )
226 AC_MSG_CHECKING([for the XShape extension])
227 if test "$SHAPE" = "yes"; then
228   AC_MSG_RESULT([yes])
229 else
230   AC_MSG_RESULT([no])
231 fi
232
233 dnl Check for Xinerama extension support
234 AC_MSG_CHECKING([whether to build support for the Xinerama extension])
235 XINERAMA="no"
236 AC_ARG_ENABLE([xinerama],
237 [  --enable-xinerama       enable support of the Xinerama extension @<:@default=no@:>@],
238   if test "$enableval" = "yes"; then
239         AC_MSG_RESULT([yes])
240
241         AC_CHECK_LIB([Xinerama], [XineramaQueryExtension],
242           [
243             AC_MSG_CHECKING([for X11/extensions/Xinerama.h])
244             AC_TRY_LINK(
245               [
246                 #include <X11/Xlib.h>
247                 #include <X11/extensions/Xinerama.h>
248               ],
249               [
250                 XineramaScreenInfo foo
251               ],
252               [
253                 AC_MSG_RESULT([yes])
254                 XINERAMA="yes"
255                 AC_DEFINE([XINERAMA], [1],
256                           [Enable support of the Xinerama extension])
257                 LIBS="$LIBS -lXinerama"
258               ],
259               [
260                 AC_MSG_RESULT([no])
261               ]
262             )
263           ]
264         )
265
266     AC_MSG_CHECKING([for the Xinerama extension])
267     if test "$XINRERAMA" = "yes"; then
268       AC_MSG_RESULT([yes])
269     else
270       AC_MSG_RESULT([no])
271     fi
272   else
273         AC_MSG_RESULT([no])
274   fi,
275   AC_MSG_RESULT([no])
276 )
277
278
279
280 AC_CONFIG_FILES([Makefile
281                 m4/Makefile 
282                 po/Makefile.in
283                 intl/Makefile
284                 otk/Makefile
285                 src/Makefile
286                 util/Makefile
287                 util/epist/Makefile
288                 doc/Makefile
289                 doc/doxygen/Makefile
290                 data/Makefile
291                 data/styles/Makefile
292                 version.h
293                 ])
294 AC_OUTPUT
295
296 AC_MSG_RESULT
297 AC_MSG_RESULT([$PACKAGE version $VERSION configured successfully.])
298
299 AC_MSG_RESULT
300 AC_MSG_RESULT([Using '$prefix' for installation.])
301 AC_MSG_RESULT([Using '$CXX' for C++ compiler.])
302 AC_MSG_RESULT([Building with '$CFLAGS' for C++ compiler flags.])
303 AC_MSG_RESULT([Building with '$LIBS' for linker flags.])
304 AC_MSG_RESULT
305 AC_MSG_RESULT([configure complete, now type \"make\"])
306 AC_MSG_RESULT