From 6ae60a46a83b070e7ed257e07a3bbd14db18dea7 Mon Sep 17 00:00:00 2001 From: reinelt Date: Sat, 19 Jul 2003 09:42:42 +0000 Subject: [lcd4linux @ 2003-07-19 09:42:42 by reinelt] check for dvb/frontend.h and disable DVB client if not found. git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@198 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- config.h.in | 3 ++ configure | 149 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- configure.in | 1 + dvb.c | 31 +++++++++++-- 4 files changed, 177 insertions(+), 7 deletions(-) diff --git a/config.h.in b/config.h.in index e4c2412..3cc16c9 100644 --- a/config.h.in +++ b/config.h.in @@ -39,6 +39,9 @@ /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_DVB_FRONTEND_H + /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_PARPORT_H diff --git a/configure b/configure index 5a21ab8..a587d24 100755 --- a/configure +++ b/configure @@ -2359,8 +2359,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ - ''\ - '#include ' \ + '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ @@ -2374,8 +2373,8 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include $ac_declaration +#include int main () { @@ -3228,7 +3227,7 @@ echo "${ECHO_T}Please note that some screen refreshs may fail" >&6 echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 ncurses_version=unknown cat > conftest.$ac_ext < @@ -5474,6 +5473,148 @@ fi done +for ac_header in linux/dvb/frontend.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------ ## +## Report this to bug-autoconf@gnu.org. ## +## ------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + for ac_header in gd/gd.h gd.h do diff --git a/configure.in b/configure.in index 8648538..0950092 100644 --- a/configure.in +++ b/configure.in @@ -236,6 +236,7 @@ AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([fcntl.h malloc.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h termios.h unistd.h]) AC_CHECK_HEADERS(sys/io.h asm/io.h) AC_CHECK_HEADERS(linux/parport.h linux/ppdev.h) +AC_CHECK_HEADERS(linux/dvb/frontend.h) AC_CHECK_HEADERS(gd/gd.h gd.h) AC_CHECK_HEADERS(net/if_ppp.h) AC_CHECK_HEADERS(asm/msr.h) diff --git a/dvb.c b/dvb.c index be01168..53bf8d7 100644 --- a/dvb.c +++ b/dvb.c @@ -41,6 +41,30 @@ #include #include #include + +#ifndef HAVE_LINUX_DVB_FRONTEND_H + +#warning linux/dvb/frontend.h not found. +#warning DVB client will be disabled. + +int DVB (double *strength, double *snr) +{ + static int flag=0; + + if (flag==0) { + error("lcd4linux has been compiled without DVB support"); + error("DVB client will be disabled"); + flag=1; + } + + *strength=0.0; + *snr=0.0; + + return 0; +} + +#else + #include #include "debug.h" @@ -79,20 +103,21 @@ int DVB (double *strength, double *snr) fd=-1; return -1; } - + if (ioctl(fd, FE_READ_SNR, &raw_snr)) { error("ioctl(FE_READ_SNR) failed: %s", strerror(errno)); fd=-1; return -1; } - + // Normalize to 1.0 strength0=raw_strength/65535.0; snr0=raw_snr/65535.0; - + *strength=strength0; *snr=snr0; return 0; } +#endif -- cgit v1.2.3