configure.in 29.7 KB
Newer Older
1 2 3
####################################################################
#                                                                  #
#  The Why3 Verification Platform   /   The Why3 Development Team  #
Guillaume Melquiond's avatar
Guillaume Melquiond committed
4
#  Copyright 2010-2019   --   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 -I +threads"
526
      fi
527
   fi
528
   if test -z "$DIR"; then
529
      LABLGTKINCLUDE="-I +lablgtk3 -I +threads"
530
      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 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591
      case $GTKVERSION in
        2)
           LIB_SOURCEVIEW=lablgtksourceview2
           PKG_SOURCEVIEW=lablgtk2.sourceview2
           DIR=$(ocamlfind query $PKG_SOURCEVIEW)
           if test -z "$DIR"; then
              PKG_SOURCEVIEW=lablgtksourceview2
              DIR=$(ocamlfind query $PKG_SOURCEVIEW)
           fi
           ;;
        3)
           LIB_SOURCEVIEW=lablgtk3_sourceview3
           PKG_SOURCEVIEW=lablgtk3-sourceview3
           DIR=$(ocamlfind query $PKG_SOURCEVIEW)
           ;;
        *)
           AC_MSG_ERROR(Unknown gtk version $GTKVERSION)
           ;;
      esac
592
      if test -n "$DIR";then
593
         echo "ocamlfind found $PKG_SOURCEVIEW in $DIR"
594
      fi
595
   fi
596
   if test -z "$DIR"; then
597 598
      DIR="$OCAMLLIB/lablgtk$GTKVERSION"
      AC_CHECK_FILE($DIR/lablgtksourceview$GTKVERSION.cma,,enable_ide=no)
599
   fi
600
   AC_CHECK_FILE($DIR/gSourceView$GTKVERSION.cmi,,enable_ide=no)
601
   if test "$enable_ide" = no; then
602 603
      AC_MSG_WARN([Lib lablgtksourceview not found, IDE disabled.])
      reason_ide=" (lablgtksourceview not found)"
604 605
   else
      LABLGTKINCLUDE="$LABLGTKINCLUDE -I $DIR"
606
   fi
Andrei Paskevich's avatar
Andrei Paskevich committed
607
fi
608

Andrei Paskevich's avatar
Andrei Paskevich committed
609
if test "$enable_ide" = yes ; then
610 611 612 613 614 615 616 617 618 619 620 621 622
   case $GTKVERSION in
        2)
           LABLGTKLIB="lablgtk"
           ;;
        3)
           LABLGTKLIB="threads lablgtk3"
           ;;
        *)
           AC_MSG_ERROR(Unknown gtk version $GTKVERSION)
           ;;
      esac
   LABLGTKLIB="$LABLGTKLIB $LIB_SOURCEVIEW"
   LABLGTKPKG="lablgtk$GTKVERSION lablgtk$GTKVERSION.init $PKG_SOURCEVIEW"
Andrei Paskevich's avatar
Andrei Paskevich committed
623
else
624 625 626
   LABLGTKLIB=
   LABLGTKPKG=
   LABLGTKINCLUDE=
Andrei Paskevich's avatar
Andrei Paskevich committed
627 628
fi

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

Andrei Paskevich's avatar
Andrei Paskevich committed
631
dnl AC_CHECK_PROG(OCAMLWEB,ocamlweb,ocamlweb,true)
632

633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661
# 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

662
# checking for js_of_ocaml
663 664 665 666 667 668
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
669 670
   JSOFOCAML=$(ocamlfind query js_of_ocaml)
   if test -z "$JSOFOCAML"; then
671 672
      enable_js_of_ocaml=no
      reason_js_of_ocaml=" (js_of_ocaml not found)"
673
   else
674
      JSOFOCAMLPPX=$(ocamlfind query js_of_ocaml-ppx)
675
      if test -z "$JSOFOCAMLPPX"; then
