1 AC_INIT(gwm, 0.0, gtw@gnu.org)
3 AC_CONFIG_SRCDIR(gwm.c)
5 AC_CONFIG_FILES(Makefile gwm.ld)
6 AC_CONFIG_HEADERS(config.h)
8 if test -f config.options; then
14 # GWM_MANDATORY_PACKAGE(PKG-NAME)
15 AC_DEFUN([GWM_MANDATORY_PACKAGE],[
16 AC_MSG_CHECKING([for $1])
17 PKG_CHECK_EXISTS([$1],
19 gwm_packages="$gwm_packages $1"],
23 # GWM_OPTIONAL_PACKAGE(PKG-NAME, [LABEL], [DEPENDENCIES])
24 AC_DEFUN([GWM_OPTIONAL_PACKAGE],[
25 gwm_label=m4_ifval([$2], [$2], [$1])
26 gwm_name=`echo $ECHO_N $gwm_label | tr 'a-z' 'A-Z' | tr -c 'a-zA-Z0-9' _`
29 if eval test "x\$gwm_found_$gwm_i" != "xyes"; then gwm_have_deps=no; fi
31 if test $gwm_have_deps = yes; then
32 AC_MSG_CHECKING([for $gwm_label])
33 if eval test "x\$with_$gwm_label" = xno; then
34 AC_MSG_RESULT(disabled)
36 PKG_CHECK_EXISTS([$1],
38 gwm_packages="$gwm_packages $1"
39 eval "gwm_found_$gwm_label=yes"
40 AC_DEFINE_UNQUOTED(USE_$gwm_name, 1)],
46 AH_BOTTOM([/* If we haven't been told that we're debugging, assume we aren't. */
51 # Checks for programs:
53 AC_USE_SYSTEM_EXTENSIONS
56 # Checks for libraries:
57 AC_ARG_WITH(composite,[ --with-composite use the X Composite extension.])
58 AC_ARG_WITH(damage, [ --with-damage use the X DAMAGE extension.])
59 AC_ARG_WITH(render, [ --with-render use the X RENDER extension.])
60 AC_ARG_WITH(shape, [ --with-shape use the X SHAPE extension.])
61 AC_ARG_WITH(xfixes, [ --with-xfixes use the XFIXES extension.])
63 AH_TEMPLATE(USE_COMPOSITE,[Use the X Composite extension.])
64 AH_TEMPLATE(USE_DAMAGE,[Use the X DAMAGE extension.])
65 AH_TEMPLATE(USE_RENDER,[Use the X RENDER extension.])
66 AH_TEMPLATE(USE_SHAPE,[Use the X SHAPE extension.])
67 AH_TEMPLATE(USE_XFIXES,[Use the XFIXES extension.])
69 GWM_MANDATORY_PACKAGE(xcb)
70 GWM_OPTIONAL_PACKAGE(fontconfig)
71 GWM_OPTIONAL_PACKAGE(freetype2)
72 GWM_OPTIONAL_PACKAGE(xcb-composite, composite)
73 GWM_OPTIONAL_PACKAGE(xcb-damage, damage)
74 GWM_OPTIONAL_PACKAGE(xcb-render, render, fontconfig freetype2)
75 GWM_OPTIONAL_PACKAGE(xcb-shape, shape)
76 GWM_OPTIONAL_PACKAGE(xcb-xfixes, xfixes)
78 AM_CONDITIONAL(RENDER, [test x$gwm_found_render = xyes])
80 AC_SEARCH_LIBS(iconv, iconv)
82 # Checks for header files:
83 AC_CHECK_HEADERS(iconv.h mcheck.h sys/mman.h poll.h sys/param.h)
88 # Checks for functions:
89 AC_CHECK_FUNCS(iconv mtrace ppoll)
91 # Check for a reasonable section alignment to pass to the linker. First,
92 # try looking for typical compile-time constants in system header files...
93 AC_MSG_CHECKING([linker section alignment])
96 while test $gwm_align -le 65536; do
97 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
99 #include <sys/param.h>
105 #if EXEC_PAGESIZE == ]] $gwm_align [[ || PAGE_SIZE == ]] $gwm_align [[ || PAGESIZE == ]] $gwm_align [[
106 int main() { return 0; }
110 ]])], [gwm_found_align=yes; break], [])
111 gwm_align=$(expr $gwm_align \* 2)
113 if test $gwm_found_align = no; then
115 if test $cross_compiling != yes; then
116 for gwm_prog in pagesize "getconf PAGE_SIZE"; do
117 if $gwm_prog > /dev/null 2>&1; then
120 while test $gwm_align -le 65536; do
121 if test $($gwm_prog 2> /dev/null) = $gwm_align; then
125 gwm_align=$(expr $gwm_align \* 2)
127 if test $gwm_found_align = yes; then break; fi
132 if test $gwm_found_align = no; then
133 gwm_align=4096 # complete guess
135 AC_MSG_RESULT([$gwm_align])
136 SECTION_ALIGN=$gwm_align
137 AC_SUBST(SECTION_ALIGN)
139 AC_MSG_CHECKING([for linker script support])
140 gwm_ldflags="$LDFLAGS"
141 LDFLAGS="$LDFLAGS -Wl,-Tconftest.ld"
142 cat > conftest.ld <<EOF
146 .gwminit.text : { init*(.text ) }
147 .gwminit.rodata : { init*(.rodata ) }
152 AC_LINK_IFELSE([AC_LANG_SOURCE([[
153 extern char init_start, init_end;
154 int main() { (void) ( &init_end - &init_start ); return 0; }
155 ]])], [gwm_linker_scripts=yes
156 AC_DEFINE(HAVE_INIT_SECTION, 1)
157 AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])
158 LDFLAGS="$gwm_ldflags"
159 AM_CONDITIONAL(LINKER_SCRIPTS, [test x$gwm_linker_scripts = xyes])
160 AH_TEMPLATE(HAVE_INIT_SECTION,[Define if the linker supports scripts (used to locate the init section).])
162 PKG_CFLAGS=$($PKG_CONFIG --cflags $gwm_packages)
163 PKG_LIBS=$($PKG_CONFIG --libs $gwm_packages)