Commit 18e6f1a8 authored by Sam Hocevar's avatar Sam Hocevar

. suppression de quelques #define SYS_* (mais pas encore tous)

 . include/config.h devient include/config.h.in et config.h sera
  g�n�r� par ./configure. Le but est d'�viter les options -DFOO de gcc
 . suppression d'un 'Resources' qui trainait encore dans config.h
parent d3a8f7e2
...@@ -2650,22 +2650,102 @@ else ...@@ -2650,22 +2650,102 @@ else
fi fi
done done
for ac_hdr in dlfcn.h image.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:2658: 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 2663 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2668: \"$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
for ac_hdr in arpa/inet.h net/if.h netinet/in.h sys/socket.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:2698: 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 2703 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2708: \"$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
for ac_hdr in cthreads.h pthread.h kernel/sheduler.h kernel/OS.h for ac_hdr in cthreads.h pthread.h kernel/sheduler.h kernel/OS.h
do do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:2659: checking for $ac_hdr" >&5 echo "configure:2739: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2664 "configure" #line 2744 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <$ac_hdr> #include <$ac_hdr>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2669: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:2749: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
...@@ -2693,12 +2773,12 @@ done ...@@ -2693,12 +2773,12 @@ done
echo $ac_n "checking for working const""... $ac_c" 1>&6 echo $ac_n "checking for working const""... $ac_c" 1>&6
echo "configure:2697: checking for working const" >&5 echo "configure:2777: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2702 "configure" #line 2782 "configure"
#include "confdefs.h" #include "confdefs.h"
int main() { int main() {
...@@ -2747,7 +2827,7 @@ ccp = (char const *const *) p; ...@@ -2747,7 +2827,7 @@ ccp = (char const *const *) p;
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:2751: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:2831: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
ac_cv_c_const=yes ac_cv_c_const=yes
else else
...@@ -2768,12 +2848,12 @@ EOF ...@@ -2768,12 +2848,12 @@ EOF
fi fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
echo "configure:2772: checking for ANSI C header files" >&5 echo "configure:2852: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2777 "configure" #line 2857 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
...@@ -2781,7 +2861,7 @@ else ...@@ -2781,7 +2861,7 @@ else
#include <float.h> #include <float.h>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2785: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:2865: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
...@@ -2798,7 +2878,7 @@ rm -f conftest* ...@@ -2798,7 +2878,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI. # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2802 "configure" #line 2882 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <string.h> #include <string.h>
EOF EOF
...@@ -2816,7 +2896,7 @@ fi ...@@ -2816,7 +2896,7 @@ fi
if test $ac_cv_header_stdc = yes; then if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2820 "configure" #line 2900 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdlib.h> #include <stdlib.h>
EOF EOF
...@@ -2837,7 +2917,7 @@ if test "$cross_compiling" = yes; then ...@@ -2837,7 +2917,7 @@ if test "$cross_compiling" = yes; then
: :
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2841 "configure" #line 2921 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <ctype.h> #include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
...@@ -2848,7 +2928,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); ...@@ -2848,7 +2928,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); } exit (0); }
EOF EOF
if { (eval echo configure:2852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:2932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then then
: :
else else
...@@ -2872,12 +2952,12 @@ EOF ...@@ -2872,12 +2952,12 @@ EOF
fi fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6 echo $ac_n "checking for size_t""... $ac_c" 1>&6
echo "configure:2876: checking for size_t" >&5 echo "configure:2956: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2881 "configure" #line 2961 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/types.h> #include <sys/types.h>
#if STDC_HEADERS #if STDC_HEADERS
...@@ -2905,12 +2985,12 @@ EOF ...@@ -2905,12 +2985,12 @@ EOF
fi fi
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
echo "configure:2909: checking whether time.h and sys/time.h may both be included" >&5 echo "configure:2989: checking whether time.h and sys/time.h may both be included" >&5
if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2914 "configure" #line 2994 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h> #include <sys/time.h>
...@@ -2919,7 +2999,7 @@ int main() { ...@@ -2919,7 +2999,7 @@ int main() {
struct tm *tp; struct tm *tp;
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:2923: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:3003: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
ac_cv_header_time=yes ac_cv_header_time=yes
else else
...@@ -3041,7 +3121,7 @@ done ...@@ -3041,7 +3121,7 @@ done
ac_given_srcdir=$srcdir ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL" ac_given_INSTALL="$INSTALL"
trap 'rm -fr `echo "Makefile include/defs.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 trap 'rm -fr `echo "Makefile include/config.h include/defs.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF EOF
cat >> $CONFIG_STATUS <<EOF cat >> $CONFIG_STATUS <<EOF
...@@ -3128,7 +3208,7 @@ EOF ...@@ -3128,7 +3208,7 @@ EOF
cat >> $CONFIG_STATUS <<EOF cat >> $CONFIG_STATUS <<EOF
CONFIG_FILES=\${CONFIG_FILES-"Makefile"} CONFIG_FILES=\${CONFIG_FILES-"Makefile include/config.h"}
EOF EOF
cat >> $CONFIG_STATUS <<\EOF cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
......
...@@ -46,6 +46,8 @@ AC_SUBST(LIBOBJS) ...@@ -46,6 +46,8 @@ AC_SUBST(LIBOBJS)
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h) AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h)
AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.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)
dnl Check for threads library dnl Check for threads library
AC_CHECK_HEADERS(cthreads.h pthread.h kernel/sheduler.h kernel/OS.h) AC_CHECK_HEADERS(cthreads.h pthread.h kernel/sheduler.h kernel/OS.h)
...@@ -55,5 +57,5 @@ AC_C_CONST ...@@ -55,5 +57,5 @@ AC_C_CONST
AC_TYPE_SIZE_T AC_TYPE_SIZE_T
AC_HEADER_TIME AC_HEADER_TIME
AC_OUTPUT([Makefile]) AC_OUTPUT([Makefile include/config.h])
...@@ -41,8 +41,8 @@ ...@@ -41,8 +41,8 @@
*****************************************************************************/ *****************************************************************************/
/* Program version and copyright message */ /* Program version and copyright message */
#define COPYRIGHT_MESSAGE "VideoLAN Client - version " PROGRAM_VERSION \ #define COPYRIGHT_MESSAGE "VideoLAN Client - version " @VLC_VERSION@ \
" " PROGRAM_CODENAME " - (c)1996-2000 VideoLAN" " " @VLC_CODENAME@ " - (c)1996-2000 VideoLAN"
/***************************************************************************** /*****************************************************************************
* General compilation options * General compilation options
...@@ -289,8 +289,8 @@ ...@@ -289,8 +289,8 @@
#define VOUT_GAMMA 0. #define VOUT_GAMMA 0.
/* Default fonts */ /* Default fonts */
#define VOUT_DEFAULT_FONT "Resources/default8x9.psf" #define VOUT_DEFAULT_FONT "lib/default8x9.psf"
#define VOUT_LARGE_FONT "Resources/default8x16.psf" #define VOUT_LARGE_FONT "lib/default8x16.psf"
/* /*
* Time settings * Time settings
......
...@@ -55,12 +55,21 @@ ...@@ -55,12 +55,21 @@
/* Define if you have the usleep function. */ /* Define if you have the usleep function. */
#undef HAVE_USLEEP #undef HAVE_USLEEP
/* Define if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define if you have the <cthreads.h> header file. */ /* Define if you have the <cthreads.h> header file. */
#undef HAVE_CTHREADS_H #undef HAVE_CTHREADS_H
/* Define if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define if you have the <fcntl.h> header file. */ /* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H #undef HAVE_FCNTL_H
/* Define if you have the <image.h> header file. */
#undef HAVE_IMAGE_H
/* Define if you have the <kernel/OS.h> header file. */ /* Define if you have the <kernel/OS.h> header file. */
#undef HAVE_KERNEL_OS_H #undef HAVE_KERNEL_OS_H
...@@ -70,12 +79,21 @@ ...@@ -70,12 +79,21 @@
/* Define if you have the <machine/soundcard.h> header file. */ /* Define if you have the <machine/soundcard.h> header file. */
#undef HAVE_MACHINE_SOUNDCARD_H #undef HAVE_MACHINE_SOUNDCARD_H
/* Define if you have the <net/if.h> header file. */
#undef HAVE_NET_IF_H
/* Define if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define if you have the <pthread.h> header file. */ /* Define if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H #undef HAVE_PTHREAD_H
/* Define if you have the <sys/ioctl.h> header file. */ /* Define if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H #undef HAVE_SYS_IOCTL_H
/* Define if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define if you have the <sys/soundcard.h> header file. */ /* Define if you have the <sys/soundcard.h> header file. */
#undef HAVE_SYS_SOUNDCARD_H #undef HAVE_SYS_SOUNDCARD_H
......
...@@ -25,11 +25,14 @@ ...@@ -25,11 +25,14 @@
#if defined(HAVE_PTHREAD_H) /* pthreads (Linux & BSD for example) */ #if defined(HAVE_PTHREAD_H) /* pthreads (Linux & BSD for example) */
#include <pthread.h> #include <pthread.h>
#elif defined(HAVE_CTHREADS_H) /* GNUMach */ #elif defined(HAVE_CTHREADS_H) /* GNUMach */
#include <cthreads.h> #include <cthreads.h>
#elif defined(HAVE_KERNEL_SHEDULER_H) && defined(HAVE_KERNEL_OS_H) /* BeOS */ #elif defined(HAVE_KERNEL_SHEDULER_H) && defined(HAVE_KERNEL_OS_H) /* BeOS */
#include <kernel/OS.h> #include <kernel/OS.h>
#include <kernel/scheduler.h> #include <kernel/scheduler.h>
#else #else
#error no threads available on your system ! #error no threads available on your system !
#endif #endif
...@@ -200,11 +203,11 @@ static __inline__ void vlc_thread_join( vlc_thread_t thread ) ...@@ -200,11 +203,11 @@ static __inline__ void vlc_thread_join( vlc_thread_t thread )
static __inline__ void lazy_init_mutex(vlc_mutex_t* p_mutex) static __inline__ void lazy_init_mutex(vlc_mutex_t* p_mutex)
{ {
int32 v = atomic_or( &p_mutex->init, 1 ); int32 v = atomic_or( &p_mutex->init, 1 );
if( 2000 == v ) // we're the first, so do the init if( 2000 == v ) /* we're the first, so do the init */
{ {
vlc_mutex_init( p_mutex ); vlc_mutex_init( p_mutex );
} }
else // we're not the first, so wait until the init is finished else /* we're not the first, so wait until the init is finished */
{ {
while( p_mutex->init != 9999 ) snooze( 10000 ); while( p_mutex->init != 9999 ) snooze( 10000 );
} }
...@@ -292,11 +295,11 @@ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex ) ...@@ -292,11 +295,11 @@ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex )
static __inline__ void lazy_init_cond( vlc_cond_t* p_condvar ) static __inline__ void lazy_init_cond( vlc_cond_t* p_condvar )
{ {
int32 v = atomic_or( &p_condvar->init, 1 ); int32 v = atomic_or( &p_condvar->init, 1 );
if( 2000 == v ) // we're the first, so do the init if( 2000 == v ) /* we're the first, so do the init */
{ {
vlc_cond_init( p_condvar ); vlc_cond_init( p_condvar );
} }
else // we're not the first, so wait until the init is finished else /* we're not the first, so wait until the init is finished */
{ {
while( p_condvar->init != 9999 ) snooze( 10000 ); while( p_condvar->init != 9999 ) snooze( 10000 );
} }
......
...@@ -578,7 +578,9 @@ static void SignalHandler( int i_signal ) ...@@ -578,7 +578,9 @@ static void SignalHandler( int i_signal )
static int TestMMX( void ) static int TestMMX( void )
{ {
/* FIXME: under beos, gcc does not support the foolowing inline assembly */ /* FIXME: under beos, gcc does not support the foolowing inline assembly */
#ifndef SYS_BEOS #ifdef SYS_BEOS
return( 1 );
#else
int i_reg, i_dummy = 0; int i_reg, i_dummy = 0;
...@@ -642,8 +644,6 @@ static int TestMMX( void ) ...@@ -642,8 +644,6 @@ static int TestMMX( void )
return( 1 ); return( 1 );
#else /* SYS_BEOS */ #endif
return( 1 );
#endif /* SYS_BEOS */
} }
#endif #endif
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include <unistd.h> /* select() */ #include <unistd.h> /* select() */
#include <sys/time.h> #include <sys/time.h>
#ifdef SYS_BEOS #ifdef HAVE_KERNEL_OS_H
#include <kernel/OS.h> #include <kernel/OS.h>
#endif #endif
...@@ -70,8 +70,9 @@ char *mstrtime( char *psz_buffer, mtime_t date ) ...@@ -70,8 +70,9 @@ char *mstrtime( char *psz_buffer, mtime_t date )
*****************************************************************************/ *****************************************************************************/
mtime_t mdate( void ) mtime_t mdate( void )
{ {
#ifdef SYS_BEOS #ifdef HAVE_KERNEL_OS_H
return( real_time_clock_usecs() ); return( real_time_clock_usecs() );
#else #else
struct timeval tv_date; struct timeval tv_date;
...@@ -80,6 +81,7 @@ mtime_t mdate( void ) ...@@ -80,6 +81,7 @@ mtime_t mdate( void )
* here, since tv is a local variable. */ * here, since tv is a local variable. */
gettimeofday( &tv_date, NULL ); gettimeofday( &tv_date, NULL );
return( (mtime_t) tv_date.tv_sec * 1000000 + (mtime_t) tv_date.tv_usec ); return( (mtime_t) tv_date.tv_sec * 1000000 + (mtime_t) tv_date.tv_usec );
#endif #endif
} }
...@@ -92,7 +94,8 @@ mtime_t mdate( void ) ...@@ -92,7 +94,8 @@ mtime_t mdate( void )
*****************************************************************************/ *****************************************************************************/
void mwait( mtime_t date ) void mwait( mtime_t date )
{ {
#ifdef SYS_BEOS #ifdef HAVE_KERNEL_OS_H
mtime_t delay; mtime_t delay;
delay = date - real_time_clock_usecs(); delay = date - real_time_clock_usecs();
...@@ -101,7 +104,7 @@ void mwait( mtime_t date ) ...@@ -101,7 +104,7 @@ void mwait( mtime_t date )
return; return;
} }
snooze( delay ); snooze( delay );
#else /* SYS_BEOS */ #else
struct timeval tv_date, tv_delay; struct timeval tv_date, tv_delay;
mtime_t delay; /* delay in msec, signed to detect errors */ mtime_t delay; /* delay in msec, signed to detect errors */
...@@ -115,17 +118,18 @@ void mwait( mtime_t date ) ...@@ -115,17 +118,18 @@ void mwait( mtime_t date )
{ {
return; return;
} }
#ifndef usleep
#ifdef HAVE_USLEEP
usleep( delay );
#else
tv_delay.tv_sec = delay / 1000000; tv_delay.tv_sec = delay / 1000000;
tv_delay.tv_usec = delay % 1000000; tv_delay.tv_usec = delay % 1000000;
/* see msleep() about select() errors */ /* see msleep() about select() errors */
select( 0, NULL, NULL, NULL, &tv_delay ); select( 0, NULL, NULL, NULL, &tv_delay );
#else
usleep( delay );
#endif #endif
#endif /* SYS_BEOS */ #endif /* HAVE_KERNEL_OS_H */
} }