676 677
         enable_js_of_ocaml=no
         reason_js_of_ocaml=" (js_of_ocaml-ppx not found)"
678 679
      else
         JSOFOCAMLPKG="js_of_ocaml js_of_ocaml.ppx"
680
      fi
681
   fi
682 683 684 685 686 687
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
688
   reason_web_ide=" (Javascript support not available)"
689 690
fi

691
# Coq
692

693
enable_coq_support=yes
694 695
enable_coq_fp_libs=yes

696 697
coq_compat_version=

Guillaume Melquiond's avatar
Guillaume Melquiond committed
698
if test "$enable_coq_libs" = no; then
699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714
   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)
715
   COQVERSION=[`$COQC -v | sed -n -e 's|.*version *\([^ ]*\) .*$|\1|p'`]
716
   AC_MSG_RESULT($COQVERSION)
717 718

   case $COQVERSION in
719
      8.5*)
720 721
         coq_compat_version="COQ85"
         ;;
Guillaume Melquiond's avatar
Guillaume Melquiond committed
722
      8.6*)
723 724
         coq_compat_version="COQ86"
         ;;
Guillaume Melquiond's avatar
Guillaume Melquiond committed
725 726 727
      8.7*)
         coq_compat_version="COQ87"
         ;;
728 729 730
      8.8*)
         coq_compat_version="COQ88"
         ;;
731 732 733
      8.9*)
         coq_compat_version="COQ89"
         ;;
734 735
      *)
         enable_coq_support=no
736 737
         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)"
738 739 740 741 742 743 744 745 746 747 748
         ;;
   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
749
fi
750 751 752

if test "$enable_coq_support" = no; then
   enable_coq_libs=no
753
   COQVERSION=
754 755
fi

756 757 758
if test "$enable_coq_libs" = yes; then
   AC_MSG_CHECKING([for Flocq])
   AS_IF(
759 760
     [ echo "Require Import Flocq.Version BinNat." \
            "Goal (30100 <= Flocq_version)%N. easy. Qed." > conftest.v
761 762 763 764 765
       "$COQC" conftest.v > conftest.err ],
     [ AC_MSG_RESULT(yes) ],
     [ AC_MSG_RESULT(no)
       enable_coq_fp_libs=no
       AC_MSG_WARN(Cannot find Flocq.)
766
       reason_coq_fp_libs=" (Flocq >= 3.1 not found)" ])
767 768 769
   rm -f conftest.v conftest.vo conftest.err
fi

Jean-Christophe's avatar
Jean-Christophe committed
770 771 772 773 774 775 776 777 778 779 780 781 782 783
# 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)
784
        PVSVERSION=[`$PVS -version | sed -n -e 's|.*Version *\([^ ]*\)$|\1|p'`]
Jean-Christophe's avatar
Jean-Christophe committed
785 786

        case $PVSVERSION in
787 788
          6.*)
	        enable_pvs_support=yes
789 790
                AC_MSG_RESULT($PVSVERSION)
                ;;
791
          *)
Jean-Christophe's avatar
Jean-Christophe committed
792
                AC_MSG_RESULT($PVSVERSION)
793 794 795
                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
796 797 798 799 800 801 802
                ;;
        esac
    fi
fi

if test "$enable_pvs_support" = no; then
   enable_pvs_libs=no
803
   PVSVERSION=
Jean-Christophe's avatar
Jean-Christophe committed
804 805
fi

806 807
# Isabelle

808 809
# Default version used for generation of realization in the case Isabelle is not
# detected or Why3 is compiled with disable-isabelle.
810
ISABELLEVERSION=2018
811

812 813 814 815 816 817
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
818 819 820
       enable_isabelle_support=no
       AC_MSG_WARN(Cannot find isabelle.)
       reason_isabelle_support=" (isabelle not found)"
821 822
    else
        AC_MSG_CHECKING(Isabelle version)
