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 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
#!/bin/sh
##################################
#
# Configuration script for otags
#
##################################
cmdline="$0 $*"
root=/usr/local
bindir=$root/bin
bindir_spec=no
libdir=$root/lib/ocaml/camlp5
#libdir=`camlp4 -where`
libdir_spec=no
#splaydir=$root/lib/ocaml
#splaydir_spec=no
ocamlc=
ocamlopt=
native=
byterequest=0
versioncheck=1
usage (){
echo "Usage:"
echo "./configure [OPTION]..."
echo
echo "Recognized options are:"
echo " --prefix <path> installation prefix [/usr/local]"
echo " --bindir <path> user executables [PREFIX/bin]"
echo " --libdir <path> camlp4 libraries [PREFIX/lib/ocaml]"
echo " --bytecode don't use native compiler (for testing only)"
echo " --no-version-check don't check for correct ocaml version (not recommended)"
}
while : ; do
case "$1" in
"") break;;
-help|--help) usage; exit 2;;
-prefix|--prefix) bindir_spec=yes
bindir=$2/bin
libdir_spec=yes
libdir=$2/lib/ocaml
# splaydir_spec=yes
# splaydir=$2/lib/ocaml
shift;;
-bindir|--bindir) bindir_spec=yes
bindir=$2
shift;;
-libdir|--libdir) libdir_spec=yes
libdir=$2
shift;;
-bytecode|--bytecode) byterequest=1;;
-no-version-check|--no-version-check)
versioncheck=0;;
*) echo "Unknown option \"$1\"." 1>&2; exit 2;;
esac
shift
done
# check for ocamlc
ocv=$(ocamlc -version)
if [ $? -ne 0 ] ; then
echo compiler ocamlc not found. Please adjust \$PATH.
exit 1
else
echo ocaml version $ocv found.
ocamlc=ocamlc
fi
# check ocamlc version
if [ $versioncheck = 1 ] ; then
if [ "$ocv" \< "3.09" ] ; then
echo ocaml version $ocv found. Need 3.09.x.
exit 1
fi
fi
# check for ocamlopt.opt
ocvo=$(ocamlopt.opt -version)
if [ $? -eq 0 -a $byterequest = 0 ] ; then
echo ocamlopt.opt version $ocvo found. Native compilation enabled.
if [ "$ocv" != "$ocvo" ] ; then
echo ocamlc and ocamlopt.opt have different versions! Please clean up!
exit 1
fi
ocamlopt=ocamlopt.opt
native=true
else
# check for ocamlopt
ocvo=$(ocamlopt -version)
if [ $? -eq 0 -a $byterequest = 0 ] ; then
echo ocamlopt version $ocvo found. Nativs compilation enabled.
if [ "$ocv" != "$ocvo" ] ; then
echo ocamlc and ocamlopt have different versions! Please clean up!
exit 1
fi
ocamlopt=ocamlopt
native=true
else
echo Neither ocamlopt nor ocamlopt.opt found. Native compilation disabled.
native=false
fi
fi
if [ $native = "true" ] ; then
ncamlgoals="camlp4o_pr_emacs camlp4o_pr_vi"
otags=otags.opt
else
ncamlgoals=
otags=otags.byte
fi
# check for ocamlc.opt
ocvo=$(ocamlc.opt -version)
if [ $? -eq 0 ] ; then
echo ocamlc.opt version $ocvo found.
if [ "$ocv" != "$ocvo" ] ; then
echo ocamlc and ocamlc.opt have different versions! Please clean up!
exit 1
fi
ocamlc=ocamlc.opt
else
echo ocamlc.opt not found.
fi
./mk_conf "$cmdline" $libdir $bindir $native > conf.ml
# Summary of the configuration
echo
echo " Configuration summary:"
echo " binaries will be copied to $bindir"
echo " libraries will be copied to $libdir"
if [ $native = "true" ] ; then
echo " native-code compilation enabled"
else
echo " native-code compilation disabled"
fi
sed -e "s|tplbin|$bindir|" \
-e "s|tpllib|$libdir|" \
-e "s|tplnative|$native|" \
-e "s|tplocamlc|$ocamlc|" \
-e "s|tplocamlopt|$ocamlopt|" \
-e "s|tplncamlgoals|$ncamlgoals|" \
-e "s|tplotags|$otags|" \
Makefile.here.tpl > Makefile.here
# -e "s|tplsplay|$splaydir|" \
|