configure.in 29 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 lablgtk3
517 518 519
if test "$enable_ide" != yes ; then
   reason_ide=" (disabled by user)"
else
520
   DIR=
521
   if test "$USEOCAMLFIND" = yes; then
522
      DIR=$(ocamlfind query lablgtk3)
523
      if test -n "$DIR"; then
524
         echo "ocamlfind found lablgtk3 in $DIR"
525
         LABLGTKINCLUDE="-I $DIR"
526
      fi
527
   fi
528
   if test -z "$DIR"; then
529 530
      LABLGTKINCLUDE="-I +lablgtk3"
      DIR="$OCAMLLIB/lablgtk3"
531 532 533
      AC_CHECK_FILE($DIR/lablgtk.cma,,enable_ide=no)
   fi
   AC_CHECK_FILE($DIR/gtkButton.cmi,,enable_ide=no)
534
   if test "$enable_ide" = yes; then
535 536
      GTKVERSION=3
      reason_ide=" (gtk3)"
537
   else
538
      AC_MSG_WARN([Lib lablgtk3 not found, trying lablgtk2.])
539 540 541 542
      enable_ide=retry
   fi
fi

543
# checking for lablgtk2
544 545 546 547
if test "$enable_ide" = retry; then
   enable_ide=yes
   DIR=
   if test "$USEOCAMLFIND" = yes; then
548
      DIR=$(ocamlfind query lablgtk2)
549
      if test -n "$DIR"; then
550
         echo "ocamlfind found lablgtk2 in $DIR"
551 552 553 554
         LABLGTKINCLUDE="-I $DIR"
      fi
   fi
   if test -z "$DIR"; then
555 556
      LABLGTKINCLUDE="-I +lablgtk2"
      DIR="$OCAMLLIB/lablgtk2"
557 558 559 560
      AC_CHECK_FILE($DIR/lablgtk.cma,,enable_ide=no)
   fi
   AC_CHECK_FILE($DIR/gtkButton.cmi,,enable_ide=no)
   if test "$enable_ide" = yes; then
561 562
      GTKVERSION=2
      reason_ide=" (gtk2)"
563
   else
564
      AC_MSG_WARN([Lib lablgtk2 not found, IDE disabled.])
565
      reason_ide=" (lablgtk2/3 not found)"
566 567 568
   fi
fi

569
# checking for lablgtksourceview
570
if test "$enable_ide" = yes ; then
571
   DIR=
572
   if test "$USEOCAMLFIND" = yes; then
573
      DIR=$(ocamlfind query lablgtk$GTKVERSION.sourceview$GTKVERSION)
574
      if test -z "$DIR"; then
575
         DIR=$(ocamlfind query lablgtksourceview$GTKVERSION)
576
      fi
577
      if test -n "$DIR";then
578
         echo "ocamlfind found lablgtksourceview$GTKVERSION in $DIR"
579
      fi
580
   fi
581
   if test -z "$DIR"; then
582 583
      DIR="$OCAMLLIB/lablgtk$GTKVERSION"
      AC_CHECK_FILE($DIR/lablgtksourceview$GTKVERSION.cma,,enable_ide=no)
584
   fi
585
   AC_CHECK_FILE($DIR/gSourceView$GTKVERSION.cmi,,enable_ide=no)
586
   if test "$enable_ide" = no; then
587 588
      AC_MSG_WARN([Lib lablgtksourceview not found, IDE disabled.])
      reason_ide=" (lablgtksourceview not found)"
589
   fi
Andrei Paskevich's avatar
Andrei Paskevich committed
590
fi
591

Andrei Paskevich's avatar
Andrei Paskevich committed
592
if test "$enable_ide" = yes ; then
593 594
   LABLGTKLIB="lablgtk lablgtksourceview$GTKVERSION"
   LABLGTKPKG="lablgtk$GTKVERSION lablgtk$GTKVERSION.init lablgtk$GTKVERSION.sourceview$GTKVERSION"
Andrei Paskevich's avatar
Andrei Paskevich committed
595
else
596 597 598
   LABLGTKLIB=
   LABLGTKPKG=
   LABLGTKINCLUDE=
