Krolyxon
Commit 81cfbf1

Branches

Refs →

nsxivconfig.c

45 lines · 783 B · C

1#define _POSIX_C_SOURCE 200112L
2#define _FEATURE_CONFIG
3
4#include <stdio.h>
5#include <string.h>
6
7#include "config.h"
8
9#define QUOTE(m) #m
10#define PUT_MACRO(m) \
11 printf("%s-D%s=%s", n++ ? " " : "", #m, QUOTE(m))
12
13int n = 0;
14
15inline void puts_if(const char *s, int c) {
16 if (c)
17 printf("%s%s", n++ ? " " : "", s);
18}
19
20inline void endl() {
21 if (n) {
22 printf("\n");
23 n = 0;
24 }
25}
26
27int main(int argc, char **argv) {
28 int i;
29
30 for (i = 1; i < argc; i++) {
31 if (!strcmp(argv[i], "-D")) {
32 PUT_MACRO(EXIF_SUPPORT);
33 PUT_MACRO(GIF_SUPPORT);
34 endl();
35 } else if (!strcmp(argv[i], "-l")) {
36 puts_if("-lexif", EXIF_SUPPORT);
37 puts_if("-lgif", GIF_SUPPORT);
38 endl();
39 } else {
40 fprintf(stderr, "%s: invalid argument: %s\n", argv[0], argv[i]);
41 return 1;
42 }
43 }
44 return 0;
45}