forked from intel-staging/libptpmgmt_iaclocklib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
1167 lines (1062 loc) · 41 KB
/
configure.ac
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
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: Copyright © 2022 Erez Geva <ErezGeva2@gmail.com> */
#
# @file
# @brief configuration
#
# @author Erez Geva <ErezGeva2@@gmail.com>
# @copyright © 2022 Erez Geva
#
AC_COPYRIGHT(Copyright © 2022 Erez Geva)
AC_PREREQ([2.69])
m4_define([ptpm_VER], m4_esyscmd_s([. ./tools/version && echo "$ver_maj.$ver_min"]))
AC_INIT([libptpmgmt], m4_defn([ptpm_VER]), [],
[libptpmgmt-]m4_defn([ptpm_VER]).txz,
[https://libptpmgmt.nwtime.org])
AC_CONFIG_FILES([defs.mk])
AC_CONFIG_SRCDIR([src/mngIds.m4])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_LANG([C++])
AC_PROG_CC
AC_PROG_CXX
AC_PROG_GREP
AC_PROG_EGREP
AC_PROG_FGREP
AC_PROG_RANLIB
AC_PROG_SED
AC_PROG_INSTALL
AC_PROG_MKDIR_P
AC_PROG_LN_S
#----------------------------------------------------------------
# globals
#----------------------------------------------------------------
AS_VAR_SET([ptpm_include_dirs],
["$includedir /usr/local/include /usr/include /opt/local/include"])
#----------------------------------------------------------------
# Macroes
#----------------------------------------------------------------
m4_define([ptpm_result],
[AS_IF([test -z "${$1}"], [AC_MSG_RESULT([not found])],
[AC_MSG_RESULT([${$1}])])])
m4_define([ptpm_basename],
[AS_VAR_SET([$1], [`expr "X$2" : 'X.*/\(.*\)'`])])
#----------------------------------------------------------------
# Tools
#----------------------------------------------------------------
AS_UNSET([ASTYLEVER])
AS_UNSET([ASTYLEMINVER])
AS_UNSET([DOXYGENVER])
AS_UNSET([DOXYGENMINVER])
AC_CHECK_TOOLS([M4], [m4 autom4te])
AC_CHECK_TOOLS([CTAGS], [ctags ctags-exuberant])
AC_CHECK_TOOLS([READLINK], [readlink])
AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
AC_CHECK_TOOL([ASTYLE], [astyle])
AC_MSG_CHECKING([for astyle version])
AS_IF([test -n "$ASTYLE"],
[AS_VAR_SET([astylever], ["`$ASTYLE -V`"])
for d in `$ASTYLE -V`; do :;done
AS_VAR_SET([ASTYLEVER], ["$d"])])
ptpm_result([ASTYLEVER])
AC_MSG_CHECKING([for astyle minimum version])
AS_VERSION_COMPARE([3.1], [$ASTYLEVER],
[AS_VAR_SET([ASTYLEMINVER], ["$ASTYLEVER"])], # above 3.1
[AS_VAR_SET([ASTYLEMINVER], ["$ASTYLEVER"])]) # equal 3.1
# version 3.3 add some changes, we will use in the future
AS_VERSION_COMPARE([3.2], [$ASTYLEVER],
[AS_UNSET([ASTYLEMINVER])]) # above 3.2
ptpm_result([ASTYLEMINVER])
AC_CHECK_TOOL([CPPCHECK], [cppcheck])
AC_CHECK_TOOL([DOXYGEN], [doxygen])
AC_MSG_CHECKING([for doxygen version])
AS_IF([test -n "$DOXYGEN"],
[AS_VAR_SET([DOXYGENVER], ["`$DOXYGEN -v`"])])
ptpm_result([DOXYGENVER])
AC_MSG_CHECKING([for doxygen minimum version])
AS_VERSION_COMPARE([1.8], [$DOXYGENVER],
[AS_VAR_SET([DOXYGENMINVER], ["$DOXYGENVER"])], # above 1.8
[AS_VAR_SET([DOXYGENMINVER], ["$DOXYGENVER"])]) # equal 1.8
ptpm_result([DOXYGENMINVER])
AC_CHECK_TOOL([DOTTOOL], [dot])
AC_CHECK_TOOL([EPSTOPDF_TOOL], [epstopdf])
AC_CHECK_TOOL([VALGRIND], [valgrind])
AC_SUBST([ASTYLEVER])
AC_SUBST([ASTYLEMINVER])
AC_SUBST([DOXYGENVER])
AC_SUBST([DOXYGENMINVER])
#----------------------------------------------------------------
# compilation
#----------------------------------------------------------------
AS_UNSET([USE_CROSS_COMPILE])
AS_UNSET([CXX_COLOR_USE])
AS_UNSET([CXX_COLOR_NONE])
AC_MSG_CHECKING([for cross compilation])
AS_IF([test "x$cross_compiling" = xyes],
[AS_VAR_SET([USE_CROSS_COMPILE], ["true"])])
ptpm_result([USE_CROSS_COMPILE])
m4_define([ptpm_cross],
[AS_IF([test -n "$USE_CROSS_COMPILE" &&\
(echo ${$1} | $GREP "$build_cpu" >/dev/null)],
[AS_VAR_SET([$1],
[`echo ${$1} | $SED "s%$build_cpu%$host_cpu%"`])])])
AC_MSG_CHECKING([compiler support colors])
# https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Message-Formatting-Options.html
AS_VAR_SET([ptpm_keep_cppflags], ["$CPPFLAGS"])
AS_VAR_SET([ptpm_color], ["-fdiagnostics-color=always"])
AS_VAR_SET([ptpm_color_none], ["-fno-diagnostics-color"])
AS_VAR_SET([CPPFLAGS], ["$ptpm_keep_cppflags $ptpm_color"])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([])],
[AS_VAR_SET([CXX_COLOR_USE], ["$ptpm_color"])
AS_VAR_SET([CXX_COLOR_NONE], ["$ptpm_color_none"])])
# https://clang.llvm.org/docs/UsersManual.html
AS_IF([test -z "$CXX_COLOR_USE"],
[AS_VAR_SET([ptpm_color], ["-fcolor-diagnostics"])
AS_VAR_SET([ptpm_color_none], ["-fno-color-diagnostics"])
AS_VAR_SET([CPPFLAGS], ["$ptpm_keep_cppflags $ptpm_color"])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([])],
[AS_VAR_SET([CXX_COLOR_USE], ["$ptpm_color"])
AS_VAR_SET([CXX_COLOR_NONE], ["$ptpm_color_none"])])])
ptpm_result([CXX_COLOR_USE])
AS_VAR_SET([CPPFLAGS], ["$ptpm_keep_cppflags"])
AC_SUBST([USE_CROSS_COMPILE])
AC_SUBST([CXX_COLOR_USE])
AC_SUBST([CXX_COLOR_NONE])
#----------------------------------------------------------------
# Miscellaneous
#----------------------------------------------------------------
# Root directory
AC_MSG_CHECKING([for project root folder])
AS_VAR_SET([ROOT_DIR], ["`pwd`"])
ptpm_result([ROOT_DIR])
AC_SUBST([ROOT_DIR])
AS_UNSET([CXXFLAGS_PMC])
AC_ARG_WITH([pmc-flags],
[AS_HELP_STRING([--with-pmc-flags=flags],
[compilation flags for pmc tool])],
[AS_VAR_SET([CXXFLAGS_PMC], ["$withval"])])
AC_SUBST([CXXFLAGS_PMC])
AS_UNSET([USE_FULL_PATH_LINK])
AC_ARG_ENABLE([full-link],
[AS_HELP_STRING([--enable-full-link],
[Use full path in symbolic link])],
[AS_VAR_SET([USE_FULL_PATH_LINK], ["true"])])
AC_SUBST([USE_FULL_PATH_LINK])
#----------------------------------------------------------------
# Testing tools
#----------------------------------------------------------------
AS_UNSET([HAVE_GTEST_HEADER])
AS_UNSET([GTEST_INC_FLAGS])
AS_UNSET([GTEST_LIB_FLAGS])
AS_UNSET([HAVE_CRITERION_HEADER])
AS_UNSET([CRITERION_INC_FLAGS])
AS_UNSET([CRITERION_LIB_FLAGS])
AC_CHECK_HEADER([gtest/gtest.h],
[AS_VAR_SET([HAVE_GTEST_HEADER], ["gtest/gtest.h"])])
# We do not use unit tests with cross compilation
AS_IF([test -n "$HAVE_GTEST_HEADER" && test -n "$PKG_CONFIG" &&\
test -z "$USE_CROSS_COMPILE" ],
[AS_VAR_SET([GTEST_INC_FLAGS], ["`$PKG_CONFIG --cflags gtest`"])
AS_VAR_SET([GTEST_LIB_FLAGS], ["`$PKG_CONFIG --libs gtest`"])
AC_CHECK_LIB([gtest], [main],
[AS_IF([test -z "$GTEST_LIB_FLAGS"],
[AS_VAR_SET([GTEST_LIB_FLAGS],
['-lgtest -lpthread'])])],
[AS_UNSET([GTEST_LIB_FLAGS])],
["$GTEST_LIB_FLAGS"])])
AC_CHECK_HEADER([criterion/criterion.h],
[AS_VAR_SET([HAVE_CRITERION_HEADER], ["criterion/criterion.h"])])
AS_VAR_SET([ptpm_c_include], ["#include"])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([$ptpm_c_include <$HAVE_CRITERION_HEADER>
$ptpm_c_include <criterion/new/assert.h>
$ptpm_c_include <criterion/new/memory.h>])],
[AS_VAR_SET([HAVE_CRITERION_HEADER],
["$HAVE_CRITERION_HEADER criterion/new/assert.h criterion/new/memory.h"])])
# We do not use unit test with cross compilation
AS_IF([test -n "$HAVE_CRITERION_HEADER" && test -n "$PKG_CONFIG" &&\
test -z "$USE_CROSS_COMPILE" ],
[AS_VAR_SET([CRITERION_INC_FLAGS], ["`$PKG_CONFIG --cflags criterion`"])
AS_VAR_SET([CRITERION_LIB_FLAGS], ["`$PKG_CONFIG --libs criterion`"])
AC_CHECK_LIB([criterion], [main],
[AS_IF([test -z "$CRITERION_LIB_FLAGS"],
[AS_VAR_SET([CRITERION_LIB_FLAGS],
['-lcriterion'])])],
[AS_UNSET([CRITERION_LIB_FLAGS])],
["$CRITERION_LIB_FLAGS"])])
AC_SUBST([HAVE_GTEST_HEADER])
AC_SUBST([GTEST_INC_FLAGS])
AC_SUBST([GTEST_LIB_FLAGS])
AC_SUBST([HAVE_CRITERION_HEADER])
AC_SUBST([CRITERION_INC_FLAGS])
AC_SUBST([CRITERION_LIB_FLAGS])
#----------------------------------------------------------------
# Find Address Sanitizer libraries
#----------------------------------------------------------------
AS_UNSET([ASAN_LIBS])
AS_VAR_SET([ptpm_keep_cppflags], ["$CPPFLAGS"])
AS_VAR_SET([ptpm_keep_ldflags], ["$LDFLAGS"])
for n in address pointer-compare pointer-subtract undefined leak; do
AS_VAR_SET([CPPFLAGS], ["$CPPFLAGS -fsanitize=$n"])
AS_VAR_SET([LDFLAGS], ["$LDFLAGS -fsanitize=$n"])
done
AC_MSG_CHECKING([for Address Sanitizer libraries])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([])],
[AS_VAR_SET([ASAN_LIBS],
[`ldd conftest$EXEEXT | $GREP 'san.so' | $SED 's/=>.*//;s/\n//' |\
tr '\n' ' ' `])
AC_MSG_RESULT([$ASAN_LIBS])],
[AC_MSG_RESULT([no])])
AS_VAR_SET([CPPFLAGS], ["$ptpm_keep_cppflags"])
AS_VAR_SET([LDFLAGS], ["$ptpm_keep_ldflags"])
AC_SUBST([ASAN_LIBS])
#----------------------------------------------------------------
# JSON libraries
#----------------------------------------------------------------
AS_UNSET([HAVE_JSONC_LIB])
AS_UNSET([JSONC_LIB_FLAGS])
AS_UNSET([HAVE_FJSON_LIB])
AS_UNSET([FJSON_LIB_FLAGS])
AC_ARG_WITH([json],
[AS_HELP_STRING([--without-json],
[Skip using all json libraries])],
[AS_VAR_SET([skip_json], ["$withval"])])
AC_ARG_WITH([jsonc],
[AS_HELP_STRING([--without-jsonc], [Skip using jsonc library])],
[AS_VAR_SET([skip_jsonc], ["$withval"])])
AC_ARG_WITH([fjson],
[AS_HELP_STRING([--without-fjson],
[Skip using libfastjson library])],
[AS_VAR_SET([skip_fsonc], ["$withval"])])
AS_IF([test "x$skip_json" = xno],
[AS_VAR_SET([skip_jsonc], ["no"])
AS_VAR_SET([skip_fsonc], ["no"])])
AS_IF([test "x$skip_jsonc" != xno],
[AC_CHECK_HEADER([json-c/json.h],
[AS_VAR_SET([HAVE_JSONC_LIB], ["json-c/json.h"])])
AS_IF([test -n "$HAVE_JSONC_LIB"],
[AC_CHECK_LIB([json-c], [json_c_version],
[AS_VAR_SET([JSONC_LIB_FLAGS], ["-ljson-c"])],
[AS_UNSET([HAVE_JSONC_LIB])])])])
AS_IF([test "x$skip_fsonc" != xno],
[AC_CHECK_HEADER([libfastjson/json.h],
[AS_VAR_SET([HAVE_FJSON_LIB], ["libfastjson/json.h"])])
AS_VAR_SET([FJSON_LIB_FLAGS], ["-lfastjson"])])
AC_SUBST([HAVE_JSONC_LIB])
AC_SUBST([JSONC_LIB_FLAGS])
AC_SUBST([HAVE_FJSON_LIB])
AC_SUBST([FJSON_LIB_FLAGS])
#----------------------------------------------------------------
# Version
#----------------------------------------------------------------
AS_UNSET([PACKAGE_VERSION_MAJ])
AS_UNSET([PACKAGE_VERSION_MIN])
AS_UNSET([PACKAGE_VERSION_VAL])
. ./tools/version
AC_MSG_CHECKING([for package version string])
ptpm_result([PACKAGE_VERSION])
AC_MSG_CHECKING([for package version major])
AS_VAR_SET([PACKAGE_VERSION_MAJ], ["$ver_maj"])
ptpm_result([PACKAGE_VERSION_MAJ])
AC_MSG_CHECKING([for package version minor])
AS_VAR_SET([PACKAGE_VERSION_MIN], ["$ver_min"])
ptpm_result([PACKAGE_VERSION_MIN])
AC_MSG_CHECKING([for package version value])
AS_VAR_SET([PACKAGE_VERSION_VAL], ["`printf '0x%.2x%.2x' $ver_maj $ver_min`"])
ptpm_result([PACKAGE_VERSION_VAL])
AC_SUBST([PACKAGE_VERSION_MAJ])
AC_SUBST([PACKAGE_VERSION_MIN])
AC_SUBST([PACKAGE_VERSION_VAL])
#----------------------------------------------------------------
# Ignore automake flags passed by Debian
#----------------------------------------------------------------
AC_ARG_ENABLE([dependency-tracking],
[AS_HELP_STRING([--disable-dependency-tracking], [ignored])])
AC_ARG_ENABLE([maintainer-mode],
[AS_HELP_STRING([--enable-maintainer-mode], [ignored])])
AC_ARG_ENABLE([silent-rules],
[AS_HELP_STRING([--disable-silent-rules], [ignored])])
#----------------------------------------------------------------
# Look for swig
#----------------------------------------------------------------
AS_UNSET([SWIG])
AS_UNSET([SWIGBIN])
AS_UNSET([SWIGVER])
AS_UNSET([SWIGMINVER])
AS_UNSET([SWIGLIB])
AS_UNSET([SWIGARGCARGV_GO])
AC_ARG_WITH([swig],
[AS_HELP_STRING([--without-swig], [Disable swig])]
[AS_HELP_STRING([--with-swig=path], [Set location of swig executable])],
[AS_VAR_SET([SWIGBIN], ["$withval"])],
[AS_VAR_SET([SWIGBIN], ["yes"])])
if test "x$SWIGBIN" = xno; then
AC_MSG_NOTICE([Disabling swig])
else
AS_IF([test "x$SWIGBIN" = xyes],
[AC_CHECK_TOOL([SWIG], [swig])],
[AS_VAR_SET([SWIG], ["$SWIGBIN"])])
AC_MSG_CHECKING([for swig version])
AS_VAR_SET([SWIGVER], ["`$SWIG -version | $GREP Version | $SED 's%.* %%'`"])
ptpm_result([SWIGVER])
AC_MSG_CHECKING([for swig minimum version])
AS_VERSION_COMPARE([4.1], [$SWIGVER],
[AS_VAR_SET([SWIGMINVER], ["$SWIGVER"])], # above 4.1
[AS_VAR_SET([SWIGMINVER], ["$SWIGVER"])]) # equal 4.1
ptpm_result([SWIGMINVER])
AC_MSG_CHECKING([for swig library])
AS_VAR_SET([SWIGLIB], ["`$SWIG -swiglib`"])
ptpm_result([SWIGLIB])
AS_IF([test -n "$SWIGLIB"],
[AC_MSG_CHECKING([for swig argcargv])
AS_IF([test ! -r $SWIGLIB/go/argcargv.i],
[AS_VAR_SET([SWIGARGCARGV_GO], ["true"])])
ptpm_result([SWIGARGCARGV_GO])])
fi
AC_SUBST([SWIG])
AC_SUBST([SWIGBIN])
AC_SUBST([SWIGVER])
AC_SUBST([SWIGMINVER])
AC_SUBST([SWIGLIB])
AC_SUBST([SWIGARGCARGV_GO])
#--------------------------------------------------------------------
# Target languages
#--------------------------------------------------------------------
AC_MSG_CHECKING([for build wrapper])
if test -z "$SWIGMINVER"; then
AS_VAR_SET([alllang_default], ["no"])
AC_MSG_RESULT([no proper swig])
else
AC_ARG_WITH([alllang],
[AS_HELP_STRING([--without-alllang], [Disable all languages])],
[AS_VAR_SET([with_alllang], ["$withval"])])
AS_IF([test "x$with_alllang" = "xno"],
[AS_VAR_SET([alllang_default], ["no"])],
[AS_VAR_SET([alllang_default], ["yes"])])
ptpm_result([alllang_default])
fi
#--------------------------------------------------------------------
# Look for Tcl
#--------------------------------------------------------------------
AS_UNSET([TCLPACKAGE])
AS_UNSET([TCLCONFIG])
AS_UNSET([TCLINCDIR])
AS_UNSET([TCLINCLUDE])
AS_UNSET([TCLLIB])
AS_UNSET([TCLVER])
AS_UNSET([TCLMINVER])
AS_UNSET([TCL_PKG_DIR])
AC_ARG_WITH([tclconfig],
[AS_HELP_STRING([--without-tcl], [Disable Tcl])]
[AS_HELP_STRING([--with-tclconfig=path], [Set location of tclConfig.sh])],
[AS_VAR_SET([with_tclconfig],["$withval"])],
[AS_UNSET([with_tclconfig])])
AC_ARG_WITH([tcl],
[AS_HELP_STRING([--with-tcl=path],
[Set location of Tcl package])],
[AS_VAR_SET([TCLPACKAGE], ["$withval"])],
[AS_VAR_SET([TCLPACKAGE], ["$alllang_default"])])
AC_ARG_WITH([tclincl],
[AS_HELP_STRING([--with-tclincl=path],
[Set location of Tcl include directory])],
[AS_VAR_SET([TCLINCDIR], ["$withval"])])
AC_ARG_WITH([tcllib],
[AS_HELP_STRING([--with-tcllib=path],
[Set location of Tcl library directory])],
[AS_VAR_SET([TCLLIB], ["-L$withval"])])
# First, check for "--without-tcl" or "--with-tcl=no".
if test "x$TCLPACKAGE" = xno; then
AC_MSG_NOTICE([Disabling Tcl])
AS_UNSET([TCLLIB])
else
AC_MSG_CHECKING([for Tcl configuration])
# First check to see if --with-tclconfig was specified.
if test "x$with_tclconfig" != x; then
AS_IF([test -f "$with_tclconfig/tclConfig.sh"],
[AS_VAR_SET([TCLCONFIG], ["`(cd $with_tclconfig; pwd)`"])],
[AC_MSG_ERROR([$with_tcl directory does not contain tclConfig.sh])])
fi
# check in a few common install locations
AS_VAR_SET([dirs], ["/usr/lib*/ /usr/lib*/tcl*/ /usr/local/lib*/"])
AS_VAR_SET([dirs], ["$dirs /usr/local/lib*/tcl*/"])
AS_IF([test "x$TCLCONFIG" = x],
[for d in $dirs; do
for i in `ls -d -r $d 2>/dev/null`; do
AS_IF([test -f $i"tclConfig.sh"],
[AS_VAR_SET([TCLCONFIG], ["`(cd $i; pwd)`"])
break])
done
done])
if test "x$TCLCONFIG" = x; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([found $TCLCONFIG/tclConfig.sh])
. $TCLCONFIG/tclConfig.sh
AS_IF([test -z "$TCLINCDIR"],
[AS_VAR_SET([TCLINCDIR],
[`echo $TCL_INCLUDE_SPEC | $SED 's%^-I%%'`])])
AS_IF([test -z "$TCLLIB"], [AS_VAR_SET([TCLLIB], ["$TCL_LIB_SPEC"])])
if test -n "$TCL_VERSION"; then
AC_MSG_CHECKING([for Tcl version])
AS_VAR_SET([TCLVER], ["$TCL_VERSION"])
AS_VERSION_COMPARE([8.0], [$TCL_VERSION],
[AS_VAR_SET([TCLMINVER], ["$TCLVER"])], # above 8.0
[AS_VAR_SET([TCLMINVER], ["$TCLVER"])]) # equal 8.0
ptpm_result([TCLMINVER])
fi
if test -n "$TCL_PACKAGE_PATH"; then
AC_MSG_CHECKING([for Tcl package path])
for d in $TCL_PACKAGE_PATH; do
AS_IF([echo $d | $GREP "$host_cpu" >/dev/null],
[AS_VAR_SET([TCL_PKG_DIR], ["$d"])
break])
done
AS_IF([test -z "$TCL_PKG_DIR"],
[for d in $TCL_PACKAGE_PATH; do
AS_IF([test "x$d" = "x$TCLCONFIG"],
[AS_VAR_SET([TCL_PKG_DIR], ["$d"])
break])
done])
AS_IF([test -z "$TCL_PKG_DIR"],
[AS_VAR_SET([i], [0])
for d in $TCL_PACKAGE_PATH; do
AS_VAR_ARITH([i], [$i + 1])
done
AS_IF([test $i -eq 1],
[AS_VAR_SET([TCL_PKG_DIR],
[$TCL_PACKAGE_PATH])])])
ptpm_result([TCL_PKG_DIR])
fi
fi
AS_IF([test "x$TCLPACKAGE" != xyes],
[AS_IF([test -z "$TCLINCDIR"],
[AS_VAR_SET([TCLINCDIR], ["$TCLPACKAGE/include"])])
AS_IF([test -z "$TCLLIB"],
[AS_VAR_SET([TCLLIB], ["-L$TCLPACKAGE/lib -ltcl"])])])
AC_MSG_CHECKING([for Tcl header files])
AS_IF([test -z "$TCLINCDIR"],
[for i in $ptpm_include_dirs; do
AS_IF([test -r $i/tcl.h],
[AC_MSG_RESULT([$i])
AS_VAR_SET([TCLINCDIR], ["$i"])
break])
done])
AS_IF([test -n "$TCLINCDIR"],
[AS_VAR_SET([TCLINCLUDE], ["-I$TCLINCDIR"])])
ptpm_result([TCLINCLUDE])
AC_MSG_CHECKING([for Tcl library])
AS_IF([test -z "$TCLLIB"],
[AS_VAR_SET([dirs],
["/usr/local/lib /usr/lib /opt/local/lib /opt/freeware/lib"])
for i in $dirs; do
AS_IF([test -r $i/libtcl.a],
[AS_VAR_SET([TCLLIB], ["-L$i -ltcl"])
break])
done])
ptpm_result([TCLLIB])
fi
AC_SUBST([TCLCONFIG])
AC_SUBST([TCLINCDIR])
AC_SUBST([TCLINCLUDE])
AC_SUBST([TCLLIB])
AC_SUBST([TCLVER])
AC_SUBST([TCLMINVER])
AC_SUBST([TCL_PKG_DIR])
#----------------------------------------------------------------
# Look for Python 3.x
#----------------------------------------------------------------
AS_UNSET([PY3VER])
AS_UNSET([PY3VERSION])
AS_UNSET([PY3INCLUDE])
AS_UNSET([PY3INCDIR])
AS_UNSET([PY3PLATINCDIR])
AS_UNSET([PY3SITE_DIR])
AS_UNSET([PY3LINK])
AS_UNSET([PY3EXT])
AS_UNSET([PY3LDLIBS])
AC_ARG_WITH([python3],
[AS_HELP_STRING([--without-python3],
[Don't probe for Python 3.x])]
dnl '
[AS_HELP_STRING([--with-python3=path],
[Set location of Python 3.x executable])],
[AS_VAR_SET([PY3BIN], ["$withval"])],
[AS_VAR_SET([PY3BIN], ["$alllang_default"])])
# First, check for "--without-python3" or "--with-python3=no".
if test "x$PY3BIN" = xno; then
AC_MSG_NOTICE([Disabling Python 3.x probe])
AS_UNSET([PY3LINK])
else
if test "x$PY3BIN" = xyes; then
for py_ver in 3 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 ""; do
AC_CHECK_PROGS([PYTHON3], [python$py_ver])
AS_IF([test -n "$PYTHON3"],
[AC_CHECK_PROGS([PY3CONFIG], [$PYTHON3-config])
AS_IF([test -n "$PY3CONFIG"], [break])])
done
else
AS_VAR_SET([PYTHON3], ["$PY3BIN"])
AC_CHECK_PROGS([PY3CONFIG], [$PYTHON3-config])
fi
AS_IF([test -n "$PYTHON3"],
[AC_MSG_CHECKING([for $PYTHON3 major version number])
AS_VAR_SET([PY3VER],
[`($PYTHON3 -c "import sys;\
sys.stdout.write(sys.version[[0]])") 2>/dev/null`])
AC_MSG_RESULT([$PY3VER])])
AS_IF([test -z "$PY3VER"], [AS_VAR_SET([PY3VER], [0])])
if test $PY3VER -ge 3 && test -n "$PY3CONFIG"; then
# Note: I could not think of a standard way to get the version string
# from different versions.
# This trick pulls it out of the file location
# for a standard library file.
AC_MSG_CHECKING([for Python 3.x version])
AS_VAR_SET([PY3VERSION],
[`($PYTHON3 -c "import string,operator,os.path;\
print(operator.getitem(os.path.split(\
operator.getitem(os.path.split(string.__@&t@file__),\
0)),1))") 2>/dev/null`])
ptpm_result([PY3VERSION])
# Set the include directory
AC_MSG_CHECKING([for Python 3.x header files])
AS_VAR_SET([PY3INCLUDE], ["`($PY3CONFIG --includes) 2>/dev/null`"])
ptpm_result([PY3INCLUDE])
AS_IF([test -n "$PY3INCLUDE"],
[AS_VAR_SET([var], ["PY3INCDIR"])
for d in $PY3INCLUDE; do
AS_VAR_SET([${var}], ["`echo $d | $SED 's/^-I//'`"])
AS_VAR_SET([var], ["PY3PLATINCDIR"])
done])
AS_VAR_SET([dirs],
[`($PYTHON3 -c "import site;print('\n'.join(\
site.getsitepackages()))") 2>/dev/null`])
AC_MSG_CHECKING([for Python 3.x site folder])
for d in $dirs; do
AS_VAR_SET([have_lib], ["`echo $d | $GREP '^$libdir'`"])
AS_VAR_SET([have_ver], ["`echo $d | $GREP $PY3VERSION`"])
AS_IF([test "x$have_lib" != x && test "x$have_ver" != x],
[AS_VAR_SET([PY3SITE_DIR], ["$d"])
break])
done
AS_IF([test -z "$PY3SITE_DIR"],
[for d in $dirs; do
AS_VAR_SET([not_local], ["`echo $d | $GREP '/local/'`"])
AS_VAR_SET([have_ver], ["`echo $d | $GREP $PY3VERSION`"])
AS_IF([test "x$not_local" = x && test "x$have_ver" != x],
[AS_VAR_SET([PY3SITE_DIR], ["$d"])
break])
done])
AS_IF([test -z "$PY3SITE_DIR"],
[for d in $dirs; do
AS_IF([echo $d | $GREP "^$libdir" >/dev/null],
[AS_VAR_SET([PY3SITE_DIR], ["$d"])
break])
done])
ptpm_result([PY3SITE_DIR])
AC_MSG_CHECKING([for Python 3.x library])
AS_VAR_SET([PY3LINK], ["-l$PY3VERSION"])
ptpm_result([PY3LINK])
AC_MSG_CHECKING([for Python 3.x extension suffix])
AS_VAR_SET([PY3EXT], ["`($PY3CONFIG --extension-suffix) 2>/dev/null`"])
ptpm_cross([PY3EXT])
ptpm_result([PY3EXT])
AC_MSG_CHECKING([for Python 3.x linking])
AS_VAR_SET([PY3LDLIBS], ["`($PY3CONFIG --libs) 2>/dev/null`"])
ptpm_result([PY3LDLIBS])
fi
fi
AC_SUBST([PY3VER])
AC_SUBST([PY3VERSION])
AC_SUBST([PY3INCLUDE])
AC_SUBST([PY3INCDIR])
AC_SUBST([PY3PLATINCDIR])
AC_SUBST([PY3SITE_DIR])
AC_SUBST([PY3LINK])
AC_SUBST([PY3EXT])
AC_SUBST([PY3LDLIBS])
#----------------------------------------------------------------
# Look for Perl5
#----------------------------------------------------------------
AS_UNSET([PERL])
AS_UNSET([PERLBIN])
AS_UNSET([PERL5DIR])
AS_UNSET([PERL5EXT])
AS_UNSET([PERL5TEST])
AS_UNSET([PERL5TOUCH])
AC_ARG_WITH([perl5],
[AS_HELP_STRING([--without-perl5],
[Disable Perl5])]
[AS_HELP_STRING([--with-perl5=path],
[Set location of Perl5 executable])],
[AS_VAR_SET([PERLBIN], ["$withval"])],
[AS_VAR_SET([PERLBIN], ["yes"])])
# First, check for "--without-perl5" or "--with-perl5=no".
if test "x$PERLBIN" = xno; then
AC_MSG_NOTICE([Disabling Perl5])
else
# First figure out what the name of Perl5 is
AS_IF([test "x$PERLBIN" = xyes],
[AC_CHECK_PROGS([PERL], [perl perl5])],
[AS_VAR_SET([PERL], ["$PERLBIN"])])
# This could probably be simplified as for all platforms and
# all versions of Perl the following apparently
# should be run to get the compilation options:
# perl -MExtUtils::Embed -e ccopts
AC_MSG_CHECKING([for Perl5 confiuration])
if test -n "$PERL"; then
AS_VAR_SET([ptpm_perl_dir],
[`($PERL -MConfig -le 'print $Config{archlibexp}')\
2>/dev/null`])
AS_IF([test -h "$ptpm_perl_dir" && test "x$READLINK" != x ],
[AS_VAR_SET([PERL5DIR],[`$READLINK -f $ptpm_perl_dir 2>/dev/null`])],
[AS_VAR_SET([PERL5DIR],["$ptpm_perl_dir"])])
AS_IF([test "x$PERL5DIR" = x],
[AS_VAR_SET([PERL5DIR],["$ptpm_perl_dir"])])
ptpm_cross([PERL5DIR])
AS_IF([test -n "$PERL5DIR"],
[AC_MSG_RESULT([$PERL5DIR])
AC_MSG_CHECKING([for Perl5 header files])
for i in $PERL5DIR $PERL5DIR/CORE; do
AS_IF([test -r $i/perl.h],
[AS_VAR_SET([PERL5EXT], ["$i"])
break])
done
ptpm_result(PERL5EXT)],
[AC_MSG_RESULT([unable to determine perl5 configuration])])
AS_IF([$PERL -e 'use Test::Class;Test::More;' 2>/dev/null],
[AS_VAR_SET([PERL5TEST], ["have"])])
AS_IF([$PERL -e 'use File::Touch;' 2>/dev/null],
[AS_VAR_SET([PERL5TOUCH], ["have"])])
else
AC_MSG_RESULT([could not figure out how to run perl5])
fi
fi
AC_SUBST([PERL])
AC_SUBST([PERL5DIR])
AC_SUBST([PERL5EXT])
AC_SUBST([PERL5TEST])
AC_SUBST([PERL5TOUCH])
#----------------------------------------------------------------
# Look for Ruby
#----------------------------------------------------------------
AS_UNSET([RUBY])
AS_UNSET([RUBYBIN])
AS_UNSET([RUBYHDRDIR])
AS_UNSET([RUBYARCHHDRDIR])
AS_UNSET([RUBYINCLUDE])
AS_UNSET([RUBYVER])
AS_UNSET([RUBYLIB])
AS_UNSET([RUBYLINK])
AS_UNSET([RUBYSITE])
AC_ARG_WITH([ruby],
[AS_HELP_STRING([--without-ruby], [Disable Ruby])]
[AS_HELP_STRING([--with-ruby=path], [Set location of Ruby executable])],
[AS_VAR_SET([RUBYBIN], ["$withval"])],
[AS_VAR_SET([RUBYBIN], ["$alllang_default"])])
# First, check for "--without-ruby" or "--with-ruby=no".
if test "x$RUBYBIN" = xno; then
AC_MSG_NOTICE([Disabling Ruby])
else
# configuration comes from /usr/lib/*/ruby/*/rbconfig.rb
# First figure out what the name of Ruby is
AS_IF([test "x$RUBYBIN" = xyes],
[AC_CHECK_PROGS([RUBY], [ruby])],
[AS_VAR_SET([RUBY], ["$RUBYBIN"])])
AC_MSG_CHECKING([for Ruby header files])
if test -n "$RUBY"; then
# Try Ruby1.9+ first
AS_VAR_SET([RUBYHDRDIR],
[`($RUBY -rrbconfig -e\
'print RbConfig::CONFIG[["rubyhdrdir"]]') 2>/dev/null`])
AS_VAR_SET([RUBYARCHHDRDIR],
[`($RUBY -rrbconfig -e\
'print RbConfig::CONFIG[["rubyarchhdrdir"]]') 2>/dev/null`])
ptpm_cross([RUBYARCHHDRDIR])
if test "x$RUBYHDRDIR" != x; then
AS_IF([test -r $RUBYHDRDIR/ruby.h && test -n "$RUBYARCHHDRDIR"],
[AS_VAR_SET([RUBYINCLUDE], ["-I$RUBYHDRDIR -I$RUBYARCHHDRDIR"])])
ptpm_result([RUBYINCLUDE])
AC_MSG_CHECKING([for Ruby header folder])
ptpm_result([RUBYHDRDIR])
AC_MSG_CHECKING([for Ruby header architecture folder])
ptpm_result([RUBYARCHHDRDIR])
AC_MSG_CHECKING([for Ruby version])
AS_VAR_SET([RUBYVER],
[`$RUBY -e 'print "#{RUBY_VERSION}"'`])
ptpm_result([RUBYVER])
AS_VAR_SET([RUBYLINK],
[`($RUBY -rrbconfig -e\
'n=RbConfig::CONFIG[["RUBY_SO_NAME"]];print "-l#{n}"')
2>/dev/null`])
# Find library and path for linking.
AC_MSG_CHECKING([for Ruby library])
AS_VAR_SET([rb_archlibdir],
[`($RUBY -rrbconfig -e\
'print RbConfig::CONFIG[["archlibdir"]]') 2>/dev/null`])
AS_VAR_SET([rb_libdir],
[`($RUBY -rrbconfig -e 'print RbConfig::CONFIG[["libdir"]]')\
2>/dev/null`])
AS_VAR_SET([rb_bindir],
[`($RUBY -rrbconfig -e 'print RbConfig::CONFIG[["bindir"]]')\
2>/dev/null`])
AS_VAR_SET([dirs], ["$rb_archlibdir $rb_libdir $rb_bindir"])
AS_VAR_SET([rb_libruby],
[`($RUBY -rrbconfig -e\
'print RbConfig::CONFIG[["LIBRUBY_SO"]]') 2>/dev/null`])
AS_IF([test "x$rb_libruby" != x],
[for i in $dirs; do
AS_IF([test -r $i/$rb_libruby],
[AS_VAR_SET([RUBYLIB], ["$i"])
break])
done])
ptpm_cross([RUBYLIB])
ptpm_result([RUBYLIB])
else
AC_MSG_RESULT([unable to determine ruby configuration])
fi
AC_MSG_CHECKING([for Ruby link flags])
AS_VAR_SET([RUBYLINK],
["$RUBYLINK `($RUBY -rrbconfig -e\
'print RbConfig::CONFIG[["LIBS"]]') 2>/dev/null`"])
ptpm_result([RUBYLINK])
AC_MSG_CHECKING([for Ruby site])
AS_VAR_SET([RUBYSITE],
[`($RUBY -rrbconfig -e\
'print RbConfig::CONFIG[["vendorarchdir"]]') 2>/dev/null`])
ptpm_cross([RUBYSITE])
ptpm_result([RUBYSITE])
else
AC_MSG_RESULT([could not figure out how to run ruby])
fi
fi
AC_SUBST([RUBY])
AC_SUBST([RUBYHDRDIR])
AC_SUBST([RUBYARCHHDRDIR])
AC_SUBST([RUBYINCLUDE])
AC_SUBST([RUBYVER])
AC_SUBST([RUBYLIB])
AC_SUBST([RUBYLINK])
AC_SUBST([RUBYSITE])
#-------------------------------------------------------------------------
# Look for PHP
#-------------------------------------------------------------------------
AS_UNSET([PHPBIN])
AS_UNSET([PHP])
AS_UNSET([PHPCONFIG])
AS_UNSET([PHPINCDIR])
AS_UNSET([PHPVER])
AS_UNSET([PHPEXT])
AS_UNSET([PHPINC])
AS_UNSET([PHPINC_FLAGS])
AS_UNSET([PHPUNIT])
AC_ARG_WITH([php],
[AS_HELP_STRING([--without-php], [Disable PHP])
AS_HELP_STRING([--with-php=path], [Set location of PHP executable])],
[AS_VAR_SET([PHPBIN], ["$withval"])],
[AS_VAR_SET([PHPBIN], ["$alllang_default"])])
# First, check for "--without-php" or "--with-php=no".
if test "x$PHPBIN" = xno; then
AC_MSG_NOTICE([Disabling PHP])
else
AS_IF([test "x$PHPBIN" = xyes],
[AC_CHECK_PROGS([PHP],
[php8.1 php8.0 php7.4 php7.3 php7.2\
php7.1 php7.0 php])],
[AS_VAR_SET([PHP], ["$PHPBIN"])])
if test -n "$PHP"; then
# /usr/bin/php7.0 -> /usr/bin/php-config7.0
AS_CASE([$PHP],
[*7.*],
[AS_VAR_SET([phpconfig],
[`echo "$PHP" | $SED 's%7\...*$%-config&%'`])],
[*8.*],
[AS_VAR_SET([phpconfig],
[`echo "$PHP" | $SED 's%8\...*$%-config&%'`])],
[AS_VAR_SET([phpconfig], ["$PHP-config"])])
AC_CHECK_PROGS([PHPCONFIG], [$phpconfig php-config])
AC_MSG_CHECKING([for PHP include folder])
AS_VAR_SET([dirs],
[`$PHP -r 'echo get_include_path();' | $SED 's%:% %g'`])
for d in $dirs; do
AS_IF([test "x$d" != 'x.'],
[AS_VAR_SET([PHPINCDIR], ["$d"])
break])
done
ptpm_result([PHPINCDIR])
if test -n "$PHPCONFIG"; then
AC_MSG_CHECKING([for PHP version])
AS_VAR_SET([PHPVER], ["`$PHPCONFIG --version 2>/dev/null`"])
ptpm_result([PHPVER])
AC_MSG_CHECKING([for PHP extensions])
AS_VAR_SET([PHPEXT], ["`$PHPCONFIG --extension-dir 2>/dev/null`"])
ptpm_result([PHPEXT])
AC_MSG_CHECKING([for PHP headers base folder])
AS_VAR_SET([PHPINC], ["`$PHPCONFIG --include-dir 2>/dev/null`"])
ptpm_result([PHPINC])
AC_MSG_CHECKING([for PHP header files])
AS_CASE([$PHPVER],
[7.*|8.*],
[AS_VAR_SET([phpinc_flags],
[`$PHPCONFIG --includes 2>/dev/null`])
AS_VAR_SET([sub], ['${PHPINC}'])
AS_IF([test -n "$phpinc_flags"],
[AS_VAR_SET([PHPINC_FLAGS],
[`echo "$phpinc_flags" |\
$SED "s%$PHPINC%$sub%g"`])])
ptpm_result([PHPINC_FLAGS])],
[""],
[AS_VAR_SET([msg], ["could not find $PHPCONFIG or obtain"])
AC_MSG_RESULT([$msg PHP version from it])],
[AC_MSG_RESULT([found PHP $PHPVER - not PHP 7 or 8])])
fi
AC_CHECK_PROGS([PHPUNIT], [phpunit])
fi
fi
AC_SUBST([PHP])
AC_SUBST([PHPCONFIG])
AC_SUBST([PHPINCDIR])
AC_SUBST([PHPVER])
AC_SUBST([PHPEXT])
AC_SUBST([PHPINC])
AC_SUBST([PHPINC_FLAGS])
AC_SUBST([PHPUNIT])
#----------------------------------------------------------------
# Look for Lua
#----------------------------------------------------------------
AS_UNSET([LUABIN])
AS_UNSET([LUA_VERSION])
AS_UNSET([LUABIN_VERSION])
AS_UNSET([LUAINCLUDE])
AS_UNSET([LUALIB])
AS_UNSET([LUA_INC])
AS_UNSET([LUALINK])
AS_UNSET([LUAVERSIONS])
AS_UNSET([LUAVERSIONS_UNIT])
AS_UNSET([LUAUNIT])
AS_UNSET([LUA_5_1_INC])
AS_UNSET([LUA_5_2_INC])
AS_UNSET([LUA_5_3_INC])
AS_UNSET([LUA_5_4_INC])
AS_UNSET([LUA_5_5_INC])
AS_UNSET([LUA_5_6_INC])
AS_UNSET([LUA_5_7_INC])
AS_UNSET([LUA_5_1_LINK])
AS_UNSET([LUA_5_2_LINK])
AS_UNSET([LUA_5_3_LINK])
AS_UNSET([LUA_5_4_LINK])
AS_UNSET([LUA_5_5_LINK])
AS_UNSET([LUA_5_6_LINK])
AS_UNSET([LUA_5_7_LINK])
AC_ARG_WITH([lua],
[AS_HELP_STRING([--without-lua], [Disable Lua])]
[AS_HELP_STRING([--with-lua=path], [Set location of Lua executable])],
[AS_VAR_SET([LUABIN], ["$withval"])],
[AS_VAR_SET([LUABIN], ["$alllang_default"])])
AC_ARG_WITH([luaincl],
[AS_HELP_STRING([--with-luaincl=path],
[Set location of Lua include directory])],
[AS_VAR_SET([LUAINCLUDE], ["$withval"])])
AC_ARG_WITH([lualib],
[AS_HELP_STRING([--with-lualib=path],
[Set location of Lua library directory])],
[AS_VAR_SET([LUALIB], ["$withval"])])
# First, check for "--without-lua" or "--with-lua=no".
if test "x$LUABIN" = xno; then
AC_MSG_NOTICE([Disabling Lua])
AS_UNSET([LUABIN])
else
# Try to probe all Lua version on Debian and similar
AS_IF([test -z "$LUAINCLUDE" && test "x$LUABIN" = xyes &&\
test -z "$LUALIB"],
[for i in $ptpm_include_dirs; do
for v in $i/lua5.*; do
AS_IF([test -r $v/lua.h],
[AS_VAR_SET([name], [`echo $v | $SED "s%$i/lua%%"`])
AS_VAR_SET([tag], ["`echo $name | $SED 's%\.%_%'`"])
AS_VAR_SET([LUA_${tag}_INC], ["$v"])
AS_VAR_SET([LUA_${tag}_LINK], ["-llua$name"])
AS_VAR_SET([LUAVERSIONS], ["$LUAVERSIONS $name"])
AS_IF([lua$name -e "require 'luaunit'" 2>/dev/null],
[AS_VAR_SET([LUAVERSIONS_UNIT],
["$LUAVERSIONS_UNIT $name"])])])
done
done])
# can we find lua?
AS_IF([test "x$LUABIN" = xyes],
# We look for a versioned Lua binary first, as there can be
# multiple versions of Lua installed on some systems (like Debian).
[AC_PATH_PROGS([LUABIN],
[lua5.7 lua5.6 lua5.5 lua5.4 lua5.3 lua5.2 lua5.1 lua])])
if test -z "$LUAVERSIONS" && test -n "$LUABIN"; then
# check version: we need Lua 5.x
AC_MSG_CHECKING([Lua version])
AS_VAR_SET([LUA_VERSION],
[`$LUABIN -e 'print(string.match(_VERSION, "%d+[.]%d+"))'`])
ptpm_result([LUA_VERSION])
AS_CASE([$LUA_VERSION],
[5.*], [],
[AS_VAR_SET([msg], ["Not Lua 5.x, SWIG does not support"])
AC_MSG_WARN([$msg this version of Lua])
AS_UNSET([LUABIN])])
if test -n "$LUABIN"; then
# look for the header files & set LUA_INC accordingly
# will clear LUABIN if not present