Andrei Paskevich's avatar
Andrei Paskevich committed
599 600
fi

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

Andrei Paskevich's avatar
Andrei Paskevich committed
603
dnl AC_CHECK_PROG(OCAMLWEB,ocamlweb,ocamlweb,true)
604

605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633
# 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

634
# checking for js_of_ocaml
635 636 637 638 639 640
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
641 642
   JSOFOCAML=$(ocamlfind query js_of_ocaml)
   if test -z "$JSOFOCAML"; then
643 644
      enable_js_of_ocaml=no
      reason_js_of_ocaml=" (js_of_ocaml not found)"
645
   else
646
      JSOFOCAMLPPX=$(ocamlfind query js_of_ocaml-ppx)
647
      if test -z "$JSOFOCAMLPPX"; then
648 649
         enable_js_of_ocaml=no
         reason_js_of_ocaml=" (js_of_ocaml-ppx not found)"
650 651
      else
         JSOFOCAMLPKG="js_of_ocaml js_of_ocaml.ppx"
652
      fi
653
   fi
654 655 656 657 658 659
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
660
   reason_web_ide=" (Javascript support not available)"
661 662
fi

663
# Coq
664

665
enable_coq_support=yes
666 667
enable_coq_fp_libs=yes

668 669
coq_compat_version=

Guillaume Melquiond's avatar
Guillaume Melquiond committed
670
if test "$enable_coq_libs" = no; then
671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686
   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)
687
   COQVERSION=[`$COQC -v | sed -n -e 's|.*version *\([^ ]*\) .*$|\1|p'`]
688
   AC_MSG_RESULT($COQVERSION)
689 690

   case $COQVERSION in
691
      8.5*)
692 693
         coq_compat_version="COQ85"
         ;;
Guillaume Melquiond's avatar
Guillaume Melquiond committed
694
      8.6*)
695 696
         coq_compat_version="COQ86"
         ;;
Guillaume Melquiond's avatar
Guillaume Melquiond committed
697 698 699
      8.7*)
         coq_compat_version="COQ87"
         ;;
700 701 702
      8.8*)
         coq_compat_version="COQ88"
         ;;
703 704 705
      8.9*)
         coq_compat_version="COQ89"
         ;;
706 707
      *)
         enable_coq_support=no
708 709
         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)"
710 711 712 713 714 715 716 717 718 719 720
         ;;
   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
721
fi
722 723 724

if test "$enable_coq_support" = no; then
   enable_coq_libs=no
725
   COQVERSION=
726 727
fi

728 729 730
if test "$enable_coq_libs" = yes; then
   AC_MSG_CHECKING([for Flocq])
   AS_IF(
731
     [ echo "Require Import Flocq.Flocq_version BinNat." \
732
            "Goal (20500 <= Flocq_version)%N. easy. Qed." > conftest.v
733 734 735 736 737
       "$COQC" conftest.v > conftest.err ],
     [ AC_MSG_RESULT(yes) ],
     [ AC_MSG_RESULT(no)
       enable_coq_fp_libs=no
       AC_MSG_WARN(Cannot find Flocq.)
738
       reason_coq_fp_libs=" (Flocq >= 2.5, < 3.0 not found)" ])
739 740 741
   rm -f conftest.v conftest.vo conftest.err
fi

Jean-Christophe's avatar
Jean-Christophe committed
742 743 744 745 746 747 748 749 750 751 752 753 754 755
# 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)
756
        PVSVERSION=[`$PVS -version | sed -n -e 's|.*Version *\([^ ]*\)$|\1|p'`]
Jean-Christophe's avatar
Jean-Christophe committed
757 758

        case $PVSVERSION in
759 760
          6.*)
	        enable_pvs_support=yes
761 762
                AC_MSG_RESULT($PVSVERSION)
                ;;
763
          *)
Jean-Christophe's avatar
Jean-Christophe committed
764
                AC_MSG_RESULT($PVSVERSION)
765 766 767
                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
768 769 770 771 772 773 774
                ;;
        esac
    fi
