1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
5 /* Copyright (c) Jeremy Harris 2017 */
6 /* See the file NOTICE for conditions of use and distribution. */
8 /* Create a static data structure with the predefined macros, to be
9 included in the main Exim build */
12 #include "macro_predef.h"
14 unsigned mp_index
= 0;
16 /* Global dummy variables */
18 void fn_smtp_receive_timeout(const uschar
* name
, const uschar
* str
) {}
19 uschar
* syslog_facility_str
;
21 /******************************************************************************/
24 builtin_macro_create(const uschar
* name
)
26 printf ("static macro_item p%d = { ", mp_index
);
30 printf("&p%d,", mp_index
-1);
32 printf(" FALSE, %d, \"%s\", \"y\" };\n", Ustrlen(name
), name
);
37 spf(uschar
* buf
, int len
, const uschar
* fmt
, ...)
42 while (*fmt
&& len
> 1)
43 if (*fmt
== '%' && fmt
[1] == 'T')
45 uschar
* s
= va_arg(ap
, uschar
*);
46 while (*s
&& len
-- > 1)
47 *buf
++ = toupper(*s
++);
52 *buf
++ = *fmt
++; len
--;
59 options_from_list(optionlist
* opts
, unsigned nopt
,
60 const uschar
* section
, uschar
* group
)
66 /* The 'previously-defined-substring' rule for macros in config file
67 lines is done thus for these builtin macros: we know that the table
68 we source from is in strict alpha order, hence the builtins portion
69 of the macros list is in reverse-alpha (we prepend them) - so longer
70 macros that have substrings are always discovered first during
73 for (i
= 0; i
< nopt
; i
++) if (*(s
= US opts
[i
].name
) && *s
!= '*')
76 spf(buf
, sizeof(buf
), "_OPT_%T_%T_%T", section
, group
, s
);
78 spf(buf
, sizeof(buf
), "_OPT_%T_%T", section
, s
);
79 builtin_macro_create(buf
);
84 /******************************************************************************/
87 /* Create compile-time feature macros */
91 /* Probably we could work out a static initialiser for wherever
92 macros are stored, but this will do for now. Some names are awkward
93 due to conflicts with other common macros. */
95 #ifdef SUPPORT_CRYPTEQ
96 builtin_macro_create(US
"_HAVE_CRYPTEQ");
99 builtin_macro_create(US
"_HAVE_ICONV");
102 builtin_macro_create(US
"_HAVE_IPV6");
104 #ifdef HAVE_SETCLASSRESOURCES
105 builtin_macro_create(US
"_HAVE_SETCLASSRESOURCES");
108 builtin_macro_create(US
"_HAVE_PAM");
111 builtin_macro_create(US
"_HAVE_PERL");
114 builtin_macro_create(US
"_HAVE_DLFUNC");
116 #ifdef USE_TCP_WRAPPERS
117 builtin_macro_create(US
"_HAVE_TCPWRAPPERS");
120 builtin_macro_create(US
"_HAVE_TLS");
122 builtin_macro_create(US
"_HAVE_GNUTLS");
124 builtin_macro_create(US
"_HAVE_OPENSSL");
127 #ifdef SUPPORT_TRANSLATE_IP_ADDRESS
128 builtin_macro_create(US
"_HAVE_TRANSLATE_IP_ADDRESS");
130 #ifdef SUPPORT_MOVE_FROZEN_MESSAGES
131 builtin_macro_create(US
"_HAVE_MOVE_FROZEN_MESSAGES");
133 #ifdef WITH_CONTENT_SCAN
134 builtin_macro_create(US
"_HAVE_CONTENT_SCANNING");
137 builtin_macro_create(US
"_HAVE_DKIM");
139 #ifndef DISABLE_DNSSEC
140 builtin_macro_create(US
"_HAVE_DNSSEC");
142 #ifndef DISABLE_EVENT
143 builtin_macro_create(US
"_HAVE_EVENT");
146 builtin_macro_create(US
"_HAVE_I18N");
149 builtin_macro_create(US
"_HAVE_OCSP");
152 builtin_macro_create(US
"_HAVE_PRDR");
155 builtin_macro_create(US
"_HAVE_PROXY");
158 builtin_macro_create(US
"_HAVE_SOCKS");
161 builtin_macro_create(US
"_HAVE_TCP_FASTOPEN");
163 #ifdef EXPERIMENTAL_LMDB
164 builtin_macro_create(US
"_HAVE_LMDB");
166 #ifdef EXPERIMENTAL_SPF
167 builtin_macro_create(US
"_HAVE_SPF");
169 #ifdef EXPERIMENTAL_SRS
170 builtin_macro_create(US
"_HAVE_SRS");
172 #ifdef EXPERIMENTAL_BRIGHTMAIL
173 builtin_macro_create(US
"_HAVE_BRIGHTMAIL");
175 #ifdef EXPERIMENTAL_DANE
176 builtin_macro_create(US
"_HAVE_DANE");
178 #ifdef EXPERIMENTAL_DCC
179 builtin_macro_create(US
"_HAVE_DCC");
181 #ifdef EXPERIMENTAL_DMARC
182 builtin_macro_create(US
"_HAVE_DMARC");
184 #ifdef EXPERIMENTAL_DSN_INFO
185 builtin_macro_create(US
"_HAVE_DSN_INFO");
188 #ifdef LOOKUP_LSEARCH
189 builtin_macro_create(US
"_HAVE_LOOKUP_LSEARCH");
192 builtin_macro_create(US
"_HAVE_LOOKUP_CDB");
195 builtin_macro_create(US
"_HAVE_LOOKUP_DBM");
198 builtin_macro_create(US
"_HAVE_LOOKUP_DNSDB");
200 #ifdef LOOKUP_DSEARCH
201 builtin_macro_create(US
"_HAVE_LOOKUP_DSEARCH");
204 builtin_macro_create(US
"_HAVE_LOOKUP_IBASE");
207 builtin_macro_create(US
"_HAVE_LOOKUP_LDAP");
209 #ifdef EXPERIMENTAL_LMDB
210 builtin_macro_create(US
"_HAVE_LOOKUP_LMDB");
213 builtin_macro_create(US
"_HAVE_LOOKUP_MYSQL");
216 builtin_macro_create(US
"_HAVE_LOOKUP_NIS");
218 #ifdef LOOKUP_NISPLUS
219 builtin_macro_create(US
"_HAVE_LOOKUP_NISPLUS");
222 builtin_macro_create(US
"_HAVE_LOOKUP_ORACLE");
225 builtin_macro_create(US
"_HAVE_LOOKUP_PASSWD");
228 builtin_macro_create(US
"_HAVE_LOOKUP_PGSQL");
231 builtin_macro_create(US
"_HAVE_LOOKUP_REDIS");
234 builtin_macro_create(US
"_HAVE_LOOKUP_SQLITE");
237 builtin_macro_create(US
"_HAVE_LOOKUP_TESTDB");
240 builtin_macro_create(US
"_HAVE_LOOKUP_WHOSON");
243 #ifdef TRANSPORT_APPENDFILE
244 # ifdef SUPPORT_MAILDIR
245 builtin_macro_create(US
"_HAVE_TRANSPORT_APPEND_MAILDIR");
247 # ifdef SUPPORT_MAILSTORE
248 builtin_macro_create(US
"_HAVE_TRANSPORT_APPEND_MAILSTORE");
251 builtin_macro_create(US
"_HAVE_TRANSPORT_APPEND_MBX");
262 options_transports();
270 printf("#include \"exim.h\"\n");
274 printf("macro_item * macros = &p%d;\n", mp_index
-1);
275 printf("macro_item * mlast = &p0;\n");