configure.in 28 KB
Newer Older
1 2 3
####################################################################
#                                                                  #
#  The Why3 Verification Platform   /   The Why3 Development Team  #
Guillaume Melquiond's avatar
Guillaume Melquiond committed
4
#  Copyright 2010-2018   --   Inria - CNRS - Paris-Sud University  #
5 6 7 8
#                                                                  #
#  This software is distributed under the terms of the GNU Lesser  #
#  General Public License version 2.1, with the special exception  #
#  on linking described in file LICENSE.                           #
9
#                                                                  #
10
####################################################################
11 12 13

#
# autoconf input for Objective Caml programs
Andrei Paskevich's avatar
Andrei Paskevich committed
14
# Copyright (C) 2001 Jean-Christophe Filliâtre
15 16
#   from a first script by Georges Mariano
#
17 18 19
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License version 2, as published by the Free Software Foundation.
20
#
21 22 23
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24
#
25 26 27
# See the GNU Library General Public License version 2 for more details
# (enclosed in the file LGPL).

28
AC_INIT([Why3], m4_esyscmd([. ./Version; printf "$VERSION"]))
29

30
# verbosemake
31

Andrei Paskevich's avatar
Andrei Paskevich committed
32
AC_ARG_ENABLE(verbose-make,
33
    AS_HELP_STRING([--enable-verbose-make], [verbose makefile recipes]),,
Andrei Paskevich's avatar
Andrei Paskevich committed
34 35
    enable_verbose_make=no)

36 37 38
# LOCAL_CONF

AC_ARG_ENABLE(local,
39
    AS_HELP_STRING([--enable-local], [use Why3 in the build directory (no installation)]),,
40
    enable_local=no)
41

42 43 44
# RELOCATABLE INSTALLATION

AC_ARG_ENABLE(relocation,
45
    AS_HELP_STRING([--enable-relocation], [allow for later relocation of Why3 installation]),,
46 47
    enable_relocation=no)

48 49 50
# NATIVE

AC_ARG_ENABLE(native-code,
51
    AS_HELP_STRING([--disable-native-code], [use only the byte-code compiler]),,
52 53
    enable_native_code=yes)

54 55 56 57 58 59
# WHY3LIB

AC_ARG_ENABLE(why3-lib,
    AS_HELP_STRING([--disable-why3-lib], [use an already installed Why3]),,
    enable_why3_lib=yes)

60 61 62
# Zarith

AC_ARG_ENABLE(zarith,
63
    AS_HELP_STRING([--disable-zarith], [use Nums instead of Zarith for computations]),,
64
    enable_zarith=yes)
65 66


67
# camlzip
68 69

AC_ARG_ENABLE(zip,
70
    AS_HELP_STRING([--disable-zip], [do not use LZ compression to store session files]),,
71 72
    enable_zip=yes)

73 74 75 76 77 78
# js_of_ocaml

AC_ARG_ENABLE(js_of_ocaml,
    AS_HELP_STRING([--disable-js-of-ocaml], [do not use js-of-ocaml]),,
    enable_js_of_ocaml=yes)

79
# IDE
Andrei Paskevich's avatar
Andrei Paskevich committed
80 81

AC_ARG_ENABLE(ide,
82
    AS_HELP_STRING([--disable-ide], [do not build Why3 IDE]),,
Andrei Paskevich's avatar
Andrei Paskevich committed
83 84
    enable_ide=yes)

85 86 87 88
AC_ARG_ENABLE(web_ide,
    AS_HELP_STRING([--disable-web-ide], [do not build Why3 Web IDE]),,
    enable_web_ide=yes)

Guillaume Melquiond's avatar
Guillaume Melquiond committed
89
# Coq libraries
90 91

AC_ARG_ENABLE(coq-libs,
92
    AS_HELP_STRING([--disable-coq-libs], [do not build Coq realizations]),,
93
    enable_coq_libs=yes)
94

Jean-Christophe's avatar
Jean-Christophe committed
95 96 97
# PVS libraries

AC_ARG_ENABLE(pvs-libs,
98
    AS_HELP_STRING([--disable-pvs-libs], [do not build PVS realizations]),,
Jean-Christophe's avatar
Jean-Christophe committed
99 100
    enable_pvs_libs=yes)

101 102 103
# Isabelle libraries

AC_ARG_ENABLE(isabelle-libs,
104
    AS_HELP_STRING([--disable-isabelle-libs], [do not build Isabelle realizations]),,
105 106
    enable_isabelle_libs=yes)

107 108 109
# hypothesis selection

AC_ARG_ENABLE(hypothesis-selection,
110
    AS_HELP_STRING([--disable-hypothesis-selection], [do not support hypothesis selection]),,
111 112
    enable_hypothesis_selection=yes)

113 114 115
# documentation

AC_ARG_ENABLE(doc,
116
    AS_HELP_STRING([--disable-doc], [do not build documentation]),,
117 118
    enable_doc=yes)

119
AC_ARG_ENABLE(html-doc,
120
    AS_HELP_STRING([--disable-html-doc], [do not build HTML documentation]),,
121 122
    enable_html_doc=yes)

123
# Experimental Jessie3 Frama-C plugin, disabled by default
124 125

AC_ARG_ENABLE(frama-c,
126
    AS_HELP_STRING([--enable-frama-c], [enable Frama-C plugin]),,
127 128
    [enable_frama_c=no
     reason_frama_c=" (disabled by default)"])
129

130
# profiling
131

132
AC_ARG_ENABLE(profiling,
133
    AS_HELP_STRING([--enable-profiling], [enable profiling]),,
134
    enable_profiling=no)
135

136 137 138 139 140 141
# Emacs compilation

AC_ARG_ENABLE(emacs-compilation,
    AS_HELP_STRING([--disable-emacs-compilation], [do not compile why3.elc]),,
    enable_emacs_compilation=yes)

