-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.in
1479 lines (1282 loc) · 37.6 KB
/
configure.in
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
define([AC_CACHE_LOAD], )dnl
define([AC_CACHE_SAVE], )dnl
AC_INIT(generic/bltInit.c)
AC_CONFIG_HEADER(generic/bltConfig.h)
AC_CONFIG_AUX_DIR(cf)
AC_PREREQ(2.0)
# -----------------------------------------------------------------------
#
# Handle command line options
#
# --with-tcl=DIR
# --with-tk=DIR
# --with-cc=CC
# --with-cflags=flags This is probably for me only
# --with-gnu-ld
#
# -----------------------------------------------------------------------
INC_SPECS=""
LIB_SPECS=""
TCL_ONLY_LIB_SPECS=""
loader_run_path=""
DEFINES=""
blt_with_tcl=""
blt_with_tk=""
blt_enable_jpeg="no"
blt_enable_cygwin="yes"
blt_with_cc=""
blt_with_cflags="$CFLAGS"
blt_with_gnu_ld="no"
blt_with_tcl_includes=""
blt_with_tk_includes=""
blt_with_tcl_libraries=""
blt_with_tk_libraries=""
blt_with_scriptdir=""
AC_ARG_WITH(blt, [ --with-blt=DIR Install BLT scripts in DIR],
blt_with_scriptdir=$withval)
AC_ARG_WITH(tcl, [ --with-tcl=DIR Find tclConfig.sh in DIR],
blt_with_tcl=$withval)
AC_ARG_WITH(tk, [ --with-tk=DIR Find tkConfig.sh in DIR],
blt_with_tk=$withval)
AC_ARG_WITH(tclincls, [ --with-tclincls=DIR Find tcl.h in DIR],
blt_with_tcl_includes=$withval)
AC_ARG_WITH(tkincls, [ --with-tkincls=DIR Find tk.h in DIR],
blt_with_tk_includes=$withval)
AC_ARG_WITH(tcllibs, [ --with-tcllibs=DIR Find Tcl library in DIR],
blt_with_tcl_libraries=$withval)
AC_ARG_WITH(tklibs, [ --with-tklibs=DIR Find Tk library in DIR],
blt_with_tk_libraries=$withval)
AC_ARG_ENABLE(jpeg, [ --enable-jpeg=DIR Find JPEG headers and libraries in DIR], [
unset ac_cv_header_jpeglib_h
unset ac_cv_lib_jpeg ac_cv_lib_jpeg_jpeg_read_header
blt_enable_jpeg=$enableval ])
AC_ARG_ENABLE(cygwin, [ --enable-cygwin Use cygwin Tcl/Tk libraries. Requires cygwin1.dll], [
blt_enable_cygwin=$enableval ])
AC_ARG_WITH(cc, [ --with-cc=CC Set C compiler to CC], [
blt_with_cc=$with_cc
unset ac_cv_prog_CC
unset ac_cv_prog_CPP ])
AC_ARG_WITH(cflags, [ --with-cflags=FLAGS Set compiler flags to FLAGS],
blt_with_cflags="$with_cflags")
AC_ARG_WITH(gnu_ld, [ --with-gnu-ld Use GNU linker],
blt_with_gnu_ld="yes")
AC_CANONICAL_SYSTEM
AC_PREFIX_PROGRAM(wish)
# -----------------------------------------------------------------------
#
# Set a variable containing current working directory if /bin/sh
# doesn't do it already.
#
# -----------------------------------------------------------------------
PWD=`pwd`
# -----------------------------------------------------------------------
#
# C compiler and debugging flags
#
# -----------------------------------------------------------------------
BLT_ENV_CC=$CC
#
# CC search order
#
# 1. command line (--with-cc)
# 2. environment variable ($CC)
# 3. cached variable ($blt_cv_prog_cc)
# 4. check for program (AC_PROG_CC)
# 4. default to cc
#
dnl AC_MSG_CHECKING([which C compiler])
dnl if test "x${blt_with_cc}" != "x" ; then
dnl CC=${blt_with_cc}
dnl unset ac_cv_prog_CPP
dnl unset ac_cv_prog_CC
dnl elif test "x${BLT_ENV_CC}" != "x" ; then
dnl unset ac_cv_prog_CPP
dnl unset ac_cv_prog_CC
dnl elif test "x${blt_cv_prog_cc}" != "x" ; then
dnl CC=${blt_cv_prog_cc}
dnl unset ac_cv_prog_CC
dnl else
dnl AC_PROG_CC
dnl fi
dnl if test "x${CC}" = "x" ; then
dnl CC=cc
dnl fi
dnl case $target in
dnl *-*-cygwin*|*-*-mingw*)
dnl if test "${blt_enable_cygwin}" = "no" ; then
dnl CC="${CC} -mno-cygwin"
dnl fi
dnl ;;
dnl esac
dnl AC_MSG_RESULT([$CC])
dnl unset blt_cv_prog_cc
dnl AC_CACHE_VAL(blt_cv_prog_cc, blt_cv_prog_cc=$CC)
dnl AC_SUBST(CC)
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CPP
if test "x${GCC}" != "x" ; then
blt_have_gcc="yes"
else
AC_MSG_CHECKING([if C compiler is really gcc])
AC_EGREP_CPP(_cc_is_gcc_, [
#ifdef __GNUC__
_cc_is_gcc_
#endif
], [blt_have_gcc=yes], [blt_have_gcc=no])
AC_MSG_RESULT([$blt_have_gcc])
fi
dnl #
dnl # CFLAGS search order
dnl #
dnl # 1. command line (--with-cflags)
dnl # 2. cached variable ($blt_cv_prog_cflags)
dnl # 3. set to "-O6" if using gcc ($blt_have_gcc)
dnl # 4. otherwise, default to "-O"
dnl #
dnl AC_MSG_CHECKING([default compiler flags])
dnl if test "x${blt_with_cflags}" != "x" ; then
dnl CFLAGS=${blt_with_cflags}
dnl elif test "x${blt_cv_prog_cflags}" != "x" ; then
dnl CFLAGS=${blt_cv_prog_cflags}
dnl elif test "${blt_have_gcc}" = "yes" ; then
dnl CFLAGS=-O6
dnl else
dnl CFLAGS=-O
dnl fi
dnl AC_MSG_RESULT([$CFLAGS])
dnl unset blt_cv_prog_cflags
dnl AC_CACHE_VAL(blt_cv_prog_cflags, blt_cv_prog_cflags=$CFLAGS)
dnl AC_SUBST(CFLAGS)
GCCFLAGS=""
if test "${blt_have_gcc}" = "yes" ; then
GCCFLAGS="-Wall"
if test "${CFLAGS}" = "-g" ; then
GCCFLAGS="-Wshadow -Winline -Wpointer-arith ${GCCFLAGS}"
fi
fi
AC_SUBST(GCCFLAGS)
dnl AC_CYGWIN
blt_lib_prefix="lib"
case $target in
*-*-mingw*)
blt_platform="win"
blt_lib_prefix=""
;;
*-*-macosx)
blt_platform="macosx"
;;
*)
blt_platform="unix"
;;
esac
# -----------------------------------------------------------------------
#
# Programs: Check for existence of ranlib and install programs
#
# -----------------------------------------------------------------------
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_LN_S
# -----------------------------------------------------------------------
#
# Libraries: Check for libraries used
#
# -----------------------------------------------------------------------
AC_CHECK_LIB(socket, main)
AC_CHECK_LIB(nsl, main)
AC_CHECK_LIB(m, main)
# -----------------------------------------------------------------------
#
# Headers: Check for header files used
#
# -----------------------------------------------------------------------
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_CHECK_HEADERS(inttypes.h)
if test "${ac_cv_header_inttypes_h}" = "yes" ; then
HAVE_INTTYPES_H=1
else
HAVE_INTTYPES_H=0
fi
AC_SUBST(HAVE_INTTYPES_H)
AC_CHECK_HEADERS(limits.h sys/param.h)
AC_CHECK_HEADERS(string.h ctype.h)
AC_CHECK_HEADERS(errno.h float.h math.h ieeefp.h)
AC_CHECK_HEADERS(sys/time.h waitflags.h sys/wait.h)
AC_CHECK_HEADERS(malloc.h memory.h)
AC_CHECK_HEADERS(setjmp.h)
if test "${blt_enable_jpeg}" != "no" ; then
jpeg_save_CPPFLAGS=${CPPFLAGS}
CPPFLAGS=""
if test "${blt_enable_jpeg}" != "yes" ; then
CPPFLAGS="-I${blt_enable_jpeg}/include"
fi
AC_CHECK_HEADERS(jpeglib.h, [JPEG_INC_SPEC="${CPPFLAGS}"], [JPEG_INC_SPEC=""])
CPPFLAGS=${jpeg_save_CPPFLAGS}
fi
# Run this check after jpeglib.h because jpeglib.h sets HAVE_STDLIB_H
AC_CHECK_HEADERS(stdlib.h unistd.h)
# -----------------------------------------------------------------------
#
# Types: Check for existence of types of size_t and pid_t
#
# -----------------------------------------------------------------------
dnl AC_TYPE_SIZE_T
dnl AC_TYPE_PID_T
AC_MSG_CHECKING([whether union wait is defined correctly])
AC_CACHE_VAL(blt_cv_struct_wait_works,
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/wait.h>], [
/*
* Check whether <sys/wait.h> defines the type "union wait"
* correctly. It's needed because of weirdness in HP-UX where
* "union wait" is defined in both the BSD and SYS-V environments.
* Checking the usability of WIFEXITED seems to do the trick.
*/
union wait x;
WIFEXITED(x); /* Generates compiler error if WIFEXITED
* uses an int. */
],
[blt_cv_struct_wait_works="yes"],
[blt_cv_struct_wait_works="no"]))
if test "${blt_cv_struct_wait_works}" = "yes"; then
AC_DEFINE(HAVE_UNION_WAIT)
fi
AC_MSG_RESULT([$blt_cv_struct_wait_works])
# -----------------------------------------------------------------------
#
# Compiler characteristics:
# Check for existence of types of size_t and pid_t
#
# -----------------------------------------------------------------------
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(void *)
SIZEOF_LONG="${ac_cv_sizeof_long}"
SIZEOF_LONG_LONG="${ac_cv_sizeof_long_long}"
SIZEOF_VOID_P="${ac_cv_sizeof_void_p}"
SIZEOF_INT="${ac_cv_sizeof_int}"
AC_SUBST(SIZEOF_INT)
AC_SUBST(SIZEOF_LONG)
AC_SUBST(SIZEOF_LONG_LONG)
AC_SUBST(SIZEOF_VOID_P)
# -----------------------------------------------------------------------
#
# Library Functions: Check for strdup, drand48, and srand48.
#
# -----------------------------------------------------------------------
AC_HAVE_FUNCS(strdup strcasecmp strncasecmp drand48 srand48 finite strtod isnan nan)
# For HPUX it's a little more complicated to search for isfinite
AC_MSG_CHECKING([for isfinite])
AC_CACHE_VAL(blt_cv_have_isfinite,
AC_TRY_LINK([#include <math.h>], [
double x = 1.0;
if (isfinite(x)) {
return 0;
}
], [blt_cv_have_isfinite="yes"], [blt_cv_have_isfinite="no"]))
if test "${blt_cv_have_isfinite}" = "yes"; then
AC_DEFINE(HAVE_ISFINITE)
fi
AC_MSG_RESULT([$blt_cv_have_isfinite])
# -----------------------------------------------------------------------
#
# Check the smallest value such that 1.0 + x != 1.0.
# For ANSI compilers this is DBL_EPSILON in float.h
#
#--------------------------------------------------------------------
AC_MSG_CHECKING([whether DBL_EPSILON is defined in float.h])
AC_CACHE_VAL(blt_cv_found_dbl_epsilon,
AC_EGREP_CPP(blt_yes,
[
#ifdef HAVE_FLOAT_H
#include <float.h>
#endif
#ifdef DBL_EPSILON
blt_yes
#endif
], blt_cv_found_dbl_epsilon=yes, blt_cv_found_dbl_epsilon=no)
)
AC_MSG_RESULT([${blt_cv_found_dbl_epsilon}])
if test "${blt_cv_found_dbl_epsilon}" = "no" ; then
AC_CACHE_VAL(blt_cv_dbl_epsilon,
old_flags="$CFLAGS"
CFLAGS="-g -lm"
AC_MSG_CHECKING([whether DBL_EPSILON can be computed])
AC_TRY_RUN_WITH_OUTPUT([blt_cv_dbl_epsilon], [
#include <stdio.h>
#include <stdlib.h>
main () {
double e, u;
/*
* Check the smallest value such that 1.0 + x != 1.0.
* For ANSI compilers this is DBL_EPSILON in float.h
*/
u = 1.0;
for(;;) {
u *= 0.5;
if ((1.0 + u) == 1.0) {
break;
}
}
e = u * 2.0;
printf("%.17e\n", e);
exit(0);
}])
CFLAGS="$old_flags"
AC_DEFINE_UNQUOTED(BLT_DBL_EPSILON, ${blt_cv_dbl_epsilon})
AC_MSG_RESULT([${blt_cv_dbl_epsilon}])
)
fi
AC_MSG_CHECKING([whether declaration is needed for strdup])
AC_CACHE_VAL(blt_cv_nedd_decl_strdup,
AC_EGREP_CPP(strdup, [
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
], [blt_cv_need_decl_strdup=no], [blt_cv_need_decl_strdup=yes]))
if test "${blt_cv_need_decl_strdup}" = "yes"; then
AC_DEFINE(NEED_DECL_STRDUP)
fi
AC_MSG_RESULT([$blt_cv_need_decl_strdup])
AC_MSG_CHECKING([whether declaration is needed for drand48])
AC_CACHE_VAL(blt_cv_need_decl_drand48,
AC_EGREP_CPP(drand48, [
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_MATH_H
#include <math.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
], [blt_cv_need_decl_drand48=no], [blt_cv_need_decl_drand48=yes]))
if test "${blt_cv_need_decl_drand48}" = "yes"; then
AC_DEFINE(NEED_DECL_DRAND48)
fi
AC_MSG_RESULT([$blt_cv_need_decl_drand48])
AC_MSG_CHECKING([whether declaration is needed for srand48])
AC_CACHE_VAL(blt_cv_need_decl_srand48,
AC_EGREP_CPP(srand48, [
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_MATH_H
#include <math.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
], [blt_cv_need_decl_srand48=no], [blt_cv_need_decl_srand48=yes]))
if test "${blt_cv_need_decl_srand48}" = "yes"; then
AC_DEFINE(NEED_DECL_SRAND48)
fi
AC_MSG_RESULT([$blt_cv_need_decl_srand48])
AC_MSG_CHECKING([whether declaration is needed for j1])
AC_CACHE_VAL(blt_cv_need_decl_j1,
AC_EGREP_CPP(j1, [
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_MATH_H
#include <math.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
], [blt_cv_need_decl_j1=no], [blt_cv_need_decl_j1=yes]))
if test "${blt_cv_need_decl_j1}" = "yes"; then
AC_DEFINE(NEED_DECL_J1)
fi
AC_MSG_RESULT([$blt_cv_need_decl_j1])
# -----------------------------------------------------------------------
#
# System services: X, Tcl, Tk
#
# -----------------------------------------------------------------------
AC_PATH_X
# -----------------------------------------------------------------------
#
# Find the Tcl build configuration file "tclConfig.sh"
#
# -----------------------------------------------------------------------
AC_MSG_CHECKING([for tclConfig.sh])
tcl_config_sh=""
if test "x$blt_with_tcl" != "x" ; then
# Verify that a tclConfig.sh file exists in the directory specified
# by --with-tcl.
for dir in \
$blt_with_tcl
do
if test -r "$dir/tclConfig.sh" ; then
tcl_config_sh="$dir/tclConfig.sh"
break
elif test -r "$dir/lib/tclConfig.sh" ; then
tcl_config_sh="$dir/lib/tclConfig.sh"
break
elif test -r "$dir/$blt_platform/tclConfig.sh" ; then
tcl_config_sh="$dir/$blt_platform/tclConfig.sh"
break
fi
done
else
# Otherwise, search for Tcl configuration file.
# 1. Search previously named locations.
for dir in \
$prefix \
$exec_prefix \
../tcl \
$blt_cv_tcl_lib
do
if test -r "$dir/tclConfig.sh" ; then
tcl_config_sh="$dir/tclConfig.sh"
break
elif test -r "$dir/lib/tclConfig.sh" ; then
tcl_config_sh="$dir/lib/tclConfig.sh"
break
elif test -r "$dir/$blt_platform/tclConfig.sh" ; then
tcl_config_sh="$dir/$blt_platform/tclConfig.sh"
break
fi
done
# 2. Search source directories.
if test "x$tcl_config_sh" = "x" ; then
for dir in \
`ls -dr ../tcl[[7-9]].[[0-9]]* 2>/dev/null` \
../tcl \
`ls -dr ../../tcl[[7-9]].[[0-9]]* 2>/dev/null` \
../../tcl \
`ls -dr ../../../tcl[[7-9]].[[0-9]]* 2>/dev/null` \
../../../tcl
do
if test -r "$dir/$blt_platform/tclConfig.sh" ; then
tcl_config_sh="$dir/$blt_platform/tclConfig.sh"
break
fi
done
fi
# 3. Search standard locations.
if test "x$tcl_config_sh" = "x" ; then
for dir in \
`ls -dr /usr/local/tcl/tcl[[7-9]].[[0-9]]* 2>/dev/null` \
/usr/local/tcl \
/usr/local \
/usr
do
if test -r "$dir/tclConfig.sh" ; then
tcl_config_sh="$dir/tclConfig.sh"
break
elif test -r "$dir/lib/tclConfig.sh" ; then
tcl_config_sh="$dir/lib/tclConfig.sh"
break
fi
done
fi
fi
AC_MSG_RESULT([${tcl_config_sh}])
if test "x$tcl_config_sh" = "x" ; then
echo "can't find Tcl configuration script \"tclConfig.sh\""
exit 1
fi
# -----------------------------------------------------------------------
#
# Find the Tk build configuration file "tkConfig.sh"
#
# -----------------------------------------------------------------------
AC_MSG_CHECKING([for tkConfig.sh])
tk_config_sh=""
if test "x$blt_with_tk" != "x" -o "x$blt_with_tcl" != "x"; then
# Verify that a tkConfig.sh file exists in the directory specified
# by --with-tcl or --with-tk.
for dir in \
$blt_with_tk \
$blt_with_tcl
do
if test -r "$dir/tkConfig.sh" ; then
tk_config_sh="$dir/tkConfig.sh"
break
elif test -r "$dir/lib/tkConfig.sh" ; then
tk_config_sh="$dir/lib/tkConfig.sh"
break
elif test -r "$dir/$blt_platform/tkConfig.sh" ; then
tk_config_sh="$dir/$blt_platform/tkConfig.sh"
break
fi
done
else
# Search for Tk configuration file.
# 1. Search previously named locations.
for dir in \
$prefix \
$exec_prefix \
../tk \
$blt_cv_tk_lib \
$blt_cv_tcl_lib
do
if test -r "$dir/tkConfig.sh" ; then
tk_config_sh="$dir/tkConfig.sh"
break
elif test -r "$dir/lib/tkConfig.sh" ; then
tk_config_sh="$dir/lib/tkConfig.sh"
break
elif test -r "$dir/$blt_platform/tkConfig.sh" ; then
tk_config_sh="$dir/$blt_platform/tkConfig.sh"
break
fi
done
# 2. Search source directories.
if test "x$tk_config_sh" = "x" ; then
for dir in \
../tcl \
`ls -dr ../tk[[4-9]].[[0-9]]* 2>/dev/null` \
../../tk \
`ls -dr ../../tk[[4-9]].[[0-9]]* 2>/dev/null` \
../../../tk \
`ls -dr ../../../tk[[4-9]].[[0-9]]* 2>/dev/null`
do
if test -r "$dir/$blt_platform/tkConfig.sh"; then
tk_config_sh="$dir/$blt_platform/tkConfig.sh"
break
fi
done
fi
# 3. Search standard locations.
if test "x$tk_config_sh" = "x" ; then
for dir in \
`ls -dr /usr/local/tcl/tcl[[7-9]].[[0-9]]* 2>/dev/null` \
/usr/local/tcl \
/usr/local \
${x_libraries} \
/usr
do
if test -r "$dir/tkConfig.sh" ; then
tk_config_sh="$dir/tkConfig.sh"
break
elif test -r "$dir/lib/tkConfig.sh" ; then
tk_config_sh="$dir/lib/tkConfig.sh"
break
fi
done
fi
fi
AC_MSG_RESULT([${tk_config_sh}])
if test "x$tk_config_sh" = "x" ; then
echo "can't find Tk configuration script \"tkConfig.sh\""
exit 1
fi
# -----------------------------------------------------------------------
#
# Source in the Tcl/Tk configuration scripts.
#
# -----------------------------------------------------------------------
. $tcl_config_sh
. $tk_config_sh
TCL_INC_DIR=""
TK_INC_DIR=""
if test "x${blt_with_tcl_includes}" != "x" ; then
if test -r "${blt_with_tcl_includes}/tcl.h" ; then
TCL_INC_DIR=${blt_with_tcl_includes}
else
echo "Can't find tcl.h in \"${blt_with_tcl_includes}\""
exit 1
fi
else
for dir in \
${TCL_PREFIX}/include/tcl${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION} \
${TCL_PREFIX}/include \
${TCL_SRC_DIR}/generic
do
if test -r "$dir/tcl.h" ; then
TCL_INC_DIR=$dir
break
fi
done
if test "x${TCL_INC_DIR}" = "x" ; then
echo "Can't find tcl.h header file"
exit 1
fi
fi
if test "x${blt_with_tk_includes}" != "x" ; then
if test -r "${blt_with_tk_includes}/tk.h" ; then
TK_INC_DIR=${blt_with_tk_includes}
else
echo "Can't find tk.h in \"${blt_with_tk_includes}\""
exit 1
fi
else
for dir in \
${TK_PREFIX}/include/tk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION} \
${TK_PREFIX}/include \
${TK_SRC_DIR}/generic \
${TCL_INC_DIR}
do
if test -r "$dir/tk.h" ; then
TK_INC_DIR=$dir
break
fi
done
if test "x${TK_INC_DIR}" = "x" ; then
echo "Can't find tk.h header file"
exit 1
fi
fi
case $target in
*-sunos4*|*-*-netbsd|NetBSD-*|FreeBSD-*|OpenBSD-*|*-*-mingw*)
TCL_LIB_NAME="tcl${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}"
TK_LIB_NAME="tk${TK_MAJOR_VERSION}${TK_MINOR_VERSION}"
;;
*)
TCL_LIB_NAME="tcl${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}"
TK_LIB_NAME="tk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}"
;;
esac
TCL_LIB_SPEC="-l${TCL_LIB_NAME}"
TK_LIB_SPEC="-l${TK_LIB_NAME}"
case $target in
*-hpux*)
SHLIB_SUFFIX="sl"
;;
*)
SHLIB_SUFFIX="so"
;;
esac
TCL_LIB_DIR="${TCL_SRC_DIR}/$blt_platform"
TK_LIB_DIR="${TK_SRC_DIR}/$blt_platform"
if test "x${blt_with_tcl_libraries}" != "x" ; then
for libname in \
"${blt_with_tcl_libraries}/lib${TCL_LIB_NAME}.${SHLIB_SUFFIX}" \
"${blt_with_tcl_libraries}/lib${TCL_LIB_NAME}.a"
do
if test -r "$libname" ; then
TCL_LIB_DIR="${blt_with_tcl_libraries}"
break
fi
done
if test "x${TCL_LIB_DIR}" = "x" ; then
echo "Can't find tcl library in \"${blt_with_tcl_libraries}\""
exit 1
fi
else
for libname in \
"${TCL_EXEC_PREFIX}/lib/lib${TCL_LIB_NAME}.${SHLIB_SUFFIX}" \
"${TCL_EXEC_PREFIX}/lib/lib${TCL_LIB_NAME}.a"
do
if test -r "$libname" ; then
TCL_LIB_DIR="${TCL_EXEC_PREFIX}/lib"
break
fi
done
if test "x${TCL_LIB_DIR}" = "x" ; then
echo "Can't find tcl library"
exit 1
fi
fi
if test "x${blt_with_tk_libraries}" != "x" ; then
for libname in \
"${blt_with_tk_libraries}/lib${TK_LIB_NAME}.${SHLIB_SUFFIX}" \
"${blt_with_tk_libraries}/lib${TK_LIB_NAME}.a"
do
if test -r "$libname" ; then
TK_LIB_DIR="${blt_with_tk_libraries}"
break
fi
done
if test "x${TK_LIB_DIR}" = "x" ; then
echo "Can't find tk library in \"${blt_with_tk_libraries}\""
exit 1
fi
else
for libname in \
"${TK_EXEC_PREFIX}/lib/lib${TK_LIB_NAME}.${SHLIB_SUFFIX}" \
"${TK_EXEC_PREFIX}/lib/lib${TK_LIB_NAME}.a"
do
if test -r "$libname" ; then
TK_LIB_DIR="${TK_EXEC_PREFIX}/lib"
break
fi
done
if test "x${TK_LIB_DIR}" = "x" ; then
echo "Can't find tk library"
exit 1
fi
fi
# -----------------------------------------------------------------------
#
# Include files
#
# Append to INC_SPECS the various include files specifications
# (built fromt the include directory information).
#
# -----------------------------------------------------------------------
# JPEG include files
if test "${blt_enable_jpeg}" != "no" ; then
if test "x${JPEG_INC_SPEC}" != "x" ; then
INC_SPECS="${INC_SPECS} ${JPEG_INC_SPEC}"
fi
fi
# Tk include files
if test "${TK_INC_DIR}" != "/usr/include" ; then
INC_SPECS="${INC_SPECS} -I${TK_INC_DIR}"
fi
INC_SPECS="${INC_SPECS} -I${TK_SRC_DIR}/generic -I${TK_SRC_DIR}/unix"
# Tcl include files
#
# Add the include directory specification only if the Tcl
# headers reside in a different directory from Tk's.
if test "${TCL_INC_DIR}" != "/usr/include" -a \
"${TCL_INC_DIR}" != "${TK_INC_DIR}" ; then
INC_SPECS="${INC_SPECS} -I${TCL_INC_DIR}"
fi
INC_SPECS="${INC_SPECS} -I${TCL_SRC_DIR}/generic -I${TCL_SRC_DIR}/unix"
# On Windows, override the default include directory with our own.
if test "${blt_platform}" = "win"; then
x_includes="NONE"
fi
# X11 include files
if test "x${x_includes}" != "x" -a \
"${x_includes}" != "NONE" -a \
"${x_includes}" != "/usr/include" -a \
"${x_includes}" != "${TK_INC_DIR}" -a \
"${x_includes}" != "${TCL_INC_DIR}" ; then
INC_SPECS="${INC_SPECS} -I${x_includes}"
fi
# -----------------------------------------------------------------------
#
# Libraries
#
# Append to LIB the various library specifications
# (built from the library directory information).
#
# -----------------------------------------------------------------------
# Tk libraries
if test "${TK_LIB_DIR}" = "/usr/lib" ; then
LIB_SPECS="${LIB_SPECS} ${TK_LIB_SPEC}"
else
LIB_SPECS="${LIB_SPECS} -L${TK_LIB_DIR} ${TK_LIB_SPEC}"
if test "x${loader_run_path}" = "x" ; then
loader_run_path="${TK_LIB_DIR}"
else
loader_run_path="${TK_LIB_DIR}:${loader_run_path}"
fi
fi
# Tcl libraries
if test "${TCL_LIB_DIR}" = "/usr/lib" -o \
"${TCL_LIB_DIR}" = "${TK_LIB_DIR}" ; then
LIB_SPECS="${LIB_SPECS} ${TCL_LIB_SPEC}"
else
LIB_SPECS="${LIB_SPECS} -L${TCL_LIB_DIR} ${TCL_LIB_SPEC}"
if test "x${loader_run_path}" = "x" ; then
loader_run_path="${TCL_LIB_DIR}"
else
loader_run_path="${TCL_LIB_DIR}:${loader_run_path}"
fi
fi
if test "${TCL_LIB_DIR}" = "/usr/lib" ; then
TCL_ONLY_LIB_SPECS="${TCL_LIB_SPEC}"
else
TCL_ONLY_LIB_SPECS="-L${TCL_LIB_DIR} ${TCL_LIB_SPEC}"
fi
# Collect the libraries for AIX that aren't using stubs.
aix_lib_specs=""
if test "${blt_platform}" = "win"; then
LIB_SPECS="${LIB_SPECS} -mwindows"
elif test "${blt_platform}" = "unix"; then
# Add specification for X11 library only on Unix platforms.
if test "x${x_libraries}" = "x" -o \
"x${x_libraries}" = "NONE" -o \
"${x_libraries}" = "/usr/lib" -o \
"${x_libraries}" = "${TK_LIB_DIR}" -o \
"${x_libraries}" = "${TCL_LIB_DIR}" ; then
LIB_SPECS="${LIB_SPECS} -lX11"
aix_lib_specs="${aix_lib_specs} -lX11"
else
LIB_SPECS="${LIB_SPECS} -L${x_libraries} -lX11"
aix_lib_specs="${aix_lib_specs} -L${x_libraries} -lX11"
if test "x${loader_run_path}" = "x" ; then
loader_run_path="${x_libraries}"
else
loader_run_path="${loader_run_path}:${x_libraries}"
fi
fi
fi
# JPEG library
if test "${blt_enable_jpeg}" != "no" ; then
jpeg_save_LDFlags="${LDFLAGS}"
JPEG_LIB_SPEC="-ljpeg"
JPEG_LIB_DIR=""
if test "${blt_enable_jpeg}" != "yes" ; then
JPEG_LIB_DIR="${blt_enable_jpeg}/lib"
JPEG_LIB_SPEC="-L${JPEG_LIB_DIR} ${JPEG_LIB_SPEC}"
LDFLAGS="-L${JPEG_LIB_DIR} ${LDFLAGS}"
fi
AC_CHECK_LIB(jpeg, jpeg_read_header, [found=yes], [found=no], )
if test "${found}" = "yes" ; then
LIB_SPECS="${LIB_SPECS} ${JPEG_LIB_SPEC}"
aix_lib_specs="${aix_lib_specs} ${JPEG_LIB_SPEC}"
if test "x${JPEG_LIB_DIR}" != "x" ; then
loader_run_path="${loader_run_path}:${JPEG_LIB_DIR}"
fi
fi
LDFLAGS=${jpeg_save_LDFlags}
fi
save_libs=$LIBS
LIBS="$LIB_SPECS $LIBS"
AC_CHECK_FUNCS(XExtendedMaxRequestSize)
LIBS=$save_libs
# -----------------------------------------------------------------------
#
# Set up a new default prefix to installation path. The ways
# the prefix can be set and their precedence are as follows:
#
# 1. --prefix option given to ./configure. (prefix != NONE)
# 2. use previously configured Tk prefix
#
# -----------------------------------------------------------------------
if test "$prefix" = "NONE" ; then
prefix=${TCL_PREFIX}
fi
if test "$exec_prefix" = "NONE" ; then
exec_prefix=${TCL_EXEC_PREFIX}
fi
# -------------------------------------------------------------------------
#
# Extract the BLT version number for the blt.h header
#
# -------------------------------------------------------------------------
AC_MSG_CHECKING([BLT_MAJOR_VERSION])
AC_CACHE_VAL(blt_cv_major_version,
AC_GREP_SYMBOL(blt_cv_major_version, BLT_MAJOR_VERSION, ${srcdir}/generic/blt.h)
)
BLT_MAJOR_VERSION=${blt_cv_major_version}
AC_MSG_RESULT([$blt_cv_major_version])
AC_MSG_CHECKING([BLT_MINOR_VERSION])
AC_CACHE_VAL(blt_cv_minor_version,
AC_GREP_SYMBOL(blt_cv_minor_version, BLT_MINOR_VERSION, ${srcdir}/generic/blt.h)
)
AC_MSG_RESULT([$blt_cv_minor_version])
BLT_MINOR_VERSION=${blt_cv_minor_version}
BLT_VERSION=${BLT_MAJOR_VERSION}.${BLT_MINOR_VERSION}
AC_MSG_CHECKING([BLT_PATCH_LEVEL])
AC_CACHE_VAL(blt_cv_patch_level,
AC_GREP_SYMBOL(blt_cv_patch_level, BLT_PATCH_LEVEL, ${srcdir}/generic/blt.h)
)
AC_MSG_RESULT([$blt_cv_patch_level])
BLT_PATCH_LEVEL=${blt_cv_patch_level}
# Add BLT to the run path
libdir=${exec_prefix}/lib
if test "x${libdir}" != "x" -a \
"${libdir}" != "/usr/lib" -a \
"${libdir}" != "${x_libraries}" -a \
"${libdir}" != "${TK_LIB_DIR}" -a \
"${libdir}" != "${TCL_LIB_DIR}" ; then
if test "x${loader_run_path}" = "x" ; then
loader_run_path="${libdir}"