| 1 |
# -*- Autotest -*- |
| 2 |
|
| 3 |
# Macros tested in acerlang.at: |
| 4 |
# AC_ERLANG_PATH_ERL |
| 5 |
# AC_ERLANG_PATH_ERLC |
| 6 |
# AC_ERLANG_SUBST_ERTS_VER |
| 7 |
# AU::AC_LANG_ERLANG |
| 8 |
|
| 9 |
AT_BANNER([Erlang low level compiling and utility macros.]) |
| 10 |
|
| 11 |
# Copyright (C) 2009-2017, 2020-2026 Free Software Foundation, Inc. |
| 12 |
# |
| 13 |
# This program is free software: you can redistribute it and/or modify |
| 14 |
# it under the terms of the GNU General Public License as published by |
| 15 |
# the Free Software Foundation, either version 3 of the License, or |
| 16 |
# (at your option) any later version. |
| 17 |
# |
| 18 |
# This program is distributed in the hope that it will be useful, |
| 19 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 |
# GNU General Public License for more details. |
| 22 |
# |
| 23 |
# You should have received a copy of the GNU General Public License |
| 24 |
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 25 |
|
| 26 |
|
| 27 |
# Since the macros which compile are required by most tests, check |
| 28 |
# them first. But remember that looking for a compiler is even more |
| 29 |
# primitive, so check those first. |
| 30 |
|
| 31 |
|
| 32 |
## ----------------- ## |
| 33 |
## Erlang Compiler. ## |
| 34 |
## ----------------- ## |
| 35 |
|
| 36 |
AT_CHECK_MACRO([Erlang basic compilation], |
| 37 |
[[AC_LANG([Erlang]) |
| 38 |
|
| 39 |
AC_CACHE_CHECK([whether erlc works], [ac_cv_erlang_erlc_works], |
| 40 |
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [halt(0)])], |
| 41 |
[ac_cv_erlang_erlc_works=yes], |
| 42 |
[ac_cv_erlang_erlc_works=no])]) |
| 43 |
|
| 44 |
if test $ac_cv_erlang_erlc_works = no; then |
| 45 |
AC_MSG_ERROR([could not compile a test Erlang module]) |
| 46 |
fi |
| 47 |
|
| 48 |
# To keep AT_CHECK_MACRO happy, we lie and say that erl does work |
| 49 |
# when cross compiling. |
| 50 |
AC_CACHE_CHECK([whether erl works], [ac_cv_erlang_erl_works], |
| 51 |
[AC_RUN_IFELSE([AC_LANG_PROGRAM([], [halt(0)])], |
| 52 |
[ac_cv_erlang_erl_works=yes], |
| 53 |
[ac_cv_erlang_erl_works=no], |
| 54 |
[ac_cv_erlang_erl_works=yes])]) |
| 55 |
|
| 56 |
if test $ac_cv_erlang_erl_works = no; then |
| 57 |
AC_MSG_ERROR([could not run a test Erlang module]) |
| 58 |
fi |
| 59 |
]]) |
| 60 |
|
| 61 |
|
| 62 |
## ---------------------- ## |
| 63 |
## Erlang lib detection. ## |
| 64 |
## ---------------------- ## |
| 65 |
|
| 66 |
AT_CHECK_MACRO([AC_ERLANG_CHECK_LIB], |
| 67 |
[[AC_ERLANG_CHECK_LIB([stdlib]) |
| 68 |
if test "$ERLANG_LIB_DIR_stdlib" = "not found"; then |
| 69 |
AC_MSG_ERROR([failed to find the Erlang stdlib]) |
| 70 |
fi |
| 71 |
## Test that the lib path detection really detected a directory: |
| 72 |
if test ! -d "$ERLANG_LIB_DIR_stdlib"; then |
| 73 |
AC_MSG_ERROR([incorrect ERLANG_LIB_DIR_stdlib variable]) |
| 74 |
fi |
| 75 |
]]) |
| 76 |
|
| 77 |
|
| 78 |
## --------------------------- ## |
| 79 |
## Erlang root dir detection. ## |
| 80 |
## --------------------------- ## |
| 81 |
|
| 82 |
AT_CHECK_MACRO([AC_ERLANG_SUBST_ROOT_DIR], |
| 83 |
[[AC_ERLANG_SUBST_ROOT_DIR |
| 84 |
## Test that the root path detection really detected a directory: |
| 85 |
if test ! -d "$ERLANG_ROOT_DIR"; then |
| 86 |
AC_MSG_ERROR([incorrect ERLANG_ROOT_DIR variable]) |
| 87 |
fi |
| 88 |
]]) |
| 89 |
|
| 90 |
|
| 91 |
## -------------------------- ## |
| 92 |
## Erlang lib dir detection. ## |
| 93 |
## -------------------------- ## |
| 94 |
|
| 95 |
AT_CHECK_MACRO([AC_ERLANG_SUBST_LIB_DIR], |
| 96 |
[[AC_ERLANG_SUBST_LIB_DIR |
| 97 |
## Test that the lib path detection really detected a directory: |
| 98 |
if test ! -d "$ERLANG_LIB_DIR"; then |
| 99 |
AC_MSG_ERROR([incorrect ERLANG_LIB_DIR variable]) |
| 100 |
fi |
| 101 |
]], |
| 102 |
[AT_KEYWORDS([Erlang])]) |
| 103 |
|
| 104 |
|
| 105 |
## ---------------------------------- ## |
| 106 |
## Erlang install lib dir detection. ## |
| 107 |
## ---------------------------------- ## |
| 108 |
|
| 109 |
AT_CHECK_MACRO([AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR], |
| 110 |
[[AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR([test_blah], [1.24-b]) |
| 111 |
## Test that the generated directory name is well-formed: |
| 112 |
if test `echo "$ERLANG_INSTALL_LIB_DIR_test_blah" | sed -e 's/^.*\///'` \ |
| 113 |
!= "test_blah-1.24-b"; then |
| 114 |
AC_MSG_ERROR([incorrect ERLANG_INSTALL_LIB_DIR_test_blah variable]) |
| 115 |
fi |
| 116 |
]], |
| 117 |
[AT_KEYWORDS([Erlang])]) |