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
@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
@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}.
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
# 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
# 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)
# ------------------------
# 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
[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])
# 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
[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])
[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])
# 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],
[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
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