fi

if test "$enable_pvs_support" = no; then
   enable_pvs_libs=no
775
   PVSVERSION=
Jean-Christophe's avatar
Jean-Christophe committed
776 777
fi

778 779
# Isabelle

780 781
# Default version used for generation of realization in the case Isabelle is not
# detected or Why3 is compiled with disable-isabelle.
782
ISABELLEVERSION=2018
783

784 785 786 787 788 789
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
790 791 792
       enable_isabelle_support=no
       AC_MSG_WARN(Cannot find isabelle.)
       reason_isabelle_support=" (isabelle not found)"
793 794
    else
        AC_MSG_CHECKING(Isabelle version)
795
        ISABELLEDETECTEDVERSION=[`$ISABELLE version | sed -n -e 's|Isabelle\([^:]*\).*$|\1|p'`]
796

797
        case $ISABELLEDETECTEDVERSION in
798
          2018*)
799
	        enable_isabelle_support=yes
800
                ISABELLEVERSION=2018
801 802
                AC_MSG_RESULT($ISABELLEDETECTEDVERSION)
                ;;
803
          2017*)
804
	        enable_isabelle_support=yes
805
                ISABELLEVERSION=2017
806
                AC_MSG_RESULT($ISABELLEDETECTEDVERSION)
807 808
                ;;
          *)
809
                AC_MSG_RESULT($ISABELLEDETECTEDVERSION)
810
                enable_isabelle_support=no
811 812
	        AC_MSG_WARN(You need Isabelle 2017 or later; Isabelle discarded)
                reason_isabelle_support=" (need version >= 2017)"
813 814 815 816 817 818 819 820 821
                ;;
        esac
    fi
fi

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

Jean-Christophe's avatar
Jean-Christophe committed
822
if test "$enable_pvs_libs" = yes; then
823 824 825
   AC_MSG_CHECKING([for NASA PVS library])
   enable_pvs_libs=no
   reason_pvs_libs=" (no NASA PVS library in PVS_LIBRARY_PATH)"
826
   for dir in  `echo $PVS_LIBRARY_PATH | tr ':' ' '`; do
Jean-Christophe's avatar
Jean-Christophe committed
827
       if test -f $dir/nasalib-version; then
828 829
          enable_pvs_libs=yes
          reason_pvs_libs=""
Jean-Christophe's avatar
Jean-Christophe committed
830 831
       fi
   done
832
   AC_MSG_RESULT($enable_pvs_libs)
Jean-Christophe's avatar
Jean-Christophe committed
833 834
fi

835
#check frama-c
836
FRAMAC_SUPPORTED=Sulfur
837 838 839 840 841 842 843 844
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)
845
      FRAMAC_VERSION=`$FRAMAC -version | sed -n -e 's|\(Version: \)\?\(.*\)$|\2|p'`
846 847
      AC_MSG_RESULT($FRAMAC_VERSION)
      case $FRAMAC_VERSION in
848
         $FRAMAC_SUPPORTED-*) ;;
849
         *) AC_MSG_WARN(Version $FRAMAC_SUPPORTED required.)
850
            enable_frama_c=no
851
            reason_frama_c=" (version $FRAMAC_SUPPORTED required)"
852 853 854 855 856
            ;;
      esac
   fi
fi

857 858 859 860 861 862
if test "$enable_frama_c" = yes; then
   FRAMAC_SHARE=`$FRAMAC -print-path`
   FRAMAC_LIBDIR=`$FRAMAC -print-libpath`
   FRAMAC_INCLUDE="-I $FRAMAC_LIBDIR"
fi

863
#Viewer for ps and pdf
Andrei Paskevich's avatar
Andrei Paskevich committed
864 865 866
dnl AC_CHECK_PROGS(PSVIEWER,gv evince)
dnl AC_CHECK_PROGS(PDFVIEWER,xpdf acroread evince)

867
VERSION=$PACKAGE_VERSION
Andrei Paskevich's avatar
Andrei Paskevich committed
868

869
# substitutions to perform
Andrei Paskevich's avatar
Andrei Paskevich committed
870 871 872 873
AC_SUBST(VERSION)

