From 228ad9b85373f57ad6ef45740163fad25534b4da Mon Sep 17 00:00:00 2001
From: ctiller <ctiller@google.com>
Date: Wed, 7 Jan 2015 15:33:00 -0800
Subject: [PATCH] Fix opensource build. 	Change on 2015/01/07 by ctiller
 <ctiller@google.com> ------------- Created by MOE:
 http://code.google.com/p/moe-java MOE_MIGRATED_REVID=83469328

---
 Makefile                    | 17 +----------------
 templates/Makefile.template | 17 +----------------
 2 files changed, 2 insertions(+), 32 deletions(-)

diff --git a/Makefile b/Makefile
index a48e621deb..829241b9d5 100644
--- a/Makefile
+++ b/Makefile
@@ -84,7 +84,7 @@ CPPFLAGS += -g -fPIC -Wall -Werror -Wno-long-long
 LDFLAGS += -g -pthread -fPIC
 
 INCLUDES = . include gens
-LIBS = rt m z event event_pthreads pthread
+LIBS = rt m z pthread
 LIBSXX = protobuf
 LIBS_PROTOC = protoc protobuf
 
@@ -143,20 +143,12 @@ else
 IS_GIT_FOLDER = true
 endif
 
-EVENT2_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/event2.c -levent $(LDFLAGS)
 OPENSSL_ALPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/openssl-alpn.c -lssl -lcrypto -ldl $(LDFLAGS)
 ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/zlib.c -lz $(LDFLAGS)
 
-HAS_SYSTEM_EVENT2 = $(shell $(EVENT2_CHECK_CMD) 2> /dev/null && echo true || echo false)
 HAS_SYSTEM_OPENSSL_ALPN = $(shell $(OPENSSL_ALPN_CHECK_CMD) 2> /dev/null && echo true || echo false)
 HAS_SYSTEM_ZLIB = $(shell $(ZLIB_CHECK_CMD) 2> /dev/null && echo true || echo false)
 
-ifeq ($(wildcard third_party/libevent/include/event2/event.h),)
-HAS_EMBEDDED_EVENT2 = false
-else
-HAS_EMBEDDED_EVENT2 = true
-endif
-
 ifeq ($(wildcard third_party/openssl/ssl/ssl.h),)
 HAS_EMBEDDED_OPENSSL_ALPN = false
 else
@@ -169,12 +161,6 @@ else
 HAS_EMBEDDED_ZLIB = true
 endif
 
-ifneq ($(SYSTEM),MINGW32)
-ifeq ($(HAS_SYSTEM_EVENT2),false)
-DEP_MISSING += libevent
-endif
-endif
-
 ifeq ($(HAS_SYSTEM_ZLIB),false)
 ifeq ($(HAS_EMBEDDED_ZLIB),true)
 ZLIB_DEP = third_party/zlib/libz.a
@@ -466,7 +452,6 @@ chttp2_socket_pair_one_byte_at_a_time_thread_stress_test: bins/$(CONFIG)/chttp2_
 chttp2_socket_pair_one_byte_at_a_time_writes_done_hangs_with_pending_read_test: bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_writes_done_hangs_with_pending_read_test
 
 run_dep_checks:
-	$(EVENT2_CHECK_CMD) || true
 	$(OPENSSL_ALPN_CHECK_CMD) || true
 	$(ZLIB_CHECK_CMD) || true
 
diff --git a/templates/Makefile.template b/templates/Makefile.template
index bdb9765114..44144c8f7e 100644
--- a/templates/Makefile.template
+++ b/templates/Makefile.template
@@ -100,7 +100,7 @@ CPPFLAGS += -g -fPIC -Wall -Werror -Wno-long-long
 LDFLAGS += -g -pthread -fPIC
 
 INCLUDES = . include gens
-LIBS = rt m z event event_pthreads pthread
+LIBS = rt m z pthread
 LIBSXX = protobuf
 LIBS_PROTOC = protoc protobuf
 
@@ -159,20 +159,12 @@ else
 IS_GIT_FOLDER = true
 endif
 
-EVENT2_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/event2.c -levent $(LDFLAGS)
 OPENSSL_ALPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/openssl-alpn.c -lssl -lcrypto -ldl $(LDFLAGS)
 ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/zlib.c -lz $(LDFLAGS)
 
-HAS_SYSTEM_EVENT2 = $(shell $(EVENT2_CHECK_CMD) 2> /dev/null && echo true || echo false)
 HAS_SYSTEM_OPENSSL_ALPN = $(shell $(OPENSSL_ALPN_CHECK_CMD) 2> /dev/null && echo true || echo false)
 HAS_SYSTEM_ZLIB = $(shell $(ZLIB_CHECK_CMD) 2> /dev/null && echo true || echo false)
 
-ifeq ($(wildcard third_party/libevent/include/event2/event.h),)
-HAS_EMBEDDED_EVENT2 = false
-else
-HAS_EMBEDDED_EVENT2 = true
-endif
-
 ifeq ($(wildcard third_party/openssl/ssl/ssl.h),)
 HAS_EMBEDDED_OPENSSL_ALPN = false
 else
@@ -185,12 +177,6 @@ else
 HAS_EMBEDDED_ZLIB = true
 endif
 
-ifneq ($(SYSTEM),MINGW32)
-ifeq ($(HAS_SYSTEM_EVENT2),false)
-DEP_MISSING += libevent
-endif
-endif
-
 ifeq ($(HAS_SYSTEM_ZLIB),false)
 ifeq ($(HAS_EMBEDDED_ZLIB),true)
 ZLIB_DEP = third_party/zlib/libz.a
@@ -291,7 +277,6 @@ ${tgt.name}: bins/$(CONFIG)/${tgt.name}
 % endfor
 
 run_dep_checks:
-	$(EVENT2_CHECK_CMD) || true
 	$(OPENSSL_ALPN_CHECK_CMD) || true
 	$(ZLIB_CHECK_CMD) || true
 
-- 
GitLab