~ubuntu-branches/debian/sid/frama-c/sid

« back to all changes in this revision

Viewing changes to configure.in

  • Committer: Bazaar Package Importer
  • Author(s): Mehdi Dogguy
  • Date: 2009-06-03 08:19:25 UTC
  • Revision ID: james.westby@ubuntu.com-20090603081925-kihvxvt0wy3zc4ar
Tags: upstream-20081201.dfsg
ImportĀ upstreamĀ versionĀ 20081201.dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
##########################################################################
 
2
#                                                                        #
 
3
#  This file is part of Frama-C.                                         #
 
4
#                                                                        #
 
5
#  Copyright (C) 2007-2008                                               #
 
6
#    CEA   (Commissariat ļæ½ l'ļæ½nergie Atomique)                           #
 
7
#    INRIA (Institut National de Recherche en Informatique et en         #
 
8
#           Automatique)                                                 #
 
9
#                                                                        #
 
10
#  you can redistribute it and/or modify it under the terms of the GNU   #
 
11
#  Lesser General Public License as published by the Free Software       #
 
12
#  Foundation, version 2.1.                                              #
 
13
#                                                                        #
 
14
#  It is distributed in the hope that it will be useful,                 #
 
15
#  but WITHOUT ANY WARRANTY; without even the implied warranty of        #
 
16
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         #
 
17
#  GNU Lesser General Public License for more details.                   #
 
18
#                                                                        #
 
19
#  See the GNU Lesser General Public License version v2.1                #
 
20
#  for more details (enclosed in the file licenses/LGPLv2.1).            #
 
21
#                                                                        #
 
22
##########################################################################
 
23
 
 
24
#
 
25
# autoconf input for Objective Caml programs
 
26
# Copyright (C) 2001 Jean-Christophe Filliļæ½tre
 
27
#   from a first script by Georges Mariano
 
28
 
 
29
# the script generated by autoconf from this input will set the following
 
30
# variables:
 
31
#   OCAMLC        "ocamlc" if present in the path, or a failure
 
32
#                 or "ocamlc.opt" if present with same version number as ocamlc
 
33
#   OCAMLOPT      "ocamlopt" (or "ocamlopt.opt" if present), or "no"
 
34
#   OCAMLBEST     either "byte" if no native compiler was found,
 
35
#                 or "opt" otherwise
 
36
#   OCAMLDEP      "ocamldep"
 
37
#   OCAMLLEX      "ocamllex" (or "ocamllex.opt" if present)
 
38
#   OCAMLYACC     "ocamlyacc"
 
39
#   OCAMLLIB      the path to the ocaml standard library
 
40
#   OCAMLVERSION  the ocaml version number
 
41
#   OCAMLWIN32    "yes"/"no" depending on Sys.os_type = "Win32"
 
42
#   EXE           ".exe" if OCAMLWIN32=yes, "" otherwise
 
43
 
 
44
AC_INIT(src/kernel)
 
45
export CYGWIN=nobinmode
 
46
 
 
47
upper() {
 
48
  echo "$1" | tr "a-z" "A-Z"
 
49
}
 
50
 
 
51
lower() {
 
52
  echo "$1" | tr "A-Z" "a-z"
 
53
}
 
54
 
 
55
new_section() {
 
56
  banner=`echo "* $1 *" | sed -e 's/./*/g'`
 
57
  title=`echo "* $1 *" | tr "a-z" "A-Z"`
 
58
  AC_MSG_NOTICE($banner)
 
59
  AC_MSG_NOTICE($title)
 
60
  AC_MSG_NOTICE($banner)
 
61
}
 
62
 
 
63
##########################
 
64
# Check for Make version #
 
65
##########################
 
66
 
 
67
new_section "configure make"
 
68
 
 
69
AC_CHECK_PROG(MAKE,make,make,)
 
70
MAKE_DISTRIB=`$MAKE -v | sed -n -e 's/\(.*\) Make.*$/\1/p' `
 
71
MAKE_MAJOR=`$MAKE -v | sed -n  -f bin/sed_get_make_major `
 
72
MAKE_MINOR=`$MAKE -v | sed -n -f bin/sed_get_make_minor `
 
73
echo $ECHO_N "make version is $MAKE_DISTRIB Make $MAKE_MAJOR.$MAKE_MINOR: $ECHO_C"
 
74
if test "$MAKE_DISTRIB" != GNU -o "$MAKE_MAJOR" -lt 3 -o "$MAKE_MINOR" -lt 81;
 
75
then
 
76
   echo "${ECHO_T}"
 
77
   AC_MSG_ERROR([unsupported version; GNU Make version 3.81
 
78
                 or higher is required.]);
 
79
else
 
80
   echo "${ECHO_T}Good!"
 
81
fi
 
82
 
 
83
# verbosemake feature
 
84
AC_ARG_ENABLE(verbosemake,[  --enable-verbosemake    verbose makefile commands],VERBOSEMAKE=yes,VERBOSEMAKE=no)
 
85
if test "$VERBOSEMAKE" = yes ; then
 
86
        AC_MSG_RESULT(Make will be verbose.)
 
87
fi
 
88
 
 
89
#############################
 
90
# Check for Ocaml compilers #
 
91
#############################
 
92
 
 
93
# Specifically allow 3.10.0
 
94
UNSUPPORTED_OCAML=no
 
95
AC_ARG_ENABLE(unsupported-ocaml,
 
96
[  --enable-unsupported-ocaml
 
97
    attempt to compile even against unsupported ocaml version],
 
98
UNSUPPORTED_OCAML=yes,UNSUPPORTED_OCAML=no)
 
99
 
 
100
new_section "configure ocaml compilers"
 
101
 
 
102
# we first look for ocamlc in the path; if not present, we fail
 
103
AC_CHECK_PROG(OCAMLC,ocamlc,ocamlc,no)
 
104
if test "$OCAMLC" = no ; then
 
105
        AC_MSG_ERROR(Cannot find ocamlc.)
 
106
fi
 
107
 
 
108
# we extract Ocaml version number and library path
 
109
OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
 
110
LOWER_THAN_311="yes"
 
111
echo $ECHO_N "ocaml version is $OCAMLVERSION: $ECHO_C"
 
112
case $OCAMLVERSION in
 
113
  3.09.3*) echo "${ECHO_T}Good!";;
 
114
  3.09*) echo "${ECHO_T}Warning: unsupported version.";
 
115
         if test "$UNSUPPORTED_OCAML" == "yes"; then
 
116
           echo "Compile at your own risks";
 
117
         else
 
118
           echo "If you want to compile Frama-C with this version, use the \
 
119
--enable-unsupported-ocaml option of configure";
 
120
           exit 2;
 
121
         fi
 
122
         ;;
 
123
  3.0*) echo "${ECHO_T}Incompatible version!"; exit 2;;
 
124
  3.10.0) echo "${ECHO_T}Warning: unsupported version." ;
 
125
         if test "$UNSUPPORTED_OCAML" == "yes"; then
 
126
           echo "Compile at your own risks";
 
127
         else
 
128
           echo "If you want to compile Frama-C with this version, use the \
 
129
--enable-unsupported-ocaml option of configure";
 
130
           exit 2;
 
131
         fi
 
132
         ;;
 
133
  3.10*) echo "${ECHO_T}Good!";;
 
134
  3.1*) LOWER_THAN_311=no;
 
135
        echo "${ECHO_T}Good!";;
 
136
  *) echo "${ECHO_T}Incompatible version!"; exit 2;;
 
137
esac
 
138
 
 
139
# Ocaml library path
 
140
OCAMLLIB=`$OCAMLC -where | tr -d '\\r'`
 
141
echo "ocaml library path is $OCAMLLIB"
 
