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