[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: new AC_ERLANG_SUBST_ERTS_VER macro
From: |
Eric Blake |
Subject: |
Re: new AC_ERLANG_SUBST_ERTS_VER macro |
Date: |
Thu, 28 May 2009 06:23:19 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Romain Lenglet on 5/28/2009 5:14 AM:
> On Wednesday 27 May 2009 20:19:15 Eric Blake wrote:
>> OK, I think this patch is safe to apply from a copyright perspective.
>> However, before we do that, can you find an email address for Ruslan, or
>> at least a URL containing his suggestion, rather than just putting a ? in
>> the THANKS?
>
> OK, here is an updated patch with Ruslan's email address.
Thanks for the updated patch. After fixing your trailing whitespace, I
made some further minor tweaks, including a NEWS entry and corrected
texinfo markup. Here's a trimmed version of what I'm pushing. It would
be really nice if someone familiar with Erlang added an Erlang test to the
testsuite, so that we could exercise this macro; meanwhile, since I'm not
familiar with Erlang, I'm trusting your patch.
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkoegjcACgkQ84KuGfSFAYDpUwCdFaz/4nieXv51/Uf1rN1whAgZ
3dgAn3+M+MmZbT2Pouf+UubiDA+19F83
=8TSZ
-----END PGP SIGNATURE-----
>From 9e380c5ada53c8212506aabc8971caaf5eae6137 Mon Sep 17 00:00:00 2001
From: Romain Lenglet <address@hidden>
Date: Thu, 28 May 2009 20:14:07 +0900
Subject: [PATCH] New AC_ERLANG_SUBST_ERTS_VER macro.
* lib/autoconf/erlang.m4: Add macro AC_ERLANG_SUBST_ERTS_VER.
* doc/autoconf.texi (Erlang Libraries): Document
AC_ERLANG_SUBST_ERTS_VER.
* NEWS: Likewise.
* AUTHORS: Update Romain Lenglet's email address.
* THANKS: Update.
Suggested by Ruslan Babayev.
Signed-off-by: Eric Blake <address@hidden>
---
AUTHORS | 2 +-
ChangeLog | 11 +++++
NEWS | 3 +
THANKS | 3 +-
doc/autoconf.texi | 45 ++++++++++++++++++++-
lib/autoconf/erlang.m4 | 102 ++++++++++++++++++++++++++++-------------------
6 files changed, 120 insertions(+), 46 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index 9c07a86..aac3f00 100644
--- a/AUTHORS
+++ b/AUTHORS
diff --git a/ChangeLog b/ChangeLog
index e07b300..a9f3ca8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-05-28 Romain Lenglet <address@hidden>
+
+ New AC_ERLANG_SUBST_ERTS_VER macro.
+ * lib/autoconf/erlang.m4: Add macro AC_ERLANG_SUBST_ERTS_VER.
+ * doc/autoconf.texi (Erlang Libraries): Document
+ AC_ERLANG_SUBST_ERTS_VER.
+ * NEWS: Likewise.
+ * AUTHORS: Update Romain Lenglet's email address.
+ * THANKS: Update.
+ Suggested by Ruslan Babayev.
+
2009-05-26 Eric Blake <address@hidden>
Sanitize more problematic environment variables.
diff --git a/NEWS b/NEWS
index 9626cac..82ba635 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,9 @@ GNU Autoconf NEWS - User visible changes.
** AS_IF and AS_CASE have been taught to avoid syntax errors even when
given arguments that expand to just whitespace.
+** The following documented autoconf macros are new:
+ AC_ERLANG_SUBST_ERTS_VER
+
** Ensure AT_CHECK can support commands that include a # given with
proper m4 quoting. For shell comments, this is a new feature; for
non-shell comments, this fixes a regression introduced in 2.63b.
diff --git a/THANKS b/THANKS
index 3c2843b..eab63f2 100644
--- a/THANKS
+++ b/THANKS
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 3ddecdf..632058d 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -7798,10 +7798,22 @@ Erlang Libraries
configuration of an Erlang interpreter and an Erlang compiler
(@pxref{Erlang Compiler and Interpreter}).
address@hidden AC_ERLANG_SUBST_ERTS_VER
address@hidden
address@hidden ERLANG_ERTS_VER
+Set the output variable @code{ERLANG_ERTS_VER} to the version of the
+Erlang runtime system (as returned by Erlang's
address@hidden:system_info(version)} function). The result of this test
+is cached if caching is enabled when running @command{configure}. The
address@hidden variable is not intended to be used for testing
+for features of specific ERTS versions, but to be used for substituting
+the ERTS version in Erlang/OTP release resource files (@code{.rel}
+files), as shown below.
address@hidden defmac
+
@defmac AC_ERLANG_SUBST_ROOT_DIR
@acindex{ERLANG_SUBST_ROOT_DIR}
@ovindex ERLANG_ROOT_DIR
-
Set the output variable @code{ERLANG_ROOT_DIR} to the path to the base
directory in which Erlang/OTP is installed (as returned by Erlang's
@code{code:root_dir/0} function). The result of this test is cached if
@@ -7811,7 +7823,6 @@ Erlang Libraries
@defmac AC_ERLANG_SUBST_LIB_DIR
@acindex{ERLANG_SUBST_LIB_DIR}
@ovindex ERLANG_LIB_DIR
-
Set the output variable @code{ERLANG_LIB_DIR} to the path of the library
directory of Erlang/OTP (as returned by Erlang's
@code{code:lib_dir/0} function), which subdirectories each contain an installed
@@ -7824,7 +7835,6 @@ Erlang Libraries
@acindex{ERLANG_CHECK_LIB}
@ovindex address@hidden
@ovindex address@hidden
-
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}.
@@ -7848,6 +7858,35 @@ Erlang Libraries
echo "is installed in \"$ERLANG_LIB_DIR_stdlib\""],
[AC_MSG_ERROR([stdlib was not found!])])
@end example
+
+The @address@hidden variables (set by
address@hidden) and the @code{ERLANG_ERTS_VER} variable (set
+by @code{AC_ERLANG_SUBST_ERTS_VER}) are not intended to be used for
+testing for features of specific versions of libraries or of the Erlang
+runtime system. Those variables are intended to be substituted in
+Erlang release resource files (@code{.rel} files). For instance, to
+generate a @file{example.rel} file for an application depending on the
address@hidden library, @file{configure.ac} could contain:
+
address@hidden
+AC_ERLANG_SUBST_ERTS_VER
+AC_ERLANG_CHECK_LIB([stdlib],
+ [],
+ [AC_MSG_ERROR([stdlib was not found!])])
+AC_CONFIG_FILES([example.rel])
address@hidden example
+
address@hidden
+The @file{example.rel.in} file used to generate @file{example.rel}
+should contain:
+
address@hidden
+{release,
+ {"@@PACKAGE@@", "@@VERSION@@"},
+ {erts, "@@ERLANG_ERTS_VER@@"},
+ [{stdlib, "@@ERLANG_LIB_VER_stdlib@@"},
+ {@@PACKAGE@@, "@@VERSION@@"}]}.
address@hidden example
@end defmac
In addition to the above macros, which test installed Erlang libraries, the
diff --git a/lib/autoconf/erlang.m4 b/lib/autoconf/erlang.m4
index 7f6d92d..1e4418b 100644
--- a/lib/autoconf/erlang.m4
+++ b/lib/autoconf/erlang.m4
@@ -1,6 +1,6 @@
# This file is part of Autoconf. -*- Autoconf -*-
# Erlang/OTP language support.
-# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -175,8 +175,7 @@ AC_DEFUN([AC_LANG_COMPILER(Erlang)],
# AC_ERLANG_CHECK_LIB(LIBRARY, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# ----------------------------------------------------------------------
# Macro for checking if an Erlang library is installed, and to
-# determine its version
-#
+# determine its version.
AC_DEFUN([AC_ERLANG_CHECK_LIB],
[AC_REQUIRE([AC_ERLANG_PATH_ERLC])[]dnl
AC_REQUIRE([AC_ERLANG_PATH_ERL])[]dnl
@@ -216,8 +215,7 @@ AS_IF([test "$erlang_cv_lib_dir_$1" = "not found"], [$3],
[$2])
# AC_ERLANG_SUBST_ROOT_DIR
# ------------------------
-# Determines the Erlang/OTP root directory
-#
+# Determines the Erlang/OTP root directory.
AC_DEFUN([AC_ERLANG_SUBST_ROOT_DIR],
[AC_REQUIRE([AC_ERLANG_NEED_ERLC])[]dnl
AC_REQUIRE([AC_ERLANG_NEED_ERL])[]dnl
@@ -262,11 +260,9 @@ AC_SUBST([ERLANG_LIB_DIR], [$erlang_cv_lib_dir])
# AC_ERLANG_SUBST_INSTALL_LIB_DIR
# -------------------------------
-#
# Directories for installing Erlang/OTP packages are separated from the
# directories determined by running the Erlang/OTP installation that is used
# for building.
-#
AC_DEFUN([AC_ERLANG_SUBST_INSTALL_LIB_DIR],
[AC_MSG_CHECKING([for Erlang/OTP library installation base directory])
AC_ARG_VAR([ERLANG_INSTALL_LIB_DIR],
@@ -286,7 +282,8 @@ AC_DEFUN([AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR],
[AC_REQUIRE([AC_ERLANG_SUBST_INSTALL_LIB_DIR])[]dnl
AC_MSG_CHECKING([for Erlang/OTP '$1' library installation subdirectory])
AC_ARG_VAR([ERLANG_INSTALL_LIB_DIR_$1],
- [Erlang/OTP '$1' library installation subdirectory
[ERLANG_INSTALL_LIB_DIR/$1-$2]])
+ [Erlang/OTP '$1' library installation subdirectory
+ [ERLANG_INSTALL_LIB_DIR/$1-$2]])
if test -n "$ERLANG_INSTALL_LIB_DIR_$1"; then
AC_MSG_RESULT([$ERLANG_INSTALL_LIB_DIR_$1])
else
@@ -294,3 +291,26 @@ else
AC_MSG_RESULT([$ERLANG_INSTALL_LIB_DIR/$1-$2])
fi
])# AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR
+
+
+# AC_ERLANG_SUBST_ERTS_VER
+# ------------------------
+# Determines the Erlang runtime system version.
+AC_DEFUN([AC_ERLANG_SUBST_ERTS_VER],
+[AC_REQUIRE([AC_ERLANG_NEED_ERLC])[]dnl
+AC_REQUIRE([AC_ERLANG_NEED_ERL])[]dnl
+AC_CACHE_CHECK([for Erlang/OTP ERTS version],
+ [erlang_cv_erts_ver],
+ [AC_LANG_PUSH([Erlang])[]dnl
+ AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM([], [dnl
+ Version = erlang:system_info(version),
+ file:write_file("conftest.out", Version),
+ ReturnValue = 0,
+ halt(ReturnValue)])],
+ [erlang_cv_erts_ver=`cat conftest.out`],
+ [AC_MSG_FAILURE([test Erlang program execution failed])])
+ AC_LANG_POP([Erlang])[]dnl
+ ])
+AC_SUBST([ERLANG_ERTS_VER], [$erlang_cv_erts_ver])
+])# AC_ERLANG_SUBST_ERTS_VER
--
1.6.3.rc3.2.g4b51