142
 
 
143
# then we look for ocamlopt; if not present, we issue a warning
 
144
# if the version is not the same, we also discard it
 
145
# we set OCAMLBEST to "opt" or "byte", whether ocamlopt is available or not
 
146
AC_CHECK_PROG(OCAMLOPT,ocamlopt,ocamlopt,no)
 
147
OCAMLBEST=byte
 
148
if test "$OCAMLOPT" = no ; then
 
149
        AC_MSG_WARN(Cannot find ocamlopt; bytecode compilation only.)
 
150
else
 
151
        AC_MSG_CHECKING(ocamlopt version)
 
152
        TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
 
153
        if test "$TMPVERSION" != "$OCAMLVERSION" ; then
 
154
            AC_MSG_RESULT(differs from ocamlc; ocamlopt discarded.)
 
155
            OCAMLOPT=no
 
156
        else
 
157
            AC_MSG_RESULT(ok)
 
158
            OCAMLBEST=opt
 
159
        fi
 
160
fi
 
161
 
 
162
if test "$OCAMLBEST" = "opt"; then
 
163
   LIB_SUFFIX=cmxa
 
164
   OBJ_SUFFIX=cmx;
 
165
else
 
166
   LIB_SUFFIX=cma
 
167
   OBJ_SUFFIX=cmo;
 
168
fi
 
169
 
 
170
# checking for ocamlc.opt
 
171
AC_CHECK_PROG(OCAMLCDOTOPT,ocamlc.opt,ocamlc.opt,no)
 
172
if test "$OCAMLCDOTOPT" != no ; then
 
173
        AC_MSG_CHECKING(ocamlc.opt version)
 
174
        TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
 
175
        if test "$TMPVERSION" != "$OCAMLVERSION" ; then
 
176
            AC_MSG_RESULT(differs from ocamlc; ocamlc.opt discarded.)
 
177
        else
 
178
            AC_MSG_RESULT(ok)
 
179
            OCAMLC=$OCAMLCDOTOPT
 
180
        fi
 
181
fi
 
182
 
 
183
# checking for ocamlopt.opt
 
184
if test "$OCAMLOPT" != no ; then
 
185
    AC_CHECK_PROG(OCAMLOPTDOTOPT,ocamlopt.opt,ocamlopt.opt,no)
 
186
    if test "$OCAMLOPTDOTOPT" != no ; then
 
187
        AC_MSG_CHECKING(ocamlc.opt version)
 
188
        TMPVER=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
 
189
        if test "$TMPVER" != "$OCAMLVERSION" ; then
 
190
            AC_MSG_RESULT(differs from ocamlc; ocamlopt.opt discarded.)
 
191
        else
 
192
            AC_MSG_RESULT(ok)
 
193
            OCAMLOPT=$OCAMLOPTDOTOPT
 
194
        fi
 
195
    fi
 
196
fi
 
197
 
 
198
##############################################
 
199
# Check for other mandatory tools/libraries #
 
200
##############################################
 
201
 
 
202
new_section "configure mandatory tools and libraries"
 
203
 
 
204
# ocamldep
 
205
AC_CHECK_PROG(OCAMLDEP,ocamldep,ocamldep,no)
 
206
if test "$OCAMLDEP" = no ; then
 
207
        AC_MSG_ERROR(Cannot find ocamldep.)
 
208
else
 
209
    AC_CHECK_PROG(OCAMLDEPDOTOPT,ocamldep.opt,ocamldep.opt,no)
 
210
    if test "$OCAMLDEPDOTOPT" != no ; then
 
211
        OCAMLDEP=$OCAMLDEPDOTOPT
 
212
    fi
 
213
fi
 
214
 
 
215
# ocamllex
 
216
AC_CHECK_PROG(OCAMLLEX,ocamllex,ocamllex,no)
 
217
if test "$OCAMLLEX" = no ; then
 
218
    AC_MSG_ERROR(Cannot find ocamllex.)
 
219
else
 
220
    AC_CHECK_PROG(OCAMLLEXDOTOPT,ocamllex.opt,ocamllex.opt,no)
 
221
    if test "$OCAMLLEXDOTOPT" != no ; then
 
222
        OCAMLLEX=$OCAMLLEXDOTOPT
 
223
    fi
 
224
fi
 
225
 
 
226
# ocamlyacc
 
227
AC_CHECK_PROG(OCAMLYACC,ocamlyacc,ocamlyacc,no)
 
228
if test "$OCAMLYACC" = no ; then
 
229
        AC_MSG_ERROR(Cannot find ocamlyacc.)
 
230
fi
 
231
 
 
232
# camlp4oof
 
233
dnl AC_CHECK_PROG(CAMLP4OOF,camlp4oof,camlp4oof,no)
 
234
dnl if test "$CAMLP4OOF" == no ; then
 
235
dnl   case $OCAMLVERSION in
 
236
dnl     3.09*) CAMLP4OOF="$CAMLP4O pa_macro.cmo pr_o.cmo" ;;
 
237
dnl     *) AC_MSG_ERROR([You need to install camlp4.]);;
 
238
dnl   esac
 
239
dnl fi
 
240
 
 
241
# ocamlgraph
 
242
 
 
243
OCAMLGRAPH_LOCAL=ocamlgraph
 
244
OCAMLGRAPH_EXISTS=no
 
245
 
 
246
OCAMLGRAPH_TEST=$OCAMLGRAPH_LOCAL
 
247
OCAMLGRAPH="-I lib"
 
248
AC_CHECK_FILE($OCAMLGRAPH_TEST,OCAMLGRAPH_EXISTS=yes)
 
249
 
 
250
if test "$OCAMLGRAPH_EXISTS" == "no"; then
 
251
 AC_CHECK_FILE(ocamlgraph.tar.gz,OCAMLGRAPH_EXISTS=yes)
 
252
 if test "$OCAMLGRAPH_EXISTS" == "yes"; then
 
253
         AC_MSG_NOTICE([Unarchiving ocamlgraph.tar.gz])
 
254
         tar zxf ocamlgraph.tar.gz
 
255
 fi
 
256
else
 
257
 AC_CHECK_FILE(ocamlgraph.tar.gz,OCAMLGRAPH_TAR=yes)
 
258
 if test "$OCAMLGRAPH_TAR" == "yes"; then
 
259
   if test ocamlgraph.tar.gz -nt ocamlgraph; then
 
260
     rm -rf ocamlgraph
 
261
     AC_MSG_NOTICE([Ocamlgraph updated])
 
262
     tar zxf ocamlgraph.tar.gz
 
263
   fi
 
264
 fi
 
265
fi
 
266
 
 
267
#NB: until now, it is not really possible to check a particular
 
268
#version of ocamlgraph if it is installed system-wide. for godi installs, this
 
269
#is taken into account by godi itself
 
270
if test "$OCAMLGRAPH_EXISTS" == "no"; then
 
271
   OCAMLGRAPH_LOCAL=""
 
272
   OCAMLGRAPH_TEST=$OCAMLLIB/ocamlgraph
 
273
   OCAMLGRAPH="-I +ocamlgraph"
 
274
   AC_CHECK_FILE($OCAMLGRAPH_TEST,OCAMLGRAPH_EXISTS=yes)
 
275
 
 
276
   if test "$OCAMLGRAPH_EXISTS" == "no"; then
 
277
      OCAMLGRAPH_TEST=$OCAMLLIB
 
278
      OCAMLGRAPH=
 
279
      AC_CHECK_FILE($OCAMLGRAPH_TEST/graph.$OBJ_SUFFIX,OCAMLGRAPH_EXISTS=yes)
 
280
   fi
 
281
 
 
282
   if test "$OCAMLGRAPH_EXISTS" == "no"; then
 
