1 dnl Process this file with autoconf to produce a configure script.
2 dnl Please report bugs in this autoconf script Tom Payne <ion@tompayne.org>
3 dnl $Header: /home/twp/cvsroot/twp/ion/ion-devel-autoconf/configure.ac,v 1.16 2004/01/14 11:32:19 twp Exp $
5 AC_INIT([Ion Window Manager],
7 [nobody@nowhere.invalid],
10 AC_REVISION([$Revision: 1.16 $])
12 dnl Checks for programs. {{{
17 AC_CHECK_TOOL([STRIP], [strip], [:])
18 AC_CHECK_TOOL([AR], [ar], [])
19 AC_CHECK_PROG(XMESSAGE, xmessage, xmessage)
20 if test "x${XMESSAGE}" = "x"; then
21 AC_MSG_WARN([*** ion needs xmessage to run correctly])
25 dnl Checks for libraries. {{{
27 AC_CHECK_HEADER([libintl.h], [],
28 [AC_MSG_ERROR([*** libintl.h not found.
29 *** You probably need to install libc6-dev])])
30 dnl Perhaps we should check for -lintl, but on my machine,
31 dnl the library isn't needed. Only the #include is necessary.
33 test "${X_DISPLAY_MISSING+set}" = set && exit 1
34 AC_CHECK_HEADER([X11/SM/SMlib.h], [],
35 [AC_MSG_ERROR([*** SMlib.h not found.
36 *** You probably need to install libsm-dev])])
37 AC_CHECK_HEADER([X11/Xresource.h], [],
38 [AC_MSG_ERROR([*** Xresource.h.h not found.
39 *** You probably need to install libx11-dev])])
42 [X_LIBS="$X_LIBS -lXext"],
43 [AC_MSG_ERROR([*** Missing symbol XMissingExtension in Xext])],
44 [$X_PRE_LIBS -lX11 $X_LIBS $X_EXTRA_LIBS])
47 dnl XINERAMA_LIBS, _DCF_NO_XINERAMA {{{
49 AC_SUBST([XINERAMA_LIBS])
50 AC_SUBST([_DCF_NO_XINERAMA])
52 AC_ARG_ENABLE([xinerama],
53 [AS_HELP_STRING([--disable-xinerama],
54 [Disable Xinerama support])])
56 if test "x$enable_xinerama" != xno; then
57 AC_CHECK_LIB([Xinerama],
58 [XineramaQueryExtension],
59 [XINERAMA_LIBS="-lXinerama"],
60 [AC_MSG_WARN([*** Xinerama disabled (not available)])
61 enable_xinerama="no"],
62 [$X_PRE_LIBS -lX11 $X_LIBS $X_EXTRA_LIBS])
66 if test "x$enable_xinerama" = xno; then
67 _DCF_NO_XINERAMA="-DCF_NO_XINERAMA"
72 dnl _DCF_XFREE86_TEXTPROP_BUG_WORKAROUND {{{
74 AC_SUBST([_DCF_XFREE86_TEXTPROP_BUG_WORKAROUND])
76 AC_ARG_ENABLE([xfree86-textprop-bug-workaround],
77 [AS_HELP_STRING([--disable-xfree86-textprop-bug-workaround],
78 [Disable the XFree86 textprop bug workaround])])
80 if test "x$enable_xfree86_textprop_bug_workaround" != xno; then
81 _DCF_XFREE86_TEXTPROP_BUG_WORKAROUND="-DCF_XFREE86_TEXTPROP_BUG_WORKAROUND"
86 dnl _DCF_DE_USE_XUTF8 {{{
88 AC_SUBST([_DCF_DE_USE_XUTF8])
90 AC_ARG_ENABLE([Xutf8],
91 [AS_HELP_STRING([--enable-Xutf8],
92 [Use the Xutf8 routines (XFree86 extension)
93 instead of Xmb routines in an UTF-8 locale.])])
95 if test "x$enable_Xutf8" = xyes; then
96 AC_MSG_CHECKING([for Xutf8*])
98 CFLAGS="$CFLAGS $X_CFLAGS"
99 AC_RUN_IFELSE([AC_LANG_SOURCE([[
100 #include <X11/Xlib.h>
104 #ifdef X_HAVE_UTF8_STRING
111 [AC_MSG_RESULT([yes])
112 _DCF_DE_USE_XUTF8="-DCF_DE_USE_XUTF8"],
115 CFLAGS="$save_CFLAGS"
120 dnl _DCF_SUN_F1X_REMAP {{{
122 AC_SUBST([_DCF_SUN_F1X_REMAP])
124 AC_ARG_ENABLE([sun-f1x-remap],
125 [AS_HELP_STRING([--enable-sun-f1x-remap],
126 [Remap F11 key to SunF36 and F12 to SunF37])])
128 if test "x$enable_sun_f1x_remap" == xyes; then
129 _DCF_SUN_F1X_REMAP="-DCF_SUN_F1X_REMAP"
138 AC_CHECK_HEADER([dlfcn.h], [], [AC_MSG_ERROR([*** missing header dlfcn.h])])
139 AC_CHECK_LIB([dl], [dlopen], [DL_LIBS="-ldl"],
140 [AC_MSG_ERROR([*** missing library dl])])
144 dnl PRELOAD_MODULES {{{
146 AC_SUBST(PRELOAD_MODULES)
148 AC_ARG_ENABLE([shared],
149 [AS_HELP_STRING([--disable-shared],
150 [Do not dynamically load modules (preload modules
153 if test "x$enable_shared" = xno; then
159 dnl LUA, LUAC, LUA_INCLUDES, LUA_LIBS {{{
163 AC_SUBST([LUA_INCLUDES])
167 AC_ARG_WITH([lua-prefix],
168 [AS_HELP_STRING([--with-lua-prefix=DIR],
169 [Lua files are in DIR])])
170 AC_ARG_WITH([lua-includes],
171 [AS_HELP_STRING([--with-lua-includes=DIR],
172 [Lua include files are in DIR])])
173 AC_ARG_WITH([lua-libraries],
174 [AS_HELP_STRING([--with-lua-libraries=DIR],
175 [Lua library files are in DIR])])
176 AC_ARG_WITH([lua-suffix],
177 [AS_HELP_STRING([--with-lua-suffix=ARG],
178 [Lua binary and library files are suffixed with
183 if test "x$with_lua_prefix" = x; then
184 lua_search_path="$PATH"
186 lua_search_path="$with_lua_prefix/bin"
188 if test "x$LUA" = x; then
189 AC_PATH_PROG([LUA], [lua$with_lua_suffix], [], [$lua_search_path])
190 test "x$LUA" = x && AC_MSG_ERROR([*** Can't build ion without lua])
195 AC_MSG_CHECKING([for lua version >= 5.1])
196 lua_version=$($LUA -v 2>&1 | head -n 1 | cut -d' ' -f2)
197 dnl lua_version=$($LUA -v 2>&1 >/dev/null | head -n 1 | $EGREP -o '[0-9]+(\.[0-9]+)+')
199 0.* | 1.* | 2.* | 3.* | 4.* | 5.0)
200 AC_MSG_RESULT([no (found $lua_version)])
201 AC_MSG_ERROR([*** can't build ion with this version of lua])
204 AC_MSG_RESULT([yes (found $lua_version)])
210 if test "x$LUAC" = x; then
211 AC_PATH_PROG([LUAC], [luac$with_lua_suffix], [], [$lua_search_path])
212 test "x$LUAC" = x && exit 1
217 AC_MSG_CHECKING([for lua version = luac version])
218 luac_version=$($LUAC -v 2>&1 | head -n 1 | cut -d' ' -f2)
219 if test "x$lua_version" = "x$luac_version"; then
220 AC_MSG_RESULT([yes (found $luac_version)])
222 AC_MSG_RESULT([no (found $luac_version)])
228 if test "x$with_lua_includes" != x; then
229 LUA_INCLUDES="-I$with_lua_includes"
230 elif test "x$with_lua_prefix" != x; then
231 LUA_INCLUDES="-I$with_lua_prefix/include"
233 save_CFLAGS="$CFLAGS"
234 CFLAGS="$CFLAGS $LUA_INCLUDES"
235 AC_CHECK_HEADERS([lua.h lualib.h], [],
236 [AC_MSG_ERROR([*** missing headers lua.h or lualib.h.
237 *** install the lua's -dev package or check --with-lua-includes option.])], [])
238 CFLAGS="$save_CFLAGS"
242 if test "x$with_lua_libraries" != x; then
243 LUA_LIBS="-L$with_lua_libraries"
244 elif test "x$with_lua_prefix" != x; then
245 LUA_LIBS="-L$with_lua_prefix/lib"
247 AC_CHECK_LIB([m], [exp], [lua_extra_libs="$lua_extra_libs -lm"], [])
248 AC_CHECK_LIB([dl], [dlopen], [lua_extra_libs="$lua_extra_libs -ldl"], [])
249 AC_CHECK_LIB([lua$with_lua_suffix],
251 [LUA_LIBS="$LUA_LIBS -llua$with_lua_suffix $lua_extra_libs"],
252 [AC_MSG_ERROR([*** Can't find lua_call in lua$with_lua_suffix.
253 *** Check for liblua installation or --with-lua-libraries or --with-lua-suffix options])],
254 [$LUA_LIBS $lua_extra_libs])
257 dnl liblua_version {{{
258 AC_MSG_CHECKING([for liblua version >= 5.1])
259 save_CFLAGS="$CFLAGS"
261 CFLAGS="$CFLAGS $LUA_INCLUDES"
262 LIBS="$LIBS $LUA_LIBS"
263 AC_RUN_IFELSE([AC_LANG_SOURCE([[
272 printf("(found %s, %d)... ", LUA_VERSION, LUA_VERSION_NUM);
273 if(LUA_VERSION_NUM >= 501)
279 [AC_MSG_RESULT([yes])],
282 CFLAGS="$save_CFLAGS"
288 dnl HAS_SYSTEM_ASPRINTF {{{
290 AC_SUBST([HAS_SYSTEM_ASPRINTF])
292 AC_CHECK_FUNC([asprintf],
293 [AC_CHECK_FUNC([vasprintf],
294 [HAS_SYSTEM_ASPRINTF="1"])])
300 AC_SUBST([XOPEN_SOURCE])
302 AC_ARG_ENABLE([xopen-source],
303 [AS_HELP_STRING([--enable-xopen-source],
304 [Enable X/Open C flags (development use only)])])
306 if test "x$enable_xopen_source" = xyes; then
307 AC_MSG_CHECKING([for $CC flags to accept X/Open C])
309 # FIXME: what flags are required for other hosts/compilers?
310 *-*-solaris* | *-*-sunos*)
311 XOPEN_SOURCE="-D__EXTENSIONS__"
314 XOPEN_SOURCE="-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED"
317 AC_MSG_RESULT([$XOPEN_SOURCE])
324 AC_SUBST([C99_SOURCE])
326 AC_ARG_ENABLE([c99-source],
327 [AS_HELP_STRING([--enable-c99-source],
328 [Enable C99 source (development use only)])])
330 if test "x$enable_c99_source" = xyes; then
331 AC_MSG_CHECKING([for $CC flags to accept C99])
333 # FIXME: what flags are required for other hosts/compilers?
335 C99_SOURCE="-std=c99"
338 AC_MSG_RESULT([$C99_SOURCE])
343 dnl _DCF_HAS_VA_COPY {{{
345 AC_SUBST([_DCF_HAS_VA_COPY])
347 dnl check for va_copy {{{
349 AC_MSG_CHECKING([for va_copy])
350 save_CFLAGS="$CFLAGS"
351 CFLAGS="$CFLAGS $C99_SOURCE"
352 AC_RUN_IFELSE([AC_LANG_SOURCE([[
357 void f(void *last, ...)
363 exit(va_arg(aq, int));
368 f(NULL, EXIT_SUCCESS);
373 [AC_MSG_RESULT([yes])
374 _DCF_HAS_VA_COPY="-DCF_HAVE_VA_COPY"],
375 [AC_MSG_RESULT([no])])
376 CFLAGS="$save_CFLAGS"
380 dnl check whether -ansi breaks va_copy {{{
382 if test "x${XOPEN_SOURCE}" != "x"; then
383 AC_MSG_CHECKING([whether XOPEN_SOURCE breaks va_copy])
384 save_CFLAGS="$CFLAGS"
385 CFLAGS="$CFLAGS $XOPEN_SOURCE $C99_SOURCE"
386 AC_LINK_IFELSE([AC_LANG_SOURCE([[
391 void f(void *last, ...)
407 [AC_MSG_RESULT([no])],
408 [AC_MSG_RESULT([yes, clearing XOPEN_SOURCE])
410 CFLAGS="$save_CFLAGS"
416 dnl _DCF_NO_LOCALE {{{
418 AC_SUBST([_DCF_NO_LOCALE])
420 AC_ARG_ENABLE([locale],
421 [AS_HELP_STRING([--disable-locale],
422 [Disable locale support])])
424 if test "x$enable_locale" == xno; then
425 _DCF_NO_LOCALE="-DCF_NO_LOCALE"
431 AC_OUTPUT([system-ac.mk])
433 if test "x$lua_version" = "x5.0"; then
435 AC_MSG_NOTICE([** lua version 5.0 is buggy, consider upgrading to 5.0.1])
436 AC_MSG_NOTICE([** see http://lua-users.org/lists/lua-l/2003-10/msg00039.html])
440 dnl vim: foldmethod=marker tabstop=4 shiftwidth=4