Skip to content

Commit

Permalink
teach couch-config --erlang-version
Browse files Browse the repository at this point in the history
  • Loading branch information
janl committed Oct 3, 2013
1 parent 0f5aa11 commit 98683d9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bin/Makefile.am
Expand Up @@ -95,6 +95,7 @@ couch-config: couch-config.tpl
-e "s|%package_author_name%|@package_author_name@|g" \
-e "s|%package_name%|@package_name@|g" \
-e "s|%version%|@version@|g" \
-e "s|%erlangversion%|@erlangversion@|g" \
-e "s|%couchdb_command_name%|$(couchdb_command_name)|g" > \
$@ < $<
chmod +x $@
Expand All @@ -118,6 +119,7 @@ couch-config_dev: couch-config.tpl
-e "s|%package_author_name%|@package_author_name@|g" \
-e "s|%package_name%|@package_name@|g" \
-e "s|%version%|@version@|g" \
-e "s|%erlangversion%|@erlangversion@|g" \
-e "s|%couchdb_command_name%|$(abs_top_builddir)/utils/run|g" > \
$@ < $<
chmod +x $@
Expand Down
5 changes: 5 additions & 0 deletions bin/couch-config.tpl.in
Expand Up @@ -22,6 +22,7 @@ viewdir="%localstatelibdir%"
confdir="%localconfdir%"
urifile="%localstaterundir%/couch.uri"
logdir="%localstatelogdir%"
erlangversion="%erlangversion%"

version () {
cat << EOF
Expand Down Expand Up @@ -60,6 +61,7 @@ Options:
--log-dir log directory
--uri-file daemon sockets file
--couch-version version of Apache CouchDB
--erlang-version version of Erlang that CouchDB was built with
--version version of $basename
--help Print usage
Expand Down Expand Up @@ -108,6 +110,9 @@ do
--couch-version)
echo $couchversion
;;
--erlang-version)
echo $erlangversion
;;
--version)
version
exit 0
Expand Down
3 changes: 3 additions & 0 deletions bin/erlang-version.escript
@@ -0,0 +1,3 @@

main(_) ->
io:format("~s~n", [erlang:system_info(otp_release)]).
6 changes: 6 additions & 0 deletions configure.ac
Expand Up @@ -123,6 +123,7 @@ else
fi

AC_PATH_PROG([ERL], [erl])
AC_PATH_PROG([ESCRIPT], [escript])

AS_IF([test x${ERL} = x], [
AC_MSG_ERROR([Could not find the `erl' executable. Is Erlang installed?])
Expand Down Expand Up @@ -650,6 +651,9 @@ else
fi
fi

ERL_VERSION_COMMAND="${ESCRIPT} bin/erlang-version.escript"
erlangversion=`${ERL_VERSION_COMMAND}`

AC_ARG_VAR([ERL], [path to the `erl' executable])
AC_ARG_VAR([ERLC], [path to the `erlc' executable])

Expand Down Expand Up @@ -688,6 +692,8 @@ AC_SUBST([locallibdir], [${libdir}/${package_identifier}])
AC_SUBST([localstatelibdir], [${localstatedir}/lib/${package_identifier}])
AC_SUBST([localstatelogdir], [${localstatedir}/log/${package_identifier}])
AC_SUBST([localstaterundir], [${localstatedir}/run/${package_identifier}])
AC_SUBST([erlangversion], [${erlangversion}])


# On Windows we install directly into our erlang distribution.
if test x${IS_WINDOWS} = xTRUE; then
Expand Down
1 change: 1 addition & 0 deletions license.skip
Expand Up @@ -24,6 +24,7 @@
^bin/Makefile.in
^bin/couchdb.1
^bin/couchjs.1
^bin/erlang-version.escript
^build-aux/.*
^config..*
^configure
Expand Down

0 comments on commit 98683d9

Please sign in to comment.