summaryrefslogtreecommitdiffstats
path: root/config.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-09-13 10:08:35 +0200
committerBert <ber.t@gmx.com>2011-09-13 10:08:35 +0200
commit81cfbf171dfd11c6f8a4d277159ee077b5ca0255 (patch)
treec971f0309dd388985cab2a94f3a7fb3452318400 /config.c
parent255dd5bbcda9de790e543ef8c658cfab942ab71f (diff)
downloadnsxiv-81cfbf171dfd11c6f8a4d277159ee077b5ca0255.tar.zst
Renamed XLIBS to config, added -D/-l options
Diffstat (limited to 'config.c')
-rw-r--r--config.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/config.c b/config.c
new file mode 100644
index 0000000..51da7db
--- /dev/null
+++ b/config.c
@@ -0,0 +1,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;
+}