[MPlayer-cvslog] r32246 - trunk/configure

diego subversion at mplayerhq.hu
Tue Sep 14 19:04:07 CEST 2010


Author: diego
Date: Tue Sep 14 19:04:06 2010
New Revision: 32246

Log:
Simplify a bunch of configure checks through the use of function_check().

Modified:
   trunk/configure

Modified: trunk/configure
==============================================================================
--- trunk/configure	Tue Sep 14 16:09:33 2010	(r32245)
+++ trunk/configure	Tue Sep 14 19:04:06 2010	(r32246)
@@ -2928,12 +2928,8 @@ fi
 
 echocheck "langinfo"
 if test "$_langinfo" = auto ; then
-  cat > $TMPC <<EOF
-#include <langinfo.h>
-int main(void) { nl_langinfo(CODESET); return 0; }
-EOF
   _langinfo=no
-  cc_check && _langinfo=yes
+  function_check langinfo.h 'nl_langinfo(CODESET)' && _langinfo=yes
 fi
 if test "$_langinfo" = yes ; then
   def_langinfo='#define HAVE_LANGINFO 1'
@@ -3057,12 +3053,8 @@ echores "$_kstat"
 
 echocheck "posix4"
 # required for nanosleep on some systems
-cat > $TMPC << EOF
-#include <time.h>
-int main(void) { nanosleep(0, 0); return 0; }
-EOF
 _posix4=no
-function_check time.h "nanosleep(0, 0)" -lposix4 && _posix4=yes
+function_check time.h 'nanosleep(0, 0)' -lposix4 && _posix4=yes
 if test "$_posix4" = yes ; then
   extra_ldflags="$extra_ldflags -lposix4"
 fi
@@ -3098,13 +3090,8 @@ echores "$_mkstemp"
 
 
 echocheck "nanosleep"
-# also check for nanosleep
-cat > $TMPC << EOF
-#include <time.h>
-int main(void) { nanosleep(0, 0); return 0; }
-EOF
 _nanosleep=no
-cc_check && _nanosleep=yes
+function_check time.h 'nanosleep(0, 0)' && _nanosleep=yes
 if test "$_nanosleep" = yes ; then
   def_nanosleep='#define HAVE_NANOSLEEP 1'
 else
@@ -3128,11 +3115,7 @@ done
 test $_socklib = yes && test $_winsock2_h = auto && _winsock2_h=no
 if test $_winsock2_h = auto ; then
   _winsock2_h=no
-  cat > $TMPC << EOF
-#include <winsock2.h>
-int main(void) { gethostbyname(0); return 0; }
-EOF
-  cc_check -lws2_32 && _ld_sock="-lws2_32" && _winsock2_h=yes
+  function_check winsock2.h 'gethostbyname(0)' -lws2_32 && _ld_sock="-lws2_32" && _winsock2_h=yes
 fi
 test "$_ld_sock" && res_comment="using $_ld_sock"
 echores "$_socklib"
@@ -3330,11 +3313,7 @@ echores "$_socklen_t"
 
 echocheck "closesocket()"
 _closesocket=no
-cat > $TMPC << EOF
-#include <winsock2.h>
-int main(void) { closesocket(~0); return 0; }
-EOF
-cc_check $_ld_sock && _closesocket=yes
+function_check winsock2.h 'closesocket(~0)' $_ld_sock && _closesocket=yes
 if test "$_closesocket" = yes ; then
   def_closesocket='#define HAVE_CLOSESOCKET 1'
 else
@@ -3461,12 +3440,8 @@ echores "$_malloc"
 echocheck "memalign()"
 # XXX restrict to x86 ? extend to other CPUs/cacheline sizes ?
 def_memalign_hack='#define CONFIG_MEMALIGN_HACK 0'
-cat > $TMPC << EOF
-#include <malloc.h>
-int main(void) { memalign(64, sizeof(char)); return 0; }
-EOF
 _memalign=no
-cc_check && _memalign=yes
+function_check malloc.h 'memalign(64, sizeof(char))' && _memalign=yes
 if test "$_memalign" = yes ; then
   def_memalign='#define HAVE_MEMALIGN 1'
 else
@@ -3490,12 +3465,8 @@ echores "$posix_memalign"
 
 
 echocheck "alloca.h"
-cat > $TMPC << EOF
-#include <alloca.h>
-int main(void) { alloca(0); return 0; }
-EOF
 _alloca=no
-cc_check && _alloca=yes
+function_check alloca.h 'alloca(0)' && _alloca=yes
 if cc_check ; then
   def_alloca_h='#define HAVE_ALLOCA_H 1'
 else
@@ -3971,12 +3942,8 @@ echores "$_glob"
 
 
 echocheck "setenv()"
-cat > $TMPC << EOF
-#include <stdlib.h>
-int main(void) { setenv("","",0); return 0; }
-EOF
 _setenv=no
-cc_check && _setenv=yes
+function_check stdlib.h 'setenv("", "", 0)' && _setenv=yes
 if test "$_setenv" = yes ; then
   def_setenv='#define HAVE_SETENV 1'
   _need_setenv=no
@@ -3990,22 +3957,14 @@ echores "$_setenv"
 echocheck "setmode()"
 _setmode=no
 def_setmode='#define HAVE_SETMODE 0'
-cat > $TMPC << EOF
-#include <io.h>
-int main(void) { setmode(0, 0); return 0; }
-EOF
-cc_check && _setmode=yes && def_setmode='#define HAVE_SETMODE 1'
+function_check io.h 'setmode(0, 0)' && _setmode=yes && def_setmode='#define HAVE_SETMODE 1'
 echores "$_setmode"
 
 
 if sunos; then
 echocheck "sysi86()"
-cat > $TMPC << EOF
-#include <sys/sysi86.h>
-int main(void) { sysi86(0); return 0; }
-EOF
 _sysi86=no
-cc_check && _sysi86=yes
+function_check sys/sysi86.h 'sysi86(0)' && _sysi86=yes
 if test "$_sysi86" = yes ; then
   def_sysi86='#define HAVE_SYSI86 1'
   cat > $TMPC << EOF
@@ -4139,14 +4098,10 @@ if test "$_smb" = yes; then
   extra_ldflags="$extra_ldflags -lsmbclient"
 fi
 if test "$_smb" = auto; then
-    _smb=no
-    cat > $TMPC << EOF
-#include <libsmbclient.h>
-int main(void) { smbc_opendir("smb://"); return 0; }
-EOF
+  _smb=no
   for _ld_tmp in "-lsmbclient" "-lsmbclient $_ld_dl" "-lsmbclient $_ld_dl -lnsl" "-lsmbclient $_ld_dl -lssl -lnsl" ; do
-    cc_check $_ld_tmp && extra_ldflags="$extra_ldflags $_ld_tmp" && \
-      _smb=yes && break
+    function_check libsmbclient.h 'smbc_opendir("smb://")' $_ld_tmp &&
+      extra_ldflags="$extra_ldflags $_ld_tmp" && _smb=yes && break
   done
 fi
 
@@ -4762,12 +4717,8 @@ fi
 
 echocheck "GGI"
 if test "$_ggi" = auto ; then
-  cat > $TMPC << EOF
-#include <ggi/ggi.h>
-int main(void) { ggiInit(); return 0; }
-EOF
   _ggi=no
-  cc_check -lggi && _ggi=yes
+  function_check ggi/ggi.h 'ggiInit()' -lggi && _ggi=yes
 fi
 if test "$_ggi" = yes ; then
   def_ggi='#define CONFIG_GGI 1'
@@ -4955,15 +4906,8 @@ echores $quicktime
 
 echocheck "Quartz"
 if test "$_quartz" = auto ; then
-  cat > $TMPC <<EOF
-#include <Carbon/Carbon.h>
-int main(void) {
-    CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false);
-    return 0;
-}
-EOF
   _quartz=no
-  cc_check -framework Carbon && _quartz=yes
+  function_check Carbon/Carbon.h 'CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false)' -framework Carbon && _quartz=yes
 fi
 if test "$_quartz" = yes ; then
   libs_mplayer="$libs_mplayer -framework Carbon"
@@ -5121,12 +5065,8 @@ fi
 
 if test "$_gif" = auto ; then
   _gif=no
-cat > $TMPC << EOF
-#include <gif_lib.h>
-int main(void) { QuantizeBuffer(0, 0, 0, 0, 0, 0, 0, 0); return 0; }
-EOF
   for _ld_gif in "-lungif" "-lgif" ; do