283
      AC_MSG_ERROR(Cannot find $OCAMLGRAPH_LOCAL in current directory
 
284
      Please download the latest version from http://ocamlgraph.lri.fr/download
 
285
      Compile it in "ocamlgraph" then rerun ./configure)
 
286
   fi
 
287
else
 
288
        AC_CHECK_FILE($OCAMLGRAPH_TEST/Makefile,,
 
289
        AC_MSG_NOTICE([Configuring ocamlgraph])
 
290
        [(cd $OCAMLGRAPH_TEST && ./configure > /dev/null)])
 
291
#        AC_CHECK_FILE($OCAMLGRAPH_TEST/graph.cmo,,
 
292
#        AC_MSG_NOTICE([ocamlgraph not compiled: compiling it])
 
293
#        [$MAKE -s -C $OCAMLGRAPH_TEST])
 
294
fi
 
295
 
 
296
#################################################
 
297
# Check for other non-mandatory tools/libraries #
 
298
#################################################
 
299
 
 
300
new_section "configure non-mandatory tools and libraries"
 
301
 
 
302
AC_CHECK_PROG(OCAMLDOC,ocamldoc,ocamldoc,no)
 
303
if test "$OCAMLDOC" = no ; then
 
304
        AC_MSG_RESULT(ocamldoc discarded not present)
 
305
fi
 
306
 
 
307
AC_CHECK_PROG(OCAMLMKTOP,ocamlmktop,ocamlmktop,no)
 
308
if test "$OCAMLMKTOP" = no ; then
 
309
        AC_MSG_RESULT(Cannot find ocamlmktop: toplevels cannot be built.)
 
310
fi
 
311
 
 
312
AC_CHECK_PROG(OTAGS,otags,otags,)
 
313
AC_CHECK_PROG(DOT,dot,dot,)
 
314
 
 
315
############
 
316
# Platform #
 
317
############
 
318
 
 
319
new_section "configure platform"
 
320
 
 
321
AC_MSG_CHECKING(platform)
 
322
if echo "let _ = Sys.os_type;;" | ocaml | grep -q Win32; then
 
323
    AC_MSG_RESULT(Win32)
 
324
    OCAMLWIN32=yes
 
325
    EXE=.exe
 
326
else
 
327
    OCAMLWIN32=no
 
328
    if echo "let _ = Sys.os_type;;" | ocaml | grep -q Cygwin; then
 
329
       AC_MSG_RESULT(Cygwin)
 
330
       EXE=.exe
 
331
    else
 
332
       AC_MSG_RESULT(Unix)
 
333
       EXE=
 
334
    fi
 
335
fi
 
336
 
 
337
# Local machdep feature (to generate new platforms)
 
338
AC_ARG_ENABLE(localmachdep,[  --enable-localmachdep    enable local machdep configuration],LOCAL_MACHDEP=yes,LOCAL_MACHDEP=no)
 
339
 
 
340
if test "$LOCAL_MACHDEP" = yes ; then
 
341
AC_CONFIG_HEADER(config.h)
 
342
AC_CHECK_HEADERS(stdlib.h)
 
343
AC_CHECK_HEADERS(wchar.h)
 
344
 
 
345
 
 
346
# Find out the true definitions of some integer types
 
347
# checkIntegerype(size_t) will echo "int" or "long"
 
348
checkIntegerType() {
 
349
  fn="testtype.c"
 
350
  fo="testtype.o"
 
351
  for t in "int" "unsigned int" "long" "unsigned long" "short" "unsigned short" "char" "unsigned  char" ;do
 
352
     echo "#include <stddef.h>" >$fn
 
353
     echo "#include <wchar.h>" >>$fn
 
354
     # We define a prototype with one type and the function with
 
355
     # another type. This will result in compilation error
 
356
     # unless the types are really identical
 
357
     echo "$t foo($t x);"      >>$fn
 
358
     echo "$1 foo($1 x) { return x;}" >>$fn
 
359
     if gcc -c $fn 2>/dev/null ;then
 
360
        # Found it
 
361
        echo $t
 
362
        rm -f $fn $fo
 
363
        return
 
364
     fi
 
365
  done
 
366
  rm -f $fn $fo
 
367
}
 
368
 
 
369
AC_MSG_CHECKING([definition of size_t])
 
370
TYPE_SIZE_T=`checkIntegerType "size_t"`
 
371
if test "x$TYPE_SIZE_T" = "x" ;then
 
372
  AC_MSG_ERROR([Cannot find definition of size_t])
 
373
fi
 
374
AC_DEFINE_UNQUOTED(TYPE_SIZE_T, "$TYPE_SIZE_T")
 
375
AC_MSG_RESULT([$TYPE_SIZE_T])
 
376
 
 
377
AC_MSG_CHECKING([definition of wchar_t])
 
378
TYPE_WCHAR_T=`checkIntegerType "wchar_t"`
 
379
if test "x$TYPE_WCHAR_T" = "x" ;then
 
380
  AC_MSG_ERROR([Cannot find definition of wchar_t])
 
381
fi
 
382
AC_DEFINE_UNQUOTED(TYPE_WCHAR_T, "$TYPE_WCHAR_T")
 
383
AC_MSG_RESULT([$TYPE_WCHAR_T])
 
384
 
 
385
AC_MSG_CHECKING([definition of ptrdiff_t])
 
386
TYPE_PTRDIFF_T=`checkIntegerType "ptrdiff_t"`
 
387
if test "x$TYPE_PTRDIFF_T" = "x" ;then
 
388
  AC_MSG_ERROR([Cannot find definition of ptrdiff_t])
 
389
fi
 
390
AC_DEFINE_UNQUOTED(TYPE_PTRDIFF_T, "$TYPE_PTRDIFF_T")
 
391
AC_MSG_RESULT([$TYPE_PTRDIFF_T])
 
392
 
 
393
AC_MSG_CHECKING([for gcc version])
 
394
AC_CHECK_TYPE(__builtin_va_list,
 
395
              HAVE_BUILTIN_VA_LIST=true,
 
396
              HAVE_BUILTIN_VA_LIST=false)
 
397
AC_MSG_CHECKING([if __thread is a keyword])
 
398
AC_COMPILE_IFELSE([int main(int __thread) { return 0; }],
 
399
                  THREAD_IS_KEYWORD=false,
 
400
                  THREAD_IS_KEYWORD=true)
 
401
AC_MSG_RESULT($THREAD_IS_KEYWORD)
 
402
 
 
403
# Does gcc add underscores to identifiers to make assembly labels?
 
404
# (I think MSVC always does)
 
405
AC_MSG_CHECKING([if gcc adds underscores to assembly labels.])
 
406
AC_LINK_IFELSE([int main() { __asm__("jmp _main"); }],
 
407
                  UNDERSCORE_NAME=true,
 
408
                  UNDERSCORE_NAME=false)
 
409
AC_MSG_RESULT($UNDERSCORE_NAME)
 
410
 
 
411
fi
 
412
 
 
413
AC_MSG_CHECKING(if performance counters are usable)
 
414
# Create a C file from src/perfcount.c.in
 
415
rm -f ./cycles.exe
 
416
if gcc -DCONFIGURATION_ONLY \
 
417
       -x c cil/ocamlutil/perfcount.c.in -lm -o bin/cycles.exe >/dev/null 2>&1; then
 
418
 
 
419
   if CYCLES_PER_USEC=`bin/cycles.exe 2>&1` ;then
 
420
     AC_MSG_RESULT([ok ($CYCLES_PER_USEC cycles per us)])
 
421
   else
 
422
     # Print what we got
 
423
     AC_MSG_RESULT([no ($CYCLES_PER_USEC)])
 
