]> icculus.org git repositories - mikachu/openbox.git/blob - configure.ac
look for xft
[mikachu/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 -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 Xft2
95 AC_MSG_CHECKING([for Xft version 2])
96 XFT2=""
97 if pkg-config xft; then
98   AC_MSG_RESULT([yes])
99   XFT2="yes"
100   LIBS="$LIBS `pkg-config --libs xft`"
101   CXXFLAGS="`pkg-config --cflags xft` $CXXFLAGS"
102 else
103   AC_MSG_RESULT([no])
104 fi
105
106 AC_CHECK_LIB([Xft], [XftFontOpenXlfd],
107   AC_MSG_CHECKING([for X11/Xft/Xft.h])
108   AC_TRY_LINK(
109     [
110       #include <X11/Xlib.h>
111       #include <X11/Xft/Xft.h>
112     ],
113     [
114       XftFont foo
115     ],
116     [
117       AC_MSG_RESULT([yes])
118       dnl This is for Xft version 1
119       test "$XFT2" = "yes" || LIBS="$LIBS -lXft"
120     ],
121     [ 
122       AC_MSG_RESULT([no])
123       AC_MSG_ERROR([Openbox requires the Xft font library.
124 See http://www.fontconfig.org/
125 ])
126     ]
127   )
128 )
129
130 dnl Check for XShape extension support
131 AC_CHECK_LIB([Xext], [XShapeCombineShape],
132   AC_MSG_CHECKING([for X11/extensions/shape.h])
133   AC_TRY_LINK(
134     [
135       #include <X11/Xlib.h>
136       #include <X11/Xutil.h>
137       #include <X11/extensions/shape.h>
138     ],
139     [
140       long foo = ShapeSet
141     ],
142     [
143       AC_MSG_RESULT([yes])
144       SHAPE="yes"
145       AC_DEFINE([SHAPE], [1], [Found the XShape extension])
146       LIBS="$LIBS -lXext"
147     ],
148     [ 
149       AC_MSG_RESULT([no])
150       SHAPE="no"
151     ]
152   )
153 )
154 AC_MSG_CHECKING([for the XShape extension])
155 if test "$SHAPE" = "yes"; then
156   AC_MSG_RESULT([yes])
157 else
158   AC_MSG_RESULT([no])
159 fi
160
161 dnl Check for Xinerama extension support
162 AC_MSG_CHECKING([whether to build support for the Xinerama extension])
163 XINERAMA="no"
164 AC_ARG_ENABLE([xinerama],
165 [  --enable-xinerama       enable support of the Xinerama extension @<:@default=no@:>@],
166   if test "$enableval" = "yes"; then
167         AC_MSG_RESULT([yes])
168
169         AC_CHECK_LIB([Xinerama], [XineramaQueryExtension],
170           [
171             AC_MSG_CHECKING([for X11/extensions/Xinerama.h])
172             AC_TRY_LINK(
173               [
174                 #include <X11/Xlib.h>
175                 #include <X11/extensions/Xinerama.h>
176               ],
177               [
178                 XineramaScreenInfo foo
179               ],
180               [
181                 AC_MSG_RESULT([yes])
182                 XINERAMA="yes"
183                 AC_DEFINE([XINERAMA], [1],
184                           [Enable support of the Xinerama extension])
185                 LIBS="$LIBS -lXinerama"
186               ],
187               [
188                 AC_MSG_RESULT([no])
189               ]
190             )
191           ]
192         )
193
194     AC_MSG_CHECKING([for the Xinerama extension])
195     if test "$XINRERAMA" = "yes"; then
196       AC_MSG_RESULT([yes])
197     else
198       AC_MSG_RESULT([no])
199     fi
200   else
201         AC_MSG_RESULT([no])
202   fi,
203   AC_MSG_RESULT([no])
204 )
205
206
207
208 AC_CONFIG_FILES([Makefile
209                 m4/Makefile 
210                 po/Makefile.in
211                 intl/Makefile
212                 otk/Makefile
213                 src/Makefile
214                 util/Makefile
215                 util/epist/Makefile
216                 doc/Makefile
217                 doc/doxygen/Makefile
218                 data/Makefile
219                 data/styles/Makefile
220                 version.h
221                 ])
222 AC_OUTPUT
223
224 AC_MSG_RESULT
225 AC_MSG_RESULT([$PACKAGE version $VERSION configured successfully.])
226
227 AC_MSG_RESULT
228 AC_MSG_RESULT([Using '$prefix' for installation.])
229 AC_MSG_RESULT([Using '$CXX' for C++ compiler.])
230 AC_MSG_RESULT([Building with '$CPPFLAGS' for C++ compiler flags.])
231 AC_MSG_RESULT([Building with '$LIBS' for linker flags.])
232 AC_MSG_RESULT
233 AC_MSG_RESULT([configure complete, now type \"make\"])
234 AC_MSG_RESULT