-
Notifications
You must be signed in to change notification settings - Fork 33
/
configure
executable file
·770 lines (677 loc) · 20.4 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
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
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
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
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
#! /bin/sh
# configuration script for Apron
#
# generates automatically a suitable Makefile.config
##############################################
# help
#######
help()
{
cat <<EOF
usage: configure [options]
where options include:
-prefix dir installation directory
-gmp-prefix dir where to find the GMP library
-mpfr-prefix dir where to find the MPFR library
-ppl-prefix dir where to find the PPL library
-pplite-prefix dir where to find the PPLite library
-flint-prefix dir where to find the Flint library (for PPLite only)
-glpk-prefix dir where to find the GLPK library
-java-prefix dir where to find Java
-no-cxx disable C++ support
-no-ocaml disable OCaml support
-no-ocamlfind disable OCamlfind support
-no-ocaml-plugins disable OCaml native plugins
-no-ppl disable PPL support
-no-pplite disable PPLite support
-no-glpk disable GLPK support
-no-java disable Java support
-absolute-dylibs force absolute library names (OSX only)
-debug install also debug library version
-no-strip don't strip libraries
Environment variables that affect configuration:
CC C compiler to use (default: gcc)
CXX C++ compiler to use (default: g++)
CFLAGS extra flags to pass to the C compiler
CXXFLAGS extra flags to pass to the C++ compiler
CPPFLAGS extra flags to pass to the C/C++ preprocessor
LDFLAGS extra link flags
GMP_PREFIX where to find the GMP library
MPFR_PREFIX where to find the MPFR library
PPL_PREFIX where to find the PPL library
PPLITE_PREFIX where to find the PPLite library
FLINT_PREFIX where to find the FLINT library
GLPK_PREFIX where to find the GLPK library
JAVA_HOME where to find Java
EOF
exit
}
##############################################
# parse arguments
#################
apron_prefix=/usr/local
has_cxx=1
has_ppl=1
has_pplite=1
has_glpk=1
has_ocaml=1
has_ocamlfind=1
has_ocaml_plugins=1
has_java=1
force_absolute_dylib_install_names=0;
ext_dll=so
has_debug=0
strip="strip --strip-unneeded"
while : ; do
case "$1" in
"")
break;;
-prefix|--prefix)
apron_prefix="$2"
shift;;
-gmp-prefix|--gmp-prefix)
gmp_prefix="$2"
shift;;
-mpfr-prefix|--mpfr-prefix)
mpfr_prefix="$2"
shift;;
-ppl-prefix|--ppl-prefix)
ppl_prefix="$2"
shift;;
-pplite-prefix|--pplite-prefix)
pplite_prefix="$2"
shift;;
-flint-prefix|--flint-prefix)
flint_prefix="$2"
shift;;
-glpk-prefix|--glpk-prefix)
glpk_prefix="$2"
shift;;
-java-prefix|--java-prefix)
java_prefix="$2"
shift;;
-ext-dll|--ext-dll)
ext_dll="$2"
shift;;
-no-cxx|--no-cxx)
has_cxx=0
has_ppl=0
has_pplite=0;;
-no-ppl|--no-ppl)
has_ppl=0;;
-no-pplite|--no-pplite)
has_pplite=0;;
-no-glpk|--no-glpk)
has_glpk=0;;
-no-ocaml|--no-ocaml)
has_ocaml=0;;
-no-ocamlfind|--no-ocamlfind)
has_ocamlfind=0;;
-no-ocaml-plugins|--no-ocaml-plugins)
has_ocaml_plugins=0;;
-no-java|--no-java)
has_java=0;;
-absolute-dylibs|--absolute-dylibs)
force_absolute_dylib_install_names=1;;
-debug|--debug)
has_debug=1;;
-no-strip|--no-strip)
strip=echo;;
-help|--help)
help;;
*)
echo "unknown option $1, try -help"
exit 2;;
esac
shift
done
##############################################
# utilities
###########
# print utility
echo_n()
{
echo "$1" | tr -d '\012'
}
# checkcc cc opt
# checks that compiler cc can compile a simple program with option opt
# if so, add it to acc
checkcomp()
{
testcc="$1"
testopt="$2";
echo_n "checking compilation with $testcc $testopt: "
rm -f tmp.c tmp.out
echo "int main() { return 1; }" >> tmp.c
r=1
$testcc $testopt tmp.c -o tmp.out >/dev/null 2>/dev/null || r=0
if test ! -x tmp.out; then r=0; fi
rm -f tmp.c tmp.o tmp.out
if test $r -eq 0; then
echo "not working"
else
acc="$acc $testopt"
echo "working"
fi
return $r
}
# checking include file
checkinc()
{
testcc="$1"
testinc="$2"
echo_n "include $testinc: "
rm -f tmp.c tmp.o
echo "#include <$testinc>" > tmp.c
echo "int main() { return 1; }" >> tmp.c
r=1
$testcc -c tmp.c -o tmp.o >/dev/null 2>/dev/null || r=0
if test ! -f tmp.o; then r=0; fi
rm -f tmp.c tmp.o
if test $r -eq 0; then echo "not found"; else echo "found"; fi
return $r
}
# checking library
checklib()
{
testcc="$1"
testlib="$2"
echo_n "library $testlib: "
rm -f tmp.c tmp.out
echo "int main() { return 1; }" >> tmp.c
r=1
$testcc tmp.c -l$testlib -o tmp.out >/dev/null 2>/dev/null || r=0
if test ! -x tmp.out; then r=0; fi
rm -f tmp.c tmp.o tmp.out
if test $r -eq 0; then echo "not found"; else echo "found"; fi
return $r
}
# checkprefix include lib
#
# tries to find a prefix needed to get the library
checkprefix()
{
testcc="$1"
testinc="$2"
testlib="$3"
testprefix="$4"
# try without any prefix (unless the user forced a prefix)
if test "x$testprefix" = "x"
then
echo "looking for $testlib without prefix"
prefix=""
checkinc "$testcc" "$testinc"
if test $r -eq 1
then
checklib "$testcc" "$testlib"
if test $r -eq 1
then
echo "library $testlib found without prefix"
return 1
fi
fi
fi
# check with a prefix
for prefix in $testprefix /usr/local /opt/homebrew /usr "$HOME"
do
echo "looking for $testlib in prefix $prefix"
checkinc "$testcc -I$prefix/include" "$testinc"
if test $r -eq 1
then
checklib "$testcc -L$prefix/lib" "$testlib"
if test $r -eq 1
then
echo "library $testlib found with prefix $prefix"
return 1
fi
fi
done
echo "library $testlib not found"
return 0
}
# checking binaries in $PATH
searchbin()
{
if test "x$1" = "x"; then return 0; fi
echo_n "binary $1: "
IFS=':'
path=""
for i in $PATH
do
if test -z "$i"; then i='.'; fi
if test -x "$i/$1"
then
echo "found in $i"
path="$i/$1"
unset IFS
return 1
fi
done
echo "not found"
unset IFS
return 0
}
searchbinreq()
{
searchbin $1
if test $? -eq 0; then echo "required program $1 not found"; exit 1; fi
}
checkdirinpath()
{
dir="$1"
path="$2"
echo_n "checking whether $1 belongs to $3: "
# env bash -c '[[ ":'${path}':" == *":'${dir}':"* ]]';
# if test $? -eq 1; then echo "no"; return 1; fi
IFS=':'
found=0
for d in $path
do
if test "$d" -ef "$dir"; then found=1; fi
done
unset IFS;
if test $found -eq 0; then echo "no"; return 1; fi
echo "yes"
}
# checking support for OCaml native plugins
checkcmxs()
{
testocamlopt="$1"
echo_n "checking support for native plugins: "
rm -f tmp.ml tmp.cmxs
echo "let f = ()" >> tmp.ml
r=1
$testocamlopt tmp.ml -a -o tmp.cmxa >/dev/null 2>/dev/null && \
$testocamlopt -shared -o tmp.cmxs tmp.cmxa >/dev/null 2>/dev/null || r=0
if test ! -x tmp.cmxs; then r=0; fi
rm -f tmp.ml tmp.cmxa tmp.cmxs tmp.a tmp.cmi tmp.cmx
if test $r -eq 0; then
echo "not working"
else
echo "working"
fi
return $r
}
#####################################
# tests
#######
# Flags common to c and c++ compilation
c_cxx_flags="-Wcast-qual -Wswitch -Wall -Wextra -Wundef -Wcast-align \
-Wno-unused -Wno-unused-parameter -Wno-unused-function -fPIC \
-Wno-stringop-overflow"
# System-based selection of default compilers
case $(uname -s)-$(uname -r)
in
FreeBSD-9.*)
# NB: Select clang as default compiler on FreeBSD-9.* as gcc
# on this system is known to trigger some bugs when compiling
# Apron (like "junk `(%rip)' after expression"). See
# `https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52554'
echo "FreeBSD-9.* system detected:"\
"default C/C++ compilers set to clang/clang++"
cc_compilers="$CC clang"
cxx_compilers="$CXX clang++"
;;
*)
cc_compilers="$CC cc gcc clang"
cxx_compilers="$CXX c++ g++ clang++"
;;
esac
# C compiler
cc="none"
for i in $cc_compilers
do
checkcomp "$i" ""
if test $? -eq 1; then cc="$i"; break; fi
done
if test "$cc" = "none"; then echo "no C compiler found"; exit 1; fi
acc=""
for i in $c_cxx_flags -Werror-implicit-function-declaration -Wbad-function-cast -Wstrict-prototypes stringop-overflow -std=c99 $CFLAGS $LDFLAGS
do
checkcomp "$cc" "$i"
done
cflags=$acc
# C++ compiler
if test $has_cxx -eq 1
then
has_cxx=0
for i in $cxx_compilers
do
checkcomp "$i" ""
if test $? -eq 1; then has_cxx=1; cxx="$i"; break; fi
done
fi
if test $has_cxx -eq 1
then
acc=""
for i in $c_cxx_flags $CXXFLAGS $LDFLAGS
do
checkcomp "$cxx" "$i"
done
cxxflags=$acc
fi
# tools
searchbinreq "ar"; ar="$path"
searchbinreq "ranlib"; ranlib="$path"
searchbinreq "sed"; sed="$path"
#searchbinreq "perl"; perl="$path"
searchbinreq "install"; install="$path"
# C libraries
if test "x$gmp_prefix" != "x"; then GMP_PREFIX="$gmp_prefix"; fi
checkprefix "$cc $cflags" gmp.h gmp "$GMP_PREFIX"
if test $? -eq 0; then echo "GMP not found, set GMP_PREFIX"; exit 1; fi
gmp_prefix="$prefix"
if test "x$mpfr_prefix" != "x"; then MPFR_PREFIX="$mpfr_prefix"; fi
# the check for mpfr depends on gmp
deps=""
if test "x$gmp_prefix" != "x"; then deps="$deps -I$gmp_prefix/include"; fi
checkprefix "$cc $cflags $deps" mpfr.h mpfr "$MPFR_PREFIX"
if test $? -eq 0; then echo "MPFR not found, set MPFR_PREFIX"; exit 1; fi
mpfr_prefix="$prefix"
if test $has_cxx -eq 1 -a $has_ppl -eq 1
then
# the check for ppl depends on gmp (and gmpxx)
deps=""
if test "x$gmp_prefix" != "x"; then deps="$deps -I$gmp_prefix/include"; fi
if test "x$ppl_prefix" != "x"; then PPL_PREFIX="$ppl_prefix"; fi
checkprefix "$cxx $cxxflags $deps" ppl.hh ppl "$PPL_PREFIX"
if test $? -eq 0; then has_ppl=0; fi
ppl_prefix="$prefix"
else
has_ppl=0
fi
get_pplite_version()
{
echo_n "getting PPLite version: "
rm -f tmp.cc tmp
echo "#include <iostream>" > tmp.cc
echo "#include <pplite/pplite-config.h>" >> tmp.cc
echo "int main() {" >> tmp.cc
echo " std::cout << PPLITE_PACKAGE_VERSION << std::endl;" >> tmp.cc
echo "}" >> tmp.cc
r=1
if test "x$pplite_prefix" != "x"
then
$cxx $cxxflags $deps -I$pplite_prefix/include -o tmp tmp.cc >/dev/null 2>/dev/null || r=0
else
$cxx $cxxflags $deps -o tmp tmp.cc >/dev/null 2>/dev/null || r=0
fi
if test $r -eq 0 -o ! -f tmp
then
r=0
pplite_version="not found"
else
r=1
pplite_version=`./tmp`
fi
echo $pplite_version
rm -f tmp.cc tmp
return $r
}
if test $has_cxx -eq 1 -a $has_pplite -eq 1
then
# check for flint
if test "x$flint_prefix" != "x"; then FLINT_PREFIX="$flint_prefix"; fi
# the check for flint depends on mpfr and gmp
deps=""
if test "x$gmp_prefix" != "x"; then deps="$deps -I$gmp_prefix/include"; fi
if test "x$mpfr_prefix" != "x"; then deps="$deps -I$mpfr_prefix/include"; fi
checkprefix "$cc $cflags $deps" flint/fmpz.h flint "$FLINT_PREFIX"
if test $? -eq 0; then has_flint=0; else has_flint=1; fi
flint_prefix="$prefix"
if test $has_flint -eq 0
then
has_pplite=0;
else
# check for pplite (the check does not depend on flint)
if test "x$pplite_prefix" != "x"; then PPLITE_PREFIX="$pplite_prefix"; fi
checkprefix "$cxx $cxxflags -std=c++11" pplite/globals.hh pplite "$PPLITE_PREFIX"
if test $? -eq 0; then has_pplite=0; fi
pplite_prefix="$prefix"
fi
# check if pplite version is 0.11
if test $has_pplite -eq 1
then
get_pplite_version
if test "x$pplite_version" != "x0.11"
then
have_pplite_0_11_cxxflags=
else
have_pplite_0_11_cxxflags=-DHAVE_PPLITE_0_11
fi
fi
else
has_pplite=0
fi
if test $has_glpk -eq 1
then
if test "x$glpk_prefix" != "x"; then GLPK_PREFIX="$glpk_prefix"; fi
checkprefix "$cc $cflags" glpk.h glpk "$GLPK_PREFIX"
if test $? -eq 0; then has_glpk=0; fi
glpk_prefix="$prefix"
fi
# OCaml environment
# check OCaml binaries
if test $has_ocaml -eq 1; then searchbin "ocamlc.opt"; has_ocaml=$?; ocamlc="$path"; fi
if test $has_ocaml -eq 1; then searchbin "ocamlopt.opt"; has_ocaml=$?; ocamlopt="$path"; fi
if test $has_ocaml -eq 1; then searchbin "ocamldep"; has_ocaml=$?; ocamldep="$path"; fi
if test $has_ocaml -eq 1; then searchbin "ocamllex"; has_ocaml=$?; ocamllex="$path"; fi
if test $has_ocaml -eq 1; then searchbin "ocamlyacc"; has_ocaml=$?; ocamlyacc="$path"; fi
if test $has_ocaml -eq 1; then searchbin "ocamldoc"; has_ocaml=$?; ocamldoc="$path"; fi
if test $has_ocaml -eq 1; then searchbin "ocamlmktop"; has_ocaml=$?; ocamlmktop="$path"; fi
if test $has_ocaml -eq 1; then searchbin "ocamlmklib"; has_ocaml=$?; ocamlmklib="$path"; fi
if test $has_ocaml -eq 1; then searchbin "camlidl"; has_ocaml=$?; camlidl="$path"; fi
# optional ocamlfind
if test $has_ocamlfind -eq 1
then
has_ocamlfind=0
if test $has_ocaml -eq 1; then searchbin "ocamlfind"; has_ocamlfind=1; ocamlfind="$path"; fi
fi
# guess prefix
if test $has_ocamlfind -eq 1
then
caml_prefix=`$ocamlfind printconf stdlib`
camlidl_prefix=`$ocamlfind query camlidl`
if test "x$camlidl_prefix" = "x"; then camlidl_prefix=`$ocamlc -where`; fi
mlgmpidl_prefix=`$ocamlfind query gmp`
if test "x$mlgmpidl_prefix" = "x"; then mlgmpidl_prefix=`$ocamlc -where`; fi
else
# sane default (but does not work with OPAM)
caml_prefix=`$ocamlc -where`
camlidl_prefix=`$ocamlc -where`
mlgmpidl_prefix=`$ocamlc -where`
fi
# test that we can actually build plugins
if test $has_ocaml_plugins -eq 1; then checkcmxs "$ocamlopt"; has_ocaml_plugins=$?; fi
# check that the prefix is correct
if test $has_ocaml -eq 1
then
checkinc "$cc $cflags -I$caml_prefix" caml/mlvalues.h
has_ocaml=$?
fi
if test $has_ocaml -eq 1
then
checkinc "$cc $cflags -I$caml_prefix -I$camlidl_prefix" caml/camlidlruntime.h
has_ocaml=$?
fi
if test $has_ocaml -eq 1
then
cc_cmd="$cc $cflags -I$caml_prefix -I$mlgmpidl_prefix";
if test "x$gmp_prefix" != "x"; then cc_cmd="$cc_cmd -I$gmp_prefix/include"; fi
if test "x$mpfr_prefix" != "x"; then cc_cmd="$cc_cmd -I$mpfr_prefix/include"; fi
checkinc "$cc_cmd" gmp_caml.h
has_ocaml=$?
fi
# Java environment
# check Java binaries
if test "x$java_prefix" != "x"; then JAVA_HOME="$java_prefix"; fi
if test "x$JAVA_HOME" != "x"; then PATH=$JAVA_HOME/bin:$PATH; fi
if test $has_java -eq 1; then searchbin "java"; has_java=$?; java="$path"; fi
if test $has_java -eq 1; then searchbin "javac"; has_java=$?; javac="$path"; fi
if test $has_java -eq 1; then searchbin "javadoc"; has_java=$?; javadoc="$path"; fi
if test $has_java -eq 1; then searchbin "jar"; has_java=$?; jar="$path"; fi
# check Java version
if test $has_java -eq 1
then
java_version=`$java -version 2>&1 | grep version | cut -d'"' -f2 | sed 's/\(1\.\)\{0,1\}\([0-9]*\).*/\2/'`
if test $java_version -ge 9
then
# new Java use javac -h
javac_has_h=1
else
# unsupported due to the lack of Cleaner interface
echo "Java < 9 is no longer supported, disabling Java API"
has_java=0
fi
fi
# check jni includes
if test $has_java -eq 1
then
checkinc "$cc $cflags -I$JAVA_HOME/include -I$JAVA_HOME/include/linux" jni.h
if test $? -eq 0; then echo "JNI not found, please set JAVA_HOME"; has_java=0; fi
fi
##############################################
# Custom tests
##############
# Use abolute dynamic library names under OSX when explicitly asked,
# or when the installation prefix does not belong to DYLD_LIBRARY_PATH
# nor DYLD_FALLBACK_LIBRARY_PATH or
# '$(HOME)/lib:/usr/local/lib:/lib:/usr/lib' (the default fallback).
absolute_dylib_install_names=;
if test "x$(uname -s)" = "xDarwin"
then
if test $force_absolute_dylib_install_names -eq 1
then
echo "using absolute dynamic library install names as requested"
absolute_dylib_install_names=1
else
libdir="${apron_prefix}/lib"
if test "x$DYLD_FALLBACK_LIBRARY_PATH" != "x"
then
fldpath="$DYLD_FALLBACK_LIBRARY_PATH"
else
fldpath="$HOME/lib:/usr/local/lib:/lib:/usr/lib"
fi
checkdirinpath "${libdir}" "$DYLD_LIBRARY_PATH" "DYLD_LIBRARY_PATH" || \
checkdirinpath "${libdir}" "${fldpath}" "DYLD_FALLBACK_LIBRARY_PATH"
if test $? -eq 1
then
echo "forcing absolute dynamic library install names"
absolute_dylib_install_names=1
fi
fi
else
if test $force_absolute_dylib_install_names -eq 1
then
echo "ignoring option \`-absolute-dylibs', only meaningful under OSX";
fi
fi
if test "x$(uname -s)" = "xLinux"
then
linux_install_soname=1
fi
##############################################
# log
#####
cat <<EOF
detected configuration:
optional OCaml support $has_ocaml
optional OCamlFind support $has_ocamlfind
optional plugins support $has_ocaml_plugins
optional C++ support $has_cxx
optional Java support $has_java ($java_version)
optional PPL support $has_ppl
optional PPLite support $has_pplite ($pplite_version)
optional GLPK support $has_glpk
optional debug libraries $has_debug
installation path $apron_prefix
dynamic libraries extension $ext_dll
install command $install
strip command $strip
EOF
test "x$absolute_dylib_install_names" = "x1" && cat <<EOF
dynamic libraries shall use absolute install names
EOF
##############################################
# generation
############
if test "$has_cxx" -eq 0; then has_cxx=; fi
if test "$has_ocaml" -eq 0; then has_ocaml=; fi
if test "$has_ocaml_plugins" -eq 0; then has_ocaml_plugins=; fi
if test "$has_java" -eq 0; then has_java=; fi
if test "$has_ppl" -eq 0; then has_ppl=; fi
if test "$has_pplite" -eq 0; then has_pplite=; fi
if test "$has_glpk" -eq 0; then has_glpk=; fi
if test "$has_debug" -eq 0; then has_debug=; fi
cat > Makefile.config <<EOF
# generated by ./configure
HAS_OCAML = $has_ocaml
HAS_OCAMLOPT = $has_ocaml
HAS_NATIVE_PLUGINS = $has_ocaml_plugins
HAS_MPFR = 1
HAS_PPL = $has_ppl
HAS_PPLITE = $has_pplite
HAS_GLPK = $has_glpk
HAS_CPP = $has_cxx
HAS_LONG_DOUBLE = 1
HAS_SHARED = 1
HAS_JAVA = $has_java
HAS_DEBUG = $has_debug
APRON_PREFIX = $apron_prefix
MLGMPIDL_PREFIX = $mlgmpidl_prefix
PPL_PREFIX = $ppl_prefix
PPLITE_PREFIX = $pplite_prefix
FLINT_PREFIX = $flint_prefix
GLPK_PREFIX = $glpk_prefix
GMP_PREFIX = $gmp_prefix
MPFR_PREFIX = $mpfr_prefix
JAVA_PREFIX = $apron_prefix/lib
JAVA = $java
JAVAC = $javac -Xlint:unchecked
JAVAH = $javah
JAVAC_HAS_H = $javac_has_h
JAVADOC = $javadoc -encoding UTF-8
JAR = $jar
JAVA_HOME = ${JAVA_HOME}
JNIINC = -I${JAVA_HOME}/INCLUDE
CC = $cc
CFLAGS = -U__STRICT_ANSI__ -DNDEBUG -O3 $cflags
CFLAGS_DEBUG = -U__STRICT_ANSI__ -UNDEBUG -O0 -g $cflags
CXX = $cxx
CXXFLAGS = -U__STRICT_ANSI__ -DNDEBUG -O3 $cxxflags
CXXFLAGS_DEBUG = -U__STRICT_ANSI__ -UNDEBUG -O0 -g $cxxflags
# The PPLite wrapper requires using the C++11 language standard
PPLITE_CXXFLAGS = -std=c++11 -DNDEBUG -O3 $have_pplite_0_11_cxxflags $cxxflags
PPLITE_CXXFLAGS_DEBUG = -std=c++11 -UNDEBUG -O0 -g $have_pplite_0_11_cxxflags $cxxflags
EXT_DLL = $ext_dll
AR = $ar
RANLIB = $ranlib
SED = $sed
PERL = perl
INSTALL = $install
STRIP = $strip
INSTALLd = $install -d
CAML_PREFIX = $caml_prefix
CAMLIDL_PREFIX = $camlidl_prefix
OCAMLC = $ocamlc
OCAMLOPT = $ocamlopt
OCAMLFLAGS = -g
OCAMLOPTFLAGS = -inline 20
OCAMLDEP = $ocamldep
OCAMLLEX = $ocamllex
OCAMLYACC = $ocamlyacc
OCAMLDOC = $ocamldoc
OCAMLMKTOP = $ocamlmktop
OCAMLMKLIB = $ocamlmklib
CAMLIDL = $camlidl
OCAMLFIND = $ocamlfind
# TODO: to be configured
LATEX = latex
PDFLATEX = pdflatex
DVIPDF = dvipdf
MAKEINDEX = makeindex
TEXI2ANY = texi2any
# OSX only:
ABSOLUTE_DYLIB_INSTALL_NAMES = $absolute_dylib_install_names
LINUX_INSTALL_SONAME = $linux_install_soname
EOF