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"],
27 [AC_MSG_ERROR([*** Missing symbol XMissingExtension in Xext])],
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"],
44 [AC_MSG_WARN([*** Xinerama disabled (not available)])
45 enable_xinerama="no"],
46 [$X_PRE_LIBS -lX11 $X_LIBS $X_EXTRA_LIBS])
50 if test "x$enable_xinerama" = xno; then
51 _DCF_NO_XINERAMA="-DCF_NO_XINERAMA"
56 dnl _DCF_XFREE86_TEXTPROP_BUG_WORKAROUND {{{
58 AC_SUBST([_DCF_XFREE86_TEXTPROP_BUG_WORKAROUND])
60 AC_ARG_ENABLE([xfree86-textprop-bug-workaround],
61 [AS_HELP_STRING([--disable-xfree86-textprop-bug-workaround],
62 [Disable the XFree86 textprop bug workaround])])
64 if test "x$enable_xfree86_textprop_bug_workaround" != xno; then
65 _DCF_XFREE86_TEXTPROP_BUG_WORKAROUND="-DCF_XFREE86_TEXTPROP_BUG_WORKAROUND"
70 dnl _DCF_DE_USE_XUTF8 {{{
72 AC_SUBST([_DCF_DE_USE_XUTF8])
74 AC_ARG_ENABLE([Xutf8],
75 [AS_HELP_STRING([--enable-Xutf8],
76 [Use the Xutf8 routines (XFree86 extension)
77 instead of Xmb routines in an UTF-8 locale given
78 the -i18n command line option])])
80 if test "x$enable_Xutf8" = xyes; then
81 AC_MSG_CHECKING([for Xutf8*])
83 CFLAGS="$CFLAGS $X_CFLAGS"
84 AC_RUN_IFELSE([AC_LANG_SOURCE([[
89 #ifdef X_HAVE_UTF8_STRING
97 _DCF_DE_USE_XUTF8="-DCF_DE_USE_XUTF8"],
100 CFLAGS="$save_CFLAGS"
105 dnl _DCF_SUN_F1X_REMAP {{{
107 AC_SUBST([_DCF_SUN_F1X_REMAP])
109 AC_ARG_ENABLE([sun-f1x-remap],
110 [AS_HELP_STRING([--enable-sun-f1x-remap],
111 [Remap F11 key to SunF36 and F12 to SunF37])])
113 if test "x$enable_sun_f1x_remap" == xyes; then
114 _DCF_SUN_F1X_REMAP="-DCF_SUN_F1X_REMAP"
123 AC_CHECK_HEADER([dlfcn.h], [], [AC_MSG_ERROR([*** missing header dlfcn.h])])
124 AC_CHECK_LIB([dl], [dlopen], [DL_LIBS="-ldl"],
125 [AC_MSG_ERROR([*** missing library dl])])
129 dnl PRELOAD_MODULES {{{
131 AC_SUBST(PRELOAD_MODULES)
133 AC_ARG_ENABLE([shared],
134 [AS_HELP_STRING([--disable-shared],
135 [Do not dynamically load modules (preload modules
138 if test "x$enable_shared" = xno; then
144 dnl LUA, LUAC, LUA_INCLUDES, LUA_LIBS {{{
148 AC_SUBST([LUA_INCLUDES])
152 AC_ARG_WITH([lua-prefix],
153 [AS_HELP_STRING([--with-lua-prefix=DIR],
154 [Lua files are in DIR])])
155 AC_ARG_WITH([lua-includes],
156 [AS_HELP_STRING([--with-lua-includes=DIR],
157 [Lua include files are in DIR])])
158 AC_ARG_WITH([lua-libraries],
159 [AS_HELP_STRING([--with-lua-libraries=DIR],
160 [Lua library files are in DIR])])
161 AC_ARG_WITH([lua-suffix],
162 [AS_HELP_STRING([--with-lua-suffix=ARG],
163 [Lua binary and library files are suffixed with
168 if test "x$with_lua_prefix" = x; then
169 lua_search_path="$PATH"
171 lua_search_path="$with_lua_prefix/bin"
173 if test "x$LUA" = x; then
174 AC_PATH_PROG([LUA], [lua$with_lua_suffix], [], [$lua_search_path])
175 test "x$LUA" = x && AC_MSG_ERROR([*** Can't build ion without lua])
180 AC_MSG_CHECKING([for lua version >= 5.0])
181 lua_version=$($LUA -v 2>&1 | head -n 1 | cut -d' ' -f2)
182 dnl lua_version=$($LUA -v 2>&1 >/dev/null | head -n 1 | $EGREP -o '[0-9]+(\.[0-9]+)+')
184 0.* | 1.* | 2.* | 3.* | 4.*)
185 AC_MSG_RESULT([no (found $lua_version)])
186 AC_MSG_ERROR([*** can't build ion with this version of lua])
189 AC_MSG_RESULT([yes (found $lua_version)])
195 if test "x$LUAC" = x; then
196 AC_PATH_PROG([LUAC], [luac$with_lua_suffix], [], [$lua_search_path])
197 test "x$LUAC" = x && exit 1
202 AC_MSG_CHECKING([for lua version = luac version])
203 luac_version=$($LUAC -v 2>&1 | head -n 1 | cut -d' ' -f2)
204 if test "x$lua_version" = "x$luac_version"; then
205 AC_MSG_RESULT([yes (found $luac_version)])
207 AC_MSG_RESULT([no (found $luac_version)])
213 if test "x$with_lua_includes" != x; then
214 LUA_INCLUDES="-I$with_lua_includes"
215 elif test "x$with_lua_prefix" != x; then
216 LUA_INCLUDES="-I$with_lua_prefix/include"
218 save_CFLAGS="$CFLAGS"
219 CFLAGS="$CFLAGS $LUA_INCLUDES"
220 AC_CHECK_HEADERS([lua.h lualib.h], [],
221 [AC_MSG_ERROR([*** missing headers lua.h or lualib.h.
222 *** install the lua's -dev package or check --with-lua-includes option.])], [])
223 CFLAGS="$save_CFLAGS"
227 if test "x$with_lua_libraries" != x; then
228 LUA_LIBS="-L$with_lua_libraries"
229 elif test "x$with_lua" != x; then
230 LUA_LIBS="-L$with_lua_prefix/lib"
232 AC_CHECK_LIB([lua$with_lua_suffix],
234 [LUA_LIBS="$LUA_LIBS -llua$with_lua_suffix"],
235 [AC_MSG_ERROR([*** Can't find lua_open in lua$with_lua_suffix.
236 *** Check for liblua installation or --with-lua-libraries or --with-lua-suffix options])],
238 AC_CHECK_LIB([dl], [dlopen], [lua_extra_libs="$lua_extra_libs -ldl"], [])
239 AC_CHECK_LIB([m], [exp], [lua_extra_libs="$lua_extra_libs -lm"], [])
240 AC_CHECK_LIB([lualib$with_lua_suffix],
242 [LUA_LIBS="$LUA_LIBS $lua_extra_libs -llualib$with_lua_suffix"],
244 [$LUA_LIBS $lua_extra_libs])
247 dnl liblua_version {{{
248 AC_MSG_CHECKING([for liblua version >= 5.0])
249 save_CFLAGS="$CFLAGS"
251 CFLAGS="$CFLAGS $LUA_INCLUDES"
252 LIBS="$LIBS $LUA_LIBS"
253 AC_RUN_IFELSE([AC_LANG_SOURCE([[
261 if(strcmp(lua_version(), LUA_VERSION)!=0){
262 printf("Error: lua_version() does not match LUA_VERSION. ");
265 printf("(found %s)... ", lua_version());
266 if(strcmp(lua_version(), "Lua 5.0")<0)
272 [AC_MSG_RESULT([yes])],
275 CFLAGS="$save_CFLAGS"
281 dnl HAS_SYSTEM_ASPRINTF {{{
283 AC_SUBST([HAS_SYSTEM_ASPRINTF])
285 AC_CHECK_FUNC([asprintf],
286 [AC_CHECK_FUNC([vasprintf],
287 [HAS_SYSTEM_ASPRINTF="1"])])
293 AC_SUBST([XOPEN_SOURCE])
295 AC_ARG_ENABLE([xopen-source],
296 [AS_HELP_STRING([--enable-xopen-source],
297 [Enable X/Open C flags (development use only)])])
299 if test "x$enable_xopen_source" = xyes; then
300 AC_MSG_CHECKING([for $CC flags to accept X/Open C])
302 # FIXME: what flags are required for other hosts/compilers?
303 *-*-solaris* | *-*-sunos*)
304 XOPEN_SOURCE="-D__EXTENSIONS__"
307 XOPEN_SOURCE="-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED"
310 AC_MSG_RESULT([$XOPEN_SOURCE])
317 AC_SUBST([C99_SOURCE])
319 AC_ARG_ENABLE([c99-source],
320 [AS_HELP_STRING([--enable-c99-source],
321 [Enable C99 source (development use only)])])
323 if test "x$enable_c99_source" = xyes; then
324 AC_MSG_CHECKING([for $CC flags to accept C99])
326 # FIXME: what flags are required for other hosts/compilers?
328 C99_SOURCE="-std=c99"
331 AC_MSG_RESULT([$C99_SOURCE])
336 dnl _DCF_HAS_VA_COPY {{{
338 AC_SUBST([_DCF_HAS_VA_COPY])
340 dnl check for va_copy {{{
342 AC_MSG_CHECKING([for va_copy])
343 save_CFLAGS="$CFLAGS"
344 CFLAGS="$CFLAGS $C99_SOURCE"
345 AC_RUN_IFELSE([AC_LANG_SOURCE([[
350 void f(void *last, ...)
356 exit(va_arg(aq, int));
361 f(NULL, EXIT_SUCCESS);
366 [AC_MSG_RESULT([yes])
367 _DCF_HAS_VA_COPY="-DCF_HAVE_VA_COPY"],
368 [AC_MSG_RESULT([no])])
369 CFLAGS="$save_CFLAGS"
373 dnl check whether -ansi breaks va_copy {{{
375 if test "x${XOPEN_SOURCE}" != "x"; then
376 AC_MSG_CHECKING([whether XOPEN_SOURCE breaks va_copy])
377 save_CFLAGS="$CFLAGS"
378 CFLAGS="$CFLAGS $XOPEN_SOURCE $C99_SOURCE"
379 AC_LINK_IFELSE([AC_LANG_SOURCE([[
384 void f(void *last, ...)
400 [AC_MSG_RESULT([no])],
401 [AC_MSG_RESULT([yes, clearing XOPEN_SOURCE])
403 CFLAGS="$save_CFLAGS"
409 dnl _DCF_NO_LOCALE {{{
411 AC_SUBST([_DCF_NO_LOCALE])
413 AC_ARG_ENABLE([locale],
414 [AS_HELP_STRING([--disable-locale],
415 [Disable locale support])])
417 if test "x$enable_locale" == xno; then
418 _DCF_NO_LOCALE="-DCF_NO_LOCALE"
424 AC_OUTPUT([system-ac.mk])
426 if test "x$lua_version" = "x5.0"; then
428 AC_MSG_NOTICE([** lua version 5.0 is buggy, consider upgrading to 5.0.1])
429 AC_MSG_NOTICE([** see http://lua-users.org/lists/lua-l/2003-10/msg00039.html])
433 dnl vim: foldmethod=marker tabstop=4 shiftwidth=4