142 143 144 145 146 147 148
# either relocation or local, not both
if test "$enable_relocation" = yes ; then
if test "$enable_local" = yes ; then
    AC_MSG_ERROR(cannot use --enable-relocation and --enable-local at the same time.)
fi
fi

149 150 151 152 153 154
# Check for arch/OS

AC_MSG_CHECKING(executable suffix)
if uname -s | grep -q CYGWIN ; then
  EXE=.exe
  STRIP='echo "no strip "'
155 156 157 158 159 160
  AC_MSG_RESULT(.exe <Cygwin>)
else
if uname -s | grep -q MINGW ; then
  EXE=.exe
  STRIP=strip
  AC_MSG_RESULT(.exe <MinGW>)
161 162 163 164 165
else
  EXE=
  STRIP=strip
  AC_MSG_RESULT(<none>)
fi
166 167
fi

168
AC_PROG_CC
169 170
# Add compatibility for C99
AC_PROG_CC_STDC
171 172
AC_PROG_MKDIR_P
AC_PROG_INSTALL
173

174 175
AC_DEFUN([AX_VERSION_GE], [AS_VERSION_COMPARE([$1],[$2],[$4],[$3],[$3])])

176 177 178 179 180 181 182 183
# Check for Ocaml compilers

# we first look for ocamlc in the path; if not present, we fail
AC_CHECK_PROG(OCAMLC,ocamlc,ocamlc,no)
if test "$OCAMLC" = no ; then
	AC_MSG_ERROR(Cannot find ocamlc.)
fi

184
# we extract Ocaml version number
185
OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version *\(.*\)$|\1|p'`
186 187
echo "ocaml version is $OCAMLVERSION"

188 189
AX_VERSION_GE([$OCAMLVERSION], 4.02.3, [],
  [AC_MSG_ERROR(You need Objective Caml 4.02.3 or higher.)])
190

191 192 193 194 195 196 197 198 199 200 201 202 203 204
# Ocaml library path
# old way: OCAMLLIB=`$OCAMLC -v | tail -1 | cut -f 4 -d ' ' | tr -d '\\r'`
OCAMLLIB=`$OCAMLC -where | tr -d '\\r'`
echo "ocaml library path is $OCAMLLIB"

# then we look for ocamlopt; if not present, we issue a warning
# if the version is not the same, we also discard it
# we set OCAMLBEST to "opt" or "byte", whether ocamlopt is available or not
AC_CHECK_PROG(OCAMLOPT,ocamlopt,ocamlopt,no)
OCAMLBEST=byte
if test "$OCAMLOPT" = no ; then
	AC_MSG_WARN(Cannot find ocamlopt; bytecode compilation only.)
else
	AC_MSG_CHECKING(ocamlopt version)
205
	TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p'`
206 207 208 209 210 211 212 213 214
	if test "$TMPVERSION" != "$OCAMLVERSION" ; then
	    AC_MSG_RESULT(differs from ocamlc; ocamlopt discarded.)
	    OCAMLOPT=no
	else
	    AC_MSG_RESULT(ok)
	    OCAMLBEST=opt
	fi
fi

215 216 217 218 219 220 221
# checking for native-code
if test "$enable_native_code" != yes || test "$OCAMLBEST" = byte ; then
    enable_native_code=no
    OCAMLBEST=byte
    OCAMLOPT=no
fi

222 223 224 225
# checking for ocamlc.opt
AC_CHECK_PROG(OCAMLCDOTOPT,ocamlc.opt,ocamlc.opt,no)
if test "$OCAMLCDOTOPT" != no ; then
	AC_MSG_CHECKING(ocamlc.opt version)
226
	TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p'`
227 228 229 230 231 232 233 234 235 236 237 238 239
	if test "$TMPVERSION" != "$OCAMLVERSION" ; then
	    AC_MSG_RESULT(differs from ocamlc; ocamlc.opt discarded.)
	else
	    AC_MSG_RESULT(ok)
	    OCAMLC=$OCAMLCDOTOPT
	fi
fi

# checking for ocamlopt.opt
if test "$OCAMLOPT" != no ; then
    AC_CHECK_PROG(OCAMLOPTDOTOPT,ocamlopt.opt,ocamlopt.opt,no)
    if test "$OCAMLOPTDOTOPT" != no ; then
	AC_MSG_CHECKING(ocamlc.opt version)
240
	TMPVER=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p'`
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285
	if test "$TMPVER" != "$OCAMLVERSION" ; then
	    AC_MSG_RESULT(differs from ocamlc; ocamlopt.opt discarded.)
	else
	    AC_MSG_RESULT(ok)
	    OCAMLOPT=$OCAMLOPTDOTOPT
	fi
    fi
fi

# ocamldep, ocamllex and ocamlyacc should also be present in the path
AC_CHECK_PROG(OCAMLDEP,ocamldep,ocamldep,no)
if test "$OCAMLDEP" = no ; then
   AC_MSG_ERROR(Cannot find ocamldep.)
else
   AC_CHECK_PROG(OCAMLDEPDOTOPT,ocamldep.opt,ocamldep.opt,no)
   if test "$OCAMLDEPDOTOPT" != no ; then
      OCAMLDEP=$OCAMLDEPDOTOPT
   fi
fi

AC_CHECK_PROG(OCAMLLEX,ocamllex,ocamllex,no)
if test "$OCAMLLEX" = no ; then
	AC_MSG_ERROR(Cannot find ocamllex.)
else
    AC_CHECK_PROG(OCAMLLEXDOTOPT,ocamllex.opt,ocamllex.opt,no)
    if test "$OCAMLLEXDOTOPT" != no ; then
	OCAMLLEX=$OCAMLLEXDOTOPT
    fi