-    cc_check $_ld_gif && _gif=yes && break
+    function_check gif_lib.h 'QuantizeBuffer(0, 0, 0, 0, 0, 0, 0, 0)' $_ld_gif && _gif=yes && break
   done
 fi
 
@@ -5203,12 +5143,8 @@ esac
 
 echocheck "VESA support"
 if test "$_vesa" = auto ; then
-  cat > $TMPC << EOF
-#include <vbe.h>
-int main(void) { vbeVersion(); return 0; }
-EOF
   _vesa=no
-  cc_check -lvbe -llrmi && _vesa=yes
+  function_check vbe.h 'vbeVersion()' -lvbe -llrmi && _vesa=yes
 fi
 if test "$_vesa" = yes ; then
   def_vesa='#define CONFIG_VESA 1'
@@ -5735,14 +5671,9 @@ fi
 echocheck "JACK"
 if test "$_jack" = auto ; then
   _jack=yes
-
-cat > $TMPC << EOF
-#include <jack/jack.h>
-int main(void) { jack_client_open("test", JackUseExactName, NULL); return 0; }
-EOF
-  if cc_check -ljack ; then
+  if function_check jack/jack.h 'jack_client_open("test", JackUseExactName, NULL)' -ljack ; then
     libs_mplayer="$libs_mplayer -ljack"
-  elif cc_check $($_pkg_config --libs --cflags --silence-errors jack) ; then
+  elif function_check jack/jack.h 'jack_client_open("test", JackUseExactName, NULL)' $($_pkg_config --libs --cflags --silence-errors jack) ; then
     libs_mplayer="$libs_mplayer $($_pkg_config --libs jack)"
     extra_cflags="$extra_cflags "$($_pkg_config --cflags jack)""
   else
@@ -5915,11 +5846,8 @@ if sunos; then
 echocheck "Sun mediaLib"
 if test "$_mlib" = auto ; then
   _mlib=no
-  cat > $TMPC << EOF
-#include <mlib.h>
-int main(void) { mlib_VideoColorYUV2ABGR420(0,0,0,0,0,0,0,0,0); return 0; }
-EOF
-  cc_check -lmlib && _mlib=yes && def_mlib='#define CONFIG_MLIB 1'
+  cc_check mlib.h "mlib_VideoColorYUV2ABGR420(0, 0, 0, 0, 0, 0, 0, 0, 0)" -lmlib &&
+    _mlib=yes && def_mlib='#define CONFIG_MLIB 1'
 fi
 echores "$_mlib"
 fi #if sunos
@@ -6456,12 +6384,8 @@ echores "$_enca"
 
 
 echocheck "zlib"
-cat > $TMPC << EOF
-#include <zlib.h>
-int main(void) { inflate(0, Z_NO_FLUSH); return 0; }
-EOF
 _zlib=no
-cc_check -lz && _zlib=yes
+function_check zlib.h 'inflate(0, Z_NO_FLUSH)' -lz && _zlib=yes
 if test "$_zlib" = yes ; then
   def_zlib='#define CONFIG_ZLIB 1'
   extra_ldflags="$extra_ldflags -lz"
@@ -6476,11 +6400,7 @@ echores "$_zlib"
 echocheck "bzlib"
 bzlib=no
 def_bzlib='#define CONFIG_BZLIB 0'
-cat > $TMPC << EOF
-#include <bzlib.h>
-int main(void) { BZ2_bzlibVersion(); return 0; }
-EOF
-cc_check -lbz2 && bzlib=yes
+function_check bzlib.h 'BZ2_bzlibVersion()' -lbz2 && bzlib=yes
 if test "$bzlib" = yes ; then
   def_bzlib='#define CONFIG_BZLIB 1'
   extra_ldflags="$extra_ldflags -lbz2"
@@ -6515,11 +6435,7 @@ echores "$_rtc"
 echocheck "liblzo2 support"
 if test "$_liblzo" = auto ; then
   _liblzo=no
-  cat > $TMPC << EOF
-#include <lzo/lzo1x.h>
-int main(void) { lzo_init(); return 0; }
-EOF
-  cc_check -llzo2 && _liblzo=yes
+  function_check lzo/lzo1x.h 'lzo_init()' -llzo2 && _liblzo=yes
 fi
 if test "$_liblzo" = yes ; then
   def_liblzo='#define CONFIG_LIBLZO 1'