823
        ISABELLEDETECTEDVERSION=[`$ISABELLE version | sed -n -e 's|Isabelle\([^:]*\).*$|\1|p'`]
824

825
        case $ISABELLEDETECTEDVERSION in
826
          2018*)
827
	        enable_isabelle_support=yes
828
                ISABELLEVERSION=2018
829 830
                AC_MSG_RESULT($ISABELLEDETECTEDVERSION)
                ;;
831
          2017*)
832
	        enable_isabelle_support=yes
833
                ISABELLEVERSION=2017
834
                AC_MSG_RESULT($ISABELLEDETECTEDVERSION)
835 836
                ;;
          *)
837
                AC_MSG_RESULT($ISABELLEDETECTEDVERSION)
838
                enable_isabelle_support=no
839 840
	        AC_MSG_WARN(You need Isabelle 2017 or later; Isabelle discarded)
                reason_isabelle_support=" (need version >= 2017)"
841 842 843 844 845 846 847 848 849
                ;;
        esac
    fi
fi

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

Jean-Christophe's avatar
Jean-Christophe committed
850
if test "$enable_pvs_libs" = yes; then
851 852 853
   AC_MSG_CHECKING([for NASA PVS library])
   enable_pvs_libs=no
   reason_pvs_libs=" (no NASA PVS library in PVS_LIBRARY_PATH)"
854
   for dir in  `echo $PVS_LIBRARY_PATH | tr ':' ' '`; do
Jean-Christophe's avatar
Jean-Christophe committed
855
       if test -f $dir/nasalib-version; then
856 857
          enable_pvs_libs=yes
          reason_pvs_libs=""
Jean-Christophe's avatar
Jean-Christophe committed
858 859
       fi
   done
860
   AC_MSG_RESULT($enable_pvs_libs)
Jean-Christophe's avatar
Jean-Christophe committed
861 862
fi

863
#check frama-c
864
FRAMAC_SUPPORTED=Sulfur
865 866 867 868 869 870 871 872
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)
873
      FRAMAC_VERSION=`$FRAMAC -version | sed -n -e 's|\(Version: \)\?\(.*\)$|\2|p'`
874 875
      AC_MSG_RESULT($FRAMAC_VERSION)
      case $FRAMAC_VERSION in
876
         $FRAMAC_SUPPORTED-*) ;;
877
         *) AC_MSG_WARN(Version $FRAMAC_SUPPORTED required.)
878
            enable_frama_c=no
879
            reason_frama_c=" (version $FRAMAC_SUPPORTED required)"
880 881 882 883 884
            ;;
      esac
   fi
fi

885 886 887 888 889 890
if test "$enable_frama_c" = yes; then
   FRAMAC_SHARE=`$FRAMAC -print-path`
   FRAMAC_LIBDIR=`$FRAMAC -print-libpath`
   FRAMAC_INCLUDE="-I $FRAMAC_LIBDIR"
fi

891
#Viewer for ps and pdf
Andrei Paskevich's avatar
Andrei Paskevich committed
892 893 894
dnl AC_CHECK_PROGS(PSVIEWER,gv evince)
dnl AC_CHECK_PROGS(PDFVIEWER,xpdf acroread evince)

895
VERSION=$PACKAGE_VERSION
Andrei Paskevich's avatar
Andrei Paskevich committed
896

897
# substitutions to perform
Andrei Paskevich's avatar
Andrei Paskevich committed
898 899 900 901
AC_SUBST(VERSION)

AC_SUBST(enable_verbose_make)

902 903 904 905 906 907 908 909 910 911 912 913
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)
914
AC_SUBST(OCAMLINSTALLLIB)
Andrei Paskevich's avatar
Andrei Paskevich committed
915 916
dnl AC_SUBST(OCAMLV)
dnl AC_SUBST(FORPACK)
917
AC_SUBST(OCAMLGRAPHLIB)
Andrei Paskevich's avatar
Andrei Paskevich committed
918
dnl AC_SUBST(OCAMLWEB)
919
AC_SUBST(MENHIR)
Andrei Paskevich's avatar
Andrei Paskevich committed
920

