1/*
2 * Compile-time options
3 */
4
5#include "ctwm.h"
6
7#include <stdio.h>
8#include <stdlib.h>
9#include <string.h>
10
11#include "ctopts.h"
12
13
14/*
15 * What options we're build with
16 */
17static char *ctopts[] = {
18	"I18N",     // Used to be optional, now standard.  Remove?
19#ifdef XPM
20	"XPM",
21#endif
22#ifdef JPEG
23	"JPEG",
24#endif
25#ifdef USEM4
26	"USEM4",
27#endif
28#ifdef SOUNDS
29	"SOUNDS",
30#endif
31#ifdef EWMH
32	"EWMH",
33#endif
34#ifdef XRANDR
35	"XRANDR",
36#endif
37#ifdef DEBUG
38	"DEBUG",
39#endif
40	NULL
41};
42
43
44/*
45 * Build a string of our compile-time opts
46 */
47char *
48ctopts_string(char *sep)
49{
50	char *cto;
51	size_t slen, tlen;
52	int i;
53
54	/* Figure out how long our string would be */
55	slen = strlen(sep);
56	tlen = 0;
57	i = -1;
58	while(ctopts[++i]) {
59		tlen += strlen(ctopts[i]);
60		if(i > 0) {
61			tlen += slen;
62		}
63	}
64
65	/* Now make it */
66	cto = malloc(tlen + 1);
67	*cto = '\0';
68	i = -1;
69	while(ctopts[++i]) {
70		if(i > 0) {
71			strcat(cto, sep);
72		}
73		strcat(cto, ctopts[i]);
74	}
75
76	return cto;
77}
78