diff --git a/buildconf/default.ini b/buildconf/default.ini index 97c498f0..1f48dc8c 100644 --- a/buildconf/default.ini +++ b/buildconf/default.ini @@ -18,7 +18,7 @@ async = true evdis = false ldap = auto pcre = auto -routing = true +routing = auto debug = false unbit = false xml_implementation = libxml2 diff --git a/plugins/router_redirect/router_redirect.c b/plugins/router_redirect/router_redirect.c index 0ab1d149..205e067f 100644 --- a/plugins/router_redirect/router_redirect.c +++ b/plugins/router_redirect/router_redirect.c @@ -1,5 +1,7 @@ #include "../../uwsgi.h" +#ifdef UWSGI_ROUTING + extern struct uwsgi_server uwsgi; int uwsgi_routing_func_redirect(struct wsgi_request *wsgi_req, struct uwsgi_route *ur) { @@ -46,3 +48,8 @@ struct uwsgi_plugin router_redirect_plugin = { .name = "router_redirect", .on_load = router_redirect_register, }; +#else +struct uwsgi_plugin router_redirect_plugin = { + .name = "router_redirect", +}; +#endif diff --git a/plugins/router_uwsgi/router_uwsgi.c b/plugins/router_uwsgi/router_uwsgi.c index 743007ad..c40b2dde 100644 --- a/plugins/router_uwsgi/router_uwsgi.c +++ b/plugins/router_uwsgi/router_uwsgi.c @@ -1,4 +1,5 @@ #include "../../uwsgi.h" +#ifdef UWSGI_ROUTING extern struct uwsgi_server uwsgi; @@ -114,7 +115,11 @@ void router_uwsgi_register(void) { } struct uwsgi_plugin router_uwsgi_plugin = { - .name = "router_uwsgi", .on_load = router_uwsgi_register, }; +#else +struct uwsgi_plugin router_uwsgi_plugin = { + .name = "router_uwsgi", +}; +#endif diff --git a/uwsgiconfig.py b/uwsgiconfig.py index a3cfea1e..f09320a2 100644 --- a/uwsgiconfig.py +++ b/uwsgiconfig.py @@ -513,9 +513,7 @@ class uConf(object): if self.get('udp'): self.cflags.append("-DUWSGI_UDP") - if self.get('routing'): - self.gcc_list.append('routing') - self.cflags.append("-DUWSGI_ROUTING") + has_pcre = False # re-enable after pcre fix if self.get('pcre'): @@ -527,6 +525,7 @@ class uConf(object): self.cflags.append(pcreconf) self.gcc_list.append('regexp') self.cflags.append("-DUWSGI_PCRE") + has_pcre = True else: pcreconf = spcall('pcre-config --libs') @@ -539,6 +538,17 @@ class uConf(object): self.cflags.append(pcreconf) self.gcc_list.append('regexp') self.cflags.append("-DUWSGI_PCRE") + has_pcre = True + + if self.get('routing'): + if self.get('pcre') == 'auto': + if has_pcre: + self.gcc_list.append('routing') + self.cflags.append("-DUWSGI_ROUTING") + else: + self.gcc_list.append('routing') + self.cflags.append("-DUWSGI_ROUTING") + if self.has_include('sys/capability.h') and uwsgi_os == 'Linux': self.cflags.append("-DUWSGI_CAP")