summaryrefslogtreecommitdiff
path: root/src/output/slbt_output_features.c
blob: 577ca5a63987e544c3b1f38838287eb3f4b250fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*******************************************************************/
/*  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_driver_impl.h"
#include "slibtool_dprintf_impl.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)
{
	int          fdout;
	const char * shared_option;
	const char * static_option;

	fdout = slbt_driver_fdout(dctx);

	shared_option = (dctx->cctx->drvflags & SLBT_DRIVER_DISABLE_SHARED)
		? disable : enable;

	static_option = (dctx->cctx->drvflags & SLBT_DRIVER_DISABLE_STATIC)
		? disable : enable;

	if (slbt_dprintf(fdout,"host: %s\n",dctx->cctx->host.host) < 0)
		return SLBT_SYSTEM_ERROR(dctx);

	if (slbt_dprintf(fdout,"%s shared libraries\n",shared_option) < 0)
		return SLBT_SYSTEM_ERROR(dctx);

	if (slbt_dprintf(fdout,"%s static libraries\n",static_option) < 0)
		return SLBT_SYSTEM_ERROR(dctx);

	return 0;
}