From 4945f557f5760ca26b67a5d334364673a445f7cf Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Wed, 28 Sep 2016 22:24:00 +0100 Subject: [PATCH] Refactor driver feature-macro generation to be driven by existing tables Would like to do lookup drivers too but unsure about dyn-linked variants --- doc/doc-txt/NewStuff | 7 +++-- src/src/functions.h | 1 + src/src/readconf.c | 65 +++----------------------------------------- src/src/route.c | 3 ++ src/src/transport.c | 3 ++ 5 files changed, 15 insertions(+), 64 deletions(-) diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index 9d248bc02..d99b8e0a6 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -38,9 +38,10 @@ Version 4.88 9. Expansion operator escape8bit, like escape but not touching newline etc.. 10. Feature macros, generated from compile options. All start with "_HAVE_" - and go on with some roughly recognisable name. Option macros, for each - configuration-file option; all start with "_OPT_". Use the "-bP macros" - command-line option to see what is present. + and go on with some roughly recognisable name. Driver macros, for + router, transport and authentication drivers; names starting with "_DRVR_". + Option macros, for each configuration-file option; all start with "_OPT_". + Use the "-bP macros" command-line option to see what is present. 11. Integer values for options can take a "G" multiplier. diff --git a/src/src/functions.h b/src/src/functions.h index e3d19cd38..78f6bceda 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -327,6 +327,7 @@ extern int readconf_readtime(const uschar *, int, BOOL); extern void readconf_rest(void); extern uschar *readconf_retry_error(const uschar *, const uschar *, int *, int *); extern void readconf_save_config(const uschar *); +extern void read_macro_assignment(uschar *); extern void read_message_body(BOOL); extern void receive_bomb_out(uschar *, uschar *); extern BOOL receive_check_fs(int); diff --git a/src/src/readconf.c b/src/src/readconf.c index 7a7299f2e..29181cbcb 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -566,7 +566,7 @@ Arguments: Returns: nothing */ -static void +void read_macro_assignment(uschar *s) { uschar name[64]; @@ -3163,55 +3163,7 @@ due to conflicts with other common macros. */ read_macro_assignment(US"_HAVE_LKUP_WHOSON=y"); #endif -#ifdef AUTH_CRAM_MD5 - read_macro_assignment(US"_HAVE_AUTH_CRAM_MD5=y"); -#endif -#ifdef AUTH_CYRUS_SASL - read_macro_assignment(US"_HAVE_AUTH_CYRUS_SASL=y"); -#endif -#ifdef AUTH_DOVECOT - read_macro_assignment(US"_HAVE_AUTH_DOVECOT=y"); -#endif -#ifdef AUTH_GSASL - read_macro_assignment(US"_HAVE_AUTH_GSASL=y"); -#endif -#ifdef AUTH_HEIMDAL_GSSAPI - read_macro_assignment(US"_HAVE_AUTH_HEIMDAL_GSSAPI=y"); -#endif -#ifdef AUTH_PLAINTEXT - read_macro_assignment(US"_HAVE_AUTH_PLAINTEXT=y"); -#endif -#ifdef AUTH_SPA - read_macro_assignment(US"_HAVE_AUTH_SPA=y"); -#endif -#ifdef AUTH_TLS - read_macro_assignment(US"_HAVE_AUTH_TLS=y"); -#endif - -#ifdef ROUTER_ACCEPT - read_macro_assignment(US"_HAVE_RTR_ACCEPT=y"); -#endif -#ifdef ROUTER_DNSLOOKUP - read_macro_assignment(US"_HAVE_RTR_DNSLOOKUP=y"); -#endif -#ifdef ROUTER_IPLITERAL - read_macro_assignment(US"_HAVE_RTR_IPLITERAL=y"); -#endif -#ifdef ROUTER_IPLOOKUP - read_macro_assignment(US"_HAVE_RTR_IPLOOKUP=y"); -#endif -#ifdef ROUTER_MANUALROUTE - read_macro_assignment(US"_HAVE_RTR_MANUALROUTE=y"); -#endif -#ifdef ROUTER_QUERYPROGRAM - read_macro_assignment(US"_HAVE_RTR_QUERYPROGRAM=y"); -#endif -#ifdef ROUTER_REDIRECT - read_macro_assignment(US"_HAVE_RTR_REDRCT=y"); -#endif - #ifdef TRANSPORT_APPENDFILE - read_macro_assignment(US"_HAVE_TPT_APPENDFILE=y"); # ifdef SUPPORT_MAILDIR read_macro_assignment(US"_HAVE_TPT_APPEND_MAILDR=y"); # endif @@ -3222,18 +3174,6 @@ due to conflicts with other common macros. */ read_macro_assignment(US"_HAVE_TPT_APPEND_MBX=y"); # endif #endif -#ifdef TRANSPORT_AUTOREPLY - read_macro_assignment(US"_HAVE_TPT_AUTOREPLY=y"); -#endif -#ifdef TRANSPORT_LMTP - read_macro_assignment(US"_HAVE_TPT_LMTP=y"); -#endif -#ifdef TRANSPORT_PIPE - read_macro_assignment(US"_HAVE_TPT_PIPE=y"); -#endif -#ifdef TRANSPORT_SMTP - read_macro_assignment(US"_HAVE_TPT_SMTP=y"); -#endif } @@ -4308,7 +4248,10 @@ struct auth_info * ai; readconf_options_from_list(optionlist_auths, optionlist_auths_size, US"AU"); for (ai = auths_available; ai->driver_name[0]; ai++) + { + read_macro_assignment(string_sprintf("_DRVR_AUTH_%T=y", ai->driver_name)); readconf_options_from_list(ai->options, (unsigned)*ai->options_count, ai->driver_name); + } } diff --git a/src/src/route.c b/src/src/route.c index 1764de853..935b341be 100644 --- a/src/src/route.c +++ b/src/src/route.c @@ -151,7 +151,10 @@ struct router_info * ri; readconf_options_from_list(optionlist_routers, nelem(optionlist_routers), US"RT"); for (ri = routers_available; ri->driver_name[0]; ri++) + { + read_macro_assignment(string_sprintf("_DRVR_RTR_%T=y", ri->driver_name)); readconf_options_from_list(ri->options, (unsigned)*ri->options_count, ri->driver_name); + } } /************************************************* diff --git a/src/src/transport.c b/src/src/transport.c index 330dd5b1d..6458d9fd7 100644 --- a/src/src/transport.c +++ b/src/src/transport.c @@ -119,7 +119,10 @@ struct transport_info * ti; readconf_options_from_list(optionlist_transports, nelem(optionlist_transports), US"TP"); for (ti = transports_available; ti->driver_name[0]; ti++) + { + read_macro_assignment(string_sprintf("_DRVR_TPT_%T=y", ti->driver_name)); readconf_options_from_list(ti->options, (unsigned)*ti->options_count, ti->driver_name); + } } /************************************************* -- 2.30.2