summaryrefslogtreecommitdiff
path: root/tests/erlang.at
blob: 58789b64772486709d0c42ecd2391e33c17f701f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#							-*- Autotest -*-

AT_BANNER([Erlang low level compiling and utility macros.])

# Copyright (C) 2009-2012 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.


# 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.


## ----------------- ##
## Erlang Compiler.  ##
## ----------------- ##

AT_CHECK_MACRO([Erlang],
[[AC_ERLANG_PATH_ERL([no])
AC_ERLANG_PATH_ERLC([no])
if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
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_KEYWORDS([Erlang])])


## ---------------------- ##
## Erlang lib detection.  ##
## ---------------------- ##

AT_CHECK_MACRO([AC_ERLANG_CHECK_LIB],
[[AC_ERLANG_PATH_ERL([no])
AC_ERLANG_PATH_ERLC([no])
if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
AC_ERLANG_CHECK_LIB([stdlib],
		    [AC_MSG_RESULT([ok])],
		    [AC_MSG_RESULT([failed])])
## Test that the lib path detection really detected a directory:
if test "$ERLANG_LIB_DIR_stdlib" != "not found" \
  && test ! -d "$ERLANG_LIB_DIR_stdlib"; then
	AC_MSG_ERROR([incorrect ERLANG_LIB_DIR_stdlib variable])
fi
]],
[AT_KEYWORDS([Erlang])])


## --------------------------- ##
## Erlang root dir detection.  ##
## --------------------------- ##

AT_CHECK_MACRO([AC_ERLANG_SUBST_ROOT_DIR],
[[AC_ERLANG_PATH_ERL([no])
AC_ERLANG_PATH_ERLC([no])
if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
AC_ERLANG_SUBST_ROOT_DIR
## Test that the root path detection really detected a directory:
if test ! -d "$ERLANG_ROOT_DIR"; then
	AC_MSG_ERROR([incorrect ERLANG_ROOT_DIR variable])
fi
]],
[AT_KEYWORDS([Erlang])])


## -------------------------- ##
## Erlang lib dir detection.  ##
## -------------------------- ##

AT_CHECK_MACRO([AC_ERLANG_SUBST_LIB_DIR],
[[AC_ERLANG_PATH_ERL([no])
AC_ERLANG_PATH_ERLC([no])
if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
AC_ERLANG_SUBST_LIB_DIR
## Test that the lib path detection really detected a directory:
if test ! -d "$ERLANG_LIB_DIR"; then
	AC_MSG_ERROR([incorrect ERLANG_LIB_DIR variable])
fi
]],
[AT_KEYWORDS([Erlang])])


## ----------------------------------- ##
## Erlang install base dir detection.  ##
## ----------------------------------- ##

AT_CHECK_MACRO([AC_ERLANG_SUBST_INSTALL_LIB_DIR],
	       [AT_KEYWORDS([Erlang])])


## ---------------------------------- ##
## Erlang install lib dir detection.  ##
## ---------------------------------- ##

AT_CHECK_MACRO([AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR],
[[AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR([test_blah], [1.24-b])
## Test that the generated directory name is well-formed:
if test `echo "$ERLANG_INSTALL_LIB_DIR_test_blah" | sed -e 's/^.*\///'` != "test_blah-1.24-b"; then
	AC_MSG_ERROR([incorrect ERLANG_INSTALL_LIB_DIR_test_blah variable])
fi
]],
[AT_KEYWORDS([Erlang])])


## -------------------------- ##
## Erlang version detection.  ##
## -------------------------- ##

AT_CHECK_MACRO([AC_ERLANG_SUBST_ERTS_VER],
[[AC_ERLANG_PATH_ERL([no])
AC_ERLANG_PATH_ERLC([no])
if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
AC_ERLANG_SUBST_ERTS_VER
]],
[AT_KEYWORDS([Erlang])])