Previous: C and Posix Variants, Up: Existing Tests [Contents][Index]
The following macros check for an installation of Erlang/OTP, and for the presence of certain Erlang libraries. All those macros require the configuration of an Erlang interpreter and an Erlang compiler (see Erlang Compiler and Interpreter Characteristics).
Set the output variable ERLANG_ERTS_VER
to the version of the
Erlang runtime system (as returned by Erlang’s
erlang:system_info(version)
function). The result of this test
is cached if caching is enabled when running configure
. The
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 (.rel
files), as shown below.
Set the output variable ERLANG_ROOT_DIR
to the path to the base
directory in which Erlang/OTP is installed (as returned by Erlang’s
code:root_dir/0
function). The result of this test is cached if
caching is enabled when running configure
.
Set the output variable ERLANG_LIB_DIR
to the path of the library
directory of Erlang/OTP (as returned by Erlang’s
code:lib_dir/0
function), which subdirectories each contain an installed
Erlang/OTP library. The result of this test is cached if caching is enabled
when running configure
.
Test whether the Erlang/OTP library library is installed by
calling Erlang’s code:lib_dir/1
function. The result of this
test is cached if caching is enabled when running configure
.
action-if-found is a list of shell commands to run if the library
is installed; 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 ‘ERLANG_LIB_DIR_library’ is set to the path to the
library installation directory, and the output variable
‘ERLANG_LIB_VER_library’ is set to the version number that is
part of the subdirectory name, if it is in the standard form
(library-version
). If the directory name does not
have a version part, ‘ERLANG_LIB_VER_library’ is set to the
empty string. If the library is not installed,
‘ERLANG_LIB_DIR_library’ and
‘ERLANG_LIB_VER_library’ are set to "not found"
. For
example, to check if library stdlib
is installed:
AC_ERLANG_CHECK_LIB([stdlib], [echo "stdlib version \"$ERLANG_LIB_VER_stdlib\"" echo "is installed in \"$ERLANG_LIB_DIR_stdlib\""], [AC_MSG_ERROR([stdlib was not found!])])
The ‘ERLANG_LIB_VER_library’ variables (set by
AC_ERLANG_CHECK_LIB
) and the ERLANG_ERTS_VER
variable (set
by 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 (.rel
files). For instance, to
generate a example.rel file for an application depending on the
stdlib
library, configure.ac could contain:
AC_ERLANG_SUBST_ERTS_VER AC_ERLANG_CHECK_LIB([stdlib], [], [AC_MSG_ERROR([stdlib was not found!])]) AC_CONFIG_FILES([example.rel])
The example.rel.in file used to generate example.rel should contain:
{release, {"@PACKAGE@", "@VERSION@"}, {erts, "@ERLANG_ERTS_VER@"}, [{stdlib, "@ERLANG_LIB_VER_stdlib@"}, {@PACKAGE@, "@VERSION@"}]}.
In addition to the above macros, which test installed Erlang libraries, the following macros determine the paths to the directories into which newly built Erlang libraries are to be installed:
Set the ERLANG_INSTALL_LIB_DIR
output variable to the directory into
which every built Erlang library should be installed in a separate
subdirectory.
If this variable is not set in the environment when configure
runs,
its default value is ${libdir}/erlang/lib
.
Set the ‘ERLANG_INSTALL_LIB_DIR_library’ output variable to the
directory into which the built Erlang library library version
version should be installed. If this variable is not set in the
environment when configure
runs, its default value is
‘$ERLANG_INSTALL_LIB_DIR/library-version’, the value of the
ERLANG_INSTALL_LIB_DIR
variable being set by the
AC_ERLANG_SUBST_INSTALL_LIB_DIR
macro.
Previous: C and Posix Variants, Up: Existing Tests [Contents][Index]