Skip to content
This repository has been archived by the owner on Jun 4, 2019. It is now read-only.

Commit

Permalink
* configure: allow 4.00 and 4.01
Browse files Browse the repository at this point in the history
  • Loading branch information
pad committed Oct 6, 2013
1 parent 81fbf8c commit 06dcb64
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 47 deletions.
68 changes: 37 additions & 31 deletions configure
Expand Up @@ -12,12 +12,11 @@ use Pod::Usage;

# We do not check for the following programs; we assume they are standard:
# - binutils, gcc, as, ld, the GNU toolchain
# - make, sh?, perl?
# - make, perl, bash
# - diffutils, fileutils, findutils, grep, patchutils, sh-utils
# - diff?, patch?
#

# - TODO findutils ?? need good gnu find, not macos find
# which adds some extra '//' in paths which bother pfff
# which adds some extra '//' in paths which bothers pfff
# - STILL? sharutils, for obrowser/ocsigen use of uuencode

# If want to run the tests need also:
Expand All @@ -37,15 +36,16 @@ my $prefix="/usr/local";

my $bt=0;

my $graphics=0; # X11 graphics.cma
my $visual=1; # cairo, codemap
my $graphics=0; # X11 graphics.cma
my $gui=1; # gtk, pfff_browser

my $opt= ""; # ocamlc.opt ?
my $ocamlc_flags = ""; #ocamlc -?
my $ocaml_version = 3112;

my $facebook=0;

#my $opt=".opt"; # also set in env.sh

my $man = 0;
my $help = 0;

