Release coccinelle-0.2.4rc2
[bpt/coccinelle.git] / configure
index 904e421..073d6f7 100755 (executable)
--- a/configure
+++ b/configure
@@ -28,18 +28,19 @@ my $projectcmdline =
 
 my $prefix="/usr/local";
 my $python=1;
-my $trac=0;
+my $noocamlscripting=0;
 my $opt=".opt";
 my $tarzan=1;
+my $pydir="pycaml";
+my $menhirdir="menhirlib";
+my $sexpdir="ocamlsexp";
 
 local $_ = join ' ', @ARGV;
 
 # Parse options
-/-h/ || /--help/ and die "usage: $0 [--prefix=path] [--without-python] [--with-trac] [--no-opt]\n\n\t--no-opt\tDo not use the optimimized version of OCaml\n\t--opt\tUse the optimimized version of OCaml\n\n";
+/-h/ || /--help/ and die "usage: $0 [--prefix=path] [--without-python] [--no-opt]\n\n\t--no-opt\tDo not use the optimimized version of OCaml\n\t--opt\tUse the optimimized version of OCaml\n\n";
 /--prefix=([^ ]*)/ and $prefix = $1;
 /--without-python/ and $python = 0;
-/--without-trac/ and $trac = 0;
-/--with-trac/ and $trac = 1;
 /--no-opt/ and $opt = "";
 /--opt/ and $opt = ".opt";
 
@@ -99,14 +100,21 @@ my $error = 0;
 #---------------------------------------------------------------------
 # Compilers and runtimes
 #---------------------------------------------------------------------
+
 $error +=
     check_config("echo \"1;;\\n\" | ocaml |",
-#                 "Objective(.*) 3.0[9]",
-                 "Objective(.*) 3.",
+                 "Objective(.*) 3.\(09|1[0-9]\)",
                  "OCaml (the wonderful language) is present.",
                  "The program ocaml is missing or is not a good version. We need at least 3.09",
                  );
 
+$noocamlscripting = check_config("echo \"1;;\\n\" | ocaml |",
+                 "Objective(.*) 3.1[1-9]",
+                 "OCaml >= 3.11 is present. OCaml scripting activated.",
+                 "OCaml scripting disabled. We need at least OCaml 3.11",
+                 );
+my $ocamlprefix = $noocamlscripting ? "no" : "yes";
+
 if ($opt eq ".opt") {
    my $opt_check = `which ocamlc.opt 2> /dev/null`;
    if($opt_check =~ "/ocamlc.opt\$") {
@@ -184,6 +192,36 @@ We need  3.XX",
 # Librairies
 #---------------------------------------------------------------------
 
+# pycaml. Binding between Python and OCaml
+my $syspydir=`ocamlfind query pycaml 2> /dev/null | xargs echo -n`;
+
+if($syspydir) {
+    $pydir=$syspydir;
+    pr2 "'pycaml' library is present in $pydir";
+} else {
+    pr2 "'pycaml' library is not present. A local copy will be used.";
+}
+
+# menhirLib. Runtime system for the parsers generated with menhir
+my $sysmenhirdir=`ocamlfind query menhirLib 2> /dev/null | xargs echo -n`;
+
+if($sysmenhirdir) {
+    $menhirdir=$sysmenhirdir;
+    pr2 "'menhirLib' library is present in $menhirdir";
+} else {
+    pr2 "'menhirLib' library is not present. A local copy will be used..";
+}
+
+# sexplib. Runtime system for the parsers generated with menhir
+my $syssexpdir=`ocamlfind query sexplib 2> /dev/null | xargs echo -n`;
+
+if($syssexpdir) {
+    $sexpdir=$syssexpdir;
+    pr2 "'sexplib' library is present in $sexpdir";
+} else {
+    pr2 "'sexplib' library is not present. A local copy will be used..";
+}
+
 ######################################################################
 # Generate config files (platform/portability issues)
 ######################################################################
@@ -211,12 +249,8 @@ on the $project website. !!!!
 ";
 } else {
 
-#pad: before the message was saying (make depend); make all
-# I found this confusing so I removed it.
-
-    pr2 "
-
-----------------------------------------------------------------------
+    pr2
+"----------------------------------------------------------------------
 
 All seems fine for $project.
 
@@ -241,18 +275,14 @@ Then, to test $project simply type:
 if($python) {
         pr2
 "To use the python SmPL feature you may have to set some environment variables.
+However, they are automatically set by the front-end installed in $prefix/bin.
 For bash do:
 export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:$prefix/lib
-export PYTHONPATH=\$PYTHONPATH:$src/python
-"
+export PYTHONPATH=\$PYTHONPATH:$src/python"
     }
-    pr2 "
-----------------------------------------------------------------------
-";
+    pr2 "----------------------------------------------------------------------";
 }
 
-
-
 ######################################################################
 # Generating the configuration
 ######################################################################
@@ -279,10 +309,17 @@ LIBDIR=$prefix/lib
 # Where to install the configuration files
 SHAREDIR=$src
 
+BASH_COMPLETION_DIR=/etc/bash_completion.d
+
 # Features
 FEATURE_PYTHON=$python
 FEATURE_TARZAN=$tarzan
 
+PYCAMLDIR=$pydir
+MENHIRDIR=$menhirdir
+SEXPDIR=$sexpdir
+DYNLINK=$ocamlprefix
+
 # 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
@@ -290,28 +327,17 @@ FEATURE_TARZAN=$tarzan
 OPTBIN=$opt
 ";
 
-pr2 "Modifying globals/config.ml";
-pr2 "Generating appropriate links in python/ (python=$python)";
-my $pythonprefix = $python ? "yes_" : "no_";
-`cd python; rm -f  pycocci.ml pycocci_aux.ml;`;
-`cd python; ln -s ${pythonprefix}pycocci.ml pycocci.ml; `;
-`cd python; ln -s ${pythonprefix}pycocci_aux.ml pycocci_aux.ml;`;
+
+my $pythonprefix = $python ? "yes" : "no";
+pr2 "Support for python scripting : $pythonprefix";
+`cd python; ln -sf ${pythonprefix}_pycocci.ml pycocci.ml; `;
 `cd python; make depend`;
 
+pr2 "Support for ocaml scripting : $ocamlprefix";
+`cd ocaml; ln -sf ${ocamlprefix}_prepare_ocamlcocci.ml prepare_ocamlcocci.ml;`;
+`cd ocaml; make depend`;
+
+pr2 "Modifying globals/config.ml";
 my $command = "perl -p -e 's#Not_found.\*#Not_found->\\\"$src\\\"#' globals/config.ml.in > globals/config.ml";
 `$command`;
 
-#
-# Configuration of python with or without trac
-#
-`cd python/coccilib; ln -sf output_base.py output.py;`;
-if($trac) {
-# Switch between implementation
-# in python/coccilib
-pr2 "Selecting python trac extension";
-`cd python/coccilib; ln -sf output_trac.py output.py;`;
-}
-
-
-
-