424
     CYCLES_PER_USEC=0
 
425
   fi
 
426
else
 
427
   CYCLES_PER_USEC=0
 
428
   AC_MSG_RESULT([no (cannot compile perfcount.c)])
 
429
fi
 
430
rm -f bin/cycles.exe
 
431
 
 
432
# If we are on Linux and we use performance counters try to get
 
433
# the processor speed from /proc/cpuinfo
 
434
if test "$CYCLES_PER_USEC" != "0" ;then
 
435
     case "$target" in
 
436
        # linux
 
437
        *86*linux*)
 
438
             AC_MSG_CHECKING(if /proc/cpuinfo has processor speed)
 
439
             cpuinfo=`cat /proc/cpuinfo 2>/dev/null | grep "cpu MHz"`
 
440
             [procspeed=`echo $cpuinfo | sed 's/^.*[^0-9]\([0-9]\+\.[0-9]\+\).*$/\1/g'`]
 
441
             if test "$procspeed"!="" ;then
 
442
                CYCLES_PER_USEC=$procspeed
 
443
                AC_MSG_RESULT([got $CYCLES_PER_USEC cycles per us])
 
444
             else
 
445
                AC_MSG_RESULT(no)
 
446
             fi
 
447
             ;;
 
448
        *)
 
449
             ;;
 
450
      esac
 
451
      # Now set HAS_PERFCOUNT
 
452
      HAS_PERFCOUNT=1
 
453
else
 
454
      HAS_PERFCOUNT=0
 
455
fi
 
456
 
 
457
#################
 
458
# Plugin wished #
 
459
#################
 
460
 
 
461
new_section "wished frama-c plugins"
 
462
 
 
463
# Library declarations
 
464
######################
 
465
 
 
466
# REQUIRE_LIBRARY: library *must* be present in order to build plugins
 
467
# USE_LIBRARY: better for plugins if library is present, but not required
 
468
# HAS_LIBRARY: is the library available?
 
469
 
 
470
REQUIRE_ELSA=
 
471
USE_ELSA=
 
472
HAS_ELSA=
 
473
 
 
474
REQUIRE_LABLGTK=
 
475
USE_LABLGTK=
 
476
HAS_LABLGTK=
 
477
 
 
478
REQUIRE_WHYJC=
 
479
USE_WHYJC=
 
480
HAS_WHYJC=
 
481
 
 
482
REQUIRE_APRON=
 
483
USE_APRON=
 
484
HAS_APRON=no
 
485
 
 
486
 
 
487
# Tool declarations
 
488
####################
 
489
 
 
490
LABLGLADECC=
 
491
REQUIRE_LABLGLADECC=
 
492
USE_LABLGLADECC=
 
493
HAS_LABLGLADECC=
 
494
 
 
495
CAMLP4O=
 
496
REQUIRE_CAMLP4O=
 
497
USE_CAMLP4O=
 
498
HAS_CAMLP4O=
 
499
 
 
500
 
 
501
LTLTOBA=
 
502
REQUIRE_LTLTOBA=
 
503
USE_LTLTOBA=
 
504
HAS_LTLTOBA=
 
505
 
 
506
 
 
507
### Now plugin declarations
 
508
 
 
509
PLUGINS_FORCE_LIST=
 
510
 
 
511
define([check_plugin],
 
512
[
 
513
define([PLUGIN_NAME],$1)
 
514
define([PLUGIN_FILE],$2)
 
515
define([PLUGIN_MSG],$3)
 
516
define([PLUGIN_DEFAULT],$4)
 
517
default=PLUGIN_DEFAULT
 
518
AC_CHECK_FILE(PLUGIN_FILE,plugin_present=yes,plugin_present=no;default=no)
 
519
FORCE=no
 
520
define([PLUGIN_HELP],
 
521
       AC_HELP_STRING([--enable-PLUGIN_NAME],
 
522
                      [PLUGIN_MSG (default: PLUGIN_DEFAULT)]))
 
523
AC_ARG_ENABLE(
 
524
  [PLUGIN_NAME],
 
525
  PLUGIN_HELP,
 
526
  ENABLE=$enableval;
 
527
  FORCE=$enableval,
 
528
  ENABLE=$default
 
529
)
 
530
# Test to change for static plugin, dynamic option
 
531
#default_dyn=no
 
532
#define([PLUGIN_HELP_DYN],
 
533
#       AC_HELP_STRING([--enable-PLUGIN_NAME-dynamic],
 
534
#                     [PLUGIN_MSG (default: static)])
 
535
#define([PLUGIN_NAME_DYN],[PLUGIN_NAME]-dynamic)
 
536
#AC_ARG_ENABLE(
 
537
# [PLUGIN_NAME_DYN],
 
538
#  PLUGIN_HELP_DYN,
 
539
#  ENABLE=$enableval;
 
540
#  FORCE=$enableval
 
541
#  ENABLE=$default_dyn
 
542
#)
 
543
#eval ENABLE_DYNAMIC_$up=\$ENABLE
 
544
if test "$plugin_present" == "no" -a "$FORCE" == "yes"; \
 
545
then
 
546
AC_MSG_ERROR([PLUGIN_NAME is not available])
 
547
fi
 
548
up=`upper PLUGIN_NAME`
 
549
eval FORCE_$up=\$FORCE
 
550
PLUGINS_FORCE_LIST=${PLUGINS_FORCE_LIST}" "FORCE_$up
 
551
eval ENABLE_$up=\$ENABLE
 
552
 
 
553
echo "PLUGIN_NAME... $ENABLE"
 
554
])
 
555
 
 
556
# syntactic callgraph
 
557
#####################
 
558
 
 
559
check_plugin(syntactic_callgraph, src/syntactic_callgraph,
 
560
             [support for callgraph plugin], yes)
 
561
 
 
562
if test "$ENABLE_SYNTACTIC_CALLGRAPH" == "yes"; then
 
563
  USE_GNOMECANVAS=${USE_GNOMECANVAS}" syntactic_callgraph"
 
564
  USE_LABLGTK=${USE_LABLGTK}" syntactic_callgraph"
 
565
fi
 
566
 
 
567
# constant propagation
 
568
######################
 
569
 
 
570
check_plugin(constant_propagation, src/constant_propagation,
 
571
             [support for constant propagation plugin], yes)
 
572
 
 
573
# cxx
 
574
#####
 
575
 
 
576
check_plugin(cxx,cxx_elsa,[support for cxx plugin],no)
 
577
 
 
578
if test "$ENABLE_CXX" == "yes"; then
 
579
  REQUIRE_ELSA=${REQUIRE_ELSA}" cxx"
 
580
  REQUIRE_CAMLP4O=${REQUIRE_CAMLP4O}" cxx"
 
581
fi
 
582
 
 
583
# from
 
584
######
 
585
 
 
586
check_plugin(from,src/from,[support for from analysis],yes)
 
587
 
 
588
# gui
 
589
#####
 
590
 
 
591
check_plugin(gui,src/gui,[support for gui],yes)
 
592
 
 
593
if test "$ENABLE_GUI" == "yes"; then
 
594
  REQUIRE_LABLGTK=${REQUIRE_LABLGTK}" gui"
 
595
fi
 
596
 
 
597
# impact
 
598
########
 
599
 
 
600
check_plugin(impact,src/impact,[support for impact plugin],yes)
 
601
 
 
602
# inout
 
603
#######
 
604
 
 
605
check_plugin(inout,src/inout,[support for inout analysis],yes)
 
606
 
 
607
# jessie
 
608
########
 
609
 
 
610
check_plugin(jessie,src/jessie,[support for jessie plugin],yes)
 
611
 
 
612
if test "$ENABLE_JESSIE" == "yes"; then
 