fi

AC_CHECK_PROG(OCAMLYACC,ocamlyacc,ocamlyacc,no)
if test "$OCAMLYACC" = no ; then
	AC_MSG_ERROR(Cannot find ocamlyacc.)
fi

AC_CHECK_PROG(OCAMLDOC,ocamldoc,ocamldoc,true)
if test "$OCAMLDOC" = true ; then
    AC_MSG_WARN(Cannot find ocamldoc)
else
    AC_CHECK_PROG(OCAMLDOCOPT,ocamldoc.opt,ocamldoc.opt,no)
    if test "$OCAMLDOCOPT" != no ; then
	OCAMLDOC=$OCAMLDOCOPT
    fi
fi

286 287 288 289 290
AC_CHECK_PROG(MENHIR,menhir,menhir,no)
if test "$MENHIR" = no ; then
	AC_MSG_ERROR(Cannot find menhir.)
fi

291
MENHIRVERSION=`$MENHIR --version | sed -n -e 's,.*version *\(.*\)$,\1,p'`
292 293
AX_VERSION_GE([$MENHIRVERSION], 20151112, [],
  [AC_MSG_ERROR(You need Menhir 20151112 or higher.)])
294

295 296 297 298 299 300 301 302 303 304 305 306 307 308 309
## Where are the library we need
# we look for ocamlfind; if not present, we just don't use it to find
# libraries
AC_CHECK_PROG(USEOCAMLFIND,ocamlfind,yes,no)

if test "$USEOCAMLFIND" = yes; then
   OCAMLFINDLIB=$(ocamlfind printconf stdlib)
   OCAMLFIND=$(which ocamlfind)
   if test "$OCAMLFINDLIB" != "$OCAMLLIB"; then
   USEOCAMLFIND=no;
   echo "but your ocamlfind is not compatible with your ocamlc:"
   echo "ocamlfind : $OCAMLFINDLIB, ocamlc : $OCAMLLIB"
   fi
fi

310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
if test "$enable_why3_lib" = yes ; then
   WHY3LIB=
   WHY3INCLUDE="-I lib/why3"
else
   AC_MSG_CHECKING([For Why3])
   if test "$USEOCAMLFIND" = no; then
      AC_MSG_RESULT([no])
      AC_MSG_ERROR([Cannot use --disable-why3-lib without ocamlfind.])
   fi
   WHY3LIB=why3
   WHY3INCLUDE=$(ocamlfind query why3)
   if test -n "$WHY3INCLUDE"; then
      AC_MSG_RESULT([$WHY3INCLUDE])
      WHY3INCLUDE="-I $WHY3INCLUDE"
   else
      AC_MSG_RESULT([no])
      AC_MSG_ERROR([Cannot use --disable-why3-lib without an installed Why3.])
   fi
fi

330 331
if test "$enable_local" = no; then
   LOCALDIR=''
332
else
333 334 335
   LOCALDIR="${PWD}"
fi

336 337 338
#if ocamlfind is used it gives the install path for ocaml library
if test "$USEOCAMLFIND" = yes; then
   OCAMLINSTALLLIB=$(ocamlfind printconf destdir)
339
else
340
   OCAMLINSTALLLIB=$OCAMLLIB
341 342
fi

343 344
# compiler plugins

345
AX_VERSION_GE([$OCAMLVERSION], 4.05.0,
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361
  [if test "$USEOCAMLFIND" = yes; then
     COMPILERLIBS=$(ocamlfind query compiler-libs)
   fi
   if test -n "$COMPILERLIBS"; then
     echo "ocamlfind found compiler-libs in $COMPILERLIBS"
     enable_compiler_plugins="yes"
   else
     COMPILERLIBS="+compiler-libs"
     AC_CHECK_FILE($OCAMLLIB/compiler-libs/,
                   enable_compiler_plugins=yes,
                   enable_compiler_plugins=no)
     if test "$enable_compiler_plugins" = no; then
       reason_compiler_plugins=" (compiler-libs not found)"
     fi
   fi],
  [enable_compiler_plugins="no"
362
   reason_compiler_plugins=" (Ocaml version 4.05.0 required)"])
363 364 365 366 367 368 369

if test "$enable_compiler_plugins" = yes; then
  COMPILERLIBSPKG="compiler-libs"
else
  COMPILERLIBSPKG=
fi

370 371
# checking for rubber
if test "$enable_doc" = yes ; then
372 373 374 375 376 377 378 379 380
   AC_CHECK_PROG(RUBBER,rubber,rubber,no)
   if test "$RUBBER" = no ; then
      enable_doc=no
      enable_html_doc=no
      reason_doc=" (rubber not found)"
      AC_MSG_WARN([Cannot find rubber, documentation disabled.])
   fi
else
   enable_html_doc=no
381 382
fi

383 384
# checking for hevea (note that the pdf documentation DOES NOT use hevea.sty)
if test "$enable_html_doc" = yes ; then
385 386 387
   AC_CHECK_PROG(HEVEA,hevea,hevea,no)
   if test "$HEVEA" = no ; then
      enable_html_doc=no
388 389
      reason_html_doc=" (hevea not found)"
      AC_MSG_WARN([Cannot find hevea, HTML documentation disabled.])
390 391
   fi
fi
392

393
# checking for hacha
394 395 396 397 398 399 400 401
if test "$enable_html_doc" = yes ; then
   AC_CHECK_PROG(HACHA,hacha,hacha,no)
   if test "$HACHA" = no ; then
      enable_html_doc=no
      reason_html_doc=" (hacha not found)"
      AC_MSG_WARN([Cannot find hacha, HTML documentation disabled.])
   fi
fi
402