AC_SUBST(enable_verbose_make)

874 875 876 877 878 879 880 881 882 883 884 885
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)
886
AC_SUBST(OCAMLINSTALLLIB)
Andrei Paskevich's avatar
Andrei Paskevich committed
887 888
dnl AC_SUBST(OCAMLV)
dnl AC_SUBST(FORPACK)
889
AC_SUBST(OCAMLGRAPHLIB)
Andrei Paskevich's avatar
Andrei Paskevich committed
890
dnl AC_SUBST(OCAMLWEB)
891
AC_SUBST(MENHIR)
Andrei Paskevich's avatar
Andrei Paskevich committed
892

893 894
AC_SUBST(enable_profiling)

Andrei Paskevich's avatar
Andrei Paskevich committed
895
AC_SUBST(enable_ide)
896 897 898 899
AC_SUBST(LABLGTKLIB)
AC_SUBST(LABLGTKPKG)
AC_SUBST(LABLGTKINCLUDE)
AC_SUBST(GTKVERSION)
Andrei Paskevich's avatar
Andrei Paskevich committed
900

901 902
AC_SUBST(enable_web_ide)
AC_SUBST(enable_js_of_ocaml)
903
AC_SUBST(JSOFOCAMLPKG)
904

François Bobot's avatar
François Bobot committed
905
AC_SUBST(META_OCAMLGRAPH)
906

907 908 909 910
AC_SUBST(enable_compiler_plugins)
AC_SUBST(COMPILERLIBS)
AC_SUBST(COMPILERLIBSPKG)

911 912
AC_SUBST(NUMINCLUDE)

913
AC_SUBST(enable_zarith)
914 915
AC_SUBST(BIGINTINCLUDE)
AC_SUBST(BIGINTLIB)
916
AC_SUBST(BIGINTPKG)
917

918 919 920 921
AC_SUBST(enable_zip)
AC_SUBST(ZIPINCLUDE)
AC_SUBST(ZIPLIB)

922 923
AC_SUBST(MENHIRINCLUDE)

924
AC_SUBST(enable_coq_libs)
925
AC_SUBST(enable_coq_fp_libs)
926
AC_SUBST(coq_compat_version)
François Bobot's avatar
François Bobot committed
927

Andrei Paskevich's avatar
Andrei Paskevich committed
928
AC_SUBST(COQC)
929 930
AC_SUBST(COQDEP)
AC_SUBST(COQLIB)
931
AC_SUBST(COQVERSION)
932

Jean-Christophe's avatar
Jean-Christophe committed
933 934 935 936
AC_SUBST(enable_pvs_libs)
AC_SUBST(PVS)
AC_SUBST(PVSVERSION)

937 938 939 940
AC_SUBST(enable_isabelle_libs)
AC_SUBST(ISABELLE)
AC_SUBST(ISABELLEVERSION)

941 942
AC_SUBST(enable_hypothesis_selection)

943
AC_SUBST(enable_doc)
944 945
AC_SUBST(enable_html_doc)

946
AC_SUBST(RUBBER)
947 948
AC_SUBST(HEVEA)
AC_SUBST(HACHA)
949 950

AC_SUBST(enable_emacs_compilation)
951
AC_SUBST(EMACS)
952

953 954 955 956 957 958
AC_SUBST(enable_frama_c)

AC_SUBST(FRAMAC)
AC_SUBST(FRAMAC_VERSION)
AC_SUBST(FRAMAC_SHARE)
AC_SUBST(FRAMAC_LIBDIR)
959
AC_SUBST(FRAMAC_INCLUDE)
960

961
AC_SUBST(enable_local)
962 963
AC_SUBST(LOCALDIR)

964 965 966 967
AC_SUBST(enable_why3_lib)
AC_SUBST(WHY3LIB)
AC_SUBST(WHY3INCLUDE)

968 969
AC_SUBST(enable_relocation)

Andrei Paskevich's avatar
Andrei Paskevich committed
970 971
dnl AC_SUBST(PSVIEWER)
dnl AC_SUBST(PDFVIEWER)
972

