Skip to content

Commit

Permalink
redo search paths
Browse files Browse the repository at this point in the history
  • Loading branch information
fizx committed Mar 22, 2013
1 parent 29f0090 commit b76eea3
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 22 deletions.
19 changes: 14 additions & 5 deletions extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 0 additions & 5 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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};

Expand Down
2 changes: 0 additions & 2 deletions protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 0 additions & 3 deletions server.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#ifdef HAVE_EV_H
#include "sit.h"

#define BUFFER_SIZE 8096
Expand Down Expand Up @@ -259,5 +258,3 @@ server_start(Server *server, struct sockaddr_in *addr) {
ev_loop(loop, 0);
return 0;
}

#endif
3 changes: 0 additions & 3 deletions server.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#ifndef SIT_SERVER_H_INCLUDED
#define SIT_SERVER_H_INCLUDED
#ifdef HAVE_EV_H

#include <ev.h>
#include "engine.h"
Expand Down Expand Up @@ -46,5 +45,3 @@ void
conn_free(conn_t * conn);

#endif
#endif

4 changes: 0 additions & 4 deletions sit.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ struct lrw_type;

#include <assert.h>
#include <errno.h>
#ifdef HAVE_EV_H
#include <ev.h>
#endif
#ifdef HAVE_PCRE_H
#include <pcre.h>
#endif
#include <fcntl.h>
#include <getopt.h>
#include <limits.h>
Expand Down

0 comments on commit b76eea3

Please sign in to comment.