summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-01-26 00:24:33 -0500
committerSolomon Peachy <pizza@shaftnet.org>2020-01-26 00:24:33 -0500
commitbb658b3c63a03ae3deae64e30c5768fc765d3729 (patch)
tree55c2218ef3b59683182c4449a9a49fedb5ac1675
parentc21e10a2ab94ca05710cd41b947e196f75b21133 (diff)
downloadselphy_print-bb658b3c63a03ae3deae64e30c5768fc765d3729.tar.gz
selphy_print-bb658b3c63a03ae3deae64e30c5768fc765d3729.tar.bz2
selphy_print-bb658b3c63a03ae3deae64e30c5768fc765d3729.zip
common: Move dynamic libary loading definitions into common header.
-rw-r--r--backend_common.h23
-rw-r--r--backend_mitsu70x.c21
-rw-r--r--backend_mitsu9550.c23
-rw-r--r--backend_shinkos6145.c21
4 files changed, 27 insertions, 61 deletions
diff --git a/backend_common.h b/backend_common.h
index 11e9bcf..1e7abba 100644
--- a/backend_common.h
+++ b/backend_common.h
@@ -351,4 +351,27 @@ extern struct dyesub_backend BACKEND;
quiet++; \
break;
+/* Dynamic library loading */
+#if defined(USE_DLOPEN)
+#define WITH_DYNAMIC
+#include <dlfcn.h>
+#define DL_INIT() do {} while(0)
+#define DL_OPEN(__x) dlopen(__x, RTLD_NOW)
+#define DL_SYM(__x, __y) dlsym(__x, __y)
+#define DL_CLOSE(__x) dlclose(__x)
+#define DL_EXIT() do {} while(0)
+#elif defined(USE_LTDL)
+#define WITH_DYNAMIC
+#include <ltdl.h>
+#define DL_INIT() lt_dlinit()
+#define DL_OPEN(__x) lt_dlopen(__x)
+#define DL_SYM(__x, __y) lt_dlsym(__x, __y)
+#define DL_CLOSE(__x) do {} while(0)
+#define DL_EXIT() lt_dlexit()
+#else
+#define DL_INIT() do {} while(0)
+#define DL_CLOSE(__x) do {} while(0)
+#define DL_EXIT() do {} while(0)
+#endif
+
#endif /* __BACKEND_COMMON_H */
diff --git a/backend_mitsu70x.c b/backend_mitsu70x.c
index fc4fe1d..28bcbfa 100644
--- a/backend_mitsu70x.c
+++ b/backend_mitsu70x.c
@@ -33,26 +33,7 @@
#include <config.h>
#endif
-#if defined(USE_DLOPEN)
-#define WITH_DYNAMIC
-#include <dlfcn.h>
-#define DL_INIT() do {} while(0)
-#define DL_OPEN(__x) dlopen(__x, RTLD_NOW)
-#define DL_SYM(__x, __y) dlsym(__x, __y)
-#define DL_CLOSE(__x) dlclose(__x)
-#define DL_EXIT() do {} while(0)
-#elif defined(USE_LTDL)
-#define WITH_DYNAMIC
-#include <ltdl.h>
-#define DL_INIT() lt_dlinit()
-#define DL_OPEN(__x) lt_dlopen(__x)
-#define DL_SYM(__x, __y) lt_dlsym(__x, __y)
-#define DL_CLOSE(__x) do {} while(0)
-#define DL_EXIT() lt_dlexit()
-#else
-#define DL_INIT() do {} while(0)
-#define DL_CLOSE(__x) do {} while(0)
-#define DL_EXIT() do {} while(0)
+#ifndef WITH_DYNAMIC
#warning "No dynamic loading support!"
#endif
diff --git a/backend_mitsu9550.c b/backend_mitsu9550.c
index 2ad2417..ec10bdb 100644
--- a/backend_mitsu9550.c
+++ b/backend_mitsu9550.c
@@ -1,7 +1,7 @@
/*
* Mitsubishi CP-9xxx Photo Printer Family CUPS backend
*
- * (c) 2014-2019 Solomon Peachy <pizza@shaftnet.org>
+ * (c) 2014-2020 Solomon Peachy <pizza@shaftnet.org>
*
* The latest version of this program can be found at:
*
@@ -33,26 +33,7 @@
#include <config.h>
#endif
-#if defined(USE_DLOPEN)
-#define WITH_DYNAMIC
-#include <dlfcn.h>
-#define DL_INIT() do {} while(0)
-#define DL_OPEN(__x) dlopen(__x, RTLD_NOW)
-#define DL_SYM(__x, __y) dlsym(__x, __y)
-#define DL_CLOSE(__x) dlclose(__x)
-#define DL_EXIT() do {} while(0)
-#elif defined(USE_LTDL)
-#define WITH_DYNAMIC
-#include <ltdl.h>
-#define DL_INIT() lt_dlinit()
-#define DL_OPEN(__x) lt_dlopen(__x)
-#define DL_SYM(__x, __y) lt_dlsym(__x, __y)
-#define DL_CLOSE(__x) do {} while(0)
-#define DL_EXIT() lt_dlexit()
-#else
-#define DL_INIT() do {} while(0)
-#define DL_CLOSE(__x) do {} while(0)
-#define DL_EXIT() do {} while(0)
+#ifndef WITH_DYNAMIC
#warning "No dynamic loading support!"
#endif
diff --git a/backend_shinkos6145.c b/backend_shinkos6145.c
index 6a08d10..2b7b900 100644
--- a/backend_shinkos6145.c
+++ b/backend_shinkos6145.c
@@ -47,26 +47,7 @@
#include <config.h>
#endif
-#if defined(USE_DLOPEN)
-#define WITH_DYNAMIC
-#include <dlfcn.h>
-#define DL_INIT() do {} while(0)
-#define DL_OPEN(__x) dlopen(__x, RTLD_NOW)
-#define DL_SYM(__x, __y) dlsym(__x, __y)
-#define DL_CLOSE(__x) dlclose(__x)
-#define DL_EXIT() do {} while(0)
-#elif defined(USE_LTDL)
-#define WITH_DYNAMIC
-#include <ltdl.h>
-#define DL_INIT() lt_dlinit()
-#define DL_OPEN(__x) lt_dlopen(__x)
-#define DL_SYM(__x, __y) lt_dlsym(__x, __y)
-#define DL_CLOSE(__x) do {} while(0)
-#define DL_EXIT() lt_dlexit()
-#else
-#define DL_INIT() do {} while(0)
-#define DL_CLOSE(__x) do {} while(0)
-#define DL_EXIT() do {} while(0)
+#ifndef WITH_DYNAMIC
#warning "No dynamic loading support!"
#endif