-
Notifications
You must be signed in to change notification settings - Fork 6
/
configure
executable file
·1866 lines (1754 loc) · 59.1 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
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
#!/bin/bash
# Configure script
# by Ken O. Burtch
#
# For environment variables that affect this script, see the INSTALL file.
#
# This Bourne shell script was written on Bash but should support most
# Bourne shell variants, including ksh. FreeBSD will fail using the
# default tcsh (which is based on csh and is not Bourne shell compatible).
#set -eu
# When this command was run (assumed to be build date)
CONFIGBUILDDATE=`date "+%y%m%d"`
# Default, this is not a release version
CONFIGRELEASED="false"
# Default installation prefix
PREFIX="/usr/local"
# Default man page installation prefix
MANPREFIX="/usr/share"
if [ ! -d "$MANPREFIX""/man" ] ; then
MANPREFIX="/usr/local"
fi
# This will have "sudo" if required for ldconfig
LDCONFIG_SUDO=
# Default number of GNU make processes
GMAKE_JOBS=4
# These variables may be passed into this script from the environment.
#
# For example, ARCH=i386 ./configure
# Or export ARCH=i386; ./configure
#
# ARCH - the hardware architecture
# GMAKE - the GNU make command to use
# PREFIX - the installation prefix
# MANPREFIX - the man page directory prefix
# DEV_SHM - request to use /dev/shm
# NO_BDB - request to disable Berkeley DB
# NO_L10N - request to disable GNU localization
# NO_MYSQL - request to disable MySQL
# NO_OPENGL - request to disable OpenGL
# NO_PCRE - request to disable PCRE library
# NO_POSTGRES - request to disable PostgreSQL
# NO_READLINE - request to use old Ada input routines not readline
# NO_SOUND - request to disable sound support
# NO_SDL - request to disable SDL support
NO_GCGI=1
# Gnat.CGI is default "no"
# Gnat CGI breaks some SparForte features when enabled
# It must be enabled by a configuration option
# Get command line options
#
# Throughout this script, true is non-blank, and false is blank. These
# variables may be passed in from the environment (as described in the
# INSTALL file). Any configure options overrides them here.
while [ $# -gt 0 ] ; do
TMP=`echo "$1" | cut -d= -f1`
if [ -z "$TMP" ] ; then
$TMP="$1"
fi
case "$TMP" in
-h|--help)
echo "SparForte configuration script"
echo
echo "Additional options:"
echo " --arch=ARCH hardware architecture"
echo " Examples: alpha, armv6l (Pi), athlon, i386"
echo " (base Intel 32-bit), x86_64 (base Intel"
echo " 64-bit), core2, corei7, nocona, etc."
echo " --jobs=n number of make parallel jobs (default $GMAKE_JOBS)"
echo " --make=MAKE name of GNU make"
echo " --prefix=PREFIX root installation directory"
echo " --manprefix=MANPREFIX man page install directory"
echo " --released true if not a dev version"
echo " --with-gnat-cgi enable GNAT.CGI support"
echo " --without-bdb disable Berkeley DB support"
echo " --without-l10n disable GNU localization support"
echo " --without-mysql disable MySQL support"
echo " --without-opengl disable OpenGL support"
echo " --without-pcre disable PCRE library support"
echo " --without-postgres disable PostgreSQL support"
echo " --without-readline disable GNU readline support"
echo " --without-sdl disable SDL and SDLImage support"
echo " --without-sound disable GStreamer sound support"
echo
echo "Read INSTALL for further information on these options"
exit 0
;;
--arch)
ARCH=`echo "$1" | cut -d= -f2`
;;
--jobs)
GMAKE_JOBS=`echo "$1" | cut -d= -f2`
;;
--make)
GMAKE=`echo "$1" | cut -d= -f2`
;;
--prefix)
PREFIX=`echo "$1" | cut -d= -f2`
;;
--manprefix)
MANPREFIX=`echo "$1" | cut -d= -f2`
;;
--released)
CONFIGRELEASED="true"
;;
--with-gnat-cgi)
NO_GCGI=
;;
--without-bdb)
NO_BDB=1
;;
--without-l10n)
NO_L10N=1
;;
--without-mysql)
NO_MYSQL=1
;;
--without-opengl)
NO_OPENGL=1
;;
--without-pcre)
NO_PCRE=1
;;
--without-postgres)
NO_POSTGRES=1
;;
--without-readline)
NO_READLINE=1
;;
--without-sdl)
NO_SDL=1
;;
# gnatmake -D copies files to a new directory, but does not delete them
# afterwards. So using /dev/shm doesn't seem to speedup compilation.
#--with-devshm)
# # Check for Linux RAM disk
# if [ ! -d "/dev/shm" ] ; then
# echo "/dev/shm not found"
# exit 192
# fi
# if [ ! -w "/dev/shm" ] ; then
# echo "/dev/shm not writable"
# exit 192
# fi
# # Create a sparforte subdirectory
# if [ ! -d "/dev/shm/sparforte" ] ; then
# mkdir "/dev/shm/sparforte"
# if [ $? -ne 0 ] ; then
# echo "unable to make /dev/shm/sparforte"
# exit 192
# fi
# fi
# if [ ! -w "/dev/shm/sparforte" ] ; then
# echo "/dev/shm/sparforte not writable"
# exit 192
# fi
# DEV_SHM=1
# ;;
--without-sound)
NO_SOUND=1
;;
# Unused RPM options
# When building an RPM on OpenSUSE, many unnecesssary options were passed
# to configure. I'm not sure what they all mean. Silently ignore them,
# with the exception of mandir which we treat as manprefix.
--host) echo "--host not used" ;;
--build) echo "--build not used" ;;
--program-prefix) echo "--program-prefix not used" ;;
--exec-prefix) echo "--exec-prefix not used" ;;
--bindir) echo "--binddir not used" ;;
--sbindir) echo "--sbindir not used" ;;
--sysconfdir) echo "--sysconfdir not used" ;;
--datadir) echo "--datadir not used" ;;
--includedir) echo "--includedir not used" ;;
--libdir) echo "--libdir not used" ;;
--libexecdir) echo "--libexecdir not used" ;;
--localstatedir) echo "--localdatedir not used" ;;
--sharedstatedir) echo "--sharedstatedir not used" ;;
--disable-dependency-tracking) echo "--disable-dependency-tracking not used" ;;
--mandir)
MANPREFIX=`echo "$1" | cut -d= -f2`
;;
--infodir) echo "--infodir not used" ;;
--target) echo "--infodir not used" ;;
*)
echo "Unrecognized option $TMP"
exit 192
esac
shift
done
if [ -z "$NO_OPENGL" ] ; then
if [ -n "$NO_SDL" ] ; then
echo "--without-sdl requires --without-opengl"
exit 192
fi
fi
# Debian warning
if [ -f "/etc/issue" ] ; then
TMP=`fgrep Ubuntu /etc/issue`
if [ "$TMP" != "" ] ; then
DISTRO="ubuntu"
fi
TMP=`fgrep Mint /etc/issue`
if [ "$TMP" != "" ] ; then
DISTRO="ubuntu"
fi
fi
HAS_SUDO=
(exec sudo -h >/dev/null 2>&1)
if [ $? -eq 0 ] ; then
HAS_SUDO=1
fi
if [ -z "$DISTRO" ] ; then
if test -f "/etc/debian_version" ; then
if [ -n "$HAS_SUDO" ] ; then
echo "Debian users"
echo
echo "This script uses sudo. You may need to add your login to the"
echo "sudoers configuration file. Press return to continue."
read TMP
LDCONFIG_SUDO=sudo
fi
fi
fi
# Configure SparForte
#
# The sleep 1 is to make the messages more readable.
echo "Configuring SparForte..."
sleep 1
echo
# As per Fedja B, use Git version for build date, if available.
# Git describe may fail if no git repo exiss
(exec git --version >/dev/null 2>/dev/null)
if [ $? -eq 0 ] ; then
TMP=`git describe 2>/dev/null`
if [ $? -eq 0 ] ; then
CONFIGBUILDDATE="$TMP"
fi
echo "Using Git version for build date string... $CONFIGBUILDDATE"
else
echo "Using current date for build date string... $CONFIGBUILDDATE"
fi
# Check for pkg-config command
#
# PKGCONFIG is non-blank if it is found
PKGCONFIG="pkg-config"
echo -n "checking for pkg_config... "
(exec $PKGCONFIG --version >/dev/null 2>/dev/null)
if [ $? -ne 0 ] ; then
PKGCONFIG=""
echo "no"
else
echo "yes"
fi
# Check for GNU locate command
#
# LOCATE is set to the name of the locate command
# If blank, use FINDLIB instead
LOCATE="glocate"
FINDLIB=
echo -n "checking for locate ($LOCATE)... "
"$LOCATE" --help >/dev/null 2>/dev/null
if [ $? -ne 0 ] ; then
echo "no"
LOCATE="locate"
"$LOCATE" --help >/dev/null 2>/dev/null
if [ $? -ne 0 ] ; then
LOCATE="locate"
echo -n "checking for locate ($LOCATE)... "
"$LOCATE" /bin/true >/dev/null 2>/dev/null
if [ $? -ne 0 ] ; then
echo "no"
# freebsd 8 has different parameters
"$LOCATE" thisisafakepatternbecausefreebsdlocatehasnohelp >/dev/null 2>/dev/null
else
echo "yes"
fi
else
echo "yes"
fi
else
echo "yes"
fi
# If there is no locate command, fallback to find
if [ $? -ne 0 ] ; then
LOCATE=
FINDLIB="find /usr/lib -type f"
fi
# OS Environment
#
# The name of the operating system, such as linux, darwin, cygwin, etc.
cd src
echo -n "checking for OS (uname -s)... "
OS=`uname -s 2>/dev/null`
if [ $? -ne 0 ] ; then
echo "failed"
echo
echo "Could not run uname -s"
exit 1
fi
TMP=`echo "$OS" | cut -c1-6`
if [ "$TMP" = "CYGWIN" ] ; then
OS="cygwin"
fi
if [ "$TMP" = "Darwin" ] ; then
OS="darwin"
fi
echo "yes"
# CPU architecture
#
# Use an ARCH variable if one exists. Otherwise, determine the operating
# system type and processor architecture type by uname.
echo -n "checking for architecture (\$ARCH)... "
if [ -z "$ARCH" ] ; then
echo "no"
echo -n "checking for architecture (uname -p and -m)... "
ARCH=`uname -p 2>/dev/null`
if [ $? -ne 0 ] ; then # Cygwin runs but says unknown
ARCH="unknown"
fi
if [ "$ARCH" = "unknown" ] ; then
ARCH=`uname -m 2>/dev/null`
if [ $? -ne 0 ] ; then
echo "failed"
echo
echo "Could not run uname -p or -m. Use --arch to specify your architecture."
echo "For example, export --arch=core2"
exit 1
fi
fi
fi
echo "yes"
# Display the Operating System and the CPU Architecture
#
# These will determine which spar_os binding file to use.
echo -n "making for... "
# The ARCH comes from uname and indicates the version of Linux, not the
# actual processor being used. There's a lot of aliases for Intel
# Pentium-4-ish processors. Not all appear here. CPU_ARCH is used to
# determine the spar_os binding file...we don't necessarily have one for
# every architecture.
# Intel 32-bit Pentium
if [ "$ARCH" = "i486" ] ; then
CPU_ARCH="i386"
elif [ "$ARCH" = "i586" ] ; then
CPU_ARCH="i386"
elif [ "$ARCH" = "i686" ] ; then
CPU_ARCH="i386"
elif [ "$ARCH" = "athlon" ] ; then # Intel-ish
CPU_ARCH="i386"
elif [ "$ARCH" = "amd64" ] ; then # FreeBSD 10
export ARCH="athlon64"
CPU_ARCH="i386"
# Intel 64-bit Pentium
elif [ "$ARCH" = "x86_64" ] ; then
# There is no "x86_64" CPU option. However, Athlon 64 is an early
# 64-bit CPU that has instructions also supported by Intel processors.
# so "athlon64" is generic 64-bit Intel/AMD CPU.
export ARCH="athlon64" # Fedora: x86_64 isn't valid gcc option
CPU_ARCH="i386"
elif [ "$ARCH" = "nocona" ] ; then
# Original Pentium 64-bit with MMX, SSE...SSE3 extensions
# Should only appear if --arch is used
CPU_ARCH="i386"
elif [ "$ARCH" = "core2" ] ; then
# Intel Core 2 64-bit with MMX, SSE...SSSE3 extensions
# Should only appear if --arch is used
CPU_ARCH="i386"
elif [ "$ARCH" = "corei7" ] ; then
# Intel Core i7 Version 1 64-bit with MMX, SSE...SSE4.2 extensions
# Should only appear if --arch is used
CPU_ARCH="i386"
# Other processors
elif [ "$ARCH" = "alpha" ] ; then
CPU_ARCH="alpha"
elif [ "$ARCH" = "armv6l" ] ; then
# Rasp Pi: First, ARM 6L not a GCC option. Second, not all Debian
# packages build with an CPU march flag more specific than generic
# v6.
CPU_ARCH="armv6"
ARCH="armv6"
elif [ "$ARCH" = "armv7l" ] ; then
# Rasp Pi 3: First, ARM 7L not a GCC option. Second, not all Debian
# packages build with an CPU march flag more specific than generic
# v6.
CPU_ARCH="armv6"
ARCH="armv6"
elif [ "$ARCH" = "aarch64" ] ; then
# Recent Rasp Pi 4 or Rasp Pi 5
# was ARCH="armv6" but this is no longer valid
CPU_ARCH="native"
ARCH="native"
else
CPU_ARCH="$ARCH"
fi
CPU_FLAG="-march"
# Determine the correct OS binding to use and the correct -march
# compiler flag. Newer versions of Linux
# support -march=native but this is not yet supported on the Raspberry
# Pi. Apparently there are several different Debian flavours for the
# Pi. I've only tested it on the one using armv6l.
if [ "$OS" = "Linux" -a "$CPU_ARCH" = "armv6" ] ; then
echo -n "Linux/ARM6 (assuming Raspberry Pi)"
if test -r spar_os.ads ; then
echo " (cached, make distclean to remove)";
else
echo
# The standard linux file works with the Pi
cp os_bindings/spar_linux.ads spar_os.ads
if [ $? -ne 0 ] ; then
echo "Unable to find appropriate spar_os source files"
exit 1
fi
fi
# Rasp Pi FAQ: these C flags should be used. However, they must be applied
# to the entire application and I don't have a way to pass them to the
# third-party libraries. However, I document them here.
#CFLAGSTYPE="-mfpu=vfp -mfloat-abi=hard"
# GCC Ada 4.6's Gnatmake crashes on GCC -m switches on cargs
#GMCARGSSUB="-mfpu=vfp -mfloat-abi=hard"
elif [ "$OS" = "Linux" -a "$CPU_ARCH" = "armv7" ] ; then
echo -n "Linux/ARM7 (assuming Raspberry Pi 3)"
if test -r spar_os.ads ; then
echo " (cached, make distclean to remove)";
else
echo
# The standard linux file works with the Pi
cp os_bindings/spar_linux.ads spar_os.ads
if [ $? -ne 0 ] ; then
echo "Unable to find appropriate spar_os source files"
exit 1
fi
fi
# Raspberry Pi 5
elif [ "$OS" = "Linux" -a "$CPU_ARCH" = "native" ] ; then
echo -n "Linux/AARCH64 (assuming Raspberry Pi)"
if test -r spar_os.ads ; then
echo " (cached, make distclean to remove)";
else
echo
# The standard linux file works with the Pi
cp os_bindings/spar_linux.ads spar_os.ads
if [ $? -ne 0 ] ; then
echo "Unable to find appropriate spar_os source files"
exit 1
fi
fi
elif [ "$OS" = "Linux" -a "$CPU_ARCH" = "i386" ] ; then
echo -n "Linux/Intel/AMD"
if test -r spar_os.ads ; then
echo " (cached, make distclean to remove)";
else
echo
cp os_bindings/spar_linux.ads spar_os.ads
if [ $? -ne 0 ] ; then
echo "Unable to find appropriate spar_os source files"
exit 1
fi
fi
elif [ "$OS" = "FreeBSD" -a "$CPU_ARCH" = "i386" ] ; then
echo -n "FreeBSD/Intel/AMD"
if test -r spar_os.ads ; then
echo " (cached)";
else
echo
cp os_bindings/spar_freebsd.ads spar_os.ads
if [ $? -ne 0 ] ; then
echo "Unable to find appropriate spar_os source files"
exit 1
fi
fi
CFLAGSTYPE="-DFREEBSD"
elif [ "$OS" = "Linux" -a "$CPU_ARCH" = "alpha" ] ; then
echo -n "Linux/Alpha"
if test -r spar_os.ads ; then
echo " (cached, make distclean to remove)";
else
echo
cp os_bindings/spar_alpha.ads spar_os.ads
if [ $? -ne 0 ] ; then
echo "Unable to find appropriate spar_os source files"
exit 1
fi
fi
ARCH="ev5"
CPU_FLAG="-mcpu" # -march not supported on alpha
elif [ "$OS" = "HPUX" ] ; then
echo -n "HP-UX"
if test ! -w spar_os.ads ; then
echo " (cached)";
else
echo
cp os_bindings/spar_hp.ads spar_os.ads
if [ $? -ne 0 ] ; then
echo "Unable to find appropriate spar_os source files"
exit 1
fi
cp os_bindings/spar_hp.adb spar_os.adb
if [ $? -ne 0 ] ; then
echo "Unable to find appropriate spar_os source files"
exit 1
fi
fi
echo " (Warning: SparForte HP-UX support is obsolete...you will need to edit bush_hp.ads/adb)"
elif [ "$OS" = "cygwin" ] ; then
echo -n "Cygwin"
if test -r spar_os.ads ; then
echo " (cached, make distclean to remove)";
else
echo
cp os_bindings/spar_cygwin.ads spar_os.ads
if [ $? -ne 0 ] ; then
echo "Unable to find appropriate spar_os source files"
exit 1
fi
fi
elif [ "$OS" = "darwin" ] ; then
echo -n "Darwin"
if test -r spar_os.ads ; then
echo " (cached, make distclean to remove)";
else
echo
cp os_bindings/spar_darwin.ads spar_os.ads
if [ $? -ne 0 ] ; then
echo "Unable to find appropriate spar_os source files"
exit 1
fi
fi
else
echo "unknown"
echo
echo "I couldn't identify your operating system."
echo
echo "SparForte requires a spar_os.ads file to make operating system calls."
echo "If I made a mistake and your O/S is supported, manually copy"
echo "a spar_* file to spar_os. If you're operating system isn't supported"
echo "and if you are experienced and have time, you can create a new"
echo "spar_os.ads for your operating system. Consult the Hacker's Guide"
echo "in the documentation on how to port SparForte to a new operating system."
exit 1
fi
# Check compiler
#
# CC is set to the name of the compiler
if test -f spar_os.ali ; then
if test ! -w spar_os.ali ; then
echo "spar_os.ali exists and is not writable...please remove it"
exit 1
fi
fi
echo -n "checking for gcc ... "
CC="gcc"
(exec $CC --version >/dev/null 2>/dev/null)
if [ $? -eq 0 ] ; then
echo "yes"
else
echo "no"
echo
echo "On FreeBSD, you many need to include the gcc-aux/bin path"
echo "in your PATH variable to make gcc visible."
exit 1
fi
echo -n "checking for gcc w/Ada (with gcc)... "
(exec $CC -c spar_os.ads >/dev/null 2>/dev/null)
#FreeBSD requires exec in a subshell because a command not found error
#is reported before the stderr redirect
echo "good"
if [ $? -eq 0 ] ; then
echo "yes"
else
echo "no"
echo -n "checking for gcc w/Ada (with gnatgcc)... "
CC="gnatgcc"
(exec $CC -c spar_os.ads >/dev/null 2>/dev/null)
if [ $? -eq 0 ] ; then
echo "yes"
else
echo "no"
echo -n "checking for gcc w/Ada (with adagcc)... "
CC="adagcc"
(exec $CC -c spar_os.ads >/dev/null 2>/dev/null)
if [ $? -eq 0 ] ; then
echo "yes"
else
echo "no"
echo -n "checking for gcc w/Ada (with gcc-gnat)... "
CC="gcc-gnat"
$CC -c spar_os.ads >/dev/null 2>/dev/null
if [ $? -eq 0 ] ; then
echo "yes"
else
echo "no"
echo
echo "--------------------------------------------------------------------------"
echo "Your system does not have a GCC compiler that understands the Ada language"
echo
echo "The name of the GCC package with Ada support depends on your operating system."
echo "Examples:"
echo " - Debian Linux users can try apt-get install gnat-3.3 (or similar)"
echo " - Fedora Linux users can try add/remove software gcc-gnat"
echo " - SuSE Linux users can try add/remove software gcc-ada"
echo
echo "Specifically, SparForte requires one of the following:"
echo " - GCC 3.x or newer with the Ada language enabled (http://gcc.gnu.org)"
echo " - ACT's GNAT compiler 3.14 or newer, based on GCC 2.7.2 (ftp://cs.nyu.edu/pub/gnat)"
echo
echo "Please update your system and re-run this script."
echo "--------------------------------------------------------------------------"
exit 1
fi
fi
fi
fi
# Check for the Ada Run-Time Library
echo -n "checking for libgnat (ldconfig -p, Linux)... "
TMP=`$LDCONFIG_SUDO /sbin/ldconfig -p 2>/dev/null | grep libgnat`
if [ -z "$TMP" ] ; then
echo "no"
echo -n "checking for libgnat (ldconfig -r, FreeBSD)... "
TMP=`/sbin/ldconfig -r 2>/dev/null | grep adalib`
# was libgnat. For freebsd, just settle on having adalib in the hints
if [ -z "$TMP" ] ; then
echo "no"
# Some FreeBSD put libgnat under /usr/local/lib but doesn't show
# up in ldconfig -r
echo -n "checking under /usr/local (e.g. some FreeBSD)... "
TMP=`find /usr/local -type f -name "libgnat*"`
if [ ! -z "$TMP" ] ; then
echo "yes"
else
echo "no"
echo -n "checking for libgnat.dylib (Darwin)..."
if [ ! -z "$LOCATE" ] ; then
TMP=`"$LOCATE" adalib/libgnat.dylib`
else
TMP=`"$FINDLIB" -name 'libgnat.dylib' -print`
fi
if [ ! -z "$TMP" ] ; then
echo "yes"
else
echo "no"
echo -n "checking for libgnat.dll.a (Cygwin)..."
if [ ! -z "$LOCATE" ] ; then
TMP=`"$LOCATE" adalib/libgnat | fgrep dll.a`
else
TMP=`"$FINDLIB" -name 'libgnat*' -print | fgrep dll.a`
fi
if [ ! -z "$TMP" ] ; then
echo "yes"
else
echo "no"
echo -n "checking for static libgnat.a only (e.g. Slackware)... "
# In some cases, this may return multiple files.
if [ ! -z "$LOCATE" ] ; then
TMP=`"$LOCATE" adalib/libgnat`
else
TMP=`"$FINDLIB" -name 'libgnat*' -print`
fi
if [ $? -eq 0 ] ; then
if [ ! -z "$LOCATE" ] ; then
TMP2=`"$LOCATE" adalib/libgnat.a`
else
TMP2=`"$FINDLIB" -name 'libgnat.a' -print`
fi
else
TMP2="fail-me"
fi
if [ "$TMP" = "$TMP2" ] ; then
echo "yes"
else
echo "no"
echo
echo "GCC Ada or GNAT is installed but the Ada Run-Time Environment"
echo "(libgnat) was not found. If libgnat.so was installed, you"
echo "may need to run ldconfig (as root) to update the shared"
echo "library search paths. You may need to edit ld.so.conf first"
echo "and add the path to libgnat's directory. If libgnat.a was"
echo "installed, run updatedb (as root) and this script should"
echo "detect it."
echo
exit 1
fi
fi
fi
fi
else
echo "yes"
fi
else
echo "yes"
fi
# Test version of scanner-calendar for this GCC Ada
if test ! -d ../test ; then
echo "test directory missing"
exit 192
fi
cd ../test # src to test
cp "../src/c_scanner.c" "c_scanner.c"
echo -n "compiling c calendar linkage function..."
(exec gcc -c c_scanner.c > /dev/null 2>/dev/null )
if [ $? -ne 0 ] ; then
echo "no"
echo
echo "This is a copy of the __gnat_localtime_tzoff function (renamed to"
echo "a __bush prefix). The C compile failed."
exit 192
else
echo "yes"
fi
SCANNER_VERSION="scanner-calendar-latest"
echo -n "trying calendar $SCANNER_VERSION ..."
cp "../src/$SCANNER_VERSION.ads" "scanner-calendar.ads"
cp "../src/$SCANNER_VERSION.adb" "scanner-calendar.adb"
(exec gnatmake -f scanner_test.adb -largs c_scanner.o > /dev/null 2>/dev/null )
if [ $? -ne 0 ] ; then
echo "no"
SCANNER_VERSION="scanner-calendar-pre441"
echo -n "trying calendar $SCANNER_VERSION ..."
cp "../src/$SCANNER_VERSION.ads" "scanner-calendar.ads"
cp "../src/$SCANNER_VERSION.adb" "scanner-calendar.adb"
(exec gnatmake -f scanner_test.adb -largs c_scanner.o > /dev/null 2>/dev/null )
if [ $? -ne 0 ] ; then
echo "no"
SCANNER_VERSION="scanner-calendar-pre431"
echo -n "trying calendar $SCANNER_VERSION ..."
cp "../src/$SCANNER_VERSION.ads" "scanner-calendar.ads"
cp "../src/$SCANNER_VERSION.adb" "scanner-calendar.adb"
(exec gnatmake -f scanner_test.adb -largs c_scanner.o > /dev/null 2>/dev/null )
if [ $? -ne 0 ] ; then
echo "no"
SCANNER_VERSION="scan-cal-gnat314"
echo -n "trying calendar $SCANNER_VERSION ..."
cp "../src/$SCANNER_VERSION.ads" "scanner-calendar.ads"
cp "../src/$SCANNER_VERSION.adb" "scanner-calendar.adb"
(exec gnatmake -f scanner_test.adb -largs c_scanner.o > /dev/null 2>/dev/null )
if [ $? -ne 0 ] ; then
echo "no"
echo
echo "no suitable version of scanner-calendar found"
echo
echo "scanner-calendar is a modified version of ada-calendar that"
echo "has the time as a non-private time so time values can be stored in"
echo "Bush variables. If this is a newer version of Ada, you may"
echo "need to provide your own version of scanner-calendar."
exit 1
else
cp "../src/$SCANNER_VERSION.ads" "../src/scanner-calendar.ads"
cp "../src/$SCANNER_VERSION.adb" "../src/scanner-calendar.adb"
echo "yes"
fi
else
cp "../src/$SCANNER_VERSION.ads" "../src/scanner-calendar.ads"
cp "../src/$SCANNER_VERSION.adb" "../src/scanner-calendar.adb"
echo "yes"
fi
else
cp "../src/$SCANNER_VERSION.ads" "../src/scanner-calendar.ads"
cp "../src/$SCANNER_VERSION.adb" "../src/scanner-calendar.adb"
echo "yes"
fi
else
cp "../src/$SCANNER_VERSION.ads" "../src/scanner-calendar.ads"
cp "../src/$SCANNER_VERSION.adb" "../src/scanner-calendar.adb"
echo "yes"
fi
# clean test directory
rm *.o *.ali scanner_test
rm scanner-calendar*
rm c_scanner.c
cd ../src/
# Check for ncurses (which includes tput)
echo -n "checking for tput... "
# was init now clear since init no longer in freebsd?!
# While building a container, newer versions of tput may fail because
# there is no tty.
if [ -z "$HAS_SUDO" ] ;then
echo "skipped"
else
(exec tput clear >/dev/null 2>/dev/null)
if [ $? -eq 0 ] ; then
echo "yes"
else
echo "no"
echo
echo "tput is sometimes included with the ncurses library (e.g. Cygwin)."
echo "Please install ncurses or another package with the tput command."
exit 1
fi
fi
# Check for libssl
echo -n "checking for libssl (ldconfig -p, Linux)... "
TMP=`$LDCONFIG_SUDO /sbin/ldconfig -p 2>/dev/null | fgrep libssl.so.`
if [ -z "$TMP" ] ; then
echo "no"
echo -n "checking for libssl.dylib (Darwin)..."
if [ ! -z "$LOCATE" ] ; then
TMP=`"$LOCATE" libssl.dylib`
else
TMP=`"$FINDLIB" -name 'libssl.dylib' -print`
fi
if [ ! -z "$TMP" ] ; then
echo "yes"
else
echo "no"
echo -n "checking for lib/openssl (Cygwin)..."
if [ ! -z "$LOCATE" ] ; then
TMP=`"$LOCATE" lib/openssl`
else
TMP=`"$FINDLIB" -name 'openssl*' -print`
fi
if [ ! -z "$TMP" ] ; then
echo "yes"
else
echo "no"
echo -n "checking for libssl (FreeBSD)..."
TMP=`$LDCONFIG_SUDO /sbin/ldconfig -r 2>/dev/null | fgrep libssl.so.`
if [ ! -z "$TMP" ] ; then
echo "yes"
else
echo "no"
echo
echo "If you have libssl, it may be version specific"
echo "Please make a general symbol link libssl.so to the "
echo "correct version and run ldconfig to update the"
echo "shared library list."
exit 1
fi
fi
fi
else
TMP=`$LDCONFIG_SUDO /sbin/ldconfig -p 2>/dev/null | grep libssl.so`
if [ -z "$TMP" ] ; then
echo "no"
echo -n "checking for libssl (ldconfig -r, FreeBSD)... "
TMP=`/sbin/ldconfig -r 2>/dev/null | grep libssl.so`
if [ -z "$TMP" ] ; then
echo "no"
echo
echo "Some database support requires libssl"
# TODO: test for database...and abort...
else
echo "yes"
fi
else
echo "yes"
fi
fi
# Check for the libSDL (Simple DirectMedia Layer) Library
if [ -z "$NO_SDL" ] ; then
echo -n "checking for libSDL (ldconfig -p, Linux)... "
TMP=`$LDCONFIG_SUDO /sbin/ldconfig -p 2>/dev/null | grep libSDL`
if [ -z "$TMP" ] ; then
echo "no"
echo -n "checking for libSDL (ldconfig -r, FreeBSD)... "
TMP=`/sbin/ldconfig -r 2>/dev/null | grep libSDL`
if [ -z "$TMP" ] ; then
echo "no"
echo -n "checking for libSDL (locate, Darwin)... "
if [ ! -z "$LOCATE" ] ; then
TMP=`"$LOCATE" libSDL libsdl`
else
TMP=`"$FINDLIB" -name 'libsdl*' -print`
fi
if [ ! -z "$TMP" ] ; then
echo "yes"
else
echo "no"
echo "No version of the Simple DirectMedia Layer (libSDL) was found"
echo "If you have installed libSDL, you may need to use ldconfig (as"
echo "root) to update the shared library search paths for libSDL"
echo
echo "libSDL is used by SparForte to access sound and graphics on your machine"
exit 1
fi
else
echo "yes"
fi
else
echo "yes"
fi
if [ -z "$SDL_CONFIG" ] ; then
SDL_CONFIG="sdl-config"
fi
echo -n "configuring SDL (SDL_config)... "
TMP=`(exec $SDL_CONFIG --version 2>/dev/null)`
if [ -z "$TMP" ] ; then
echo "no"
if [ -n "$PKGCONFIG" ] ; then
echo -n "configuring SDL (pkg-config)... "
# bundled SDL here
SDLLIBS=`(exec $PKGCONFIG --libs sdl 2>/dev/null)`" -lSDL_image"
SDLINCL=`(exec $PKGCONFIG --cflags sdl 2>/dev/null)`
if [ $? -ne 0 ] ; then
SDLLIBS=""
SDLINCL=""
echo "no"
else
echo "yes"
fi
fi
if [ -z "$SDLLIBS" ] ; then
echo "guessing at SDL configuration (may be incorrect)... "
# Cannot find SDL_config? Use these defaults for makefile sed...
if [ "$OS" = "FreeBSD" ] ; then
SDLLIBS="-L/usr/local/lib -lSDL-1.1 -lSDL_image -lpthread"
SDLINCL="-I/usr/local/include/SDL11"
elif [ "$OS" = "darwin" ] ; then
SDLLIBS="/Library/Frameworks/SDL.framework/SDL /Library/Frameworks/SDL_image.framework/SDL_image"
SDLINCL="-I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers"
elif [ -r "/usr/lib64/libSDL-1.2.so.0" ] ; then
# Red Hat 9
SDLLIBS="-L/usr/lib64/ -l:libSDL-1.2.so.0"
SDLINCL="-I/usr/local/include/SDL"
else
SDLLIBS="-L/usr/local/lib -lSDL -lSDL_image"
SDLINCL="-I/usr/local/include/SDL"
fi
fi
else
# Remove -D_REENTRANT (not recognized by GCC Ada)
SDLLIBS=`$SDL_CONFIG --libs`" -lSDL_image"
SDLINCL=`$SDL_CONFIG --cflags | sed "s/\ -D_REENTRANT//g"`
echo "yes"
fi
# Escape special characters (space and slash)
SDLLIBSTYPE=`echo "$SDLLIBS" | sed 's/\ /\\\ /g;s/\//\\\\\//g'`
SDLINCLTYPE=`echo "$SDLINCL" | sed 's/\ /\\\ /g;s/\//\\\\\//g'`
#if [ -z "$SDL_CONFIG" ] ; then
# SDL_CONFIG="sdl-config"
#fi
#echo -n "checking for SDL_config... "
#TMP=`(exec $SDL_CONFIG --version 2>/dev/null)`
#if [ -z "$TMP" ] ; then
# # Cannot find SDL_config? Use these defaults for makefile sed...
# if [ "$OS" = "FreeBSD" ] ; then
# SDLLIBSTYPE="-L\/usr\/local\/lib -lSDL-1.1\ -lSDL_image -lpthread"
# SDLINCLTYPE="-I\/usr\/local\/include\/SDL11"
# else
# SDLLIBSTYPE="-l\ SDL\ -l\ SDL_image"
# SDLINCLTYPE="-I\/usr\/include\/SDL"
# fi
# echo "no"
#else
# # Remove -D_REENTRANT (not recognized by GCC Ada) and escape special
# # sed characters (space and slash)
# SDLLIBSTYPE=`$SDL_CONFIG --libs`" -lSDL_image"
# SDLLIBSTYPE=`echo "$SDLLIBSTYPE" | sed 's/\ /\\\ /g;s/\//\\\\\//g'`
# SDLINCLTYPE=`$SDL_CONFIG --cflags | sed "s/\ -D_REENTRANT//g"`
# SDLINCLTYPE=`echo "$SDLINCLTYPE" | sed 's/\ /\\\ /g;s/\//\\\\\//g'`
# echo "yes"
#fi
# Bytes are aligned differently between 32-bit and 64-bit SDL data structures.
# Default to 64-bit else use 32-bit.