configure.in 28 KB
Newer Older
Andrei Paskevich's avatar
Andrei Paskevich committed
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  #
Andrei Paskevich's avatar
Andrei Paskevich committed
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
#                                                                  #
Andrei Paskevich's avatar
Andrei Paskevich committed
10
####################################################################
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
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
#
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
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
#
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
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
#
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
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"]))
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
29

30
# verbosemake
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
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)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
94

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre 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 Filliâtre's avatar
Jean-Christophe Filliâtre 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)

MARCHE Claude's avatar
MARCHE Claude committed
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

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
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>)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
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
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
173

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

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
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'`
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
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

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
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'`
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
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

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
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'`
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
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'`
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
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=
Andrei Paskevich's avatar
Andrei Paskevich committed
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)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
572

Andrei Paskevich's avatar
Andrei Paskevich committed
573
dnl AC_CHECK_PROG(OCAMLWEB,ocamlweb,ocamlweb,true)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
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

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
631
# Coq
632

633
enable_coq_support=yes
634 635
enable_coq_fp_libs=yes

Andrei Paskevich's avatar
Andrei Paskevich committed
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
Guillaume Melquiond's avatar
Guillaume Melquiond committed
659
      8.5*)
660 661
         coq_compat_version="COQ85"
         ;;
Guillaume Melquiond's avatar
Guillaume Melquiond committed
662
      8.6*)
Guillaume Melquiond's avatar
Guillaume Melquiond committed
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
      *)
         enable_coq_support=no
673 674
         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)"
675 676 677 678 679 680 681 682 683 684 685
         ;;
   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
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
686
fi
687 688 689

if test "$enable_coq_support" = no; then
   enable_coq_libs=no
690
   COQVERSION=
691 692
fi

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

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
707 708 709 710 711 712 713 714 715 716 717 718 719 720
# 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)
721
        PVSVERSION=[`$PVS -version | sed -n -e 's|.*Version *\([^ ]*\)$|\1|p'`]
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
722 723

        case $PVSVERSION in
724 725
          6.*)
	        enable_pvs_support=yes
726 727
                AC_MSG_RESULT($PVSVERSION)
                ;;
728
          *)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
729
                AC_MSG_RESULT($PVSVERSION)
730 731 732
                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 Filliâtre's avatar
Jean-Christophe Filliâtre committed
733 734 735 736 737 738 739
                ;;
        esac
    fi
fi

if test "$enable_pvs_support" = no; then
   enable_pvs_libs=no
740
   PVSVERSION=
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
741 742
fi

743 744
# Isabelle

745 746 747 748
# Default version used for generation of realization in the case Isabelle is not
# detected or Why3 is compiled with disable-isabelle.
ISABELLEVERSION=2017

749 750 751 752 753 754
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
755 756 757
       enable_isabelle_support=no
       AC_MSG_WARN(Cannot find isabelle.)
       reason_isabelle_support=" (isabelle not found)"
758 759
    else
        AC_MSG_CHECKING(Isabelle version)
760
        ISABELLEDETECTEDVERSION=[`$ISABELLE version | sed -n -e 's|Isabelle\([^:]*\).*$|\1|p'`]
761

762
        case $ISABELLEDETECTEDVERSION in
763
          2016-1*)
764
	        enable_isabelle_support=yes
765
                ISABELLEVERSION=2016-1
766 767
                AC_MSG_RESULT($ISABELLEDETECTEDVERSION)
                ;;
Stefan Berghofer's avatar
Stefan Berghofer committed
768
          2017*)
769
	        enable_isabelle_support=yes
Stefan Berghofer's avatar
Stefan Berghofer committed
770
                ISABELLEVERSION=2017
771
                AC_MSG_RESULT($ISABELLEDETECTEDVERSION)
772 773
                ;;
          *)
774
                AC_MSG_RESULT($ISABELLEDETECTEDVERSION)
775
                enable_isabelle_support=no
Stefan Berghofer's avatar
Stefan Berghofer committed
776 777
	        AC_MSG_WARN(You need Isabelle 2016-1 or later; Isabelle discarded)
                reason_isabelle_support=" (need version >= 2016-1)"
