aboutsummaryrefslogtreecommitdiffstats
path: root/config.c
blob: 51da7db4ae21fa76cb123654006b1042efea75a2 (plain) (blame)
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
44
45
#define _POSIX_C_SOURCE 200112L
#define _FEATURE_CONFIG

#include <stdio.h>
#include <string.h>

#include "config.h"

#define QUOTE(m) #m
#define PUT_MACRO(m) \
	printf("%s-D%s=%s", n++ ? " " : "", #m, QUOTE(m))

int n = 0;

inline void puts_if(const char *s, int c) {
	if (c)
		printf("%s%s", n++ ? " " : "", s);
}

inline void endl() {
	if (n) {
		printf("\n");
		n = 0;
	}
}

int main(int argc, char **argv) {
	int i;

	for (i = 1; i < argc; i++) {
		if (!strcmp(argv[i], "-D")) {
			PUT_MACRO(EXIF_SUPPORT);
			PUT_MACRO(GIF_SUPPORT);
			endl();
		} else if (!strcmp(argv[i], "-l")) {
			puts_if("-lexif", EXIF_SUPPORT);
			puts_if("-lgif",  GIF_SUPPORT);
			endl();
		} else {
			fprintf(stderr, "%s: invalid argument: %s\n", argv[0], argv[i]);
			return 1;
		}
	}
	return 0;
}