dnl when going to/from release please set the nano (fourth number) right !
dnl releases only do Wall, cvs and prerelease does Werror too
-AS_VERSION(gstreamer, GST_VERSION, 0, 4, 2, 1, GST_ERROR="-Wall", GST_ERROR="-Wall -Werror")
+dnl only use Wall or Werror if compiler is gcc.
+if test "x$GCC" = "xyes"; then
+ AS_VERSION(gstreamer, GST_VERSION, 0, 4, 2, 1, GST_ERROR="-Wall", GST_ERROR="-Wall -Werror")
+else
+ AS_VERSION(gstreamer, GST_VERSION, 0, 4, 2, 1, GST_ERROR="", GST_ERROR="")
+fi
+
dnl AM_MAINTAINER_MODE only provides the option to configure to enable it
AM_MAINTAINER_MODE
AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
])
fi
+dnl
+dnl Check for functions
+dnl
+AC_MSG_CHECKING(whether $GCC implements __func__)
+AC_CACHE_VAL(have_func,
+[AC_TRY_LINK([#include <stdio.h>],[printf("%s", __func__);],
+have_func=yes,
+have_func=no)])
+AC_MSG_RESULT($have_func)
+if test "$have_func" = yes; then
+ AC_DEFINE(HAVE_FUNC,1,[defined if gcc have HAVE_FUNC)])
+else
+ AC_MSG_CHECKING(whether $GCC implements __PRETTY_FUNCTION__)
+ AC_CACHE_VAL(have_pretty_function,
+ [AC_TRY_LINK([#include <stdio.h>],[printf("%s", __PRETTY_FUNCTION__);],
+ have_pretty_function=yes,
+ have_pretty_function=no)])
+ AC_MSG_RESULT($have_pretty_function)
+ if test "$have_pretty_function" = yes; then
+ AC_DEFINE(HAVE_PRETTY_FUNCTION,1,[defined if gcc have HAVE_PRETTY_FUNCTION)])
+ else
+ AC_MSG_CHECKING(whether $GCC implements __FUNCTION__)
+ AC_CACHE_VAL(have_function,
+ [AC_TRY_LINK([#include <stdio.h>],[printf("%s", __FUNCTION__);],
+ have_function=yes,
+ have_function=no)])
+ AC_MSG_RESULT($have_function)
+ if test "$have_function" = yes; then
+ AC_DEFINE(HAVE_FUNCTION,1,[defined if gcc have HAVE_FUNCTION)])
+ fi
+ fi
+fi
+
dnl ######################################################################
dnl # Check command line parameters, and set shell variables accordingly #
dnl ######################################################################
/* default scheduler, 'basicomega', can be changed in
* gstscheduler.c in function gst_scheduler_factory_class_init
*/
-static const struct poptOption options[] = {
+static const struct poptOption gstreamer_options[] = {
{NULL, NUL, POPT_ARG_CALLBACK|POPT_CBFLAG_PRE|POPT_CBFLAG_POST, &init_popt_callback, 0, NULL, NULL},
{"gst-version", NUL, POPT_ARG_NONE|POPT_ARGFLAG_STRIP, NULL, ARG_VERSION, "Print the GStreamer version", NULL},
{"gst-fatal-warnings", NUL, POPT_ARG_NONE|POPT_ARGFLAG_STRIP, NULL, ARG_FATAL_WARNINGS, "Make all warnings fatal", NULL},
const struct poptOption *
gst_init_get_popt_table (void)
{
- return options;
+ return gstreamer_options;
}
/**
gchar **temp;
const struct poptOption *options;
/* this is probably hacky, no? */
- const struct poptOption options_with[] = {
+ struct poptOption options_with[] = {
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, poptHelpOptions, 0, "Help options:", NULL},
- {NULL, NUL, POPT_ARG_INCLUDE_TABLE, (struct poptOption *) gst_init_get_popt_table(), 0, "GStreamer options:", NULL},
+ {NULL, NUL, POPT_ARG_INCLUDE_TABLE, gstreamer_options, 0, "GStreamer options:", NULL},
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, (struct poptOption *) popt_options, 0, "Application options:", NULL},
POPT_TABLEEND
};
const struct poptOption options_without[] = {
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, poptHelpOptions, 0, "Help options:", NULL},
- {NULL, NUL, POPT_ARG_INCLUDE_TABLE, (struct poptOption *) gst_init_get_popt_table(), 0, "GStreamer options:", NULL},
+ {NULL, NUL, POPT_ARG_INCLUDE_TABLE, gstreamer_options, 0, "GStreamer options:", NULL},
POPT_TABLEEND
};
#include <config.h>
#endif
+#ifdef HAVE_FUNC
+#define FUNCTION __func__
+#elif HAVE_PRETTY_FUNCTION
+#define FUNCTION __PRETTY_FUNCTION__
+#elif HAVE_FUNCTION
+#define FUNCTION __FUNCTION__
+#else
+#define FUNCTION ""
+#endif
/***** are we in the core or not? *****/
#ifdef __GST_PRIVATE_H__
+#ifdef G_HAVE_ISO_VARARGS
+
+#ifdef GST_DEBUG_ENABLED
+#define GST_DEBUG(cat, ...) G_STMT_START{ \
+ if ((1<<cat) & _gst_debug_categories) \
+ _gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
+ NULL,g_strdup_printf( __VA_ARGS__ )); \
+}G_STMT_END
+
+#define GST_DEBUG_ELEMENT(cat, element, ...) G_STMT_START{ \
+ if ((1<<cat) & _gst_debug_categories) \
+ _gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
+ element,g_strdup_printf( __VA_ARGS__ )); \
+}G_STMT_END
+
+#else
+#define GST_DEBUG(cat, ...)
+#define GST_DEBUG_ELEMENT(cat,element, ...)
+#endif
+
+#elif defined(G_HAVE_GNUC_VARARGS)
#ifdef GST_DEBUG_ENABLED
#define GST_DEBUG(cat,format,args...) G_STMT_START{ \
if ((1<<cat) & _gst_debug_categories) \
- _gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
+ _gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
NULL,g_strdup_printf( format , ## args )); \
}G_STMT_END
#define GST_DEBUG_ELEMENT(cat,element,format,args...) G_STMT_START{ \
if ((1<<cat) & _gst_debug_categories) \
- _gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
+ _gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
element,g_strdup_printf( format , ## args )); \
}G_STMT_END
#define GST_DEBUG_ELEMENT(cat,element,format,args...)
#endif
+#endif
+
GST_OBJECT_NAME (GST_OBJECT_PARENT(pad)) : \
"''", GST_OBJECT_NAME (pad)
+#ifdef G_HAVE_ISO_VARARGS
+
+#ifdef GST_DEBUG_COLOR
+ #define GST_DEBUG_ENTER(...) GST_DEBUG( 31 , "\033[00;37mentering\033[00m :" __VA_ARGS__ )
+ #define GST_DEBUG_LEAVE(...) GST_DEBUG( 31 , "\033[00;37mleaving\033[00m :" , __VA_ARGS__ )
+#else
+ #define GST_DEBUG_ENTER(...) GST_DEBUG( 31 , "entering :" __VA_ARGS__ )
+ #define GST_DEBUG_LEAVE(...) GST_DEBUG( 31 , "leaving :" __VA_ARGS__ )
+#endif
+
+#elif defined(G_HAVE_GNUC_VARARGS)
+
#ifdef GST_DEBUG_COLOR
#define GST_DEBUG_ENTER(format, args...) GST_DEBUG( 31 , format ": \033[00;37mentering\033[00m" , ##args )
#define GST_DEBUG_LEAVE(format, args...) GST_DEBUG( 31 , format ": \033[00;37mleaving\033[00m" , ##args )
#define GST_DEBUG_LEAVE(format, args...) GST_DEBUG( 31 , format ": leaving" , ##args )
#endif
+#endif
+
/***** Colorized debug for thread ids *****/
#ifdef GST_DEBUG_COLOR
G_GNUC_UNUSED static gchar *_debug_string_pointer = NULL;
G_GNUC_UNUSED static GModule *_debug_self_module = NULL;
+#ifdef G_HAVE_ISO_VARARGS
+
+#define _DEBUG_ENTER_BUILTIN(...) \
+ static int _debug_in_wrapper = 0; \
+ gchar *_debug_string = ({ \
+ if (!_debug_in_wrapper) { \
+ void *_return_value; \
+ gchar *_debug_string; \
+ _debug_function_f function; \
+ void *_function_args = __builtin_apply_args(); \
+ _debug_in_wrapper = 1; \
+ _debug_string = g_strdup_printf(GST_DEBUG_PREFIX("")); \
+ _debug_string_pointer = _debug_string; \
+ fprintf(stderr,"%s: entered " FUNCTION, _debug_string); \
+ fprintf(stderr, __VA_ARGS__ ); \
+ fprintf(stderr,"\n"); \
+ if (_debug_self_module == NULL) _debug_self_module = g_module_open(NULL,0); \
+ g_module_symbol(_debug_self_module,FUNCTION,(gpointer *)&function); \
+ _return_value = __builtin_apply(function,_function_args,64); \
+ fprintf(stderr,"%s: left " FUNCTION, _debug_string); \
+ fprintf(stderr, __VA_ARGS__); \
+ fprintf(stderr,"\n"); \
+ g_free(_debug_string); \
+ __builtin_return(_return_value); \
+ } else { \
+ _debug_in_wrapper = 0; \
+ } \
+ _debug_string_pointer; \
+ });
+
+#elif defined(G_HAVE_GNUC_VARARGS)
+
#define _DEBUG_ENTER_BUILTIN(format,args...) \
static int _debug_in_wrapper = 0; \
gchar *_debug_string = ({ \
_debug_in_wrapper = 1; \
_debug_string = g_strdup_printf(GST_DEBUG_PREFIX("")); \
_debug_string_pointer = _debug_string; \
- fprintf(stderr,"%s: entered " __PRETTY_FUNCTION__ format "\n" , _debug_string , ## args ); \
+ fprintf(stderr,"%s: entered " FUNCTION format "\n" , _debug_string , ## args ); \
if (_debug_self_module == NULL) _debug_self_module = g_module_open(NULL,0); \
- g_module_symbol(_debug_self_module,__FUNCTION__,(gpointer *)&function); \
+ g_module_symbol(_debug_self_module,FUNCTION,(gpointer *)&function); \
_return_value = __builtin_apply(function,_function_args,64); \
- fprintf(stderr,"%s: left " __PRETTY_FUNCTION__ format "\n" , _debug_string , ## args ); \
+ fprintf(stderr,"%s: left " FUNCTION format "\n" , _debug_string , ## args ); \
g_free(_debug_string); \
__builtin_return(_return_value); \
} else { \
_debug_string_pointer; \
});
+#endif
+
* WARNING: there's a gcc CPP bug lurking in here. The extra space before the ##args *
* somehow make the preprocessor leave the _debug_string. If it's removed, the *
* _debug_string somehow gets stripped along with the ##args, and that's all she wrote. *
+
+#ifdef G_HAVE_ISO_VARARGS
+
+#define _DEBUG_BUILTIN(...) \
+ if (_debug_string != (void *)-1) { \
+ if (_debug_string) { \
+ fprintf(stderr, "%s: " _debug_string); \
+ fprintf(stderr, __VA_ARGS__); \
+ } else { \
+ fprintf(stderr,GST_DEBUG_PREFIX(": " __VA_ARGS__)); \
+ } \
+ }
+
+#elif defined(G_HAVE_GNUC_VARARGS)
+
#define _DEBUG_BUILTIN(format,args...) \
if (_debug_string != (void *)-1) { \
if (_debug_string) \
fprintf(stderr,GST_DEBUG_PREFIX(": " format , ## args)); \
}
+#endif
+
*/
#define GST_INFO_ENABLED
#endif
+#ifdef G_HAVE_ISO_VARARGS
+
+#ifdef GST_INFO_ENABLED
+#define GST_INFO(cat,...) G_STMT_START{ \
+ if ((1<<cat) & _gst_info_categories) \
+ _gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
+ NULL,g_strdup_printf( __VA_ARGS__ )); \
+}G_STMT_END
+
+#define GST_INFO_ELEMENT(cat,element,...) G_STMT_START{ \
+ if ((1<<cat) & _gst_info_categories) \
+ _gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
+ element,g_strdup_printf( __VA_ARGS__ )); \
+}G_STMT_END
+
+#else
+#define GST_INFO(cat,...)
+#define GST_INFO_ELEMENT(cat,element,...)
+#endif
+
+#elif defined(G_HAVE_GNUC_VARARGS)
+
#ifdef GST_INFO_ENABLED
#define GST_INFO(cat,format,args...) G_STMT_START{ \
if ((1<<cat) & _gst_info_categories) \
- _gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
+ _gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
NULL,g_strdup_printf( format , ## args )); \
}G_STMT_END
#define GST_INFO_ELEMENT(cat,element,format,args...) G_STMT_START{ \
if ((1<<cat) & _gst_info_categories) \
- _gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
+ _gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
element,g_strdup_printf( format , ## args )); \
}G_STMT_END
#define GST_INFO_ELEMENT(cat,element,format,args...)
#endif
+#endif
+
void gst_info_set_categories (guint32 categories);
guint32 gst_info_get_categories (void);
extern GstErrorHandler _gst_error_handler;
+#ifdef G_HAVE_ISO_VARARGS
+
+#define GST_ERROR(element,...) \
+ _gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
+ element,NULL,g_strdup_printf( __VA_ARGS__ ))
+
+#define GST_ERROR_OBJECT(element,object,...) \
+ _gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
+ element,object,g_strdup_printf( __VA_ARGS__ ))
+
+#elif defined(G_HAVE_GNUC_VARARGS)
+
#define GST_ERROR(element,format,args...) \
- _gst_error_handler(__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
+ _gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
element,NULL,g_strdup_printf( format , ## args ))
#define GST_ERROR_OBJECT(element,object,format,args...) \
- _gst_error_handler(__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
+ _gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
element,object,g_strdup_printf( format , ## args ))
+#endif
+