778 779 780 781 782 783 784 785 786
                ;;
        esac
    fi
fi

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

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

800
#check frama-c
801
FRAMAC_SUPPORTED=Sulfur
802 803 804 805 806 807 808 809
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)
810
      FRAMAC_VERSION=`$FRAMAC -version | sed -n -e 's|\(Version: \)\?\(.*\)$|\2|p'`
811 812
      AC_MSG_RESULT($FRAMAC_VERSION)
      case $FRAMAC_VERSION in
MARCHE Claude's avatar
MARCHE Claude committed
813
         $FRAMAC_SUPPORTED-*) ;;
814
         *) AC_MSG_WARN(Version $FRAMAC_SUPPORTED required.)
815
            enable_frama_c=no
816
            reason_frama_c=" (version $FRAMAC_SUPPORTED required)"
817 818 819 820 821
            ;;
      esac
   fi
fi

822 823 824 825 826 827
if test "$enable_frama_c" = yes; then
   FRAMAC_SHARE=`$FRAMAC -print-path`
   FRAMAC_LIBDIR=`$FRAMAC -print-libpath`
   FRAMAC_INCLUDE="-I $FRAMAC_LIBDIR"
fi

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

832
VERSION=$PACKAGE_VERSION
Andrei Paskevich's avatar
Andrei Paskevich committed
833

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
834
# substitutions to perform
Andrei Paskevich's avatar
Andrei Paskevich committed
835 836 837 838
AC_SUBST(VERSION)

AC_SUBST(enable_verbose_make)

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
839 840 841 842 843 844 845 846 847 848 849 850
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)
851
AC_SUBST(OCAMLINSTALLLIB)
Andrei Paskevich's avatar
Andrei Paskevich committed
852 853
dnl AC_SUBST(OCAMLV)
dnl AC_SUBST(FORPACK)
Andrei Paskevich's avatar
Andrei Paskevich committed
854
AC_SUBST(OCAMLGRAPHLIB)
Andrei Paskevich's avatar
Andrei Paskevich committed
855
dnl AC_SUBST(OCAMLWEB)
856
AC_SUBST(MENHIR)
Andrei Paskevich's avatar
Andrei Paskevich committed
857

858 859
AC_SUBST(enable_profiling)

Andrei Paskevich's avatar
Andrei Paskevich committed
860
AC_SUBST(enable_ide)
861
AC_SUBST(LABLGTK2LIB)
Andrei Paskevich's avatar
Andrei Paskevich committed
862 863
AC_SUBST(LABLGTK2PKG)

864 865
AC_SUBST(enable_web_ide)
AC_SUBST(enable_js_of_ocaml)
866

François Bobot's avatar
META  
François Bobot committed
867
AC_SUBST(META_OCAMLGRAPH)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
868

869 870 871 872
AC_SUBST(enable_compiler_plugins)
AC_SUBST(COMPILERLIBS)
AC_SUBST(COMPILERLIBSPKG)

873 874
AC_SUBST(NUMINCLUDE)

875
AC_SUBST(enable_zarith)
876 877
AC_SUBST(BIGINTINCLUDE)
AC_SUBST(BIGINTLIB)
878
AC_SUBST(BIGINTPKG)
879

880 881 882 883
AC_SUBST(enable_zip)
AC_SUBST(ZIPINCLUDE)
AC_SUBST(ZIPLIB)

884 885
AC_SUBST(MENHIRINCLUDE)

886
AC_SUBST(enable_coq_libs)
887
AC_SUBST(enable_coq_fp_libs)
Andrei Paskevich's avatar
Andrei Paskevich committed
888
AC_SUBST(coq_compat_version)
François Bobot's avatar
META  
François Bobot committed
889

Andrei Paskevich's avatar
Andrei Paskevich committed
890
AC_SUBST(COQC)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
891 892
AC_SUBST(COQDEP)
AC_SUBST(COQLIB)
893
AC_SUBST(COQVERSION)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
894

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
895 896 897 898
AC_SUBST(enable_pvs_libs)
AC_SUBST(PVS)
AC_SUBST(PVSVERSION)

