Changeset 135

Show
Ignore:
Timestamp:
20/09/06 13:56:27 (2 years ago)
Author:
sam
Message:
  • Update bootstrap file.
  • Check for gettimeofday() in configure.ac.
  • Fix decode_mpeg.c so that it builds on Win32.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/bootstrap

    r90 r135  
    11#! /bin/sh 
    22 
    3 ##  generic bootstrap file for libraries -- Sam Hocevar <sam@zoy.org> 
    4 ##  $Id$ 
     3# bootstrap: the ultimate bootstrap/autogen.sh script for autotools projects 
     4# Copyright (c) 2002, 2003, 2004, 2005, 2006 Sam Hocevar <sam@zoy.org> 
     5
     6#    This program is free software; you can redistribute it and/or 
     7#    modify it under the terms of the Do What The Fuck You Want To 
     8#    Public License, Version 2, as published by Sam Hocevar. See 
     9#    http://sam.zoy.org/wtfpl/COPYING for more details. 
     10
     11# The latest version of this script can be found at the following place: 
     12#   http://sam.zoy.org/autotools/ 
    513 
    6 set -x 
     14# Die if an error occurs 
    715set -e 
    816 
    9 # Get a sane environment, just in case 
    10 LANG=C 
    11 export LANG 
    12 CYGWIN=binmode 
    13 export CYGWIN 
     17# Guess whether we are using configure.ac or configure.in 
     18if test -f configure.ac; then 
     19  conffile="configure.ac" 
     20elif test -f configure.in; then 
     21  conffile="configure.in" 
     22else 
     23  echo "$0: could not find configure.ac or configure.in" 
     24  exit 1 
     25fi 
     26 
     27# Check for needed features 
     28auxdir="`sed -ne 's/^[ \t]*A._CONFIG_AUX_DIR *( *\([^ )]*\).*/\1/p' $conffile`" 
     29libtool="`grep -q '^[ \t]*A._PROG_LIBTOOL' $conffile && echo yes || echo no`" 
     30header="`grep -q '^[ \t]*A._CONFIG_HEADER' $conffile && echo yes || echo no`" 
     31aclocalflags="`sed -ne 's/^[ \t]*ACLOCAL_AMFLAGS[ \t]*=//p' Makefile.am`" 
    1432 
    1533# Check for automake 
    1634amvers="no" 
    17 if automake-1.8 --version >/dev/null 2>&1; then 
    18   amvers="-1.8" 
    19 elif automake-1.7 --version >/dev/null 2>&1; then 
    20   amvers="-1.7" 
    21 elif automake-1.6 --version >/dev/null 2>&1; then 
    22   amvers="-1.6" 
    23 elif automake-1.5 --version >/dev/null 2>&1; then 
    24   amvers="-1.5" 
    25 elif automake --version > /dev/null 2>&1; then 
     35for v in "-1.9" "19" "-1.8" "18" "-1.7" "17" "-1.6" "16" "-1.5" "15"; do 
     36  if automake${v} --version >/dev/null 2>&1; then 
     37    amvers="${v}" 
     38    break 
     39  fi 
     40done 
     41 
     42if test "${amvers}" = "no" && automake --version > /dev/null 2>&1; then 
    2643  amvers="`automake --version | sed -e '1s/[^0-9]*//' -e q`" 
    2744  if expr "$amvers" "<" "1.5" > /dev/null 2>&1; then 
     
    3350 
    3451if test "$amvers" = "no"; then 
    35   set +x 
    3652  echo "$0: you need automake version 1.5 or later" 
    3753  exit 1 
    3854fi 
    3955 
    40 # Check for libtool 
    41 libtoolize="no" 
    42 if glibtoolize --version >/dev/null 2>&1; then 
    43   libtoolize="glibtoolize" 
    44 elif libtoolize --version >/dev/null 2>&1; then 
    45   libtoolize="libtoolize" 
    46 fi 
     56# Check for autoconf 
     57acvers="no" 
     58for v in "" "259" "253"; do 
     59  if autoconf${v} --version >/dev/null 2>&1; then 
     60    acvers="${v}" 
     61    break 
     62  fi 
     63done 
    4764 
    48 if test "$libtoolize" = "no"; then 
    49   set +x 
    50   echo "$0: you need libtool" 
     65if test "$acvers" = "no"; then 
     66  echo "$0: you need autoconf" 
    5167  exit 1 
    5268fi 
    5369 
    54 # Remove old cruft 
    55 rm -f aclocal.m4 configure config.guess config.log config.sub config.cache config.h.in config.h compile ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh 
    56 rm -Rf autom4te.cache 
    57 (cd autotools && rm -f config.guess config.sub missing mkinstalldirs compile ltmain.sh depcomp install-sh) 
     70# Check for libtool 
     71if test "$libtool" = "yes"; then 
     72  libtoolize="no" 
     73  if glibtoolize --version >/dev/null 2>&1; then 
     74    libtoolize="glibtoolize" 
     75  else 
     76    for v in "16" "15" "" "14"; do 
     77      if libtoolize${v} --version >/dev/null 2>&1; then 
     78        libtoolize="libtoolize${v}" 
     79        break 
     80      fi 
     81    done 
     82  fi 
    5883 
    59 ${libtoolize} --copy --force 
    60 if test -f "ltmain.sh"; then 
    61   echo "$0: working around a minor libtool issue" 
    62   mv ltmain.sh autotools/ 
     84  if test "$libtoolize" = "no"; then 
     85    echo "$0: you need libtool" 
     86    exit 1 
     87  fi 
    6388fi 
    6489 
    65 aclocal${amvers} 
    66 autoconf 
    67 autoheader 
    68 automake${amvers} --add-missing --copy 
     90# Remove old cruft 
     91for x in aclocal.m4 configure config.guess config.log config.sub config.cache config.h.in config.h compile libtool.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh; do rm -f $x autotools/$x; if test -n "$auxdir"; then rm -f "$auxdir/$x"; fi; done 
     92rm -Rf autom4te.cache 
     93if test -n "$auxdir"; then 
     94  if test ! -d "$auxdir"; then 
     95    mkdir "$auxdir" 
     96  fi 
     97  aclocalflags="${aclocalflags} -I $auxdir" 
     98fi 
    6999 
     100# Explain what we are doing from now 
     101set -x 
     102 
     103# Bootstrap package 
     104if test "$libtool" = "yes"; then 
     105  ${libtoolize} --copy --force 
     106  if test -n "$auxdir" -a ! "$auxdir" = "." -a -f "ltmain.sh"; then 
     107    echo "$0: working around a minor libtool issue" 
     108    mv ltmain.sh "$auxdir/" 
     109  fi 
     110fi 
     111 
     112aclocal${amvers} ${aclocalflags} 
     113autoconf${acvers} 
     114if test "$header" = "yes"; then 
     115  autoheader${acvers} 
     116fi 
     117#add --include-deps if you want to bootstrap with any other compiler than gcc 
     118#automake${amvers} --add-missing --copy --include-deps 
     119automake${amvers} --foreign --add-missing --copy 
     120 
     121# Remove cruft that we no longer want 
     122rm -Rf autom4te.cache 
     123 
  • trunk/configure.ac

    r121 r135  
    5757dnl Check for headers 
    5858AC_CHECK_HEADERS(stdint.h inttypes.h) 
     59AC_CHECK_FUNCS(gettimeofday) 
    5960 
    6061AC_CHECK_HEADERS(sys/socket.h, [ac_have_sys_socket_h=yes]) 
  • trunk/examples/decode_mpeg.c

    r134 r135  
    422422    int      i_port = 0; 
    423423    char   * ipaddress = NULL; 
     424#endif 
     425#ifdef HAVE_GETTIMEOFDAY 
    424426    time_t   time_prev = 0; 
     427#endif 
     428    mtime_t  i_prev_pcr = 0;  /* 33 bits */ 
    425429    int      i_old_cc = -1;  
    426     mtime_t  i_prev_pcr = 0;  /* 33 bits */ 
    427 #endif 
    428430    uint32_t i_bytes = 0; /* bytes transmitted between PCR's */ 
    429431    char *filename = NULL; 
     
    582584 
    583585                    printf( "%.2d, PCRpid(%d), ", i_cc, i_pid ); 
     586#ifdef HAVE_GETTIMEOFDAY 
    584587                    if( b_verbose ) 
    585588                    { 
     
    599602                        time_prev = time_current; 
    600603                    } 
     604#endif 
    601605                    if( i_delta <= 0 ) 
    602606                        printf( "value %lld, previous %lld, delta %lld, bytes %u, ", 
     
    630634                    { 
    631635                        mtime_t i_delta; 
     636#ifdef HAVE_GETTIMEOFDAY 
    632637                        struct timeval tv; 
     638#endif 
    633639 
    634640                        i_delta = (long long int)p_stream->pid[i_pid].i_pcr - (long long int)i_prev_pcr; 
     
    643649                        printf( "\n" ); 
    644650 
     651#ifdef HAVE_GETTIMEOFDAY 
    645652                        /* Initialize the arrival time */ 
    646653                        gettimeofday( &tv, NULL ); 
    647654                        time_prev = (tv.tv_sec*1000) + (tv.tv_usec/1000); 
    648655                        i_bytes = 0; 
     656#endif 
    649657                    } 
    650658                    if( b_discontinuity_seen )