From b76eea3d73f0abf8051dd771f426a42a34bf6bf9 Mon Sep 17 00:00:00 2001 From: Kyle Maxwell Date: Fri, 22 Mar 2013 16:14:59 -0700 Subject: [PATCH] redo search paths --- extconf.rb | 19 ++++++++++++++----- main.c | 5 ----- protocol.c | 2 -- server.c | 3 --- server.h | 3 --- sit.h | 4 ---- 6 files changed, 14 insertions(+), 22 deletions(-) diff --git a/extconf.rb b/extconf.rb index c211f7d..ad856dd 100644 --- a/extconf.rb +++ b/extconf.rb @@ -3,6 +3,7 @@ CONFIG['optflags'] = "-O0" $CFLAGS << ' -g -std=c99 -Wall -Wextra + -D_GNU_SOURCE -DCOMPILE_WITH_DEBUG -Wno-newline-eof -Wno-declaration-after-statement @@ -13,12 +14,20 @@ -Wno-switch -Wno-variadic-macros -o sit'.gsub(/\s+/, " ") + +headers = %w[/usr/local/include /usr/include] +libs = %w[/usr/local/lib /usr/lib] +out = `pcre-config --libs`[/-L(\S+)/, 1] +libs.unshift(out) if out -find_library('ev', 'ev_default_loop') && have_header("ev.h") -have_header("aio.h") -find_library('pcre', 'pcre_compile') && have_header("pcre.h") -have_header("sys/queue.h") -create_makefile('sit') +find_library('ev', 'ev_default_loop', *libs) && +find_header("ev.h", *headers) && +find_header("aio.h", *headers) && +find_library('pcre', 'pcre_free_study', *libs) && +find_header("pcre.h", *headers) && +find_header("sys/queue.h", *headers) && +create_makefile('sit') || +abort("error") footer = <<-STR $(TARGET): $(OBJS) Makefile diff --git a/main.c b/main.c index b87b522..27e40f7 100644 --- a/main.c +++ b/main.c @@ -87,8 +87,6 @@ main(int argc, char **argv) { engine_add_stream_parser(engine, "solr", solr_parser_new()); engine_add_stream_parser(engine, "json", json_white_parser_new()); -#ifdef HAVE_EV_H - if(port > 0) { struct sockaddr_in addr; bzero(&addr, sizeof(addr)); @@ -99,9 +97,6 @@ main(int argc, char **argv) { Server *server = server_new(engine); server_start(server, &addr); } else { -#else - { -#endif pstring nl = {"\n", 1}; diff --git a/protocol.c b/protocol.c index b673033..58c279e 100644 --- a/protocol.c +++ b/protocol.c @@ -261,14 +261,12 @@ _input_command_found(struct ProtocolHandler *handler, pstring *command, pstring Callback *cb = callback_new(_dump_handler, output); engine_each_query(input->engine, cb); callback_free(cb); -#ifdef HAVE_EV_H } else if(TEST_MODE && !cpstrcmp("stop", command)) { INFO("stopping now!\n"); input->output->close(input->output); ev_unloop(ev_default_loop(0), EVUNLOOP_ALL); engine_free(input->engine); INFO("stopped\n"); -#endif } else { pstring *buf = pstringf("Unknown command: %.*s", command->len, command->val); handler->error_found(handler, buf); diff --git a/server.c b/server.c index 42270b4..33b2c01 100644 --- a/server.c +++ b/server.c @@ -1,4 +1,3 @@ -#ifdef HAVE_EV_H #include "sit.h" #define BUFFER_SIZE 8096 @@ -259,5 +258,3 @@ server_start(Server *server, struct sockaddr_in *addr) { ev_loop(loop, 0); return 0; } - -#endif diff --git a/server.h b/server.h index e743340..4b1a6cb 100644 --- a/server.h +++ b/server.h @@ -1,6 +1,5 @@ #ifndef SIT_SERVER_H_INCLUDED #define SIT_SERVER_H_INCLUDED -#ifdef HAVE_EV_H #include #include "engine.h" @@ -46,5 +45,3 @@ void conn_free(conn_t * conn); #endif -#endif - diff --git a/sit.h b/sit.h index 7f75a06..5f36a21 100644 --- a/sit.h +++ b/sit.h @@ -11,12 +11,8 @@ struct lrw_type; #include #include -#ifdef HAVE_EV_H #include -#endif -#ifdef HAVE_PCRE_H #include -#endif #include #include #include