Commit eb3a07ec eb3a07ec466ebc923230618d059bdb4c29b170b9 by Sergey Poznyakoff

Move `mailutils-config' functionality to `mu'. Retain `mailutils-config' for ba…

…ckward compatibility.

* config/.gitignore: Remove.
* config/Makefile.am: Remove.
* config/mailutils-config.c: Remove.
* config/maint.mk: Remove.
* config/mailutils.m4: Move to mu-aux/mailutils.m4
* mu-aux/Makefile.am (m4datadir, dist_m4data_DATA): New variables.

* Makefile.am (SUBDIRS) <config>: Remove.
* configure.ac (AC_CONFIG_FILES): Remove config.

* mu/mailutils-config: New file.
* mu/cflags.c: New file.
* mu/ldflags.c: New file.
* mu/Makefile.am (dist_bin_SCRIPTS, EXTRA_DIST): Add mailutils-config.
(mu_SOURCES): Add cflags.c and ldflags.c.
(AM_CPPFLAGS): New variable.
* mu/mu.c: Add new modes: cflags and ldflags.
* mu/mu.h (mutool_ldflags, mutool_cflags): New protos.
* po/POTFILES.in: Update.
1 parent 686a7344
...@@ -104,7 +104,6 @@ SUBDIRS = . \ ...@@ -104,7 +104,6 @@ SUBDIRS = . \
104 libmu_sieve\ 104 libmu_sieve\
105 $(PYTHON_DIR)\ 105 $(PYTHON_DIR)\
106 doc\ 106 doc\
107 config\
108 examples\ 107 examples\
109 mu\ 108 mu\
110 $(FRM_DIR)\ 109 $(FRM_DIR)\
......
1 .deps
2 .libs
3 Makefile
4 Makefile.in
5 mailutils-config
1 ## This file is part of GNU Mailutils.
2 ## Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software
3 ## Foundation, Inc.
4 ##
5 ## GNU Mailutils is free software; you can redistribute it and/or
6 ## modify it under the terms of the GNU General Public License as
7 ## published by the Free Software Foundation; either version 3, or (at
8 ## your option) any later version.
9 ##
10 ## GNU Mailutils is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
17
18 INCLUDES = @MU_APP_COMMON_INCLUDES@
19
20 bin_PROGRAMS = mailutils-config
21
22 mailutils_config_SOURCES = mailutils-config.c
23 mailutils_config_LDADD = \
24 ${MU_APP_LIBRARIES}\
25 ${MU_LIB_MAILUTILS}\
26 @MU_COMMON_LIBRARIES@
27
28 mailutils_config_CFLAGS = -DCOMPILE_FLAGS="\"-I$(includedir)\"" \
29 -I$(top_srcdir)/intl \
30 -I${top_srcdir}/lib \
31 -DLINK_FLAGS="\"-L$(libdir)\"" \
32 -DLINK_POSTFLAGS="\"$(MU_LINK_POSTFLAGS)\"" \
33 -DAUTHLIBS="\"$(MU_AUTHLIBS)\"" \
34 -DGUILE_LIBS="\"$(GUILE_LIBS)\"" \
35 -DPYTHON_LIBS="\"$(PYTHON_LIBS)\"" \
36 -DI18NLIBS="\"$(LIBINTL)\""
37
38 m4datadir = $(datadir)/aclocal
39 dist_m4data_DATA = mailutils.m4
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2002, 2007, 2009, 2010 Free Software
3 Foundation, Inc.
4
5 GNU Mailutils is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
8 any later version.
9
10 GNU Mailutils is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. */
17
18 #ifdef HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21 #include <string.h>
22 #include <mailutils/mailutils.h>
23 #include <mu_asprintf.h>
24 #include "mailutils/libargp.h"
25
26 static char doc[] = N_("GNU mailutils-config -- display compiler and loader options needed for building a program with mailutils.");
27 static char args_doc[] = N_("[arg...]");
28
29 static struct argp_option options[] = {
30 {"compile", 'c', NULL, 0,
31 N_("print C compiler flags to compile with"), 0},
32 {"link", 'l', NULL, 0,
33 N_("print libraries to link with; possible arguments are: auth, guile, "
34 "mbox, mh, maildir, mailer, imap, pop, sieve and all"), 0},
35 {"info", 'i', NULL, 0,
36 N_("print a list of configuration options used to build mailutils; "
37 "optional arguments are interpreted as a list of configuration "
38 "options to check for"), 0},
39 {"query", 'q', N_("FILE"), OPTION_ARG_OPTIONAL,
40 N_("query configuration values from FILE (default mailutils.rc)"),
41 0 },
42 {"verbose", 'v', NULL, 0,
43 N_("increase output verbosity"), 0},
44 {0, 0, 0, 0}
45 };
46
47 enum config_mode {
48 MODE_VOID,
49 MODE_COMPILE,
50 MODE_LINK,
51 MODE_INFO,
52 MODE_QUERY
53 };
54
55 enum config_mode mode;
56 int verbose;
57 char *query_config_file;
58
59 static error_t
60 parse_opt (int key, char *arg, struct argp_state *state)
61 {
62 switch (key)
63 {
64 case 'l':
65 mode = MODE_LINK;
66 break;
67
68 case 'c':
69 mode = MODE_COMPILE;
70 break;
71
72 case 'i':
73 mode = MODE_INFO;
74 break;
75
76 case 'q':
77 if (arg)
78 query_config_file = arg;
79 mode = MODE_QUERY;
80 break;
81
82 case 'v':
83 verbose++;
84 break;
85
86 default:
87 return ARGP_ERR_UNKNOWN;
88 }
89 return 0;
90 }
91
92 static struct argp argp = {
93 options,
94 parse_opt,
95 args_doc,
96 doc,
97 NULL,
98 NULL, NULL
99 };
100
101 static const char *argp_capa[] = {
102 "common",
103 "license",
104 NULL
105 };
106
107 #ifdef WITH_TLS
108 # define NEEDAUTH 1
109 #else
110 # define NEEDAUTH 0
111 #endif
112 #define NOTALL 2
113
114 struct lib_descr {
115 char *name;
116 char *libname;
117 int flags;
118 } lib_descr[] = {
119 { "mbox", "mu_mbox", 0 },
120 { "mh", "mu_mh", 0 },
121 { "maildir","mu_maildir", 0 },
122 { "imap", "mu_imap", NEEDAUTH },
123 { "pop", "mu_pop", NEEDAUTH },
124 { "nntp", "mu_nntp", 0 },
125 { "mailer", "mu_mailer", 0 },
126 { "sieve", "mu_sieve", NOTALL },
127 { NULL }
128 };
129
130 struct lib_entry {
131 int level;
132 char *ptr;
133 } lib_entry[16];
134
135 int nentry;
136
137 void
138 add_entry (int level, char *ptr)
139 {
140 int i;
141 if (nentry >= sizeof(lib_entry)/sizeof(lib_entry[0]))
142 {
143 mu_error (_("too many arguments"));
144 exit (1);
145 }
146
147 for (i = 0; i < nentry; i++)
148 if (strcmp (lib_entry[i].ptr, ptr) == 0)
149 return;
150 lib_entry[nentry].level = level;
151 lib_entry[nentry].ptr = ptr;
152 nentry++;
153 }
154
155 /* Sort the entries by their level. */
156 void
157 sort_entries ()
158 {
159 int j;
160
161 for (j = 0; j < nentry; j++)
162 {
163 int i;
164
165 for (i = j; i < nentry; i++)
166 if (lib_entry[j].level > lib_entry[i].level)
167 {
168 struct lib_entry tmp;
169 tmp = lib_entry[i];
170 lib_entry[i] = lib_entry[j];
171 lib_entry[j] = tmp;
172 }
173
174 }
175 }
176
177 int
178 main (int argc, char **argv)
179 {
180 int index;
181 int i, rc;
182 struct argp *myargp;
183 char **excapa;
184 mu_cfg_tree_t *tree = NULL;
185 mu_stream_t stream;
186 int fmtflags = 0;
187
188 mu_argp_init (NULL, NULL);
189
190 mu_set_program_name (argv[0]);
191 mu_libargp_init ();
192 for (i = 0; argp_capa[i]; i++)
193 mu_gocs_register_std (argp_capa[i]); /*FIXME*/
194 myargp = mu_argp_build (&argp, &excapa);
195
196 if (argp_parse (myargp, argc, argv, 0, &index, NULL))
197 {
198 argp_help (myargp, stdout, ARGP_HELP_SEE, program_invocation_short_name);
199 return 1;
200 }
201 mu_argp_done (myargp);
202 mu_set_program_name (program_invocation_name);
203
204 argc -= index;
205 argv += index;
206
207 switch (mode)
208 {
209 case MODE_VOID:
210 break;
211
212 case MODE_LINK:
213 {
214 int j;
215 char *ptr;
216
217 add_entry (-100, LINK_FLAGS);
218 add_entry (100, LINK_POSTFLAGS);
219 add_entry (1, "-lmailutils");
220 #ifdef ENABLE_NLS
221 if (sizeof (I18NLIBS) > 1)
222 add_entry (10, I18NLIBS);
223 #endif
224
225 for ( ; argc > 0; argc--, argv++)
226 {
227 if (strcmp (argv[0], "auth") == 0)
228 {
229 add_entry (2, "-lmu_auth " AUTHLIBS);
230 }
231 #ifdef WITH_GUILE
232 else if (strcmp (argv[0], "guile") == 0)
233 {
234 add_entry (-1, "-lmu_scm " GUILE_LIBS);
235 }
236 #endif
237 #ifdef WITH_PYTHON
238 else if (strcmp (argv[0], "python") == 0)
239 {
240 add_entry (-1, "-lmu_py " PYTHON_LIBS);
241 }
242 #endif
243 else if (strcmp (argv[0], "cfg") == 0)
244 add_entry (-1, "-lmu_cfg");
245 else if (strcmp (argv[0], "argp") == 0)
246 add_entry (-2, "-lmu_argp");
247 else if (strcmp (argv[0], "all") == 0)
248 {
249 struct lib_descr *p;
250
251 for (p = lib_descr; p->name; p++)
252 {
253 if (p->flags & NOTALL)
254 continue;
255 asprintf (&ptr, "-l%s", p->libname);
256 add_entry (0, ptr);
257 if (p->flags & NEEDAUTH)
258 add_entry (2, "-lmu_auth " AUTHLIBS);
259 }
260 }
261 else
262 {
263 struct lib_descr *p;
264
265 for (p = lib_descr; p->name; p++)
266 if (mu_c_strcasecmp (p->name, argv[0]) == 0)
267 break;
268
269 if (p->name)
270 {
271 asprintf (&ptr, "-l%s", p->libname);
272 add_entry (0, ptr);
273 if (p->flags & NEEDAUTH)
274 add_entry (2, "-lmu_auth " AUTHLIBS);
275 }
276 else
277 {
278 argp_help (&argp, stdout, ARGP_HELP_USAGE,
279 program_invocation_short_name);
280 return 1;
281 }
282 }
283 }
284
285 sort_entries ();
286
287 /* At least one entry is always present */
288 printf ("%s", lib_entry[0].ptr);
289
290 /* Print the rest of them separated by a space */
291 for (j = 1; j < nentry; j++)
292 {
293 printf (" %s", lib_entry[j].ptr);
294 }
295 printf ("\n");
296 return 0;
297 }
298
299 case MODE_COMPILE:
300 if (argc != 0)
301 break;
302 printf ("%s\n", COMPILE_FLAGS);
303 return 0;
304
305 case MODE_INFO:
306 if (argc == 0)
307 mu_fprint_options (stdout, verbose);
308 else
309 {
310 int i, found = 0;
311
312 for (i = 0; i < argc; i++)
313 {
314 const struct mu_conf_option *opt = mu_check_option (argv[i]);
315 if (opt)
316 {
317 found++;
318 mu_fprint_conf_option (stdout, opt, verbose);
319 }
320 }
321 return found == argc ? 0 : 1;
322 }
323 return 0;
324
325 case MODE_QUERY:
326 if (argc == 0)
327 {
328 mu_error (_("not enough arguments"));
329 return 1;
330 }
331
332 if (query_config_file)
333 {
334 mu_load_site_rcfile = 0;
335 mu_load_user_rcfile = 0;
336 mu_load_rcfile = query_config_file;
337 }
338
339 if (mu_libcfg_parse_config (&tree))
340 exit (1);
341 if (!tree)
342 exit (0);
343 rc = mu_stdio_stream_create (&stream, MU_STDOUT_FD, 0);
344 if (rc)
345 {
346 mu_error ("mu_stdio_stream_create: %s", mu_strerror (rc));
347 exit (1);
348 }
349 if (verbose)
350 fmtflags = MU_CFG_FMT_LOCUS;
351 for ( ; argc > 0; argc--, argv++)
352 {
353 char *path = *argv;
354 mu_cfg_node_t *node;
355
356 if (mu_cfg_find_node (tree, path, &node) == 0)
357 {
358 mu_cfg_format_node (stream, node, fmtflags);
359 }
360 }
361 exit (0);
362 }
363
364 argp_help (&argp, stdout, ARGP_HELP_USAGE, program_invocation_short_name);
365 return 0;
366 }
367
1 # This file is part of GNU Mailutils.
2 # Copyright (C) 2009, 2010 Free Software Foundation, Inc.
3 #
4 # Written by Sergey Poznyakoff
5 #
6 # GNU Mailutils is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3, or (at your option)
9 # any later version.
10 #
11 # GNU Mailutils is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
18
19 include Makefile
20 mailutils_config_CFLOW_INPUT=$(mailutils_config_SOURCES)
21 mailutils-config.cflow: $(mailutils_config_CFLOW_INPUT) Makefile
22 cflow -o$@ $(CFLOW_FLAGS) $(DEFS) \
23 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
24 $(CPPFLAGS) \
25 $(mailutils_config_CFLOW_INPUT)
26
27 flowgraph: mailutils-config.cflow
28 maintclean:
29 rm -f mailutils-config.cflow
...@@ -1337,7 +1337,6 @@ AC_CONFIG_FILES([ ...@@ -1337,7 +1337,6 @@ AC_CONFIG_FILES([
1337 Makefile 1337 Makefile
1338 sql/Makefile 1338 sql/Makefile
1339 comsat/Makefile 1339 comsat/Makefile
1340 config/Makefile
1341 doc/Makefile 1340 doc/Makefile
1342 doc/man/Makefile 1341 doc/man/Makefile
1343 doc/texinfo/Makefile 1342 doc/texinfo/Makefile
......
1 cfg_lexer.c 1 lexer.c
2 cfg_parser.c 2 parser.c
3 cfg_parser.h 3 parser.h
......
...@@ -24,3 +24,5 @@ EXTRA_DIST = \ ...@@ -24,3 +24,5 @@ EXTRA_DIST = \
24 sqlmod.sh\ 24 sqlmod.sh\
25 generr.awk 25 generr.awk
26 26
27 m4datadir = $(datadir)/aclocal
28 dist_m4data_DATA = mailutils.m4
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
16 ## along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. 16 ## along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
17 17
18 bin_PROGRAMS = mu 18 bin_PROGRAMS = mu
19 dist_bin_SCRIPTS = mailutils-config
19 20
20 if MU_COND_SUPPORT_POP 21 if MU_COND_SUPPORT_POP
21 POP_C=pop.c 22 POP_C=pop.c
...@@ -25,11 +26,13 @@ EXTRA_DIST=pop.c ...@@ -25,11 +26,13 @@ EXTRA_DIST=pop.c
25 26
26 mu_SOURCES = \ 27 mu_SOURCES = \
27 acl.c\ 28 acl.c\
29 cflags.c\
28 info.c\ 30 info.c\
29 mu.h\ 31 mu.h\
30 mu.c\ 32 mu.c\
31 filter.c\ 33 filter.c\
32 flt2047.c\ 34 flt2047.c\
35 ldflags.c\
33 $(POP_C)\ 36 $(POP_C)\
34 query.c\ 37 query.c\
35 shell.c\ 38 shell.c\
...@@ -50,3 +53,11 @@ mu_LDADD = \ ...@@ -50,3 +53,11 @@ mu_LDADD = \
50 @READLINE_LIBS@ @MU_COMMON_LIBRARIES@ 53 @READLINE_LIBS@ @MU_COMMON_LIBRARIES@
51 54
52 INCLUDES = @MU_APP_COMMON_INCLUDES@ @MU_AUTHINCS@ 55 INCLUDES = @MU_APP_COMMON_INCLUDES@ @MU_AUTHINCS@
56 AM_CPPFLAGS = \
57 -DCOMPILE_FLAGS="\"-I$(includedir)\"" \
58 -DLINK_FLAGS="\"-L$(libdir)\"" \
59 -DLINK_POSTFLAGS="\"$(MU_LINK_POSTFLAGS)\"" \
60 -DAUTHLIBS="\"$(MU_AUTHLIBS)\"" \
61 -DGUILE_LIBS="\"$(GUILE_LIBS)\"" \
62 -DPYTHON_LIBS="\"$(PYTHON_LIBS)\"" \
63 -DI18NLIBS="\"$(LIBINTL)\""
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2010 Free Software Foundation, Inc.
3
4 GNU Mailutils is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
7 any later version.
8
9 GNU Mailutils is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. */
16
17 #if defined(HAVE_CONFIG_H)
18 # include <config.h>
19 #endif
20 #include <stdlib.h>
21 #include <mailutils/mailutils.h>
22 #include <mailutils/libcfg.h>
23 #include <argp.h>
24
25 static char cflags_doc[] = N_("mu cflags - show compiler options");
26
27 static struct argp cflags_argp = {
28 NULL,
29 NULL,
30 NULL,
31 cflags_doc,
32 NULL,
33 NULL,
34 NULL
35 };
36
37 int
38 mutool_cflags (int argc, char **argv)
39 {
40 if (argp_parse (&cflags_argp, argc, argv, ARGP_IN_ORDER, NULL, NULL))
41 return 1;
42 printf ("%s\n", COMPILE_FLAGS);
43 return 0;
44 }
45
46
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2010 Free Software Foundation, Inc.
3
4 GNU Mailutils is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
7 any later version.
8
9 GNU Mailutils is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. */
16
17 #if defined(HAVE_CONFIG_H)
18 # include <config.h>
19 #endif
20 #include <stdlib.h>
21 #include <mailutils/mailutils.h>
22 #include <mailutils/libcfg.h>
23 #include <argp.h>
24
25 static char ldflags_doc[] = N_("mu ldflags - list libraries required to link");
26 static char ldflags_args_doc[] = N_("KEYWORD [KEYWORD...]");
27
28 static struct argp ldflags_argp = {
29 NULL,
30 NULL,
31 ldflags_args_doc,
32 ldflags_doc,
33 NULL,
34 NULL,
35 NULL
36 };
37
38
39 #ifdef WITH_TLS
40 # define NEEDAUTH 1
41 #else
42 # define NEEDAUTH 0
43 #endif
44 #define NOTALL 2
45
46 struct lib_descr {
47 char *name;
48 char *libname;
49 int flags;
50 } lib_descr[] = {
51 { "mbox", "mu_mbox", 0 },
52 { "mh", "mu_mh", 0 },
53 { "maildir","mu_maildir", 0 },
54 { "imap", "mu_imap", NEEDAUTH },
55 { "pop", "mu_pop", NEEDAUTH },
56 { "nntp", "mu_nntp", 0 },
57 { "mailer", "mu_mailer", 0 },
58 { "sieve", "mu_sieve", NOTALL },
59 { NULL }
60 };
61
62 struct lib_entry {
63 int level;
64 char *ptr;
65 } lib_entry[16];
66
67 int nentry;
68
69 void
70 add_entry (int level, char *ptr)
71 {
72 int i;
73 if (nentry >= sizeof(lib_entry)/sizeof(lib_entry[0]))
74 {
75 mu_error (_("too many arguments"));
76 exit (1);
77 }
78
79 for (i = 0; i < nentry; i++)
80 if (strcmp (lib_entry[i].ptr, ptr) == 0)
81 return;
82 lib_entry[nentry].level = level;
83 lib_entry[nentry].ptr = ptr;
84 nentry++;
85 }
86
87 /* Sort the entries by their level. */
88 void
89 sort_entries ()
90 {
91 int j;
92
93 for (j = 0; j < nentry; j++)
94 {
95 int i;
96
97 for (i = j; i < nentry; i++)
98 if (lib_entry[j].level > lib_entry[i].level)
99 {
100 struct lib_entry tmp;
101 tmp = lib_entry[i];
102 lib_entry[i] = lib_entry[j];
103 lib_entry[j] = tmp;
104 }
105 }
106 }
107
108
109 int
110 mutool_ldflags (int argc, char **argv)
111 {
112 int i, j;
113 char *ptr;
114
115 if (argp_parse (&ldflags_argp, argc, argv, ARGP_IN_ORDER, &i, NULL))
116 return 1;
117
118 argc -= i;
119 argv += i;
120
121 add_entry (-100, LINK_FLAGS);
122 add_entry (100, LINK_POSTFLAGS);
123 add_entry (1, "-lmailutils");
124 #ifdef ENABLE_NLS
125 if (sizeof (I18NLIBS) > 1)
126 add_entry (10, I18NLIBS);
127 #endif
128
129 for ( ; argc > 0; argc--, argv++)
130 {
131 if (strcmp (argv[0], "auth") == 0)
132 add_entry (2, "-lmu_auth " AUTHLIBS);
133 #ifdef WITH_GUILE
134 else if (strcmp (argv[0], "guile") == 0)
135 add_entry (-1, "-lmu_scm " GUILE_LIBS);
136 #endif
137 #ifdef WITH_PYTHON
138 else if (strcmp (argv[0], "python") == 0)
139 add_entry (-1, "-lmu_py " PYTHON_LIBS);
140 #endif
141 else if (strcmp (argv[0], "cfg") == 0)
142 add_entry (-1, "-lmu_cfg");
143 else if (strcmp (argv[0], "argp") == 0)
144 add_entry (-2, "-lmu_argp");
145 else if (strcmp (argv[0], "all") == 0)
146 {
147 struct lib_descr *p;
148
149 for (p = lib_descr; p->name; p++)
150 {
151 if (p->flags & NOTALL)
152 continue;
153 asprintf (&ptr, "-l%s", p->libname);
154 add_entry (0, ptr);
155 if (p->flags & NEEDAUTH)
156 add_entry (2, "-lmu_auth " AUTHLIBS);
157 }
158 }
159 else
160 {
161 struct lib_descr *p;
162
163 for (p = lib_descr; p->name; p++)
164 if (mu_c_strcasecmp (p->name, argv[0]) == 0)
165 break;
166
167 if (p->name)
168 {
169 asprintf (&ptr, "-l%s", p->libname);
170 add_entry (0, ptr);
171 if (p->flags & NEEDAUTH)
172 add_entry (2, "-lmu_auth " AUTHLIBS);
173 }
174 else
175 {
176 mu_error (_("unknown keyword: %s"), argv[0]);
177 return 1;
178 }
179 }
180 }
181
182 sort_entries ();
183
184 /* At least one entry is always present */
185 printf ("%s", lib_entry[0].ptr);
186
187 /* Print the rest of them separated by a space */
188 for (j = 1; j < nentry; j++)
189 printf (" %s", lib_entry[j].ptr);
190 putchar ('\n');
191 return 0;
192 }
193
1 #! /bin/sh
2 # A deprecated interface to GNU Mailutils configuration facilities.
3 # Copyright (C) 2010 Free Software Foundation, Inc.
4 #
5 # GNU Mailutils is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License as
7 # published by the Free Software Foundation; either version 2, or (at
8 # your option) any later version.
9 #
10 # GNU Mailutils is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
17
18 mode=
19 file=
20 dir=`expr "$0" : '\(.*\)/.*'`
21
22 test -n "$dir" && PATH=$PATH:$dir
23
24 usage() {
25 cat <<EOT
26 This is a deprecated interface to GNU Mailutils configuration facilities.
27 It will be removed in future versions. Please, consider using these
28 alternatives instead:
29
30 Traditional usage | Use instead
31 ------------------------------+-------------------
32 mailutils-config --compile | mu cflags
33 mailutils-config --link | mu ldflags
34 mailutils-config --info | mu info
35 mailutils-config --query | mu query
36 mailutils-config --query=FILE | mu query -f FILE
37
38 For more information, try \`mu --help'.
39
40 EOT
41 exit 0
42 }
43
44 while test $# -ne 0
45 do
46 arg=$1
47 shift
48 case $arg in
49 -c|--c|--co|--com|--comp|--compil|--compile)
50 mode=cflags
51 break
52 ;;
53 -i|--i|--in|--inf|--info)
54 mode=info
55 break
56 ;;
57 -l|--l|--li|--lin|--link)
58 mode=ldflags
59 break
60 ;;
61 --)
62 break
63 ;;
64 -q*=*|--q*=*)
65 opt=`expr "$arg" : '\(.*\)='`
66 arg=`expr "$arg" : '.*=\(.*\)'`
67 case $opt in
68 -q|--q|--qu|--que|--quer|--query)
69 mode=query
70 file=arg
71 break
72 ;;
73 *)
74 echo >&2 "$0: invalid option: $1"
75 exit 1
76 esac
77 ;;
78 -q|--q|--qu|--que|--quer|--query)
79 mode=query
80 break
81 ;;
82 -q*)
83 mode=query
84 file=`expr "$arg" : '-q\(.*\)'`
85 break
86 ;;
87 --usage|--u|--us|--usa|--usag|--help|--hel|--he|--h)
88 usage
89 ;;
90 -V|--version|--versio|--versi|--vers|--ver|--ve|--v)
91 mu --version | sed -n '1{s/^mu/mailutils-config/;s/(\(GNU Mailutils\)) \([0-9][0-9.]*\).*/(\1 \2)/;p}'
92 exit 0
93 ;;
94 *)
95 echo >&2 "$0: unexpected argument; try \`$0 --usage' for help"
96 exit 1
97 ;;
98 esac
99 done
100
101 if test -z "$mode"; then
102 usage
103 fi
104
105 if test -n "$file"; then
106 set -- -f"$file" $*
107 fi
108
109 mu $mode $*
...@@ -34,6 +34,8 @@ Commands are:\n\ ...@@ -34,6 +34,8 @@ Commands are:\n\
34 mu 2047 - decode/encode message headers as per RFC 2047\n\ 34 mu 2047 - decode/encode message headers as per RFC 2047\n\
35 mu acl - test access control lists\n\ 35 mu acl - test access control lists\n\
36 mu wicket - find matching URL in wicket\n\ 36 mu wicket - find matching URL in wicket\n\
37 mu ldflags- list libraries required to link\n\
38 mu cflags - list compiler flags\n\
37 \n\ 39 \n\
38 Try `mu COMMAND --help' to get help on a particular COMMAND.\n\ 40 Try `mu COMMAND --help' to get help on a particular COMMAND.\n\
39 \n\ 41 \n\
...@@ -108,6 +110,8 @@ struct mutool_action_tab mutool_action_tab[] = { ...@@ -108,6 +110,8 @@ struct mutool_action_tab mutool_action_tab[] = {
108 { "query", mutool_query }, 110 { "query", mutool_query },
109 { "acl", mutool_acl }, 111 { "acl", mutool_acl },
110 { "wicket", mutool_wicket }, 112 { "wicket", mutool_wicket },
113 { "ldflags", mutool_ldflags },
114 { "cflags", mutool_cflags },
111 { NULL } 115 { NULL }
112 }; 116 };
113 117
......
...@@ -36,7 +36,9 @@ int mutool_info (int argc, char **argv); ...@@ -36,7 +36,9 @@ int mutool_info (int argc, char **argv);
36 int mutool_query (int argc, char **argv); 36 int mutool_query (int argc, char **argv);
37 int mutool_acl (int argc, char **argv); 37 int mutool_acl (int argc, char **argv);
38 int mutool_wicket (int argc, char **argv); 38 int mutool_wicket (int argc, char **argv);
39 39 int mutool_ldflags (int argc, char **argv);
40 int mutool_cflags (int argc, char **argv);
41
40 extern char *mutool_shell_prompt; 42 extern char *mutool_shell_prompt;
41 extern mu_vartab_t mutool_prompt_vartab; 43 extern mu_vartab_t mutool_prompt_vartab;
42 extern int mutool_shell_interactive; 44 extern int mutool_shell_interactive;
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
7 comsat/action.c 7 comsat/action.c
8 comsat/comsat.c 8 comsat/comsat.c
9 9
10 config/mailutils-config.c
11
12 dotlock/dotlock.c 10 dotlock/dotlock.c
13 11
14 frm/common.c 12 frm/common.c
...@@ -213,6 +211,9 @@ mu/mu.c ...@@ -213,6 +211,9 @@ mu/mu.c
213 mu/pop.c 211 mu/pop.c
214 mu/query.c 212 mu/query.c
215 mu/shell.c 213 mu/shell.c
214 mu/cflags.c
215 mu/ldflags.c
216 mu/wicket.c
216 217
217 # EOF 218 # EOF
218 219
......