permit multiline comments and strings in macros
[bpt/coccinelle.git] / configure.ac
CommitLineData
abad11c5
C
1dnl run 'autoreconf' to obtain aclocal.m4, and update configure and setup/pkg.m4
2dnl run 'automake -acf' to update setup/{install-sh,missing}
3
feec80c3 4dnl standard initialization (we only use autoconf not automake)
d6ce1786
C
5AC_PREREQ([2.68])
6AC_INIT([coccinelle], m4_esyscmd([cat ./version | tr -d '\n']), [cocci@diku.dk], [], [http://coccinelle.lip6.fr/])
7AC_CONFIG_MACRO_DIR([setup])
8AC_CONFIG_AUX_DIR([setup])
d6ce1786
C
9AC_SUBST([CONFIGURE_FLAGS], ["$*"])
10AC_SUBST([COCCI_VERSION], ["$PACKAGE_VERSION"])
11AC_SUBST([COCCI_SRCDIR], ["$(pwd)"])
feec80c3 12AC_MSG_NOTICE([configuring coccinelle $COCCI_VERSION in $COCCI_SRCDIR])
abad11c5 13AM_INIT_AUTOMAKE
feec80c3
C
14
15AC_CONFIG_SRCDIR([cocci.ml]) dnl this file must be present in our src directory
16AC_COCCI_CONFVERSION
17
18dnl reminder that this configure depends on macros generated by aclocal
19AC_MSG_NOTICE([this configure program uses pkg-config m4 macros])
20AC_MSG_NOTICE([this configure program uses ocaml m4 macros (see setup/ocaml.m4)])
21AC_MSG_NOTICE([this configure program uses custom m4 macros (see setup/cocci.m4)])
22AC_MSG_NOTICE([some fake substitutions for required but unavailable programs may be used (see setup/fake*)])
23
24
25dnl
26dnl Note: the conditionals in this configure script are tricky.
27dnl The approach taken here is that many tools can be enabled/disabled
28dnl and paths can be given explicitly via commandline parameters or
29dnl environment variables.
30dnl
31
32
33dnl
34dnl Basic tools
35dnl
36
37AC_MSG_NOTICE([verifying basic tools])
38
39AC_PROG_INSTALL
40AC_PROG_MKDIR_P
41AC_PROG_CPP
42AC_PATH_PROG([TAR],[tar])
43AC_PATH_PROG([PATCH],[patch])
abad11c5
C
44
45dnl ensures that INSTALL points to an absolute install-sh when that one is configured.
46AS_IF([test "$INSTALL" = "setup/install-sh -c" -o "$INSTALL" = "./setup-install-sh -c"],
47[dnl
48 AC_SUBST([INSTALL], ["$COCCI_SRCDIR/$INSTALL"])
49])
50
51dnl the same for MKDIR_P
52AS_IF([test "$MKDIR_P" = "setup/install-sh -c -d" -o "$INSTALL" = "./setup-install-sh -c -d"],
53[dnl
54 AC_SUBST([MKDIR_P], ["$COCCI_SRCDIR/$MKDIR_P"])
55])
56
57dnl patchelf is an optional dependency and in principle not used for building coccinelle
d6ce1786 58AC_PATH_PROG([PATCHELF],[patchelf])
feec80c3 59
abad11c5
C
60dnl pkg config is required, but we have an alternative script for it
61AC_COCCI_TOOL([PKG_CONFIG],[pkg-config])
feec80c3 62AS_IF([test "x$PKG_CONFIG" = xno],
abad11c5
C
63[dnl no specific pkg-config configured
64 AC_SUBST([PKG_CONFIG_ORIG],[pkg-config])
65],
66[dnl a specific pkg-config configured
67 AC_SUBST([PKG_CONFIG_ORIG],[$PKG_CONFIG])
feec80c3
C
68])
69
abad11c5
C
70dnl always use the wrapper around pkg-config
71AC_SUBST([PKG_CONFIG],["$COCCI_SRCDIR/setup/fake-subst.sh $PKG_CONFIG_ORIG"])
72
73
74dnl ocaml compiler configuration
feec80c3
C
75AC_PROG_OCAML
76AC_CHECK_OCAMLVERSION([OCAMLATLEAST310],[3.10])
77AC_CHECK_OCAMLVERSION([OCAMLATLEAST311],[3.11])
755320b0 78AC_SUBST([OCAMLCORIG],["$OCAMLC"])
feec80c3
C
79
80AS_IF([test "x$OCAMLC" = xno -o "x$OCAMLDEP" = xno -o "x$OCAMLDOC" = xno -o "x$OCAMLMKLIB" = xno],
81[dnl
82 AC_MSG_ERROR([You must install the OCaml compiler])
83])
84AS_IF([test "x$OCAMLATLEAST310" = xno],[AC_MSG_NOTICE([a more recent OCaml installation may be required])])
85
86dnl ocaml tools
87AC_PROG_CAMLP4
88AC_COCCI_TOOL([OCAMLLEX],[ocamllex],[])
89AC_COCCI_TOOL([OCAMLYACC],[ocamlyacc],[])
90AC_COCCI_TOOL([OCAMLFIND],[ocamlfind],[$COCCI_SRCDIR/setup/fake-subst.sh ocamlfind])
755320b0 91AC_COCCI_TOOL([OCAMLPROF],[ocamlprof],[])
feec80c3
C
92
93dnl enforce ocaml tool requirements
94AS_IF([test "x$OCAMLLEX" = xno],
95[dnl
96 AC_MSG_ERROR([the OCaml Lexer needs to be installed (the ocamllex command). It should be part of your OCaml distribution.])
97])
98
99AS_IF([test "x$OCAMLYACC" = xno],
100[dnl
101 AC_MSG_ERROR([The OCaml parser generated needs to be installed (the ocamlyacc command). It should be part of your OCaml distribution.])
102])
103
104AS_IF([test "x$OCAMLFIND" = xno],
105[dnl
106 AC_MSG_ERROR([A suitable OCaml findlib (the ocamlfind command) could not be found.])
107])
108
d6ce1786 109dnl these runtime commands can also be passed as runtime flags to spatch.
feec80c3
C
110AC_COCCI_RUNTIME_CMD([OCAMLFIND],[ocamlfind])
111AC_COCCI_RUNTIME_CMD([OCAMLC],[ocamlc])
112AC_COCCI_RUNTIME_CMD([OCAMLOPT],[ocamlopt])
113AC_COCCI_RUNTIME_CMD([OCAMLDEP],[ocamldep])
114AC_COCCI_RUNTIME_CMD([CAMLP4],[camlp4])
115AC_COCCI_RUNTIME_CMD([CAMLP4O],[camlp4o])
116
755320b0 117dnl AC_CACHE_SAVE
feec80c3
C
118
119
120dnl
121dnl Basic ocaml modules
122dnl
123
124AC_MSG_NOTICE([verifying basic ocaml modules])
125
126dnl default dir with the bundled ocaml packages
127AC_COCCI_SET_EXTERNAL_DIR([$COCCI_SRCDIR/bundles])
128
129dnl set some defaults
130dnl add a line for each package that is
131dnl configured via AC_CHECK_COCCI_EXTPKG
132dnl or AC_REQ_COCCI_EXTPKG
feec80c3 133AC_COCCI_INIT_PKG_EMPTY([menhirLib])
feec80c3
C
134AC_COCCI_INIT_PKG_EMPTY([dynlink])
135AC_COCCI_INIT_PKG_EMPTY([pcre])
136AC_COCCI_INIT_PKG_EMPTY([pycaml])
137AC_COCCI_INIT_PKG_EMPTY([camlp4])
138
139dnl required ocaml packages
140AC_MSG_NOTICE([the following OCaml packages should be provided by your ocaml installation])
141AC_REQ_COCCI_STDPKG([unix])
142AC_REQ_COCCI_STDPKG([bigarray])
143AC_REQ_COCCI_STDPKG([num])
144AC_REQ_COCCI_STDPKG([str])
feec80c3
C
145
146dnl required modules (Some are available locally too)
147AC_REQ_COCCI_EXTPKG([dynlink])
148AC_REQ_COCCI_EXTPKG([camlp4])
feec80c3 149AC_REQ_COCCI_EXTPKG([menhirLib])
feec80c3
C
150
151
755320b0 152dnl AC_CACHE_SAVE
feec80c3
C
153
154
155dnl
156dnl Handling of optional features
157dnl
158
159AC_MSG_NOTICE([verifying optional features])
160
d6ce1786
C
161dnl test if the optimized version of dynlink is available
162AS_IF([test "x$OCAML_PKG_dynlink" != xno -a -f "$PATH_dynlink/dynlink.cmxa"],
163[dnl yes
164 AC_SUBST([OPTIMIZED_dynlink], [yes])
165],
166[dnl no
167 AC_SUBST([OPTIMIZED_dynlink], [no])
168])
169
feec80c3
C
170
171dnl menhir handling
172dnl variables:
173dnl with_menhir: whether or not menhir must be used
174AC_COCCI_TOOL([MENHIR],[menhir],[$COCCI_SRCDIR/setup/fake-menhir.sh menhir])
175AS_IF([test "x$SUBSTITUTED_MENHIR" = xyes],
176[dnl
177 AC_MSG_NOTICE([pregenerated parsers will be required as substitute for Menhir])
178])
179
180
181dnl ocaml script handling
182dnl variables:
183dnl enable_ocaml: whether to enable ocaml scripts
184AC_ARG_ENABLE([ocaml], AS_HELP_STRING([--enable-ocaml], [enable ocaml scripting (default: auto)]))
185AS_IF([test "x$OCAML_PKG_dynlink" = xno],
186[dnl
187 AS_IF([test -z "$enable_ocaml"],
188 [dnl
d6ce1786 189 AC_SUBST([enable_ocaml], [no])
feec80c3
C
190 AC_MSG_NOTICE([ocaml scripting is disabled because the 'dynlink' package is not installed])
191 ], [test "x$enable_ocaml" != xno],
192 [dnl
193 AC_MSG_ERROR([the OCaml package dynlink is required for ocaml scripting])
194 ])
195])
196
197dnl too old ocaml version, disable dynlink by default
198AS_IF([test "x$OCAMLATLEAST311" = xno],
199[dnl
d6ce1786
C
200 AS_IF([test -z "$enable_ocaml"],
201 [dnl
202 AC_SUBST([enable_ocaml], [no])
203 AC_MSG_NOTICE([ocaml scripting has been disabled by default because your OCaml version may not support dynamic linking properly])
204 ], [test "x$enable_ocaml" = xyes],
205 [dnl
206 AC_MSG_NOTICE([warning: your ocaml version may be too old for dynamic linking, thus ocaml scripting may not work])
207 ])
208])
209
210dnl no optimized version, disable dynlink by default
211AS_IF([test "x$OPTIMIZED_dynlink" = xno],
212[dnl
213 AS_IF([test -z "$enable_ocaml"],
214 [dnl
215 AC_SUBST([enable_ocaml], [no])
216 AC_MSG_NOTICE([ocaml scripting has been disabled by default because the optimized version of dynlink is not available])
217 ], [test "x$enable_ocaml" = xyes],
218 [dnl
219 AC_MSG_NOTICE([warning: the optimized version of dynlink is not available, thus ocaml scripting may not work])
220 ])
feec80c3
C
221])
222
223dnl scripting requirement on ocamlfind
224AS_IF([test -n "$SUBSTITUTED_OCAMLFIND"],
225[dnl
226 AS_IF([test -z "$enable_ocaml"],
227 [dnl this is perhaps a bit too strict
228 AC_SUBST([enable_ocaml],[no])
229 AC_MSG_NOTICE([ocaml scripting is disabled because it depends on ocamlfind])
230 ], [test "x$enable_ocaml" != xno],
231 [dnl
d6ce1786 232 AC_MSG_NOTICE([warning: ocamlfind is not found but may be required when ocaml scripts are used])
feec80c3
C
233 ])
234])
235
236dnl scripting requirement on camlp4
237AS_IF([test "x$CAMLP4" = xno],
238[dnl
239 AS_IF([test -z "$enable_ocaml"],
240 [dnl this is perhaps a bit too strict
241 AC_SUBST([enable_ocaml],no)
d6ce1786 242 AC_MSG_NOTICE([ocaml scripting is disabled because it requires camlp4 which is not available])
feec80c3
C
243 ], [test "x$enable_ocaml" != xno],
244 [dnl
d6ce1786 245 AC_MSG_NOTICE([warning: camlp4 is not found but may be required when ocaml scripts are used])
feec80c3
C
246 ])
247])
248
249AS_IF([test "x$enable_ocaml" = xno],
250[dnl
251 AC_COCCI_INIT_PKG_EMPTY([dynlink]) dnl prevent linking with it
d6ce1786
C
252 AC_SUBST(OCAMLCOCCI_MODULE, [No_prepare_ocamlcocci])
253 AC_SUBST(OCAMLCOCCI_FILE, [no_prepare_ocamlcocci.ml])
feec80c3
C
254],
255[dnl
d6ce1786
C
256 AC_SUBST([enable_ocaml], [yes])
257 AC_SUBST(OCAMLCOCCI_MODULE, [Yes_prepare_ocamlcocci])
258 AC_SUBST(OCAMLCOCCI_FILE, [yes_prepare_ocamlcocci.ml])
feec80c3
C
259])
260
261
262dnl python handling
263dnl variables:
264dnl with_python: whether to enable the python feature (and what version)
265dnl OCAML_PKG_pycaml: if "local" use local pycaml package
266AC_ARG_VAR([PYTHON], [path to python when the version is determined automatically])
267AC_ARG_ENABLE([python], [AS_HELP_STRING([--enable-python], [enable python scripting (yes/no) (default: auto)])])
268AS_IF([test "x$enable_python" != xno],
269[dnl
d6ce1786
C
270 dnl an explicitly set --with-python disables the global pycaml by default
271 dnl set --enable-pycaml if it is clear that the installed pycaml library
272 dnl is consistent with the chosen python version
feec80c3
C
273 AS_IF([test -n "$enable_python" -a -z "$enable_pycaml"],
274 [dnl if explicit python given:
275 AC_MSG_NOTICE([skipped the selection of a global pycaml module because --enable-python is given explicitly but --enable-pycaml is not.])
d6ce1786 276 AC_SUBST([enable_pycaml], [no])
feec80c3
C
277 ])
278
279 dnl sets "$PYVER" if python is available
280 AC_COCCI_PYVER
281
282 AS_IF([test -z "$PYVER"],
283 [dnl PYVER undetermined
284 AS_IF([test "x$enable_python" = xyes],
285 [dnl
286 AC_MSG_ERROR([python scripting is enabled explicitly but the version of python could not be determined])
287 ])
288 ],
289 [dnl
d6ce1786 290 AC_MSG_NOTICE([looking for the corresponding python library])
feec80c3
C
291 PKG_CHECK_MODULES([PYTHON], [python-$PYVER],[AC_SUBST(HAVE_PYTHON,[yes])],[AC_SUBST(HAVE_PYTHON,[no])])
292
293 AS_IF([test "x$HAVE_PYTHON" != xyes -a "x$enable_python" != xyes],
294 [dnl fallback if the above failed
d6ce1786 295 AC_MSG_NOTICE([trying the default python library as fallback])
feec80c3
C
296 PKG_CHECK_MODULES([PYTHON], [python],[AC_SUBST(HAVE_PYTHON,[yes])],[AC_SUBST(HAVE_PYTHON,[no])])
297 ])
298 ])
299])
300
301AS_IF([test -z "$enable_python"],
302[dnl
303 AS_IF([test "x$HAVE_PYTHON" = xyes],
304 [dnl
d6ce1786 305 AC_SUBST([enable_python], [yes])
feec80c3
C
306 ],
307 [dnl
d6ce1786 308 AC_SUBST([enable_python], [no])
feec80c3
C
309 ])
310])
311
312AS_IF([test "x$enable_python" != xno],
313[dnl
314 AS_IF([test "x$HAVE_PYTHON" = xyes],
315 [dnl
316 AC_MSG_NOTICE([support for python scripts is enabled])
317 ],
318 [dnl
319 AC_MSG_ERROR([the python scripts feature is enabled but the pkg-config python library is not found])
320 ])
321
322 AC_REQ_COCCI_EXTPKG([pycaml])
323 AC_SUBST([PYCOCCI_MODULE], [Yes_pycocci])
324 AC_SUBST([PYCOCCI_FILE],[yes_pycocci.ml])
325],
326[dnl
327 AC_COCCI_INIT_PKG_EMPTY([pycaml])
328 AC_SUBST([PYCOCCI_MODULE], [No_pycocci])
329 AC_SUBST([PYCOCCI_FILE],[no_pycocci.ml])
330])
331
332
333dnl pcre handling
334dnl variables:
335dnl enable_pcre: whether to enable the pcre feature
336dnl OCAML_PKG_pcre: if "local" use str package
337AC_ARG_ENABLE([pcre-syntax], AS_HELP_STRING([--enable-pcre-syntax], [enable pcre regular expression syntax (default: auto)]))
338AS_IF([test "x$enable_pcre_syntax" != "xno"],
339[dnl
340 PKG_CHECK_MODULES([PCRE], [libpcre],[AC_SUBST([HAVE_PCRE],[yes])],[AC_SUBST([HAVE_PCRE],[no])])
341 AS_IF([test -z "$enable_pcre_syntax" -a "x$HAVE_PCRE" != xyes],
342 [dnl
d6ce1786 343 AC_SUBST([enable_pcre_syntax], [no])
feec80c3
C
344 ],
345 [dnl
346 AC_CHECK_COCCI_EXTPKG([pcre]) dnl will set $enable_pcre to 'yes', 'no', or 'local'
347 enable_pcre_syntax=$enable_pcre
348 ])
349])
350
351AS_IF([test "x$enable_pcre_syntax" != xno],
352[dnl
353 AS_IF([test "x$HAVE_PCRE" = xyes],
354 [dnl
355 AC_MSG_NOTICE([support for pcre syntax is enabled])
356 ],
357 [dnl
358 AC_MSG_ERROR([the pcre feature is enabled but the pkg-config libpcre library is not found])
359 ])
360
361 AC_SUBST([REGEXP_MODULE], [Regexp_pcre])
362 AC_SUBST([REGEXP_FILE], [regexp_pcre.ml])
363],
364[dnl
365 AC_COCCI_INIT_PKG_EMPTY([pcre])
366 AC_SUBST([REGEXP_MODULE], [Regexp_str])
367 AC_SUBST([REGEXP_FILE], [regexp_str.ml])
368])
369
370
755320b0 371dnl AC_CACHE_SAVE
feec80c3
C
372
373
374dnl obtain the value of $prefix
375AS_IF([test "$prefix" = "NONE"],[prefix=$ac_default_prefix])
376
377
378dnl
379dnl backwards compatibility
380dnl
381
382dnl defines some variables needed by the Make infrastructure
383AC_SUBST(SHAREDIR,["${prefix}/share/coccinelle"])
384
385AS_IF([test "x$enable_python" != xno],
386[dnl
d6ce1786 387 AC_SUBST(FEATURE_PYTHON, [1])
feec80c3
C
388],
389[dnl
d6ce1786 390 AC_SUBST(FEATURE_PYTHON, [0])
feec80c3
C
391])
392
393AS_IF([test "x$enable_ocaml" != xno],
394[dnl
d6ce1786 395 AC_SUBST(FEATURE_OCAML, [1])
feec80c3
C
396],
397[dnl
d6ce1786 398 AC_SUBST(FEATURE_OCAML, [0])
feec80c3
C
399])
400
401dnl dynlink stuff depending on the OCaml version and whether it is enabled
d6ce1786 402AS_IF([test "x$OCAMLATLEAST311" = xyes -a "x$enable_ocaml" = xyes -a "x$OCAMLOPT" != xno],
feec80c3 403[dnl
d6ce1786 404 AC_SUBST([DYNLINK_IS_NATIVE], [Dynlink.is_native])
feec80c3
C
405],
406[dnl
d6ce1786 407 AC_SUBST([DYNLINK_IS_NATIVE], [false])
feec80c3
C
408])
409
410dnl in case of the compilation of the manual
411AC_COCCI_TOOL([PDFLATEX],[pdflatex],[$COCCI_SRCDIR/setup/fake-pdflatex.sh pdflatex])
412
413
d6ce1786 414dnl determine release configuration
755320b0 415AC_ARG_ENABLE([release], [AS_HELP_STRING([--enable-release], [build with a release configuration (yes,no,profile default: no)])])
feec80c3
C
416AS_IF([test -z "$enable_release"],
417[dnl
418 AC_MSG_NOTICE([choosing the development Makefile configuration because the release configuration is not explicitly requested.])
419 AC_SUBST([enable_release], [no])
420])
421
755320b0 422AC_SUBST([MODULES_profiling],[])
feec80c3 423AS_IF([test "x$enable_release" = xyes],
d6ce1786 424[dnl set the default target to 'release' when enable_release is given
feec80c3
C
425 AC_SUBST([MAKETARGET_ALL], [all-release])
426], [test "x$enable_release" = xno],
d6ce1786 427[dnl otherwise, set the default target to 'dev'
feec80c3 428 AC_SUBST([MAKETARGET_ALL], [all-dev])
755320b0
C
429], [test "x$enable_release" = xprofile],
430[dnl selected profiling
431 AS_IF([test -z "$OCAMLPROF" -o "x$OCAMLPROF" = xno],
432 [dnl
433 AC_MSG_ERROR([ocamlprof is required for profiling, but is absent.])
434 ])
435
436 dnl configuration-time overrides for profiling
437 AC_SUBST([MAKETARGET_ALL], [all-dev])
abad11c5 438 AC_SUBST([OCAMLC], ["$COCCI_SRCDIR/setup/wrapper-ocamlcp.sh $OCAMLCORIG $OCAMLPROF"])
755320b0
C
439 AC_SUBST([MODULES_profiling], [profiling.cmo])
440 AC_MSG_NOTICE([configured coccinelle for profiling])
feec80c3
C
441],
442[dnl custom target given
443 AC_SUBST([MAKETARGET_ALL], ["$enable_release"])
444])
445
d6ce1786
C
446dnl determine whether to build the optimizing version
447AC_ARG_ENABLE([opt], [AS_HELP_STRING([--enable-opt], [build an optimized spatch (yes,no, default: auto)])])
448AS_IF([test "x$OCAMLOPT" = xno -a "x$enable_opt" != xno],
449[dnl
450 AS_IF([test -n "$enable_release" -a "x$enable_release" != xyes -a "x$enable_release" != xno],
451 [dnl
452 AC_MSG_NOTICE([warning: ensure that make target $enable_release does not depend on the unavailable ocamlopt])
453 ], [test "x$enable_opt" = xyes],
454 [dnl
455 AC_MSG_ERROR([the optimized version of coccinelle is requested explicitly, but ocamlopt is absent])
456 ],
457 [dnl
458 AC_MSG_NOTICE([the optimized version of coccinelle will not be build because ocamlopt is not present])
459 AC_SUBST([enable_opt], [no])
460 ])
461])
462
463AS_IF([test "x$OCAMLVERSION" = x3.11.2 -a -z "$enable_opt"],
464[dnl the optimized version may not be buildable with ocaml 3.11.2 (know bug), hence disable it by default
465 AC_MSG_NOTICE([the optimized version of coccinelle will not be build by default due to OCaml version $OCAMLVERSION])
466 AC_SUBST([enable_opt], [no])
467])
468
469dnl disable the optimized target when dynlinking is enabled but the optimized version of dynlink is not available
470AS_IF([test "x$OPTIMIZED_dynlink" = xno -a "x$enable_ocaml" = xyes],
471[dnl
472 AS_IF([test -z "$enable_opt"],
473 [dnl
474 AC_MSG_NOTICE([the optimized version of coccinelle will not be build by default because ocaml scripting is enabled but the required optimized dynlink package is not present])
475 AC_SUBST([enable_opt], [no])
476 ], [test "x$enable_opt" = xyes],
477 [dnl
478 AC_MSG_ERROR([the optimized version of coccinelle in combination with ocaml scripting requires the optimized version of the dynlik package, which is not present])
479 ])
480])
481
abad11c5 482dnl set the default enable-opt setting
d6ce1786
C
483AS_IF([test -z "$enable_opt"],
484[dnl
485 AS_IF([test "x$enable_release" = xyes -o "x$enable_release" = xno],
486 [dnl
487 AC_SUBST([enable_opt], ["$enable_release"])
488 ])
489])
490
491dnl variables depending on whether we build the optimized spatch
492AS_IF([test "x$enable_opt" = xyes],
493[dnl default target for the optimized version
494 AC_SUBST([SPATCHNAME], [spatch.opt])
495 AC_SUBST([MAKETARGET_SPATCH], [opt-only])
496],
497[dnl default target for the bytecode version
498 AC_SUBST([SPATCHNAME], [spatch])
499 AC_SUBST([MAKETARGET_SPATCH], [byte-only])
500])
feec80c3
C
501
502
abad11c5
C
503dnl ocamlbuild handling
504AC_ARG_ENABLE([ocamlbuild], AS_HELP_STRING([--enable-ocamlbuild], [enable ocamlbuild support (default: no)]))
505AS_IF([test "x$enable_ocamlbuild" = xyes],
506[dnl ocamlbuild support requested
507 AS_IF([test -z "$OCAMLBUILD" -o "x$OCAMLBUILD" = xno],
508 [dnl
509 AC_MSG_ERROR([Ocamlbuild is required but is not installed.])
510 ])
511
512 AC_SUBST([FEATURE_OCAMLBUILD], [yes])
513],
514[dnl default: disable ocamlbuild support
515 AC_SUBST([FEATURE_OCAMLBUILD], [ ])
516])
517
518
feec80c3
C
519dnl
520dnl generating configuration
521dnl
522
d6ce1786
C
523AC_CONFIG_FILES([
524 Makefile.config
525 version.ml
526 commons/commands.ml
527 globals/config.ml globals/regexp.ml python/pycocci.ml
528 ocaml/prepare_ocamlcocci.ml
529 scripts/spatch.sh
530 docs/spatch.1
abad11c5
C
531 myocamlbuild.ml
532
533 setup/Makefile
d6ce1786 534])
feec80c3
C
535
536AC_OUTPUT
537
538AC_MSG_NOTICE([configuration completed])
539
540cat << EOF
541------------------------------------------------------------------------------
542Summary
543
d6ce1786
C
544configure flags: $CONFIGURE_FLAGS
545findlib: $OCAMLFIND (an actual version is strongly recommended)
546menhir: $MENHIR (should be an optional tool)
755320b0 547menhirLib module: $enable_menhirLib (for local package use --disable-menhirLib)
feec80c3 548
d6ce1786
C
549ocaml scripting: $enable_ocaml (overridable with --enable-ocaml)
550python scripting: $enable_python (overridable with --enable-python)
551pycaml module: $enable_pycaml (for local package use --disable-pycaml)
feec80c3 552
d6ce1786
C
553pcre regexes: $enable_pcre_syntax (overridable with --enable-pcre-syntax)
554pcre module: $enable_pcre (for local package use --disable-pcre)
555pcre library: $HAVE_PCRE (requires the dev version of libpcre)
feec80c3 556
d6ce1786
C
557release config: $enable_release (strongly recommended to be 'yes', overridable with --enable-release)
558optimized spatch: $enable_opt (overridable with --disable-opt)
feec80c3 559
feec80c3
C
560------------------------------------------------------------------------------
561Coccinelle can now be compiled and installed.
562
563
564If you compile coccinelle again after source code changes or
565configuration changes, you may need to run first:
566 \$ make clean
567
568To compile coccinelle, run:
569 \$ make all
570
571To install coccinelle, run:
572 \$ make install
573
d6ce1786
C
574Then, to test coccinelle, run for example:
575 \$ spatch -sp_file demos/simple.cocci demos/simple.c -o /tmp/new_simple.c
576
577Or when coccinelle is not installed yet:
578 \$ COCCINELLE_HOME=$(pwd) ./scripts/spatch -sp_file demos/simple.cocci demos/simple.c -o /tmp/new_simple.c
feec80c3
C
579EOF
580
581if test "x$enable_python" != "xno"; then
582cat << EOF
583------------------------------------------------------------------------------
584You may need to set some environment variables so that the python
585libraries are found. The frontend 'spatch' sets the following variables:
586
587 \$ export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:$prefix/lib
588 \$ export PYTHONPATH=\$PYTHONPATH:$prefix/share/coccinelle/python
589
590EOF
591fi
592
593cat << EOF
594------------------------------------------------------------------------------
595EOF