[lcd4linux @ 2001-03-02 20:18:12 by reinelt]

allow compile on systems without net/if_ppp.h

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@97 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
This commit is contained in:
reinelt
2001-03-02 20:18:12 +00:00
parent 78d14698bd
commit 4f3c19b6c5
3 changed files with 89 additions and 36 deletions
Vendored
+70 -30
View File
@@ -2577,14 +2577,54 @@ else
fi
done
for ac_hdr in net/if_ppp.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:2585: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2590 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2595: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
else
echo "$ac_t""no" 1>&6
fi
done
echo $ac_n "checking for working const""... $ac_c" 1>&6
echo "configure:2583: checking for working const" >&5
echo "configure:2623: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2588 "configure"
#line 2628 "configure"
#include "confdefs.h"
int main() {
@@ -2633,7 +2673,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
if { (eval echo configure:2637: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2677: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -2654,21 +2694,21 @@ EOF
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
echo "configure:2658: checking for inline" >&5
echo "configure:2698: checking for inline" >&5
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
#line 2665 "configure"
#line 2705 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
if { (eval echo configure:2672: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2712: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@@ -2694,12 +2734,12 @@ EOF
esac
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
echo "configure:2698: checking for pid_t" >&5
echo "configure:2738: checking for pid_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2703 "configure"
#line 2743 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2727,12 +2767,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
echo "configure:2731: checking for size_t" >&5
echo "configure:2771: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2736 "configure"
#line 2776 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2760,12 +2800,12 @@ EOF
fi
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
echo "configure:2764: checking whether time.h and sys/time.h may both be included" >&5
echo "configure:2804: checking whether time.h and sys/time.h may both be included" >&5
if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2769 "configure"
#line 2809 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
@@ -2774,7 +2814,7 @@ int main() {
struct tm *tp;
; return 0; }
EOF
if { (eval echo configure:2778: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2818: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_time=yes
else
@@ -2795,12 +2835,12 @@ EOF
fi
echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
echo "configure:2799: checking whether struct tm is in sys/time.h or time.h" >&5
echo "configure:2839: checking whether struct tm is in sys/time.h or time.h" >&5
if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2804 "configure"
#line 2844 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <time.h>
@@ -2808,7 +2848,7 @@ int main() {
struct tm *tp; tp->tm_sec;
; return 0; }
EOF
if { (eval echo configure:2812: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2852: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm=time.h
else
@@ -2829,12 +2869,12 @@ EOF
fi
echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
echo "configure:2833: checking for uid_t in sys/types.h" >&5
echo "configure:2873: checking for uid_t in sys/types.h" >&5
if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2838 "configure"
#line 2878 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
@@ -2865,13 +2905,13 @@ fi
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
echo "configure:2869: checking whether ${CC-cc} needs -traditional" >&5
echo "configure:2909: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
#line 2875 "configure"
#line 2915 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@@ -2889,7 +2929,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
#line 2893 "configure"
#line 2933 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@@ -2911,7 +2951,7 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
fi
echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
echo "configure:2915: checking for 8-bit clean memcmp" >&5
echo "configure:2955: checking for 8-bit clean memcmp" >&5
if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2919,7 +2959,7 @@ else
ac_cv_func_memcmp_clean=no
else
cat > conftest.$ac_ext <<EOF
#line 2923 "configure"
#line 2963 "configure"
#include "confdefs.h"
main()
@@ -2929,7 +2969,7 @@ main()
}
EOF
if { (eval echo configure:2933: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:2973: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_memcmp_clean=yes
else
@@ -2947,12 +2987,12 @@ echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
echo "configure:2951: checking return type of signal handlers" >&5
echo "configure:2991: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2956 "configure"
#line 2996 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -2969,7 +3009,7 @@ int main() {
int i;
; return 0; }
EOF
if { (eval echo configure:2973: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:3013: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@@ -2990,12 +3030,12 @@ EOF
for ac_func in gettimeofday select socket strdup strerror strstr strtol uname
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:2994: checking for $ac_func" >&5
echo "configure:3034: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2999 "configure"
#line 3039 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3018,7 +3058,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:3022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3062: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
+1
View File
@@ -92,6 +92,7 @@ AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h limits.h strings.h sys/ioctl.h sys/time.h syslog.h unistd.h)
AC_CHECK_HEADERS(sys/io.h asm/io.h)
AC_CHECK_HEADERS(gd/gd.h gd.h)
AC_CHECK_HEADERS(net/if_ppp.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
+18 -6
View File
@@ -1,4 +1,4 @@
/* $Id: system.c,v 1.19 2001/02/16 08:23:09 reinelt Exp $
/* $Id: system.c,v 1.20 2001/03/02 20:18:12 reinelt Exp $
*
* system status retreivement
*
@@ -20,6 +20,10 @@
*
*
* $Log: system.c,v $
* Revision 1.20 2001/03/02 20:18:12 reinelt
*
* allow compile on systems without net/if_ppp.h
*
* Revision 1.19 2001/02/16 08:23:09 reinelt
*
* new token 'ic' (ISDN connected) by Carsten Nau <info@cnau.de>
@@ -177,7 +181,12 @@
#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#ifdef HAVE_NET_IF_PPP_H
#include <net/if_ppp.h>
#else
#warning if_ppp.h not found. PPP support deactivated.
#endif
#include "debug.h"
#include "cfg.h"
@@ -667,14 +676,17 @@ int Net (int *rx, int *tx, int *bytes)
int PPP (int unit, int *rx, int *tx)
{
static int fd=-2;
struct ifpppstatsreq req;
char buffer[16];
static double junk=0;
#ifdef HAVE_NET_IF_PPP_H
struct ifpppstatsreq req;
#endif
*rx=0;
*tx=0;
#ifdef HAVE_NET_IF_PPP_H
if (fd==-1) return -1;
if (fd==-2) {
@@ -697,8 +709,8 @@ int PPP (int unit, int *rx, int *tx)
*rx=smooth(buffer, 500, req.stats.p.ppp_ibytes);
snprintf (buffer, sizeof(buffer), "ppp%d_tx", unit);
*tx=smooth(buffer, 500, req.stats.p.ppp_obytes);
debug ("ppp_tx=%f smooth=%f", (double)(req.stats.p.ppp_obytes-junk), (double)*tx);
junk=req.stats.p.ppp_obytes;
#endif
return 0;
}