THRIFT-3421 rebar as dependency instead of bundling

This closes #693
diff --git a/build/travis/installDependencies.sh b/build/travis/installDependencies.sh
index 4945fd4..eab8c6b 100755
--- a/build/travis/installDependencies.sh
+++ b/build/travis/installDependencies.sh
@@ -43,7 +43,7 @@
 sudo apt-get install -qq libglib2.0-dev
 
 # Erlang dependencies
-sudo apt-get install -qq erlang-base erlang-eunit erlang-dev erlang-tools
+sudo apt-get install -qq erlang-base erlang-eunit erlang-dev erlang-tools rebar
 
 # GO dependencies
 echo "golang-go golang-go/dashboard boolean false" | debconf-set-selections
diff --git a/configure.ac b/configure.ac
index 777300a..37f19c9 100755
--- a/configure.ac
+++ b/configure.ac
@@ -233,13 +233,14 @@
 if test "$with_erlang" = "yes";  then
   AC_ERLANG_PATH_ERL
   AC_ERLANG_PATH_ERLC
+  AC_PATH_PROG([REBAR], [rebar])
   if test -n "$ERLC" ; then
     AC_ERLANG_SUBST_LIB_DIR
     # Install into the detected Erlang directory instead of $libdir/erlang/lib
     ERLANG_INSTALL_LIB_DIR="$ERLANG_LIB_DIR"
     AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
   fi
-  if test -n "$ERL" -a -n "$ERLC" ; then
+  if test -n "$ERL" -a -n "$ERLC" && test "x$REBAR" != "x" ; then
     have_erlang="yes"
 
     # otp_release is simply a number (like "17") for OTP17+ while "R16..." for OTP16 or less.
@@ -897,6 +898,7 @@
   echo
   echo "Erlang Library:"
   echo "   Using erlc ................ : $ERLC"
+  echo "   Using rebar ............... : $REBAR"
 fi
 if test "$have_go" = "yes" ; then
   echo
diff --git a/lib/erl/Makefile.am b/lib/erl/Makefile.am
index d140858..df11776 100644
--- a/lib/erl/Makefile.am
+++ b/lib/erl/Makefile.am
@@ -41,13 +41,13 @@
 	touch .generated
 
 all: .generated
-	./rebar get-deps
-	./rebar compile
+	$(REBAR) get-deps
+	$(REBAR) compile
 
 check: .generated
-	./rebar -C rebar.test.config get-deps
-	./rebar -C rebar.test.config compile
-	./rebar -C rebar.test.config skip_deps=true eunit
+	$(REBAR) -C rebar.test.config get-deps
+	$(REBAR) -C rebar.test.config compile
+	$(REBAR) -C rebar.test.config skip_deps=true eunit
 
 install: all
 	mkdir -p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift) ; \
@@ -64,7 +64,7 @@
 clean:
 	rm -f .generated
 	rm -rf test/gen-erl/
-	./rebar clean
+	$(REBAR) clean
 
 maintainer-clean-local:
 	rm -rf ebin
@@ -73,7 +73,6 @@
 	include \
 	src \
 	coding_standards.md \
-	rebar \
 	rebar.config \
 	test \
 	README.md
diff --git a/lib/erl/rebar b/lib/erl/rebar
deleted file mode 100755
index 53419ea..0000000
--- a/lib/erl/rebar
+++ /dev/null
Binary files differ