613
  REQUIRE_WHYJC=${REQUIRE_WHYJC}" jessie"
 
614
  USE_APRON=${USE_APRON}" jessie"
 
615
fi
 
616
 
 
617
# journal_loader
 
618
#################
 
619
 
 
620
check_plugin(journal_loader,src/journal_loader,[support journal loading],yes)
 
621
 
 
622
# metrics
 
623
#########
 
624
 
 
625
check_plugin(metrics,src/metrics,[support for metrics analysis],yes)
 
626
 
 
627
# miel
 
628
######
 
629
 
 
630
check_plugin(miel,src/miel,[support for miel plugin],no)
 
631
 
 
632
if test "$ENABLE_MIEL" == "yes"; then
 
633
  REQUIRE_LABLGTK=${REQUIRE_LABLGTK}" miel"
 
634
  REQUIRE_LABLGLADECC=${REQUIRE_LABLGLADECC}" miel"
 
635
fi
 
636
 
 
637
# occurrence
 
638
############
 
639
 
 
640
check_plugin(occurrence,src/occurrence,[support for occurrence analysis],yes)
 
641
 
 
642
# occurrence_dyn
 
643
#################
 
644
 
 
645
dnl check_plugin(occurrence_dyn,src/occurrence_dyn,
 
646
dnl     [support for occurrence analysis (full dynamic)],yes)
 
647
 
 
648
# pdg
 
649
#####
 
650
 
 
651
check_plugin(pdg,src/pdg,[support for pdg plugin],yes)
 
652
 
 
653
# postdominators
 
654
################
 
655
 
 
656
check_plugin(postdominators,src/postdominators,
 
657
             [support for postdominators plugin],yes)
 
658
 
 
659
# scope
 
660
############
 
661
 
 
662
check_plugin(scope,src/scope,[support for scope plugin],yes)
 
663
 
 
664
# security
 
665
##########
 
666
 
 
667
check_plugin(security,src/security,[support for security plugin],yes)
 
668
 
 
669
# semantic callgraph
 
670
####################
 
671
 
 
672
check_plugin(semantic_callgraph,src/semantic_callgraph,
 
673
             [support for semantic_callgraph],yes)
 
674
 
 
675
# slicing
 
676
#########
 
677
 
 
678
check_plugin(slicing,src/slicing,[support for slicing plugin],yes)
 
679
 
 
680
# spare code
 
681
############
 
682
 
 
683
check_plugin(sparecode,src/sparecode,[support for sparecode plugin],yes)
 
684
 
 
685
# users
 
686
#######
 
687
 
 
688
check_plugin(users,src/users,[support for users analysis],yes)
 
689
 
 
690
# value
 
691
#######
 
692
 
 
693
check_plugin(value,src/value,[support for value analysis],yes)
 
694
 
 
695
# wp
 
696
####
 
697
 
 
698
check_plugin(wp,src/wp,[support for wp plugin],yes)
 
699
 
 
700
 
 
701
# Aorai : ltl_to_acsl
 
702
#####################
 
703
 
 
704
check_plugin(ltl_to_acsl,src/ltl_to_acsl,[support for Aorai plugin (ltl to acsl conversion)],yes)
 
705
#if test "$ENABLE_LTL_TO_ACSL" == "yes"; then
 
706
#   REQUIRE_LTLTOBA=${REQUIRE_LTLTOBA}" ltl_to_acsl"
 
707
#fi
 
708
 
 
709
 
 
710
 
 
711
#####################################################
 
712
# Check for tools/libraries requirements of plugins #
 
713
#####################################################
 
714
 
 
715
new_section "configure tools and libraries used by some plugins"
 
716
 
 
717
# 1st param: uppercase name of the library
 
718
# 2nd param: file which must exist. This parameter can be a list of files.
 
719
# In this case, they will be tried in turn until one of them exists. The
 
720
# name of the file found will be put in the variable SELECTED_$1
 
721
# 3d  param: warning to display if problem
 
722
define([configure_library],
 
723
[
 
724
  m4_define([VAR],[$1])
 
725
  m4_define([SELECTED_VAR],[SELECTED_$1])
 
726
  m4_define([PROG],[$2])
 
727
  m4_define([require],[$REQUIRE_$1])
 
728
  m4_define([use],[$USE_$1])
 
729
  m4_define([msg],[$3])
 
730
  m4_define([has],[HAS_$1])
 
731
  m4_define([file],[FILE_$1])
 
732
  if test -n "require" -o -n "use"; then
 
733
    has=no
 
734
    m4_foreach(file,[PROG],
 
735
       [if test "$has" != "yes"; then
 
736
          AC_CHECK_FILE(file,has=yes,has=no)
 
737
          if test "$has" == "yes"; then SELECTED_VAR=file
 
738
          fi
 
739
       fi]
 
740
       )
 
741
    if test "$has" == "no"; then
 
742
      AC_MSG_WARN(msg)
 
743
      if test "require" != ""; then
 
744
        echo "plugins disabled:
 
745
 require"
 
746
        for p in require; do
 
747
          fp=FORCE_`upper "$p"`
 
748
          if eval test "\$$fp" == "yes"; then
 
749
            AC_MSG_ERROR($p requested but PROG missing.)
 
750
          fi
 
751
          ep=ENABLE_`upper "$p"`
 
752
          eval $ep="no\ \(see\ warning\ about\ PROG\)"
 
753
        done
 
754
      fi
 
755
      if test "use" != ""; then
 
756
        echo "plugins not fully functional:
 
757
 use"
 
758
        for p in use; do
 
759
          ep=ENABLE_`upper "$p"`
 
760
          eval eep="\$$ep"
 
761
          if test "`echo $eep | sed -e 's/ .*//' `" != "no"; then
 
762
            eval $ep="partial\ \(see\ warning\ about\ PROG\)"
 
763
          fi
 
764
        done
 
765
      fi
 
766
      echo
 
767
    fi
 
768
  fi
 
769
  undefine([SELECTED_VAR])
 
770
  undefine([VAR])
 
771
  undefine([PROG])
 
772
  undefine([require])
 
773
  undefine([use])
 
774
  undefine([msg])
 
775
  undefine([has])
 
776
])
 
777
 
 
778
# 1st param: uppercase name of the program
 
779
# 2nd param: program which must exist. See comment on configure_library()
 
780
# on how to deal with multiple choices for a given program.
 
781
# 3d  param: warning to display if problem
 
782
define([configure_tool],
 
783
[
 
784
  define([VAR],[$1])
 
785
  define([PROG],[$2])
 
786
  define([require],[$REQUIRE_$1])
 
787
  define([use],[$USE_$1])
 
788
  define([msg],[$3])
 
789
  define([has],[HAS_$1])
 
790
 
 
791
  if test -n "require" -o -n "use"; then
 
792
    for file in PROG; do
 
793
     has=
 
794
    AC_CHECK_PROG(has,$file,yes,no)
 
795
      if test "$has" == "yes"; then SELECTED_VAR=$file break; fi
 
796
      done
 
797
    if test "$has" == "no"; then
 
798
      AC_MSG_WARN([msg])
 
799
      if test "require" != ""; then
 
800
        echo "plugins disabled:
 
801
 require"
 
802
        for p in require; do
 
803
          fp=FORCE_`upper "$p"`
 
804
          if eval test "\$$fp" == "yes"; then
 
805
            AC_MSG_ERROR([$p requested but PROG missing.])
 
806
          fi
 
807
          ep=ENABLE_`upper "$p"`
 
808
          eval $ep="no\ \(see\ warning\ about\ PROG\)"
 
809
        done
 
810
      fi
 
811
      if test "use" != ""; then
 
812
        echo "plugins not fully functional:
 
813
 use"
 
814
        for p in use; do
 
815
          ep=ENABLE_`upper "$p"`
 
816
          eval eep="\$$ep"
 
817
          if test "`echo $eep | sed -e 's/ .*//' `" != "no"; then
 
818
            eval $ep="partial\ \(see\ warning\ about\ PROG\)"
 
819
          fi
 
820
        done
 
821
      fi
 
822
      echo
 
823
    else
 
824
        VAR=PROG
 
825
    fi
 
826
  fi
 
827
  undefine([VAR])
 
828
  undefine([PROG])
 
829
  undefine([require])
 
830
  undefine([use])
 
831
  undefine([msg])
 
832
  undefine([has])
 
833
])
 