403
# checking for emacs
404 405 406 407 408 409 410
if test "$enable_emacs_compilation" = yes ; then
   AC_CHECK_PROG(EMACS,emacs,emacs,no)
   if test "$EMACS" = no ; then
      enable_emacs_compilation=no
      AC_MSG_WARN([Cannot find emacs, compilation of why3.elc disabled.])
   fi
fi
411

MARCHE Claude's avatar
MARCHE Claude committed
412
# checking for Num
413 414
# (ocamlfind cannot be trusted here, since the default installation path is $OCAMLLIB)
found_num=no
MARCHE Claude's avatar
MARCHE Claude committed
415
if test "$USEOCAMLFIND" = yes; then
416 417 418
   DIR=$(ocamlfind query num)
   if test -n "$DIR"; then
      echo "ocamlfind found num in $DIR"
419 420 421 422
      NUMINCLUDE="-I $DIR"
      found_num=yes
      AC_CHECK_FILE($DIR/nums.cma,,found_num=no)
      AC_CHECK_FILE($DIR/num.cmi,,found_num=no)
423
   fi
MARCHE Claude's avatar
MARCHE Claude committed
424
fi
425 426 427 428 429 430 431
if test "$found_num" = no; then
   DIR="$OCAMLLIB"
   NUMINCLUDE=
   found_num=yes
   AC_CHECK_FILE($DIR/nums.cma,,found_num=no)
   AC_CHECK_FILE($DIR/num.cmi,,found_num=no)
fi
432 433
if test "$found_num" = no; then
   AC_MSG_ERROR([Library Num not found.])
MARCHE Claude's avatar
MARCHE Claude committed
434 435
fi

436 437
# checking for Zarith
if test "$enable_zarith" = yes; then
438
   DIR=
439
   if test "$USEOCAMLFIND" = yes; then
440 441 442 443
      DIR=$(ocamlfind query zarith)
      if test -n "$DIR"; then
         echo "ocamlfind found zarith in $DIR"
         BIGINTINCLUDE="-I $DIR"
444 445
      fi
   fi
446 447 448 449 450 451 452 453 454 455
   if test -z "$DIR"; then
      BIGINTINCLUDE="-I +zarith"
      DIR="$OCAMLLIB/zarith"
      AC_CHECK_FILE($DIR/zarith.cma,,enable_zarith=no)
   fi
   AC_CHECK_FILE($DIR/z.cmi,,enable_zarith=no)
   if test "$enable_zarith" = no; then
      AC_MSG_WARN([Lib Zarith not found, using Nums instead.])
      reason_zarith=" (zarith not found)"
   fi
456 457 458 459
fi

if test "$enable_zarith" = yes; then
   BIGINTLIB=zarith
460
   BIGINTPKG=zarith
461 462
else
   BIGINTLIB=nums
463
   BIGINTPKG=num
464
   BIGINTINCLUDE="$NUMINCLUDE"
465 466
fi

467
# checking for camlzip
468
if test "$enable_zip" = yes; then
469
   DIR=
470
   if test "$USEOCAMLFIND" = yes; then
471 472 473 474
      DIR=$(ocamlfind query zip)
      if test -n "DIR"; then
         echo "ocamlfind found camlzip in $DIR"
         ZIPINCLUDE="-I $DIR"
475 476
      fi
   fi
477 478 479 480 481 482 483 484 485 486
   if test -z "$DIR"; then
      ZIPINCLUDE="-I +zip"
      DIR="$OCAMLLIB/zip"
      AC_CHECK_FILE($DIR/zip.cma,,enable_zip=no)
   fi
   AC_CHECK_FILE($DIR/zip.cmi,,enable_zip=no)
   if test "$enable_zip" = no; then
      AC_MSG_WARN([Lib camlzip not found, sessions files will not be compressed.])
      reason_zip=" (camlzip not found)"
   fi
487 488 489 490 491 492
fi

if test "$enable_zip" = yes; then
   ZIPLIB=zip
else
   ZIPLIB=
493
   ZIPINCLUDE=
494 495
fi

496
# checking for menhirlib
497 498 499 500 501 502 503
found_menhirlib=yes
DIR=
if test "$USEOCAMLFIND" = yes; then
   DIR=$(ocamlfind query menhirLib)
   if test -n "$DIR"; then
      echo "ocamlfind found menhirLib in $DIR"
      MENHIRINCLUDE="-I $DIR"
504 505
   fi
fi
506 507 508 509 510 511 512 513
if test -z "$DIR"; then
   MENHIRINCLUDE="-I +menhirLib"
   DIR="$OCAMLLIB/menhirLib"
   AC_CHECK_FILE($DIR/menhirLib.cmx,,found_menhirlib=no)
fi
AC_CHECK_FILE($DIR/menhirLib.cmi,,found_menhirlib=no)
if test "$found_menhirlib" = no; then
   AC_MSG_ERROR([Library menhirLib not found.])
514 515
fi

516
# checking for lablgtk2
517 518 519
if test "$enable_ide" != yes ; then
   reason_ide=" (disabled by user)"
else
520
   DIR=
521
   if test "$USEOCAMLFIND" = yes; then
522 523 524 525 526
      DIR=$(ocamlfind query lablgtk2)
      if test -n "$DIR"; then
         echo "ocamlfind found lablgtk2 in $DIR"
         LABLGTK2LIB="$DIR"
      fi
527
   fi
528
   if test -z "$DIR"; then
529
      LABLGTK2LIB="+lablgtk2"
530 531 532 533 534 535 536
      DIR="$OCAMLLIB/lablgtk2"
      AC_CHECK_FILE($DIR/lablgtk.cma,,enable_ide=no)
   fi
   AC_CHECK_FILE($DIR/gtkButton.cmi,,enable_ide=no)
   if test "$enable_ide" = no; then
      AC_MSG_WARN([Lib lablgtk2 not found, IDE disabled.])
      reason_ide=" (lablgtk2 not found)"
