Ralf Wildenhues wrote:
[...]
> Why do you need AC_PROG_SED and $SED? Your script below is
> short and your input should not have too long lines, right?
> Then you could just use plain sed, as is done in several
> places in Autoconf.
OK. There was no specific reason. Only to be pedantic. ;-)
Here is the modified version of the patch using plain sed.
--
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/lib/autoconf/erlang.m4 2006-02-21 04:45:33.000000000 +0900
+++ autotools-patched/autoconf/lib/autoconf/erlang.m4 2006-09-05 17:07:32.000000000 +0900
@@ -181,7 +181,8 @@
-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])
# -------------------------------------------------------------------
@@ -203,14 +204,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
--- 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