From 94f33ff7e3b7140e78c014be1a68fe9c1ba17814 Mon Sep 17 00:00:00 2001 From: Juergen Keil Date: Thu, 6 Sep 2001 18:38:11 +0000 Subject: Trying to port the xine-lib sources to a non-gcc compiler CVS patchset: 584 CVS date: 2001/09/06 18:38:11 --- acconfig.h | 8 +- configure.in | 197 ++++++++++++++++++++------------------ src/input/Makefile.am | 5 +- src/input/dvd_udf.c | 4 + src/input/input_file.c | 6 +- src/libffmpeg/libavcodec/common.h | 2 +- src/libffmpeg/libavcodec/mjpeg.c | 12 ++- src/libffmpeg/libavcodec/mpeg12.c | 12 ++- src/libspudec/spu.c | 23 ++++- src/libspudec/xine_decoder.c | 42 ++++---- src/video_out/video_out_xshm.c | 6 +- src/xine-engine/load_plugins.c | 6 +- src/xine-engine/monitor.h | 21 +++- src/xine-engine/utils.c | 19 ++-- src/xine-engine/xine.c | 6 +- 15 files changed, 223 insertions(+), 146 deletions(-) diff --git a/acconfig.h b/acconfig.h index 4ad550b6e..591ade575 100644 --- a/acconfig.h +++ b/acconfig.h @@ -90,4 +90,10 @@ #undef FPM_PPC #undef FPM_SPARC #undef FPM_MIPS -#undef FPM_M68K \ No newline at end of file +#undef FPM_M68K + +@BOTTOM@ +/* Disable GCC compiler extensions, if gcc is not in use */ +#ifndef __GNUC__ +#define __attribute__(x) /**/ +#endif diff --git a/configure.in b/configure.in index fef8b0cf1..0b48be007 100644 --- a/configure.in +++ b/configure.in @@ -339,20 +339,24 @@ AC_CHECK_LIB(posix4, sched_get_priority_min) AC_HAVE_FUNCS(sigaction sigset getpwuid_r nanosleep) AC_CHECK_HEADERS(byteswap.h malloc.h sys/mman.h) -dnl -dnl check cflags not supported by all gcc versions -dnl eg: -mpreferred-stack-boundary=2 and 2.91.66, -dnl and gcc-2.7.2.3 support a bit less options -dnl -AC_TRY_CFLAGS("-mpreferred-stack-boundary=2", + +if test "$GCC" = yes; then + dnl + dnl check cflags not supported by all gcc versions + dnl eg: -mpreferred-stack-boundary=2 and 2.91.66, + dnl and gcc-2.7.2.3 support a bit less options + dnl + AC_TRY_CFLAGS("-mpreferred-stack-boundary=2", m_psb="-mpreferred-stack-boundary=2", m_psb="") -AC_TRY_CFLAGS("-fno-strict-aliasing", f_nsa="-fno-strict-aliasing", f_nsa="") -AC_TRY_CFLAGS("-fschedule-insns2", f_si="-fschedule-insns2", f_si="") -AC_TRY_CFLAGS("-mwide-multiply", m_wm="-mwide-multiply", m_wm="") + AC_TRY_CFLAGS("-fno-strict-aliasing", f_nsa="-fno-strict-aliasing", f_nsa="") + AC_TRY_CFLAGS("-fschedule-insns2", f_si="-fschedule-insns2", f_si="") + AC_TRY_CFLAGS("-mwide-multiply", m_wm="-mwide-multiply", m_wm="") +fi dnl Flags not supported by all *cc* variants AC_TRY_CFLAGS("-Wall", wall="-Wall", wall="") + dnl Common cflags for all platforms COMMON_CFLAGS="$wall -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DXINE_COMPILE" @@ -376,76 +380,83 @@ case $host in case "$host_alias" in i?86-* | k?-* | athlon-*) dnl catch i386,i486,i586,i686,k6,k7 - dnl Check for gcc cpu optimization support - AC_TRY_CFLAGS("-mcpu=i386", - sarchopt="-mcpu", - AC_TRY_CFLAGS("-march=i386", - sarchopt="-march", - [ AC_MSG_RESULT(** no cpu optimization supports **) - sarchopt=no ])) - dnl special check for k7 cpu CC support - AC_TRY_CFLAGS("$sarchopt=athlon", k7cpu="athlon", k7cpu="i686") - - AC_DEFINE(__i386__) - AC_DEFINE([ARCH_X86],,[x86 architecture]) - AC_DEFINE(FPM_INTEL) + if test "$GCC" = yes; then + dnl Check for gcc cpu optimization support + AC_TRY_CFLAGS("-mcpu=i386", + sarchopt="-mcpu", + AC_TRY_CFLAGS("-march=i386", + sarchopt="-march", + [ AC_MSG_RESULT(** no cpu optimization supports **) + sarchopt=no ])) + + dnl special check for k7 cpu CC support + AC_TRY_CFLAGS("$sarchopt=athlon", k7cpu="athlon", k7cpu="i686") + + dnl add x86 specific gcc CFLAGS + GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O3 -pipe -fomit-frame-pointer -malign-functions=4 -malign-loops=4 -malign-jumps=4 -malign-functions=4 $m_wm $m_psb -fexpensive-optimizations $f_si $f_nsa -ffast-math -funroll-loops -funroll-all-loops -finline-functions" + DEBUG_CFLAGS="$DEBUG_CFLAGS -O3" + + if test x"$sarchopt" != "xno"; then + [case "$host_alias" in + i386-*) # *BSD return this even on a P III #-)) + GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=i386" + DEBUG_CFLAGS="$DEBUG_CFLAGS $sarchopt=i386" + ;; + i486-*) # oh dear! + GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=i486" + DEBUG_CFLAGS="$DEBUG_CFLAGS $sarchopt=i486" + ;; + i586-*) + GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=pentium" + DEBUG_CFLAGS="$DEBUG_CFLAGS $sarchopt=pentium" + ;; + i686-*) + if test x"$check_athlon" = "xyes"; then + if test -f /proc/cpuinfo; then + modelname=`cat /proc/cpuinfo | grep "model\ name\ :" | sed -e 's/ //g' | cut -d':' -f2` + case $modelname in + *Athlon* | *Duron* | *K7*) + GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=$k7cpu" + DEBUG_CFLAGS="$DEBUG_CFLAGS $sarchopt=$k7cpu" + ;; + *) + GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=pentiumpro" + DEBUG_CFLAGS="$DEBUG_CFLAGS $X_CFLAGS $sarchopt=pentiumpro" + ;; + esac + fi + else + GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=pentiumpro" + DEBUG_CFLAGS="$DEBUG_CFLAGS $sarchopt=pentiumpro" + fi + ;; + k6-*) + GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=k6" + DEBUG_CFLAGS="$DEBUG_CFLAGS $sarchopt=k6" + ;; + k7-*) + GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=k7" + DEBUG_CFLAGS="$DEBUG_CFLAGS $sarchopt=k7" + ;; + athlon-*) + GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=athlon" + DEBUG_CFLAGS="$DEBUG_CFLAGS $sarchopt=athlon" + esac] + fi + + else + dnl add x86 specific cc CFLAGS + GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O" + DEBUG_CFLAGS="$DEBUG_CFLAGS -O" + fi - dnl add x86 specific CFLAGS - GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O3 -pipe -fomit-frame-pointer -malign-functions=4 -malign-loops=4 -malign-jumps=4 -malign-functions=4 $m_wm $m_psb -fexpensive-optimizations $f_si $f_nsa -ffast-math -funroll-loops -funroll-all-loops -finline-functions" - dnl DEBUG_CFLAGS="$DEBUG_CFLAGS -O3" - DEBUG_CFLAGS="$DEBUG_CFLAGS -O" - dnl enable x86 specific parts of the code enable_w32dll="yes" enable_ffmmx="yes" - if test x"$sarchopt" != "xno"; then - [case "$host_alias" in - i386-*) # *BSD return this even on a P III #-)) - GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=i386" - DEBUG_CFLAGS="$DEBUG_CFLAGS $sarchopt=i386" - ;; - i486-*) # oh dear! - GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=i486" - DEBUG_CFLAGS="$DEBUG_CFLAGS $sarchopt=i486" - ;; - i586-*) - GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=pentium" - DEBUG_CFLAGS="$DEBUG_CFLAGS $sarchopt=pentium" - ;; - i686-*) - if test x"$check_athlon" = "xyes"; then - if test -f /proc/cpuinfo; then - modelname=`cat /proc/cpuinfo | grep "model\ name\ :" | sed -e 's/ //g' | cut -d':' -f2` - case $modelname in - *Athlon* | *Duron* | *K7*) - GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=$k7cpu" - DEBUG_CFLAGS="$DEBUG_CFLAGS $sarchopt=$k7cpu" - ;; - *) - GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=pentiumpro" - DEBUG_CFLAGS="$DEBUG_CFLAGS $X_CFLAGS $sarchopt=pentiumpro" - ;; - esac - fi - else - GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=pentiumpro" - DEBUG_CFLAGS="$DEBUG_CFLAGS $sarchopt=pentiumpro" - fi - ;; - k6-*) - GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=k6" - DEBUG_CFLAGS="$DEBUG_CFLAGS $sarchopt=k6" - ;; - k7-*) - GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=k7" - DEBUG_CFLAGS="$DEBUG_CFLAGS $sarchopt=k7" - ;; - athlon-*) - GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=athlon" - DEBUG_CFLAGS="$DEBUG_CFLAGS $sarchopt=athlon" - esac] - fi + AC_DEFINE(__i386__) + AC_DEFINE([ARCH_X86],,[x86 architecture]) + AC_DEFINE(FPM_INTEL) ;; alphaev56-*) @@ -467,13 +478,8 @@ case $host in sparc*-*-linux-*) case $host_alias in - sparc-*) - cpu_cflags="-mcpu=supersparc -mtune=supersparc" - ;; - sparc64-*) - #cpu_cflags="-mcpu=ultrasparc -mtune=ultrasparc" - cpu_cflags="-mcpu=supersparc -mtune=ultrasparc" - ;; + sparc-*) cpu_cflags="-mcpu=supersparc -mtune=supersparc" ;; + sparc64-*) cpu_cflags="-mcpu=supersparc -mtune=ultrasparc" ;; esac GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O3 $cpu_cflags -funroll-loops -funroll-all-loops -finline-functions" DEBUG_CFLAGS="$DEBUG_CFLAGS -O $cpu_cflags -funroll-loops -funroll-all-loops -finline-functions" @@ -482,20 +488,21 @@ case $host in ;; sparc-*-solaris*) - case `uname -m` in - sun4c) - cpu_cflags="-mcpu=v7 -mtune=supersparc" - ;; - sun4m) - cpu_cflags="-mcpu=v8 -mtune=supersparc" - ;; - sun4u) - #cpu_cflags="-mcpu=ultrasparc -mtune=ultrasparc" - cpu_cflags="-mcpu=supersparc -mtune=ultrasparc" - ;; - esac - GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O3 $cpu_cflags -funroll-loops -funroll-all-loops -finline-functions" - DEBUG_CFLAGS="$DEBUG_CFLAGS -O $cpu_cflags -funroll-loops -funroll-all-loops -finline-functions" + if test "$GCC" = yes; then + case `uname -m` in + sun4c) cpu_cflags="-mcpu=v7 -mtune=supersparc" ;; + sun4m) cpu_cflags="-mcpu=v8 -mtune=supersparc" ;; + sun4u) cpu_cflags="-mcpu=supersparc -mtune=ultrasparc" ;; + *) cpu_cflags= ;; + esac + cc_optimize_cflags="-O3 $cpu_cflags -funroll-loops -funroll-all-loops -finline-functions" + cc_debug_cflags="-O $cpu_cflags -funroll-loops -funroll-all-loops -finline-functions" + else + cc_optimize_cflags="-O" + cc_debug_cflags="-O" + fi + GLOBAL_CFLAGS="$GLOBAL_CFLAGS $cc_optimize_cflags" + DEBUG_CFLAGS="$DEBUG_CFLAGS $cc_debug_cflags" AC_DEFINE(FPM_SPARC) ;; diff --git a/src/input/Makefile.am b/src/input/Makefile.am index 12d21c62b..8d9546c01 100644 --- a/src/input/Makefile.am +++ b/src/input/Makefile.am @@ -2,8 +2,7 @@ ## Process this file with automake to produce Makefile.in ## -#CFLAGS += @GLOBAL_CFLAGS@ -CFLAGS = @CFLAGS@ -D_FILE_OFFSET_BITS=64 -Wall -DXINE_COMPILE +CFLAGS = @GLOBAL_CFLAGS@ LIBTOOL = $(SHELL) $(top_builddir)/libtool-nofpic @@ -71,7 +70,7 @@ uninstall-includeHEADERS: debug: - @$(MAKE) CFLAGS="-D_FILE_OFFSET_BITS=64 -Wall -DDEBUG -g -DXINE_COMPILE" + @$(MAKE) CFLAGS="$(DEBUG_CFLAGS)" install-debug: debug @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am diff --git a/src/input/dvd_udf.c b/src/input/dvd_udf.c index c88209057..c8064b0eb 100644 --- a/src/input/dvd_udf.c +++ b/src/input/dvd_udf.c @@ -32,6 +32,10 @@ #include "dvd_udf.h" +#ifndef __GNUC__ +#define __FUNCTION__ __func__ +#endif + static int _Unicodedecode (uint8_t *data, int len, char *target); #define MAX_FILE_LEN 2048 diff --git a/src/input/input_file.c b/src/input/input_file.c index 7763c42ff..0db3d1b33 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_file.c,v 1.20 2001/08/28 23:13:08 f1rmb Exp $ + * $Id: input_file.c,v 1.21 2001/09/06 18:38:12 jkeil Exp $ */ #ifdef HAVE_CONFIG_H @@ -43,6 +43,10 @@ extern int errno; static uint32_t xine_debug; +#ifndef __GNUC__ +#define __FUNCTION__ __func__ +#endif + #define MAXFILES 65535 #ifndef NAME_MAX diff --git a/src/libffmpeg/libavcodec/common.h b/src/libffmpeg/libavcodec/common.h index aeb9ab52b..8ea58b2e7 100644 --- a/src/libffmpeg/libavcodec/common.h +++ b/src/libffmpeg/libavcodec/common.h @@ -298,7 +298,7 @@ void print_stats(void); /* misc math functions */ -extern inline int av_log2(unsigned int v) +static inline int av_log2(unsigned int v) { int n; diff --git a/src/libffmpeg/libavcodec/mjpeg.c b/src/libffmpeg/libavcodec/mjpeg.c index 1103e11d0..391ce7d23 100644 --- a/src/libffmpeg/libavcodec/mjpeg.c +++ b/src/libffmpeg/libavcodec/mjpeg.c @@ -424,9 +424,17 @@ void mjpeg_encode_mb(MpegEncContext *s, #ifndef CONFIG_WIN32 #ifdef DEBUG -#define dprintf(fmt,args...) printf(fmt, ## args) +# if __GNUC_ +# define dprintf(fmt,args...) printf(fmt, ## args) +# else +# define dprintf(...) printf(__VA_ARGS__) +# endif #else -#define dprintf(fmt,args...) +# if __GNUC__ +# define dprintf(fmt,args...) +# else +# define dprintf(...) +# endif #endif #else diff --git a/src/libffmpeg/libavcodec/mpeg12.c b/src/libffmpeg/libavcodec/mpeg12.c index f0aecd980..00183c22d 100644 --- a/src/libffmpeg/libavcodec/mpeg12.c +++ b/src/libffmpeg/libavcodec/mpeg12.c @@ -27,9 +27,17 @@ #ifndef CONFIG_WIN32 #ifdef DEBUG -#define dprintf(fmt,args...) printf(fmt, ## args) +# if __GNUC_ +# define dprintf(fmt,args...) printf(fmt, ## args) +# else +# define dprintf(...) printf(__VA_ARGS__) +# endif #else -#define dprintf(fmt,args...) +# if __GNUC__ +# define dprintf(fmt,args...) +# else +# define dprintf(...) +# endif #endif #else diff --git a/src/libspudec/spu.c b/src/libspudec/spu.c index e0f0a4aec..b52429a4f 100644 --- a/src/libspudec/spu.c +++ b/src/libspudec/spu.c @@ -19,7 +19,7 @@ * along with this program; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * -* $Id: spu.c,v 1.10 2001/08/17 15:54:31 ehasenle Exp $ +* $Id: spu.c,v 1.11 2001/09/06 18:38:12 jkeil Exp $ * *****/ @@ -72,10 +72,23 @@ #define LOG_DEBUG 1 #ifdef DEBUG -#define LOG(lvl, fmt...) fprintf (stderr, fmt); -#else -#define LOG(lvl, fmt...) -#endif + +# ifdef __GNUC__ +# define LOG(lvl, fmt...) fprintf (stderr, fmt); +# else +# define LOG(lvl, ...) fprintf (stderr, __VA_ARGS__); +# endif + +#else /* !DEBUG */ + +# ifdef __GNUC_ +# define LOG(lvl, fmt...) +# else +# define LOG(lvl, ...) +# endif + +#endif /* !DEBUG */ + /* Return value: reassembly complete = 1 */ int spuReassembly (spu_seq_t *seq, int start, uint8_t *pkt_data, u_int pkt_len) diff --git a/src/libspudec/xine_decoder.c b/src/libspudec/xine_decoder.c index b2dc7b793..e5f6f9232 100644 --- a/src/libspudec/xine_decoder.c +++ b/src/libspudec/xine_decoder.c @@ -19,7 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.11 2001/08/17 13:34:25 heikos Exp $ + * $Id: xine_decoder.c,v 1.12 2001/09/06 18:38:12 jkeil Exp $ * * stuff needed to turn libspu into a xine decoder plugin */ @@ -43,24 +43,30 @@ #include "video_out/alphablend.h" #include "xine-engine/bswap.h" +#ifdef __GNUC__ +#define CLUT_Y_CR_CB_INIT(_y,_cr,_cb) {y: (_y), cr: (_cr), cb: (_cb)} +#else +#define CLUT_Y_CR_CB_INIT(_y,_cr,_cb) { (_cb), (_cr), (_y) } +#endif + static clut_t __default_clut[] = { - {y: 0x00, cr: 0x80, cb:0x80}, - {y: 0xbf, cr: 0x80, cb:0x80}, - {y: 0x10, cr: 0x80, cb:0x80}, - {y: 0x28, cr: 0x6d, cb:0xef}, - {y: 0x51, cr: 0xef, cb:0x5a}, - {y: 0xbf, cr: 0x80, cb:0x80}, - {y: 0x36, cr: 0x80, cb:0x80}, - {y: 0x28, cr: 0x6d, cb:0xef}, - {y: 0xbf, cr: 0x80, cb:0x80}, - {y: 0x51, cr: 0x80, cb:0x80}, - {y: 0xbf, cr: 0x80, cb:0x80}, - {y: 0x10, cr: 0x80, cb:0x80}, - {y: 0x28, cr: 0x6d, cb:0xef}, - {y: 0x5c, cr: 0x80, cb:0x80}, - {y: 0xbf, cr: 0x80, cb:0x80}, - {y: 0x1c, cr: 0x80, cb:0x80}, - {y: 0x28, cr: 0x6d, cb:0xef} + CLUT_Y_CR_CB_INIT(0x00, 0x80, 0x80), + CLUT_Y_CR_CB_INIT(0xbf, 0x80, 0x80), + CLUT_Y_CR_CB_INIT(0x10, 0x80, 0x80), + CLUT_Y_CR_CB_INIT(0x28, 0x6d, 0xef), + CLUT_Y_CR_CB_INIT(0x51, 0xef, 0x5a), + CLUT_Y_CR_CB_INIT(0xbf, 0x80, 0x80), + CLUT_Y_CR_CB_INIT(0x36, 0x80, 0x80), + CLUT_Y_CR_CB_INIT(0x28, 0x6d, 0xef), + CLUT_Y_CR_CB_INIT(0xbf, 0x80, 0x80), + CLUT_Y_CR_CB_INIT(0x51, 0x80, 0x80), + CLUT_Y_CR_CB_INIT(0xbf, 0x80, 0x80), + CLUT_Y_CR_CB_INIT(0x10, 0x80, 0x80), + CLUT_Y_CR_CB_INIT(0x28, 0x6d, 0xef), + CLUT_Y_CR_CB_INIT(0x5c, 0x80, 0x80), + CLUT_Y_CR_CB_INIT(0xbf, 0x80, 0x80), + CLUT_Y_CR_CB_INIT(0x1c, 0x80, 0x80), + CLUT_Y_CR_CB_INIT(0x28, 0x6d, 0xef) }; #define NUM_SEQ_BUFFERS 5 diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index 51be649fb..f039aa512 100644 --- a/src/video_out/video_out_xshm.c +++ b/src/video_out/video_out_xshm.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xshm.c,v 1.29 2001/09/01 18:11:04 jkeil Exp $ + * $Id: video_out_xshm.c,v 1.30 2001/09/06 18:38:12 jkeil Exp $ * * video_out_xshm.c, X11 shared memory extension interface for xine * @@ -449,8 +449,6 @@ static void xshm_calc_output_size (xshm_driver_t *this) { if (this->delivered_width == 0 && this->delivered_height == 0) return; /* ConfigureNotify/VisibilityNotify, no decoder output size known */ - -#if 0 /* * quick hack to allow testing of unscaled yuv2rgb conversion routines */ @@ -462,8 +460,6 @@ static void xshm_calc_output_size (xshm_driver_t *this) { this->ratio_factor = 1.0; return; } -#endif - image_ratio = (double) this->delivered_width / (double) this->delivered_height; diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 0bbd8bec0..f315a04c9 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: load_plugins.c,v 1.39 2001/08/23 13:27:24 jcdutton Exp $ + * $Id: load_plugins.c,v 1.40 2001/09/06 18:38:12 jkeil Exp $ * * * Load input/demux/audio_out/video_out/codec plugins @@ -46,6 +46,10 @@ #include "utils.h" #include "monitor.h" +#ifndef __GNUC__ +#define __FUNCTION__ __func__ +#endif + extern int errno; /** *************************************************************** diff --git a/src/xine-engine/monitor.h b/src/xine-engine/monitor.h index 38c1be91a..316e855d7 100644 --- a/src/xine-engine/monitor.h +++ b/src/xine-engine/monitor.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: monitor.h,v 1.3 2001/07/18 21:38:17 f1rmb Exp $ + * $Id: monitor.h,v 1.4 2001/09/06 18:38:12 jkeil Exp $ * * debug print and profiling functions * @@ -47,7 +47,11 @@ extern uint32_t xine_debug; #define LOOP (xine_debug & 0x8000>>11) // 16 #define GUI (xine_debug & 0x8000>>12) // 8 +#ifdef __GNUC__ #define perr(FMT,ARGS...) {fprintf(stderr, FMT, ##ARGS);fflush(stderr);} +#else /* C99 version: */ +#define perr(...) {fprintf(stderr, __VA_ARGS__);fflush(stderr);} +#endif #ifdef DEBUG @@ -57,11 +61,20 @@ extern uint32_t xine_debug; //#define perr(FMT,ARGS...) {fprintf(stderr, FMT, ##ARGS);fflush(stderr);} +#ifdef __GNUC__ #define xprintf(LVL, FMT, ARGS...) { \ if(LVL) { \ - printf(FMT, ##ARGS); \ + printf(FMT, ##ARGS); \ + } \ + } +#else /* C99 version: */ +#define xprintf(LVL, ...) { \ + if(LVL) { \ + printf(__VA_ARGS__); \ } \ } +#endif + /* * profiling */ @@ -80,7 +93,11 @@ void profiler_print_results (); //#define perr(FMT,ARGS...) +#ifdef __GNUC__ #define xprintf(LVL, FMT, ARGS...) +#else /* C99 version: */ +#define xprintf(LVL, ...) +#endif #define profiler_init() #define profiler_set_label(id, label) diff --git a/src/xine-engine/utils.c b/src/xine-engine/utils.c index 3f45e909c..5a9dc5573 100644 --- a/src/xine-engine/utils.c +++ b/src/xine-engine/utils.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: utils.c,v 1.3 2001/09/06 13:29:18 jkeil Exp $ + * $Id: utils.c,v 1.4 2001/09/06 18:38:12 jkeil Exp $ * */ #define _POSIX_PTHREAD_SEMANTICS 1 /* for 5-arg getpwuid_r on solaris */ @@ -35,25 +35,26 @@ #include #include +#ifndef __GNUC__ +#define __FUNCTION__ __func__ +#endif + + /* * */ void *xmalloc(size_t size) { - void *ptrmalloc, *ptrmemset; + void *ptr; - if((ptrmalloc = malloc(size)) == NULL) { + if((ptr = malloc(size)) == NULL) { fprintf(stderr, "%s: malloc() failed: %s.\n", __FUNCTION__, strerror(errno)); return NULL; } - if((ptrmemset = memset(ptrmalloc, 0, size)) == NULL) { - fprintf(stderr, "%s: memset() failed: %s.\n", - __FUNCTION__, strerror(errno)); - return NULL; - } + memset(ptr, 0, size); - return ptrmemset; + return ptr; } /* diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 20cc1153f..8af7b3461 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine.c,v 1.57 2001/09/06 14:09:37 jkeil Exp $ + * $Id: xine.c,v 1.58 2001/09/06 18:38:12 jkeil Exp $ * * top-level xine functions * @@ -52,6 +52,10 @@ #include "monitor.h" #include "utils.h" +#ifndef __GNUC__ +#define __FUNCTION__ __func__ +#endif + /* debugging purposes only */ uint32_t xine_debug; -- cgit v1.2.3