#! /bin/sh # Try to turn internationalization off unset LANG unset LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME set -e PINNED=0 SKIP_VERSION_CHECK=0 for i in "$@"; do case $i in --bindir=*) BINDIR=${i##*=} ;; --libdir=*) LIBDIR=${i##*=} ;; --pkgdir=*) PKGDIR=${i##*=} ;; --pinned*) PINNED=1 ;; --skip-version-check) SKIP_VERSION_CHECK=1 ;; *) echo "usage: ./configure [--bindir=] [--libdir=] [--pkgdir=]" 1>&2 exit 2 ;; esac done # OCaml is already installed, this means we should have everything we # need. Just dump its configuration. ocaml_version=`ocamlc -version` major=`echo $ocaml_version | cut -d. -f1` minor=`echo $ocaml_version | cut -d. -f2` camlp4_version=5.4 camlp4_major=`echo $camlp4_version | cut -d. -f1` camlp4_minor=`echo $camlp4_version | cut -d. -f2` if [ $major -lt 4 -o \( $major -eq 4 -a $minor -lt 2 \) ]; then echo "The standalone Camlp4 requires OCaml >= 4.02." echo "For previous versions of OCaml use the Camlp4 distributed with OCaml." exit 2 elif [ $SKIP_VERSION_CHECK -eq 1 ]; then echo "Skipping OCaml version check" elif [ $major -ne $camlp4_major -o $minor -ne $camlp4_minor ]; then echo "This version of Camlp4 is for OCaml $camlp4_version but you are using OCaml $ocaml_version." if [ -d .git ] ; then if [ $PINNED -eq 1 ] ; then echo "You've used the wrong opam pin URL for this switch.">&2 echo "Try https://github.com/ocaml/camlp4.git#$major.$minor instead">&2 else echo "You appear to be building Camlp4 from git, so try the $major.$minor branch." fi fi exit 2 fi ocamlc -config | tr -d '\015' | sed 's/: /="/;s/$/"/' > config.sh ocamlc -config | tr -d '\015' | sed 's/^/let /;s/: / = "/;s/$/"/' > myocamlbuild_config.ml # Add a few things to config.sh . ./config.sh if [ "$os_type" = Win32 ]; then ext_exe=".exe" else ext_exe="" fi OCAMLC="`command -v ocamlc`" LIBDIR="${LIBDIR:-$standard_library}" BINDIR="${BINDIR:-`dirname $OCAMLC`}" PKGDIR="${PKGDIR:-$standard_library}" if [ -x "`command -v ocamlopt`" ]; then OB_FLAGS="" else OB_FLAGS="-byte-plugin" fi COMPLIBS="`ocamlc -where`/compiler-libs" if [ -f "$COMPLIBS/opttoploop.cmi" ]; then OCAMLNAT=true else OCAMLNAT=false fi cat >> config.sh <> myocamlbuild_config.ml <