[prev in list] [next in list] [prev in thread] [next in thread]
List: xine-cvslog
Subject: [xine-cvs] HG: xine-lib: Use M4sh AS_IF rather than sh if
From: "=?UTF-8?Q?Diego=20'Flameeyes'=20Petten=C3=B2?=" <flameeyes () gmail ! com>
Date: 2008-05-23 22:35:23
Message-ID: 686ae070079bad93a9a2.1211582096 () hg ! debian ! org
[Download RAW message or body]
# HG changeset patch
# User Diego 'Flameeyes' Pettenò <flameeyes@gmail.com>
# Date 1211582096 -7200
# Node ID 686ae070079bad93a9a2ce3431b579c129db8531
# Parent 965aea7ab1e11c9946af016b4f9c199a8bf75d16
Use M4sh AS_IF rather than sh if statements for common macros.
Instead of using directly the sh if statement, use AS_IF, which makes
it possible for autotools to identify conditionally-called macros, and
allows to avoid M4 ifelse macros.
diff -r 686ae070079bad93a9a2ce3431b579c129db8531 -r \
965aea7ab1e11c9946af016b4f9c199a8bf75d16 m4/attributes.m4
--- a/m4/attributes.m4 Sat May 24 00:34:56 2008 +0200
+++ b/m4/attributes.m4 Fri May 23 23:43:00 2008 +0200
@@ -42,11 +42,8 @@ AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [
CFLAGS="$ac_save_CFLAGS"
])
- if eval test [x$]AS_TR_SH([cc_cv_cflags_$1]) = xyes; then
- ifelse([$2], , [:], [$2])
- else
- ifelse([$3], , [:], [$3])
- fi
+ AS_IF([test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
+ [$2], [$3])
])
AC_DEFUN([CC_CHECK_CFLAGS], [
@@ -55,11 +52,8 @@ AC_DEFUN([CC_CHECK_CFLAGS], [
CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here!
)
- if eval test [x$]AS_TR_SH([cc_cv_cflags_$1]) = xyes; then
- ifelse([$2], , [:], [$2])
- else
- ifelse([$3], , [:], [$3])
- fi
+ AS_IF([test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
+ [$2], [$3])
])
dnl Check for a -Werror flag or equivalent. -Werror is the GCC
@@ -91,76 +85,69 @@ AC_DEFUN([CC_CHECK_ATTRIBUTE], [
CFLAGS="$ac_save_CFLAGS"
])
- if eval test [x$]AS_TR_SH([cc_cv_attribute_$1]) = xyes; then
- AC_DEFINE(AS_TR_CPP([SUPPORT_ATTRIBUTE_$1]), 1, [Define this if the compiler \
supports __attribute__(( ifelse([$2], , [$1], [$2]) ))])
- ifelse([$4], , [:], [$4])
- else
- ifelse([$5], , [:], [$5])
- fi
+ AS_IF([test x$]AS_TR_SH([cc_cv_attribute_$1])[ = xyes],
+ [AC_DEFINE(
+ AS_TR_CPP([SUPPORT_ATTRIBUTE_$1]), 1,
+ [Define this if the compiler supports __attribute__(( ifelse([$2], , [$1], \
[$2]) ))] + )
+ $4],
+ [$5])
])
AC_DEFUN([CC_ATTRIBUTE_CONSTRUCTOR], [
CC_CHECK_ATTRIBUTE(
[constructor],,
[void __attribute__((constructor)) ctor() { int a; }],
- [$1],
- [$2])
+ [$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_FORMAT], [
CC_CHECK_ATTRIBUTE(
[format], [format(printf, n, n)],
[void __attribute__((format(printf, 1, 2))) printflike(const char *fmt, ...) { \
fmt = (void *)0; }],
- [$1],
- [$2])
+ [$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_FORMAT_ARG], [
CC_CHECK_ATTRIBUTE(
[format_arg], [format_arg(printf)],
[char *__attribute__((format_arg(1))) gettextlike(const char *fmt) { fmt = (void \
*)0; }],
- [$1],
- [$2])
+ [$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_VISIBILITY], [
CC_CHECK_ATTRIBUTE(
[visibility_$1], [visibility("$1")],
[void __attribute__((visibility("$1"))) $1_function() { }],
- [$2],
- [$3])
+ [$2], [$3])
])
AC_DEFUN([CC_ATTRIBUTE_NONNULL], [
CC_CHECK_ATTRIBUTE(
[nonnull], [nonnull()],
[void __attribute__((nonnull())) some_function(void *foo, void *bar) { foo = \
(void*)0; bar = (void*)0; }],
- [$1],
- [$2])
+ [$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_UNUSED], [
CC_CHECK_ATTRIBUTE(
[unused], ,
[void some_function(void *foo, __attribute__((unused)) void *bar);],
- [$1],
- [$2])
+ [$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_SENTINEL], [
CC_CHECK_ATTRIBUTE(
[sentinel], ,
[void some_function(void *foo, ...) __attribute__((sentinel));],
- [$1],
- [$2])
+ [$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_DEPRECATED], [
CC_CHECK_ATTRIBUTE(
[deprecated], ,
[void some_function(void *foo, ...) __attribute__((deprecated));],
- [$1],
- [$2])
+ [$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_ALIAS], [
@@ -168,32 +155,28 @@ AC_DEFUN([CC_ATTRIBUTE_ALIAS], [
[alias], [weak, alias],
[void other_function(void *foo) { }
void some_function(void *foo) __attribute__((weak, alias("other_function")));],
- [$1],
- [$2])
+ [$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_MALLOC], [
CC_CHECK_ATTRIBUTE(
[malloc], ,
[void * __attribute__((malloc)) my_alloc(int n);],
- [$1],
- [$2])
+ [$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_PACKED], [
CC_CHECK_ATTRIBUTE(
[packed], ,
[struct astructure { char a; int b; long c; void *d; } \
__attribute__((packed));],
- [$1],
- [$2])
+ [$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_CONST], [
CC_CHECK_ATTRIBUTE(
[const], ,
[int __attribute__((const)) twopow(int n) { return 1 << n; } ],
- [$1],
- [$2])
+ [$1], [$2])
])
AC_DEFUN([CC_FLAG_VISIBILITY], [
@@ -207,39 +190,34 @@ AC_DEFUN([CC_FLAG_VISIBILITY], [
cc_cv_flag_visibility='no')
CFLAGS="$cc_flag_visibility_save_CFLAGS"])
- if test "x$cc_cv_flag_visibility" = "xyes"; then
- AC_DEFINE([SUPPORT_FLAG_VISIBILITY], 1, [Define this if the compiler supports \
the -fvisibility flag])
- ifelse([$1], , [:], [$1])
- else
- ifelse([$2], , [:], [$2])
- fi
+ AS_IF([test "x$cc_cv_flag_visibility" = "xyes"],
+ [AC_DEFINE([SUPPORT_FLAG_VISIBILITY], 1,
+ [Define this if the compiler supports the -fvisibility flag])
+ $1],
+ [$2])
])
AC_DEFUN([CC_FUNC_EXPECT], [
- AC_REQUIRE([CC_CHECK_WERROR])
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $cc_cv_werror"
- AC_CACHE_CHECK([if compiler has __builtin_expect function],
- [cc_cv_func_expect],
- [AC_COMPILE_IFELSE([
- int some_function()
- {
- int a = 3;
- return (int)__builtin_expect(a, 3);
- }
- ],
- [cc_cv_func_expect=yes],
- [cc_cv_func_expect=no])
- ])
- CFLAGS="$ac_save_CFLAGS"
-
- if test "x$cc_cv_func_expect" = "xyes"; then
- AC_DEFINE([SUPPORT__BUILTIN_EXPECT], 1, [Define this if the compiler supports \
__builtin_expect() function])
- $1
- else
- true
- $2
- fi
+ AC_REQUIRE([CC_CHECK_WERROR])
+ AC_CACHE_CHECK([if compiler has __builtin_expect function],
+ [cc_cv_func_expect],
+ [ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $cc_cv_werror"
+ AC_COMPILE_IFELSE(
+ [int some_function() {
+ int a = 3;
+ return (int)__builtin_expect(a, 3);
+ }],
+ [cc_cv_func_expect=yes],
+ [cc_cv_func_expect=no])
+ CFLAGS="$ac_save_CFLAGS"
+ ])
+
+ AS_IF([test "x$cc_cv_func_expect" = "xyes"],
+ [AC_DEFINE([SUPPORT__BUILTIN_EXPECT], 1,
+ [Define this if the compiler supports __builtin_expect() function])
+ $1],
+ [$2])
])
AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [
diff -r 686ae070079bad93a9a2ce3431b579c129db8531 -r \
965aea7ab1e11c9946af016b4f9c199a8bf75d16 m4/misc.m4
--- a/m4/misc.m4 Sat May 24 00:34:56 2008 +0200
+++ b/m4/misc.m4 Fri May 23 23:43:00 2008 +0200
@@ -50,9 +50,6 @@ AC_DEFUN([XINE_CHECK_MINMAX], [
[xine_cv_minmax=no])
])
- if test x$xine_cv_minmax = xyes; then
- ifelse([$1], , [:], [$1])
- else
- ifelse([$2], , [:], [$2])
- fi
+ AS_IF([test x$xine_cv_minmax = xyes],
+ [$1], [$2])
])
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Xine-cvslog mailing list
Xine-cvslog@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xine-cvslog
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic