2 # Helper to bypass AC_ERLANG_CHECK_LIB
4 # Ejabberd releases do not download specific versions of its erlang
5 # dependencies. Instead, it clones the master branch of a git
6 # repository and asks erl to provide the library version. However,
7 # the target erl program cannot be called from the host. So, this
8 # script aims at finding the library version installed on the target,
9 # without calling erlang.
15 Look for Erlang's library in TARGET_DIR/usr/lib/erlang/lib.
17 If the library is found, it returns the path to the latest version,
18 relative to TARGET_DIR. Otherwise, it returns "not found".
20 If there are several versions, it returns an error because it does not
21 know which one Erlang uses.
38 target_dir
="${TARGET_DIR:-output/target}"
40 [ -d "$target_dir" ] || die
"TARGET_DIR is not a directory. Please \
41 specify the TARGET_DIR environment variable."
43 case "$(ls -1d -- "$target_dir/usr
/lib
/erlang
/lib
/$library-"* | wc -l)" in
48 echo "$target_dir/usr/lib/erlang/lib/$library-"* \
49 |
sed -e "s,^$target_dir,,"
52 die
"Several versions of $library have been found. Please \
53 remove the unused ones."