11016ad83Smrgdnl Detection and configuration of the visibility feature of gcc
21016ad83Smrgdnl Vincent Torri 2006-02-11
31016ad83Smrgdnl
41016ad83Smrgdnl XCB_CHECK_VISIBILITY([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
51016ad83Smrgdnl Check the visibility feature of gcc
61016ad83Smrgdnl
71016ad83SmrgAC_DEFUN([XCB_CHECK_VISIBILITY],
81016ad83Smrg[
91016ad83SmrgAC_MSG_CHECKING([whether ${CC} supports symbol visibility])
101016ad83Smrg
111016ad83Smrgsave_CFLAGS=${CFLAGS}
121016ad83SmrgCFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
131016ad83SmrgAC_COMPILE_IFELSE(
141016ad83Smrg   [AC_LANG_PROGRAM(
151016ad83Smrg      [[
161016ad83Smrg#pragma GCC visibility push(hidden)
171016ad83Smrgextern void f(int);
181016ad83Smrg#pragma GCC visibility pop
191016ad83Smrg      ]],
201016ad83Smrg      [[]]
211016ad83Smrg    )],
221016ad83Smrg   [AC_DEFINE(
231016ad83Smrg       GCC_HAS_VISIBILITY,
241016ad83Smrg       [],
251016ad83Smrg       [Defined if GCC supports the visibility feature])
261016ad83Smrg    m4_if([$1], [], [:], [$1])
271016ad83Smrg    AC_MSG_RESULT(yes)],
281016ad83Smrg   [m4_if([$2], [], [:], [$2])
291016ad83Smrg    AC_MSG_RESULT(no)])
301016ad83Smrg
311016ad83SmrgCFLAGS=${save_CFLAGS}
321016ad83Smrg])
331016ad83Smrg
341016ad83Smrgdnl Detection and configuration of the visibility feature of gcc
351016ad83Smrgdnl Vincent Torri 2006-02-11
361016ad83Smrgdnl
371016ad83Smrgdnl XCB_EXTENSION(name, default)
381016ad83Smrgdnl set the X extension
391016ad83Smrgdnl
401016ad83SmrgAC_DEFUN([XCB_EXTENSION],
417204935cSmrg[dnl
421016ad83Smrgpushdef([UP], translit([$1], [-a-z], [_A-Z]))dnl
431016ad83Smrgpushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl
447204935cSmrgdnl
457204935cSmrgm4_if([$2], [yes], [m4_define([xcb_defopt], [yes])],
467204935cSmrg      [$2], [no],  [m4_define([xcb_defopt], [no])],
477204935cSmrg      m4_define([xcb_defopt], [auto]))dnl
481016ad83Smrg
491016ad83SmrgAC_ARG_ENABLE(DOWN,
507204935cSmrg    [AS_HELP_STRING([--enable-[]DOWN],
517204935cSmrg                    [Build XCB $1 Extension (default: ]xcb_defopt[)])],
521016ad83Smrg    [BUILD_[]UP=$enableval],
537204935cSmrg    [BUILD_[]UP=xcb_defopt])
547204935cSmrgdnl
557204935cSmrgm4_if(xcb_defopt, [auto], [
567204935cSmrg# This extension has a default value of "auto" and depends on the value of $2
577204935cSmrgif test "x$BUILD_[]UP" = "xauto" ; then
587204935cSmrg    BUILD_[]UP=$2
597204935cSmrgfi
607204935cSmrgif test "x$BUILD_[]UP" = "xyes" ; then
617204935cSmrg    if test "x$2" = "xno" ; then
627204935cSmrg      AC_MSG_ERROR([Extension []UP requested, but dependencies are not met])
637204935cSmrg    fi
647204935cSmrgfi])
651016ad83Smrg
667204935cSmrgm4_undefine([xcb_defopt])dnl
671016ad83SmrgAM_CONDITIONAL(BUILD_[]UP, [test "x$BUILD_[]UP" = "xyes"])
681016ad83Smrg])
691016ad83Smrg
701016ad83Smrgdnl End of acinclude.m4
71