THRIFT-646. erlang: Misc build cleanups
- Use AC_ERLANG_PATH_ERLC to find erlc, instead of the generic
AC_PATH_PROG.
- Also check for erl, just in case it is used internally by checks.
- Use AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR instead of manual hackery to
find the location where Erlang libraries should be installed. (This
doesn't use the discovered version of Erlang, though. See
http://lists.gnu.org/archive/html/bug-autoconf/2010-05/msg00003.html .)
- Minor style changes in Makefile.am
- Remove some hacks we were using in the old makefile that were
necessary because we were not using automake.
- Remove ebin in a "maintainer-clean-local" rule to avoid shadowing the
default "maintainer-clean" rule which handles MAINTAINERCLEANFILES.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@945744 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/configure.ac b/configure.ac
index 21ab733..223c179 100644
--- a/configure.ac
+++ b/configure.ac
@@ -98,9 +98,11 @@
AX_THRIFT_LIB(erlang, [Erlang], yes)
if test "$with_erlang" = "yes"; then
- AC_PATH_PROG([ERLC], [erlc])
+ AC_ERLANG_PATH_ERL
+ AC_ERLANG_PATH_ERLC
+ AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
fi
-AM_CONDITIONAL(WITH_ERLANG, [test -n "$ERLC"])
+AM_CONDITIONAL(WITH_ERLANG, [test -n "$ERL" -a -n "$ERLC"])
AX_THRIFT_LIB(py, [Python], yes)
if test "$with_py" = "yes"; then
diff --git a/lib/erl/Makefile.am b/lib/erl/Makefile.am
index ee8fbff..a7ed477 100644
--- a/lib/erl/Makefile.am
+++ b/lib/erl/Makefile.am
@@ -17,9 +17,6 @@
# under the License.
#
-# directory where erlang library code should live
-ERL_LIB_ROOT_DIR=$(shell erl -eval 'io:format("~s~n", [code:lib_dir()])' -s init stop -noshell)
-
MODULES = \
src
@@ -28,30 +25,20 @@
(cd $$dir; ${MAKE} $@); \
done
-ERLLIBDIR=$(DESTDIR)$(ERL_LIB_ROOT_DIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
-
install: all
- mkdir -p $(ERLLIBDIR) ; \
- mkdir -p $(ERLLIBDIR)/ebin ; \
- mkdir -p $(ERLLIBDIR)/include ; \
- mkdir -p $(ERLLIBDIR)/src ; \
- for i in ebin/*.app* ; do $(INSTALL) $$i $(ERLLIBDIR)/$$i ; done ; \
- for i in ebin/*.beam ; do $(INSTALL) $$i $(ERLLIBDIR)/$$i ; done ; \
- for i in include/*.hrl ; do $(INSTALL) $$i $(ERLLIBDIR)/$$i ; done ; \
- for i in src/*.erl ; do $(INSTALL) $$i $(ERLLIBDIR)/$$i ; done
+ mkdir -p $(ERLANG_INSTALL_LIB_DIR_thrift) ; \
+ mkdir -p $(ERLANG_INSTALL_LIB_DIR_thrift)/ebin ; \
+ mkdir -p $(ERLANG_INSTALL_LIB_DIR_thrift)/include ; \
+ mkdir -p $(ERLANG_INSTALL_LIB_DIR_thrift)/src ; \
+ for i in ebin/*.app* ebin/*.beam include/*.hrl src/*.erl ; \
+ do $(INSTALL) $$p $(ERLANG_INSTALL_LIB_DIR_thrift)/$$p ; \
+ done
uninstall:
- rm -rf $(ERLLIBDIR)
+ rm -rf $(ERLANG_INSTALL_LIB_DIR_thrift)
-check: all
-distclean: clean
-
-# Hack to make "make dist" work.
-# This should not work, but it appears to.
-distdir:
+maintainer-clean-local:
+ rm -rf ebin
MAINTAINERCLEANFILES = Makefile.in
-
-maintainer-clean:
- test ! -d ebin || rm -rf ebin