@@ -6549,12 +6465,8 @@ echores "$_mad"
 
 echocheck "Twolame"
 if test "$_twolame" = auto ; then
-  cat > $TMPC <<EOF
-#include <twolame.h>
-int main(void) { twolame_init(); return 0; }
-EOF
   _twolame=no
-  cc_check -ltwolame $_ld_lm && _twolame=yes
+  function_check twolame.h 'twolame_init()' -ltwolame $_ld_lm && _twolame=yes
 fi
 if test "$_twolame" = yes ; then
   def_twolame='#define CONFIG_TWOLAME 1'
@@ -6572,11 +6484,7 @@ if test "$_toolame" = auto ; then
 if test "$_twolame" = yes ; then
   res_comment="disabled by twolame"
 else
-  cat > $TMPC <<EOF
-#include <toolame.h>
-int main(void) { toolame_init(); return 0; }
-EOF
-  cc_check -ltoolame $_ld_lm && _toolame=yes
+  function_check toolame.h 'toolame_init()' -ltoolame $_ld_lm && _toolame=yes
 fi
 fi
 if test "$_toolame" = yes ; then
@@ -6597,19 +6505,11 @@ if test "$_tremor_internal" = yes; then
   _libvorbis=no
 elif test "$_tremor" = auto; then
   _tremor=no
-  cat > $TMPC << EOF
-#include <tremor/ivorbiscodec.h>
-int main(void) { vorbis_packet_blocksize(0,0); return 0; }
-EOF
-  cc_check -logg -lvorbisidec $_ld_lm && _tremor=yes && _libvorbis=no
+  function_check tremor/ivorbiscodec.h 'vorbis_packet_blocksize(0, 0)' -logg -lvorbisidec $_ld_lm && _tremor=yes && _libvorbis=no
 fi
 if test "$_libvorbis" = auto; then
   _libvorbis=no
-  cat > $TMPC << EOF
-#include <vorbis/codec.h>
-int main(void) { vorbis_packet_blocksize(0,0); return 0; }
-EOF
-  cc_check -lvorbis -logg $_ld_lm && _libvorbis=yes
+  function_check vorbis/codec.h 'vorbis_packet_blocksize(0, 0)' -lvorbis -logg $_ld_lm && _libvorbis=yes
 fi
 if test "$_tremor_internal" = yes ; then
   _vorbis=yes
@@ -6664,11 +6564,7 @@ echores "$_speex"
 echocheck "libgsm"
 if test "$_libgsm" = auto ; then
   _libgsm=no
-  cat > $TMPC << EOF
-#include <gsm/gsm.h>
-int main(void) { gsm_create(); return 0; }
-EOF
-  cc_check -lgsm && _libgsm=yes
+  function_check gsm/gsm.h 'gsm_create()' -lgsm && _libgsm=yes
 fi
 if test "$_libgsm" = yes ; then
   def_libgsm='#define CONFIG_LIBGSM 1'
@@ -6768,11 +6664,7 @@ echocheck "mpg123 support"
 def_mpg123='#undef CONFIG_MPG123'
 if test "$_mpg123" = auto; then
   _mpg123=no
-  cat > $TMPC <<EOF
-#include <mpg123.h>
-int main(void){ mpg123_init(); return 0; }
-EOF
-  cc_check -lmpg123 && _mpg123=yes && extra_ldflags="$extra_ldflags -lmpg123"
+  function_check mpg123.h 'mpg123_init()' -lmpg123 && _mpg123=yes && extra_ldflags="$extra_ldflags -lmpg123"
 fi
 if test "$_mpg123" = yes ; then
   def_mpg123='#define CONFIG_MPG123 1'
@@ -7279,11 +7171,7 @@ echores "$ffmpeg"
 echocheck "libopencore_amr narrowband"
 if test "$_libopencore_amrnb" = auto ; then
   _libopencore_amrnb=no
