summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2014-10-24 17:15:03 +0200
committerRobin Gareus <robin@gareus.org>2014-10-24 17:15:03 +0200
commit5e7f935a272ea5a8c1a87834089cb56454602c81 (patch)
treee406d6c75a149419782c45f56bb99d3d2b7a197f /libs
parent25a6aa57a377a1ca2843563cc401a69d1453bd7d (diff)
add explicit construction (for MSVC) and some debug messages
Diffstat (limited to 'libs')
-rw-r--r--libs/backends/jack/weak_libjack.c21
-rw-r--r--libs/backends/jack/weak_libjack.def2
2 files changed, 18 insertions, 5 deletions
diff --git a/libs/backends/jack/weak_libjack.c b/libs/backends/jack/weak_libjack.c
index e48f11b89d..bba1055b38 100644
--- a/libs/backends/jack/weak_libjack.c
+++ b/libs/backends/jack/weak_libjack.c
@@ -84,15 +84,15 @@ static struct WeakJack {
static int _status = -1;
-int have_libjack (void) {
- return _status;
-}
-
__attribute__((constructor))
+//__attribute__((constructor))
static void init_weak_jack(void)
{
void* lib;
int err = 0;
+#ifndef NDEBUG
+ fprintf(stderr, "*** WEAK-JACK: initializing\n");
+#endif
memset(&_j, 0, sizeof(_j));
@@ -111,6 +111,9 @@ static void init_weak_jack(void)
lib = lib_open("libjack.so.0");
#endif
if (!lib) {
+#ifndef NDEBUG
+ fprintf(stderr, "*** WEAK-JACK: libjack was not found\n");
+#endif
_status = -2;
return;
}
@@ -135,6 +138,16 @@ static void init_weak_jack(void)
_j._client_open = NULL;
}
_status = err;
+#ifndef NDEBUG
+ fprintf(stderr, "*** WEAK-JACK: %s. (%d)\n", err ? "jack is not available" : "OK", _status);
+#endif
+}
+
+int have_libjack (void) {
+ if (_status == -1) {
+ init_weak_jack();
+ }
+ return _status;
}
/*******************************************************************************
diff --git a/libs/backends/jack/weak_libjack.def b/libs/backends/jack/weak_libjack.def
index 4118dbd9ea..eeab00e943 100644
--- a/libs/backends/jack/weak_libjack.def
+++ b/libs/backends/jack/weak_libjack.def
@@ -9,7 +9,7 @@
* see https://en.wikibooks.org/wiki/C_Programming/Preprocessor#X-Macros
*/
-#ifndef USE_WEAK_JACK
+#ifdef USE_WEAK_JACK
/* <jack/jack.h> */
JCFUN(1, int, client_close, 0)