537 538 539 540 541
   fi
fi

# checking for lablgtksourceview2
if test "$enable_ide" = yes ; then
542
   DIR=
543
   if test "$USEOCAMLFIND" = yes; then
544 545 546
      DIR=$(ocamlfind query lablgtk2.sourceview2)
      if test -z "$DIR"; then
         DIR=$(ocamlfind query lablgtksourceview2)
547
      fi
548 549 550
      if test -n "$DIR";then
         echo "ocamlfind found lablgtksourceview2 in $DIR"
         LABLGTKSV2LIB="$DIR"
551
      fi
552
   fi
553 554 555 556 557 558 559 560 561
   if test -z "$DIR"; then
      DIR="$OCAMLLIB/lablgtk2"
      AC_CHECK_FILE($DIR/lablgtksourceview2.cma,,enable_ide=no)
   fi
   AC_CHECK_FILE($DIR/gSourceView2.cmi,,enable_ide=no)
   if test "$enable_ide" = no; then
      AC_MSG_WARN([Lib lablgtksourceview2 not found, IDE disabled.])
      reason_ide=" (lablgtksourceview2 not found)"
   fi
Andrei Paskevich's avatar
Andrei Paskevich committed
562
fi
563

Andrei Paskevich's avatar
Andrei Paskevich committed
564
if test "$enable_ide" = yes ; then
565
   LABLGTK2PKG="lablgtk2 lablgtk2.init lablgtk2.sourceview2"
Andrei Paskevich's avatar
Andrei Paskevich committed
566
else
567 568
   LABLGTK2PKG=
   LABLGTK2LIB=
Andrei Paskevich's avatar
Andrei Paskevich committed
569 570
fi

Andrei Paskevich's avatar
Andrei Paskevich committed
571
dnl AC_CHECK_PROG(enable_ide,lablgtk2,yes,no) not always available (Win32)
572

Andrei Paskevich's avatar
Andrei Paskevich committed
573
dnl AC_CHECK_PROG(OCAMLWEB,ocamlweb,ocamlweb,true)
574

575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603
# checking for ocamlgraph
if test "$enable_hypothesis_selection" = yes; then
   DIR=
   if test "$USEOCAMLFIND" = yes; then
      DIR=$(ocamlfind query ocamlgraph)
      if test -n "$DIR"; then
         echo "ocamlfind found ocamlgraph in $DIR"
         OCAMLGRAPHLIB="$DIR"
      fi
   fi
   if test -z "$DIR"; then
      OCAMLGRAPHLIB="+ocamlgraph"
      DIR="$OCAMLLIB/ocamlgraph"
      AC_CHECK_FILE($DIR/graph.cma,,enable_hypothesis_selection=no)
   fi
   AC_CHECK_FILE($DIR/graph.cmi,,enable_hypothesis_selection=no)
   if test "$enable_hypothesis_selection" = no; then
      reason_hypothesis_selection=" (ocamlgraph not found)"
      AC_MSG_WARN([Lib ocamlgraph not found, hypothesis selection disabled.])
   fi
fi

if test "$enable_hypothesis_selection" = yes; then
   META_OCAMLGRAPH="ocamlgraph"
else
   META_OCAMLGRAPH=
   OCAMLGRAPHLIB=
fi

604
# checking for js_of_ocaml
605 606 607 608 609 610
if test "$enable_js_of_ocaml" != yes; then
   reason_js_of_ocaml=" (disabled by user)"
elif test "$USEOCAMLFIND" != yes; then
   enable_js_of_ocaml=no
   reason_js_of_ocaml=" (ocamlfind not available)"
else
611 612
   JSOFOCAML=$(ocamlfind query js_of_ocaml)
   if test -z "$JSOFOCAML"; then
613 614
      enable_js_of_ocaml=no
      reason_js_of_ocaml=" (js_of_ocaml not found)"
615
   else
616
      JSOFOCAMLPPX=$(ocamlfind query js_of_ocaml-ppx)
617
      if test -z "$JSOFOCAMLPPX"; then
618 619
         enable_js_of_ocaml=no
         reason_js_of_ocaml=" (js_of_ocaml-ppx not found)"
620
      fi
621
   fi
622 623 624 625 626 627 628
fi

if test "$enable_web_ide" != yes; then
   reason_web_ide=" (disabled by user)"
elif test "$enable_js_of_ocaml" != yes; then
   enable_web_ide=no
   reason_web_ide=" (js_of_ocaml not available)"
629 630
fi

631
# Coq
632

633
enable_coq_support=yes
634 635
enable_coq_fp_libs=yes

636 637
coq_compat_version=

Guillaume Melquiond's avatar
Guillaume Melquiond committed
638
if test "$enable_coq_libs" = no; then
639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654
   enable_coq_support=no
   reason_coq_support=" (disabled by user)"
fi

if test "$enable_coq_support" = yes; then
   AC_CHECK_PROG(COQC,coqc,coqc,no)
   if test "$COQC" = no ; then
      enable_coq_support=no
      AC_MSG_WARN(Cannot find coqc.)
      reason_coq_support=" (coqc not found)"
   fi
fi

if test "$enable_coq_support" = yes; then
   COQLIB=`$COQC -where | sed -e 's|\\\|/|g' -e 's| |\\ |g'`
   AC_MSG_CHECKING(Coq version)
655
   COQVERSION=[`$COQC -v | sed -n -e 's|.*version *\([^ ]*\) .*$|\1|p'`]
656
   AC_MSG_RESULT($COQVERSION)
657 658

   case $COQVERSION in
659
      8.5*)
660 661
         coq_compat_version="COQ85"
         ;;
Guillaume Melquiond's avatar
Guillaume Melquiond committed
662
      8.6*)
