• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1dnl
2dnl Check for working do while(0) macros. This is used by G_STMT_START
3dnl and G_STMT_END in glib/gmacros.h. Without having this defined we
4dnl get "ambigious if-else" compiler warnings when compling C++ code.
5dnl
6dnl Copied from GLib's configure.in
7dnl
8AC_DEFUN([AG_GST_CHECK_DOWHILE_MACROS],[
9
10dnl *** check for working do while(0) macros ***
11AC_CACHE_CHECK([for working do while(0) macros], _cv_g_support_dowhile_macros, [
12	AC_TRY_COMPILE([],[
13	#define STMT_START do
14	#define STMT_END while(0)
15	#define STMT_TEST STMT_START { i = 0; } STMT_END
16	int main(void) { int i = 1; STMT_TEST; return i; }],
17	[_cv_g_support_dowhile_macros=yes],
18	[_cv_g_support_dowhile_macros=no],
19	[_cv_g_support_dowhile_macros=yes])
20])
21if test x$_cv_g_support_dowhile_macros = xyes; then
22  AC_DEFINE(HAVE_DOWHILE_MACROS, 1, [define for working do while(0) macros])
23fi
24])
25