Skip to content
Browse files

[enhance] configure: added a specific check for cryptokit, need >= 1.…

…5 now

You can upgrade your cryptokit with the dependencies/installation_helper.sh

Usual Steps :

1) rm -rf dependencies/cryptokit*
2) ./dependencies/installation_helper.sh --packages "findlib cryptokit" --prefix INSTALL_DIR
3) ./configure --prefix INSTALL_DIR
4) make clean
5) make all
6) make uninstall install
  • Loading branch information...
1 parent 4120638 commit 2f70b7f12410cb6b7018162b2332ae3d0a173fd5 @Aqua-Ye Aqua-Ye committed Feb 6, 2012
Showing with 43 additions and 1 deletion.
  1. +43 −1 configure
View
44 configure
@@ -552,13 +552,55 @@ lib-not-found () {
LIBS_NOT_FOUND[${#LIBS_NOT_FOUND[@]}]="$lib (might be found in package $package)"
}
+check-cryptokit () {
+ local OPTIONAL=""
+ if [ "$1" = "-opt" ]; then OPTIONAL=1; shift; fi
+ local MODULE=$1; shift # one module that the lib contains, to check
+ [ $# -gt 0 ] # remaining args: possible lib names (may be usual_dir/libname)
+
+ echo-check for $(basename $1)
+
+ local LIBDIR=""
+ local VERSION=""
+ local LIB
+ local LIB_NAMES=("$@")
+ while [ $# -gt 0 ] && [ -z "$LIBDIR" ]; do
+ LIB=$(basename $1)
+ USUAL_DIR=$(dirname $1)
+ [ "$USUAL_DIR" = "." ] && USUAL_DIR=$LIB
+ if [ -n "$OCAMLFIND" ] &&
+ LIBDIR=$("$OCAMLFIND" query "$LIB" 2>/dev/null) &&
+ VERSION=$("$OCAMLFIND" query -format %v "$LIB" 2>/dev/null)
+ then
+ LIB=$(check-cmxa $LIBDIR $LIB "${LIB_NAMES[@]}") || return 1
+ echo-ok -n "ocamlfind:$LIBDIR, "
+ else
+ echo-err "We need ocamlfind in order to check cryptokit version"
+ fi
+ shift
+ done
+ if [ -z "$LIBDIR" ]; then
+ echo-err "Not found"
+ return 1
+ elif CHECK_VERSION=$(echo "1.5" | tr -d '.') &&
+ CURRENT_VERSION=$(echo "$VERSION" | tr -d '.') &&
+ [ "$CURRENT_VERSION" -lt "$CHECK_VERSION" ]
+ then
+ echo-err "Invalid cryptokit version, must be >= 1.5"
+ return 1
+ fi
+
+ check-ocaml-lib "$MODULE" "$LIB" "$LIBDIR" || return 1
+ echo "$LIBDIR/$LIB"
+}
+
# - checking ocaml-ssl
if ! CONFIG_LIB_OCAMLSSL=$(locate-ocaml-lib "Ssl" "ssl")
then lib-not-found "ocaml_ssl" "libssl-ocaml-dev"
fi
# - checking cryptokit
-if ! CONFIG_LIB_CRYPTOKIT=$(EXTRA_TAGS="$EXTRA_TAGS -tag use_nums" locate-ocaml-lib "Cryptokit" "cryptokit")
+if ! CONFIG_LIB_CRYPTOKIT=$(EXTRA_TAGS="$EXTRA_TAGS -tag use_nums" check-cryptokit "Cryptokit" "cryptokit")
then lib-not-found "cryptokit" "libcryptokit-ocaml-dev"
fi

0 comments on commit 2f70b7f

Please sign in to comment.
Something went wrong with that request. Please try again.