/[zanavi_public1]/navit/navit/maptool/libcfu-0.03-zanavi/src/libcfu-config.c
ZANavi

Contents of /navit/navit/maptool/libcfu-0.03-zanavi/src/libcfu-config.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Mon Feb 4 17:41:59 2013 UTC (11 years, 1 month ago) by zoff99
File MIME type: text/plain
File size: 2064 byte(s)
new map version, lots of fixes and experimental new features
1 /* Creation date: 2005-08-07 13:34:49
2 * Authors: Don
3 * Change log:
4 */
5
6 #include <string.h>
7 #include <stdio.h>
8 #include <stdlib.h>
9
10 #include "cfu.h"
11 #include "cfuopt.h"
12
13 #define GET_PREFIX CFU_PREFIX
14 #define GET_EXEC_PREFIX CFU_EXEC_PREFIX
15 #define GET_VERSION LIBCFU_VERSION
16 #define GET_LIBS "-L" CFU_LIBDIR " -lcfu " CFU_LIBS
17 #define GET_CFLAGS "-I" CFU_INCLUDEDIR
18
19 static void
20 print_usage() {
21 fprintf(stderr, "Usage: libcfu-config [OPTIONS]\n");
22 fprintf(stderr, "Options:\n");
23 fprintf(stderr, " --prefix [%s]\n", GET_PREFIX);
24 fprintf(stderr, " --exec-prefix [%s]\n", GET_EXEC_PREFIX);
25 fprintf(stderr, " --version [%s]\n", GET_VERSION);
26 fprintf(stderr, " --libs [%s]\n", GET_LIBS);
27 fprintf(stderr, " --cflags [%s]\n", GET_CFLAGS);
28 }
29
30 int main(int argc, char **argv) {
31 char *arg = NULL;
32 int do_prefix = 0;
33 int do_exec_prefix = 0;
34 int do_version = 0;
35 int do_libs = 0;
36 int do_cflags = 0;
37 cfuopt_t *options = cfuopt_new();
38 char *error = NULL;
39
40 cfuopt_add_entry(options, "prefix!", &do_prefix, "Display install prefix", NULL);
41 cfuopt_add_entry(options, "exec-prefix!", &do_exec_prefix, "Display install prefix for executables", NULL);
42 cfuopt_add_entry(options, "version!", &do_version, "Display library version", NULL);
43 cfuopt_add_entry(options, "libs!", &do_libs, "Display libraries required for linking with this library", NULL);
44 cfuopt_add_entry(options, "cflags", &do_cflags, "Display CFLAGS required for compilation", NULL);
45
46 if (argc < 2) {
47 print_usage();
48 exit(1);
49 }
50
51 cfuopt_parse(options, &argc, &argv, &error);
52
53 arg = argv[1];
54
55 if (do_prefix) {
56 fprintf(stdout, "%s\n", GET_PREFIX);
57 } else if (do_exec_prefix) {
58 fprintf(stdout, "%s\n", GET_EXEC_PREFIX);
59 } else if (do_version) {
60 fprintf(stdout, "%s\n", GET_VERSION);
61 } else if (do_libs) {
62 fprintf(stdout, "%s\n", GET_LIBS);
63 } else if (do_cflags) {
64 fprintf(stdout, "%s\n", GET_CFLAGS);
65 } else {
66 print_usage();
67 cfuopt_destroy(options);
68 exit(1);
69 }
70
71 cfuopt_destroy(options);
72
73 return 0;
74 }

   
Visit the ZANavi Wiki