add run-time tests for weak-linked symbols from JACK (e.g. functions added to the API since 0.116.2) so that we can avoid using them if running on a platform with an older version of JACK

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6075 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2009-11-12 21:53:27 +00:00
parent b76635a8fd
commit 8f0a937d01

View file

@ -48,6 +48,19 @@ AudioEngine* AudioEngine::_instance = 0;
#define GET_PRIVATE_JACK_POINTER(j) jack_client_t* _priv_jack = (jack_client_t*) (j); if (!_priv_jack) { return; }
#define GET_PRIVATE_JACK_POINTER_RET(j,r) jack_client_t* _priv_jack = (jack_client_t*) (j); if (!_priv_jack) { return r; }
typedef void (*_JackInfoShutdownCallback)(jack_status_t code, const char* reason, void *arg);
static void (*on_info_shutdown)(jack_client_t*, _JackInfoShutdownCallback, void *);
extern void jack_on_info_shutdown (jack_client_t*, _JackInfoShutdownCallback, void *) __attribute__((weak_import));
static void check_jack_symbols () __attribute__((constructor));
void check_jack_symbols ()
{
/* use weak linking to see if we really have various late-model JACK function */
on_info_shutdown = jack_on_info_shutdown;
}
static void
ardour_jack_error (const char* msg)
{
@ -141,11 +154,12 @@ AudioEngine::start ()
_processed_frames = 0;
last_monitor_check = 0;
#ifdef HAVE_JACK_ON_INFO_SHUTDOWN
jack_on_info_shutdown (_priv_jack, halted_info, this);
#else
jack_on_shutdown (_priv_jack, halted, this);
#endif
if (on_info_shutdown) {
on_info_shutdown (_priv_jack, halted_info, this);
} else {
jack_on_shutdown (_priv_jack, halted, this);
}
jack_set_graph_order_callback (_priv_jack, _graph_order_callback, this);
jack_set_thread_init_callback (_priv_jack, _thread_init_callback, this);
jack_set_process_callback (_priv_jack, _process_callback, this);