Commit 19868f14 authored by Sam Hocevar's avatar Sam Hocevar

* Added an endianness check for cross-compilations.

  * We now check for sys/times.h.
parent f46ba5d4
This diff is collapsed.
......@@ -33,11 +33,68 @@ AC_PROG_RANLIB
dnl AM_PROG_LIBTOOL
AC_PROG_INSTALL
dnl Check for endianness
dnl if we cross compile for win32, we don't need to test it.
dnl quick and udly hack. Gonna search the way to do it better.
if eval "test $CC = gcc"; then
AC_C_BIGENDIAN
dnl
dnl Endianness check, with a special test for cross-compilation
dnl
if test x${cross_compiling} != xyes; then
AC_C_BIGENDIAN
else
dnl We are crosscompiling, give the user the opportunity to specify
dnl --with-words=big or --with-words=little ; otherwise, try to guess
AC_ARG_WITH(words,
[ --with-words=endianness Set endianness (big or little)])
case "x$withval" in
xbig)
ac_cv_c_bigendian=yes
;;
xlittle)
ac_cv_c_bigendian=no
;;
*)
dnl Try to guess endianness by matching patterns on a compiled
dnl binary, by looking for an ASCII or EBCDIC string
ac_cv_c_bigendian=unknown
AC_MSG_CHECKING(what the byte order looks to be)[
cat >conftest.c <<EOF
short am[] = { 0x4249, 0x4765, 0x6e44, 0x6961, 0x6e53, 0x7953, 0 };
short ai[] = { 0x694c, 0x5454, 0x656c, 0x6e45, 0x6944, 0x6e61, 0 };
void _a(void) { char*s = (char*)am; s = (char *)ai; }
short ei[] = { 0x89D3, 0xe3e3, 0x8593, 0x95c5, 0x89c4, 0x9581, 0 };
short em[] = { 0xc2c9, 0xc785, 0x95c4, 0x8981, 0x95e2, 0xa8e2, 0 };
void _e(void) { char*s = (char*)em; s = (char*)ei; }
int main(void) { _a(); _e(); return 0; }
EOF
]
if test -f conftest.c
then
if ${CC-cc} conftest.c -o conftest.o >config.log 2>&1 \
&& test -f conftest.o
then
if test `grep -l BIGenDianSyS conftest.o`
then
AC_MSG_RESULT("big endian")
ac_cv_c_bigendian=yes
fi
if test `grep -l LiTTleEnDian conftest.o`
then
AC_MSG_RESULT("little endian")
ac_cv_c_bigendian=no
fi
fi
fi
if test $ac_cv_c_bigendian = xunknown
then
AC_MSG_ERROR([Could not guess endianness, please use --with-words])
fi
dnl Now we know what to use for endianness, just put it in the header
if test $ac_cv_c_bigendian = yes
then
cat >> confdefs.h <<\EOF
#define WORDS_BIGENDIAN 1
EOF
fi
;;
esac
fi
dnl Check for system libs needed
......@@ -106,7 +163,7 @@ AC_EGREP_HEADER(strncasecmp,strings.h,[
dnl Check for headers
AC_CHECK_HEADERS(stddef.h getopt.h strings.h)
AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/time.h)
AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/time.h sys/times.h)
AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h)
AC_CHECK_HEADERS(dlfcn.h image.h)
AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h)
......
/* include/defs.h.in. Generated automatically from configure.in by autoheader. */
/* include/defs.h.in. Generated automatically from configure.in by autoheader 2.13. */
/* Define to empty if the keyword does not work. */
#undef const
......@@ -160,6 +160,9 @@
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define if you have the <sys/times.h> header file. */
#undef HAVE_SYS_TIMES_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
......
......@@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.139 2001/10/03 12:58:57 massiot Exp $
* $Id: input.c,v 1.140 2001/10/03 13:14:05 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -57,8 +57,8 @@
# include <sys/socket.h>
#endif
#ifndef WIN32
#include <sys/times.h>
#ifdef HAVE_SYS_TIMES_H
# include <sys/times.h>
#endif
#include "config.h"
......@@ -498,17 +498,19 @@ static void EndThread( input_thread_t * p_input )
if( p_main->b_stats )
{
#ifdef HAVE_SYS_TIMES_H
/* Display statistics */
#ifndef WIN32
struct tms cpu_usage;
times( &cpu_usage );
intf_StatMsg( "input stats: %d loops consuming user: %d, system: %d",
p_input->c_loops,
cpu_usage.tms_utime, cpu_usage.tms_stime );
#else
intf_StatMsg( "input stats: %d loops", p_input->c_loops );
#endif
input_DumpStream( p_input );
#endif
}
/* Free all ES and destroy all decoder threads */
......
......@@ -2,7 +2,7 @@
* video_parser.c : video parser thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_parser.c,v 1.7 2001/10/03 03:32:05 xav Exp $
* $Id: video_parser.c,v 1.8 2001/10/03 13:14:05 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -36,8 +36,8 @@
#include <errno.h>
#include <string.h>
#ifndef WIN32
#include <sys/times.h>
#ifdef HAVE_SYS_TIMES_H
# include <sys/times.h>
#endif
#include "config.h"
......@@ -318,15 +318,18 @@ static void EndThread( vpar_thread_t *p_vpar )
if( p_main->b_stats )
{
#ifndef WIN32
#ifdef HAVE_SYS_TIMES_H
struct tms cpu_usage;
times( &cpu_usage );
#endif
intf_StatMsg( "vpar stats: %d loops among %d sequence(s)",
p_vpar->c_loops, p_vpar->c_sequences );
#ifdef HAVE_SYS_TIMES_H
intf_StatMsg( "vpar stats: cpu usage (user: %d, system: %d)",
cpu_usage.tms_utime, cpu_usage.tms_stime );
#endif
intf_StatMsg( "vpar stats: Read %d frames/fields (I %d/P %d/B %d)",
p_vpar->pc_pictures[I_CODING_TYPE]
......@@ -359,7 +362,6 @@ static void EndThread( vpar_thread_t *p_vpar )
S.i_scalable_mode ? "scalable" : "non-scalable",
S.i_matrix_coefficients );
#undef S
#endif
}
/* Dispose of matrices if they have been allocated. */
......
......@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: video_output.c,v 1.142 2001/10/03 03:32:05 xav Exp $
* $Id: video_output.c,v 1.143 2001/10/03 13:14:05 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -34,8 +34,8 @@
#include <stdio.h> /* sprintf() */
#include <string.h> /* strerror() */
#ifndef WIN32
#include <sys/times.h>
#ifdef HAVE_SYS_TIMES_H
# include <sys/times.h>
#endif
#include "config.h"
......@@ -1360,17 +1360,20 @@ static void EndThread( vout_thread_t *p_vout )
if( p_main->b_stats )
{
#ifndef WIN32
#ifdef HAVE_SYS_TIMES_H
struct tms cpu_usage;
times( &cpu_usage );
intf_StatMsg( "vout info: %d loops consuming user: %d, system: %d",
p_vout->c_loops, cpu_usage.tms_utime, cpu_usage.tms_stime );
#else
intf_StatMsg( "vout info: %d loops", p_vout->c_loops );
#endif
intf_StatMsg( "vout info: %d pictures received, discarded %d",
p_vout->c_pictures, p_vout->c_late_pictures );
intf_StatMsg( "vout info: average display jitter of %lld s",
p_vout->display_jitter );
#endif
}
/* Destroy all remaining pictures and subpictures */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment