Commit | Line | Data |
---|---|---|
34e49164 | 1 | #!/usr/bin/perl |
708f4980 | 2 | |
fc1ad971 | 3 | # Author: Yoann Padioleau |
708f4980 | 4 | |
34e49164 C |
5 | ###################################################################### |
6 | # Prelude | |
7 | ###################################################################### | |
8 | ||
9 | # Yes I know about autoconf ... and autoconf sux. | |
10 | ||
11 | # assume standard: diff | |
12 | # assume standard: perl | |
13 | ||
708f4980 | 14 | #TODO check python 2.5 ? |
34e49164 | 15 | |
978fd7e5 C |
16 | # need latex and hevea if want to compile the documentation |
17 | ||
34e49164 C |
18 | #old: --with-menhir=/path/to/menhirLib or `ocamlfind query menhirLib` |
19 | ||
0708f913 | 20 | my $project = |
34e49164 | 21 | "coccinelle"; |
0708f913 | 22 | my $projectcmdline = |
978fd7e5 | 23 | "spatch -sp_file demos/simple.cocci demos/simple.c -o /tmp/new_simple.c"; |
34e49164 | 24 | |
34e49164 C |
25 | ###################################################################### |
26 | # Options | |
27 | ###################################################################### | |
28 | ||
29 | my $prefix="/usr/local"; | |
30 | my $python=1; | |
993936c0 | 31 | my $pcre=1; |
174d1640 | 32 | my $noocamlscripting=0; |
0708f913 | 33 | my $opt=".opt"; |
978fd7e5 | 34 | my $tarzan=1; |
90aeb998 C |
35 | my $pydir="pycaml"; |
36 | my $menhirdir="menhirlib"; | |
37 | my $sexpdir="ocamlsexp"; | |
97111a47 C |
38 | my $python_cmd="python"; |
39 | ||
40 | # generic ocaml libraries (set entries to 0 to disable by default) | |
41 | # 0: disabled, 1: use global library, >1: use local library | |
42 | my %libs= | |
43 | ( "pycaml" => 1 | |
44 | , "menhirLib" => 1 | |
45 | , "sexplib" => 1 | |
46 | , "pcre" => 1 | |
47 | , "dynlink" => 0 | |
48 | , "extlib" => 0 | |
49 | ); | |
50 | ||
51 | # add additional dependencies that some of these libraries may have | |
52 | # these will then be added automatically | |
53 | # (we don't really make use of this here) | |
54 | my %deps= | |
55 | ( # "pycaml" => ["str"] # example | |
56 | # "sexplib" => ["unix", "bigarray", "num"] | |
57 | ); | |
34e49164 C |
58 | |
59 | local $_ = join ' ', @ARGV; | |
60 | ||
61 | # Parse options | |
993936c0 C |
62 | /-h/ || /--help/ and die "usage: $0 [--prefix=path] [--without-FEATURE] [--no-opt]\n |
63 | \t--without-python\tDisable scripting in Python | |
64 | \t--without-ocaml\t\tDisable scripting in Ocaml | |
65 | \t--without-pcre\t\tDisable regexp with PCRE | |
97111a47 | 66 | \t--with-pyton=PATH\t\tSpecify path to python executable |
993936c0 C |
67 | \t--no-opt\t\tDo not use the optimimized version of OCaml |
68 | \t--opt\t\t\tUse the optimimized version of OCaml\n\n"; | |
34e49164 | 69 | /--prefix=([^ ]*)/ and $prefix = $1; |
993936c0 | 70 | /--without-pcre/ and $pcre = 0; |
34e49164 | 71 | /--without-python/ and $python = 0; |
c491d8ee | 72 | /--without-ocaml/ and $noocamlscripting = 1; |
0708f913 | 73 | /--no-opt/ and $opt = ""; |
8ba84ae2 | 74 | /--opt/ and $opt = ".opt"; |
97111a47 C |
75 | /--with-python=([^ ]*)/ and $python_cmd = $1; |
76 | ||
77 | # todo: also print these options as part of the help message... | |
78 | foreach my $lib (keys %libs) { | |
79 | /--with-$lib/ and $libs{$lib} = 1; | |
80 | /--with-local-$lib/ and $libs{$lib} = 2; | |
81 | /--without-$lib/ and $libs{$lib} = 0; | |
82 | } | |
34e49164 | 83 | |
978fd7e5 C |
84 | #tarzan by default (used by score file parsing and now also for sexp_ast_c.ml) |
85 | ||
86 | ||
97111a47 C |
87 | # extend the feature set based on their dependencies |
88 | my $changedLibs = 1; | |
89 | while($changedLibs) { | |
90 | $changedLibs = 0; | |
91 | foreach $dep (keys %deps) { | |
92 | if ($libs{$dep}) { | |
93 | my $reqs = $deps{$dep}; | |
94 | foreach $req (@$reqs) { | |
95 | if (!$libs{$req}) { | |
96 | $libs{$req} = 1; | |
97 | $changedLibs = 1; | |
98 | } | |
99 | } | |
100 | } | |
101 | } | |
102 | } | |
103 | ||
34e49164 C |
104 | #if($ARGV[0] =~ "--prefix=(.*)") { |
105 | # $prefix = $1; | |
106 | #} | |
107 | #if($ARGV[1] =~ "--without-python") { | |
108 | # $python = 0; | |
109 | #} | |
110 | ||
111 | my $src="$prefix/share/$project"; | |
112 | ||
113 | ###################################################################### | |
114 | # Side effects | |
115 | ###################################################################### | |
116 | ||
117 | ||
118 | ###################################################################### | |
119 | # Helpers | |
120 | ###################################################################### | |
121 | #BEGIN { die "need Perl 5 or greater" if $] < 5 ; } | |
122 | ||
123 | #use Common; | |
124 | sub pr2 { print STDERR "@_\n" } | |
0708f913 | 125 | sub cat { |
34e49164 C |
126 | my ($what) = @_; |
127 | my @list; | |
128 | open(TMP, $what); | |
129 | while(<TMP>) { push @list, "$_"; } | |
130 | \@list; | |
131 | } | |
132 | sub notb { !$_[0] } | |
133 | sub mapf { my ($f, $xs) = @_; [ map { &$f($_) } @{$xs} ] } | |
134 | sub plural { my ($e) = @_; if ($e > 1) { "s" } else { "" } } | |
135 | ||
136 | sub check_config { my ($command, $expect, $msggood, $msgbad) = @_; | |
137 | my $error = 0; | |
0708f913 | 138 | |
34e49164 C |
139 | my $full = cat($command); |
140 | my $res = join(" ", @{$full}); | |
141 | # pr2 $res; | |
142 | if(notb($res =~ $expect)) { $error++; pr2 "!!!! $msgbad !!!!"; } | |
143 | else { pr2 $msggood } | |
144 | return $error; | |
145 | } | |
146 | ||
147 | ###################################################################### | |
148 | # Let's go | |
149 | ###################################################################### | |
150 | pr2 "Checking your configuration.\n"; | |
151 | ||
152 | my $error = 0; | |
153 | ||
34e49164 C |
154 | #--------------------------------------------------------------------- |
155 | # Compilers and runtimes | |
156 | #--------------------------------------------------------------------- | |
174d1640 | 157 | |
0708f913 | 158 | $error += |
34e49164 | 159 | check_config("echo \"1;;\\n\" | ocaml |", |
174d1640 | 160 | "Objective(.*) 3.\(09|1[0-9]\)", |
34e49164 C |
161 | "OCaml (the wonderful language) is present.", |
162 | "The program ocaml is missing or is not a good version. We need at least 3.09", | |
163 | ); | |
164 | ||
3a314143 | 165 | unless ($noocamlscripting) { |
174d1640 C |
166 | $noocamlscripting = check_config("echo \"1;;\\n\" | ocaml |", |
167 | "Objective(.*) 3.1[1-9]", | |
168 | "OCaml >= 3.11 is present. OCaml scripting activated.", | |
169 | "OCaml scripting disabled. We need at least OCaml 3.11", | |
170 | ); | |
c491d8ee | 171 | } |
88e71198 | 172 | my $ocamlprefix = $noocamlscripting ? "no" : "yes"; |
174d1640 | 173 | |
0708f913 | 174 | if ($opt eq ".opt") { |
8ba84ae2 C |
175 | my $opt_check = `which ocamlc.opt 2> /dev/null`; |
176 | if($opt_check =~ "/ocamlc.opt\$") { | |
177 | pr2 "ocamlc.opt is present."; | |
178 | } | |
179 | else { | |
180 | $opt=""; | |
181 | pr2 "ocamlc.opt not found"; | |
182 | } | |
183 | ||
184 | my $opt_check = `which ocamlopt.opt 2> /dev/null`; | |
185 | if($opt_check =~ "/ocamlopt.opt\$") { | |
186 | pr2 "ocamlopt.opt is present."; | |
187 | } | |
188 | else { | |
189 | $opt=""; | |
190 | pr2 "ocamlopt.opt not found"; | |
191 | } | |
192 | ||
193 | my $opt_check = `which ocamldep.opt 2> /dev/null`; | |
194 | if($opt_check =~ "/ocamldep.opt\$") { | |
195 | pr2 "ocamldep.opt is present."; | |
196 | } | |
197 | else { | |
0708f913 | 198 | $opt=""; |
8ba84ae2 C |
199 | pr2 "ocamldep.opt not found"; |
200 | } | |
201 | ||
202 | my $opt_check = `which ocamllex.opt 2> /dev/null`; | |
203 | if($opt_check =~ "/ocamllex.opt\$") { | |
204 | pr2 "ocamllex.opt is present."; | |
0708f913 C |
205 | } |
206 | else { | |
8ba84ae2 C |
207 | $opt=""; |
208 | pr2 "ocamllex.opt not found"; | |
209 | } | |
210 | ||
211 | if($opt eq "") { | |
212 | pr2 "At least one native OCaml tool have not been found."; | |
213 | pr2 "Desactivation of all native OCaml tools for compilation."; | |
0708f913 C |
214 | } |
215 | } | |
216 | ||
34e49164 C |
217 | #we have cached the result of menhir in the tgz we build. |
218 | ||
0708f913 | 219 | #$error += |
34e49164 C |
220 | # check_config("menhir --version |", |
221 | # "menhir, version 20071212", | |
222 | ## "menhir, version 2006.*", | |
223 | # "Menhir (the parser generator) is present.", | |
224 | # "The program menhir is missing or is not a good version.", | |
225 | # ); | |
226 | ||
227 | ||
228 | #--------------------------------------------------------------- | |
229 | # Developers tools | |
230 | #--------------------------------------------------------------- | |
231 | ||
232 | pr2 ""; | |
233 | ||
234 | $error += check_config( | |
235 | "make -v 2>&1 |grep Make|", | |
708f4980 | 236 | "GNU Make [^0-9]*3\.[0-9]+.*", #version 3.79.1, 3.81 |
34e49164 C |
237 | "make (gnu version) is present.", |
238 | "The program gnu make is missing or is not a good version. | |
239 | We need 3.XX", | |
240 | ); | |
241 | ||
34e49164 C |
242 | #--------------------------------------------------------------------- |
243 | # More developers tools | |
244 | #--------------------------------------------------------------------- | |
245 | ||
246 | #--------------------------------------------------------------------- | |
247 | # Librairies | |
248 | #--------------------------------------------------------------------- | |
249 | ||
3a314143 | 250 | # Python dev |
b23ff9c7 | 251 | my $PY_VERSION; |
3a314143 C |
252 | if($python) { |
253 | if(check_config( | |
97111a47 C |
254 | "$python_cmd --version 2>&1 |", |
255 | '^Python [23]\.', | |
256 | "$python_cmd is present", | |
257 | "$python_cmd is missing or is not a good version." | |
3a314143 C |
258 | )) |
259 | { | |
260 | $python=0; | |
261 | } | |
262 | if($python) { | |
97111a47 C |
263 | my $PY_PREFIX = `$python_cmd pycaml/getprefix.py | tr -d '\n'`; |
264 | $PY_VERSION = `$python_cmd pycaml/getversion.py | tr -d '\n'`; | |
3a314143 C |
265 | my $python_hdr = "$PY_PREFIX/include/python$PY_VERSION/Python.h"; |
266 | if(check_config( | |
267 | "ls $python_hdr 2> /dev/null | ", | |
268 | $python_hdr, | |
269 | "Python.h found", | |
270 | "Python.h missing - You need to install python-dev" | |
271 | )) | |
272 | { | |
273 | $python=0 | |
274 | } | |
275 | } | |
276 | } | |
277 | ||
ca417fcf C |
278 | my $ocamlfind=!check_config( |
279 | "which ocamlfind 2> /dev/null |", | |
280 | '/ocamlfind$', | |
281 | "ocamlfind is present", | |
282 | "ocamlfind is missing -- Switch to local library copies." | |
283 | ); | |
284 | ||
90aeb998 C |
285 | # pycaml. Binding between Python and OCaml |
286 | my $syspydir=`ocamlfind query pycaml 2> /dev/null | xargs echo -n`; | |
287 | ||
288 | if($syspydir) { | |
97111a47 C |
289 | pr2 "'pycaml' library is present in $syspydir"; |
290 | if ($libs{'pycaml'} > 1) { | |
291 | pr2 "... but a local copy of 'pycaml' will be used."; | |
292 | } | |
293 | else { | |
294 | $pydir=$syspydir; | |
295 | } | |
174d1640 C |
296 | } else { |
297 | pr2 "'pycaml' library is not present. A local copy will be used."; | |
90aeb998 C |
298 | } |
299 | ||
300 | # menhirLib. Runtime system for the parsers generated with menhir | |
301 | my $sysmenhirdir=`ocamlfind query menhirLib 2> /dev/null | xargs echo -n`; | |
302 | ||
303 | if($sysmenhirdir) { | |
304 | $menhirdir=$sysmenhirdir; | |
174d1640 C |
305 | pr2 "'menhirLib' library is present in $menhirdir"; |
306 | } else { | |
993936c0 | 307 | pr2 "'menhirLib' library is not present. A local copy will be used."; |
90aeb998 C |
308 | } |
309 | ||
97111a47 | 310 | # sexplib. |
90aeb998 C |
311 | my $syssexpdir=`ocamlfind query sexplib 2> /dev/null | xargs echo -n`; |
312 | ||
313 | if($syssexpdir) { | |
314 | $sexpdir=$syssexpdir; | |
174d1640 C |
315 | pr2 "'sexplib' library is present in $sexpdir"; |
316 | } else { | |
993936c0 C |
317 | pr2 "'sexplib' library is not present. A local copy will be used."; |
318 | } | |
319 | ||
320 | # Check if libpcre-ocaml is available | |
321 | # when pcre feature is enabled. | |
322 | my $pcredir=""; | |
323 | if($pcre) { | |
324 | $pcredir=`ocamlfind query pcre 2> /dev/null | xargs echo -n `; | |
325 | if(check_config( | |
326 | "echo -n $pcredir | ", | |
327 | '^/.*$', | |
328 | "'pcre-ocaml' library is present in $pcredir", | |
329 | "'pcre-ocaml' library is not present - You need to install libpcre-ocaml-dev" | |
330 | )) | |
331 | { | |
332 | $pcre=0 | |
333 | } | |
90aeb998 C |
334 | } |
335 | ||
97111a47 C |
336 | ###################################################################### |
337 | # Printing of library selection | |
338 | ###################################################################### | |
339 | ||
340 | ||
341 | pr2 "----------------------------------------------------------------------"; | |
342 | pr2 "Library configuration:"; | |
343 | ||
344 | my %libPaths = {}; | |
345 | foreach my $lib (keys %libs) { | |
346 | my $isSelected = $libs{$lib}; | |
347 | if ($isSelected) { | |
348 | my $libdir = `ocamlfind query $lib 2> /dev/null | xargs echo -n`; | |
349 | if ($libdir && $libs{$lib} <= 1) { | |
350 | $libs{$lib} = 1; | |
351 | $libPaths{$lib} = $libdir; | |
352 | } | |
353 | else { | |
354 | if (-d $lib) { # test if local directory exists | |
355 | $libs{$lib} = 2; # use local version | |
356 | $libPaths{$lib} = $lib; | |
357 | } else { | |
358 | $libs{$lib} = 0; # disable the feature | |
359 | $libPaths{$lib} = ""; | |
360 | } | |
361 | } | |
362 | } | |
363 | ||
364 | my $choice = $libs{$lib}; | |
365 | if ($choice == 0) { | |
366 | pr2 "$lib: disabled"; | |
367 | } elsif ($choice == 1) { | |
368 | pr2 "$lib: global version in $libPaths{$lib}"; | |
369 | } else { | |
370 | pr2 "$lib: local version selected"; | |
371 | } | |
372 | } | |
373 | ||
34e49164 C |
374 | ###################################################################### |
375 | # Generate config files (platform/portability issues) | |
376 | ###################################################################### | |
377 | ||
378 | ||
379 | ###################################################################### | |
380 | # Generate globals files (features issues) | |
381 | ###################################################################### | |
382 | ||
383 | ###################################################################### | |
0708f913 | 384 | # Diagnostic |
34e49164 C |
385 | ###################################################################### |
386 | ||
0708f913 | 387 | if($error) { |
34e49164 C |
388 | pr2 " |
389 | ---------------------------------------------------------------------- | |
0708f913 | 390 | !!!! There seems to have problem, we have found $error missing package" . |
34e49164 | 391 | plural($error) . ". |
0708f913 C |
392 | " . (($error > 1) ? "Some of those packages" : "This package") . |
393 | " may be installed by picking " . ($error > 1 ? "them" : "it") . | |
34e49164 C |
394 | " in $project-dependencies.tgz available |
395 | on the $project website. !!!! | |
396 | ---------------------------------------------------------------------- | |
397 | "; | |
0708f913 | 398 | } else { |
34e49164 | 399 | |
174d1640 C |
400 | pr2 |
401 | "---------------------------------------------------------------------- | |
34e49164 C |
402 | |
403 | All seems fine for $project. | |
404 | ||
405 | To compile $project type: | |
708f4980 C |
406 | \$ make depend |
407 | \$ make all | |
408 | ||
409 | Or alternatively, for the optimized version: | |
410 | \$ make all.opt | |
b1b2de81 | 411 | If you want both, you could use: |
708f4980 C |
412 | \$ make world |
413 | ||
34e49164 C |
414 | |
415 | To install type: | |
708f4980 | 416 | \$ make install |
34e49164 C |
417 | |
418 | Then, to test $project simply type: | |
708f4980 | 419 | \$ $projectcmdline |
34e49164 C |
420 | |
421 | "; | |
422 | ||
ca417fcf C |
423 | if($python) { |
424 | pr2 | |
34e49164 | 425 | "To use the python SmPL feature you may have to set some environment variables. |
174d1640 | 426 | However, they are automatically set by the front-end installed in $prefix/bin. |
34e49164 C |
427 | For bash do: |
428 | export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:$prefix/lib | |
174d1640 | 429 | export PYTHONPATH=\$PYTHONPATH:$src/python" |
34e49164 | 430 | } |
ca417fcf | 431 | |
174d1640 | 432 | pr2 "----------------------------------------------------------------------"; |
34e49164 C |
433 | } |
434 | ||
34e49164 C |
435 | ###################################################################### |
436 | # Generating the configuration | |
437 | ###################################################################### | |
438 | ||
ca417fcf C |
439 | pr2 " Compilation configuration\n"; |
440 | ||
34e49164 C |
441 | pr2 "$project target prefix: $prefix (you can use --prefix to override it)"; |
442 | pr2 "Generating Makefile.config"; | |
443 | open(CONFIG, ">Makefile.config"); | |
444 | print CONFIG "# autogenerated by configure | |
445 | ||
8ba84ae2 C |
446 | # |
447 | INSTALL_PROGRAM?=install -c -m 755 | |
448 | INSTALL_LIB?= install -c -m 755 | |
449 | INSTALL_DATA?= install -c -m 644 | |
450 | ||
34e49164 C |
451 | # Where to install the binary |
452 | BINDIR=$prefix/bin | |
453 | ||
454 | # Where to install the man pages | |
455 | MANDIR=$prefix/man | |
456 | ||
457 | # Where to install the lib | |
458 | LIBDIR=$prefix/lib | |
459 | ||
460 | # Where to install the configuration files | |
461 | SHAREDIR=$src | |
462 | ||
174d1640 C |
463 | BASH_COMPLETION_DIR=/etc/bash_completion.d |
464 | ||
34e49164 C |
465 | # Features |
466 | FEATURE_PYTHON=$python | |
978fd7e5 | 467 | FEATURE_TARZAN=$tarzan |
b23ff9c7 C |
468 | "; |
469 | ||
470 | if ($python) { | |
97111a47 C |
471 | print CONFIG "PYVER=$PY_VERSION\n"; |
472 | print CONFIG "PYCMD=$python_cmd\n"; | |
b23ff9c7 | 473 | } |
0708f913 | 474 | |
993936c0 C |
475 | if($pcre) { |
476 | print CONFIG " | |
477 | PCREDIR=$pcredir" | |
478 | } | |
479 | ||
b23ff9c7 | 480 | print CONFIG " |
90aeb998 C |
481 | PYCAMLDIR=$pydir |
482 | MENHIRDIR=$menhirdir | |
483 | SEXPDIR=$sexpdir | |
88e71198 | 484 | DYNLINK=$ocamlprefix |
90aeb998 | 485 | |
0708f913 C |
486 | # The OPTBIN variable is here to allow to use ocamlc.opt instead of |
487 | # ocaml, when it is available, which speeds up compilation. So | |
488 | # if you want the fast version of the ocaml chain tools, set this var | |
489 | # or setenv it to \".opt\" in your startup script. | |
490 | OPTBIN=$opt | |
34e49164 C |
491 | "; |
492 | ||
97111a47 C |
493 | # |
494 | # Generate variables for handling the ocaml libraries | |
495 | # | |
496 | ||
497 | my @sellibs = (); | |
498 | my @makelibs = (); | |
499 | my @cleanlibs = (); | |
500 | my @deplibs = (); | |
501 | my @lnklibs = (); | |
502 | my @optlnklibs = (); | |
503 | my @inclibs = (); | |
504 | my @flagslibs = (); | |
505 | my @featurelibs = (); | |
506 | my @pathlibs = (); | |
507 | ||
508 | sub strVar { | |
509 | return "\$(" . $_[0] . "_" . $_[1] . ")"; | |
510 | } | |
511 | ||
512 | foreach $lib (keys %libs) { | |
513 | my $sel = $libs{$lib}; | |
514 | my $path = $libPaths{$lib}; | |
515 | my $pathvar = strVar("PATH", $lib); | |
516 | ||
517 | if ($sel == 1) { # global version | |
518 | push(@lnklibs, strVar("GLOBAL", $lib)); | |
519 | push(@optlnklibs, strVar("GLOBALOPT", $lib)); | |
520 | } elsif ($sel > 1) { # local version | |
521 | push(@lnklibs, strVar("LOCAL", $lib)); | |
522 | push(@optlnklibs, strVar("LOCALOPT", $lib)); | |
523 | if (-e "$path/Makefile") { # does it have a Makefile? | |
524 | push(@makelibs, $pathvar); | |
525 | push(@cleanlibs, $pathvar); | |
526 | push(@deplibs, $pathvar); | |
527 | } | |
528 | } | |
529 | ||
530 | if ($sel >= 1) { # indifferent of global/local | |
531 | push(@sellibs, $lib); | |
532 | push(@inclibs, $pathvar); | |
533 | push(@flagslibs, strVar("FLAGS", $lib)); | |
534 | ||
535 | push(@featurelibs, "FEATURE_$lib=1"); | |
536 | push(@pathlibs, "PATH_$lib=$path"); | |
537 | } | |
538 | } | |
539 | ||
540 | my $strSellibs = join(" ", @sellibs); | |
541 | my $strMakelibs = join(" ", @makelibs); | |
542 | my $strCleanlibs = join(" ", @cleanlibs); | |
543 | my $strDeplibs = join(" ", @deplibs); | |
544 | my $strLnklibs = join(" ", @lnklibs); | |
545 | my $strOptlnklibs = join(" ", @optlnklibs); | |
546 | my $strInclibs = join(" ", @inclibs); | |
547 | my $strFlagslibs = join(" ", @flagslibs); | |
548 | my $strFeatures = join("\n", @featurelibs); | |
549 | my $strPaths = join("\n", @pathlibs); | |
550 | ||
551 | print CONFIG " | |
552 | # selected libraries | |
553 | $strFeatures | |
554 | ||
555 | # library paths | |
556 | $strPaths | |
557 | ||
558 | # collected config vars | |
559 | SELLIBS=$strSellibs | |
560 | MAKELIBS=$strMakelibs | |
561 | CLEANLIBS=$strCleanlibs | |
562 | DEPLIBS=$strDeplibs | |
563 | LNKLIBS=$strLnklibs | |
564 | OPTLNKLIBS=$strOptlnklibs | |
565 | INCLIBS=$strInclibs | |
566 | FLAGSLIBS=$strFlagslibs | |
567 | "; | |
568 | ||
174d1640 C |
569 | |
570 | my $pythonprefix = $python ? "yes" : "no"; | |
ca417fcf | 571 | pr2 "Support for python scripting: $pythonprefix"; |
174d1640 | 572 | `cd python; ln -sf ${pythonprefix}_pycocci.ml pycocci.ml; `; |
34e49164 C |
573 | `cd python; make depend`; |
574 | ||
ca417fcf | 575 | pr2 "Support for ocaml scripting: $ocamlprefix"; |
174d1640 C |
576 | `cd ocaml; ln -sf ${ocamlprefix}_prepare_ocamlcocci.ml prepare_ocamlcocci.ml;`; |
577 | `cd ocaml; make depend`; | |
578 | ||
993936c0 C |
579 | my $pcresuffix = $pcre ? "pcre" : "str"; |
580 | pr2 "Support for regexp: $pcresuffix"; | |
581 | `cd globals; ln -sf regexp_${pcresuffix}.ml regexp.ml; touch regexp.ml;`; | |
582 | `cd globals; make depend`; | |
583 | ||
174d1640 | 584 | pr2 "Modifying globals/config.ml"; |
b1b2de81 | 585 | my $command = "perl -p -e 's#Not_found.\*#Not_found->\\\"$src\\\"#' globals/config.ml.in > globals/config.ml"; |
34e49164 C |
586 | `$command`; |
587 | ||
ca417fcf C |
588 | pr2 "----------------------------------------------------------------------"; |
589 | pr2 " Runtime dependency\n"; | |
590 | ||
591 | if ($ocamlfind) { | |
592 | pr2 "Support for external ocaml library in ocaml scripting: yes (ocamlfind found)"; | |
593 | } | |
594 | else { | |
8babbc8f C |
595 | pr2 "Support for external ocaml library in ocaml scripting: no"; |
596 | pr2 "!!!!!!! WARNING !!!!!!! ocamlfind may be required at runtime"; | |
ca417fcf C |
597 | } |
598 | ||
599 | pr2 ""; |