Hi,
Here is a small patch that enhances one of the Erlang-related
macro to substitute a new variable. The documentation is
updated. Is that OK?
Regards,
Please CC me: I have not registered to the list. Thanks.
--
Romain Lenglet
--- autotools-cvs/autoconf/ChangeLog 2006-09-04 04:53:07.000000000 +0900
+++ autotools-patched/autoconf/ChangeLog 2006-09-05 16:47:40.000000000 +0900
@@ -1,3 +1,10 @@
+2006-09-05 Romain Lenglet <[EMAIL PROTECTED]>
+
+ * lib/autoconf/erlang.m4 (AC_ERLANG_CHECK_LIB): Added substitution
+ of ERLANG_LIB_VER_* variables.
+ * doc/autoconf.texi (Erlang Libraries): Document ERLANG_LIB_VER_*
+ variables.
+
2006-09-03 Paul Eggert <[EMAIL PROTECTED]>
and Ralf Wildenhues <[EMAIL PROTECTED]>
--- autotools-cvs/autoconf/doc/autoconf.texi 2006-09-04 04:53:07.000000000 +0900
+++ autotools-patched/autoconf/doc/autoconf.texi 2006-09-05 16:47:40.000000000 +0900
@@ -7337,20 +7337,29 @@
@defmac AC_ERLANG_CHECK_LIB (@var{library}, @ovar{action-if-found}, @ovar{action-if-not-found})
@acindex{ERLANG_CHECK_LIB}
@ovindex [EMAIL PROTECTED]
[EMAIL PROTECTED] [EMAIL PROTECTED]
-Test whether the Erlang/OTP library @var{library} is installed by calling
-Erlang's @code{code:lib_dir/1} function. The result of this test is cached if
-caching is enabled when running @command{configure}. @var{action-if-found} is a
-list of shell commands to run if the library is installed;
[EMAIL PROTECTED] is a list of shell commands to run if it is not.
-Additionally, if the library is installed, the output variable
[EMAIL PROTECTED]@var{library}} is set to the path to the library
-installation directory. For example, to check if library @code{stdlib} is
-installed:
+Test whether the Erlang/OTP library @var{library} is installed by
+calling Erlang's @code{code:lib_dir/1} function. The result of this
+test is cached if caching is enabled when running @command{configure}.
[EMAIL PROTECTED] is a list of shell commands to run if the library
+is installed; @var{action-if-not-found} is a list of shell commands to
+run if it is not. Additionally, if the library is installed, the output
+variable @[EMAIL PROTECTED] is set to the path to the
+library installation directory, and the output variable
[EMAIL PROTECTED]@var{library}} is set to the version number that is
+part of the subdirectory name, if it is in the standard form
+(@[EMAIL PROTECTED]@var{version}}). If the directory name does not
+have a version part, @[EMAIL PROTECTED] is set to the
+empty string. If the library is not installed,
[EMAIL PROTECTED]@var{library}} and
[EMAIL PROTECTED]@var{library}} are set to @code{"not found"}. For
+example, to check if library @code{stdlib} is installed:
@example
AC_ERLANG_CHECK_LIB([stdlib],
- [echo "stdlib is installed in $ERLANG_LIB_DIR_stdlib"],
+ [echo "stdlib version \"$ERLANG_LIB_VER_stdlib\""
+ echo "is installed in \"$ERLANG_LIB_DIR_stdlib\""],
[AC_MSG_ERROR([stdlib was not found!])])
@end example
@end defmac
--- autotools-cvs/autoconf/lib/autoconf/erlang.m4 2006-02-21 04:45:33.000000000 +0900
+++ autotools-patched/autoconf/lib/autoconf/erlang.m4 2006-09-05 16:47:40.000000000 +0900
@@ -181,13 +181,15 @@
-dnl Macro for checking if an Erlang library is installed
+dnl Macro for checking if an Erlang library is installed, and to
+dnl determine its version
# AC_ERLANG_CHECK_LIB(LIBRARY, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# -------------------------------------------------------------------
AC_DEFUN([AC_ERLANG_CHECK_LIB],
[AC_REQUIRE([AC_ERLANG_PATH_ERLC])[]dnl
AC_REQUIRE([AC_ERLANG_PATH_ERL])[]dnl
+AC_REQUIRE([AC_PROG_SED])[]dnl
AC_CACHE_CHECK([for Erlang/OTP '$1' library subdirectory],
[erlang_cv_lib_dir_$1],
[AC_LANG_PUSH(Erlang)[]dnl
@@ -203,14 +205,21 @@
end,
halt(ReturnValue)])],
[erlang_cv_lib_dir_$1=`cat conftest.out`],
- [if ! test -f conftest.out; then
+ [if test ! -f conftest.out; then
AC_MSG_FAILURE([test Erlang program execution failed])
else
erlang_cv_lib_dir_$1="not found"
fi])
AC_LANG_POP(Erlang)[]dnl
])
+AC_CACHE_CHECK([for Erlang/OTP '$1' library version],
+ [erlang_cv_lib_ver_$1],
+ [AS_IF([test "$erlang_cv_lib_dir_$1" = "not found"],
+ [erlang_cv_lib_ver_$1="not found"],
+ [erlang_cv_lib_ver_$1=`echo "$erlang_cv_lib_dir_$1" | $SED -n -e 's,^.*-\([[^/-]]*\)$,\1,p'`])[]dnl
+ ])
AC_SUBST([ERLANG_LIB_DIR_$1], [$erlang_cv_lib_dir_$1])
+AC_SUBST([ERLANG_LIB_VER_$1], [$erlang_cv_lib_ver_$1])
AS_IF([test "$erlang_cv_lib_dir_$1" = "not found"], [$3], [$2])
])# AC_ERLANG_CHECK_LIB