-  cat > $TMPC << EOF
-#include <opencore-amrnb/interf_dec.h>
-int main(void) { Decoder_Interface_init(); return 0; }
-EOF
-  cc_check -lopencore-amrnb && _libopencore_amrnb=yes
+  function_check opencore-amrnb/interf_dec.h 'Decoder_Interface_init()' -lopencore-amrnb && _libopencore_amrnb=yes
   if test "$ffmpeg_a" != yes ; then
     _libopencore_amrnb=no
     res_comment="ffmpeg (static) is required by libopencore_amrnb, sorry"
@@ -7306,11 +7194,7 @@ echores "$_libopencore_amrnb"
 echocheck "libopencore_amr wideband"
 if test "$_libopencore_amrwb" = auto ; then
   _libopencore_amrwb=no
-  cat > $TMPC << EOF
-#include <opencore-amrwb/dec_if.h>
-int main(void) { D_IF_init(); return 0; }
-EOF
-  cc_check -lopencore-amrwb && _libopencore_amrwb=yes
+  function_check opencore-amrwb/dec_if.h 'D_IF_init()' -lopencore-amrwb && _libopencore_amrwb=yes
   if test "$ffmpeg_a" != yes ; then
     _libopencore_amrwb=no
     res_comment="ffmpeg (static) is required by libopencore_amrwb, sorry"
@@ -7347,12 +7231,9 @@ echores "$_libdv"
 echocheck "Xvid"
 if test "$_xvid" = auto ; then
   _xvid=no
-  cat > $TMPC << EOF
-#include <xvid.h>
-int main(void) { xvid_global(0, 0, 0, 0); return 0; }
-EOF
   for _ld_tmp in "-lxvidcore $_ld_lm" "-lxvidcore $_ld_lm $_ld_pthread" ; do
-    cc_check $_ld_tmp && extra_ldflags="$extra_ldflags $_ld_tmp" && _xvid=yes && break
+    function_check xvid.h 'xvid_global(0, 0, 0, 0)' $_ld_tmp &&
+      extra_ldflags="$extra_ldflags $_ld_tmp" && _xvid=yes && break
   done
 fi
 
@@ -7588,16 +7469,8 @@ if test "$_mp3lame" = yes ; then
   def_mp3lame="#define CONFIG_MP3LAME 1"
   _ld_mp3lame=-lmp3lame
   libs_mencoder="$libs_mencoder $_ld_mp3lame"
-  cat > $TMPC << EOF
-#include <lame/lame.h>
-int main(void) { lame_set_preset(NULL, STANDARD_FAST); return 0; }
-EOF
-  cc_check $_ld_mp3lame $_ld_lm && def_mp3lame_preset="#define CONFIG_MP3LAME_PRESET 1"
-  cat > $TMPC << EOF
-#include <lame/lame.h>
-int main(void) { lame_set_preset(NULL, MEDIUM_FAST); return 0; }
-EOF
-  cc_check $_ld_mp3lame $_ld_lm && def_mp3lame_preset_medium="#define CONFIG_MP3LAME_PRESET_MEDIUM 1"
+  function_check lame/lame.h 'lame_set_preset(NULL, STANDARD_FAST)' $_ld_mp3lame $_ld_lm && def_mp3lame_preset="#define CONFIG_MP3LAME_PRESET 1"
+  function_check lame/lame.h 'lame_set_preset(NULL,   MEDIUM_FAST)' $_ld_mp3lame $_ld_lm && def_mp3lame_preset_medium="#define CONFIG_MP3LAME_PRESET_MEDIUM 1"
   test "$_mp3lame_lavc" = auto && _mp3lame_lavc=yes
   if test "$_mp3lame_lavc" = yes ; then
     def_mp3lame_lavc="#define CONFIG_LIBMP3LAME 1"
@@ -8214,11 +8087,7 @@ if arm; then
 echocheck "maemo (Nokia 770|8x0)"
 if test "$_maemo" = auto ; then
   _maemo=no
-  cat > $TMPC << EOF
-#include <libosso.h>
-int main(void) { osso_initialize("", "", 0, NULL); return 0; }
-EOF
-  cc_check $($_pkg_config --cflags --libs libosso 2>/dev/null) && _maemo=yes
+  function_check libosso.h 'osso_initialize('', '', 0, NULL)' $($_pkg_config --cflags --libs libosso 2>/dev/null) && _maemo=yes
 fi
 if test "$_maemo" = yes ; then
   def_maemo='#define CONFIG_MAEMO 1'


More information about the MPlayer-cvslog mailing list