diff options
author | midipix <writeonce@midipix.org> | 2018-06-23 01:35:08 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2018-06-23 02:06:50 -0400 |
commit | 23b10108b56a851debb4d1e142e64b6d155e1fc3 (patch) | |
tree | 25820604a7e66553e014a6415142179a88f65820 /src/output | |
parent | 621608e6c6a0714966a4ceddaf5631d90db57d3f (diff) | |
download | slibtool-23b10108b56a851debb4d1e142e64b6d155e1fc3.tar.bz2 slibtool-23b10108b56a851debb4d1e142e64b6d155e1fc3.tar.xz |
driver: added slbt_output_features(), providing compatible --features output.
Diffstat (limited to 'src/output')
-rw-r--r-- | src/output/slbt_output_features.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/output/slbt_output_features.c b/src/output/slbt_output_features.c new file mode 100644 index 0000000..b0252fa --- /dev/null +++ b/src/output/slbt_output_features.c @@ -0,0 +1,40 @@ +/*******************************************************************/ +/* slibtool: a skinny libtool implementation, written in C */ +/* Copyright (C) 2016--2017 Z. Gilboa */ +/* Released under the Standard MIT License; see COPYING.SLIBTOOL. */ +/*******************************************************************/ + +#include <stdio.h> +#include <string.h> +#include <stdbool.h> + +#include <slibtool/slibtool.h> +#include "slibtool_errinfo_impl.h" + +static const char enable[] = "enable"; +static const char disable[] = "disable"; + +int slbt_output_features(const struct slbt_driver_ctx * dctx) +{ + const char * shared_option; + const char * static_option; + + shared_option = (dctx->cctx->drvflags & SLBT_DRIVER_DISABLE_SHARED) + ? disable : enable; + + static_option = (dctx->cctx->drvflags & SLBT_DRIVER_DISABLE_STATIC) + ? disable : enable; + + if (fprintf(stdout,"host: %s\n",dctx->cctx->host.host) < 0) + return SLBT_SYSTEM_ERROR(dctx); + + if (fprintf(stdout,"%s shared libraries\n",shared_option) < 0) + return SLBT_SYSTEM_ERROR(dctx); + + if (fprintf(stdout,"%s static libraries\n",static_option) < 0) + return SLBT_SYSTEM_ERROR(dctx); + + return fflush(stdout) + ? SLBT_SYSTEM_ERROR(dctx) + : 0; +} |