uclibc: fix two more regressions introduced in 1.0.18
[buildroot-gz.git] / package / ejabberd / check-erlang-lib
blob63f8bf192648ba28e04a4602d25b49e74086c012
1 #!/bin/sh -e
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.
11 usage() {
12 cat <<EOF
13 Usage:
14 $0 library
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.
23 EOF
26 die () {
27 echo "$@" >&2
28 exit 1
31 if [ $# -ne 1 ]; then
32 usage
33 exit 0
34 else
35 library="$1"
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
45 echo "not found"
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."
55 esac