From 9bbef9b0c5b0ae2105d3ffb0de2bf4c231bbdca3 Mon Sep 17 00:00:00 2001 From: "roberto@cable" Date: Sat, 25 Feb 2012 08:34:11 +0100 Subject: [PATCH] various condition build fixes --- loop.c | 2 +- plugins/php/uwsgiplugin.py | 16 +++++++++++++++- uwsgi.c | 6 +++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/loop.c b/loop.c index e2390fa3..25b0dcaf 100644 --- a/loop.c +++ b/loop.c @@ -40,9 +40,9 @@ void *simple_loop(void *arg1) { long core_id = (long) arg1; struct wsgi_request *wsgi_req = uwsgi.wsgi_requests[core_id]; - int i; #ifdef UWSGI_THREADING + int i; //PyThreadState *pts; sigset_t smask; diff --git a/plugins/php/uwsgiplugin.py b/plugins/php/uwsgiplugin.py index 2e5fd952..9bef3c0a 100644 --- a/plugins/php/uwsgiplugin.py +++ b/plugins/php/uwsgiplugin.py @@ -2,14 +2,28 @@ import os NAME='php' +ld_run_path = None +PHPPATH = 'php-config' + +try: + phpdir = os.environ['UWSGICONFIG_PHPDIR'] + ld_run_path = "%s/lib" % phpdir + PHPPATH = "%s/bin/php-config" % phpdir +except: + pass + try: PHPPATH = os.environ['UWSGICONFIG_PHPPATH'] except: - PHPPATH = 'php-config' + pass CFLAGS = [os.popen(PHPPATH + ' --includes').read().rstrip()] LDFLAGS = os.popen(PHPPATH + ' --ldflags').read().rstrip().split() +if ld_run_path: + LDFLAGS.append('-L%s' % ld_run_path) + os.environ['LD_RUN_PATH'] = ld_run_path + LIBS = [os.popen(PHPPATH + ' --libs').read().rstrip(), '-lphp5'] GCC_LIST = ['php_plugin'] diff --git a/uwsgi.c b/uwsgi.c index c1b011a6..c881a8ec 100644 --- a/uwsgi.c +++ b/uwsgi.c @@ -500,11 +500,11 @@ void wait_for_threads() { void gracefully_kill(int signum) { - struct wsgi_request *wsgi_req = current_wsgi_req(); uwsgi_log("Gracefully killing worker %d (pid: %d)...\n", uwsgi.mywid, uwsgi.mypid); uwsgi.workers[uwsgi.mywid].manage_next_request = 0; #ifdef UWSGI_THREADING + struct wsgi_request *wsgi_req = current_wsgi_req(); if (uwsgi.threads > 1) { wait_for_threads(); if (!uwsgi.core[wsgi_req->async_id]->in_request) { @@ -3035,6 +3035,7 @@ void uwsgi_ignition() { if (uwsgi.zeromq && uwsgi.async < 2 && !uwsgi.sockets->next) { if (uwsgi.threads > 1) { +#ifdef UWSGI_THREADING if (pthread_key_create(&uwsgi.tur_key, NULL)) { uwsgi_error("pthread_key_create()"); exit(1); @@ -3043,6 +3044,7 @@ void uwsgi_ignition() { long j = i; pthread_create(&uwsgi.core[i]->thread_id, &uwsgi.threads_attr, zeromq_loop, (void *) j); } +#endif } long y = 0; @@ -3053,6 +3055,7 @@ void uwsgi_ignition() { if (uwsgi.threads > 1) { #endif +#ifdef UWSGI_THREADING if (pthread_key_create(&uwsgi.tur_key, NULL)) { uwsgi_error("pthread_key_create()"); exit(1); @@ -3061,6 +3064,7 @@ void uwsgi_ignition() { long j = i; pthread_create(&uwsgi.core[i]->thread_id, &uwsgi.threads_attr, simple_loop, (void *) j); } +#endif } if (uwsgi.async < 2) {