663 664
         coq_compat_version="COQ86"
         ;;
Guillaume Melquiond's avatar
Guillaume Melquiond committed
665 666 667
      8.7*)
         coq_compat_version="COQ87"
         ;;
668 669 670
      8.8*)
         coq_compat_version="COQ88"
         ;;
671 672 673
      8.9*)
         coq_compat_version="COQ89"
         ;;
674 675
      *)
         enable_coq_support=no
676 677
         AC_MSG_WARN(You need Coq 8.5 or later; Coq discarded)
         reason_coq_support=" (version is $COQVERSION but need version 8.5 or later)"
678 679 680 681 682 683 684 685 686 687 688
         ;;
   esac
fi

if test "$enable_coq_support" = yes; then
   AC_CHECK_PROG(COQDEP,coqdep,coqdep,no)
   if test "$COQDEP" = no; then
      enable_coq_support=no
      AC_MSG_WARN(Cannot find coqdep.)
      reason_coq_support=" (coqdep not found)"
   fi
689
fi
690 691 692

if test "$enable_coq_support" = no; then
   enable_coq_libs=no
693
   COQVERSION=
694 695
fi

696 697 698
if test "$enable_coq_libs" = yes; then
   AC_MSG_CHECKING([for Flocq])
   AS_IF(
699
     [ echo "Require Import Flocq.Flocq_version BinNat." \
700
            "Goal (20500 <= Flocq_version)%N. easy. Qed." > conftest.v
701 702 703 704 705
       "$COQC" conftest.v > conftest.err ],
     [ AC_MSG_RESULT(yes) ],
     [ AC_MSG_RESULT(no)
       enable_coq_fp_libs=no
       AC_MSG_WARN(Cannot find Flocq.)
706
       reason_coq_fp_libs=" (Flocq >= 2.5, < 3.0 not found)" ])
707 708 709
   rm -f conftest.v conftest.vo conftest.err
fi

Jean-Christophe's avatar
Jean-Christophe committed
710 711 712 713 714 715 716 717 718 719 720 721 722 723
# PVS

if test "$enable_pvs_libs" = no; then
    enable_pvs_support=no
    reason_pvs_support=" (disabled by user)"
else
    AC_CHECK_PROG(PVS,pvs,pvs,no)
    if test "$PVS" = no ; then
        enable_pvs_support=no
        AC_MSG_WARN(Cannot find pvs.)
        reason_pvs_support=" (pvs not found)"
    else
        PVSLIB=`$PVS -where`
        AC_MSG_CHECKING(PVS version)
724
        PVSVERSION=[`$PVS -version | sed -n -e 's|.*Version *\([^ ]*\)$|\1|p'`]
Jean-Christophe's avatar
Jean-Christophe committed
725 726

        case $PVSVERSION in
727 728
          6.*)
	        enable_pvs_support=yes
729 730
                AC_MSG_RESULT($PVSVERSION)
                ;;
731
          *)
Jean-Christophe's avatar
Jean-Christophe committed
732
                AC_MSG_RESULT($PVSVERSION)
733 734 735
                enable_pvs_support=no
	        AC_MSG_WARN(You need PVS 6.0 or higher; PVS discarded)
                reason_pvs_support=" (need version 6.0 or higher)"
Jean-Christophe's avatar
Jean-Christophe committed
736 737 738 739 740 741 742
                ;;
        esac
    fi
fi

if test "$enable_pvs_support" = no; then
   enable_pvs_libs=no
743
   PVSVERSION=
Jean-Christophe's avatar
Jean-Christophe committed
744 745
fi

746 747
# Isabelle

748 749
# Default version used for generation of realization in the case Isabelle is not
# detected or Why3 is compiled with disable-isabelle.
750
ISABELLEVERSION=2018
751

752 753 754 755 756 757
if test "$enable_isabelle_libs" = no; then
    enable_isabelle_support=no
    reason_isabelle_support=" (disabled by user)"
else
    AC_CHECK_PROG(ISABELLE,isabelle,isabelle,no)
    if test "$ISABELLE" = no ; then
758 759 760
       enable_isabelle_support=no
       AC_MSG_WARN(Cannot find isabelle.)
       reason_isabelle_support=" (isabelle not found)"
761 762
    else
        AC_MSG_CHECKING(Isabelle version)
763
        ISABELLEDETECTEDVERSION=[`$ISABELLE version | sed -n -e 's|Isabelle\([^:]*\).*$|\1|p'`]
764

765
        case $ISABELLEDETECTEDVERSION in
766
          2018*)
767
	        enable_isabelle_support=yes
768
                ISABELLEVERSION=2018
769 770
                AC_MSG_RESULT($ISABELLEDETECTEDVERSION)
                ;;
771
          2017*)
772
	        enable_isabelle_support=yes
773
                ISABELLEVERSION=2017
774
                AC_MSG_RESULT($ISABELLEDETECTEDVERSION)
775 776
                ;;
          *)
777
                AC_MSG_RESULT($ISABELLEDETECTEDVERSION)
778
                enable_isabelle_support=no
779 780
	        AC_MSG_WARN(You need Isabelle 2017 or later; Isabelle discarded)
                reason_isabelle_support=" (need version >= 2017)"
781 782 783 784 785 786 787 788 789
                ;;
        esac
    fi
fi

if test "$enable_isabelle_support" = no; then
   enable_isabelle_libs=no
fi

Jean-Christophe's avatar
Jean-Christophe committed
790
if test "$enable_pvs_libs" = yes; then
791 792 793
   AC_MSG_CHECKING([for NASA PVS library])
   enable_pvs_libs=no
   reason_pvs_libs=" (no NASA PVS library in PVS_LIBRARY_PATH)"
794
   for dir in  `echo $PVS_LIBRARY_PATH | tr ':' ' '`; do
