-
Notifications
You must be signed in to change notification settings - Fork 11
/
aclocal.m4
1109 lines (975 loc) · 27.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
#############################################################
#
# Macro to add for using GNU gettext
#
#############################################################
AC_DEFUN(AM_WITH_NLS,
[AC_MSG_CHECKING([whether NLS is requested])
dnl Default is enabled NLS
AC_ARG_ENABLE(nls,
[ --disable-nls do not use Native Language Support],
USE_NLS=$enableval, USE_NLS=yes)
AC_MSG_RESULT($USE_NLS)
AC_SUBST(USE_NLS)
GETTEXT_INTL="False"
HAVE_GETTEXT="False"
dnl If we use NLS figure out what method
if test "$USE_NLS" = "yes"; then
AC_DEFINE(ENABLE_NLS)
dnl Figure out whether gettext is available in the C or intl library.
nls_cv_header_intl=
nls_cv_header_libgt=
AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM([extern int gettext(char*);],
[return (int) gettext ("")])],
[gt_cv_func_gettext_libc=yes],
[gt_cv_func_gettext_libc=no])])
if test "$gt_cv_func_gettext_libc" != "yes"; then
AC_CHECK_LIB(intl, bindtextdomain,
[AC_CACHE_CHECK([for gettext in libintl],
gt_cv_func_gettext_libintl,
[AC_CHECK_LIB(intl, gettext,
gt_cv_func_gettext_libintl=yes,
gt_cv_func_gettext_libintl=no)],
gt_cv_func_gettext_libintl=no)])
if test "$gt_cv_func_gettext_libintl" = "yes"; then
GETTEXT_INTL="True"
fi
fi
if test "$gt_cv_func_gettext_libc" = "yes" \
|| test "$gt_cv_func_gettext_libintl" = "yes"; then
HAVE_GETTEXT="True"
fi
fi
dnl Make all variables we use known to autoconf.
AC_SUBST(GETTEXT_INTL)
AC_SUBST(HAVE_GETTEXT)
])
AC_DEFUN(AM_GNU_GETTEXT,
[AM_WITH_NLS
])
dnl Check if we are running under Windows with msys to use pwd -W which produces Windows paths such as d:/tool instead of /d/tool
AC_DEFUN(AM_CHECK_HOST_PWD,
[
if test x${awa_host_pwd_check} != xyes; then
case "${target_os}" in
mingw32*|cygwin*|mingw64*|msys)
awa_pwd_option="-W"
;;
*)
awa_pwd_option=""
;;
esac
awa_host_pwd_check=yes
fi
])
# Check whether we can use gprbuild or gnatmake
AC_DEFUN(AM_GNAT_CHECK_GPRBUILD,
[
AC_CHECK_PROGS(GPRBUILD, gprbuild, "")
if test -n "$GPRBUILD"; then
GNATMAKE="$GPRBUILD"
else
AC_CHECK_PROGS(GNATMAKE, gnatmake, "")
fi
if test -z "$GNATMAKE"; then
AC_MSG_ERROR([gnatmake or gprbuild must be installed.])
fi;
AC_CHECK_PROGS(GPRCLEAN, gprclean, "")
if test -n "$GPRCLEAN"; then
GNATCLEAN="$GPRCLEAN"
else
AC_CHECK_PROGS(GNATCLEAN, gnatclean, "")
fi
AC_CHECK_PROGS(GPRINSTALL, gprinstall, "")
])
# Check if a GNAT project is available.
# dnl AM_GNAT_CHECK_PROJECT([name],[path])
AC_DEFUN(AM_GNAT_CHECK_PROJECT,
[
AC_CACHE_CHECK([whether $1 project exists],[ac_cv_gnat_project_$1],[
echo "with \"$2\"; project conftest is for Source_Dirs use (); end conftest;" > conftest.gpr
if AC_TRY_COMMAND([$GNATCHECK -Pconftest.gpr $GNATCHECK_ARG > /dev/null 2>conftest.out])
then
ac_cv_gnat_project_$1=yes
ac_cv_gnat_project_with_$1="with \"$2\";";
else
ac_cv_gnat_project_$1=no
fi
rm -f conftest.gpr])
])
# Check if a GNAT project is available.
# AM_GNAT_FIND_PROJECT([ada-util],[Ada Utility Library],[util],[link],[code-fail],[code-ok])
AC_DEFUN(AM_GNAT_FIND_PROJECT,
[
AC_ARG_WITH($1,
AS_HELP_STRING([--with-$1=x], [Path for $2]),
[
if test "${withval}/" = "yes/"; then
ac_cv_gnat_project_name_$3=${awa_build_root}$1
else
ac_cv_gnat_project_name_$3=${withval}/
if test -d "${withval}"; then
ac_cv_gnat_project_name_$3=${withval}/$3
fi
fi
],
[
ac_cv_gnat_project_name_$3=${awa_build_root}$3
])
AC_CACHE_CHECK([$2],[ac_cv_gnat_project_$3],[
rm -f conftest.gpr
# Search in the GNAT project path.
echo "with \"${ac_cv_gnat_project_name_$3}\"; project conftest is for Source_Dirs use (); end conftest;" > conftest.gpr
if AC_TRY_COMMAND([$GNATCHECK -Pconftest.gpr $GNATCHECK_ARG > /dev/null 2>conftest.out])
then
ac_cv_gnat_project_$3=yes
else
ac_cv_gnat_project_$3=no
# Search in ../$1-*/$3.gpr
dir=`cd .. && pwd ${awa_pwd_option}`
files=`ls -r $dir/$1/$3.gpr $dir/$3/$3.gpr $dir/$1-*/$3.gpr 2>/dev/null`
for name in $files; do
dir=`dirname $name`
# AC_MSG_CHECKING([for $2 project in ${dir}])
echo "with \"${name}\"; project conftest is for Source_Dirs use (); end conftest;" > conftest.gpr
if AC_TRY_COMMAND([$GNATCHECK -Pconftest.gpr $GNATCHECK_ARG > /dev/null 2>conftest.out])
then
ac_cv_gnat_project_$3=yes
ac_cv_gnat_project_name_$3=${name}
# AC_MSG_RESULT(yes, using ${name})
break
else
ac_cv_gnat_project_$3=no
# AC_MSG_RESULT(no)
fi
done
if test x${ac_cv_gnat_project_$3} != xyes; then
echo "with \"$3\"; project conftest is for Source_Dirs use (); end conftest;" > conftest.gpr
if AC_TRY_COMMAND([$GNATCHECK -Pconftest.gpr $GNATCHECK_ARG > /dev/null 2>conftest.out])
then
ac_cv_gnat_project_$3=yes
ac_cv_gnat_project_name_$3=$3
else
ac_cv_gnat_project_$3=no
fi
fi
fi
rm -f conftest.gpr
if test x${ac_cv_gnat_project_$3} = xyes; then
ac_cv_gnat_project_with_$3="with \"${ac_cv_gnat_project_name_$3}\";";
ac_cv_gnat_project_dir_$3=`dirname ${ac_cv_gnat_project_name_$3}`
if test ${ac_cv_gnat_project_dir_$3} = . ; then
ac_cv_gnat_project_dir_$3=
else
ac_cv_gnat_project_dir_$3="${ac_cv_gnat_project_dir_$3}/"
fi
else
ac_cv_gnat_project_dir_$3=
ac_cv_gnat_project_name_$3=
fi
])
if test x${ac_cv_gnat_project_$3} = xyes; then
$6
else
if test x"$5" != x; then
AC_MSG_RESULT(no)
AC_MSG_ERROR([$5
You should build and install the $2 component.
It must be available and found by ${GNATMAKE}.
This project was not found in the ADA_PROJECT_PATH environment variable.
This project was not found in ../$3 nor in ../$1-*.
The component is available at $4.
Please, download and configure $2.
The current configuration was using:
${GNATMAKE}
ADA_PROJECT_PATH=$ADA_PROJECT_PATH
])
fi
fi
])
dnl Check for utilada_base GNAT project
AC_DEFUN(AM_GNAT_FIND_ADA_UTIL,
[
AM_GNAT_FIND_PROJECT([ada-util],[Ada Utility Library],[utilada_base],
[git@github.com:stcarrez/ada-util.git],
[Building $1 requires the Ada Utility Library.],
[
UTIL_DIR=${ac_cv_gnat_project_dir_utilada_base}
])
AC_SUBST(UTIL_DIR)
])
dnl Check for elada GNAT project
AC_DEFUN(AM_GNAT_FIND_ADA_EL,
[
AM_GNAT_FIND_PROJECT([ada-el],[Ada Expression Language Library],[elada],
[git@github.com:stcarrez/ada-el.git],
[Building $1 requires the Ada EL Library.],
[
EL_DIR=${ac_cv_gnat_project_dir_elada}
])
AC_SUBST(EL_DIR)
])
dnl Check for security GNAT project
AC_DEFUN(AM_GNAT_FIND_ADA_SECURITY,
[
AM_GNAT_FIND_PROJECT([ada-security],[Ada Security Library],[security],
[git@github.com:stcarrez/ada-security.git],
[Building $1 requires the Ada Security Library.],
[
SECURITY_DIR=${ac_cv_gnat_project_dir_security}
])
AC_SUBST(SECURITY_DIR)
])
dnl Check for servletada GNAT project
AC_DEFUN(AM_GNAT_FIND_ADA_SERVLET,
[
AM_GNAT_FIND_PROJECT([ada-servlet],[Ada Servlet Library],[servletada],
[git@github.com:stcarrez/ada-servlet.git],
[Building $1 requires the Ada Servlet Library.],
[
SERVLET_DIR=${ac_cv_gnat_project_dir_servletada}
])
AC_SUBST(SERVLET_DIR)
])
dnl Check for asf GNAT project
AC_DEFUN(AM_GNAT_FIND_ADA_SERVER_FACES,
[
AM_GNAT_FIND_PROJECT([ada-asf],[Ada Server Faces],[asf],
[git@github.com:stcarrez/ada-asf.git],
[Building $1 requires the Ada Server Faces Library.],
[
ASF_DIR=${ac_cv_gnat_project_dir_asf}
])
AC_SUBST(ASF_DIR)
])
dnl Check for ado GNAT project
AC_DEFUN(AM_GNAT_FIND_ADA_ADO,
[
AM_GNAT_FIND_PROJECT([ada-ado],[Ada Database Objects],[ado],
[git@github.com:stcarrez/ada-ado.git],
[Building $1 requires the Ada Database Objects Library.],
[
ADO_DIR=${ac_cv_gnat_project_dir_ado}
])
AC_SUBST(ADO_DIR)
])
dnl Check for wikiada GNAT project
AC_DEFUN(AM_GNAT_FIND_ADA_WIKI,
[
AM_GNAT_FIND_PROJECT([ada-wiki],[Ada Wiki Library],[wikiada],
[git@github.com:stcarrez/ada-wiki.git],
[Building $1 requires the Ada Wiki Library.],
[
WIKI_DIR=${ac_cv_gnat_project_dir_wikiada}
])
AC_SUBST(WIKI_DIR)
])
dnl Check for swaggerada GNAT project
AC_DEFUN(AM_GNAT_FIND_ADA_OPENAPI,
[
AM_GNAT_FIND_PROJECT([openapi-ada],[OpenAPI Ada Library],[openapi],
[git@github.com:stcarrez/swagger-ada.git],
[Building $1 requires the Ada OpenAPI Library.],
[
OPENAPI_DIR=${ac_cv_gnat_project_dir_openapi}
])
AC_SUBST(OPENAPI_DIR)
])
dnl Check for swaggerada GNAT project
AC_DEFUN(AM_GNAT_FIND_ADA_KEYSTORE,
[
AM_GNAT_FIND_PROJECT([ada-keystore],[Ada Keystore Library],[keystoreada],
[git@github.com:stcarrez/ada-keystore.git],
[Building $1 requires the Ada Keystore Library.],
[
KEYSTOREADA_DIR=${ac_cv_gnat_project_dir_keystoreada}
])
AC_SUBST(KEYSTOREADA_DIR)
])
dnl Check for AWA GNAT project
AC_DEFUN(AM_GNAT_FIND_ADA_AWA,
[
AM_GNAT_FIND_PROJECT([awa],[Ada Web Application],[awa],
[git@github.com:stcarrez/ada-awa.git],
[Building $1 requires the Ada Web Application Library.],
[
AWA_DIR=${ac_cv_gnat_project_dir_awa}
])
AC_SUBST(AWA_DIR)
])
dnl Check for XML/Ada_base GNAT project
dnl AM_GNAT_FIND_PROJECT([code-found],[not-found])
AC_DEFUN(AM_GNAT_FIND_XML_ADA,
[
gnat_xml_ada=xmlada-config
AC_ARG_WITH(xmlada,
AS_HELP_STRING([--with-xmlada=], [Path for XML/Ada]),
[
if test T${withval} = Tno ; then
HAVE_XML_ADA=no;
else
gnat_xml_ada=${withval}/xmlada-config;
WITH_XML_ADA="with \"${withval}\";";
HAVE_XML_ADA='yes';
fi
],
[
WITH_XML_ADA='';
HAVE_XML_ADA='yes';
])
if test T$HAVE_XML_ADA = Tyes ; then
AM_GNAT_CHECK_PROJECT([xmlada_sax],[xmlada_sax])
if test T$ac_cv_gnat_project_xmlada_sax = Tno; then
AM_GNAT_CHECK_PROJECT([xmlada],[xmlada])
fi
AC_CACHE_CHECK([XML/Ada version],[ac_cv_gnat_xmlada_version],[
if test T$HAVE_XML_ADA = Tyes ; then
gnat_xmlada_version=`$gnat_xml_ada --version 2>/dev/null | sed -e 's, ,-,g'`
else
gnat_xmlada_version=none
HAVE_XML_ADA='no'
fi
case $gnat_xmlada_version in
XmlAda-3.2*)
ac_cv_gnat_xmlada_version='3'
;;
XmlAda-4.*|XmlAda-2013|XmlAda-2014)
ac_cv_gnat_xmlada_version='4'
;;
*)
ac_cv_gnat_xmlada_version='none'
HAVE_XML_ADA='no'
;;
esac
if test T$ac_cv_gnat_project_xmlada_sax = Tno; then
if test T$ac_cv_gnat_project_xmlada != Tyes; then
ac_cv_gnat_xmlada_version='none'
HAVE_XML_ADA='no'
fi
else
ac_cv_gnat_xmlada_version='4'
HAVE_XML_ADA='yes'
fi
])
else
ac_cv_gnat_project_xmlada_sax='no'
fi
if test T$ac_cv_gnat_project_xmlada = Tyes; then
WITH_XML_ADA="with \"xmlada\";";
fi
if test T$ac_cv_gnat_project_xmlada_sax = Tyes; then
WITH_XML_ADA="with \"xmlada_sax\";";
fi
VERSION_XML_ADA=$ac_cv_gnat_xmlada_version
case T$HAVE_XML_ADA in
Tyes)
$1
;;
Tno)
WITH_XML_ADA='';
VERSION_XML_ADA='none';
HAVE_XML_ADA='no'
$2
;;
esac
AC_SUBST(WITH_XML_ADA)
AC_SUBST(VERSION_XML_ADA)
AC_SUBST(HAVE_XML_ADA)
])
dnl Check whether the shared library support is enabled.
AC_DEFUN(AM_SHARED_LIBRARY_SUPPORT,
[
AC_MSG_CHECKING([shared library support])
ac_enable_shared=no
AC_ARG_ENABLE(shared,
[ --enable-shared Enable the shared libraries (disabled)],
[case "${enableval}" in
no|none) ac_enable_shared=no ;;
*) ac_enable_shared=yes ;;
esac])dnl
ac_enable_default_shared=no
AC_ARG_ENABLE(default-shared,
[ --enable-default-shared Use shared libraries by default (disabled)],
[case "${enableval}" in
no|none) ac_enable_default_shared=no ;;
*) ac_enable_default_shared=yes ;;
esac])dnl
AC_MSG_RESULT(${ac_enable_shared})
BUILDS_SHARED=$ac_enable_shared
AC_SUBST(BUILDS_SHARED)
AC_MSG_CHECKING([default library type])
if test ${ac_enable_shared} = yes && test ${ac_enable_default_shared} = yes; then
DEFAULT_LIBRARY_TYPE='relocatable'
else
DEFAULT_LIBRARY_TYPE='static'
fi
AC_MSG_RESULT(${DEFAULT_LIBRARY_TYPE})
AC_SUBST(DEFAULT_LIBRARY_TYPE)
])
dnl Check whether the coverage support is enabled.
AC_DEFUN(AM_COVERAGE_SUPPORT,
[
AC_MSG_CHECKING([coverage support])
ac_enable_coverage=no
AC_ARG_ENABLE(coverage,
[ --enable-coverage build with coverage support -fprofile-arcs -ftest-coverage (disabled)],
[case "${enableval}" in
no|none) ac_enable_coverage=no ;;
*) ac_enable_coverage=yes ;;
esac])dnl
AC_MSG_RESULT(${ac_enable_coverage})
BUILDS_COVERAGE=$ac_enable_coverage
AC_SUBST(BUILDS_COVERAGE)
if test T$ac_enable_coverage = Tyes; then
ac_build_mode='coverage'
fi
])
dnl Check whether the distrib/debug build is enabled.
AC_DEFUN(AM_DISTRIB_SUPPORT,
[
AC_MSG_CHECKING([distribution build])
ac_enable_distrib=yes
ac_quiet_mode=-q
ac_build_mode=distrib
AC_ARG_ENABLE(distrib,
[ --enable-distrib build for distribution, optimized and strip symbols (enabled)],
[case "${enableval}" in
no|none) ac_enable_distrib=no
ac_build_mode=debug
ac_quiet_mode=
;;
*) ac_enable_distrib=yes
ac_build_mode=distrib
ac_quiet_mode=-q
;;
esac])dnl
AC_MSG_RESULT(${ac_enable_distrib})
BUILDS_DISTRIB=$ac_enable_distrib
AC_SUBST(BUILDS_DISTRIB)
BUILDS_QUIET=$ac_quiet_mode
AC_SUBST(BUILDS_QUIET)
])
dnl Check whether the AWS support is enabled and find the aws GNAT project.
AC_DEFUN(AM_GNAT_CHECK_AWS,
[
dnl Define option to enable/disable AWS
gnat_enable_aws=yes
gnat_project_aws=no
gnat_project_name_aws=
AC_ARG_ENABLE(aws,
[ --enable-aws Enable the AWS support (enabled)],
[case "${enableval}" in
no|none) gnat_enable_aws=no ;;
*) gnat_enable_aws=yes ;;
esac])dnl
AC_MSG_CHECKING([AWS support is enabled])
AC_MSG_RESULT(${gnat_enable_aws})
if test T$gnat_enable_aws = Tyes; then
dnl AC_MSG_NOTICE([Ada Web Server library (http://libre.adacore.com/libre/tools/aws/)])
AC_ARG_WITH(aws,
AS_HELP_STRING([--with-aws=x], [Path for the Ada Web Server library (http://libre.adacore.com/libre/tools/aws/)]),
[
gnat_project_name=${withval}
],
[
gnat_project_name=aws
])
AM_GNAT_CHECK_PROJECT([aws],[${gnat_project_name}])
if test x$ac_cv_gnat_project_aws = xno; then
gnat_enable_aws=no
else
gnat_project_aws=aws
fi
fi
if test T$gnat_enable_aws = Tno; then
$1
else
$2
fi
])
dnl Setup installation paths
dnl AM_UTIL_INSTALL([inc],[ali],[lib],[prj])
AC_DEFUN(AM_UTIL_INSTALL,
[
gnat_prefix=
for dir in $1 $2 $3 $4; do
dir=`echo $dir | sed -e 's,\\\\,/,g'`
# If we have a valid path, try to identify the common path prefix.
if test x$gnat_prefix = x; then
gnat_prefix=$dir
else
# echo "Dir=$dir"
gnat_old_ifs=$IFS
path=
IFS='/\'
for c in $dir; do
if test x"$path" = x"/" || test x"$path" = x ; then
case $c in
c:|C:|d:|D:|e:|E:)
try="$c"
;;
*)
try="/$c"
;;
esac
else
try="$path/$c"
fi
# echo "gnat_prefix=$gnat_prefix try=$try path=$path c=$c"
case $gnat_prefix in
$try*)
;;
*)
break
;;
esac
path=$try
done
IFS=$gnat_old_ifs
gnat_prefix=$path
fi
done
ADA_INC_BASE=`echo $1 | sed -e 's,\\\\,/,g' | sed -e s,^$gnat_prefix/,,`
ADA_ALI_BASE=`echo $2 | sed -e 's,\\\\,/,g' | sed -e s,^$gnat_prefix/,,`
ADA_LIB_BASE=`echo $3 | sed -e 's,\\\\,/,g' | sed -e s,^$gnat_prefix/,,`
ADA_PRJ_BASE=`echo $4 | sed -e 's,\\\\,/,g' | sed -e s,^$gnat_prefix/,,`
AC_MSG_CHECKING([installation of Ada source files])
AC_MSG_RESULT(<prefix>/${ADA_INC_BASE})
AC_MSG_CHECKING([installation of Ada ALI files])
AC_MSG_RESULT(<prefix>/${ADA_ALI_BASE})
AC_MSG_CHECKING([installation of library files])
AC_MSG_RESULT(<prefix>/${ADA_LIB_BASE})
AC_MSG_CHECKING([installation of GNAT project files])
AC_MSG_RESULT(<prefix>/${ADA_PRJ_BASE})
AC_SUBST(ADA_INC_BASE)
AC_SUBST(ADA_LIB_BASE)
AC_SUBST(ADA_ALI_BASE)
AC_SUBST(ADA_PRJ_BASE)
])
dnl Check by using xmlada-config where some files are installed.
dnl The goad is to find or guess some installation paths.
dnl XML/Ada Debian
dnl *.ads <prefix>/include/xmlada <prefix>/usr/share/adainclude/xmlada
dnl *.ali <prefix>/lib/xmlada/static <prefix>/usr/lib/<arch>/ada/adalib/xmlada
dnl *.so <prefix>/lib/xmlada/static <prefix>/usr/lib/<arch>
dnl *.prj <prefix>/lib/gnat <prefix>/usr/share/adainclude
AC_DEFUN(AM_GNAT_CHECK_INSTALL,
[
#
ac_cv_gnat_prefix=
ac_cv_gnat_xml_inc_dir=
ac_cv_gnat_xml_ali_dir=
ac_cv_gnat_xml_lib_dir=
ac_cv_gnat_xml_prl_dir=
if test x${ac_cv_gnat_xml_ada} = 'x'; then
ac_cv_gnat_xml_ada=xmlada-config
fi
ac_cv_gnat_xml_config=`$gnat_xml_ada --sax 2>/dev/null`
# echo "Config: $gnat_xml_config"
for i in $ac_cv_gnat_xml_config; do
# echo " Checking $i"
case $i in
-aI*)
name=`echo $i | sed -e 's,-aI,,'`
dir=`dirname $name`
name=`basename $name`
if test x$name = "xxmlada"; then
ac_cv_gnat_xml_inc_dir=$dir
else
dir=''
fi
;;
-aO*)
name=`echo $i | sed -e 's,-aO,,'`
dir=`dirname $name`
name=`basename $name`
case $name in
xmlada)
ac_cv_gnat_xml_ali_dir=$dir
;;
static|relocatable)
name=`basename $dir`
dir=`dirname $dir`
if test x$name = "xxmlada"; then
ac_cv_gnat_xml_ali_dir=$dir
else
dir=''
fi
;;
*)
dir=''
;;
esac
;;
-largs)
dir=''
;;
-L*)
dir=`echo $i | sed -e 's,-L,,'`
ac_cv_gnat_xml_lib_dir=$dir
;;
/*.a)
dir=`dirname $i`
name=`basename $dir`
case $name in
xmlada)
dir=`dirname $dir`
ac_cv_gnat_xml_lib_dir=$dir
;;
static|relocatable)
dir=`dirname $dir`
name=`basename $dir`
if test x$name = "xxmlada"; then
dir=`dirname $dir`
ac_cv_gnat_xml_lib_dir=$dir
else
dir=''
fi
;;
*)
dir=''
;;
esac
;;
*)
dir=
;;
esac
# If we have a valid path, try to identify the common path prefix.
if test x$dir != "x"; then
if test x$ac_cv_gnat_prefix = x; then
ac_cv_gnat_prefix=$dir
else
# echo "Dir=$dir"
gnat_old_ifs=$IFS
path=
IFS=/
for c in $dir; do
if test x"$path" = x"/"; then
try="/$c"
else
try="$path/$c"
fi
# echo "gnat_prefix=$gnat_prefix try=$try path=$path c=$c"
case $ac_cv_gnat_prefix in
$try*)
;;
*)
break
;;
esac
path=$try
done
IFS=$gnat_old_ifs
ac_cv_gnat_prefix=$path
fi
fi
done
if test -f $ac_cv_gnat_prefix/lib/gnat/xmlada.gpr ; then
ac_cv_gnat_xml_prj_dir=$ac_cv_gnat_prefix/lib/gnat
elif test -f $gnat_xml_inc_dir/xmlada.gpr ; then
ac_cv_gnat_xml_prj_dir=$ac_cv_gnat_xml_inc_dir
elif test -f $ac_cv_gnat_prefix/share/gpr/xmlada.gpr ; then
ac_cv_gnat_xml_prj_dir=$ac_cv_gnat_prefix/share/gpr
else
ac_cv_gnat_xml_prj_dir=$gnat_xml_inc_dir
fi
if test x${ac_cv_gnat_xml_inc_dir} = x ; then
ac_cv_gnat_xml_inc_dir='include'
fi
if test x${ac_cv_gnat_xml_lib_dir} = x ; then
ac_cv_gnat_xml_lib_dir='lib'
fi
if test x${ac_cv_gnat_xml_ali_dir} = x ; then
ac_cv_gnat_xml_ali_dir='lib'
fi
if test x${ac_cv_gnat_xml_prj_dir} = x ; then
ac_cv_gnat_xml_prj_dir='lib/gnat'
fi
ADA_INC_BASE=`echo $ac_cv_gnat_xml_inc_dir | sed -e s,^$ac_cv_gnat_prefix/,,`
ADA_LIB_BASE=`echo $ac_cv_gnat_xml_lib_dir | sed -e s,^$ac_cv_gnat_prefix/,,`
ADA_ALI_BASE=`echo $ac_cv_gnat_xml_ali_dir | sed -e s,^$ac_cv_gnat_prefix/,,`
ADA_PRJ_BASE=`echo $ac_cv_gnat_xml_prj_dir | sed -e s,^$ac_cv_gnat_prefix/,,`
AM_UTIL_INSTALL([${ac_cv_gnat_xml_inc_dir}],[${ac_cv_gnat_xml_ali_dir}],[${ac_cv_gnat_xml_lib_dir}],[${ac_cv_gnat_xml_prj_dir}])
])
# AM_TRY_ADA and AM_HAS_INTRINSIC_SYNC_COUNTERS are imported from GNATcoll aclocal.m4
#############################################################
# Check whether gnatmake can compile, bind and link an Ada program
# AM_TRY_ADA(gnatmake,filename,content,success,failure)
#############################################################
AC_DEFUN(AM_TRY_ADA,
[
cat > conftest.ada <<EOF
[$3]
EOF
if AC_TRY_COMMAND([gnatchop -q conftest.ada && $1 $2 >/dev/null 2>conftest.out])
then
: Success
$4
else
: Failure
$5
fi
rm -rf conftest.ada
])
#############################################################
# Check whether platform/GNAT supports atomic increment/decrement
# operations.
# The following variable is then set:
# SYNC_COUNTERS_IMPL
# to either "intrinsic" or "mutex"
# Code comes from the PolyORB configure.ac
#############################################################
AC_DEFUN(AM_HAS_INTRINSIC_SYNC_COUNTERS,
[
AC_MSG_CHECKING([whether platform supports atomic inc/dec])
AM_TRY_ADA([gnatmake], [check.adb],
[
with Interfaces; use Interfaces;
procedure Check is
function Sync_Add_And_Fetch
(Ptr : access Interfaces.Integer_32;
Value : Interfaces.Integer_32) return Interfaces.Integer_32;
pragma Import (Intrinsic, Sync_Add_And_Fetch, "__sync_add_and_fetch_4");
X : aliased Interfaces.Integer_32;
Y : Interfaces.Integer_32 := 0;
pragma Volatile (Y);
-- On some platforms (e.g. i386), GCC has limited support for
-- __sync_add_and_fetch_4 for the case where the result is not used.
-- Here we want to test for general availability, so make Y volatile to
-- prevent the store operation from being discarded.
begin
Y := Sync_Add_And_Fetch (X'Access, 1);
end Check;
],
[
AC_MSG_RESULT(yes)
$1
],[
AC_MSG_RESULT(no)
$2
])
rm -f check.adb check check.o check.ali
])
# Prepare for using the GNAT project
# AM_GNAT_LIBRARY_SETUP([name])
AC_DEFUN(AM_GNAT_LIBRARY_SETUP,
[
AC_MSG_CHECKING([preparing for GNAT project $1])
mkdir -p obj/$1/static obj/$1/relocatable lib/$1/static lib/$1/relocatable
AC_MSG_RESULT(done)
])
# Prepare for using the GNAT project
# AM_GNAT_LIBRARY_PROJECT([name])
AC_DEFUN(AM_GNAT_LIBRARY_PROJECT,
[
AC_ARG_WITH(build-root,
AS_HELP_STRING([--with-build-root=PATH], [Path to find the Ada libraries]),
[
awa_build_root=${withval}/
],
[
awa_build_root=''
])
if test x${awa_build_root} != x; then
AM_CHECK_HOST_PWD
awa_build_pwd=`cd ${awa_build_root} && pwd $awa_pwd_option`
if test x${awa_build_pwd} != x${awa_build_root}; then
awa_build_root=${awa_build_pwd}/
fi
fi
# checking for local tools
AC_CANONICAL_TARGET
AM_GNAT_CHECK_GPRBUILD
AC_CHECK_PROGS(GNAT, gnat, "")
if test -n "$GNAT"; then
GNATCHECK="$GNAT ls"
GNATCHECK_ARG=" system.ads"
else
GNATCHECK="$GNATMAKE"
GNATCHECK_ARG=""
fi
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_LN_S
AM_SHARED_LIBRARY_SUPPORT
AM_DISTRIB_SUPPORT
AM_COVERAGE_SUPPORT
BUILD=$ac_build_mode
AC_SUBST(BUILD)
AC_CACHE_CHECK([number of processors],[ac_cv_proc_count],[
ac_cv_proc_count=`getconf _NPROCESSORS_CONF 2>/dev/null || getconf NPROCESSORS_CONF 2>/dev/null || echo 1`
])
NR_CPUS=$ac_cv_proc_count
AC_SUBST(NR_CPUS)
AM_GNAT_LIBRARY_SETUP($1)
])
dnl Check and retrieve the Ada Web Server version
dnl HTTP Delete is supported after 2017
AC_DEFUN(AM_GNAT_AWS_VERSION,
[
AC_CACHE_CHECK([checking AWS version],[ac_cv_gnat_aws_version],[
cat > conftest.adb <<EOF
with AWS;
with Ada.Text_IO;
procedure Conftest is
begin
Ada.Text_IO.Put_Line (AWS.Version);
end Conftest;
EOF
cat > conftest.gpr <<EOF
with "aws";
project t is
for Main use ("conftest.adb");
end t;
EOF
if AC_TRY_COMMAND([gnatmake -Pconftest.gpr >/dev/null 2>conftest.out])
then
ac_cv_gnat_aws_version=`./conftest`
else
ac_cv_gnat_aws_version='none'
fi
rm -f conftest conftest.o conftest.ali
if test "$ac_cv_gnat_aws_version" = "20.0"; then
dnl The version 20.0 is sometimes wrong because used by several versions of AWS.
dnl The version 22.0 has the AWS.HTTP_2 constant defined and uses version 20.0.
dnl Check for that and fix the version.
cat > conftest.adb <<EOF
with AWS;
with Ada.Text_IO;
procedure Conftest is
begin
Ada.Text_IO.Put_Line (AWS.HTTP_2);
end Conftest;
EOF
if AC_TRY_COMMAND([gnatmake -Pconftest.gpr >/dev/null 2>conftest.out])
then
ac_cv_gnat_aws_version="22.0"
fi
fi
rm -f conftest.gpr conftest.adb conftest.o conftest.ali
rm -f b__conftest.ads b__conftest.adb b__conftest.o b__conftest.ali
])
AWS_VERSION=$ac_cv_gnat_aws_version
AC_SUBST(AWS_VERSION)
])
dnl Check the OS and CPU to build Ada Util configuration (UTIL_OS)
AC_DEFUN(AM_ADA_UTIL_HARDWARE,
[
AC_CANONICAL_TARGET
os_base='unix'
os_version='none'
AC_MSG_CHECKING([operating system])
case "${target_os}" in
linux|linux-*|solaris*|sysv-*)
os_version='linux'
;;
netbsd*|dragonfly*)
os_version='netbsd'
;;
openbsd*|freebsd*)
# Let OpenBSD people cry
os_version='freebsd'
;;
macos*|darwin*)
os_version='macos'
;;
mingw32*|cygwin*|mingw64*|msys)
os_version='win'
os_base='windows'
;;
mingw32*|cygwin*|mingw64*|msys)
os_version='win'
os_base='windows'
;;