Commit 0e86c43d authored by gerd's avatar gerd

Isolating 3.09-specific stuff


git-svn-id: https://godirepo.camlcity.org/svn/lib-xstrp4/trunk@28 56444827-45db-0310-81c6-95464f7ca4c4
parent 22ce6e2a
......@@ -6,6 +6,9 @@
# make release: cleanup, create archive, tag CVS module
# (for developers)
include Makefile.conf
#----------------------------------------------------------------------
# specific rules for this package:
......@@ -30,11 +33,16 @@ view.sample:
camlp4 $(ROPTIONS) pa_o.cmo ./xstrp4.cma pr_o.cmo sample.ml
xstrp4_here.ml: xstrp4_here.ml.$(CAMLP4_STYLE)
rm -f xstrp4_here.ml
ln -s xstrp4_here.ml.$(CAMLP4_STYLE) xstrp4_here.ml
#----------------------------------------------------------------------
# general rules:
OPTIONS =
OCAMLC = $(OCAMLFIND) ocamlc $(OPTIONS) -package camlp4 -syntax camlp4o -ppopt pa_extend.cmo -ppopt q_MLast.cmo -ppopt "-loc" -ppopt "loc"
OCAMLC = $(OCAMLFIND) ocamlc $(OPTIONS) $(CAMLP4_OPTS)
OCAMLDEP = ocamldep $(OPTIONS)
OCAMLFIND = ocamlfind
......@@ -54,6 +62,7 @@ uninstall:
.PHONY: clean
clean:
rm -f *.cmi *.cmo *.cma *.cmx *.o *.a *.cmxa sample
rm -f xstrp4_here.ml
.PHONY: distclean
distclean: clean
......
# $Id$
#######################################################################
# Helpers:
# Split $PATH into words:
oldifs="$IFS"
IFS=" :"
spacepath=`echo $PATH`
IFS="$oldifs"
in_path () {
# Does $1 exist in $PATH?
for d in $spacepath; do
if test -x "$d/$1"; then
return 0
fi
done
return 1
}
get_path () {
for d in $spacepath; do
if test -x "$d/$1"; then
echo "$d/$1"
return
fi
done
}
#######################################################################
# Defaults
#--- Options ---
# value 0: off
# value 1: on
# defaults:
set_defaults () {
# enable_FOO=XXX
# with_FOO=XXX
:
}
ocamlc=`get_path ocamlc`
set_defaults
version="1.7"
exec_suffix=""
#######################################################################
# Option parsing
#ehelp_FOO="XXX"
#whelp_FOO="XXX"
# Which options exist? eoptions for enable/disable, woptions for with/without:
eoptions=""
woptions=""
# Packages to include anyway:
requires=""
print_options () {
for opt in $eoptions; do
e="o=\$enable_$opt"
eval "$e"
uopt=`echo $opt | sed -e 's/_/-/g'`
if [ $o -gt 0 ]; then
echo " -enable-$uopt"
else
echo " -disable-$uopt"
fi
done
for opt in $woptions; do
e="o=\$with_$opt"
eval "$e"
uopt=`echo $opt | sed -e 's/_/-/g'`
if [ $o -gt 0 ]; then
echo " -with-$uopt"
else
echo " -without-$uopt"
fi
done
}
usage () {
set_defaults
cat <<_EOF_ >&2
usage: ./configure [ options ]
_EOF_
for opt in $eoptions; do
e="help=\$ehelp_$opt"
eval "$e"
uopt=`echo $opt | sed -e 's/_/-/g'`
echo "-enable-$uopt:" >&2
echo "-disable-$uopt:" >&2
echo " $help" >&2
done
for opt in $woptions; do
e="help=\$whelp_$opt"
eval "$e"
uopt=`echo $opt | sed -e 's/_/-/g'`
echo "-with-$uopt:" >&2
echo "-without-$uopt:" >&2
echo " $help" >&2
done
}
echo "Welcome to Xstrp4 version $version" >&2
while [ "$#" -gt 0 ]; do
case "$1" in
-enable-*)
opt=`echo "$1" | sed -e 's/-enable-//' -e 's/-/_/g'`
check_eopt "$opt"
eval "enable_$opt=2"
shift
;;
-disable-*)
opt=`echo "$1" | sed -e 's/-disable-//' -e 's/-/_/g'`
check_eopt "$opt"
eval "enable_$opt=-1"
shift
;;
-with-*)
opt=`echo "$1" | sed -e 's/-with-//' -e 's/-/_/g'`
check_wopt "$opt"
eval "with_$opt=2"
shift
;;
-without-*)
opt=`echo "$1" | sed -e 's/-without-//' -e 's/-/_/g'`
check_wopt "$opt"
eval "with_$opt=-1"
shift
;;
-version)
echo "$version"
exit 0
;;
*)
usage
esac
done
######################################################################
# Check ocamlfind
printf "%s" "Checking for findlib... "
if ocamlfind query stdlib >/dev/null 2>/dev/null; then
echo "found"
else
echo "not found"
echo "Make sure that ocamlfind is in your PATH, or download findlib"
echo "from www.ocaml-programming.de"
exit 1
fi
######################################################################
# Check camlp4 version
printf "%s" "Checking for camlp4... "
if camlp4; then
if camlp4 -loaded-modules >/dev/null 2>/dev/null; then
echo "3.10 style"
camlp4_style="310"
camlp4_opts="-package camlp4 -syntax camlp4o -ppopt pa_extend.cmo -ppopt q_MLast.cmo -ppopt -loc -ppopt loc"
else
echo "3.09 style"
camlp4_style="309"
camlp4_opts="-package camlp4 -syntax camlp4o -ppopt pa_extend.cmo -ppopt q_MLast.cmo -ppopt -loc -ppopt loc"
fi
else
echo "not found"
echo "Make sure the camlp4 command is in your PATH"
fi
######################################################################
# Write Makefile.conf
echo "Writing Makefile.conf"
cat <<_EOF_ >Makefile.conf
# The Xstrp4 version:
VERSION = $version
# Camlp4 style:
CAMLP4_STYLE = $camlp4_style
# Camlp4 options:
CAMLP4_OPTS = $camlp4_opts
_EOF_
######################################################################
# Finish
echo
echo "Please check Makefile.conf."
echo
echo "You can now compile Xstrp4 by invoking"
echo " make all"
echo "for the bytecode compiler, and optionally by invoking"
echo " make opt"
echo "for the native-code compiler (if supported on your architecture)."
echo "Finally, a"
echo " make install"
echo "will install the package(s)."
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment