diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/util/gnunet-config.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index 797de0b0d..a195d6014 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c | |||
@@ -36,6 +36,23 @@ static char *backend_check; | |||
36 | 36 | ||
37 | 37 | ||
38 | /** | 38 | /** |
39 | * If printing the value of CFLAGS has been requested. | ||
40 | */ | ||
41 | static int cflags; | ||
42 | |||
43 | /** | ||
44 | * If printing the value of LIBS has been requested. | ||
45 | */ | ||
46 | static int libs; | ||
47 | |||
48 | /** | ||
49 | * If printing the value of PREFIX has been requested. | ||
50 | */ | ||
51 | static int prefix; | ||
52 | |||
53 | |||
54 | /** | ||
55 | * Print each option in a given section. | ||
39 | * Main task to run to perform operations typical for | 56 | * Main task to run to perform operations typical for |
40 | * gnunet-config as per the configuration settings | 57 | * gnunet-config as per the configuration settings |
41 | * given in @a cls. | 58 | * given in @a cls. |
@@ -54,6 +71,26 @@ run (void *cls, | |||
54 | { | 71 | { |
55 | struct GNUNET_CONFIGURATION_ConfigSettings *cs = cls; | 72 | struct GNUNET_CONFIGURATION_ConfigSettings *cs = cls; |
56 | 73 | ||
74 | if (1 == cflags || 1 == libs || 1 == prefix) | ||
75 | { | ||
76 | char *prefixdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_PREFIX); | ||
77 | char *libdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBDIR); | ||
78 | if (1 == cflags) | ||
79 | { | ||
80 | fprintf (stdout, "-I%sinclude\n", prefixdir); | ||
81 | } | ||
82 | if (1 == libs) | ||
83 | { | ||
84 | fprintf (stdout, "-L%s -lgnunetutil\n", libdir); | ||
85 | } | ||
86 | if (1 == prefix) | ||
87 | { | ||
88 | fprintf (stdout, "%s\n", prefixdir); | ||
89 | } | ||
90 | GNUNET_free (prefixdir); | ||
91 | GNUNET_free (libdir); | ||
92 | return; | ||
93 | } | ||
57 | if (NULL != backend_check) | 94 | if (NULL != backend_check) |
58 | { | 95 | { |
59 | char *name; | 96 | char *name; |
@@ -97,6 +134,21 @@ main (int argc, | |||
97 | gettext_noop ( | 134 | gettext_noop ( |
98 | "test if the current installation supports the specified BACKEND"), | 135 | "test if the current installation supports the specified BACKEND"), |
99 | &backend_check)), | 136 | &backend_check)), |
137 | GNUNET_GETOPT_option_flag ('C', | ||
138 | "cflags", | ||
139 | gettext_noop ( | ||
140 | "Provide an appropriate value for CFLAGS to applications building on top of GNUnet"), | ||
141 | &cflags), | ||
142 | GNUNET_GETOPT_option_flag ('j', | ||
143 | "libs", | ||
144 | gettext_noop ( | ||
145 | "Provide an appropriate value for LIBS to applications building on top of GNUnet"), | ||
146 | &libs), | ||
147 | GNUNET_GETOPT_option_flag ('p', | ||
148 | "prefix", | ||
149 | gettext_noop ( | ||
150 | "Provide the path under which GNUnet was installed"), | ||
151 | &prefix), | ||
100 | GNUNET_CONFIGURATION_CONFIG_OPTIONS (&cs), | 152 | GNUNET_CONFIGURATION_CONFIG_OPTIONS (&cs), |
101 | GNUNET_GETOPT_OPTION_END | 153 | GNUNET_GETOPT_OPTION_END |
102 | }; | 154 | }; |