[Pixman] [PATCH 2/3] configure.ac: Make PIXMAN_CHECK_CFLAG macro more flexible
Søren Sandmann
sandmann at cs.au.dk
Thu Oct 10 13:19:35 PDT 2013
From: Søren Sandmann Pedersen <ssp at redhat.com>
Change the PIXMAN_CHECK_CFLAG macro to perform a yes_action or
no_action depending on whether the given flag is supported. Previously
it would simply add the flag to CFLAGS.
Also add a new PIXMAN_ADD_CFLAG that adds the flag to CFLAGS; this
macro should now be called instead of the old PIXMAN_CHECK_CFLAG.
---
configure.ac | 28 ++++++++++++++++++----------
1 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/configure.ac b/configure.ac
index b8f6ab0..68d8d6e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -126,8 +126,8 @@ for w in -Werror -errwarn; do
fi
done
-dnl PIXMAN_CHECK_CFLAG(flag, [program])
-dnl Adds flag to CFLAGS if the given program links without warnings or errors.
+dnl PIXMAN_CHECK_CFLAG(flag, [program], [yes_action], [no_action])
+dnl Checks whether flag is supported and performas yes/no_action if it is/isn't
AC_DEFUN([PIXMAN_CHECK_CFLAG], [dnl
AC_MSG_CHECKING([whether the compiler supports $1])
PIXMAN_LINK_WITH_ENV(
@@ -137,10 +137,18 @@ AC_DEFUN([PIXMAN_CHECK_CFLAG], [dnl
],
[_yesno=yes],
[_yesno=no])
- if test "x$_yesno" = xyes; then
- CFLAGS="$CFLAGS $1"
+ if test "x$_yesno" = "xyes"; then
+ ifelse([$3], , :, [$3])
+ else
+ ifelse([$4], , :, [$4])
fi
- AC_MSG_RESULT($_yesno)
+ AC_MSG_RESULT($_yesno)
+])
+
+dnl PIXMAN_ADD_CFLAG(flag, [program])
+dnl Adds flag to CFLAGS if the given program links without warnings or errors.
+AC_DEFUN([PIXMAN_ADD_CFLAG], [dnl
+ PIXMAN_CHECK_CFLAG([$1],[$2],[CFLAGS="$CFLAGS $1"])
])
AC_CHECK_SIZEOF(long)
@@ -182,9 +190,9 @@ AC_SUBST(LT_VERSION_INFO)
# Check for dependencies
-PIXMAN_CHECK_CFLAG([-Wall])
-PIXMAN_CHECK_CFLAG([-Wdeclaration-after-statement])
-PIXMAN_CHECK_CFLAG([-fno-strict-aliasing])
+PIXMAN_ADD_CFLAG([-Wall])
+PIXMAN_ADD_CFLAG([-Wdeclaration-after-statement])
+PIXMAN_ADD_CFLAG([-fno-strict-aliasing])
dnl =========================================================================
dnl OpenMP for the test suite?
@@ -251,7 +259,7 @@ AC_SUBST(OPENMP_CFLAGS)
dnl =========================================================================
dnl -fvisibility stuff
-PIXMAN_CHECK_CFLAG([-fvisibility=hidden], [dnl
+PIXMAN_ADD_CFLAG([-fvisibility=hidden], [dnl
#if defined(__GNUC__) && (__GNUC__ >= 4)
#ifdef _WIN32
#error Have -fvisibility but it is ignored and generates a warning
@@ -261,7 +269,7 @@ PIXMAN_CHECK_CFLAG([-fvisibility=hidden], [dnl
#endif
])
-PIXMAN_CHECK_CFLAG([-xldscope=hidden], [dnl
+PIXMAN_ADD_CFLAG([-xldscope=hidden], [dnl
#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
#else
#error Need Sun Studio 8 for visibility
--
1.7.1
More information about the Pixman
mailing list