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)
......@@ -177,7 +234,7 @@ Your system doesn't seem to have support for dynamic linking. You may
have problems using libdvdcss.
------------
"
fi
fi
fi
dnl End of the bizarre compilation tests
......@@ -250,7 +307,7 @@ ALTIVEC_MODULES="idctaltivec motionaltivec"
AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
[ac_cv_mmx_inline],
[AC_TRY_COMPILE(,[void quux(){void *p;asm("packuswb %%mm1,%%mm2"::"r"(p));}],
ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
if test x"$ac_cv_mmx_inline" != x"no"; then
ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
fi
......@@ -258,7 +315,7 @@ fi
AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
[ac_cv_mmxext_inline],
[AC_TRY_COMPILE(,[void quux(){void *p;asm("maskmovq %%mm1,%%mm2"::"r"(p));}],
ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
if test x"$ac_cv_mmxext_inline" != x"no"; then
ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
fi
......@@ -266,7 +323,7 @@ fi
AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
[ac_cv_3dnow_inline],
[AC_TRY_COMPILE(,[void quux(){void *p;asm("pfadd %%mm1,%%mm2"::"r"(p));}],
ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
if test x"$ac_cv_3dnow_inline" != x"no"; then
ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
fi
......@@ -274,7 +331,7 @@ fi
AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
[ac_cv_sse_inline],
[AC_TRY_COMPILE(,[void quux(){void *p;asm("xorps %%xmm1,%%xmm2"::"r"(p));}],
ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
if test x"$ac_cv_sse_inline" != x"no"; then
ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
fi
......@@ -287,7 +344,7 @@ AC_CACHE_CHECK([if \$CC groks Altivec inline assembly],
CFLAGS="$CFLAGS -Wa,-m7400"
AC_TRY_COMPILE(,[void quux(){asm("mtspr 256,%0"::"r"(-1));}],
[ac_cv_altivec_inline=yes; CFLAGS_ALTIVEC="-Wa,-m7400"],
ac_cv_altivec_inline=no)
ac_cv_altivec_inline=no)
CFLAGS=$save_CFLAGS
])])
if test x"$ac_cv_altivec_inline" != x"no"; then
......@@ -804,8 +861,8 @@ AC_ARG_WITH(directx,
INCLUDE="${INCLUDE} -I"$withval"/include"
else
AC_CHECK_HEADERS(directx.h, ,
AC_MSG_ERROR([Cannot find DirectX headers !])
)
AC_MSG_ERROR([Cannot find DirectX headers !])
)
LIB_DIRECTX="${LIB_DIRECTX} -L/usr/lib -lgdi32 -ldxguid"
fi
fi ])
......
/* 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