Jean-Christophe's avatar
Jean-Christophe committed
795
       if test -f $dir/nasalib-version; then
796 797
          enable_pvs_libs=yes
          reason_pvs_libs=""
Jean-Christophe's avatar
Jean-Christophe committed
798 799
       fi
   done
800
   AC_MSG_RESULT($enable_pvs_libs)
Jean-Christophe's avatar
Jean-Christophe committed
801 802
fi

803
#check frama-c
804
FRAMAC_SUPPORTED=Sulfur
805 806 807 808 809 810 811 812
if test "$enable_frama_c" = yes ; then
   AC_CHECK_PROG(FRAMAC,frama-c,frama-c,no)
   if test "$FRAMAC" = no ; then
        AC_MSG_WARN(Cannot find Frama-C.)
        enable_frama_c="no"
        reason_frama_c=" (frama-c not found)"
   else
      AC_MSG_CHECKING(Frama-C version)
813
      FRAMAC_VERSION=`$FRAMAC -version | sed -n -e 's|\(Version: \)\?\(.*\)$|\2|p'`
814 815
      AC_MSG_RESULT($FRAMAC_VERSION)
      case $FRAMAC_VERSION in
816
         $FRAMAC_SUPPORTED-*) ;;
817
         *) AC_MSG_WARN(Version $FRAMAC_SUPPORTED required.)
818
            enable_frama_c=no
819
            reason_frama_c=" (version $FRAMAC_SUPPORTED required)"
820 821 822 823 824
            ;;
      esac
   fi
fi

825 826 827 828 829 830
if test "$enable_frama_c" = yes; then
   FRAMAC_SHARE=`$FRAMAC -print-path`
   FRAMAC_LIBDIR=`$FRAMAC -print-libpath`
   FRAMAC_INCLUDE="-I $FRAMAC_LIBDIR"
fi

831
#Viewer for ps and pdf
Andrei Paskevich's avatar
Andrei Paskevich committed
832 833 834
dnl AC_CHECK_PROGS(PSVIEWER,gv evince)
dnl AC_CHECK_PROGS(PDFVIEWER,xpdf acroread evince)

835
VERSION=$PACKAGE_VERSION
Andrei Paskevich's avatar
Andrei Paskevich committed
836

837
# substitutions to perform
Andrei Paskevich's avatar
Andrei Paskevich committed
838 839 840 841
AC_SUBST(VERSION)

AC_SUBST(enable_verbose_make)

842 843 844 845 846 847 848 849 850 851 852 853
AC_SUBST(EXE)
AC_SUBST(STRIP)

AC_SUBST(OCAMLC)
AC_SUBST(OCAMLOPT)
AC_SUBST(OCAMLDEP)
AC_SUBST(OCAMLLEX)
AC_SUBST(OCAMLYACC)
AC_SUBST(OCAMLDOC)
AC_SUBST(OCAMLBEST)
AC_SUBST(OCAMLVERSION)
AC_SUBST(OCAMLLIB)
854
AC_SUBST(OCAMLINSTALLLIB)
Andrei Paskevich's avatar
Andrei Paskevich committed
855 856
dnl AC_SUBST(OCAMLV)
dnl AC_SUBST(FORPACK)
857
AC_SUBST(OCAMLGRAPHLIB)
Andrei Paskevich's avatar
Andrei Paskevich committed
858
dnl AC_SUBST(OCAMLWEB)
859
AC_SUBST(MENHIR)
Andrei Paskevich's avatar
Andrei Paskevich committed
860

861 862
AC_SUBST(enable_profiling)

Andrei Paskevich's avatar
Andrei Paskevich committed
863
AC_SUBST(enable_ide)
864
AC_SUBST(LABLGTK2LIB)
Andrei Paskevich's avatar
Andrei Paskevich committed
865 866
AC_SUBST(LABLGTK2PKG)

867 868
AC_SUBST(enable_web_ide)
AC_SUBST(enable_js_of_ocaml)
869

François Bobot's avatar
François Bobot committed
870
AC_SUBST(META_OCAMLGRAPH)
871

872 873 874 875
AC_SUBST(enable_compiler_plugins)
AC_SUBST(COMPILERLIBS)
AC_SUBST(COMPILERLIBSPKG)

876 877
AC_SUBST(NUMINCLUDE)

878
AC_SUBST(enable_zarith)
879 880
AC_SUBST(BIGINTINCLUDE)
AC_SUBST(BIGINTLIB)
881
AC_SUBST(BIGINTPKG)
882

883 884 885 886
AC_SUBST(enable_zip)
AC_SUBST(ZIPINCLUDE)
AC_SUBST(ZIPLIB)

887 888
AC_SUBST(MENHIRINCLUDE)

889
AC_SUBST(enable_coq_libs)
890
AC_SUBST(enable_coq_fp_libs)
891
AC_SUBST(coq_compat_version)
François Bobot's avatar
François Bobot committed
892

Andrei Paskevich's avatar
Andrei Paskevich committed
893
AC_SUBST(COQC)
894 895
AC_SUBST(COQDEP)
AC_SUBST(COQLIB)
896
AC_SUBST(COQVERSION)
897

Jean-Christophe's avatar
Jean-Christophe committed
898 899 900 901
AC_SUBST(enable_pvs_libs)
AC_SUBST(PVS)
AC_SUBST(PVSVERSION)

902 903 904 905
AC_SUBST(enable_isabelle_libs)
AC_SUBST(ISABELLE)
AC_SUBST(ISABELLEVERSION)

906 907
AC_SUBST(enable_hypothesis_selection)

908
AC_SUBST(enable_doc)
909 910
AC_SUBST(enable_html_doc)

911
AC_SUBST(RUBBER)
912 913
AC_SUBST(HEVEA)
AC_SUBST(HACHA)
914 915

