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],
10 AC_REVISION([$Revision: 1.16 $])
12 dnl Checks for programs. {{{
17 AC_CHECK_TOOL([STRIP], [strip], [:])
18 AC_CHECK_TOOL([AR], [ar], [])
21 dnl Checks for libraries. {{{
23 test "${X_DISPLAY_MISSING+set}" = set && exit 1
26 [X_LIBS="$X_LIBS -lXext"],
28 [$X_PRE_LIBS -lX11 $X_LIBS $X_EXTRA_LIBS])
31 dnl XINERAMA_LIBS, _DCF_NO_XINERAMA {{{
33 AC_SUBST([XINERAMA_LIBS])
34 AC_SUBST([_DCF_NO_XINERAMA])
36 AC_ARG_ENABLE([xinerama],
37 [AS_HELP_STRING([--disable-xinerama],
38 [Disable Xinerama support])])
40 if test "x$enable_xinerama" != xno; then
41 AC_CHECK_LIB([Xinerama],
42 [XineramaQueryExtension],
43 [XINERAMA_LIBS="-lXinerama"],
45 [$X_PRE_LIBS -lX11 $X_LIBS $X_EXTRA_LIBS])
47 _DCF_NO_XINERAMA="-DCF_NO_XINERAMA"
52 dnl _DCF_XFREE86_TEXTPROP_BUG_WORKAROUND {{{
54 AC_SUBST([_DCF_XFREE86_TEXTPROP_BUG_WORKAROUND])
56 AC_ARG_ENABLE([xfree86-textprop-bug-workaround],
57 [AS_HELP_STRING([--disable-xfree86-textprop-bug-workaround],
58 [Disable the XFree86 textprop bug workaround])])
60 if test "x$enable_xfree86_textprop_bug_workaround" != xno; then
61 _DCF_XFREE86_TEXTPROP_BUG_WORKAROUND="-DCF_XFREE86_TEXTPROP_BUG_WORKAROUND"
66 dnl _DCF_DE_USE_XUTF8 {{{
68 AC_SUBST([_DCF_DE_USE_XUTF8])
70 AC_ARG_ENABLE([Xutf8],
71 [AS_HELP_STRING([--enable-Xutf8],
72 [Use the Xutf8 routines (XFree86 extension)
73 instead of Xmb routines in an UTF-8 locale given
74 the -i18n command line option])])
76 if test "x$enable_Xutf8" = xyes; then
77 AC_MSG_CHECKING([for Xutf8*])
79 CFLAGS="$CFLAGS $X_CFLAGS"
80 AC_RUN_IFELSE([AC_LANG_SOURCE([[
85 #ifdef X_HAVE_UTF8_STRING
93 _DCF_DE_USE_XUTF8="-DCF_DE_USE_XUTF8"],
101 dnl _DCF_SUN_F1X_REMAP {{{
103 AC_SUBST([_DCF_SUN_F1X_REMAP])
105 AC_ARG_ENABLE([sun-f1x-remap],
106 [AS_HELP_STRING([--enable-sun-f1x-remap],
107 [Remap F11 key to SunF36 and F12 to SunF37])])
109 if test "x$enable_sun_f1x_remap" == xyes; then
110 _DCF_SUN_F1X_REMAP="1"
119 AC_CHECK_HEADER([dlfcn.h], [], [exit 1])
120 AC_CHECK_LIB([dl], [dlopen], [DL_LIBS="-ldl"], [exit 1])
124 dnl PRELOAD_MODULES {{{
126 AC_SUBST(PRELOAD_MODULES)
128 AC_ARG_ENABLE([shared],
129 [AS_HELP_STRING([--disable-shared],
130 [Do not dynamically load modules (preload modules
133 if test "x$enable_shared" = xno; then
139 dnl LUA, LUAC, LUA_INCLUDES, LUA_LIBS {{{
143 AC_SUBST([LUA_INCLUDES])
147 AC_ARG_WITH([lua-prefix],
148 [AS_HELP_STRING([--with-lua-prefix=DIR],
149 [Lua files are in DIR])])
150 AC_ARG_WITH([lua-includes],
151 [AS_HELP_STRING([--with-lua-includes=DIR],
152 [Lua include files are in DIR])])
153 AC_ARG_WITH([lua-libraries],
154 [AS_HELP_STRING([--with-lua-libraries=DIR],
155 [Lua library files are in DIR])])
156 AC_ARG_WITH([lua-suffix],
157 [AS_HELP_STRING([--with-lua-suffix=ARG],
158 [Lua binary and library files are suffixed with
163 if test "x$with_lua_prefix" = x; then
164 lua_search_path="$PATH"
166 lua_search_path="$with_lua_prefix/bin"
168 if test "x$LUA" = x; then
169 AC_PATH_PROG([LUA], [lua$with_lua_suffix], [], [$lua_search_path])
170 test "x$LUA" = x && exit 1
175 AC_MSG_CHECKING([for lua version >= 5.0])
176 lua_version=$($LUA -v 2>&1 | head -n 1 | cut -d' ' -f2)
177 dnl lua_version=$($LUA -v 2>&1 >/dev/null | head -n 1 | $EGREP -o '[0-9]+(\.[0-9]+)+')
179 0.* | 1.* | 2.* | 3.* | 4.*)
180 AC_MSG_RESULT([no (found $lua_version)])
184 AC_MSG_RESULT([yes (found $lua_version)])
190 if test "x$LUAC" = x; then
191 AC_PATH_PROG([LUAC], [luac$with_lua_suffix], [], [$lua_search_path])
192 test "x$LUAC" = x && exit 1
197 AC_MSG_CHECKING([for lua version = luac version])
198 luac_version=$($LUAC -v 2>&1 | head -n 1 | cut -d' ' -f2)
199 if test "x$lua_version" = "x$luac_version"; then
200 AC_MSG_RESULT([yes (found $luac_version)])
202 AC_MSG_RESULT([no (found $luac_version)])
208 if test "x$with_lua_includes" != x; then
209 LUA_INCLUDES="-I$with_lua_includes"
210 elif test "x$with_lua_prefix" != x; then
211 LUA_INCLUDES="-I$with_lua_prefix/include"
213 save_CFLAGS="$CFLAGS"
214 CFLAGS="$CFLAGS $LUA_INCLUDES"
215 AC_CHECK_HEADERS([lua.h lualib.h], [], [exit 1], [])
216 CFLAGS="$save_CFLAGS"
220 if test "x$with_lua_libraries" != x; then
221 LUA_LIBS="-L$with_lua_libraries"
222 elif test "x$with_lua" != x; then
223 LUA_LIBS="-L$with_lua_prefix/lib"
225 AC_CHECK_LIB([lua$with_lua_suffix],
227 [LUA_LIBS="$LUA_LIBS -llua$with_lua_suffix"],
230 AC_CHECK_LIB([dl], [dlopen], [lua_extra_libs="$lua_extra_libs -ldl"], [])
231 AC_CHECK_LIB([m], [exp], [lua_extra_libs="$lua_extra_libs -lm"], [])
232 AC_CHECK_LIB([lualib$with_lua_suffix],
234 [LUA_LIBS="$LUA_LIBS $lua_extra_libs -llualib$with_lua_suffix"],
236 [$LUA_LIBS $lua_extra_libs])
239 dnl liblua_version {{{
240 AC_MSG_CHECKING([for liblua version >= 5.0])
241 save_CFLAGS="$CFLAGS"
243 CFLAGS="$CFLAGS $LUA_INCLUDES"
244 LIBS="$LIBS $LUA_LIBS"
245 AC_RUN_IFELSE([AC_LANG_SOURCE([[
253 if(strcmp(lua_version(), LUA_VERSION)!=0){
254 printf("Error: lua_version() does not match LUA_VERSION. ");
257 printf("(found %s)... ", lua_version());
258 if(strcmp(lua_version(), "Lua 5.0")<0)
264 [AC_MSG_RESULT([yes])],
267 CFLAGS="$save_CFLAGS"
273 dnl HAS_SYSTEM_ASPRINTF {{{
275 AC_SUBST([HAS_SYSTEM_ASPRINTF])
277 AC_CHECK_FUNC([asprintf],
278 [AC_CHECK_FUNC([vasprintf],
279 [HAS_SYSTEM_ASPRINTF="1"])])
285 AC_SUBST([XOPEN_SOURCE])
287 AC_ARG_ENABLE([xopen-source],
288 [AS_HELP_STRING([--enable-xopen-source],
289 [Enable X/Open C flags (development use only)])])
291 if test "x$enable_xopen_source" = xyes; then
292 AC_MSG_CHECKING([for $CC flags to accept X/Open C])
294 # FIXME: what flags are required for other hosts/compilers?
295 *-*-solaris* | *-*-sunos*)
296 XOPEN_SOURCE="-D__EXTENSIONS__"
299 XOPEN_SOURCE="-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED"
302 AC_MSG_RESULT([$XOPEN_SOURCE])
309 AC_SUBST([C99_SOURCE])
311 AC_ARG_ENABLE([c99-source],
312 [AS_HELP_STRING([--enable-c99-source],
313 [Enable C99 source (development use only)])])
315 if test "x$enable_c99_source" = xyes; then
316 AC_MSG_CHECKING([for $CC flags to accept C99])
318 # FIXME: what flags are required for other hosts/compilers?
320 C99_SOURCE="-std=c99"
323 AC_MSG_RESULT([$C99_SOURCE])
328 dnl _DCF_HAS_VA_COPY {{{
330 AC_SUBST([_DCF_HAS_VA_COPY])
332 dnl check for va_copy {{{
334 AC_MSG_CHECKING([for va_copy])
335 save_CFLAGS="$CFLAGS"
336 CFLAGS="$CFLAGS $C99_SOURCE"
337 AC_RUN_IFELSE([AC_LANG_SOURCE([[
342 void f(void *last, ...)
348 exit(va_arg(aq, int));
353 f(NULL, EXIT_SUCCESS);
358 [AC_MSG_RESULT([yes])
359 _DCF_HAS_VA_COPY="-DCF_HAVE_VA_COPY"],
360 [AC_MSG_RESULT([no])])
361 CFLAGS="$save_CFLAGS"
365 dnl check whether -ansi breaks va_copy {{{
367 if test "x${XOPEN_SOURCE}" != "x"; then
368 AC_MSG_CHECKING([whether XOPEN_SOURCE breaks va_copy])
369 save_CFLAGS="$CFLAGS"
370 CFLAGS="$CFLAGS $XOPEN_SOURCE $C99_SOURCE"
371 AC_LINK_IFELSE([AC_LANG_SOURCE([[
376 void f(void *last, ...)
392 [AC_MSG_RESULT([no])],
393 [AC_MSG_RESULT([yes, clearing XOPEN_SOURCE])
395 CFLAGS="$save_CFLAGS"
401 dnl _DCF_NO_LOCALE {{{
403 AC_SUBST([_DCF_NO_LOCALE])
405 AC_ARG_ENABLE([locale],
406 [AS_HELP_STRING([--disable-locale],
407 [Disable locale support])])
409 if test "x$enable_locale" == xno; then
410 _DCF_NO_LOCALE="-DCF_NO_LOCALE"
416 AC_OUTPUT([system-ac.mk])
418 if test "x$lua_version" = "x5.0"; then
420 AC_MSG_NOTICE([** lua version 5.0 is buggy, consider upgrading to 5.0.1])
421 AC_MSG_NOTICE([** see http://lua-users.org/lists/lua-l/2003-10/msg00039.html])
425 dnl vim: foldmethod=marker tabstop=4 shiftwidth=4