834
 
 
835
# elsa
 
836
######
 
837
configure_library([ELSA],[cxx_elsa],[
 
838
  sources of cxx_elsa are not present in this directory.
 
839
  Please check them out from the cvs repository.])
 
840
 
 
841
REQUIRE_CCPARSE=
 
842
USE_CCPARSE=
 
843
HAS_CCPARSE=
 
844
if test "$has" == "yes"; then
 
845
  USE_CCPARSE="$REQUIRE_ELSA$USE_ELSA"
 
846
fi
 
847
 
 
848
configure_library([CCPARSE],
 
849
  [cxx_elsa/elsa-2006.06.11/elsa/ccparse],
 
850
  [elsa seems to be uncompiled. Please run 'make elsa'.])
 
851
 
 
852
# lablglade
 
853
###########
 
854
configure_tool([LABLGLADECC],[lablgladecc2],[lablgladecc2 not found.])
 
855
 
 
856
# camlp4o
 
857
###########
 
858
configure_tool([CAMLP4O],[camlp4o],[camlp4o not found.])
 
859
 
 
860
# ltl2ba library
 
861
################
 
862
configure_tool([LTLTOBA],[ltl2ba],[ltl2ba not found.])
 
863
 
 
864
# lablgtk2
 
865
##########
 
866
configure_library([LABLGTK],[$OCAMLLIB/lablgtk2/lablgtk.$LIB_SUFFIX],
 
867
                  [lablgtk2/lablgtk.$LIB_SUFFIX not found.])
 
868
 
 
869
HAS_LABLGTK_CUSTOM_MODEL=no
 
870
AC_ARG_ENABLE(custommodel,
 
871
[  --enable-custommodel
 
872
     use a custom tree model in GUI. Need to have a recent lablgtk version],
 
873
HAS_LABLGTK_CUSTOM_MODEL=yes,HAS_LABLGTK_CUSTOM_MODEL=no)
 
874
 
 
875
# Gtksourceview
 
876
###############
 
877
REQUIRE_GTKSOURCEVIEW=
 
878
USE_GTKSOURCEVIEW=
 
879
HAS_GTKSOURCEVIEW=
 
880
FORCE_GTKSOURCEVIEW="yes"
 
881
 
 
882
if test "$FORCE_GTKSOURCEVIEW" == "yes"; then
 
883
  REQUIRE_GTKSOURCEVIEW="$REQUIRE_LABLGTK"
 
884
  USE_GTKSOURCEVIEW="$USE_LABLGTK"
 
885
else
 
886
  if test "$has" == "yes"; then
 
887
    USE_GTKSOURCEVIEW="$REQUIRE_LABLGTK$USE_LABLGTK"
 
888
  fi
 
889
fi
 
890
 
 
891
configure_library([GTKSOURCEVIEW],
 
892
                  [$OCAMLLIB/lablgtk2/lablgtksourceview.$LIB_SUFFIX,$OCAMLLIB/lablgtksourceview/lablgtksourceview.$LIB_SUFFIX],
 
893
                  [lablgtksourceview.$LIB_SUFFIX not found])
 
894
 
 
895
case $SELECTED_GTKSOURCEVIEW in
 
896
$OCAMLLIB/lablgtksourceview/lablgtksourceview.$LIB_SUFFIX)
 
897
  HAS_LEGACY_GTKSOURCEVIEW=yes
 
898
  ;;
 
899
esac
 
900
 
 
901
# Gnomecanvas
 
902
#############
 
903
configure_library([GNOMECANVAS],[$OCAMLLIB/lablgtk2/lablgnomecanvas.$LIB_SUFFIX],
 
904
                  [lablgnomecanvas.$LIB_SUFFIX not found])
 
905
 
 
906
# why/jc library
 
907
################
 
908
 
 
909
define([WHY_DEFAULT],why)
 
910
AC_ARG_WITH(
 
911
  whydir,
 
912
  [  --with-whydir=<path>       directory for Why sources (default: WHY_DEFAULT) ],
 
913
  WHYDISTRIB=$with_whydir,
 
914
  WHYDISTRIB=WHY_DEFAULT
 
915
)
 
916
 
 
917
configure_library([WHYJC],
 
918
                  [$WHYDISTRIB/jc,$OCAMLLIB/jessie/jc.$OBJ_SUFFIX],
 
919
                  [why not found])
 
920
 
 
921
configure_library([APRON],
 
922
                  [/usr/local/lib/apron.a,/usr/lib/apron.a],
 
923
                  [apron not found])
 
924
 
 
925
if test "$HAS_WHYJC" == "yes" -a "$REQUIRE_WHYJC" != ""; then
 
926
  case $SELECTED_WHYJC in
 
927
  $WHYDISTRIB/jc)
 
928
    JCCMO=$WHYDISTRIB/jc/jc.cmo
 
929
    JCCMX=$WHYDISTRIB/jc/jc.cmx
 
930
    JESSIE_LOCAL=yes
 
931
    JESSIE_INCLUDES="-I $WHYDISTRIB/src -I $WHYDISTRIB/jc"
 
932
    (cd $WHYDISTRIB && ./configure --prefix=$prefix --datarootdir=$datarootdir \
 
933
      --exec_prefix=$exec_prefix --bindir=$bindir --libdir=$datadir/frama-c \
 
934
      --mandir=$mandir --enable-apron=$HAS_APRON) || ENABLE_JESSIE=no
 
935
    if test "$ENABLE_JESSIE" == "no"; then
 
936
       INFO_JESSIE=" (configuration of Why failed)"
 
937
    fi
 
938
    ;;
 
939
  $OCAMLLIB/jessie)
 
940
    JCCMO=$SELECTED_WHYJC/jc.cmo
 
941
    JCCMX=$SELECTED_WHYJC/jc.cmx
 
942
    JESSIE_LOCAL=no
 
943
    JESSIE_INCLUDES="-I $SELECTED_WHYJC"
 
944
    ;;
 
945
  *)
 
946
    AC_MSG_WARN([Unexpected location for why tool: $SELECTED_WHYJC])
 
947
    JESSIE_LOCAL=no
 
948
    ;;
 
949
  esac
 
950
else
 
951
  JESSIE_LOCAL=no
 
952
fi
 
953
 
 
954
#######################
 
955
# Plugin dependencies #
 
956
#######################
 
957
 
 
958
new_section "checking for plugin dependencies"
 
959
 
 
960
# What are the dependencies?
 
961
############################
 
962
# Each plugin has to update these lists
 
963
 
 
964
REQUIRE_FROM="value inout pdg slicing"
 
965
 
 
966
#USE_GUI="occurrence security slicing value impact"
 
967
 
 
968
REQUIRE_PDG="slicing security"
 
969
 
 
970
REQUIRE_SECURITY="impact"
 
971
 
 
972
USE_SLICING="security miel"
 
973
 
 
974
REQUIRE_VALUE="constant_propagation from inout occurrence pdg scope security \
 
975
  slicing sparecode users semantic_callgraph miel"
 
976
 
 
977
### Now compute the dependencies
 
978
# a bit ugly... Probably optimizable
 
979
 
 
980
# First, initialize some variables
 
981
for fp in ${PLUGINS_FORCE_LIST}; do
 
982
  if test "$fp" != "FORCE_GTKSOURCEVIEW"; then
 
983
    plugin=`echo $fp | sed -e "s/FORCE_\(.*\)/\1/" `
 
984
    TODOLIST=$TODOLIST" "$plugin
 
985
    eval MARK_$plugin=
 
986
    eval REMEMBER_$plugin=
 
987
  fi
 
988
done
 
989
 
 
990
# Implementation of an ordering $1 < $2: "" < yes < partial < no
 
991
lt_mark () {
 
992
  first=`echo "$1" | sed -e 's/ .*//' `
 
993
  second=`echo "$2" | sed -e 's/ .*//' `
 
994
  case $first in
 
995
    "") echo "true";;
 
996
    "yes"*)
 
997
      case $second in
 
998
        "yes") echo "";;
 
999
        "partial" | "no") echo "true";;
 
1000
      esac;;
 
1001
    "partial"*)
 
1002
      case $second in
 
1003
        "yes" | "partial") echo "";;
 
1004
        "no") echo "true";;
 
1005
      esac;;
 
1006
    "no"*) echo "";;
 
1007
  esac
 
1008
}
 
1009
 
 
1010
# Check and propagate marks to requires and users.
 
1011
# $1: parent plugin
 
1012
# $2: mark to propagate to requires
 
1013
# $3: mark to propagate to users
 
1014
check_and_propagate () {
 
1015
  # for each requiers
 
1016
  r=REQUIRE_$1
 
1017
  eval require="\$$r"
 
1018
  for p in $require; do
 
1019
    up=`upper "$p"`
 
1020
    m=MARK_"$up"
 
1021
    eval mark="\$$m"
 
1022
    if test `lt_mark "$mark" "$2" `; then
 
1023
      # update marks
 
1024
      eval MARK_$up=\"$2\";
 
1025
      TODOLIST=$TODOLIST" "$p
 
1026
      # display a warning or an error if required
 
1027
      short_mark=`echo $2 | sed -e 's/ .*//'`
 
1028
      lp=`lower $p`
 
1029
      reason=`echo $2 | sed -e 's/no (\(.*\))/\1/' `
 
1030
      if test "$short_mark" == "no"; then
 
1031
        fp=FORCE_"$up"
 
1032
        if eval test "\$$fp" == "yes"; then
 
1033
          AC_MSG_ERROR([$lp requested but $reason.])
 
1034
        else
 
1035
          AC_MSG_WARN([$lp disable because $reason.])
 
1036
        fi
 
1037
      else
 
1038
        if test "$short_mark" == "partial"; then
 
1039
          reason=`echo $2 | sed -e 's/partial (\(.*\))/\1/' `
 
1040
          AC_MSG_WARN([$lp only partially enable because $reason.])
 
1041
        fi
 
1042
      fi
 
1043
    fi
 
1044
  done
 
1045
  # for each users
 
1046
  u=USE_$1
 
1047
  eval use="\$$u"
 
1048
  for p in $use; do
 
1049
    up=`upper "$p"`
 
1050
    m=MARK_$up
 
1051
    eval mark="\$$m"
 
1052
    if test `lt_mark "$mark" "$3" `; then
 
1053
      # update marks
 
1054
      eval MARK_$up=\"$3\";
 
1055
      TODOLIST=$TODOLIST" "$p
 
1056
      # display a warning if required
 
1057
      lp=`lower $p`
 
1058
      reason=`echo $3 | sed -e 's/partial (\(.*\))/\1/' `
 
1059
      if test "$reason" != "$3"; then
 
1060
        AC_MSG_WARN([$lp only partially enable because $reason.])
 
1061
      fi
 
1062
    fi
 
1063
  done
 
1064
}
 
1065
 
 
1066
# Recursively check the plugin dependencies using the plugin dependency graph
 
1067
compute_dependency () {
 
1068
  plugin=`echo $TODOLIST | sed -e 's/ .*//' `
 
1069
  TODOLIST=`echo $TODOLIST | sed -e 's/[[^ ]]* *\(.*\)/\1/' `
 
1070
 
 
1071
  lplugin=`lower "$plugin"`
 
1072
  uplugin=`upper "$plugin"`
 
1073
  # new mark to consider
 
1074
  m=MARK_$uplugin
 
1075
  eval mark="\$$m"
 
1076
  # old mark to consider
 
1077
  r=REMEMBER_$uplugin
 
1078
  eval remember="\$$r"
 
1079
  # the exact mark (final result),
 
1080
  # also the old mark if plugin already visited
 
1081
  e=ENABLE_$uplugin
 
1082
  eval enable="\$$e"
 
1083
 
 
1084
#  echo "plugin $lplugin (mark=$mark, remember=$remember, enable=$enable)"
 
1085
  if test `lt_mark "$remember" "$mark"`; then
 
1086
    # visit the current plugin:
 
1087
    # mark <- max(mark, enable)
 
1088
    case `echo "$mark" | sed -e 's/ .*//' ` in
 
1089
      "" | "yes")
 
1090
       if test -n "$enable"; then mark="$enable"; else mark="yes"; fi;;
 
1091
      "partial") if test "$enable" == "no"; then mark="no"; fi;;
 
1092
      "no")      ;;
 
1093
    esac
 
1094
    # update plugin attributes with the new mark
 
1095
#    echo "update attributes with $mark"
 
1096
    eval $m=\"$mark\"
 
1097
    eval $e=\"$mark\"
 
1098
    enable="$mark"
 
1099
    eval $r=\"$mark\"
 
1100
    # compute and propagate a new mark to requieres and users
 
1101
    case `echo "$enable" | sed -e 's/ .*//' ` in
 
1102
      "")        echo "problem?"; exit 3;;
 
1103
      "yes")     check_and_propagate $uplugin "yes" "yes";;
 
1104
      "partial")
 
1105
        check_and_propagate \
 
1106
          "$uplugin" \
 
1107
          "partial ($lplugin partially enable)" \
 
1108
          "yes";;
 
1109
      "no")
 
1110
        check_and_propagate \
 
1111
          "$uplugin" \
 
1112
          "no ($lplugin not enable)" \
 
1113
          "partial ($lplugin not enable)";;
 
1114
    esac
 
1115
  fi
 
1116
 
 
1117
  # recursively consider the next plugins
 
1118
  if test -n "$TODOLIST"; then
 
1119
    compute_dependency;
 
1120
  fi
 
1121
}
 
1122
 
 
1123
# main call
 
1124
compute_dependency
 
1125
 
 
1126
# Compute INFO_* and exported ENABLE_* from previously computed ENABLE_*
 
1127
for fp in ${PLUGINS_FORCE_LIST}; do
 
1128
  if test "$fp" != "FORCE_GTKSOURCEVIEW"; then
 
1129
    plugin=`echo $fp | sed -e "s/FORCE_\(.*\)/\1/" `
 
1130
    ep=ENABLE_$plugin
 
1131
    eval v=\$$ep
 
1132
    eval ep_v=`echo $v | sed -e 's/ .*//' `
 
1133
    eval ENABLE_$plugin=$ep_v
 
1134
    reason=`echo $v | sed -e 's/[[a-z]]*\( .*\)/\1/' `
 
1135
    if test "$reason" != "$ep_v"; then
 
1136
      eval INFO_$plugin="\$reason"
 
1137
    fi
 
1138
  fi
 
1139
done
 
1140
 
 
1141
############################
 
1142
# Substitutions to perform #
 
1143
############################
 
