~ctwm/ctwm/trunk

421.1.3 by Matthew Fuller
Add a more central list of compile-time options and the ability to
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
 */
17
static char *ctopts[] = {
18
	"I18N",     // Used to be optional, now standard.  Remove?
19
#ifdef XPM
20
	"XPM",
21
#endif
421.1.10 by Matthew Fuller
Include JPEG in the list of options we're running with.
22
#ifdef JPEG
23
	"JPEG",
24
#endif
421.1.3 by Matthew Fuller
Add a more central list of compile-time options and the ability to
25
#ifdef USEM4
26
	"USEM4",
27
#endif
28
#ifdef SOUNDS
29
	"SOUNDS",
30
#endif
31
#ifdef EWMH
32
	"EWMH",
33
#endif
614.1.13 by Maxime Soulé
Forgot XRANDR15 compile time option in win info + --info
34
#ifdef XRANDR
614.1.108 by Matthew Fuller
Don't specify version in the RANDR option; we don't need that much
35
	"XRANDR",
614.1.13 by Maxime Soulé
Forgot XRANDR15 compile time option in win info + --info
36
#endif
421.1.6 by Matthew Fuller
Trap building with DEBUG as well.
37
#ifdef DEBUG
38
	"DEBUG",
39
#endif
421.1.3 by Matthew Fuller
Add a more central list of compile-time options and the ability to
40
	NULL
41
};
42
43
44
/*
45
 * Build a string of our compile-time opts
46
 */
47
char *
48
ctopts_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;
421.1.11 by Matthew Fuller
Now with 'make indent'-ified style.
58
	while(ctopts[++i]) {
421.1.3 by Matthew Fuller
Add a more central list of compile-time options and the ability to
59
		tlen += strlen(ctopts[i]);
421.1.11 by Matthew Fuller
Now with 'make indent'-ified style.
60
		if(i > 0) {
421.1.3 by Matthew Fuller
Add a more central list of compile-time options and the ability to
61
			tlen += slen;
421.1.11 by Matthew Fuller
Now with 'make indent'-ified style.
62
		}
421.1.3 by Matthew Fuller
Add a more central list of compile-time options and the ability to
63
	}
64
65
	/* Now make it */
66
	cto = malloc(tlen + 1);
67
	*cto = '\0';
68
	i = -1;
421.1.11 by Matthew Fuller
Now with 'make indent'-ified style.
69
	while(ctopts[++i]) {
70
		if(i > 0) {
421.1.3 by Matthew Fuller
Add a more central list of compile-time options and the ability to
71
			strcat(cto, sep);
421.1.11 by Matthew Fuller
Now with 'make indent'-ified style.
72
		}
421.1.3 by Matthew Fuller
Add a more central list of compile-time options and the ability to
73
		strcat(cto, ctopts[i]);
74
	}
75
76
	return cto;
77
}