forked from mozart/mozart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aclocal.m4
1571 lines (1418 loc) · 43.8 KB
/
aclocal.m4
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
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
dnl -*- m4 -*-
dnl
dnl Authors:
dnl Denys Duchier ([email protected])
dnl Michael Mehl ([email protected])
dnl
dnl Copyright:
dnl Denys Duchier (1998)
dnl
dnl Last change:
dnl $Date$ by $Author$
dnl $Revision$
dnl
dnl This file is part of Mozart, an implementation
dnl of Oz 3:
dnl http://www.mozart-oz.org
dnl
dnl See the file "LICENSE" or
dnl http://www.mozart-oz.org/LICENSE.html
dnl for information on usage and redistribution
dnl of this file, and for a DISCLAIMER OF ALL
dnl WARRANTIES.
dnl
dnl ==================================================================
dnl SRCDIR, SRCTOP, BUILDTOP
dnl ==================================================================
dnl ------------------------------------------------------------------
dnl OZ_PATH_SRCDIR
dnl
dnl makes sure that $srcdir is absolute and sets SRCDIR. Obviously
dnl this one _must_ not be cached or else recursive configure will
dnl become very confused
dnl ------------------------------------------------------------------
AC_DEFUN(OZ_PATH_SRCDIR,[
srcdir=`cd $srcdir && pwd`
SRCDIR="$srcdir"
AC_SUBST(SRCDIR)
])
dnl ------------------------------------------------------------------
dnl OZ_PATH_UPWARD(VAR,DIR,FILES)
dnl
dnl looks upward from DIR for a directory that contains one of the
dnl FILES and sets VAR to the abolute path to this directory, else
dnl leaves VAR unchanged. First it looks upward for the 1st file, if
dnl it does not find it, then it tries with the next file, etc...
dnl Thus you should list first the files that are more surely
dnl characteristic of the directory that you are looking for, and last
dnl those files that are strongly indicative, but not necessarily
dnl sure bets.
dnl ------------------------------------------------------------------
AC_DEFUN(OZ_PATH_UPWARD,[
oz_tmp_dir=[$2]
oz_tmp_ok=
oz_for="[$3]"
for oz_tmp1 in $oz_for; do
for oz_tmp2 in $oz_tmp_dir \
$oz_tmp_dir/.. \
$oz_tmp_dir/../.. \
$oz_tmp_dir/../../.. \
$oz_tmp_dir/../../../.. \
$oz_tmp_dir/../../../../..; do
if test -r "$oz_tmp2/$oz_tmp1"; then
[$1]=`cd $oz_tmp2 && pwd`
oz_tmp_ok=yes
break
fi
done
test -n "$oz_tmp_ok" && break
done])
dnl ------------------------------------------------------------------
dnl OZ_PATH_SRCTOP
dnl
dnl sets SRCTOP by looking upward from $srcdir for a directory
dnl containing file OZVERSION
dnl ------------------------------------------------------------------
AC_DEFUN(OZ_PATH_SRCTOP,[
AC_CACHE_CHECK([for SRCTOP],oz_cv_path_SRCTOP,[
OZ_PATH_UPWARD(oz_cv_path_SRCTOP,$srcdir,[OZVERSION])
if test -z "$oz_cv_path_SRCTOP"; then
AC_MSG_ERROR([cannot find SRCTOP])
fi])
SRCTOP=$oz_cv_path_SRCTOP
AC_SUBST(SRCTOP)])
dnl ------------------------------------------------------------------
dnl OZ_PATH_BUILDTOP
dnl
dnl sets BUILDTOP by looking upward from the current directory
dnl for a directory containing either contrib or config.cache. We
dnl look for config.cache last because some people may want to run
dnl configure only in a subdirectory of the source tree.
dnl ------------------------------------------------------------------
AC_DEFUN(OZ_PATH_BUILDTOP,[
AC_CACHE_CHECK([for BUILDTOP],oz_cv_path_BUILDTOP,[
OZ_PATH_UPWARD(oz_cv_path_BUILDTOP,.,[contrib config.cache])
if test -z "$oz_cv_path_BUILDTOP"; then
AC_MSG_ERROR([cannot find BUILDTOP])
fi])
BUILDTOP=$oz_cv_path_BUILDTOP
AC_SUBST(BUILDTOP)])
AC_DEFUN(OZ_PROG_INSTALL,[
if test "${INSTALL+set}" = set; then
AC_CACHE_CHECK([whether to unset broken INSTALL],
oz_cv_unset_INSTALL,[
echo >conftest.$$
if $INSTALL -c -m 644 conftest.$$ /tmp >/dev/null 2>&1; then
rm -f /tmp/conftest.$$ 2>/dev/null
oz_cv_unset_INSTALL=no
oz_cv_given_INSTALL="$INSTALL"
else
oz_cv_unset_INSTALL=yes
fi
rm -f conftest.$$ 2>/dev/null])
test "$oz_cv_unset_INSTALL" = yes && unset INSTALL
fi
AC_PROG_INSTALL
if test "$INSTALL" = "$oz_cv_given_INSTALL"; then
ac_given_INSTALL="$oz_cv_given_INSTALL"
fi
OZ_PATH_PROG(INSTALL_DIR, mkinstalldirs)])
AC_DEFUN(OZ_BUILD_DATE,[
AC_CACHE_CHECK([for build date],oz_cv_build_date,[
oz_cv_build_date=`date +"%Y%m%d"`])
OZBUILDDATE=$oz_cv_build_date;
AC_SUBST(OZBUILDDATE)])
AC_DEFUN(OZ_BUILD_TIME,[
AC_CACHE_CHECK([for build time],oz_cv_build_time,[
oz_cv_build_time=`date +"%H%M%S"`])
OZBUILDTIME=$oz_cv_build_time;
AC_SUBST(OZBUILDTIME)])
AC_DEFUN(OZ_VERSION,[
AC_CACHE_CHECK([for oz version],oz_cv_ozversion,[
oz_cv_ozversion=`sh $SRCTOP/OZVERSION`])
OZVERSION=$oz_cv_ozversion;
AC_SUBST(OZVERSION)])
AC_DEFUN(OZ_INIT, [
AC_PREFIX_DEFAULT(/usr/local/oz)
OZ_PATH_SRCDIR
OZ_PATH_SRCTOP
OZ_PATH_BUILDTOP
AC_CONFIG_AUX_DIR($SRCTOP)
if test "$host_os" = ""; then
AC_CANONICAL_HOST
fi
OZ_PROG_MAKE
AC_PROG_MAKE_SET
OZ_PROG_INSTALL
OZ_VERSION
HOMEURL="http://www.mozart-oz.org/home-$OZVERSION"
HOMECACHE="http/www.mozart-oz.org/home-$OZVERSION"
AC_SUBST(HOMEURL)
AC_SUBST(HOMECACHE)
case "$target" in
i386-mingw32|i386-mingw32msvc)
PLATFORM=win32-i486
platform="win32-i486"
ozplatform=$platform
cross_compiling=yes
CXX=${target}-gcc
CC=${CXX}
RANLIB=${target}-ranlib
AR=${target}-ar
STRIP=${target}-strip
WINDRES=${target}-windres
AS=${target}-as
DLLTOOL=${target}-dlltool
DLLWRAP=${target}-dllwrap
OZTOOL="sh $BUILDTOP/platform/emulator/${target}-oztool"
enable_contrib_psql=no
enable_contrib_gdbm=yes
enable_contrib_regex=yes
enable_contrib_os=no
;;
*)
OZ_PATH_PROG(OZPLATFORM,ozplatform)
PLATFORM=`$OZPLATFORM || exit 1`
OZ_PATH_PROG(OZTOOL,oztool,[OZTOOL="sh $BUILDTOP/platform/emulator/oztool.sh"])
;;
esac
OZ_ARG_WITH_INC_DIR
OZ_ARG_WITH_LIB_DIR
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
OZ_BUILD_DATE
OZ_BUILD_TIME
AC_SUBST(PLATFORM)
OZ_OZLOADSEP
OZ_OZLOADWIN
])
dnl ==================================================================
dnl VERSION CHECKING
dnl ==================================================================
dnl ------------------------------------------------------------------
dnl OZ_CHECK_VERSION(OK,GOT,WANT)
dnl
dnl GOT and WANT consist of integers separated by single periods, e.g.
dnl 23.1 or 3.5.7, and OK is set to yes or no according to whether
dnl GOT >= WANT with respect to the obvious ordering. To accomodate
dnl such program as perl, we also permit `_' and `-' instead of `.'
dnl
dnl for example
dnl OZ_CHECK_VERSION(OK,$VERSION,2.5.4)
dnl sets OK to yes or no, according to whether $VERSION is greater
dnl than 2.5.4
dnl
dnl Note that we now support having one letter at the end: this
dnl interpreted as a "beta" version. Thus 1.3.23c is less that
dnl 1.3.23, but more than 1.3.23a.
dnl
dnl `set $oz_tmp_got DONE' results in the component integers being
dnl assigned to positional parameters $1, $2 etc... DONE marks the
dnl of this sequence. The for loop goes through what we `want' but
dnl also through what correspondingly we `got' through positional
dnl parameter $1. the `shift' at the end of the loop moves left
dnl all positional parameters, thus bringing the next thing we `got'
dnl into $1.
dnl
dnl Note that if GOT is empty the test succeeds (so don't do it)
dnl ------------------------------------------------------------------
AC_DEFUN(OZ_PREPARE_VERSION,[
oz_tmp="$[$1]"
changequote(<,>)
oz_tmp=`echo $oz_tmp | sed -e 's/[a-z]/.\0/'`
oz_tmp=`echo $oz_tmp | sed -e 's/[._-]/ /g'`
changequote([,])
[$1]=$oz_tmp])
AC_DEFUN(OZ_CHECK_VERSION,[
oz_tmp_got="[$2]"
oz_tmp_want="[$3]"
OZ_PREPARE_VERSION(oz_tmp_got)
OZ_PREPARE_VERSION(oz_tmp_want)
set $oz_tmp_got DONE
oz_tmp__ok=yes
for oz_tmp_cur in $oz_tmp_want; do
case $oz_tmp_cur in
DONE)
case $[1] in
[a-z]) oz_tmp__ok=no;;
*);;
esac
break
;;
[a-z])
case $[1] in
DONE) break;;
[a-z])
if test `expr $oz_tmp_cur '<=' $[1]` -eq 0; then
oz_tmp__ok=no
break
fi
;;
*) break
;;
esac
;;
*)
case $[1] in
DONE) oz_tmp__ok=no
break
;;
[a-z]) oz_tmp__ok=no
break
;;
*) if test "$oz_tmp_cur" -lt "$[1]"; then
break
elif test "$oz_tmp_cur" -gt "$[1]"; then
oz_tmp__ok=no
break
fi
;;
esac
;;
esac
[shift]
done
[$1]=$oz_tmp__ok])
dnl ------------------------------------------------------------------
dnl OZ_PROG_VERSION_CHECK(VAR,PROG,VERSION [,HOW])
dnl
dnl gets the --version of PROG and compares it to VERSION
dnl sets VAR to yes or no accordingly. HOW is the command to execute
dnl to get the text containing the string `version XXXX' where XXXX
dnl is the version number. If HOW is not supplied we use the
dnl --version option.
dnl ------------------------------------------------------------------
AC_DEFUN(OZ_PROG_VERSION_CHECK,[
AC_MSG_CHECKING([$2 version is at least $3])
[$1]=no
if oz_tmp_version1=`ifelse([$4],[],[$2 --version],[$4]) 2>/dev/null`; then
# first we try to locate the string "version"
oz_tmp_version2=`echo "${oz_tmp_version1}" | tr '\012' ' '`
changequote(<,>)
oz_tmp_version=`expr "${oz_tmp_version2}" : '.*version \([0-9._-]*[a-z]\{0,1\}\)'`
# if that failed: we look at the end of the first line
if test -z "$oz_tmp_version"; then
oz_tmp_IFS="$IFS"
IFS='
'
for oz_tmp_version3 in ${oz_tmp_version1}; do
oz_tmp_version=`expr "${oz_tmp_version3}" : '.* \([0-9._-]*[a-z]\{0,1\}\)$'`
# else try to match the entire first line
if test -z "$oz_tmp_version"; then
oz_tmp_version=`expr "${oz_tmp_version3}" : '\([0-9._-]*[a-z]\{0,1\}\)$'`
fi
break
done
IFS="$oz_tmp_IFS"
fi
changequote([,])
if test -n "$oz_tmp_version"; then
OZ_CHECK_VERSION([$1],$oz_tmp_version,[$3])
fi
fi
if test -z "$oz_tmp_version"; then
AC_MSG_RESULT([no (cannot find version)])
elif test $[$1] = no; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes ($oz_tmp_version)])
fi])
dnl ==================================================================
dnl CHOOSE C++ COMPILER
dnl
dnl choose only if the choice is not already in the cache. At
dnl Christian's request, CXXFLAGS is set to -O by default if it is not
dnl already set in the environment
dnl ==================================================================
AC_DEFUN(OZ_VERSION_GXX,[3.3.2])
AC_DEFUN(OZ_CXX_CHOOSE,[
if test -z "$oz_cv_cxx__chosen"; then
: ${CXXFLAGS="-O"}
OZ_ARG_WITH_CXX
AC_PROG_CXX
if test "${GXX}" = yes; then
if oz_tmp=`$CXX -dumpversion 2>/dev/null` || oz_tmp=`$CXX --version 2>/dev/null`; then
if expr "$oz_tmp" : egcs >/dev/null; then
dnl I don't know what the appropriate version number is for egcs
AC_MSG_WARN([dont know how to check egcs version, assuming ok])
else
OZ_PROG_VERSION_CHECK(oz_tmp_ok,$CXX,OZ_VERSION_GXX,$CXX -dumpversion || $CXX --version)
if test "$oz_tmp_ok" = no; then
AC_MSG_ERROR([
configure found the GNU C++ compiler $CXX version $oz_tmp_version
but version] OZ_VERSION_GXX [or higher is required to build the
system. It can be retrieved from:
ftp://ftp.gnu.org/pub/gnu/gcc/
The latest version at this time is 4.1.0 and is available
packaged as the following archive:
gcc-4.1.0.tar.bz2
You may find a mirror archive closer to you by consulting:
http://www.gnu.org/order/ftp.html
])
fi
fi
else
AC_MSG_WARN([Could not check $CXX version, assuming ok])
fi
fi
case "$PLATFORM" in
*win32*)
case "$CXX" in
*mno-cygwin*)
;;
*)
OZ_CXX_OPTIONS(-mno-cygwin,oz_tmp)
CXX="$CXX${oz_tmp:+ }$oz_tmp"
;;
esac
;;
*)
;;
esac
AC_PROG_CXXCPP
oz_cv_CXX=$CXX
oz_cv_CXXCPP=$CXXCPP
oz_cv_GXX=$GXX
oz_cv_CXXFLAGS=$CXXFLAGS
oz_cv_cxx__chosen=yes
else
OZ_FROM_CACHE(CXX,[for C++ compiler])
OZ_FROM_CACHE(GXX,[whether we are using GNU C++])
OZ_FROM_CACHE(CXXCPP,[for C++ preprocessor])
if test "${CXXFLAGS+set}" != set; then
OZ_FROM_CACHE(CFLAGS,[for default CXXFLAGS])
fi
fi
AC_SUBST(CXX)
AC_SUBST(CXXCPP)])
dnl ------------------------------------------------------------------
dnl OZ_FROM_CACHE(VAR,MSG)
dnl
dnl sets VAR to $oz_cv_VAR while printing an appropriate MSG
dnl this is useful to give feedback to the user. use this when
dnl whether to compute a value is decided directly through an `if'
dnl test rather than by calling e.g. AC_CACHE_CHECK.
dnl
dnl OZ_MSG_FRONT(MSG)
dnl
dnl Same idea as AC_MSG_CHECKING, but doesn't say `Checking ', it just
dnl displays the MSG
dnl
dnl OZ_MSG_CACHING(MSG,VAR)
dnl
dnl gives feedback when caching a value that was computed as a side
dnl effect of doing something else.
dnl ------------------------------------------------------------------
AC_DEFUN(OZ_FROM_CACHE,[
OZ_MSG_FRONT([checking $2])
[$1]=$oz_cv_$1
AC_MSG_RESULT([(cached) $$1])])
define(OZ_MSG_FRONT,
[echo $ac_n "$1""... $ac_c" 1>&AC_FD_MSG
echo "configure:__oline__: $1" >&AC_FD_CC])
define(OZ_MSG_CACHING,[
OZ_MSG_FRONT([Caching $1])
AC_MSG_RESULT($$2)])
dnl ------------------------------------------------------------------
dnl OZ_ARG_WITH_CXX
dnl
dnl maybe sets CCC to a specific C++ compiler
dnl 1. --with-cxx=<CXX> (command line)
dnl 2. oz_cv_with_cxx (config.cache)
dnl 3. oz_with_cxx=<CXX> (config.site)
dnl this is intended to be used by AC_PROG_CXX because it checks
dnl $CCC first in its list of alternative C++ compiler names
dnl ------------------------------------------------------------------
AC_DEFUN(OZ_ARG_WITH_CXX,[
AC_ARG_WITH(cxx,
[--with-cxx=<CXX> use <CXX> as C++ compiler (default=NONE)],
oz_cv_with_cxx=$with_cxx)
: ${CCC:=$oz_cv_with_cxx}
: ${CCC:=$oz_with_cxx}
: ${CXX:=$CCC}
])
dnl ==================================================================
dnl CHOOSE C COMPILER
dnl
dnl At Christian's request CFLAGS is set to -O by default if it is not
dnl already set in the environment.
dnl ==================================================================
AC_DEFUN(OZ_VERSION_GCC,[3.3.2])
AC_DEFUN(OZ_CC_CHOOSE,[
if test -z "$oz_cv_cc__chosen"; then
: ${CFLAGS="-O"}
AC_PROG_CC
if test "$GCC" = yes; then
if oz_tmp=`$CC -dumpversion 2>/dev/null` || oz_tmp=`$CC --version 2>/dev/null`; then
if expr "$oz_tmp" : egcs >/dev/null; then
dnl I don't know what the appropriate version number is for egcs
AC_MSG_WARN([dont know how to check egcs version, assuming ok])
else
OZ_PROG_VERSION_CHECK(oz_tmp_ok,$CC,OZ_VERSION_GCC,$CC -dumpversion || $CC --version)
if test "$oz_tmp_ok" = no; then
AC_MSG_ERROR([
configure found the GNU C compiler $CC version $oz_tmp_version
but version] OZ_VERSION_GCC [or higher is required to build the
system. It can be retrieved from:
ftp://ftp.gnu.org/pub/gnu/gcc/
The latest version at this time is 4.1.0 and is available
packaged as the following archive:
gcc-4.1.0.tar.bz2
You may find a mirror archive closer to you by consulting:
http://www.gnu.org/order/ftp.html
])
fi
fi
else
AC_MSG_WARN([Could not check $CC version, assuming ok])
fi
fi
case "$PLATFORM" in
*win32*)
case "$CC" in
*mno-cygwin*)
;;
*)
OZ_CC_OPTIONS(-mno-cygwin,oz_tmp)
CC="$CC${oztmp:+ }$oz_tmp"
;;
esac
;;
*)
;;
esac
AC_PROG_CPP
oz_cv_CC=$CC
oz_cv_CPP=$CPP
oz_cv_GCC=$GCC
oz_cv_CFLAGS=$CFLAGS
oz_cv_cc__chosen=yes
else
OZ_FROM_CACHE(CC,[for C compiler])
OZ_FROM_CACHE(GCC,[whether we are using GNU C])
OZ_FROM_CACHE(CPP,[for C preprocessor])
if test "${CFLAGS+set}" != set ; then
OZ_FROM_CACHE(CFLAGS,[for default CFLAGS])
fi
fi
AC_SUBST(CC)
AC_SUBST(CPP)])
dnl ==================================================================
dnl LOCATE UTILITIES AND CHECK VERSION NUMBERS
dnl ==================================================================
dnl ------------------------------------------------------------------
dnl OZ_PROG_FLEX or OZ_PROG_LEX
dnl
dnl locate GNU flex and check its version number. sets LEX and FLEX
dnl ------------------------------------------------------------------
AC_DEFUN(OZ_PROG_LEX,[OZ_PROG_FLEX])
AC_DEFUN(OZ_VERSION_FLEX,[2.5.3])
AC_DEFUN(OZ_PROG_LEX_GNU,[
if `$LEX -S/dev/null --version 2>/dev/null >/dev/null`; then
GNU_LEX=yes
else
GNU_LEX=no
fi])
AC_DEFUN(OZ_PROG_FLEX,[
if test -z "$oz_cv_LEX"; then
AC_PROG_LEX
OZ_PROG_LEX_GNU
if test "$GNU_LEX" = no; then
oz_tmp_ok=no
AC_MSG_WARN([$LEX is not GNU flex])
else
OZ_PROG_VERSION_CHECK(oz_tmp_ok,$LEX,OZ_VERSION_FLEX)
fi
if test "$oz_tmp_ok" = yes; then
oz_cv_LEX=$LEX
else
if test "$oz_coolness" = yes; then
LEX=flex_not_found
AC_MSG_WARN(GNU flex not found)
else
AC_MSG_ERROR([
GNU flex version] OZ_VERSION_FLEX [or higher is needed to build the
system. It can be retrieved from:
ftp://ftp.gnu.org/pub/gnu/non-gnu/flex/
The latest version at this time is 2.5.4a and is available
packaged as the following archive:
flex-2.5.4a.tar.gz
You may find a mirror archive closer to you by consulting:
http://www.gnu.org/order/ftp.html
You may find additional information or more recent releases
on the flex development site:
http://lex.sourceforge.net/
])
fi
fi
else
OZ_FROM_CACHE(LEX,[for GNU flex])
fi
FLEX=$LEX
AC_SUBST(LEX)
AC_SUBST(FLEX)])
dnl ------------------------------------------------------------------
dnl OZ_PROG_BISON or OZ_PROG_YACC
dnl
dnl locate GNU bison and check its version number. sets YACC and BISON
dnl ------------------------------------------------------------------
AC_DEFUN(OZ_PROG_YACC,[OZ_PROG_BISON])
AC_DEFUN(OZ_VERSION_BISON,[1.25])
AC_DEFUN(OZ_PROG_YACC_GNU,[
if oz_tmp=`$YACC --version 2>/dev/null` && \
oz_tmp=`expr "$oz_tmp" : '.*GNU'`; then
GNU_YACC=yes;
else
GNU_YACC=no
fi])
AC_DEFUN(OZ_PROG_BISON,[
if test -z "$oz_cv_YACC"; then
AC_PROG_YACC
OZ_PROG_YACC_GNU
if test "$GNU_YACC" = no; then
oz_tmp_ok=no
AC_MSG_WARN([$YACC is not GNU bison])
else
OZ_PROG_VERSION_CHECK(oz_tmp_ok,$YACC,OZ_VERSION_BISON)
fi
if test "$oz_tmp_ok" = yes; then
oz_cv_YACC=$YACC
else
if test "$oz_coolness" = yes; then
YACC=bison_not_found
AC_MSG_WARN(bison not found)
else
AC_MSG_ERROR([
GNU bison version] OZ_VERSION_BISON [or higher is needed to build the system.
It can be retrieved from:
ftp://ftp.gnu.org/pub/gnu/bison/
The latest version at this time is 1.875 and is available
packaged as the following archive:
bison-1.875.tar.gz
You may find a mirror archive closer to you by consulting:
http://www.gnu.org/order/ftp.html
])
fi
fi
else
OZ_FROM_CACHE(YACC,[for GNU bison])
fi
BISON=$YACC
AC_SUBST(YACC)
AC_SUBST(BISON)])
dnl ------------------------------------------------------------------
dnl OZ_PROG_PERL
dnl
dnl locate perl and checks its version number. sets PERL
dnl ------------------------------------------------------------------
AC_DEFUN(OZ_VERSION_PERL,[5])
AC_DEFUN(OZ_PROG_PERL,[
if test -z "$oz_cv_PERL"; then
AC_CHECK_PROGS(PERL,perl perl5,NONE)
if test "$PERL" = NONE; then
oz_tmp_ok=no;
else
changequote(<,>)
oz_tmp_version=`$PERL -e 'print "[$]\n";' | sed 's|^.||'`
changequote([,])
OZ_CHECK_VERSION(oz_tmp_ok,$oz_tmp_version,OZ_VERSION_PERL)
fi
if test "$oz_tmp_ok" = yes; then
oz_cv_PERL=$PERL
else
if test "$oz_coolness" = yes; then
PERL=perl_not_found
AC_MSG_WARN(perl not found)
else
AC_MSG_ERROR([
Perl version] OZ_VERSION_PERL [or higher is needed to build the system.
It can be retrieved from:
http://www.perl.org/get.html
The latest version at this time is 5.8.2. You may find further
information on the Perl site:
http://www.perl.org/
])
fi
fi
else
OZ_FROM_CACHE(PERL,[for perl])
fi
AC_SUBST(PERL)])
dnl ------------------------------------------------------------------
dnl OZ_PROG_M4
dnl
dnl locate GNU m4. sets M4 and M4_S
dnl ------------------------------------------------------------------
AC_DEFUN(OZ_PROG_M4_GNU,[
if oz_tmp=`$M4 --version 2>/dev/null` && \
oz_tmp=`expr "$oz_tmp" : GNU`; then
GNU_M4=yes
else
GNU_M4=no
fi])
AC_DEFUN(OZ_PROG_M4,[
if test -z "$oz_cv_M4"; then
AC_CHECK_PROGS(M4,gm4 m4,NONE)
if test "$M4" = NONE; then
oz_tmp_ok=no;
else
OZ_PROG_M4_GNU
if test "$GNU_M4" = no; then
oz_tmp_ok=no
AC_MSG_WARN([$M4 is not GNU m4])
else
oz_tmp_ok=yes
fi
if test "$oz_tmp_ok" = yes; then
oz_cv_M4=$M4
else
if test "$oz_coolness" = yes; then
M4=m4_not_found
AC_MSG_WARN(m4 not found)
else
AC_MSG_ERROR([
GNU m4 is needed to build the system.
It can be retrieved from:
ftp://ftp.gnu.org/pub/gnu/m4/
The latest version at this time is 1.4 and is available
packaged as the following archive:
m4-1.4.tar.gz
You may find a mirror archive closer to you by consulting:
http://www.gnu.org/order/ftp.html
])
fi
fi
fi
else
OZ_FROM_CACHE(M4,[for GNU m4])
fi
M4_S="-s"
AC_SUBST(M4)
AC_SUBST(M4_S)])
dnl ------------------------------------------------------------------
dnl OZ_PROG_MAKE
dnl
dnl locate GNU make. sets MAKE
dnl ------------------------------------------------------------------
AC_DEFUN(OZ_PROG_MAKE_GNU,[
if oz_tmp=`$MAKE -n --version 2>/dev/null` && \
oz_tmp=`expr "$oz_tmp" : GNU`; then
GNU_MAKE=yes
else
GNU_MAKE=no
fi])
AC_DEFUN(OZ_PROG_MAKE,[
if test -z "$oz_cv_MAKE"; then
AC_CHECK_PROGS(MAKE,gmake make,NONE)
if test "$MAKE" = NONE; then
oz_tmp_ok=no
else
OZ_PROG_MAKE_GNU
if test "$GNU_MAKE" = no; then
oz_tmp_ok=no
AC_MSG_WARN([$MAKE is not GNU make])
else
oz_tmp_ok=yes
fi
fi
if test "$oz_tmp_ok" = yes; then
oz_cv_MAKE=$MAKE
else
AC_MSG_ERROR([
GNU make is needed to build the system.
It can be retrieved from:
ftp://ftp.gnu.org/pub/gnu/make/
The latest version at this time is 3.80 and is available
packaged as the following archive:
make-3.80.tar.gz
You may find a mirror archive closer to you by consulting:
http://www.gnu.org/order/ftp.html
])
fi
else
OZ_FROM_CACHE(MAKE,[for GNU make])
fi
AC_SUBST(MAKE)])
dnl ------------------------------------------------------------------
dnl OZ_LIB_GMP
dnl
dnl locates gmp.h and libgmp and checks the version number
dnl ------------------------------------------------------------------
AC_DEFUN(OZ_VERSION_GMP,[2])
AC_DEFUN(OZ_LIB_GMP,[
AC_MSG_CHECKING(for --with-gmp)
AC_ARG_WITH(gmp,
[--with-gmp=<dir> search gmp library and header in <dir> (default: yes)],
with_gmp=$withval,
with_gmp=yes)
if test "$with_gmp" != no
then
AC_MSG_RESULT($with_gmp)
if test "${with_gmp}" != yes
then
oz_gmp_lib_dir=$with_gmp
oz_gmp_inc_dir=$with_gmp
fi
oz_inc_path="$oz_gmp_inc_dir $oz_inc_path"
oz_lib_path="$oz_gmp_lib_dir $oz_lib_path"
else
AC_MSG_RESULT(no)
fi
OZ_CHECK_HEADER_PATH(gmp.h,
[oz_gmp_inc_found=yes],
dnl try adding /usr/include/gmp2 for Debian
[oz_inc_path_sav=$oz_inc_path
oz_inc_path="$oz_inc_path /usr/include/gmp2"
OZ_CHECK_HEADER_PATH(gmp.h,
[oz_gmp_inc_found=yes],
[oz_gmp_inc_found=no
oz_inc_path=$oz_inc_path_sav])])
if test "$oz_gmp_inc_found" = yes; then
dnl first check for GMP 3
OZ_CHECK_LIB_PATH(gmp, __gmpz_init,
oz_gmp_lib_found=gmp,
dnl if that fail, try GMP 2
OZ_CHECK_LIB_PATH(gmp, mpz_init,
oz_gmp_lib_found=gmp,
OZ_CHECK_LIB_PATH(gmp2, mpz_init,
oz_gmp_lib_found=gmp2,
oz_gmp_lib_found=no)))
fi
if test "$oz_gmp_lib_found" != no; then
AC_MSG_CHECKING(gmp version is at least OZ_VERSION_GMP)
if test -z "$oz_cv_gmp_version_ok"; then
cat > conftest.$ac_ext <<EOF
#include <gmp.h>
TheVersion __GNU_MP_VERSION __GNU_MP_VERSION_MINOR
EOF
oz_tmp=`$CXXCPP $CPPFLAGS conftest.$ac_ext | egrep TheVersion`;
rm -f conftest.$ac_ext 2>/dev/null
changequote(<,>)
OZ_GMP_MAJOR=`expr "$oz_tmp" : 'TheVersion *\([0-9]*\) '`
OZ_GMP_MINOR=`expr "$oz_tmp" : 'TheVersion *[0-9]* *\([0-9]*\) *$'`
changequote([,])
if oz_tmp=`expr "$oz_tmp" : 'TheVersion \(.*\)$'`; then
OZ_CHECK_VERSION(oz_tmp_ok,$oz_tmp,OZ_VERSION_GMP)
test "$oz_tmp_ok" = yes && oz_cv_gmp_version_ok=$oz_tmp_ok
else
oz_tmp_ok=no
fi
oz_cv_gmp_version_major=$OZ_GMP_MAJOR
oz_cv_gmp_version_minor=$OZ_GMP_MINOR
AC_MSG_RESULT($oz_tmp_ok)
else
oz_tmp_ok=$oz_cv_gmp_version_ok
OZ_GMP_MAJOR=$oz_cv_gmp_version_major
OZ_GMP_MINOR=$oz_cv_gmp_version_minor
AC_MSG_RESULT([(cached) $oz_tmp_ok])
fi
oz_gmp_version_ok=$oz_tmp_ok
fi
if test "$oz_gmp_inc_found" = no; then
AC_MSG_WARN([required GNU MP include file not found])
elif test "$oz_gmp_lib_found" = no; then
AC_MSG_WARN([required GNU MP lib not found])
elif test "$oz_gmp_version_ok" = no; then
AC_MSG_WARN([GNU MP version too old])
fi
if test "$oz_gmp_inc_found" = no || \
test "$oz_gmp_lib_found" = no || \
test "$oz_gmp_version_ok" = no; then
AC_MSG_ERROR([
The GNU Multiple Precision Arithmetic Library (gmp)
version] OZ_VERSION_GMP [or higher is required
to build the system. It can be retrieved from:
ftp://ftp.gnu.org/pub/gnu/gmp/
The latest version at this time is 4.1.2 and is available
packaged as the following archive:
ftp://ftp.gnu.org/pub/gnu/gmp/gmp-4.1.2.tar.gz
You may find a mirror archive closer to you by consulting:
http://www.gnu.org/order/ftp.html
])
fi])
dnl ------------------------------------------------------------------
dnl OZ_LIB_ZLIB
dnl
dnl locates libz and zlib.h
dnl ------------------------------------------------------------------
AC_DEFUN(OZ_LIB_ZLIB,[
AC_MSG_CHECKING(for --with-zlib)
AC_ARG_WITH(zlib,
[--with-zlib=<dir> search zlib library and header in <dir> (default: yes)],
with_zlib=$withval,
with_zlib=yes)
if test "$with_zlib" != no
then
AC_MSG_RESULT($with_zlib)
if test "${with_zlib}" != yes
then
oz_zlib_lib_dir=$with_zlib
oz_zlib_inc_dir=$with_zlib
fi
oz_inc_path="$oz_zlib_inc_dir $oz_inc_path"
oz_lib_path="$oz_zlib_lib_dir $oz_lib_path"
else
AC_MSG_RESULT(no)
fi
OZ_CHECK_HEADER_PATH(zlib.h,oz_zlib_inc_found=yes,oz_zlib_inc_found=no)
if test "$oz_zlib_inc_found" = yes; then
OZ_CHECK_LIB_PATH(z, zlibVersion, oz_zlib_lib_found=yes,
OZ_CHECK_LIB_PATH(gz, zlibVersion, oz_zlib_lib_found=yes,
oz_zlib_lib_found=no))
fi
if test "$oz_zlib_inc_found" = no; then
AC_MSG_WARN([required ZLIB include file zlib.h not found])
elif test "$oz_zlib_lib_found" = no; then
AC_MSG_WARN([required ZLIB library libz not found])
fi
if test "$oz_zlib_inc_found" = no || \
test "$oz_zlib_lib_found" = no; then
AC_MSG_ERROR([
The ZLIB general purpose compression library is required to
build the system. It can be retrieved from:
http://www.gzip.org/zlib/
])
fi
])
dnl ------------------------------------------------------------------
dnl OZ_NEEDS_FUNC(FUNCTION)
dnl
dnl makes sure that FUNCTION is now available, else signals an error.
dnl ------------------------------------------------------------------
AC_DEFUN(OZ_NEEDS_FUNC,[
AC_CHECK_FUNC([$1],[oz_tmp_ok=yes],[oz_tmp_ok=no])
if test "$oz_tmp_ok" = no; then
AC_MSG_ERROR([Function $1 is not available.
The system cannot be built.