1144
 
 
1145
AC_SUBST(VERBOSEMAKE)
 
1146
AC_SUBST(DOT)
 
1147
AC_SUBST(OCAMLGRAPH)
 
1148
AC_SUBST(OCAMLGRAPH_LOCAL)
 
1149
AC_SUBST(OCAMLBEST)
 
1150
AC_SUBST(OCAMLVERSION)
 
1151
AC_SUBST(LOWER_THAN_311)
 
1152
AC_SUBST(OCAMLLIB)
 
1153
AC_SUBST(OCAMLWIN32)
 
1154
AC_SUBST(CAMLP4O)
 
1155
AC_SUBST(EXE)
 
1156
 
 
1157
AC_SUBST(HAVE_STDLIB_H)
 
1158
AC_SUBST(HAVE_WCHAR_H)
 
1159
AC_SUBST(HAVE_PTRDIFF_H)
 
1160
AC_SUBST(HAVE_BUILTIN_VA_LIST)
 
1161
AC_SUBST(THREAD_IS_KEYWORD)
 
1162
AC_SUBST(UNDERSCORE_NAME)
 
1163
AC_SUBST(HAS_PERFCOUNT)
 
1164
AC_SUBST(CYCLES_PER_USEC)
 
1165
AC_SUBST(LOCAL_MACHDEP)
 
1166
AC_SUBST(datarootdir)
 
1167
 
 
1168
AC_SUBST(HAS_LABLGTK)
 
1169
AC_SUBST(HAS_GTKSOURCEVIEW)
 
1170
AC_SUBST(HAS_LEGACY_GTKSOURCEVIEW)
 
1171
AC_SUBST(HAS_GNOMECANVAS)
 
1172
AC_SUBST(HAS_LABLGTK_CUSTOM_MODEL)
 
1173
AC_SUBST(LABLGLADECC)
 
1174
AC_SUBST(HAS_LABLGLADECC)
 
1175
AC_SUBST(HAS_LTLTOBA)
 
1176
AC_SUBST(JCCMO)
 
1177
AC_SUBST(JCCMX)
 
1178
AC_SUBST(JESSIE_LOCAL)
 
1179
AC_SUBST(JESSIE_INCLUDES)
 
1180
 
 
1181
AC_SUBST(ENABLE_SYNTACTIC_CALLGRAPH)
 
1182
AC_SUBST(ENABLE_CONSTANT_PROPAGATION)
 
1183
AC_SUBST(ENABLE_CXX)
 
1184
AC_SUBST(ENABLE_FROM)
 
1185
AC_SUBST(ENABLE_GUI)
 
1186
AC_SUBST(ENABLE_IMPACT)
 
1187
AC_SUBST(ENABLE_INOUT)
 
1188
AC_SUBST(ENABLE_JESSIE)
 
1189
AC_SUBST(ENABLE_JOURNAL_LOADER)
 
1190
AC_SUBST(WHYDISTRIB)
 
1191
AC_SUBST(ENABLE_METRICS)
 
1192
AC_SUBST(ENABLE_MIEL)
 
1193
AC_SUBST(ENABLE_OCCURRENCE)
 
1194
dnl AC_SUBST(ENABLE_OCCURRENCE_DYN)
 
1195
AC_SUBST(ENABLE_PDG)
 
1196
AC_SUBST(ENABLE_POSTDOMINATORS)
 
1197
AC_SUBST(ENABLE_SCOPE)
 
1198
AC_SUBST(ENABLE_SECURITY)
 
1199
AC_SUBST(ENABLE_SEMANTIC_CALLGRAPH)
 
1200
AC_SUBST(ENABLE_SLICING)
 
1201
AC_SUBST(ENABLE_SPARECODE)
 
1202
AC_SUBST(ENABLE_USERS)
 
1203
AC_SUBST(ENABLE_VALUE)
 
1204
AC_SUBST(ENABLE_WP)
 
1205
AC_SUBST(ENABLE_LTL_TO_ACSL)
 
1206
 
 
1207
################################################
 
1208
# Finally create the Makefile from Makefile.in #
 
1209
################################################
 
1210
 
 
1211
new_section "creating makefile"
 
1212
 
 
1213
AC_OUTPUT(cil/ocamlutil/perfcount.c Makefile)
 
1214
chmod a-w cil/ocamlutil/perfcount.c
 
1215
chmod a-w Makefile
 
1216
 
 
1217
###########
 
1218
# Summary #
 
1219
###########
 
1220
 
 
1221
new_section "summary: plugins available"
 
1222
 
 
1223
if test "$LOWER_THAN_311" == yes ; then
 
1224
  AC_MSG_WARN(Dynamic plugins in native mode are disabled.)
 
1225
fi
 
1226
 
 
1227
AC_MSG_NOTICE([syntactic callgraph  : $ENABLE_SYNTACTIC_CALLGRAPH$INFO_SYNTACTIC_CALLGRAPH])
 
1228
AC_MSG_NOTICE([constant propagation : $ENABLE_CONSTANT_PROPAGATION$INFO_CONSTANT_PROPAGATION])
 
1229
AC_MSG_NOTICE([cxx                  : $ENABLE_CXX$INFO_CXX])
 
1230
AC_MSG_NOTICE([from                 : $ENABLE_FROM$INFO_FROM])
 
1231
AC_MSG_NOTICE([gui                  : $ENABLE_GUI$INFO_GUI])
 
1232
AC_MSG_NOTICE([impact               : $ENABLE_IMPACT$INFO_IMPACT])
 
1233
AC_MSG_NOTICE([inout                : $ENABLE_INOUT$INFO_INOUT])
 
1234
AC_MSG_NOTICE([jessie               : $ENABLE_JESSIE$INFO_JESSIE])
 
1235
AC_MSG_NOTICE([journal loader       : $ENABLE_JOURNAL_LOADER$INFO_JOURNAL_LOADER])
 
1236
AC_MSG_NOTICE([metrics              : $ENABLE_METRICS$INFO_METRICS])
 
1237
AC_MSG_NOTICE([miel                 : $ENABLE_MIEL$INFO_MIEL])
 
1238
AC_MSG_NOTICE([occurrence           : $ENABLE_OCCURRENCE$INFO_OCCURRENCE])
 
1239
dnl AC_MSG_NOTICE([occurrence dynamic   : $ENABLE_OCCURRENCE_DYN$INFO_OCCURRENCE_DYN])
 
1240
AC_MSG_NOTICE([pdg                  : $ENABLE_PDG$INFO_PDG])
 
1241
AC_MSG_NOTICE([postdominators       : $ENABLE_POSTDOMINATORS$INFO_POSTDOMINATORS])
 
1242
AC_MSG_NOTICE([scope                : $ENABLE_SCOPE$INFO_SCOPE])
 
1243
AC_MSG_NOTICE([security             : $ENABLE_SECURITY$INFO_SECURITY])
 
1244
AC_MSG_NOTICE([semantic callgraph   : $ENABLE_SEMANTIC_CALLGRAPH$INFO_SEMANTIC_CALLGRAPH])
 
1245
AC_MSG_NOTICE([slicing              : $ENABLE_SLICING$INFO_SLICING])
 
1246
AC_MSG_NOTICE([spare code           : $ENABLE_SPARECODE$INFO_SPARECODE])
 
1247
AC_MSG_NOTICE([users                : $ENABLE_USERS$INFO_USERS])
 
1248
AC_MSG_NOTICE([value                : $ENABLE_VALUE$INFO_VALUE])
 
1249
AC_MSG_NOTICE([wp                   : $ENABLE_WP$INFO_WP])
 
1250
AC_MSG_NOTICE([ltl to acsl          : $ENABLE_LTL_TO_ACSL$INFO_LTL_TO_ACSL])