Expand All @@ -58,9 +58,9 @@ GetOptions (

"bt!" => \$bt,

"visual!" => \$visual,
"gui!" => \$gui,
"graphics!" => \$graphics,
"visual!" => \$visual,

"with-all" => sub {
$facebook = 0;
Expand Down Expand Up @@ -177,18 +177,23 @@ my $arch = `uname`;
# We need 4.01 for changes in the .cmt format
$error +=
check_config("echo \"1;;\\n\" | ocaml |",
"(Objective|OCaml)(.*) (4\.01\.*)",
"(Objective|OCaml)(.*) ([34]\.*.*)",
"OCaml (the wonderful language) is present.",
"The program ocaml is missing or is not a good version. We need at least 4.01",
);
show_error_msg_and_exit_if_error($error);

#not really used for now:
#$error2 += check_config("glimpse 2>&1 |",
# "This is glimpse version",
# "glimpse is present.",
# "The program glimpse is missing.",
# );
my $command = "echo \"1;;\\n\" | ocaml |";
my $full = cat($command);
my $res = join(" ", @{$full});
if ($res =~ /(Objective|OCaml)(.*) ([34])\.([0-9]+).([0-9]+)/) {
my $major = $3;
my $minor = $4;
my $other = $5;
$ocaml_version = $major * 1000 + $minor * 10 + $other;
} else {
die "wrong version of ocaml";
}

#---------------------------------------------------------------
# Developers tools
Expand Down Expand Up @@ -219,6 +224,17 @@ show_error_msg_and_exit_if_error($error);
# More developers tools
#---------------------------------------------------------------------

# The OPTBIN variable is here to allow to use ocamlc.opt instead of
# ocaml, when it is available, which speeds up compilation. So
# if you want the fast version of the ocaml chain tools, set this var
# or setenv it to \".opt\" in your startup script.
# todo: detect if possible?
$opt = ".opt";

# -bin-annot is for codegraph, it needs ocaml 4.00,
# -absname is for tuareg mode under my mac, it also needs ocaml 4.00
$ocamlc_flags="-bin-annot -absname";

#---------------------------------------------------------------------
# Librairies
#---------------------------------------------------------------------
Expand Down Expand Up @@ -292,7 +308,7 @@ see install.txt or type ./configure --help

pr2 "$project target prefix: $prefix (you can use --prefix to override it)";
pr2 "Generating Makefile.config (BT=$bt, GUI=$gui, VISUAL=$visual)";
pr2 " (see also --help)";
pr2 " (see also configure --help)";
open(CONFIG, ">Makefile.config");
print CONFIG "# autogenerated by configure
Expand Down Expand Up @@ -324,34 +340,24 @@ FEATURE_GRAPHICS=$graphics
FEATURE_VISUAL=$visual
FEATURE_FACEBOOK=$facebook
";
OPTBIN=$opt
OCAMLCFLAGS_EXTRA=$ocamlc_flags
OCAMLVERSION=$ocaml_version
";

# The OPTBIN variable is here to allow to use ocamlc.opt instead of
# ocaml, when it is available, which speeds up compilation. So
# if you want the fast version of the ocaml chain tools, set this var
# or setenv it to \".opt\" in your startup script.
#OPTBIN=$opt

pr2 "Generating commons/features.ml";
`cpp -DFEATURE_GUI=$gui -DFEATURE_BACKTRACE=$bt commons/features.ml.in > commons/features.ml`;

#pr2 "Generating appropriate links in yyy/ (python=$python)";

pr2 "Generating globals/config_pfff.ml";
#old: my $command = "perl -p -i -e 's#Not_found.\*#Not_found->\\\"$src\\\"#' globals/config.ml";
my $command = "perl -p -e 's#Not_found1.\*#Not_found->\\\"$src\\\"#' globals/config_pfff.ml.in > globals/config_pfff.ml";
`$command`;

`perl -p -e 's#Not_found1.\*#Not_found->\\\"$src\\\"#' globals/config_pfff.ml.in > globals/config_pfff.ml`;
if($facebook) {
my ($server) = `cat facebook/pfff_logger.config`;
`perl -p -i -e 's#Not_found2.\*#Not_found-> Some \\\"$server\\\"#' globals/config_pfff.ml`;
}

`perl -p -i -e 's#Not_found[0-9]#Not_found#' globals/config_pfff.ml`;

#`touch test.ml`;

if($error || $error2) {
pr2 "!!Problems during ./configure!!";
}
Expand Down
18 changes: 7 additions & 11 deletions env.sh
Expand Up @@ -6,22 +6,14 @@ Are you sure you ran this script from the source directory of pfff?
fi

# To compile the source, using pad installation.
#echo setting OPAM
#eval `~pad/packages/Linux/bin/opam config env`
echo setting OPAM
#eval `~pad/packages/Linux/bin/opam config env` does not work, it expands
# to /home/pieter/.opam/... when done by another user => inlined here
export CAML_LD_LIBRARY_PATH=/home/pad/.opam/4.01.0/lib/stublibs
export OCAML_TOPLEVEL_PATH=/home/pad/.opam/4.01.0/lib/toplevel
export MANPATH=/home/pad/.opam/4.01.0/man:
export PATH=/home/pad/.opam/4.01.0/bin:/home/pad/packages/sbin:/home/pad/packages/bin:/home/pad/bin:/usr/kerberos/bin:/opt/local/bin:/usr/local/bin:/bin:/usr/bin:/usr/facebook/ops/scripts:/usr/facebook/scripts:/usr/facebook/scripts:/usr/facebook/scripts/db:/usr/local/sbin:/usr/sbin:/sbin:/mnt/vol/engshare/svnroot/tfb/trunk/www/scripts/bin:/mnt/vol/engshare/admin/scripts/hg:/mnt/vol/engshare/admin/scripts/git:/mnt/vol/engshare/admin/scripts:/home/pad/www/scripts/bin:/home/pad/packages/Linux/bin


# for faster compiler
echo setting OPTBIN
export OPTBIN=.opt

# -bin-annot is for codegraph, it needs ocaml 4.00,
# -absname is for tuareg mode under my mac, it also needs ocaml 4.00
export OCAMLCFLAGS_EXTRA="-bin-annot -absname"

# for exception stack traces
echo setting OCAMLRUNPARAM
export OCAMLRUNPARAM="b"
Expand All @@ -30,3 +22,7 @@ export OCAMLRUNPARAM="b"
# to find the tests/ files.
echo setting PFFF_HOME
export PFFF_HOME=`pwd`

# for ocamlgtk
echo setting PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig
10 changes: 5 additions & 5 deletions lang_ml/analyze/Makefile
Expand Up @@ -91,19 +91,19 @@ clean::
rm -f $(TARGET).top


CPP=-pp 'cpp -DOCAML_VERSION=4000'
PP=-pp "cpp -DOCAML_VERSION=$(OCAMLVERSION)"

meta_ast_cmt.cmo: meta_ast_cmt.ml
$(OCAMLC) $(CPP) -c $<
$(OCAMLC) $(PP) -c $<

meta_ast_cmt.cmx: meta_ast_cmt.ml
$(OCAMLOPT) $(CPP) -c $<
$(OCAMLOPT) $(PP) -c $<

graph_code_cmt.cmo: graph_code_cmt.ml
$(OCAMLC) $(CPP) -c $<
$(OCAMLC) $(PP) -c $<

graph_code_cmt.cmx: graph_code_cmt.ml
$(OCAMLOPT) $(CPP) $<
$(OCAMLOPT) $(PP) $<

##############################################################################
# Literate Programming rules
Expand Down

0 comments on commit 06dcb64

Please sign in to comment.