changeset 32719:1cdf5ed4b9d8

Add return_statement_check() helper function and use it to simplify some checks.
author diego
date Thu, 20 Jan 2011 12:55:37 +0000
parents 1fc2df65b915
children 1afbc8e3ff55
files configure
diffstat 1 files changed, 11 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Thu Jan 20 12:44:08 2011 +0000
+++ b/configure	Thu Jan 20 12:55:37 2011 +0000
@@ -111,6 +111,15 @@
   compile_check $TMPC $@
 }
 
+return_statement_check() {
+  cat > $TMPC << EOF
+#include <$1>
+int main(void) { $2; return $3; }
+EOF
+  shift 3
+  compile_check $TMPC $@
+}
+
 inline_asm_check() {
   cat > $TMPC << EOF
 int main(void) { __asm__ volatile ($1); return 0; }
@@ -4353,13 +4362,7 @@
 if test "$_vdpau" = auto ; then
   _vdpau=no
   if test "$_dl" = yes ; then
-    cat > $TMPC <<EOF
-#include <vdpau/vdpau_x11.h>
-int main(void) {
-    vdp_device_create_x11(0, 0, 0, 0);
-    return VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1; }
-EOF
-    cc_check -lvdpau && _vdpau=yes
+    return_statement_check vdpau/vdpau_x11.h 'vdp_device_create_x11(0, 0, 0, 0)' VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 -lvdpau && _vdpau=yes
   fi
 fi
 if test "$_vdpau" = yes ; then
@@ -4820,16 +4823,7 @@
 echocheck "MNG support"
 if test "$_mng" = auto ; then
   _mng=no
-  cat > $TMPC << EOF
-#include <libmng.h>
-int main(void) {
-  const char * p_ver = mng_version_text();
-  return !p_ver || p_ver[0] == 0;
-}
-EOF
-  if cc_check -lmng -lz $_ld_lm ; then
-    _mng=yes
-  fi
+  return_statement_check libmng.h 'const char * p_ver = mng_version_text()' '!p_ver || p_ver[0] == 0' -lmng -lz $_ld_lm && _mng=yes
 fi
 echores "$_mng"
 if test "$_mng" = yes ; then