-
Notifications
You must be signed in to change notification settings - Fork 11
/
tcl.m4
4117 lines (3822 loc) · 130 KB
/
tcl.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
# tcl.m4 --
#
# This file provides a set of autoconf macros to help TEA-enable
# a Tcl extension.
#
# Copyright (c) 1999-2000 Ajuba Solutions.
# Copyright (c) 2002-2005 ActiveState Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
AC_PREREQ([2.69])
# Possible values for key variables defined:
#
# TEA_WINDOWINGSYSTEM - win32 aqua x11 (mirrors 'tk windowingsystem')
# TEA_PLATFORM - windows unix
# TEA_TK_EXTENSION - True if this is a Tk extension
#
#------------------------------------------------------------------------
# TEA_PATH_TCLCONFIG --
#
# Locate the tclConfig.sh file and perform a sanity check on
# the Tcl compile flags
#
# Arguments:
# none
#
# Results:
#
# Adds the following arguments to configure:
# --with-tcl=...
#
# Defines the following vars:
# TCL_BIN_DIR Full path to the directory containing
# the tclConfig.sh file
#------------------------------------------------------------------------
AC_DEFUN([TEA_PATH_TCLCONFIG], [
dnl TEA specific: Make sure we are initialized
AC_REQUIRE([TEA_INIT])
#
# Ok, lets find the tcl configuration
# First, look for one uninstalled.
# the alternative search directory is invoked by --with-tcl
#
if test x"${no_tcl}" = x ; then
# we reset no_tcl in case something fails here
no_tcl=true
AC_ARG_WITH(tcl,
AS_HELP_STRING([--with-tcl],
[directory containing tcl configuration (tclConfig.sh)]),
[with_tclconfig="${withval}"])
AC_ARG_WITH(tcl8,
AS_HELP_STRING([--with-tcl8],
[Compile for Tcl8 in Tcl9 environment]),
[with_tcl8="${withval}"])
AC_MSG_CHECKING([for Tcl configuration])
AC_CACHE_VAL(ac_cv_c_tclconfig,[
# First check to see if --with-tcl was specified.
if test x"${with_tclconfig}" != x ; then
case "${with_tclconfig}" in
*/tclConfig.sh )
if test -f "${with_tclconfig}"; then
AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself])
with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`"
fi ;;
esac
if test -f "${with_tclconfig}/tclConfig.sh" ; then
ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`"
else
AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
fi
fi
# then check for a private Tcl installation
if test x"${ac_cv_c_tclconfig}" = x ; then
for i in \
../tcl \
`ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
`ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
`ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
../../tcl \
`ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
`ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
`ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
../../../tcl \
`ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
`ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
`ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
if test "${TEA_PLATFORM}" = "windows" \
-a -f "$i/win/tclConfig.sh" ; then
ac_cv_c_tclconfig="`(cd $i/win; pwd)`"
break
fi
if test -f "$i/unix/tclConfig.sh" ; then
ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
break
fi
done
fi
# on Darwin, check in Framework installation locations
if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
`ls -d /Library/Frameworks 2>/dev/null` \
`ls -d /Network/Library/Frameworks 2>/dev/null` \
`ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks/Tcl.framework 2>/dev/null` \
`ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Network/Library/Frameworks/Tcl.framework 2>/dev/null` \
`ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework 2>/dev/null` \
; do
if test -f "$i/Tcl.framework/tclConfig.sh" ; then
ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`"
break
fi
done
fi
# TEA specific: on Windows, check in common installation locations
if test "${TEA_PLATFORM}" = "windows" \
-a x"${ac_cv_c_tclconfig}" = x ; then
for i in `ls -d C:/Tcl/lib 2>/dev/null` \
`ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
; do
if test -f "$i/tclConfig.sh" ; then
ac_cv_c_tclconfig="`(cd $i; pwd)`"
break
fi
done
fi
# check in a few common install locations
if test x"${ac_cv_c_tclconfig}" = x ; then
for i in `ls -d ${libdir} 2>/dev/null` \
`ls -d ${exec_prefix}/lib 2>/dev/null` \
`ls -d ${prefix}/lib 2>/dev/null` \
`ls -d /usr/local/lib 2>/dev/null` \
`ls -d /usr/contrib/lib 2>/dev/null` \
`ls -d /usr/pkg/lib 2>/dev/null` \
`ls -d /usr/lib 2>/dev/null` \
`ls -d /usr/lib64 2>/dev/null` \
`ls -d /usr/lib/tcl9.0 2>/dev/null` \
`ls -d /usr/lib/tcl8.7 2>/dev/null` \
`ls -d /usr/lib/tcl8.6 2>/dev/null` \
`ls -d /usr/lib/tcl8.5 2>/dev/null` \
`ls -d /usr/local/lib/tcl9.0 2>/dev/null` \
`ls -d /usr/local/lib/tcl8.7 2>/dev/null` \
`ls -d /usr/local/lib/tcl8.6 2>/dev/null` \
`ls -d /usr/local/lib/tcl8.5 2>/dev/null` \
`ls -d /usr/local/lib/tcl/tcl9.0 2>/dev/null` \
`ls -d /usr/local/lib/tcl/tcl8.7 2>/dev/null` \
`ls -d /usr/local/lib/tcl/tcl8.6 2>/dev/null` \
`ls -d /usr/local/lib/tcl/tcl8.5 2>/dev/null` \
; do
if test -f "$i/tclConfig.sh" ; then
ac_cv_c_tclconfig="`(cd $i; pwd)`"
break
fi
done
fi
# check in a few other private locations
if test x"${ac_cv_c_tclconfig}" = x ; then
for i in \
${srcdir}/../tcl \
`ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
`ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
`ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
if test "${TEA_PLATFORM}" = "windows" \
-a -f "$i/win/tclConfig.sh" ; then
ac_cv_c_tclconfig="`(cd $i/win; pwd)`"
break
fi
if test -f "$i/unix/tclConfig.sh" ; then
ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
break
fi
done
fi
])
if test x"${ac_cv_c_tclconfig}" = x ; then
TCL_BIN_DIR="# no Tcl configs found"
AC_MSG_ERROR([Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh])
else
no_tcl=
TCL_BIN_DIR="${ac_cv_c_tclconfig}"
AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
fi
fi
])
#------------------------------------------------------------------------
# TEA_PATH_TKCONFIG --
#
# Locate the tkConfig.sh file
#
# Arguments:
# none
#
# Results:
#
# Adds the following arguments to configure:
# --with-tk=...
#
# Defines the following vars:
# TK_BIN_DIR Full path to the directory containing
# the tkConfig.sh file
#------------------------------------------------------------------------
AC_DEFUN([TEA_PATH_TKCONFIG], [
#
# Ok, lets find the tk configuration
# First, look for one uninstalled.
# the alternative search directory is invoked by --with-tk
#
if test x"${no_tk}" = x ; then
# we reset no_tk in case something fails here
no_tk=true
AC_ARG_WITH(tk,
AS_HELP_STRING([--with-tk],
[directory containing tk configuration (tkConfig.sh)]),
[with_tkconfig="${withval}"])
AC_ARG_WITH(tk8,
AS_HELP_STRING([--with-tk8],
[Compile for Tk8 in Tk9 environment]),
[with_tk8="${withval}"])
AC_MSG_CHECKING([for Tk configuration])
AC_CACHE_VAL(ac_cv_c_tkconfig,[
# First check to see if --with-tkconfig was specified.
if test x"${with_tkconfig}" != x ; then
case "${with_tkconfig}" in
*/tkConfig.sh )
if test -f "${with_tkconfig}"; then
AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself])
with_tkconfig="`echo "${with_tkconfig}" | sed 's!/tkConfig\.sh$!!'`"
fi ;;
esac
if test -f "${with_tkconfig}/tkConfig.sh" ; then
ac_cv_c_tkconfig="`(cd "${with_tkconfig}"; pwd)`"
else
AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
fi
fi
# then check for a private Tk library
if test x"${ac_cv_c_tkconfig}" = x ; then
for i in \
../tk \
`ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
`ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \
`ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
../../tk \
`ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
`ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
`ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
../../../tk \
`ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
`ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
`ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
if test "${TEA_PLATFORM}" = "windows" \
-a -f "$i/win/tkConfig.sh" ; then
ac_cv_c_tkconfig="`(cd $i/win; pwd)`"
break
fi
if test -f "$i/unix/tkConfig.sh" ; then
ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
break
fi
done
fi
# on Darwin, check in Framework installation locations
if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
`ls -d /Library/Frameworks 2>/dev/null` \
`ls -d /Network/Library/Frameworks 2>/dev/null` \
; do
if test -f "$i/Tk.framework/tkConfig.sh" ; then
ac_cv_c_tkconfig="`(cd $i/Tk.framework; pwd)`"
break
fi
done
fi
# check in a few common install locations
if test x"${ac_cv_c_tkconfig}" = x ; then
for i in `ls -d ${libdir} 2>/dev/null` \
`ls -d ${exec_prefix}/lib 2>/dev/null` \
`ls -d ${prefix}/lib 2>/dev/null` \
`ls -d /usr/local/lib 2>/dev/null` \
`ls -d /usr/contrib/lib 2>/dev/null` \
`ls -d /usr/pkg/lib 2>/dev/null` \
`ls -d /usr/lib/tk9.0 2>/dev/null` \
`ls -d /usr/lib/tk8.7 2>/dev/null` \
`ls -d /usr/lib/tk8.6 2>/dev/null` \
`ls -d /usr/lib/tk8.5 2>/dev/null` \
`ls -d /usr/lib 2>/dev/null` \
`ls -d /usr/lib64 2>/dev/null` \
`ls -d /usr/local/lib/tk9.0 2>/dev/null` \
`ls -d /usr/local/lib/tk8.7 2>/dev/null` \
`ls -d /usr/local/lib/tk8.6 2>/dev/null` \
`ls -d /usr/local/lib/tk8.5 2>/dev/null` \
`ls -d /usr/local/lib/tcl/tk9.0 2>/dev/null` \
`ls -d /usr/local/lib/tcl/tk8.7 2>/dev/null` \
`ls -d /usr/local/lib/tcl/tk8.6 2>/dev/null` \
`ls -d /usr/local/lib/tcl/tk8.5 2>/dev/null` \
; do
if test -f "$i/tkConfig.sh" ; then
ac_cv_c_tkconfig="`(cd $i; pwd)`"
break
fi
done
fi
# TEA specific: on Windows, check in common installation locations
if test "${TEA_PLATFORM}" = "windows" \
-a x"${ac_cv_c_tkconfig}" = x ; then
for i in `ls -d C:/Tcl/lib 2>/dev/null` \
`ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
; do
if test -f "$i/tkConfig.sh" ; then
ac_cv_c_tkconfig="`(cd $i; pwd)`"
break
fi
done
fi
# check in a few other private locations
if test x"${ac_cv_c_tkconfig}" = x ; then
for i in \
${srcdir}/../tk \
`ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
`ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
`ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
if test "${TEA_PLATFORM}" = "windows" \
-a -f "$i/win/tkConfig.sh" ; then
ac_cv_c_tkconfig="`(cd $i/win; pwd)`"
break
fi
if test -f "$i/unix/tkConfig.sh" ; then
ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
break
fi
done
fi
])
if test x"${ac_cv_c_tkconfig}" = x ; then
TK_BIN_DIR="# no Tk configs found"
AC_MSG_ERROR([Can't find Tk configuration definitions. Use --with-tk to specify a directory containing tkConfig.sh])
else
no_tk=
TK_BIN_DIR="${ac_cv_c_tkconfig}"
AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
fi
fi
])
#------------------------------------------------------------------------
# TEA_LOAD_TCLCONFIG --
#
# Load the tclConfig.sh file
#
# Arguments:
#
# Requires the following vars to be set:
# TCL_BIN_DIR
#
# Results:
#
# Substitutes the following vars:
# TCL_BIN_DIR
# TCL_SRC_DIR
# TCL_LIB_FILE
# TCL_ZIP_FILE
# TCL_ZIPFS_SUPPORT
#------------------------------------------------------------------------
AC_DEFUN([TEA_LOAD_TCLCONFIG], [
AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
AC_MSG_RESULT([loading])
. "${TCL_BIN_DIR}/tclConfig.sh"
else
AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
fi
# If the TCL_BIN_DIR is the build directory (not the install directory),
# then set the common variable name to the value of the build variables.
# For example, the variable TCL_LIB_SPEC will be set to the value
# of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
# instead of TCL_BUILD_LIB_SPEC since it will work with both an
# installed and uninstalled version of Tcl.
if test -f "${TCL_BIN_DIR}/Makefile" ; then
TCL_LIB_SPEC="${TCL_BUILD_LIB_SPEC}"
TCL_STUB_LIB_SPEC="${TCL_BUILD_STUB_LIB_SPEC}"
TCL_STUB_LIB_PATH="${TCL_BUILD_STUB_LIB_PATH}"
elif test "`uname -s`" = "Darwin"; then
# If Tcl was built as a framework, attempt to use the libraries
# from the framework at the given location so that linking works
# against Tcl.framework installed in an arbitrary location.
case ${TCL_DEFS} in
*TCL_FRAMEWORK*)
if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then
for i in "`cd "${TCL_BIN_DIR}"; pwd`" \
"`cd "${TCL_BIN_DIR}"/../..; pwd`"; do
if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
TCL_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TCL_LIB_FILE}"
break
fi
done
fi
if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then
TCL_STUB_LIB_SPEC="-L`echo "${TCL_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TCL_STUB_LIB_FLAG}"
TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
fi
;;
esac
fi
AC_SUBST(TCL_VERSION)
AC_SUBST(TCL_PATCH_LEVEL)
AC_SUBST(TCL_BIN_DIR)
AC_SUBST(TCL_SRC_DIR)
AC_SUBST(TCL_LIB_FILE)
AC_SUBST(TCL_LIB_FLAG)
AC_SUBST(TCL_LIB_SPEC)
AC_SUBST(TCL_STUB_LIB_FILE)
AC_SUBST(TCL_STUB_LIB_FLAG)
AC_SUBST(TCL_STUB_LIB_SPEC)
AC_MSG_CHECKING([platform])
hold_cc=$CC; CC="$TCL_CC"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
#ifdef _WIN32
#error win32
#endif
]])],[
# first test we've already retrieved platform (cross-compile), fallback to unix otherwise:
TEA_PLATFORM="${TEA_PLATFORM-unix}"
CYGPATH=echo
],[
TEA_PLATFORM="windows"
AC_CHECK_PROG(CYGPATH, cygpath, cygpath -m, echo)
])
CC=$hold_cc
AC_MSG_RESULT($TEA_PLATFORM)
# The BUILD_$pkg is to define the correct extern storage class
# handling when making this package
AC_DEFINE_UNQUOTED(BUILD_${PACKAGE_NAME}, [],
[Building extension source?])
# Do this here as we have fully defined TEA_PLATFORM now
if test "${TEA_PLATFORM}" = "windows" ; then
EXEEXT=".exe"
CLEANFILES="$CLEANFILES *.lib *.dll *.pdb *.exp"
fi
# TEA specific:
AC_SUBST(CLEANFILES)
AC_SUBST(TCL_LIBS)
AC_SUBST(TCL_DEFS)
AC_SUBST(TCL_EXTRA_CFLAGS)
AC_SUBST(TCL_LD_FLAGS)
AC_SUBST(TCL_SHLIB_LD_LIBS)
])
#------------------------------------------------------------------------
# TEA_LOAD_TKCONFIG --
#
# Load the tkConfig.sh file
#
# Arguments:
#
# Requires the following vars to be set:
# TK_BIN_DIR
#
# Results:
#
# Sets the following vars that should be in tkConfig.sh:
# TK_BIN_DIR
#------------------------------------------------------------------------
AC_DEFUN([TEA_LOAD_TKCONFIG], [
AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
AC_MSG_RESULT([loading])
. "${TK_BIN_DIR}/tkConfig.sh"
else
AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
fi
# If the TK_BIN_DIR is the build directory (not the install directory),
# then set the common variable name to the value of the build variables.
# For example, the variable TK_LIB_SPEC will be set to the value
# of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
# instead of TK_BUILD_LIB_SPEC since it will work with both an
# installed and uninstalled version of Tcl.
if test -f "${TK_BIN_DIR}/Makefile" ; then
TK_LIB_SPEC="${TK_BUILD_LIB_SPEC}"
TK_STUB_LIB_SPEC="${TK_BUILD_STUB_LIB_SPEC}"
TK_STUB_LIB_PATH="${TK_BUILD_STUB_LIB_PATH}"
elif test "`uname -s`" = "Darwin"; then
# If Tk was built as a framework, attempt to use the libraries
# from the framework at the given location so that linking works
# against Tk.framework installed in an arbitrary location.
case ${TK_DEFS} in
*TK_FRAMEWORK*)
if test -f "${TK_BIN_DIR}/${TK_LIB_FILE}"; then
for i in "`cd "${TK_BIN_DIR}"; pwd`" \
"`cd "${TK_BIN_DIR}"/../..; pwd`"; do
if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
TK_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TK_LIB_FILE}"
break
fi
done
fi
if test -f "${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"; then
TK_STUB_LIB_SPEC="-L` echo "${TK_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}"
TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
fi
;;
esac
fi
# TEA specific: Ensure windowingsystem is defined
if test "${TEA_PLATFORM}" = "unix" ; then
case ${TK_DEFS} in
*MAC_OSX_TK*)
AC_DEFINE(MAC_OSX_TK, 1, [Are we building against Mac OS X TkAqua?])
TEA_WINDOWINGSYSTEM="aqua"
;;
*)
TEA_WINDOWINGSYSTEM="x11"
;;
esac
elif test "${TEA_PLATFORM}" = "windows" ; then
TEA_WINDOWINGSYSTEM="win32"
fi
AC_SUBST(TK_VERSION)
AC_SUBST(TK_BIN_DIR)
AC_SUBST(TK_SRC_DIR)
AC_SUBST(TK_LIB_FILE)
AC_SUBST(TK_LIB_FLAG)
AC_SUBST(TK_LIB_SPEC)
AC_SUBST(TK_STUB_LIB_FILE)
AC_SUBST(TK_STUB_LIB_FLAG)
AC_SUBST(TK_STUB_LIB_SPEC)
# TEA specific:
AC_SUBST(TK_LIBS)
AC_SUBST(TK_XINCLUDES)
])
#------------------------------------------------------------------------
# TEA_PROG_TCLSH
# Determine the fully qualified path name of the tclsh executable
# in the Tcl build directory or the tclsh installed in a bin
# directory. This macro will correctly determine the name
# of the tclsh executable even if tclsh has not yet been
# built in the build directory. The tclsh found is always
# associated with a tclConfig.sh file. This tclsh should be used
# only for running extension test cases. It should never be
# or generation of files (like pkgIndex.tcl) at build time.
#
# Arguments:
# none
#
# Results:
# Substitutes the following vars:
# TCLSH_PROG
#------------------------------------------------------------------------
AC_DEFUN([TEA_PROG_TCLSH], [
AC_MSG_CHECKING([for tclsh])
if test -f "${TCL_BIN_DIR}/Makefile" ; then
# tclConfig.sh is in Tcl build directory
if test "${TEA_PLATFORM}" = "windows"; then
if test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${EXEEXT}" ; then
TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${EXEEXT}"
elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}s${EXEEXT}" ; then
TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}s${EXEEXT}"
elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}t${EXEEXT}" ; then
TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}t${EXEEXT}"
elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}st${EXEEXT}" ; then
TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}st${EXEEXT}"
fi
else
TCLSH_PROG="${TCL_BIN_DIR}/tclsh"
fi
else
# tclConfig.sh is in install location
if test "${TEA_PLATFORM}" = "windows"; then
TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${EXEEXT}"
else
TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}"
fi
list="`ls -d ${TCL_BIN_DIR}/../bin 2>/dev/null` \
`ls -d ${TCL_BIN_DIR}/.. 2>/dev/null` \
`ls -d ${TCL_PREFIX}/bin 2>/dev/null`"
for i in $list ; do
if test -f "$i/${TCLSH_PROG}" ; then
REAL_TCL_BIN_DIR="`cd "$i"; pwd`/"
break
fi
done
TCLSH_PROG="${REAL_TCL_BIN_DIR}${TCLSH_PROG}"
fi
AC_MSG_RESULT([${TCLSH_PROG}])
AC_SUBST(TCLSH_PROG)
])
#------------------------------------------------------------------------
# TEA_PROG_WISH
# Determine the fully qualified path name of the wish executable
# in the Tk build directory or the wish installed in a bin
# directory. This macro will correctly determine the name
# of the wish executable even if wish has not yet been
# built in the build directory. The wish found is always
# associated with a tkConfig.sh file. This wish should be used
# only for running extension test cases. It should never be
# or generation of files (like pkgIndex.tcl) at build time.
#
# Arguments:
# none
#
# Results:
# Substitutes the following vars:
# WISH_PROG
#------------------------------------------------------------------------
AC_DEFUN([TEA_PROG_WISH], [
AC_MSG_CHECKING([for wish])
if test -f "${TK_BIN_DIR}/Makefile" ; then
# tkConfig.sh is in Tk build directory
if test "${TEA_PLATFORM}" = "windows"; then
if test -f "${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${EXEEXT}" ; then
WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${EXEEXT}"
elif test -f "${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}s${EXEEXT}" ; then
WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}$s{EXEEXT}"
elif test -f "${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}t${EXEEXT}" ; then
WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}t${EXEEXT}"
elif test -f "${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}st${EXEEXT}" ; then
WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}st${EXEEXT}"
fi
else
WISH_PROG="${TK_BIN_DIR}/wish"
fi
else
# tkConfig.sh is in install location
if test "${TEA_PLATFORM}" = "windows"; then
WISH_PROG="wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${EXEEXT}"
else
WISH_PROG="wish${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}"
fi
list="`ls -d ${TK_BIN_DIR}/../bin 2>/dev/null` \
`ls -d ${TK_BIN_DIR}/.. 2>/dev/null` \
`ls -d ${TK_PREFIX}/bin 2>/dev/null`"
for i in $list ; do
if test -f "$i/${WISH_PROG}" ; then
REAL_TK_BIN_DIR="`cd "$i"; pwd`/"
break
fi
done
WISH_PROG="${REAL_TK_BIN_DIR}${WISH_PROG}"
fi
AC_MSG_RESULT([${WISH_PROG}])
AC_SUBST(WISH_PROG)
])
#------------------------------------------------------------------------
# TEA_ENABLE_SHARED --
#
# Allows the building of shared libraries
#
# Arguments:
# none
#
# Results:
#
# Adds the following arguments to configure:
# --enable-shared=yes|no
# --enable-stubs=yes|no
#
# Defines the following vars:
# STATIC_BUILD Used for building import/export libraries
# on Windows.
#
# Sets the following vars:
# SHARED_BUILD Value of 1 or 0
# STUBS_BUILD Value if 1 or 0
# USE_TCL_STUBS Value true: if SHARED_BUILD or --enable-stubs
# USE_TCLOO_STUBS Value true: if SHARED_BUILD or --enable-stubs
# USE_TK_STUBS Value true: if SHARED_BUILD or --enable-stubs
# AND TEA_WINDOWING_SYSTEM != ""
#------------------------------------------------------------------------
AC_DEFUN([TEA_ENABLE_SHARED], [
AC_MSG_CHECKING([how to build libraries])
AC_ARG_ENABLE(shared,
AS_HELP_STRING([--enable-shared],
[build and link with shared libraries (default: on)]),
[shared_ok=$enableval], [shared_ok=yes])
if test "${enable_shared+set}" = set; then
enableval="$enable_shared"
shared_ok=$enableval
else
shared_ok=yes
fi
AC_ARG_ENABLE(stubs,
AS_HELP_STRING([--enable-stubs],
[build and link with stub libraries. Always true for shared builds (default: on)]),
[stubs_ok=$enableval], [stubs_ok=yes])
if test "${enable_stubs+set}" = set; then
enableval="$enable_stubs"
stubs_ok=$enableval
else
stubs_ok=yes
fi
# Stubs are always enabled for shared builds
if test "$shared_ok" = "yes" ; then
AC_MSG_RESULT([shared])
SHARED_BUILD=1
STUBS_BUILD=1
else
AC_MSG_RESULT([static])
SHARED_BUILD=0
AC_DEFINE(STATIC_BUILD, 1, [This a static build])
if test "$stubs_ok" = "yes" ; then
STUBS_BUILD=1
else
STUBS_BUILD=0
fi
fi
if test "${STUBS_BUILD}" = "1" ; then
AC_DEFINE(USE_TCL_STUBS, 1, [Use Tcl stubs])
AC_DEFINE(USE_TCLOO_STUBS, 1, [Use TclOO stubs])
if test "${TEA_WINDOWINGSYSTEM}" != ""; then
AC_DEFINE(USE_TK_STUBS, 1, [Use Tk stubs])
fi
fi
AC_SUBST(SHARED_BUILD)
AC_SUBST(STUBS_BUILD)
])
#------------------------------------------------------------------------
# TEA_ENABLE_THREADS --
#
# Specify if thread support should be enabled. If "yes" is specified
# as an arg (optional), threads are enabled by default, "no" means
# threads are disabled. "yes" is the default.
#
# TCL_THREADS is checked so that if you are compiling an extension
# against a threaded core, your extension must be compiled threaded
# as well.
#
# Note that it is legal to have a thread enabled extension run in a
# threaded or non-threaded Tcl core, but a non-threaded extension may
# only run in a non-threaded Tcl core.
#
# Arguments:
# none
#
# Results:
#
# Adds the following arguments to configure:
# --enable-threads
#
# Sets the following vars:
# THREADS_LIBS Thread library(s)
#
# Defines the following vars:
# TCL_THREADS
# _REENTRANT
# _THREAD_SAFE
#------------------------------------------------------------------------
AC_DEFUN([TEA_ENABLE_THREADS], [
AC_ARG_ENABLE(threads,
AS_HELP_STRING([--enable-threads],
[build with threads (default: on)]),
[tcl_ok=$enableval], [tcl_ok=yes])
if test "${enable_threads+set}" = set; then
enableval="$enable_threads"
tcl_ok=$enableval
else
tcl_ok=yes
fi
if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
TCL_THREADS=1
if test "${TEA_PLATFORM}" != "windows" ; then
# We are always OK on Windows, so check what this platform wants:
# USE_THREAD_ALLOC tells us to try the special thread-based
# allocator that significantly reduces lock contention
AC_DEFINE(USE_THREAD_ALLOC, 1,
[Do we want to use the threaded memory allocator?])
AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
if test "`uname -s`" = "SunOS" ; then
AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
[Do we really want to follow the standard? Yes we do!])
fi
AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?])
AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
if test "$tcl_ok" = "no"; then
# Check a little harder for __pthread_mutex_init in the same
# library, as some systems hide it there until pthread.h is
# defined. We could alternatively do an AC_TRY_COMPILE with
# pthread.h, but that will work with libpthread really doesn't
# exist, like AIX 4.2. [Bug: 4359]
AC_CHECK_LIB(pthread, __pthread_mutex_init,
tcl_ok=yes, tcl_ok=no)
fi
if test "$tcl_ok" = "yes"; then
# The space is needed
THREADS_LIBS=" -lpthread"
else
AC_CHECK_LIB(pthreads, pthread_mutex_init,
tcl_ok=yes, tcl_ok=no)
if test "$tcl_ok" = "yes"; then
# The space is needed
THREADS_LIBS=" -lpthreads"
else
AC_CHECK_LIB(c, pthread_mutex_init,
tcl_ok=yes, tcl_ok=no)
if test "$tcl_ok" = "no"; then
AC_CHECK_LIB(c_r, pthread_mutex_init,
tcl_ok=yes, tcl_ok=no)
if test "$tcl_ok" = "yes"; then
# The space is needed
THREADS_LIBS=" -pthread"
else
TCL_THREADS=0
AC_MSG_WARN([Do not know how to find pthread lib on your system - thread support disabled])
fi
fi
fi
fi
fi
else
TCL_THREADS=0
fi
# Do checking message here to not mess up interleaved configure output
AC_MSG_CHECKING([for building with threads])
if test "${TCL_THREADS}" = 1; then
AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
AC_MSG_RESULT([yes (default)])
else
AC_MSG_RESULT([no])
fi
# TCL_THREADS sanity checking. See if our request for building with
# threads is the same as the way Tcl was built. If not, warn the user.
case ${TCL_DEFS} in
*THREADS=1*)
if test "${TCL_THREADS}" = "0"; then
AC_MSG_WARN([
Building ${PACKAGE_NAME} without threads enabled, but building against Tcl
that IS thread-enabled. It is recommended to use --enable-threads.])
fi
;;
esac
AC_SUBST(TCL_THREADS)
])
#------------------------------------------------------------------------
# TEA_ENABLE_SYMBOLS --
#
# Specify if debugging symbols should be used.
# Memory (TCL_MEM_DEBUG) debugging can also be enabled.
#
# Arguments:
# none
#
# TEA varies from core Tcl in that C|LDFLAGS_DEFAULT receives
# the value of C|LDFLAGS_OPTIMIZE|DEBUG already substituted.
# Requires the following vars to be set in the Makefile:
# CFLAGS_DEFAULT
# LDFLAGS_DEFAULT
#
# Results:
#
# Adds the following arguments to configure:
# --enable-symbols
#
# Defines the following vars:
# CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
# Sets to "$(CFLAGS_OPTIMIZE) -DNDEBUG" if false
# LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
# Sets to $(LDFLAGS_OPTIMIZE) if false
#------------------------------------------------------------------------
AC_DEFUN([TEA_ENABLE_SYMBOLS], [
dnl TEA specific: Make sure we are initialized
AC_REQUIRE([TEA_CONFIG_CFLAGS])
AC_MSG_CHECKING([for build with symbols])
AC_ARG_ENABLE(symbols,
AS_HELP_STRING([--enable-symbols],
[build with debugging symbols (default: off)]),
[tcl_ok=$enableval], [tcl_ok=no])
if test "$tcl_ok" = "no"; then
CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE} -DNDEBUG"
LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
AC_MSG_RESULT([no])
AC_DEFINE(TCL_CFG_OPTIMIZED, 1, [Is this an optimized build?])
else
CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
if test "$tcl_ok" = "yes"; then
AC_MSG_RESULT([yes (standard debugging)])
fi
fi
AC_SUBST(CFLAGS_DEFAULT)
AC_SUBST(LDFLAGS_DEFAULT)
if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?])
fi
if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
if test "$tcl_ok" = "all"; then
AC_MSG_RESULT([enabled symbols mem debugging])
else
AC_MSG_RESULT([enabled $tcl_ok debugging])
fi
fi
])
#------------------------------------------------------------------------
# TEA_ENABLE_LANGINFO --
#
# Allows use of modern nl_langinfo check for better l10n.
# This is only relevant for Unix.
#
# Arguments:
# none
#
# Results:
#
# Adds the following arguments to configure:
# --enable-langinfo=yes|no (default is yes)
#
# Defines the following vars:
# HAVE_LANGINFO Triggers use of nl_langinfo if defined.
#------------------------------------------------------------------------
AC_DEFUN([TEA_ENABLE_LANGINFO], [
AC_ARG_ENABLE(langinfo,
AS_HELP_STRING([--enable-langinfo],
[use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]),
[langinfo_ok=$enableval], [langinfo_ok=yes])
HAVE_LANGINFO=0
if test "$langinfo_ok" = "yes"; then
AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
fi
AC_MSG_CHECKING([whether to use nl_langinfo])
if test "$langinfo_ok" = "yes"; then
AC_CACHE_VAL(tcl_cv_langinfo_h, [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], [[nl_langinfo(CODESET);]])],
[tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])])
AC_MSG_RESULT([$tcl_cv_langinfo_h])
if test $tcl_cv_langinfo_h = yes; then
AC_DEFINE(HAVE_LANGINFO, 1, [Do we have nl_langinfo()?])
fi
else
AC_MSG_RESULT([$langinfo_ok])
fi
])
#--------------------------------------------------------------------
# TEA_CONFIG_SYSTEM
#
# Determine what the system is (some things cannot be easily checked
# on a feature-driven basis, alas). This can usually be done via the
# "uname" command.
#
# Arguments:
# none
#