Initial revision
[mikachu/openbox.git] / configure.in
1 dnl configure.in for Openbox
2 dnl Initialize autoconf and automake
3 AC_INIT(src/openbox.cc)
4 AM_INIT_AUTOMAKE(openbox,0.99.0,no-define)
5
6 dnl Determine default prefix
7 test x$prefix = "xNONE" && prefix="$ac_default_prefix"
8
9 dnl Check for various flavors of UNIX(r)
10 dnl AC_AIX
11 dnl AC_ISC_POSIX
12
13 dnl Locate required external software
14 AC_PROG_CC
15 AC_PROG_CXX
16 AC_PROG_INSTALL
17
18 AC_CHECK_PROGS(regex_cmd, sed)
19 if test x$regex_cmd = "x"; then
20   AC_MSG_ERROR([error. sed is required to build the default menu file.])
21 fi
22
23 dnl Check for system header files
24 AC_HEADER_STDC
25 AC_CHECK_HEADERS(ctype.h dirent.h fcntl.h libgen.h locale.h nl_types.h process.h signal.h stdarg.h stdio.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)
26 AC_HEADER_TIME
27
28 dnl Check for existance of basename(), setlocale() and strftime()
29 AC_CHECK_FUNCS(basename, , AC_CHECK_LIB(gen, basename,
30                           AC_DEFINE(HAVE_BASENAME) LIBS="$LIBS -lgen"))
31 AC_CHECK_FUNCS(getpid setlocale sigaction strftime strcasestr snprintf vsnprintf catopen catgets catclose)
32 AC_CHECK_LIB(nsl, t_open, LIBS="$LIBS -lnsl")
33 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
34
35 dnl Check for X headers and libraries
36 AC_PATH_X
37 AC_PATH_XTRA
38
39 test x$no_x = "xyes" && AC_MSG_ERROR([Openbox requires the X Window System libraries and headers.])
40
41 test x$x_includes = "x" && x_includes="/usr/include"
42 test x$x_libraries = "x" && x_libraries="/usr/lib"
43
44 CFLAGS="$CFLAGS $X_CFLAGS"
45 CXXFLAGS="$CXXFLAGS $X_CFLAGS"
46 LIBS="$LIBS $X_LIBS"
47 LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS"
48
49 dnl Check for required functions in -lX11
50 AC_CHECK_LIB(X11, XOpenDisplay,
51   LIBS="$LIBS -lX11",
52   AC_MSG_ERROR([Could not find XOpenDisplay in -lX11.])
53 )
54
55 LIBS="$LIBS $X_EXTRA_LIBS"
56
57 Xext_lib=""
58
59 dnl Check for XShape extension support and proper library files.
60 SHAPE=""
61 AC_MSG_CHECKING([whether to build support for the XShape extension])
62 AC_ARG_ENABLE(
63   shape, [  --enable-shape          enable support of the XShape extension [default=yes]])
64
65 : ${enableval="yes"}
66 if test x$enableval = "xyes"; then
67   AC_MSG_RESULT([yes])
68   AC_CHECK_LIB(Xext, XShapeCombineShape,
69     AC_MSG_CHECKING([for X11/extensions/shape.h])
70     AC_TRY_LINK(
71 #include <X11/Xlib.h>
72 #include <X11/Xutil.h>
73 #include <X11/extensions/shape.h>
74 , long foo = ShapeSet,
75       AC_MSG_RESULT([yes])
76       SHAPE="-DSHAPE"; Xext_lib="-lXext",
77       AC_MSG_RESULT([no])
78     )
79   )
80 else
81   AC_MSG_RESULT([no])
82 fi
83 AC_SUBST(SHAPE)
84
85 LIBS="$LIBS $Xext_lib"
86
87 dnl Check for the Slit
88 SLIT=""
89 AC_MSG_CHECKING([whether to include the Slit])
90 AC_ARG_ENABLE(
91   slit, [  --enable-slit           include code for the Slit [default=yes]],
92   if test x$enableval = "xyes"; then
93     AC_MSG_RESULT([yes])
94     SLIT="-DSLIT"
95   else
96     AC_MSG_RESULT([no])
97   fi,
98   AC_MSG_RESULT([yes])
99   SLIT="-DSLIT"
100 )
101 AC_SUBST(SLIT)
102
103 dnl Check for the new WM Spec
104 NEWWMSPEC=""
105 AC_MSG_CHECKING([whether to include the new WM Spec (DOES NOTHING)])
106 AC_ARG_ENABLE(
107   newspec,
108 [  --enable-newspec        include code for the new WM Spec (DOES NOTHING)
109                           [default=no]],
110   if test x$enableval = "xyes"; then
111     AC_MSG_RESULT([yes])
112     NEWWMSPEC="-DNEWWMSPEC"   
113   else
114     AC_MSG_RESULT([no])
115   fi,
116   AC_MSG_RESULT([no])
117 )
118 AC_SUBST(NEWWMSPEC)
119
120
121 dnl Check for Interlacing
122 INTERLACE=""
123 AC_MSG_CHECKING([whether to include interlacing image code])
124 AC_ARG_ENABLE(
125   interlace, [  --enable-interlace      include code for image interlacing [default=yes]],
126   if test x$enableval = "xyes"; then
127     AC_MSG_RESULT([yes])
128     INTERLACE="-DINTERLACE"
129   else
130     AC_MSG_RESULT([no])
131   fi,
132   AC_MSG_RESULT([yes])
133   INTERLACE="-DINTERLACE"
134 )
135 AC_SUBST(INTERLACE)
136
137 dnl Check for ordered 8bpp dithering
138 ORDEREDPSEUDO=""
139 AC_MSG_CHECKING([whether to include Pseudocolor ordered dithering code])
140 AC_ARG_ENABLE(ordered-pseudo,
141 [  --enable-ordered-pseudo include code for ordered pseudocolor (8bpp)
142                           dithering [default=no]],
143   if test x$enableval = "xyes"; then
144     AC_MSG_RESULT([yes])
145     ORDEREDPSEUDO="-DORDEREDPSEUDO" 
146   else
147     AC_MSG_RESULT([no]) 
148   fi,
149   AC_MSG_RESULT([no])
150 )
151 AC_SUBST(ORDEREDPSEUDO)
152
153 dnl Check for event clobbering
154 CLOBBER=""
155 AC_MSG_CHECKING([whether to intercept mouse events to clients])
156 AC_ARG_ENABLE(clobber,
157 [  --enable-clobber        intercept mouse events to clients when num lock 
158                           or scroll lock are on [default=yes]],
159   if test x$enableval = "xno"; then
160     AC_MSG_RESULT([no])
161     CLOBBER="-DNOCLOBBER" 
162   else
163     AC_MSG_RESULT([yes]) 
164   fi,
165   AC_MSG_RESULT([no])
166 )
167 AC_SUBST(CLOBBER)
168
169 dnl Check whether to include debugging code
170 DEBUG=""
171 AC_MSG_CHECKING([whether to include verbose debugging code])
172 AC_ARG_ENABLE(debug,
173   [  --enable-debug          include verbose debugging code [default=no]],
174   if test x$enableval = "xyes"; then
175     AC_MSG_RESULT([yes])
176     DEBUG="-DDEBUG"
177   else
178     AC_MSG_RESULT([no])
179   fi,
180   AC_MSG_RESULT([no])
181 )
182 AC_SUBST(DEBUG)
183
184 dnl Check whether to include natural language support (i18n)
185 NLS=""
186 AC_MSG_CHECKING([whether to include NLS support])
187 AC_ARG_ENABLE(nls,
188   [  --enable-nls            include natural language support [default=yes]],
189   if test x$enableval = "xyes"; then
190     AC_MSG_RESULT([yes])
191     NLS="-DNLS"
192   else
193     AC_MSG_RESULT([no])
194   fi,
195   AC_MSG_RESULT([yes])
196   NLS="-DNLS"
197 )
198 AC_SUBST(NLS)
199
200 AC_CHECK_LIB(xpg4, setlocale, LIBS="$LIBS -lxpg4")
201
202 AC_CHECK_PROGS(gencat_cmd, gencat)
203 if test x$gencat_cmd = "x"; then
204   NLS=""
205 fi
206
207
208 dnl Check for new timed pixmap cache
209 TIMEDCACHE=""
210 AC_MSG_CHECKING([whether to use the new timed pixmap cache])
211 AC_ARG_ENABLE(
212   timed-cache,
213 [  --enable-timed-cache    use new timed pixmap cache [default=yes]],
214   if test x$enableval = "xyes"; then
215     AC_MSG_RESULT([yes])
216     TIMEDCACHE="-DTIMEDCACHE"
217   else
218     AC_MSG_RESULT([no])
219   fi,
220   AC_MSG_RESULT([yes])
221   TIMEDCACHE="-DTIMEDCACHE"
222 )
223 AC_SUBST(TIMEDCACHE)
224
225 dnl Determine the return type of signal handlers
226 AC_TYPE_SIGNAL
227
228 dnl Determine if maintainer portions of the Makefiles should be included.
229 AM_MAINTAINER_MODE
230
231 dnl Print results
232 AC_MSG_RESULT([])
233 AC_MSG_RESULT([ $PACKAGE version $VERSION configured successfully.])
234 AC_MSG_RESULT([])
235 AC_MSG_RESULT([Using '$prefix' for installation.])
236 AC_MSG_RESULT([Using '$CXX' for C++ compiler.])
237 AC_MSG_RESULT([Building with '$CXXFLAGS' for C++ compiler flags.])
238 AC_MSG_RESULT([Building with '$LIBS' for linker flags.])
239 AC_MSG_RESULT([])
240
241 dnl Output files
242 AM_CONFIG_HEADER(config.h)
243 AC_OUTPUT(Makefile
244 src/Makefile
245 util/Makefile
246 data/Makefile
247 data/styles/Makefile
248 doc/Makefile
249 dnl doc/ja_JP/Makefile
250 dnl doc/nl_NL/Makefile
251 dnl doc/sl_SI/Makefile
252 nls/Makefile
253 nls/C/Makefile
254 nls/da_DK/Makefile
255 nls/de_DE/Makefile
256 nls/es_ES/Makefile
257 nls/et_EE/Makefile
258 nls/fr_FR/Makefile
259 nls/it_IT/Makefile
260 nls/ja_JP/Makefile
261 nls/nl_NL/Makefile
262 nls/pt_BR/Makefile
263 nls/ru_RU/Makefile
264 nls/sl_SI/Makefile
265 nls/sv_SE/Makefile
266 nls/tr_TR/Makefile
267 nls/zh_CN/Makefile
268 version.h)