84a33282dd0521b1b2d819cc025229cc71b6e3c5
1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
5 /* Copyright (c) Jeremy Harris 1995 - 2018 */
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_var(const uschar
* name
, const uschar
* val
)
26 printf ("static macro_item p%d = { ", mp_index
);
28 printf(".next=NULL,");
30 printf(".next=&p%d,", mp_index
-1);
32 printf(" .command_line=FALSE, .namelen=%d, .replen=%d,"
33 " .name=US\"%s\", .replacement=US\"%s\" };\n",
34 Ustrlen(name
), Ustrlen(val
), CS name
, CS val
);
40 builtin_macro_create(const uschar
* name
)
42 builtin_macro_create_var(name
, US
"y");
46 /* restricted snprintf */
48 spf(uschar
* buf
, int len
, const uschar
* fmt
, ...)
53 while (*fmt
&& len
> 1)
54 if (*fmt
== '%' && fmt
[1] == 'T')
56 uschar
* s
= va_arg(ap
, uschar
*);
57 while (*s
&& len
-- > 1)
58 *buf
++ = toupper(*s
++);
63 *buf
++ = *fmt
++; len
--;
70 options_from_list(optionlist
* opts
, unsigned nopt
,
71 const uschar
* section
, uschar
* group
)
76 /* The 'previously-defined-substring' rule for macros in config file
77 lines is done thus for these builtin macros: we know that the table
78 we source from is in strict alpha order, hence the builtins portion
79 of the macros list is in reverse-alpha (we prepend them) - so longer
80 macros that have substrings are always discovered first during
83 for (int i
= 0; i
< nopt
; i
++) if (*(s
= US opts
[i
].name
) && *s
!= '*')
86 spf(buf
, sizeof(buf
), CUS
"_OPT_%T_%T_%T", section
, group
, s
);
88 spf(buf
, sizeof(buf
), CUS
"_OPT_%T_%T", section
, s
);
89 builtin_macro_create(buf
);
94 /******************************************************************************/
97 /* Create compile-time feature macros */
101 /* Probably we could work out a static initialiser for wherever
102 macros are stored, but this will do for now. Some names are awkward
103 due to conflicts with other common macros. */
105 #ifdef SUPPORT_CRYPTEQ
106 builtin_macro_create(US
"_HAVE_CRYPTEQ");
109 builtin_macro_create(US
"_HAVE_ICONV");
112 builtin_macro_create(US
"_HAVE_IPV6");
114 #ifdef HAVE_SETCLASSRESOURCES
115 builtin_macro_create(US
"_HAVE_SETCLASSRESOURCES");
118 builtin_macro_create(US
"_HAVE_PAM");
121 builtin_macro_create(US
"_HAVE_PERL");
124 builtin_macro_create(US
"_HAVE_DLFUNC");
126 #ifdef USE_TCP_WRAPPERS
127 builtin_macro_create(US
"_HAVE_TCPWRAPPERS");
130 builtin_macro_create(US
"_HAVE_TLS");
132 builtin_macro_create(US
"_HAVE_GNUTLS");
134 builtin_macro_create(US
"_HAVE_OPENSSL");
137 #ifdef SUPPORT_TRANSLATE_IP_ADDRESS
138 builtin_macro_create(US
"_HAVE_TRANSLATE_IP_ADDRESS");
140 #ifdef SUPPORT_MOVE_FROZEN_MESSAGES
141 builtin_macro_create(US
"_HAVE_MOVE_FROZEN_MESSAGES");
143 #ifdef WITH_CONTENT_SCAN
144 builtin_macro_create(US
"_HAVE_CONTENT_SCANNING");
147 builtin_macro_create(US
"_HAVE_DKIM");
149 #ifndef DISABLE_DNSSEC
150 builtin_macro_create(US
"_HAVE_DNSSEC");
152 #ifndef DISABLE_EVENT
153 builtin_macro_create(US
"_HAVE_EVENT");
156 builtin_macro_create(US
"_HAVE_I18N");
159 builtin_macro_create(US
"_HAVE_OCSP");
162 builtin_macro_create(US
"_HAVE_PRDR");
165 builtin_macro_create(US
"_HAVE_PROXY");
168 builtin_macro_create(US
"_HAVE_SOCKS");
171 builtin_macro_create(US
"_HAVE_TCP_FASTOPEN");
173 #ifdef EXPERIMENTAL_LMDB
174 builtin_macro_create(US
"_HAVE_LMDB");
177 builtin_macro_create(US
"_HAVE_SPF");
179 #ifdef EXPERIMENTAL_SRS
180 builtin_macro_create(US
"_HAVE_SRS");
182 #ifdef EXPERIMENTAL_ARC
183 builtin_macro_create(US
"_HAVE_ARC");
185 #ifdef EXPERIMENTAL_BRIGHTMAIL
186 builtin_macro_create(US
"_HAVE_BRIGHTMAIL");
189 builtin_macro_create(US
"_HAVE_DANE");
191 #ifdef EXPERIMENTAL_DCC
192 builtin_macro_create(US
"_HAVE_DCC");
194 #ifdef EXPERIMENTAL_DMARC
195 builtin_macro_create(US
"_HAVE_DMARC");
197 #ifdef EXPERIMENTAL_DSN_INFO
198 builtin_macro_create(US
"_HAVE_DSN_INFO");
200 #ifdef EXPERIMENTAL_REQUIRETLS
201 builtin_macro_create(US
"_HAVE_REQTLS");
203 #ifdef EXPERIMENTAL_PIPE_CONNECT
204 builtin_macro_create(US
"_HAVE_PIPE_CONNECT");
207 #ifdef LOOKUP_LSEARCH
208 builtin_macro_create(US
"_HAVE_LOOKUP_LSEARCH");
211 builtin_macro_create(US
"_HAVE_LOOKUP_CDB");
214 builtin_macro_create(US
"_HAVE_LOOKUP_DBM");
217 builtin_macro_create(US
"_HAVE_LOOKUP_DNSDB");
219 #ifdef LOOKUP_DSEARCH
220 builtin_macro_create(US
"_HAVE_LOOKUP_DSEARCH");
223 builtin_macro_create(US
"_HAVE_LOOKUP_IBASE");
226 builtin_macro_create(US
"_HAVE_LOOKUP_LDAP");
228 #ifdef EXPERIMENTAL_LMDB
229 builtin_macro_create(US
"_HAVE_LOOKUP_LMDB");
232 builtin_macro_create(US
"_HAVE_LOOKUP_MYSQL");
235 builtin_macro_create(US
"_HAVE_LOOKUP_NIS");
237 #ifdef LOOKUP_NISPLUS
238 builtin_macro_create(US
"_HAVE_LOOKUP_NISPLUS");
241 builtin_macro_create(US
"_HAVE_LOOKUP_ORACLE");
244 builtin_macro_create(US
"_HAVE_LOOKUP_PASSWD");
247 builtin_macro_create(US
"_HAVE_LOOKUP_PGSQL");
250 builtin_macro_create(US
"_HAVE_LOOKUP_REDIS");
253 builtin_macro_create(US
"_HAVE_LOOKUP_SQLITE");
256 builtin_macro_create(US
"_HAVE_LOOKUP_TESTDB");
259 builtin_macro_create(US
"_HAVE_LOOKUP_WHOSON");
262 #ifdef TRANSPORT_APPENDFILE
263 # ifdef SUPPORT_MAILDIR
264 builtin_macro_create(US
"_HAVE_TRANSPORT_APPEND_MAILDIR");
266 # ifdef SUPPORT_MAILSTORE
267 builtin_macro_create(US
"_HAVE_TRANSPORT_APPEND_MAILSTORE");
270 builtin_macro_create(US
"_HAVE_TRANSPORT_APPEND_MBX");
274 #ifdef WITH_CONTENT_SCAN
287 options_transports();
290 #if defined(SUPPORT_TLS) && !defined(USE_GNUTLS)
307 printf("#include \"exim.h\"\n");
312 printf("macro_item * macros = &p%d;\n", mp_index
-1);
313 printf("macro_item * mlast = &p0;\n");