diff --git a/client/cs_scheduler.C b/client/cs_scheduler.C index 3e30ce68f4..790809ac51 100644 --- a/client/cs_scheduler.C +++ b/client/cs_scheduler.C @@ -21,6 +21,10 @@ #include #include +#ifdef _USING_FCGI_ +#undef _USING_FCGI_ +#endif + #include "error_numbers.h" #include "file_names.h" #include "parse.h" diff --git a/sched/Makefile.fcgi.in b/sched/Makefile.fcgi.in new file mode 100644 index 0000000000..561a3aca6f --- /dev/null +++ b/sched/Makefile.fcgi.in @@ -0,0 +1,68 @@ +DEPTH = .. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +all: cgi + +CFLAGS = -g -Wall -include /usr/local/include/fcgi_stdio.h -d _USING_FCGI_ @DEFS@ -I@top_srcdir@/db -I@top_srcdir@/lib -I@top_srcdir@/tools +CC = g++ $(CFLAGS) + +CLIBS = @LIBS@ -lfcgi -lfcgi++ + +PROGS = cgi feeder show_shmem + +all: $(PROGS) + +CGI_OBJS = \ + handle_request.o \ + main.o \ + sched_shmem.o \ + server_types.o \ + ../db/db_mysql.o \ + ../db/mysql_util.o \ + ../lib/shmem.o \ + parse.o \ + ../tools/process_result_template.o + +FEEDER_OBJS = \ + feeder.o \ + sched_shmem.o \ + ../db/db_mysql.o \ + ../db/mysql_util.o \ + ../lib/shmem.o + +SHOW_SHMEM_OBJS = \ + show_shmem.o \ + sched_shmem.o \ + ../db/db_mysql.o \ + ../db/mysql_util.o \ + ../lib/shmem.o + +MYSQL_DIR = /usr/local/mysql/lib +MYSQL_LIBS = \ +-L$(MYSQL_DIR) -L/sw/lib/mysql -L/usr/local/lib/mysql \ +-lmysqlclient -L/usr/local/lib -lz \ +-lm $(NETLIBS) + +.C.o: + $(CC) -c -o $*.o $< +.c.o: + $(CC) -c -o $*.o $< + +cgi: $(CGI_OBJS) + $(CC) $(CGI_OBJS) $(MYSQL_LIBS) $(CLIBS) -o cgi + +feeder: $(FEEDER_OBJS) + $(CC) $(FEEDER_OBJS) $(MYSQL_LIBS) $(CLIBS) -o feeder + +show_shmem: $(SHOW_SHMEM_OBJS) + $(CC) $(SHOW_SHMEM_OBJS) $(MYSQL_LIBS) $(CLIBS) -o show_shmem + +dependencies: @srcdir@/*.C + $(CC) -M @srcdir@/*.C > dependencies + +include dependencies + +clean: + rm -f $(PROGS) *.o core dependencies config.cache diff --git a/sched/Makefile.in b/sched/Makefile.in index c6d5fedd86..e244966271 100644 --- a/sched/Makefile.in +++ b/sched/Makefile.in @@ -5,10 +5,10 @@ VPATH = @srcdir@ all: cgi -CFLAGS = -g -Wall -include /usr/local/include/fcgi_stdio.h @DEFS@ -I@top_srcdir@/db -I@top_srcdir@/lib -I@top_srcdir@/tools +CFLAGS = -g -Wall @DEFS@ -I@top_srcdir@/db -I@top_srcdir@/lib -I@top_srcdir@/tools CC = g++ $(CFLAGS) -CLIBS = @LIBS@ -lfcgi -lfcgi++ +CLIBS = @LIBS@ PROGS = cgi feeder show_shmem diff --git a/sched/Makefile.nofcgi.in b/sched/Makefile.nofcgi.in new file mode 100644 index 0000000000..e244966271 --- /dev/null +++ b/sched/Makefile.nofcgi.in @@ -0,0 +1,68 @@ +DEPTH = .. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +all: cgi + +CFLAGS = -g -Wall @DEFS@ -I@top_srcdir@/db -I@top_srcdir@/lib -I@top_srcdir@/tools +CC = g++ $(CFLAGS) + +CLIBS = @LIBS@ + +PROGS = cgi feeder show_shmem + +all: $(PROGS) + +CGI_OBJS = \ + handle_request.o \ + main.o \ + sched_shmem.o \ + server_types.o \ + ../db/db_mysql.o \ + ../db/mysql_util.o \ + ../lib/shmem.o \ + ../lib/parse.o \ + ../tools/process_result_template.o + +FEEDER_OBJS = \ + feeder.o \ + sched_shmem.o \ + ../db/db_mysql.o \ + ../db/mysql_util.o \ + ../lib/shmem.o + +SHOW_SHMEM_OBJS = \ + show_shmem.o \ + sched_shmem.o \ + ../db/db_mysql.o \ + ../db/mysql_util.o \ + ../lib/shmem.o + +MYSQL_DIR = /usr/local/mysql/lib +MYSQL_LIBS = \ +-L$(MYSQL_DIR) -L/sw/lib/mysql -L/usr/local/lib/mysql \ +-lmysqlclient -L/usr/local/lib -lz \ +-lm $(NETLIBS) + +.C.o: + $(CC) -c -o $*.o $< +.c.o: + $(CC) -c -o $*.o $< + +cgi: $(CGI_OBJS) + $(CC) $(CGI_OBJS) $(MYSQL_LIBS) $(CLIBS) -o cgi + +feeder: $(FEEDER_OBJS) + $(CC) $(FEEDER_OBJS) $(MYSQL_LIBS) $(CLIBS) -o feeder + +show_shmem: $(SHOW_SHMEM_OBJS) + $(CC) $(SHOW_SHMEM_OBJS) $(MYSQL_LIBS) $(CLIBS) -o show_shmem + +dependencies: @srcdir@/*.C + $(CC) -M @srcdir@/*.C > dependencies + +include dependencies + +clean: + rm -f $(PROGS) *.o core dependencies config.cache diff --git a/sched/feeder.C b/sched/feeder.C index ce58dcdd76..50134a41f5 100644 --- a/sched/feeder.C +++ b/sched/feeder.C @@ -46,7 +46,9 @@ #include #endif +#ifdef _USING_FCGI_ #include "/usr/local/include/fcgi_stdio.h" +#endif #include "db.h" #include "shmem.h" diff --git a/sched/handle_request.C b/sched/handle_request.C index b515ec1d0d..82c3bf9402 100644 --- a/sched/handle_request.C +++ b/sched/handle_request.C @@ -21,11 +21,19 @@ #include #include +#ifdef _USING_FCGI_ #include "/usr/local/include/fcgi_stdio.h" +#endif #include "db.h" #include "backend_lib.h" + +#ifndef _USING_FCGI_ #include "parse.h" +#else +#include "fcgi_parse.h" +#endif + #include "server_types.h" #include "handle_request.h" diff --git a/sched/main.C b/sched/main.C index ddaff2f67e..4443aad92c 100644 --- a/sched/main.C +++ b/sched/main.C @@ -17,18 +17,20 @@ // Contributor(s): // + #include #include -#include "/usr/local/include/fcgi_stdio.h" -#define _USING_FCGI_ //used to tell lib to inlcude fcgi_stdio.h - #include "db.h" #include "parse.h" #include "shmem.h" #include "server_types.h" #include "handle_request.h" +#ifdef _USING_FCGI_ +#include "/usr/local/include/fcgi_stdio.h" +#endif + #define REQ_FILE_PREFIX "/tmp/boinc_req_" #define REPLY_FILE_PREFIX "/tmp/boinc_reply_" @@ -50,8 +52,10 @@ int main() { char req_path[256], reply_path[256]; SCHED_SHMEM* ssp; void* p; - - while(FCGI_Accept() >= 0) { + + #ifdef _USING_FCGI_ + while(FCGI_Accept >= 0) { + #endif retval = attach_shmem(BOINC_KEY, &p); if (retval) { printf("can't attach shmem\n"); @@ -114,5 +118,7 @@ int main() { unlink(req_path); unlink(reply_path); + #ifdef _USING_FCGI_ } + #endif } diff --git a/sched/sched_shmem.C b/sched/sched_shmem.C index e75edb768f..e191905c07 100644 --- a/sched/sched_shmem.C +++ b/sched/sched_shmem.C @@ -1,7 +1,9 @@ #include #include +#ifdef _USING_FCGI_ #include "/usr/local/include/fcgi_stdio.h" +#endif #include "db.h" diff --git a/sched/server_types.C b/sched/server_types.C index 42d312ba61..0b46ca0f9d 100644 --- a/sched/server_types.C +++ b/sched/server_types.C @@ -19,7 +19,9 @@ #include +#ifdef _USING_FCGI_ #include "/usr/local/include/fcgi_stdio.h" +#endif #include "parse.h" #include "server_types.h" diff --git a/sched/show_shmem.C b/sched/show_shmem.C index b3ff7225d6..f1ed21ef0b 100644 --- a/sched/show_shmem.C +++ b/sched/show_shmem.C @@ -1,6 +1,8 @@ #include +#ifdef _USING_FCGI_ #include "/usr/local/include/fcgi_stdio.h" +#endif #include "shmem.h" #include "sched_shmem.h"