921 922
AC_SUBST(enable_profiling)

Andrei Paskevich's avatar
Andrei Paskevich committed
923
AC_SUBST(enable_ide)
924 925 926 927
AC_SUBST(LABLGTKLIB)
AC_SUBST(LABLGTKPKG)
AC_SUBST(LABLGTKINCLUDE)
AC_SUBST(GTKVERSION)
Andrei Paskevich's avatar
Andrei Paskevich committed
928

929 930
AC_SUBST(enable_web_ide)
AC_SUBST(enable_js_of_ocaml)
931
AC_SUBST(JSOFOCAMLPKG)
932

François Bobot's avatar
François Bobot committed
933
AC_SUBST(META_OCAMLGRAPH)
934

935 936 937 938
AC_SUBST(enable_compiler_plugins)
AC_SUBST(COMPILERLIBS)
AC_SUBST(COMPILERLIBSPKG)

939 940
AC_SUBST(NUMINCLUDE)

941
AC_SUBST(enable_zarith)
942 943
AC_SUBST(BIGINTINCLUDE)
AC_SUBST(BIGINTLIB)
944
AC_SUBST(BIGINTPKG)
945

946 947 948 949
AC_SUBST(enable_zip)
AC_SUBST(ZIPINCLUDE)
AC_SUBST(ZIPLIB)

950 951
AC_SUBST(MENHIRINCLUDE)

952
AC_SUBST(enable_coq_libs)
953
AC_SUBST(enable_coq_fp_libs)
954
AC_SUBST(coq_compat_version)
François Bobot's avatar
François Bobot committed
955

Andrei Paskevich's avatar
Andrei Paskevich committed
956
AC_SUBST(COQC)
957 958
AC_SUBST(COQDEP)
AC_SUBST(COQLIB)
959
AC_SUBST(COQVERSION)
960

Jean-Christophe's avatar
Jean-Christophe committed
961 962 963 964
AC_SUBST(enable_pvs_libs)
AC_SUBST(PVS)
AC_SUBST(PVSVERSION)

965 966 967 968
AC_SUBST(enable_isabelle_libs)
AC_SUBST(ISABELLE)
AC_SUBST(ISABELLEVERSION)

969 970
AC_SUBST(enable_hypothesis_selection)

971
AC_SUBST(enable_doc)
972 973
AC_SUBST(enable_html_doc)

974
AC_SUBST(RUBBER)
975 976
AC_SUBST(HEVEA)
AC_SUBST(HACHA)
977 978

AC_SUBST(enable_emacs_compilation)
979
AC_SUBST(EMACS)
980

981 982 983 984 985 986
AC_SUBST(enable_frama_c)

AC_SUBST(FRAMAC)
AC_SUBST(FRAMAC_VERSION)
AC_SUBST(FRAMAC_SHARE)
AC_SUBST(FRAMAC_LIBDIR)
987
AC_SUBST(FRAMAC_INCLUDE)
988

989
AC_SUBST(enable_local)
990 991
AC_SUBST(LOCALDIR)

992 993 994 995
AC_SUBST(enable_why3_lib)
AC_SUBST(WHY3LIB)
AC_SUBST(WHY3INCLUDE)

996 997
AC_SUBST(enable_relocation)

Andrei Paskevich's avatar
Andrei Paskevich committed
998 999
dnl AC_SUBST(PSVIEWER)
dnl AC_SUBST(PDFVIEWER)
1000

