autoconf/tests/erlang.at

215 lines
4.5 KiB
Plaintext
Raw Normal View History

# -*- Autotest -*-
AT_BANNER([Erlang low level compiling and utility macros.])
# Copyright (C) 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
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# Since the macros which compile are required by most tests, check
# them first. But remember that looking for a compiler is even more
# primitive, so check those first.
# AT_SETUP_ERLANG(title)
# ----------------------
# Setup a test group for Erlang, named TITLE.
m4_define([AT_SETUP_ERLANG],
[AT_SETUP([$1])
AT_KEYWORDS([Erlang])
found_erl=no
found_erlc=no
_AS_PATH_WALK([], [
if AS_EXECUTABLE_P(["$as_dir/erl"]); then found_erl=yes; fi
if AS_EXECUTABLE_P(["$as_dir/erlc"]); then found_erlc=yes; fi
if test "${found_erl}${found_erlc}" = "yesyes"; then break; fi
])
AT_SKIP_IF([test "$found_erl$found_erlc" != "yesyes"])])
## ----------------- ##
## Erlang Compiler. ##
## ----------------- ##
AT_SETUP_ERLANG([Erlang])
AT_DATA([configure.ac],
[[AC_INIT
AC_ERLANG_NEED_ERL
AC_ERLANG_NEED_ERLC
AC_LANG([Erlang])
## Can't compile, but can run an Erlang module:
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [halt(0)])],
[AC_MSG_RESULT([ok])
AC_MSG_ERROR([compiling Erlang program should fail])],
[AC_MSG_RESULT([failed])])
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [halt(0)])],
[AC_MSG_RESULT([ok])],
[AC_MSG_RESULT([failed])
AC_MSG_ERROR([could not run test program])])
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([-q])
AT_CLEANUP
## ----------------------- ##
## Erlang path detection. ##
## ----------------------- ##
AT_SETUP_ERLANG([AC_ERLANG_CHECK_LIB])
AT_DATA([configure.ac],
[[AC_INIT
AC_ERLANG_NEED_ERL
AC_ERLANG_NEED_ERLC
AC_ERLANG_CHECK_LIB([stdlib],
[AC_MSG_RESULT([ok])],
[AC_MSG_RESULT([failed])])
AC_CONFIG_FILES([dir])
AC_OUTPUT
]])
AT_DATA([dir.in],
[[@ERLANG_LIB_DIR_stdlib@
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([-q])
dir=`cat dir`
rm -f dir
AT_CHECK([test "$dir" = "not found" || test -d "$dir"])
AT_CLEANUP
## --------------------------- ##
## Erlang root dir detection. ##
## --------------------------- ##
AT_SETUP_ERLANG([AC_ERLANG_SUBST_ROOT_DIR])
AT_DATA([configure.ac],
[[AC_INIT
AC_ERLANG_NEED_ERL
AC_ERLANG_NEED_ERLC
AC_ERLANG_SUBST_ROOT_DIR
AC_CONFIG_FILES([dir])
AC_OUTPUT
]])
AT_DATA([dir.in],
[[@ERLANG_ROOT_DIR@
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([-q])
dir=`cat dir`
rm -f dir
AT_CHECK([test -d "$dir"])
AT_CLEANUP
## -------------------------- ##
## Erlang lib dir detection. ##
## -------------------------- ##
AT_SETUP_ERLANG([AC_ERLANG_SUBST_LIB_DIR])
AT_DATA([configure.ac],
[[AC_INIT
AC_ERLANG_NEED_ERL
AC_ERLANG_NEED_ERLC
AC_ERLANG_SUBST_LIB_DIR
AC_CONFIG_FILES([dir])
AC_OUTPUT
]])
AT_DATA([dir.in],
[[@ERLANG_LIB_DIR@
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([-q])
dir=`cat dir`
rm -f dir
AT_CHECK([test -d "$dir"])
AT_CLEANUP
## ------------------------------- ##
## Erlang installation detection. ##
## ------------------------------- ##
AT_CHECK_MACRO([AC_ERLANG_SUBST_INSTALL_LIB_DIR], [],
[AT_KEYWORDS([Erlang])])
## ------------------------------- ##
## Erlang installation detection. ##
## ------------------------------- ##
AT_SETUP([AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR])
AT_KEYWORDS([Erlang])
AT_DATA([configure.ac],
[[AC_INIT
AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR([test_blah], [1.24-b])
AC_CONFIG_FILES([dir])
AC_OUTPUT
]])
AT_DATA([dir.in],
[[@ERLANG_INSTALL_LIB_DIR_test_blah@
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([-q])
dir=`cat dir`
subdir=`AS_BASENAME([$dir])`
rm -f dir
AT_CHECK([test "$subdir" = "test_blah-1.24-b"])
AT_CLEANUP
## -------------------------- ##
## Erlang version detection. ##
## -------------------------- ##
AT_SETUP_ERLANG([AC_ERLANG_SUBST_ERTS_VER])
AT_DATA([configure.ac],
[[AC_INIT
AC_ERLANG_NEED_ERL
AC_ERLANG_NEED_ERLC
AC_ERLANG_SUBST_ERTS_VER
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([-q])
AT_CLEANUP