summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-02-20 07:08:23 +0000
committermidipix <writeonce@midipix.org>2024-02-20 07:08:23 +0000
commitf248f358ccd4fc8b194a4831a86c4c5b6e3ba446 (patch)
tree6037b0d0fa7e9c7b924a7907844ec24d9f584d5f
parenta8b6ddb4a10e8c93465de0c28444787a0939a9b9 (diff)
downloadslibtool-f248f358ccd4fc8b194a4831a86c4c5b6e3ba446.tar.bz2
slibtool-f248f358ccd4fc8b194a4831a86c4c5b6e3ba446.tar.xz
host interfaces: added slbt_host_objfmt_is_{coff|macho}() and friends.
-rw-r--r--include/slibtool/slibtool.h8
-rw-r--r--src/host/slbt_host_flavor.c31
2 files changed, 39 insertions, 0 deletions
diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h
index fbeaf3e..2a43fad 100644
--- a/include/slibtool/slibtool.h
+++ b/include/slibtool/slibtool.h
@@ -384,6 +384,14 @@ slbt_api int slbt_host_set_althost (const struct slbt_driver_ctx *, const c
slbt_api void slbt_host_reset_althost (const struct slbt_driver_ctx *);
+slbt_api int slbt_host_objfmt_is_coff (const struct slbt_driver_ctx *);
+
+slbt_api int slbt_host_objfmt_is_macho (const struct slbt_driver_ctx *);
+
+slbt_api int slbt_host_group_is_winnt (const struct slbt_driver_ctx *);
+
+slbt_api int slbt_host_group_is_darwin (const struct slbt_driver_ctx *);
+
slbt_api int slbt_host_flavor_settings (const char *, const struct slbt_flavor_settings **);
/* utility helper interfaces */
diff --git a/src/host/slbt_host_flavor.c b/src/host/slbt_host_flavor.c
index b5f6f45..a0b3a3b 100644
--- a/src/host/slbt_host_flavor.c
+++ b/src/host/slbt_host_flavor.c
@@ -173,3 +173,34 @@ int slbt_host_flavor_settings(
return *settings ? 0 : -1;
}
+
+
+int slbt_host_objfmt_is_coff(const struct slbt_driver_ctx * dctx)
+{
+ const char * flavor = dctx->cctx->host.flavor;
+
+ return !strcmp(flavor,"midipix")
+ || !strcmp(flavor,"mingw")
+ || !strcmp(flavor,"cygwin")
+ || !strcmp(flavor,"msys");
+}
+
+
+int slbt_host_objfmt_is_macho(const struct slbt_driver_ctx * dctx)
+{
+ const char * flavor = dctx->cctx->host.flavor;
+
+ return !strcmp(flavor,"darwin");
+}
+
+
+int slbt_host_group_is_winnt(const struct slbt_driver_ctx * dctx)
+{
+ return slbt_host_objfmt_is_coff(dctx);
+}
+
+
+int slbt_host_group_is_darwin(const struct slbt_driver_ctx * dctx)
+{
+ return slbt_host_objfmt_is_macho(dctx);
+}