From: Romain Lenglet Date: Thu, 28 May 2009 11:14:07 +0000 (+0900) Subject: New AC_ERLANG_SUBST_ERTS_VER macro. X-Git-Tag: v2.64~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e380c5ada53c8212506aabc8971caaf5eae6137;p=thirdparty%2Fautoconf.git 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 --- diff --git a/AUTHORS b/AUTHORS index 9c07a86a5..aac3f0089 100644 --- a/AUTHORS +++ b/AUTHORS @@ -83,7 +83,7 @@ Gregorio Guidi greg_g@gentoo.org 2005-03-03 Bruno Haible bruno@clisp.org 2005-06-12 Toby Oliver Hilary White tow21@cam.ac.uk 2005-10-18 Eric Benjamin Blake ebb9@byu.net 2006-01-18 -Romain Lenglet rlenglet@users.forge.objectweb.org 2006-02-10 +Romain Lenglet romain.lenglet@laposte.net 2006-02-10 Markus Duft markus.duft@salomon.at 2006-08-03 Robert Schiele rschiele@gmail.com 2006-09-12 Joel Edward Denny jdenny@clemson.edu 2006-09-15 diff --git a/ChangeLog b/ChangeLog index e07b300e3..a9f3ca84d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-05-28 Romain Lenglet + + 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 Sanitize more problematic environment variables. diff --git a/NEWS b/NEWS index 9626cacd7..82ba63515 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 3c2843b2e..eab63f2c5 100644 --- a/THANKS +++ b/THANKS @@ -313,8 +313,9 @@ Roger Leigh rleigh@whinlatter.ukfsn.org Roland McGrath roland@gnu.org Rolf Ebert rolf.ebert.gcc@gmx.de Rolf Vandevaart Rolf.Vandevaart@sun.com -Romain Lenglet rlenglet@users.forge.objectweb.org +Romain Lenglet romain.lenglet@laposte.net Ruediger Kuhlmann info@ruediger-kuhlmann.de +Ruslan Babayev ruslan@babayev.com Russ Allbery rra@stanford.edu Russ Boylan ross@biostat.ucsf.edu Ryuji Abe raeva@t3.rim.or.jp diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 3ddecdf61..632058db7 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -7798,10 +7798,22 @@ presence of certain Erlang libraries. All those macros require the configuration of an Erlang interpreter and an Erlang compiler (@pxref{Erlang Compiler and Interpreter}). +@defmac AC_ERLANG_SUBST_ERTS_VER +@acindex{ERLANG_SUBST_ERTS_VER} +@ovindex ERLANG_ERTS_VER +Set the output variable @code{ERLANG_ERTS_VER} to the version of the +Erlang runtime system (as returned by Erlang's +@code{erlang:system_info(version)} function). The result of this test +is cached if caching is enabled when running @command{configure}. The +@code{ERLANG_ERTS_VER} 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. +@end 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 @@ caching is enabled when running @command{configure}. @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 @@ when running @command{configure}. @acindex{ERLANG_CHECK_LIB} @ovindex ERLANG_LIB_DIR_@var{library} @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}. @@ -7848,6 +7858,35 @@ AC_ERLANG_CHECK_LIB([stdlib], echo "is installed in \"$ERLANG_LIB_DIR_stdlib\""], [AC_MSG_ERROR([stdlib was not found!])]) @end example + +The @samp{ERLANG_LIB_VER_@var{library}} variables (set by +@code{AC_ERLANG_CHECK_LIB}) 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 +@code{stdlib} library, @file{configure.ac} could contain: + +@example +AC_ERLANG_SUBST_ERTS_VER +AC_ERLANG_CHECK_LIB([stdlib], + [], + [AC_MSG_ERROR([stdlib was not found!])]) +AC_CONFIG_FILES([example.rel]) +@end example + +@noindent +The @file{example.rel.in} file used to generate @file{example.rel} +should contain: + +@example +{release, + {"@@PACKAGE@@", "@@VERSION@@"}, + {erts, "@@ERLANG_ERTS_VER@@"}, + [{stdlib, "@@ERLANG_LIB_VER_stdlib@@"}, + {@@PACKAGE@@, "@@VERSION@@"}]}. +@end 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 7f6d92d9d..1e4418bdd 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 @@ -163,7 +163,7 @@ $2 # Find the Erlang preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able. AC_DEFUN([AC_LANG_PREPROC(Erlang)], [m4_warn([syntax], - [$0: No preprocessor defined for ]_AC_LANG)]) + [$0: No preprocessor defined for ]_AC_LANG)]) # AC_LANG_COMPILER(Erlang) # ------------------------ @@ -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 @@ -184,29 +183,29 @@ AC_CACHE_CHECK([for Erlang/OTP '$1' library subdirectory], [erlang_cv_lib_dir_$1], [AC_LANG_PUSH(Erlang)[]dnl AC_RUN_IFELSE( - [AC_LANG_PROGRAM([], [dnl - ReturnValue = case code:lib_dir("[$1]") of - {error, bad_name} -> - file:write_file("conftest.out", "not found\n"), - 1; - LibDir -> - file:write_file("conftest.out", LibDir), - 0 - end, - halt(ReturnValue)])], - [erlang_cv_lib_dir_$1=`cat conftest.out`], - [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_PROGRAM([], [dnl + ReturnValue = case code:lib_dir("[$1]") of + {error, bad_name} -> + file:write_file("conftest.out", "not found\n"), + 1; + LibDir -> + file:write_file("conftest.out", LibDir), + 0 + end, + halt(ReturnValue)])], + [erlang_cv_lib_dir_$1=`cat conftest.out`], + [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=`AS_ECHO(["$erlang_cv_lib_dir_$1"]) | sed -n -e 's,^.*-\([[^/-]]*\)$,\1,p'`])[]dnl + [erlang_cv_lib_ver_$1="not found"], + [erlang_cv_lib_ver_$1=`AS_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]) @@ -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 @@ -225,13 +223,13 @@ AC_CACHE_CHECK([for Erlang/OTP root directory], [erlang_cv_root_dir], [AC_LANG_PUSH(Erlang)[]dnl AC_RUN_IFELSE( - [AC_LANG_PROGRAM([], [dnl - RootDir = code:root_dir(), - file:write_file("conftest.out", RootDir), - ReturnValue = 0, - halt(ReturnValue)])], - [erlang_cv_root_dir=`cat conftest.out`], - [AC_MSG_FAILURE([test Erlang program execution failed])]) + [AC_LANG_PROGRAM([], [dnl + RootDir = code:root_dir(), + file:write_file("conftest.out", RootDir), + ReturnValue = 0, + halt(ReturnValue)])], + [erlang_cv_root_dir=`cat conftest.out`], + [AC_MSG_FAILURE([test Erlang program execution failed])]) AC_LANG_POP(Erlang)[]dnl ]) AC_SUBST([ERLANG_ROOT_DIR], [$erlang_cv_root_dir]) @@ -247,13 +245,13 @@ AC_CACHE_CHECK([for Erlang/OTP library base directory], [erlang_cv_lib_dir], [AC_LANG_PUSH(Erlang)[]dnl AC_RUN_IFELSE( - [AC_LANG_PROGRAM([], [dnl - LibDir = code:lib_dir(), - file:write_file("conftest.out", LibDir), - ReturnValue = 0, - halt(ReturnValue)])], - [erlang_cv_lib_dir=`cat conftest.out`], - [AC_MSG_FAILURE([test Erlang program execution failed])]) + [AC_LANG_PROGRAM([], [dnl + LibDir = code:lib_dir(), + file:write_file("conftest.out", LibDir), + ReturnValue = 0, + halt(ReturnValue)])], + [erlang_cv_lib_dir=`cat conftest.out`], + [AC_MSG_FAILURE([test Erlang program execution failed])]) AC_LANG_POP(Erlang)[]dnl ]) AC_SUBST([ERLANG_LIB_DIR], [$erlang_cv_lib_dir]) @@ -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