973
# Finally create the Makefile from Makefile.in
MARCHE Claude's avatar
MARCHE Claude committed
974
AC_CONFIG_FILES(Makefile)
975
AC_CONFIG_FILES(src/config.sh doc/version.tex)
976
AC_CONFIG_FILES(lib/why3/META)
Andrei Paskevich's avatar
Andrei Paskevich committed
977
AC_CONFIG_FILES(.merlin)
978
AC_CONFIG_FILES(src/jessie/Makefile)
MARCHE Claude's avatar
MARCHE Claude committed
979
AC_CONFIG_FILES(src/jessie/.merlin)
980
AC_CONFIG_FILES(lib/coq/version lib/pvs/version)
981
AC_CONFIG_COMMANDS([chmod],
982 983
chmod a-w Makefile src/jessie/Makefile;
chmod a-w src/config.sh doc/version.tex;
984
chmod a-w lib/why3/META;
Andrei Paskevich's avatar
Andrei Paskevich committed
985
chmod a-w .merlin;
986
chmod a-w src/jessie/Makefile;
MARCHE Claude's avatar
MARCHE Claude committed
987
chmod a-w src/jessie/.merlin;
988
chmod a-w lib/coq/version lib/pvs/version;
989 990
chmod u+x src/config.sh)

991
AC_OUTPUT
992

993 994 995 996 997 998

# Summary

echo
echo "                 Summary"
echo "-----------------------------------------"
999 1000 1001 1002 1003 1004
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"
1005
echo "    Compiler plugins        : $enable_compiler_plugins$reason_compiler_plugins"
1006
echo "    Javascript support      : $enable_js_of_ocaml$reason_js_of_ocaml"
1007
echo "Components"
1008
echo "    Why3 library            : $enable_why3_lib"
1009
echo "    GTK IDE                 : $enable_ide$reason_ide"
1010
echo "    Web IDE                 : $enable_web_ide$reason_web_ide"
1011 1012 1013 1014 1015 1016 1017 1018 1019 1020
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"
1021
if test "$enable_doc" = yes ; then
1022 1023
   echo "    PDF                     : yes"
   echo "    HTML                    : $enable_html_doc$reason_html_doc"
1024
fi
1025 1026
echo "Support for interactive proof assistants"
echo "    Coq                     : $enable_coq_support$reason_coq_support"
1027
if test "$enable_coq_support" = yes ; then
1028 1029 1030
   echo "        Version             : $COQVERSION"
   echo "        Library path        : $COQLIB"
   echo "        Realization support : $enable_coq_libs$reason_coq_libs"
1031
   if test "$enable_coq_libs" = yes ; then
1032
      echo "            FP arithmetic   : $enable_coq_fp_libs$reason_coq_fp_libs"
1033
   fi
1034
fi
1035
echo "    PVS                     : $enable_pvs_support$reason_pvs_support"
1036
if test "$enable_pvs_support" = yes ; then
1037 1038 1039
   echo "        Version             : $PVSVERSION"
   echo "        Library path        : $PVSLIB"
   echo "        Realization support : $enable_pvs_libs$reason_pvs_libs"
1040
fi
1041
echo "    Isabelle                : $enable_isabelle_support$reason_isabelle_support"
1042
if test "$enable_isabelle_support" = yes ; then
1043
   echo "        Version             : $ISABELLEVERSION ($ISABELLEDETECTEDVERSION)"
1044
   echo "        Realization support : $enable_isabelle_libs$reason_isabelle_libs"
1045
fi
1046
if test "$enable_local" = yes ; then
1047
   echo "Installable                 : no"
1048
   echo "    OCaml library path      : $OCAMLINSTALLLIB/why3"
1049
else
1050 1051
   echo "Installable                 : yes"
   echo "    Binary path             : $bindir"
1052
   echo "    Library path            : $libdir/why3"
1053
   echo "    Data path               : $datarootdir/why3"
1054
   echo "    OCaml library path      : $OCAMLINSTALLLIB/why3"
1055
   echo "    Relocatable             : $enable_relocation"
1056
fi