1001
# Finally create the Makefile from Makefile.in
MARCHE Claude's avatar
MARCHE Claude committed
1002
AC_CONFIG_FILES(Makefile)
1003
AC_CONFIG_FILES(src/config.sh doc/version.tex)
1004
AC_CONFIG_FILES(lib/why3/META)
Andrei Paskevich's avatar
Andrei Paskevich committed
1005
AC_CONFIG_FILES(.merlin)
1006
AC_CONFIG_FILES(src/jessie/Makefile)
MARCHE Claude's avatar
MARCHE Claude committed
1007
AC_CONFIG_FILES(src/jessie/.merlin)
1008
AC_CONFIG_FILES(lib/coq/version lib/pvs/version)
1009
AC_CONFIG_COMMANDS([chmod],
1010 1011
chmod a-w Makefile src/jessie/Makefile;
chmod a-w src/config.sh doc/version.tex;
1012
chmod a-w lib/why3/META;
Andrei Paskevich's avatar
Andrei Paskevich committed
1013
chmod a-w .merlin;
1014
chmod a-w src/jessie/Makefile;
MARCHE Claude's avatar
MARCHE Claude committed
1015
chmod a-w src/jessie/.merlin;
1016
chmod a-w lib/coq/version lib/pvs/version;
1017 1018
chmod u+x src/config.sh)

1019
AC_OUTPUT
1020

1021 1022 1023 1024 1025 1026

# Summary

echo
echo "                 Summary"
echo "-----------------------------------------"
1027 1028 1029 1030 1031 1032
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"
1033
echo "    Compiler plugins        : $enable_compiler_plugins$reason_compiler_plugins"
1034
echo "    Javascript support      : $enable_js_of_ocaml$reason_js_of_ocaml"
1035
echo "Components"
1036
echo "    Why3 library            : $enable_why3_lib"
1037
echo "    GTK IDE                 : $enable_ide$reason_ide"
1038
echo "    Web IDE                 : $enable_web_ide$reason_web_ide"
1039 1040 1041 1042 1043 1044 1045 1046 1047 1048
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"
1049
if test "$enable_doc" = yes ; then
1050 1051
   echo "    PDF                     : yes"
   echo "    HTML                    : $enable_html_doc$reason_html_doc"
1052
fi
1053 1054
echo "Support for interactive proof assistants"
echo "    Coq                     : $enable_coq_support$reason_coq_support"
1055
if test "$enable_coq_support" = yes ; then
1056 1057 1058
   echo "        Version             : $COQVERSION"
   echo "        Library path        : $COQLIB"
   echo "        Realization support : $enable_coq_libs$reason_coq_libs"
1059
   if test "$enable_coq_libs" = yes ; then
1060
      echo "            FP arithmetic   : $enable_coq_fp_libs$reason_coq_fp_libs"
1061
   fi
1062
fi
1063
echo "    PVS                     : $enable_pvs_support$reason_pvs_support"
1064
if test "$enable_pvs_support" = yes ; then
1065 1066 1067
   echo "        Version             : $PVSVERSION"
   echo "        Library path        : $PVSLIB"
   echo "        Realization support : $enable_pvs_libs$reason_pvs_libs"
1068
fi
1069
echo "    Isabelle                : $enable_isabelle_support$reason_isabelle_support"
1070
if test "$enable_isabelle_support" = yes ; then
1071
   echo "        Version             : $ISABELLEVERSION ($ISABELLEDETECTEDVERSION)"
1072
   echo "        Realization support : $enable_isabelle_libs$reason_isabelle_libs"
1073
fi
1074
if test "$enable_local" = yes ; then
1075
   echo "Installable                 : no"
1076
   echo "    OCaml library path      : $OCAMLINSTALLLIB/why3"
1077
else
1078 1079
   echo "Installable                 : yes"
   echo "    Binary path             : $bindir"
1080
   echo "    Library path            : $libdir/why3"
1081
   echo "    Data path               : $datarootdir/why3"
1082
   echo "    OCaml library path      : $OCAMLINSTALLLIB/why3"
1083
   echo "    Relocatable             : $enable_relocation"
1084
fi