AC_SUBST(enable_emacs_compilation)
916
AC_SUBST(EMACS)
917

918 919 920 921 922 923
AC_SUBST(enable_frama_c)

AC_SUBST(FRAMAC)
AC_SUBST(FRAMAC_VERSION)
AC_SUBST(FRAMAC_SHARE)
AC_SUBST(FRAMAC_LIBDIR)
924
AC_SUBST(FRAMAC_INCLUDE)
925

926
AC_SUBST(enable_local)
927 928
AC_SUBST(LOCALDIR)

929 930 931 932
AC_SUBST(enable_why3_lib)
AC_SUBST(WHY3LIB)
AC_SUBST(WHY3INCLUDE)

933 934
AC_SUBST(enable_relocation)

Andrei Paskevich's avatar
Andrei Paskevich committed
935 936
dnl AC_SUBST(PSVIEWER)
dnl AC_SUBST(PDFVIEWER)
937

938
# Finally create the Makefile from Makefile.in
MARCHE Claude's avatar
MARCHE Claude committed
939
AC_CONFIG_FILES(Makefile)
940
AC_CONFIG_FILES(src/config.sh doc/version.tex)
941
AC_CONFIG_FILES(lib/why3/META)
Andrei Paskevich's avatar
Andrei Paskevich committed
942
AC_CONFIG_FILES(.merlin)
943
AC_CONFIG_FILES(src/jessie/Makefile)
MARCHE Claude's avatar
MARCHE Claude committed
944
AC_CONFIG_FILES(src/jessie/.merlin)
945
AC_CONFIG_FILES(lib/coq/version lib/pvs/version)
946
AC_CONFIG_COMMANDS([chmod],
947 948
chmod a-w Makefile src/jessie/Makefile;
chmod a-w src/config.sh doc/version.tex;
949
chmod a-w lib/why3/META;
Andrei Paskevich's avatar
Andrei Paskevich committed
950
chmod a-w .merlin;
951
chmod a-w src/jessie/Makefile;
MARCHE Claude's avatar
MARCHE Claude committed
952
chmod a-w src/jessie/.merlin;
953
chmod a-w lib/coq/version lib/pvs/version;
954 955
chmod u+x src/config.sh)

956
AC_OUTPUT
957

958 959 960 961 962 963

# Summary

echo
echo "                 Summary"
echo "-----------------------------------------"
964 965 966 967 968 969
echo "Verbose make                : $enable_verbose_make"
echo "OCaml compiler              : yes"
echo "    Version                 : $OCAMLVERSION"
echo "    Library path            : $OCAMLLIB"
echo "    Native compilation      : $enable_native_code"
echo "    Profiling               : $enable_profiling"
970
echo "    Compiler plugins        : $enable_compiler_plugins$reason_compiler_plugins"
971
echo "    Javascript support      : $enable_js_of_ocaml$reason_js_of_ocaml"
972
echo "Components"
973
echo "    Why3 library            : $enable_why3_lib"
974
echo "    GTK IDE                 : $enable_ide$reason_ide"
975
echo "    Web IDE                 : $enable_web_ide$reason_web_ide"
976 977 978 979 980 981 982 983 984 985
echo "    GMP arithmetic          : $enable_zarith$reason_zarith"
echo "    Compressed sessions     : $enable_zip$reason_zip"
echo "    Hypothesis selection    : $enable_hypothesis_selection$reason_hypothesis_selection"
echo "    Frama-C support         : $enable_frama_c$reason_frama_c"
if test "$enable_frama_c" = yes ; then
   echo "        Version             : $FRAMAC_VERSION"
   echo "        Share path          : $FRAMAC_SHARE"
   echo "        Library path        : $FRAMAC_LIBDIR"
fi
echo "Documentation               : $enable_doc$reason_doc"
986
if test "$enable_doc" = yes ; then
987 988
   echo "    PDF                     : yes"
   echo "    HTML                    : $enable_html_doc$reason_html_doc"
989
fi
990 991
echo "Support for interactive proof assistants"
echo "    Coq                     : $enable_coq_support$reason_coq_support"
992
if test "$enable_coq_support" = yes ; then
993 994 995
   echo "        Version             : $COQVERSION"
   echo "        Library path        : $COQLIB"
   echo "        Realization support : $enable_coq_libs$reason_coq_libs"
996
   if test "$enable_coq_libs" = yes ; then
997
      echo "            FP arithmetic   : $enable_coq_fp_libs$reason_coq_fp_libs"
998
   fi
999
fi
1000
echo "    PVS                     : $enable_pvs_support$reason_pvs_support"
1001
if test "$enable_pvs_support" = yes ; then
1002 1003 1004
   echo "        Version             : $PVSVERSION"
   echo "        Library path        : $PVSLIB"
   echo "        Realization support : $enable_pvs_libs$reason_pvs_libs"
1005
fi
1006
echo "    Isabelle                : $enable_isabelle_support$reason_isabelle_support"
1007
if test "$enable_isabelle_support" = yes ; then
1008
   echo "        Version             : $ISABELLEVERSION ($ISABELLEDETECTEDVERSION)"
1009
   echo "        Realization support : $enable_isabelle_libs$reason_isabelle_libs"
1010
fi
1011
if test "$enable_local" = yes ; then
1012
   echo "Installable                 : no"
1013
   echo "    OCaml library path      : $OCAMLINSTALLLIB/why3"
1014
else
1015 1016
   echo "Installable                 : yes"
   echo "    Binary path             : $bindir"
1017
   echo "    Library path            : $libdir/why3"
1018
   echo "    Data path               : $datarootdir/why3"
1019
   echo "    OCaml library path      : $OCAMLINSTALLLIB/why3"
1020
   echo "    Relocatable             : $enable_relocation"
1021
fi