From 94f4be58bd952cd738c167355ab89964be737b25 Mon Sep 17 00:00:00 2001 From: "roberto@sirius" Date: Thu, 10 Mar 2011 10:40:56 +0100 Subject: [PATCH] auto configure ldap support --- buildconf/default.ini | 2 +- ldap.c | 18 +----------------- uwsgiconfig.py | 12 +++++++++--- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/buildconf/default.ini b/buildconf/default.ini index 4edf3286..11b16cad 100644 --- a/buildconf/default.ini +++ b/buildconf/default.ini @@ -13,7 +13,7 @@ sendfile = true minterpreters = true async = true evdis = false -ldap = false +ldap = auto pcre = auto debug = false unbit = false diff --git a/ldap.c b/ldap.c index bf273544..d90acbb9 100644 --- a/ldap.c +++ b/ldap.c @@ -194,8 +194,6 @@ void uwsgi_ldap_config() { int desired_version = LDAP_VERSION3; int ret; - struct option *aopt, *lopt; - LDAPURLDesc *ldap_url; if (uwsgi.ldap) { @@ -281,21 +279,7 @@ void uwsgi_ldap_config() { memcpy(uwsgi_val, bervalues[0]->bv_val, bervalues[0]->bv_len); uwsgi_val[bervalues[0]->bv_len] = 0; - lopt = uwsgi.long_options; - while ((aopt = lopt)) { - if (!aopt->name) - break; - if (!strcmp(uwsgi_attr, aopt->name)) { - if (aopt->flag) { - *aopt->flag = aopt->val; - add_exported_option(0, (char*) uwsgi_attr); - } - else { - manage_opt(aopt->val, uwsgi_val); - } - } - lopt++; - } + add_exported_option((char*) uwsgi_attr, uwsgi_val, 0); } free(bervalues); diff --git a/uwsgiconfig.py b/uwsgiconfig.py index 47e17a32..d56646e9 100644 --- a/uwsgiconfig.py +++ b/uwsgiconfig.py @@ -377,9 +377,15 @@ class uConf(object): self.gcc_list.append('yaml') if self.get('ldap'): - self.cflags.append("-DUWSGI_LDAP") - self.gcc_list.append('ldap') - self.libs.append('-lldap') + if self.get('ldap') == 'auto': + if os.path.exists('/usr/include/ldap.h'): + self.cflags.append("-DUWSGI_LDAP") + self.gcc_list.append('ldap') + self.libs.append('-lldap') + else: + self.cflags.append("-DUWSGI_LDAP") + self.gcc_list.append('ldap') + self.libs.append('-lldap') if self.get('evdis'): self.cflags.append("-DUWSGI_EVDIS")