899 900 901 902
AC_SUBST(enable_isabelle_libs)
AC_SUBST(ISABELLE)
AC_SUBST(ISABELLEVERSION)

903 904
AC_SUBST(enable_hypothesis_selection)

905
AC_SUBST(enable_doc)
906 907
AC_SUBST(enable_html_doc)

908
AC_SUBST(RUBBER)
909 910
AC_SUBST(HEVEA)
AC_SUBST(HACHA)
911 912

AC_SUBST(enable_emacs_compilation)
913
AC_SUBST(EMACS)
914

915 916 917 918 919 920
AC_SUBST(enable_frama_c)

AC_SUBST(FRAMAC)
AC_SUBST(FRAMAC_VERSION)
AC_SUBST(FRAMAC_SHARE)
AC_SUBST(FRAMAC_LIBDIR)
921
AC_SUBST(FRAMAC_INCLUDE)
922

923
AC_SUBST(enable_local)
924 925
AC_SUBST(LOCALDIR)

926 927 928 929
AC_SUBST(enable_why3_lib)
AC_SUBST(WHY3LIB)
AC_SUBST(WHY3INCLUDE)

930 931
AC_SUBST(enable_relocation)

Andrei Paskevich's avatar
Andrei Paskevich committed
932 933
dnl AC_SUBST(PSVIEWER)
dnl AC_SUBST(PDFVIEWER)
934

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

953
AC_OUTPUT
954

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
955 956 957 958 959 960

# Summary

echo
echo "                 Summary"
echo "-----------------------------------------"
961 962 963 964 965 966
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"
967
echo "    Compiler plugins        : $enable_compiler_plugins$reason_compiler_plugins"
968
echo "    Javascript support      : $enable_js_of_ocaml$reason_js_of_ocaml"
969
echo "Components"
970
echo "    Why3 library            : $enable_why3_lib"
971
echo "    GTK IDE                 : $enable_ide$reason_ide"
972
echo "    Web IDE                 : $enable_web_ide$reason_web_ide"
973 974 975 976 977 978 979 980 981 982
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"
983
if test "$enable_doc" = yes ; then
984 985
   echo "    PDF                     : yes"
   echo "    HTML                    : $enable_html_doc$reason_html_doc"
986
fi
987 988
echo "Support for interactive proof assistants"
echo "    Coq                     : $enable_coq_support$reason_coq_support"
989
if test "$enable_coq_support" = yes ; then
990 991 992
   echo "        Version             : $COQVERSION"
   echo "        Library path        : $COQLIB"
   echo "        Realization support : $enable_coq_libs$reason_coq_libs"
993
   if test "$enable_coq_libs" = yes ; then
994
      echo "            FP arithmetic   : $enable_coq_fp_libs$reason_coq_fp_libs"
995
   fi
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
996
fi
997
echo "    PVS                     : $enable_pvs_support$reason_pvs_support"
998
if test "$enable_pvs_support" = yes ; then
999 1000 1001
   echo "        Version             : $PVSVERSION"
   echo "        Library path        : $PVSLIB"
   echo "        Realization support : $enable_pvs_libs$reason_pvs_libs"
1002
fi
1003
echo "    Isabelle                : $enable_isabelle_support$reason_isabelle_support"
1004
if test "$enable_isabelle_support" = yes ; then
1005
   echo "        Version             : $ISABELLEVERSION ($ISABELLEDETECTEDVERSION)"
1006
   echo "        Realization support : $enable_isabelle_libs$reason_isabelle_libs"
1007
fi
1008
if test "$enable_local" = yes ; then
1009
   echo "Installable                 : no"
1010
   echo "    OCaml library path      : $OCAMLINSTALLLIB/why3"
1011
else
1012 1013
   echo "Installable                 : yes"
   echo "    Binary path             : $bindir"
1014
   echo "    Library path            : $libdir/why3"
1015
   echo "    Data path               : $datarootdir/why3"
1016
   echo "    OCaml library path      : $OCAMLINSTALLLIB/why3"
1017
   echo "    Relocatable             : $enable_relocation"
1018
fi