changeset 32673:9bb86c2a9dc5

Simplify a bunch of configure checks with the statement_check function.
author diego
date Wed, 05 Jan 2011 16:37:45 +0000
parents 81712a60b4bf
children 43d793e6e5b7
files configure
diffstat 1 files changed, 10 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Wed Jan 05 16:01:01 2011 +0000
+++ b/configure	Wed Jan 05 16:37:45 2011 +0000
@@ -3788,12 +3788,8 @@
 
 echocheck "shm"
 if test "$_shm" = auto ; then
-  cat > $TMPC << EOF
-#include <sys/shm.h>
-int main(void) { shmget(0, 0, 0); shmat(0, 0, 0); shmctl(0, 0, 0); return 0; }
-EOF
   _shm=no
-  cc_check && _shm=yes
+  statement_check sys/shm.h 'shmget(0, 0, 0); shmat(0, 0, 0); shmctl(0, 0, 0)' && _shm=yes
 fi
 if test "$_shm" = yes ; then
   def_shm='#define HAVE_SHM 1'
@@ -3804,12 +3800,8 @@
 
 
 echocheck "strsep()"
-cat > $TMPC << EOF
-#include <string.h>
-int main(void) { char *s = "Hello, world!"; strsep(&s, ","); return 0; }
-EOF
 _strsep=no
-cc_check && _strsep=yes
+statement_check string.h 'char *s = "Hello, world!"; strsep(&s, ",")' && _strsep=yes
 if test "$_strsep" = yes ; then
   def_strsep='#define HAVE_STRSEP 1'
  _need_strsep=no
@@ -3879,12 +3871,8 @@
 
 
 echocheck "gettimeofday()"
-cat > $TMPC << EOF
-#include <sys/time.h>
-int main(void) {struct timeval tv; struct timezone tz; gettimeofday(&tv, &tz); return 0; }
-EOF
 _gettimeofday=no
-cc_check && _gettimeofday=yes
+statement_check sys/time.h 'struct timeval tv; struct timezone tz; gettimeofday(&tv, &tz)' && _gettimeofday=yes
 if test "$_gettimeofday" = yes ; then
   def_gettimeofday='#define HAVE_GETTIMEOFDAY 1'
   _need_gettimeofday=no
@@ -3934,11 +3922,7 @@
 statement_check sys/sysi86.h 'sysi86(0)' && _sysi86=yes
 if test "$_sysi86" = yes ; then
   def_sysi86='#define HAVE_SYSI86 1'
-  cat > $TMPC << EOF
-#include <sys/sysi86.h>
-int main(void) { int sysi86(int, void*); sysi86(0); return 0; }
-EOF
-  cc_check && def_sysi86_iv='#define HAVE_SYSI86_iv 1'
+  statement_check sys/sysi86.h 'int sysi86(int, void*); sysi86(0)' && def_sysi86_iv='#define HAVE_SYSI86_iv 1'
 else
   def_sysi86='#undef HAVE_SYSI86'
 fi
@@ -3947,12 +3931,8 @@
 
 
 echocheck "sys/sysinfo.h"
-cat > $TMPC << EOF
-#include <sys/sysinfo.h>
-int main(void) { struct sysinfo s_info; sysinfo(&s_info); return 0; }
-EOF
 _sys_sysinfo=no
-cc_check && _sys_sysinfo=yes
+statement_check sys/sysinfo.h 'struct sysinfo s_info; sysinfo(&s_info)' && _sys_sysinfo=yes
 if test "$_sys_sysinfo" = yes ; then
   def_sys_sysinfo_h='#define HAVE_SYS_SYSINFO_H 1'
 else
@@ -4024,11 +4004,7 @@
 echocheck "Apple IR"
 if test "$_apple_ir" = auto ; then
   _apple_ir=no
-  cat > $TMPC <<EOF
-#include <linux/input.h>
-int main(void) { struct input_event ev; struct input_id id; return 0; }
-EOF
-  cc_check && _apple_ir=yes
+  statement_check linux/input.h 'struct input_event ev; struct input_id id' && _apple_ir=yes
 fi
 if test "$_apple_ir" = yes ; then
   def_apple_ir='#define CONFIG_APPLE_IR 1'
@@ -4761,17 +4737,8 @@
 
 echocheck "QuickTime"
 if test "$quicktime" = auto ; then
-  cat > $TMPC <<EOF
-#include <QuickTime/QuickTime.h>
-int main(void) {
-    ImageDescription *desc;
-    EnterMovies();
-    ExitMovies();
-    return 0;
-}
-EOF
   quicktime=no
-  cc_check -framework QuickTime && quicktime=yes
+  statement_check QuickTime/QuickTime.h 'ImageDescription *desc; EnterMovies(); ExitMovies()' -framework QuickTime && quicktime=yes
 fi
 if test "$quicktime" = yes ; then
   extra_ldflags="$extra_ldflags -framework QuickTime"
@@ -6998,11 +6965,7 @@
 
 echocheck "Xvid two pass plugin"
 if test "$_mencoder" = yes && test "$_xvid" = yes && test "$_xvid_lavc" = auto ; then
-  cat > $TMPC << EOF
-#include <xvid.h>
-int main(void) { xvid_plugin_2pass2_t s; s.vbv_size=0; return 0; }
-EOF
-  cc_check && _xvid_lavc=yes
+  statement_check xvid.h 'xvid_plugin_2pass2_t s; s.vbv_size = 0' && _xvid_lavc=yes
 fi
 if test "$_xvid_lavc" = yes ; then
   def_xvid_lavc='#define CONFIG_LIBXVID 1'
@@ -7156,13 +7119,8 @@
 
 echocheck "libnut"
 if test "$_libnut" = auto ; then
-  cat > $TMPC << EOF
-#include <libnut.h>
-nut_context_tt * nut;
-int main(void) { nut_error(0); return 0; }
-EOF
   _libnut=no
-   cc_check -lnut && _libnut=yes
+   statement_check libnut.h 'nut_context_tt * nut; nut_error(0)' -lnut && _libnut=yes
 fi
 
 if test "$_libnut" = yes ; then
@@ -7346,15 +7304,7 @@
 if test "$_tv_dshow" = auto ; then
   _tv_dshow=no
   if test "$_tv" = yes && win32 ; then
-    cat > $TMPC <<EOF
-#include <ole2.h>
-int main(void) {
-    void* p;
-    CoCreateInstance((GUID*)&GUID_NULL, NULL, CLSCTX_INPROC_SERVER, &GUID_NULL, &p);
-    return 0;
-}
-EOF
-    cc_check -lole32 -luuid && _tv_dshow=yes
+    statement_check ole2.h 'void* p; CoCreateInstance((GUID*)&GUID_NULL, NULL, CLSCTX_INPROC_SERVER, &GUID_NULL, &p)' -lole32 -luuid && _tv_dshow=yes
   fi
 fi
 if test "$_tv_dshow" = yes ; then