]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/autoconf/erlang.m4 (AC_ERLANG_CHECK_LIB): Added substitution
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 5 Sep 2006 14:36:17 +0000 (14:36 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 5 Sep 2006 14:36:17 +0000 (14:36 +0000)
of ERLANG_LIB_VER_* variables.
* doc/autoconf.texi (Erlang Libraries): Document ERLANG_LIB_VER_*
variables.

ChangeLog
doc/autoconf.texi
lib/autoconf/erlang.m4

index baac4206bd558af18d788cf281ed18a46fc4a820..cb5d0eacc97df59eeff9224141faaaff52b7d167 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-09-05  Romain Lenglet  <rlenglet@users.forge.objectweb.org>
+
+       * 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  <eggert@cs.ucla.edu>
        and Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
index 4fe25e60fea0f1f7b65a400cb4710495fc32c7b0..380da694a59fb67a825dbc0e6f8dea87376e2128 100644 (file)
@@ -7337,20 +7337,29 @@ when running @command{configure}.
 @defmac AC_ERLANG_CHECK_LIB (@var{library}, @ovar{action-if-found}, @ovar{action-if-not-found})
 @acindex{ERLANG_CHECK_LIB}
 @ovindex ERLANG_LIB_DIR_@var{library}
-
-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;
-@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
-@samp{ERLANG_LIB_DIR_@var{library}} is set to the path to the library
-installation directory.  For example, to check if library @code{stdlib} is
-installed:
+@ovindex ERLANG_LIB_VER_@var{library}
+
+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; @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 @samp{ERLANG_LIB_DIR_@var{library}} is set to the path to the
+library installation directory, and the output variable
+@samp{ERLANG_LIB_VER_@var{library}} is set to the version number that is
+part of the subdirectory name, if it is in the standard form
+(@code{@var{library}-@var{version}}).  If the directory name does not
+have a version part, @samp{ERLANG_LIB_VER_@var{library}} is set to the
+empty string.  If the library is not installed,
+@samp{ERLANG_LIB_DIR_@var{library}} and
+@samp{ERLANG_LIB_VER_@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
index cef65c107137485243a2bc21f96b229a43549497..b71049a858021eddb3b88efa3e1ad030e6610f5b 100644 (file)
@@ -181,7 +181,8 @@ AC_DEFUN([AC_LANG_COMPILER(Erlang)],
 
 
 
-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 @@ AC_CACHE_CHECK([for Erlang/OTP '$1' library subdirectory],
             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