From 19484c7ec5c8a9adec9620bdc996e974bc02cc49 Mon Sep 17 00:00:00 2001 From: diego Date: Thu, 24 Jun 2010 08:03:41 +0000 Subject: [PATCH] configure: Replace manual header checks by header_check function git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31545 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix arpa/inet.h configure check. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31563 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 188 +++++++++++------------------------------------------- 1 file changed, 36 insertions(+), 152 deletions(-) diff --git a/configure b/configure index 6652ccb5cc..ea5f0c3d3d 100755 --- a/configure +++ b/configure @@ -2601,11 +2601,7 @@ EOF if $(cc_check -maltivec -mabi=altivec) ; then _altivec_gcc_flags="-maltivec -mabi=altivec" # check if should be included - cat > $TMPC << EOF -#include -int main(void) { return 0; } -EOF - if $(cc_check $_altivec_gcc_flags) ; then + if $(header_check altivec.h $_altivec_gcc_flags) ; then def_altivec_h='#define HAVE_ALTIVEC_H 1' inc_altivec_h='#include ' else @@ -3040,11 +3036,8 @@ fi echocheck "arpa/inet.h" arpa_inet_h=no def_arpa_inet_h='#define HAVE_ARPA_INET_H 0' -cat > $TMPC << EOF -#include -int main(void) { return 0; } -EOF -cc_check && arpa_inet_h=yes && def_arpa_inet_h='#define HAVE_ARPA_INET_H 1' +header_check arpa/inet.h && arpa_inet_h=yes && + def_arpa_inet_h='#define HAVE_ARPA_INET_H 1' echores "$arpa_inet_h" @@ -3180,21 +3173,13 @@ echores "$_gethostbyname2" echocheck "inttypes.h (required)" -cat > $TMPC << EOF -#include -int main(void) { return 0; } -EOF _inttypes=no -cc_check && _inttypes=yes +header_check inttypes.h && _inttypes=yes echores "$_inttypes" if test "$_inttypes" = no ; then - echocheck "bitypes.h (inttypes.h predecessor)" - cat > $TMPC << EOF -#include -int main(void) { return 0; } -EOF - cc_check && _inttypes=yes + echocheck "sys/bitypes.h (inttypes.h predecessor)" + header_check sys/bitypes.h && _inttypes=yes if test "$_inttypes" = yes ; then die "You don't have inttypes.h, but sys/bitypes.h is present. Please copy etc/inttypes.h into the include path, and re-run configure." else @@ -3227,12 +3212,8 @@ echores "$_fast_inttypes" echocheck "malloc.h" -cat > $TMPC << EOF -#include -int main(void) { (void) malloc(0); return 0; } -EOF _malloc=no -cc_check && _malloc=yes +header_check malloc.h && _malloc=yes if test "$_malloc" = yes ; then def_malloc_h='#define HAVE_MALLOC_H 1' else @@ -3474,11 +3455,8 @@ _soundcard_h=no def_soundcard_h='#undef HAVE_SOUNDCARD_H' def_sys_soundcard_h='#undef HAVE_SYS_SOUNDCARD_H' for _soundcard_header in "sys/soundcard.h" "soundcard.h"; do - cat > $TMPC << EOF -#include <$_soundcard_header> -int main(void) { return 0; } -EOF - cc_check && _soundcard_h=yes && res_comment="$_soundcard_header" && break + header_check $_soundcard_header && _soundcard_h=yes && + res_comment="$_soundcard_header" && break done if test "$_soundcard_h" = yes ; then @@ -3492,12 +3470,8 @@ echores "$_soundcard_h" echocheck "sys/dvdio.h" -cat > $TMPC << EOF -#include -int main(void) { return 0; } -EOF _dvdio=no -cc_check && _dvdio=yes +header_check sys/dvdio.h && _dvdio=yes if test "$_dvdio" = yes ; then def_dvdio='#define DVD_STRUCT_IN_SYS_DVDIO_H 1' else @@ -3507,12 +3481,8 @@ echores "$_dvdio" echocheck "sys/cdio.h" -cat > $TMPC << EOF -#include -int main(void) { return 0; } -EOF _cdio=no -cc_check && _cdio=yes +header_check sys/cdio.h && _cdio=yes if test "$_cdio" = yes ; then def_cdio='#define DVD_STRUCT_IN_SYS_CDIO_H 1' else @@ -3522,12 +3492,8 @@ echores "$_cdio" echocheck "linux/cdrom.h" -cat > $TMPC << EOF -#include -int main(void) { return 0; } -EOF _cdrom=no -cc_check && _cdrom=yes +header_check linux/cdrom.h && _cdrom=yes if test "$_cdrom" = yes ; then def_cdrom='#define DVD_STRUCT_IN_LINUX_CDROM_H 1' else @@ -3537,12 +3503,8 @@ echores "$_cdrom" echocheck "dvd.h" -cat > $TMPC << EOF -#include -int main(void) { return 0; } -EOF _dvd=no -cc_check && _dvd=yes +header_check dvd.h && _dvd=yes if test "$_dvd" = yes ; then def_dvd='#define DVD_STRUCT_IN_DVD_H 1' else @@ -3553,12 +3515,8 @@ echores "$_dvd" if bsdos; then echocheck "BSDI dvd.h" -cat > $TMPC << EOF -#include -int main(void) { return 0; } -EOF _bsdi_dvd=no -cc_check && _bsdi_dvd=yes +header_check dvd.h && _bsdi_dvd=yes if test "$_bsdi_dvd" = yes ; then def_bsdi_dvd='#define DVD_STRUCT_IN_BSDI_DVDIOCTL_DVD_H 1' else @@ -3571,12 +3529,8 @@ fi #if bsdos if hpux; then # also used by AIX, but AIX does not support VCD and/or libdvdread echocheck "HP-UX SCSI header" -cat > $TMPC << EOF -#include -int main(void) { return 0; } -EOF _hpux_scsi_h=no -cc_check && _hpux_scsi_h=yes +header_check sys/scsi.h && _hpux_scsi_h=yes if test "$_hpux_scsi_h" = yes ; then def_hpux_scsi_h='#define HPUX_SCTL_IO 1' else @@ -3588,13 +3542,9 @@ fi #if hpux if sunos; then echocheck "userspace SCSI headers (Solaris)" -cat > $TMPC << EOF -#include -#include -int main(void) { return 0; } -EOF _sol_scsi_h=no -cc_check && _sol_scsi_h=yes +header_check sys/scsi/scsi_types.h && header_check sys/scsi/impl/uscsi.h && + _sol_scsi_h=yes if test "$_sol_scsi_h" = yes ; then def_sol_scsi_h='#define SOLARIS_USCSI 1' else @@ -3633,11 +3583,8 @@ def_termios_sys_h='#undef HAVE_SYS_TERMIOS_H' if test "$_termios" = auto ; then _termios=no for _termios_header in "termios.h" "sys/termios.h"; do - cat > $TMPC < -int main(void) { return 0; } -EOF - cc_check && _termios=yes && res_comment="using $_termios_header" && break + header_check $_termios_header && _termios=yes && + res_comment="using $_termios_header" && break done fi @@ -4650,12 +4597,8 @@ echores "$_caca" echocheck "SVGAlib" if test "$_svga" = auto ; then - cat > $TMPC << EOF -#include -int main(void) { return 0; } -EOF _svga=no - cc_check -lvga $_ld_lm && _svga=yes + header_check vga.h -lvga $_ld_lm && _svga=yes fi if test "$_svga" = yes ; then def_svga='#define CONFIG_SVGALIB 1' @@ -5263,12 +5206,8 @@ fi #if win32; then echocheck "DXR2" if test "$_dxr2" = auto; then _dxr2=no - cat > $TMPC << EOF -#include -int main(void) { return 0; } -EOF for _inc_tmp in "" -I/usr/local/include/dxr2 -I/usr/include/dxr2; do - cc_check $_inc_tmp && _dxr2=yes && \ + header_check dxr2ioctl.h $_inc_tmp && _dxr2=yes && extra_cflags="$extra_cflags $_inc_tmp" && break done fi @@ -5285,12 +5224,8 @@ echores "$_dxr2" echocheck "DXR3/H+" if test "$_dxr3" = auto ; then - cat > $TMPC << EOF -#include -int main(void) { return 0; } -EOF _dxr3=no - cc_check && _dxr3=yes + header_check linux/em8300.h && _dxr3=yes fi if test "$_dxr3" = yes ; then def_dxr3='#define CONFIG_DXR3 1' @@ -5426,13 +5361,8 @@ echocheck "aRts" if test "$_arts" = auto ; then _arts=no if ( artsc-config --version ) >> "$TMPLOG" 2>&1 ; then - -cat > $TMPC << EOF -#include -int main(void) { return 0; } -EOF -cc_check $(artsc-config --libs) $(artsc-config --cflags) && _arts=yes - + header_check artsc.h $(artsc-config --libs) $(artsc-config --cflags) && + _arts=yes fi fi @@ -5484,12 +5414,8 @@ fi echocheck "NAS" if test "$_nas" = auto ; then - cat > $TMPC << EOF -#include