OSDN Git Service

2004-02-24 Andrew Cagney <cagney@redhat.com>
[pf3gnuchains/pf3gnuchains3x.git] / blt / configure.in
1 define([AC_CACHE_LOAD], )dnl
2 define([AC_CACHE_SAVE], )dnl
3 AC_INIT(src/bltInit.c)
4 AC_CONFIG_HEADER(src/bltConfig.h)
5 AC_CONFIG_AUX_DIR(cf)
6 AC_PREREQ(2.0)  
7
8 # -----------------------------------------------------------------------
9 #
10 #       Handle command line options
11 #
12 #               --with-tcl=DIR
13 #               --with-tk=DIR
14 #               --with-cc=CC            
15 #               --with-cflags=flags     This is probably for me only
16 #               --with-gnu-ld 
17 #
18 # -----------------------------------------------------------------------
19
20 INC_SPECS=""
21 LIB_SPECS=""
22 TCL_ONLY_LIB_SPECS=""
23 loader_run_path=""
24 DEFINES=""
25
26 blt_with_tcl=""
27 blt_with_tk=""
28 blt_enable_jpeg="no"
29 blt_with_cc=""
30 blt_with_cflags="$CFLAGS"
31 blt_with_gnu_ld="no"
32 blt_with_tcl_includes=""
33 blt_with_tk_includes=""
34 blt_with_tcl_libraries=""
35 blt_with_tk_libraries=""
36
37 AC_ARG_WITH(tcl,        [  --with-tcl=DIR          Find tclConfig.sh in DIR],
38   blt_with_tcl=$withval) 
39 AC_ARG_WITH(tk,         [  --with-tk=DIR           Find tkConfig.sh in DIR],
40   blt_with_tk=$withval)
41 AC_ARG_WITH(tclincls,   [  --with-tclincls=DIR     Find tcl.h in DIR],
42   blt_with_tcl_includes=$withval)
43 AC_ARG_WITH(tkincls,    [  --with-tkincls=DIR      Find tk.h in DIR],
44   blt_with_tk_includes=$withval)
45 AC_ARG_WITH(tcllibs,    [  --with-tcllibs=DIR      Find Tcl library in DIR],
46   blt_with_tcl_libraries=$withval)
47 AC_ARG_WITH(tklibs,     [  --with-tklibs=DIR       Find Tk library in DIR],
48   blt_with_tk_libraries=$withval)
49 AC_ARG_ENABLE(jpeg,     [  --enable-jpeg=DIR       Find JPEG headers and libraries in DIR], [
50   unset ac_cv_header_jpeglib_h
51   unset ac_cv_lib_jpeg ac_cv_lib_jpeg_jpeg_read_header
52   blt_enable_jpeg=$enableval ])
53 AC_ARG_WITH(cc,         [  --with-cc=CC            Set C compiler to CC], [
54   blt_with_cc=$with_cc 
55   unset ac_cv_prog_CC
56   unset ac_cv_prog_CPP ])
57 AC_ARG_WITH(cflags,     [  --with-cflags=FLAGS     Set compiler flags to FLAGS],
58   blt_with_cflags="$with_cflags")
59 AC_ARG_WITH(gnu_ld,     [  --with-gnu-ld           Use GNU linker],
60   blt_with_gnu_ld="yes")
61
62 AC_CANONICAL_SYSTEM
63 AC_PREFIX_PROGRAM(bltwish)
64
65 # -----------------------------------------------------------------------
66 #
67 #       Set a variable containing current working directory if /bin/sh
68 #       doesn't do it already.
69 #
70 # -----------------------------------------------------------------------
71
72 PWD=`pwd`
73
74 # -----------------------------------------------------------------------
75 #
76 #       C compiler and debugging flags
77 #
78 # -----------------------------------------------------------------------
79
80 BLT_ENV_CC=$CC
81
82 #
83 # CC search order
84 #
85 #  1. command line (--with-cc)
86 #  2. environment variable ($CC)
87 #  3. cached variable ($blt_cv_prog_cc)
88 #  4. check for program (AC_PROG_CC)
89 #  4. default to cc
90 #
91
92 AC_MSG_CHECKING([which C compiler])
93 if test "x${blt_with_cc}" != "x" ; then 
94   CC=${blt_with_cc}
95   unset ac_cv_prog_CPP
96   unset ac_cv_prog_CC
97 elif test "x${BLT_ENV_CC}" != "x" ; then
98   unset ac_cv_prog_CPP
99   unset ac_cv_prog_CC
100 elif test "x${blt_cv_prog_cc}" != "x" ; then
101   CC=${blt_cv_prog_cc}
102   unset ac_cv_prog_CC
103 else 
104   AC_PROG_CC
105 fi
106 if test "x${CC}" = "x" ; then
107   CC=cc
108 fi
109 AC_MSG_RESULT([$CC])
110
111 unset blt_cv_prog_cc
112 AC_CACHE_VAL(blt_cv_prog_cc, blt_cv_prog_cc=$CC)
113 AC_SUBST(CC)
114 AC_PROG_CPP
115 if test "x${GCC}" != "x" ; then
116   blt_have_gcc="yes"
117 else
118   AC_MSG_CHECKING([if C compiler is really gcc])
119     AC_EGREP_CPP(_cc_is_gcc_, [
120 #ifdef __GNUC__
121     _cc_is_gcc_
122 #endif
123 ],      [blt_have_gcc=yes], [blt_have_gcc=no])
124   AC_MSG_RESULT([$blt_have_gcc])
125 fi
126
127 #
128 # CFLAGS search order
129 #
130 #  1. command line (--with-cflags)
131 #  2. cached variable ($blt_cv_prog_cflags)
132 #  3. set to "-O6" if using gcc ($blt_have_gcc)
133 #  4. otherwise, default to "-O"
134 #
135 AC_MSG_CHECKING([default compiler flags])
136 if test  "x${blt_with_cflags}" != "x" ; then 
137   CFLAGS=${blt_with_cflags}
138 elif test "x${blt_cv_prog_cflags}" != "x" ; then
139   CFLAGS=${blt_cv_prog_cflags}
140 elif test "${blt_have_gcc}" = "yes" ; then
141   CFLAGS=-O6
142 else
143   CFLAGS=-O
144 fi
145
146 AC_MSG_RESULT([$CFLAGS])
147 unset blt_cv_prog_cflags
148 AC_CACHE_VAL(blt_cv_prog_cflags, blt_cv_prog_cflags=$CFLAGS)
149 AC_SUBST(CFLAGS)
150
151 GCCFLAGS=""
152 if test "${blt_have_gcc}" = "yes" ; then
153   GCCFLAGS="-Wall"
154   if test "${CFLAGS}" = "-g" ; then 
155     GCCFLAGS="-Wshadow -Winline -Wpointer-arith ${GCCFLAGS}"
156   fi
157 fi
158 AC_SUBST(GCCFLAGS)
159
160
161 # -----------------------------------------------------------------------
162 #
163 # Programs:     Check for existence of ranlib and install programs
164 #
165 # -----------------------------------------------------------------------
166 AC_PROG_AWK
167 AC_PROG_INSTALL
168 AC_PROG_RANLIB
169 AC_PROG_LN_S
170
171 # -----------------------------------------------------------------------
172 #
173 # Libraries:    Check for libraries used
174 #
175 # -----------------------------------------------------------------------
176 AC_CHECK_LIB(socket, main)
177 AC_CHECK_LIB(nsl, main)
178 AC_CHECK_LIB(m, main)
179 # -----------------------------------------------------------------------
180 #
181 # Headers:      Check for header files used
182 #
183 # -----------------------------------------------------------------------
184
185 AC_HEADER_STDC
186 AC_HEADER_SYS_WAIT
187 AC_HEADER_TIME
188
189 AC_CHECK_HEADERS(inttypes.h)
190 if test "${ac_cv_header_inttypes_h}" = "yes" ; then
191   HAVE_INTTYPES_H=1
192 else
193   HAVE_INTTYPES_H=0
194 fi
195 AC_SUBST(HAVE_INTTYPES_H)
196
197 AC_CHECK_HEADERS(limits.h sys/param.h)
198 AC_CHECK_HEADERS(string.h ctype.h)
199 AC_CHECK_HEADERS(errno.h float.h math.h ieeefp.h)
200 AC_CHECK_HEADERS(sys/time.h waitflags.h sys/wait.h)
201 AC_CHECK_HEADERS(malloc.h memory.h)
202 AC_CHECK_HEADERS(setjmp.h)
203
204 if test "${blt_enable_jpeg}" != "no" ; then
205   jpeg_save_CPPFLAGS=${CPPFLAGS}
206   CPPFLAGS=""
207   if test "${blt_enable_jpeg}" != "yes" ; then
208     CPPFLAGS="-I${blt_enable_jpeg}/include"
209   fi
210   AC_CHECK_HEADERS(jpeglib.h, [JPEG_INC_SPEC="${CPPFLAGS}"], [JPEG_INC_SPEC=""])
211   CPPFLAGS=${jpeg_save_CPPFLAGS}
212 fi
213
214 # Run this check after jpeglib.h because jpeglib.h sets HAVE_STDLIB_H
215 AC_CHECK_HEADERS(stdlib.h unistd.h)
216
217 # -----------------------------------------------------------------------
218 #
219 # Types:        Check for existence of types of size_t and pid_t
220 #
221 # -----------------------------------------------------------------------
222 AC_TYPE_SIZE_T
223 AC_TYPE_PID_T
224
225 AC_MSG_CHECKING([whether union wait is defined correctly])
226 AC_CACHE_VAL(blt_cv_struct_wait_works,
227     AC_TRY_COMPILE([#include <sys/types.h> 
228 #include <sys/wait.h>], [
229     /* 
230      *  Check whether <sys/wait.h> defines the type "union wait" 
231      *  correctly.  It's needed because of weirdness in HP-UX where 
232      *  "union wait" is defined in both the BSD and SYS-V  environments.  
233      *  Checking the usability of WIFEXITED seems to do the trick.
234      */
235     union wait x;
236     WIFEXITED(x);       /* Generates compiler error if WIFEXITED
237                          * uses an int. */
238 ], 
239         [blt_cv_struct_wait_works="yes"], 
240         [blt_cv_struct_wait_works="no"]))
241
242 if test "${blt_cv_struct_wait_works}" = "yes"; then
243     AC_DEFINE(HAVE_UNION_WAIT)
244 fi
245 AC_MSG_RESULT([$blt_cv_struct_wait_works])
246
247 # -----------------------------------------------------------------------
248 #
249 # Compiler characteristics:     
250 #               Check for existence of types of size_t and pid_t
251 #
252 # -----------------------------------------------------------------------
253
254 AC_C_BIGENDIAN
255 AC_CHECK_SIZEOF(int)
256 AC_CHECK_SIZEOF(long)
257 AC_CHECK_SIZEOF(long long)
258 AC_CHECK_SIZEOF(void *)
259
260 SIZEOF_LONG="${ac_cv_sizeof_long}"
261 SIZEOF_LONG_LONG="${ac_cv_sizeof_long_long}"
262 SIZEOF_VOID_P="${ac_cv_sizeof_void_p}"
263 SIZEOF_INT="${ac_cv_sizeof_int}"
264 AC_SUBST(SIZEOF_INT)
265 AC_SUBST(SIZEOF_LONG)
266 AC_SUBST(SIZEOF_LONG_LONG)
267 AC_SUBST(SIZEOF_VOID_P)
268
269 # -----------------------------------------------------------------------
270 #
271 # Library Functions:    Check for  strdup, drand48, and srand48.
272 #
273 # -----------------------------------------------------------------------
274
275 AC_HAVE_FUNCS(strdup strcasecmp strncasecmp drand48 srand48 finite)
276
277 # For HPUX it's a little more complicated to search for isfinite
278 AC_MSG_CHECKING([for isfinite])
279 AC_CACHE_VAL(blt_cv_have_isfinite,
280     AC_TRY_LINK([#include <math.h>], [
281 double x = 1.0;
282 if (isfinite(x)) {
283    return 0;
284 }
285 ], [blt_cv_have_isfinite="yes"], [blt_cv_have_isfinite="no"]))
286
287 if test "${blt_cv_have_isfinite}" = "yes"; then
288     AC_DEFINE(HAVE_ISFINITE)
289 fi
290 AC_MSG_RESULT([$blt_cv_have_isfinite])
291
292 # -----------------------------------------------------------------------
293 #
294 #       Check the smallest value such that 1.0 + x != 1.0.
295 #       For ANSI compilers this is DBL_EPSILON in float.h
296 #
297 #--------------------------------------------------------------------
298
299 AC_MSG_CHECKING([whether DBL_EPSILON is defined in float.h])
300 AC_CACHE_VAL(blt_cv_found_dbl_epsilon,
301     AC_EGREP_CPP(yes,   
302    [
303 #ifdef HAVE_FLOAT_H
304 #include <float.h>
305 #endif
306 #ifdef DBL_EPSILON
307  yes
308 #endif
309 ], blt_cv_found_dbl_epsilon=yes, blt_cv_found_dbl_epsilon=no) 
310 )
311 AC_MSG_RESULT([${blt_cv_found_dbl_epsilon}])
312
313 if test "${blt_cv_found_dbl_epsilon}" = "no" ; then
314   AC_CACHE_VAL(blt_cv_dbl_epsilon, 
315   old_flags="$CFLAGS"
316   CFLAGS="-g -lm"
317   AC_MSG_CHECKING([whether DBL_EPSILON can be computed])
318   AC_TRY_RUN_WITH_OUTPUT(blt_cv_dbl_epsilon, [
319 main () {
320     double e, u;
321     /* 
322      *  Check the smallest value such that 1.0 + x != 1.0.
323      *  For ANSI compilers this is DBL_EPSILON in float.h
324      */
325     u = 1.0;
326     for(;;) {
327        u *= 0.5;
328        if ((1.0 + u) == 1.0) {
329            break;
330        }
331     }
332     e = u * 2.0;
333     printf("%.17e\n", e);
334     exit(0);
335 }])
336     CFLAGS="$old_flags"
337     AC_DEFINE_UNQUOTED(BLT_DBL_EPSILON, ${blt_cv_dbl_epsilon})
338     AC_MSG_RESULT([${blt_cv_dbl_epsilon}])
339 )
340 fi
341
342
343 AC_MSG_CHECKING([whether declaration is needed for strdup])
344 AC_CACHE_VAL(blt_cv_nedd_decl_strdup, 
345     AC_EGREP_CPP(strdup, [
346 #ifdef HAVE_STDLIB_H
347 #include <stdlib.h>
348 #endif
349 #ifdef HAVE_STRING_H
350 #include <string.h>
351 #endif
352 #ifdef HAVE_UNISTD_H
353 #include <unistd.h>
354 #endif /* HAVE_UNISTD_H */
355 ],      [blt_cv_need_decl_strdup=no], [blt_cv_need_decl_strdup=yes]))
356
357 if test "${blt_cv_need_decl_strdup}" = "yes"; then
358     AC_DEFINE(NEED_DECL_STRDUP)
359 fi
360 AC_MSG_RESULT([$blt_cv_need_decl_strdup])
361
362 AC_MSG_CHECKING([whether declaration is needed for drand48])
363 AC_CACHE_VAL(blt_cv_need_decl_drand48, 
364     AC_EGREP_CPP(drand48, [
365 #ifdef HAVE_STDLIB_H
366 #include <stdlib.h>
367 #endif
368 #ifdef HAVE_MATH_H
369 #include <math.h>
370 #endif
371 #ifdef HAVE_UNISTD_H
372 #include <unistd.h>
373 #endif /* HAVE_UNISTD_H */
374 ],      [blt_cv_need_decl_drand48=no], [blt_cv_need_decl_drand48=yes]))
375
376 if test "${blt_cv_need_decl_drand48}" = "yes"; then
377     AC_DEFINE(NEED_DECL_DRAND48)
378 fi
379 AC_MSG_RESULT([$blt_cv_need_decl_drand48])
380
381 AC_MSG_CHECKING([whether declaration is needed for srand48])
382 AC_CACHE_VAL(blt_cv_need_decl_srand48, 
383     AC_EGREP_CPP(srand48, [
384 #ifdef HAVE_STDLIB_H
385 #include <stdlib.h>
386 #endif
387 #ifdef HAVE_MATH_H
388 #include <math.h>
389 #endif
390 #ifdef HAVE_UNISTD_H
391 #include <unistd.h>
392 #endif /* HAVE_UNISTD_H */
393 ],      [blt_cv_need_decl_srand48=no], [blt_cv_need_decl_srand48=yes]))
394
395 if test "${blt_cv_need_decl_srand48}" = "yes"; then
396     AC_DEFINE(NEED_DECL_SRAND48)
397 fi
398 AC_MSG_RESULT([$blt_cv_need_decl_srand48])
399
400 AC_MSG_CHECKING([whether declaration is needed for j1])
401 AC_CACHE_VAL(blt_cv_need_decl_j1, 
402     AC_EGREP_CPP(j1, [
403 #ifdef HAVE_STDLIB_H
404 #include <stdlib.h>
405 #endif
406 #ifdef HAVE_MATH_H
407 #include <math.h>
408 #endif
409 #ifdef HAVE_UNISTD_H
410 #include <unistd.h>
411 #endif /* HAVE_UNISTD_H */
412 ],      [blt_cv_need_decl_j1=no], [blt_cv_need_decl_j1=yes]))
413
414 if test "${blt_cv_need_decl_j1}" = "yes"; then
415     AC_DEFINE(NEED_DECL_J1)
416 fi
417 AC_MSG_RESULT([$blt_cv_need_decl_j1])
418
419 # -----------------------------------------------------------------------
420 #
421 # System services:      X, Tcl, Tk
422 #
423 # -----------------------------------------------------------------------
424 AC_PATH_X
425
426 # -----------------------------------------------------------------------
427 #
428 #       Find the Tcl build configuration file "tclConfig.sh"
429 #
430 # -----------------------------------------------------------------------
431
432 AC_MSG_CHECKING([for tclConfig.sh])
433 tcl_config_sh=""
434 if test "x$blt_with_tcl" != "x" ; then
435   #
436   # Verify that a tclConfig.sh file exists in the directory specified 
437   # by --with-tcl. 
438   #
439   for dir in \
440    $blt_with_tcl 
441   do
442     if test -r "$dir/tclConfig.sh" ; then
443       tcl_config_sh="$dir/tclConfig.sh"
444       break
445     elif test -r "$dir/lib/tclConfig.sh" ; then
446       tcl_config_sh="$dir/lib/tclConfig.sh"
447       break
448     elif test -r "$dir/unix/tclConfig.sh" ; then
449       tcl_config_sh="$dir/unix/tclConfig.sh"
450       break
451     fi
452   done
453 else 
454   #
455   # Otherwise, search for Tcl configuration file.  
456   #
457
458
459   #  1. Search previously named locations.
460
461   for dir in \
462    $prefix \
463    $exec_prefix \
464    $blt_cv_tcl_lib 
465   do
466     if test -r "$dir/tclConfig.sh" ; then
467       tcl_config_sh="$dir/tclConfig.sh"
468       break
469     elif test -r "$dir/lib/tclConfig.sh" ; then
470       tcl_config_sh="$dir/lib/tclConfig.sh"
471       break
472     elif test -r "$dir/unix/tclConfig.sh" ; then
473       tcl_config_sh="$dir/unix/tclConfig.sh"
474       break
475     fi
476   done
477
478   #  2. Search source directories.
479
480   if test "x$tcl_config_sh" = "x" ; then
481     for dir in \
482      `ls -dr ../tcl[[7-9]].[[0-9]]* 2>/dev/null` \
483      ../tcl \
484      `ls -dr ../../tcl[[7-9]].[[0-9]]* 2>/dev/null` \
485      ../../tcl \
486      `ls -dr ../../../tcl[[7-9]].[[0-9]]* 2>/dev/null` \
487      ../../../tcl 
488     do
489       if test -r "$dir/unix/tclConfig.sh" ; then
490         tcl_config_sh="$dir/unix/tclConfig.sh"
491         break
492       fi
493     done
494   fi
495
496   #  3. Search standard locations.
497
498   if test "x$tcl_config_sh" = "x" ; then
499     for dir in \
500      `ls -dr /usr/local/tcl/tcl[[7-9]].[[0-9]]* 2>/dev/null` \
501      /usr/local/tcl \
502      /usr/local \
503      /usr
504     do
505       if test -r "$dir/tclConfig.sh" ; then
506         tcl_config_sh="$dir/tclConfig.sh"
507         break
508       elif test -r "$dir/lib/tclConfig.sh" ; then
509         tcl_config_sh="$dir/lib/tclConfig.sh"
510         break
511       fi
512     done
513   fi
514 fi
515
516 AC_MSG_RESULT([${tcl_config_sh}])
517
518 if test "x$tcl_config_sh" = "x" ; then
519   echo "can't find Tcl configuration script \"tclConfig.sh\""
520   exit 1
521 fi
522
523 # -----------------------------------------------------------------------
524 #
525 #       Find the Tk build configuration file "tkConfig.sh"
526 #
527 # -----------------------------------------------------------------------
528
529 AC_MSG_CHECKING([for tkConfig.sh])
530 tk_config_sh=""
531 if test "x$blt_with_tk" != "x" -o "x$blt_with_tcl" != "x"; then
532   #
533   # Verify that a tkConfig.sh file exists in the directory specified 
534   # by --with-tcl or --with-tk. 
535   #
536   for dir in \
537    $blt_with_tk \
538    $blt_with_tcl 
539   do
540     if test -r "$dir/tkConfig.sh" ; then
541       tk_config_sh="$dir/tkConfig.sh"
542       break
543     elif test -r "$dir/lib/tkConfig.sh" ; then
544       tk_config_sh="$dir/lib/tkConfig.sh"
545       break
546     elif test -r "$dir/unix/tkConfig.sh" ; then
547       tk_config_sh="$dir/unix/tkConfig.sh"
548       break
549     fi
550   done
551 else 
552   #
553   # Search for Tk configuration file.  
554   #
555
556   #
557   #  1. Search previously named locations.
558   # 
559   for dir in \
560    $prefix \
561    $exec_prefix \
562    $blt_cv_tk_lib \
563    $blt_cv_tcl_lib 
564   do
565     if test -r "$dir/tkConfig.sh" ; then
566       tk_config_sh="$dir/tkConfig.sh"
567       break
568     elif test -r "$dir/lib/tkConfig.sh" ; then
569       tk_config_sh="$dir/lib/tkConfig.sh"
570       break
571     elif test -r "$dir/unix/tkConfig.sh" ; then
572       tk_config_sh="$dir/unix/tkConfig.sh"
573       break
574     fi
575   done
576   #
577   #  2. Search source directories.
578   # 
579   if test "x$tk_config_sh" = "x" ; then
580     for dir in \
581      ../tcl \
582      `ls -dr ../tk[[4-9]].[[0-9]]* 2>/dev/null` \
583      ../../tcl \
584      `ls -dr ../../tk[[4-9]].[[0-9]]* 2>/dev/null` \
585      ../../../tcl \
586      `ls -dr ../../../tk[[4-9]].[[0-9]]* 2>/dev/null`
587     do
588       if test -r "$dir/unix/tkConfig.sh"; then
589         tk_config_sh="$dir/unix/tkConfig.sh"
590         break
591       fi
592     done
593   fi
594   #
595   #  3. Search standard locations.
596   # 
597   if test "x$tk_config_sh" = "x" ; then
598     for dir in \
599      `ls -dr /usr/local/tcl/tcl[[7-9]].[[0-9]]* 2>/dev/null` \
600      /usr/local/tcl \
601      /usr/local \
602      ${x_libraries} \
603      /usr
604     do
605       if test -r "$dir/tkConfig.sh" ; then
606         tk_config_sh="$dir/tkConfig.sh"
607         break
608       elif test -r "$dir/lib/tkConfig.sh" ; then
609         tk_config_sh="$dir/lib/tkConfig.sh"
610         break
611       fi
612     done
613   fi
614 fi
615 AC_MSG_RESULT([${tk_config_sh}])
616
617 if test "x$tk_config_sh" = "x" ; then
618   echo "can't find Tk configuration script \"tkConfig.sh\""
619   exit 1
620 fi
621
622 # -----------------------------------------------------------------------
623 #
624 #       Source in the Tcl/Tk configuration scripts.  
625 #
626 # -----------------------------------------------------------------------
627
628 . $tcl_config_sh
629 . $tk_config_sh
630
631 TCL_INC_DIR=""
632 TK_INC_DIR=""
633
634 if test "x${blt_with_tcl_includes}" != "x" ; then
635   if test -r "${blt_with_tcl_includes}/tcl.h" ; then
636     TCL_INC_DIR=${blt_with_tcl_includes}
637   else
638     echo "Can't find tcl.h in \"${blt_with_tcl_includes}\""
639     exit 1
640   fi
641 else
642   for dir in \
643    ${TCL_PREFIX}/include/tcl${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION} \
644    ${TCL_PREFIX}/include \
645    ${TCL_SRC_DIR}/generic 
646   do
647     if test -r "$dir/tcl.h" ; then
648       TCL_INC_DIR=$dir
649       break
650     fi
651   done
652   if test "x${TCL_INC_DIR}" = "x" ; then
653     echo "Can't find tcl.h header file"
654     exit 1
655   fi
656 fi
657
658 if test "x${blt_with_tk_includes}" != "x" ; then
659   if test -r "${blt_with_tk_includes}/tk.h" ; then
660     TK_INC_DIR=${blt_with_tk_includes}
661   else
662     echo "Can't find tk.h in \"${blt_with_tk_includes}\""
663     exit 1
664   fi
665 else
666   for dir in \
667    ${TK_PREFIX}/include/tk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION} \
668    ${TK_PREFIX}/include \
669    ${TK_SRC_DIR}/generic \
670    ${TCL_INC_DIR}
671   do
672     if test -r "$dir/tk.h" ; then
673       TK_INC_DIR=$dir
674       break
675     fi
676   done
677   if test "x${TK_INC_DIR}" = "x" ; then
678     echo "Can't find tk.h header file"
679     exit 1
680   fi
681 fi
682
683 case $target in
684   *-sunos4*|*-*-netbsd|NetBSD-*|FreeBSD-*|OpenBSD-*)
685     TCL_LIB_NAME="tcl${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}"
686     TK_LIB_NAME="tk${TK_MAJOR_VERSION}${TK_MINOR_VERSION}"
687     ;;
688   *)
689     TCL_LIB_NAME="tcl${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}"
690     TK_LIB_NAME="tk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}"
691     ;;
692 esac
693
694 TCL_LIB_SPEC="-l${TCL_LIB_NAME}"
695 TK_LIB_SPEC="-l${TK_LIB_NAME}"
696
697 case $target in
698   *-hpux*)
699     SHLIB_SUFFIX="sl"
700     ;;
701   *)
702     SHLIB_SUFFIX="so"
703     ;;
704 esac
705
706 TCL_LIB_DIR="${TCL_SRC_DIR}/unix"
707 TK_LIB_DIR="${TK_SRC_DIR}/unix"
708
709 if test "x${blt_with_tcl_libraries}" != "x" ; then
710   for libname in \
711    "${blt_with_tcl_libraries}/lib${TCL_LIB_NAME}.${SHLIB_SUFFIX}" \
712    "${blt_with_tcl_libraries}/lib${TCL_LIB_NAME}.a"
713   do
714     if test -r "$libname" ; then
715       TCL_LIB_DIR="${blt_with_tcl_libraries}"
716       break
717     fi
718   done
719   if test "x${TCL_LIB_DIR}" = "x" ; then
720     echo "Can't find tcl library in \"${blt_with_tcl_libraries}\""
721     exit 1
722   fi
723 else
724   for libname in \
725    "${TCL_EXEC_PREFIX}/lib/lib${TCL_LIB_NAME}.${SHLIB_SUFFIX}" \
726    "${TCL_EXEC_PREFIX}/lib/lib${TCL_LIB_NAME}.a" 
727   do
728     if test -r "$libname" ; then
729       TCL_LIB_DIR="${TCL_EXEC_PREFIX}/lib"
730       break
731     fi
732   done
733   if test "x${TCL_LIB_DIR}" = "x" ; then
734     echo "Can't find tcl library"
735     exit 1
736   fi
737 fi
738
739 if test "x${blt_with_tk_libraries}" != "x" ; then
740   for libname in \
741    "${blt_with_tk_libraries}/lib${TK_LIB_NAME}.${SHLIB_SUFFIX}" \
742    "${blt_with_tk_libraries}/lib${TK_LIB_NAME}.a"
743   do
744     if test -r "$libname" ; then
745       TK_LIB_DIR="${blt_with_tk_libraries}"
746       break
747     fi
748   done
749   if test "x${TK_LIB_DIR}" = "x" ; then
750     echo "Can't find tk library in \"${blt_with_tk_libraries}\""
751     exit 1
752   fi
753 else
754   for libname in \
755    "${TK_EXEC_PREFIX}/lib/lib${TK_LIB_NAME}.${SHLIB_SUFFIX}" \
756    "${TK_EXEC_PREFIX}/lib/lib${TK_LIB_NAME}.a"
757   do
758     if test -r "$libname" ; then
759       TK_LIB_DIR="${TK_EXEC_PREFIX}/lib"
760       break
761     fi
762   done
763   if test "x${TK_LIB_DIR}" = "x" ; then
764     echo "Can't find tk library"
765     exit 1
766   fi
767 fi
768
769 # -----------------------------------------------------------------------
770 #
771 # Include files
772 #
773 #       Append to INC_SPECS the various include files specifications
774 #       (built fromt the include directory information).
775 #
776 # -----------------------------------------------------------------------
777
778 # JPEG include files
779 if test "${blt_enable_jpeg}" != "no" ; then
780   if test "x${JPEG_INC_SPEC}" != "x" ; then
781     INC_SPECS="${INC_SPECS} ${JPEG_INC_SPEC}"
782   fi
783 fi
784
785 # X11 include files
786 if test "x${x_includes}" != "x" -a \
787         "${x_includes}" != "NONE" -a \
788         "${x_includes}" != "/usr/include" -a \
789         "${x_includes}" != "${TK_INC_DIR}" -a \
790         "${x_includes}" != "${TCL_INC_DIR}" ; then
791   INC_SPECS="${INC_SPECS} -I${x_includes}"
792 fi
793
794 # Tk include files
795 if test "${TK_INC_DIR}" != "/usr/include" ; then
796   INC_SPECS="${INC_SPECS} -I${TK_INC_DIR}"
797 fi
798
799 # Tcl include files
800 #
801 #       Add the include directory specification only if the Tcl
802 #       headers reside in a different directory from Tk's.  
803 if test "${TCL_INC_DIR}" != "/usr/include" -a \
804         "${TCL_INC_DIR}" != "${TK_INC_DIR}" ; then
805   INC_SPECS="${INC_SPECS} -I${TCL_INC_DIR}"
806 fi
807
808 # -----------------------------------------------------------------------
809 #
810 # Libraries
811 #
812 #       Append to LIB the various library specifications 
813 #       (built from the library directory information).
814 #
815 # -----------------------------------------------------------------------
816
817 # Tk libraries
818 if test "${TK_LIB_DIR}" = "/usr/lib" ; then
819   LIB_SPECS="${LIB_SPECS} ${TK_LIB_SPEC}"
820 else
821   LIB_SPECS="${LIB_SPECS} -L${TK_LIB_DIR} ${TK_LIB_SPEC}"
822   if test "x${loader_run_path}" = "x" ; then
823     loader_run_path="${TK_LIB_DIR}"
824   else
825     loader_run_path="${TK_LIB_DIR}:${loader_run_path}"
826   fi
827 fi
828
829 # Tcl libraries
830 if test "${TCL_LIB_DIR}" = "/usr/lib" -o \
831         "${TCL_LIB_DIR}" = "${TK_LIB_DIR}" ; then
832   LIB_SPECS="${LIB_SPECS} ${TCL_LIB_SPEC}"
833 else
834   LIB_SPECS="${LIB_SPECS} -L${TCL_LIB_DIR} ${TCL_LIB_SPEC}"
835   if test "x${loader_run_path}" = "x" ; then
836     loader_run_path="${TCL_LIB_DIR}"
837   else
838     loader_run_path="${TCL_LIB_DIR}:${loader_run_path}"
839   fi
840 fi
841
842 if test "${TCL_LIB_DIR}" = "/usr/lib" ; then
843   TCL_ONLY_LIB_SPECS="${TCL_LIB_SPEC}"
844 else
845   TCL_ONLY_LIB_SPECS="-L${TCL_LIB_DIR} ${TCL_LIB_SPEC}"
846 fi
847
848
849 # Collect the libraries for AIX that aren't using stubs.
850 aix_lib_specs=""
851
852 # X11 library
853 if test "x${x_libraries}" = "x"  -o \
854  "x${x_libraries}" = "NONE"  -o \
855  "${x_libraries}" = "/usr/lib" -o  \
856  "${x_libraries}" = "${TK_LIB_DIR}"  -o \
857  "${x_libraries}" = "${TCL_LIB_DIR}" ; then
858   LIB_SPECS="${LIB_SPECS} -lX11"
859   aix_lib_specs="${aix_lib_specs} -lX11"
860 else 
861   LIB_SPECS="${LIB_SPECS} -L${x_libraries} -lX11"
862   aix_lib_specs="${aix_lib_specs} -L${x_libraries} -lX11"
863   if test "x${loader_run_path}" = "x" ; then
864     loader_run_path="${x_libraries}"
865   else
866     loader_run_path="${loader_run_path}:${x_libraries}"
867   fi
868 fi
869
870 # JPEG library
871 if test "${blt_enable_jpeg}" != "no" ; then
872   jpeg_save_LDFlags="${LDFLAGS}"
873   JPEG_LIB_SPEC="-ljpeg"
874   JPEG_LIB_DIR=""
875   if test "${blt_enable_jpeg}" != "yes" ; then
876     JPEG_LIB_DIR="${blt_enable_jpeg}/lib"
877     JPEG_LIB_SPEC="-L${JPEG_LIB_DIR} ${JPEG_LIB_SPEC}"
878     LDFLAGS="-L${JPEG_LIB_DIR} ${LDFLAGS}"
879   fi
880   AC_CHECK_LIB(jpeg, jpeg_read_header, [found=yes], [found=no], )
881   if test "${found}" = "yes" ; then
882     LIB_SPECS="${LIB_SPECS} ${JPEG_LIB_SPEC}"
883     aix_lib_specs="${aix_lib_specs} ${JPEG_LIB_SPEC}"
884     if test "x${JPEG_LIB_DIR}" != "x" ; then
885       loader_run_path="${loader_run_path}:${JPEG_LIB_DIR}"
886     fi
887   fi
888   LDFLAGS=${jpeg_save_LDFlags}
889 fi
890
891 save_libs=$LIBS
892 LIBS="$LIB_SPECS $LIBS"
893 AC_CHECK_FUNCS(XExtendedMaxRequestSize)
894 LIBS=$save_libs
895
896 # -----------------------------------------------------------------------
897 #
898 #       Set up a new default prefix to installation path.  The ways
899 #       the prefix can be set and their precedence are as follows:
900 #
901 #       1. --prefix option given to ./configure. (prefix != NONE)
902 #       2. use previously configured Tk prefix
903 #
904 # -----------------------------------------------------------------------
905
906 if test "$prefix" = "NONE" ; then
907   prefix=${TCL_PREFIX}
908 fi
909
910 if test "$exec_prefix" = "NONE" ; then
911   exec_prefix=${TCL_EXEC_PREFIX}
912 fi
913
914 # -------------------------------------------------------------------------
915 #
916 #       Extract the BLT version number for the blt.h header
917 #
918 # -------------------------------------------------------------------------
919 AC_MSG_CHECKING([BLT_MAJOR_VERSION])
920 AC_CACHE_VAL(blt_cv_major_version, 
921 AC_GREP_SYMBOL(blt_cv_major_version, BLT_MAJOR_VERSION, ${srcdir}/src/blt.h)
922 )
923 BLT_MAJOR_VERSION=${blt_cv_major_version}
924 AC_MSG_RESULT([$blt_cv_major_version])
925
926 AC_MSG_CHECKING([BLT_MINOR_VERSION])
927 AC_CACHE_VAL(blt_cv_minor_version, 
928 AC_GREP_SYMBOL(blt_cv_minor_version, BLT_MINOR_VERSION, ${srcdir}/src/blt.h)
929 )
930 AC_MSG_RESULT([$blt_cv_minor_version])
931 BLT_MINOR_VERSION=${blt_cv_minor_version}
932
933 BLT_VERSION=${BLT_MAJOR_VERSION}.${BLT_MINOR_VERSION}
934
935 # Add BLT to the run path
936 libdir=${exec_prefix}/lib
937
938 if test "x${libdir}" != "x"  -a \
939         "${libdir}" != "/usr/lib" -a  \
940         "${libdir}" != "${x_libraries}" -a  \
941         "${libdir}" != "${TK_LIB_DIR}"  -a \
942         "${libdir}" != "${TCL_LIB_DIR}" ; then
943   if test "x${loader_run_path}" = "x" ; then
944     loader_run_path="${libdir}"
945   else
946     loader_run_path="${libdir}:${loader_run_path}"
947   fi
948 fi
949
950 aix_lib_specs="${aix_lib_specs} ${LIBS}"
951 LIB_SPECS="${LIB_SPECS} ${LIBS}"
952 TCL_ONLY_LIB_SPECS="${TCL_ONLY_LIB_SPECS} ${LIBS}"
953
954 # -------------------------------------------------------------------------
955 #
956 #       Extract the Tcl version number for the tcl.h header
957 #
958 # -------------------------------------------------------------------------
959 AC_MSG_CHECKING([TCL_VERSION in tcl.h])
960 AC_CACHE_VAL(blt_cv_tcl_h_version, 
961 AC_GREP_SYMBOL(blt_cv_tcl_h_version, [TCL_VERSION], ${TCL_INC_DIR}/tcl.h)
962 )
963 eval TCL_H_VERSION=${blt_cv_tcl_h_version}
964 AC_MSG_RESULT([$TCL_H_VERSION])
965 if test "${TCL_H_VERSION}" != "${TCL_VERSION}" ; then
966   echo "Error: Tcl version mismatch. "
967   echo "        ${TCL_VERSION} ${tcl_config_sh}"
968   echo "        ${TCL_H_VERSION} ${TCL_INC_DIR}/tcl.h"
969   exit 1
970 fi
971 AC_MSG_CHECKING([TK_VERSION in tk.h])
972 AC_CACHE_VAL(blt_cv_tk_h_version, 
973 AC_GREP_SYMBOL(blt_cv_tk_h_version, [TK_VERSION], ${TK_INC_DIR}/tk.h)
974 )
975 eval TK_H_VERSION=${blt_cv_tk_h_version}
976 AC_MSG_RESULT([$TK_H_VERSION])
977 if test "${TK_H_VERSION}" != "${TK_VERSION}" ; then
978   echo "Error: Tk version mismatch."
979   echo "        ${TK_VERSION} ${tk_config_sh}"
980   echo "        ${TK_H_VERSION} ${TK_INC_DIR}/tk.h"
981   exit 1
982 fi
983
984 if test "$TCL_VERSION" = "7.6" -a "$TK_VERSION" = "4.2" ; then
985   :
986 elif test "$TCL_VERSION" = "7.5" -a "$TK_VERSION" = "4.1" ; then
987   :
988 elif test "$TCL_VERSION" = "$TK_VERSION" ; then
989   :
990 else
991   echo "Mismatched Tcl/Tk versions ($TCL_VERSION != $TK_VERSION)"
992   exit 1
993 fi
994
995 #--------------------------------------------------------------------
996 #
997 # Check if we can generate shared libraries on this system.  Set flags 
998 # to generate shared libraries for systems that we know about.  Start 
999 # with the values found in tclConfig.sh, make changes as we know about 
1000 # the different systems.
1001 #
1002 #--------------------------------------------------------------------
1003
1004 LIB_BASE_NAME=libBLT
1005
1006 # Initialize shared library build variables
1007
1008 SHLIB_CFLAGS="$TCL_SHLIB_CFLAGS"
1009 SHLIB_LD="$TCL_SHLIB_LD"
1010 SHLIB_LD_FLAGS="$TCL_LD_FLAGS"
1011 SHLIB_RUNPATH="$TCL_LD_SEARCH_FLAGS"
1012
1013 SHLIB_SUFFIX=".so"
1014 SHLIB_TARGET=""
1015 SHLIB_CFLAGS=""
1016 SHLIB_LIB_SPECS="${JPEG_LIB_SPEC}"
1017 SHLIB_TCL_ONLY_LIB_SPECS="${TCL_ONLY_LIB_SPECS}"
1018 SHLIB_TCL_ONLY_LIB_SPECS=""
1019 LDFLAGS=""
1020 LD_RUN_PATH=""
1021 EXTRA_LIB_SPECS=""
1022
1023 build_shared="yes"
1024 library_name=libBLT${BLT_MAJOR_VERSION}${BLT_MINOR_VERSION}
1025
1026 case $target in
1027   *-aix4.[[2-9]]*)
1028     # No Position-Independent flags needed
1029     SHLIB_CFLAGS=""
1030     
1031     # Use the installed export file or the one found in the source directory.
1032
1033     if test -r "${TCL_LIB_DIR}/lib${TCL_LIB_NAME}.exp" ; then
1034       tcl_exp="${TCL_LIB_DIR}/lib${TCL_LIB_NAME}.exp"
1035     else
1036       tcl_exp="${TCL_SRC_DIR}/unix/lib.exp"
1037     fi
1038     if test -r "${TK_LIB_DIR}/lib${TK_LIB_NAME}.exp" ; then
1039       tk_exp="${TK_LIB_DIR}/lib${TK_LIB_NAME}.exp"
1040     else
1041       tk_exp="${TK_SRC_DIR}/unix/lib.exp"
1042     fi
1043     
1044     full_src_path=`cd ${srcdir}; pwd`
1045
1046     # Use shell-script to link shared library
1047     SHLIB_LD="${full_src_path}/cf/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry -bI:${tk_exp} -bI:${tcl_exp}"
1048
1049     SHLIB_LIB_SPECS="${aix_lib_specs} -lc"
1050
1051     LDFLAGS="-L${loader_run_path}"
1052     EXTRA_LIB_SPECS="-ldl"
1053     ;;
1054   
1055   *-aix*)
1056     # No Position-Independent flags needed
1057     SHLIB_CFLAGS=""
1058     
1059     # Use the installed export file or the one found in the source directory.
1060
1061     if test -r "${TCL_LIB_DIR}/lib${TCL_LIB_NAME}.exp" ; then
1062       tcl_exp="${TCL_LIB_DIR}/lib${TCL_LIB_NAME}.exp"
1063     else
1064       tcl_exp="${TCL_SRC_DIR}/unix/lib.exp"
1065     fi
1066     if test -r "${TK_LIB_DIR}/lib${TK_LIB_NAME}.exp" ; then
1067       tk_exp="${TK_LIB_DIR}/lib${TK_LIB_NAME}.exp"
1068     else
1069       tk_exp="${TK_SRC_DIR}/unix/lib.exp"
1070     fi
1071
1072     full_src_path=`cd ${srcdir}/cf; pwd`
1073
1074     # Use shell-script to link shared library
1075
1076     SHLIB_LD="${full_src_path}/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry -bI:${tk_exp} -bI:${tcl_exp}"
1077
1078     SHLIB_LIB_SPECS="${aix_lib_specs} -lc"
1079     
1080     LDFLAGS="-L${loader_run_path}"
1081     EXTRA_LIB_SPECS="-lld"
1082     ;;
1083   
1084   *-bsdi2*|*-bsdi3*)
1085     SHLIB_CFLAGS=""
1086     SHLIB_LD="shlicc"
1087     SHLIB_LD_FLAGS="-r"
1088
1089     EXTRA_LIB_SPECS="-ldl"
1090     ;;
1091
1092   *-bsdi4*)
1093     SHLIB_CFLAGS="-export-dynamic -fPIC"
1094     SHLIB_LD="${CC}"
1095     SHLIB_LD_FLAGS='-shared -Wl,-E -Wl,-soname,$@'
1096     ;;
1097
1098   *-dgux*)
1099     SHLIB_CFLAGS="-K PIC"
1100     SHLIB_LD="cc"
1101     SHLIB_LD_FLAGS="-G"
1102     
1103     EXTRA_LIB_SPECS="-ldl"
1104     ;;
1105   
1106   *-hpux*)
1107     if test "$blt_have_gcc" = "no" ; then
1108       DEFINES="$DEFINES -D_HPUX_SOURCE"
1109     fi
1110     AC_CHECK_LIB(dld, shl_load, [found=yes], [found=no])
1111     if test "${found}" = "yes" ; then
1112       SHLIB_CFLAGS="+z"
1113       SHLIB_LD="ld"
1114       SHLIB_LD_FLAGS="-b -E -n +s +b,${loader_run_path}:."
1115       SHLIB_SUFFIX=".sl"
1116
1117       # The run path is included in both LDFLAGS and SHLIB_LD_FLAGS
1118       # because SHLIB_LD is ld and LD is cc/gcc.
1119
1120       LDFLAGS="-Wl,-E -Wl,+s,+b,${loader_run_path}:."
1121       EXTRA_LIB_SPECS="-ldld"
1122     fi
1123     ;;
1124   
1125   *-irix64-6.5*)
1126     SHLIB_CFLAGS=""
1127     SHLIB_LD="ld"
1128     SHLIB_LD_FLAGS="-32 -shared -rdata_shared"
1129     LD_RUN_PATH="-Wl,-rpath,${loader_run_path}"
1130     ;;
1131
1132   *-irix-[56].*|*-irix64-*)
1133     SHLIB_CFLAGS=""
1134     SHLIB_LD="ld"
1135     SHLIB_LD_FLAGS="-shared -rdata_shared"
1136     LD_RUN_PATH="-Wl,-rpath,${loader_run_path}"
1137     LDFLAGS=""
1138     if test "$blt_have_gcc" = "yes" ; then
1139       SHLIB_CFLAGS="-mabi=n32 $SHLIB_CFLAGS"
1140       SHLIB_LD_FLAGS="-mabi=n32 $SHLIB_LD_FLAGS"
1141       LDFLAGS="-mabi=n32 $LDFLAGS"
1142     else        
1143       CFLAGS="-n32 $CFLAGS"
1144       LDFLAGS="-n32 $LDFLAGS"
1145     fi
1146     ;;
1147     
1148   *-linux*)
1149     SHLIB_CFLAGS="-fPIC"
1150     SHLIB_LD="${CC}"
1151     SHLIB_LD_FLAGS='-rdynamic -shared -Wl,-E -Wl,-soname,$@'
1152     LD_RUN_PATH="-Wl,-rpath,${loader_run_path}"
1153     
1154     LDFLAGS=""
1155     EXTRA_LIB_SPECS="-ldl"
1156     ;;
1157   
1158   *-mp-ras-02*)
1159     SHLIB_CFLAGS="-G -K PIC"
1160     SHLIB_LD="${CC}"
1161     SHLIB_LD_FLAGS=""
1162     ;;
1163
1164   *-mp-ras-*)
1165     SHLIB_CFLAGS="-G -K PIC"
1166     SHLIB_LD="${CC}"
1167     SHLIB_LD_FLAGS="-Wl,-Bexport"
1168     ;;
1169
1170   *-ncr-sysv4-*2*)
1171     SHLIB_CFLAGS="-K PIC"
1172     SHLIB_LD="cc"
1173     SHLIB_LD_FLAGS="-G"
1174
1175     EXTRA_LIB_SPECS="-ldl"
1176     ;;
1177
1178   *-ncr-sysv4*)
1179     SHLIB_CFLAGS="-K PIC"
1180     SHLIB_LD="cc"
1181     SHLIB_LD_FLAGS="-G -Wl,-Bexport"
1182
1183     LDFLAGS="-Wl,-Bexport"
1184     EXTRA_LIB_SPECS="-ldl"
1185     ;;
1186
1187   *-netbsd*|*-freebsd*|*-openbsd*)
1188     # Not available on all versions:  check for include file.
1189     AC_CHECK_HEADER(dlfcn.h, test_ok=yes, test_ok=no)
1190     if test "$test_ok" = yes; then
1191       SHLIB_CFLAGS="-fpic"
1192       SHLIB_LD="ld"
1193       SHLIB_LD_FLAGS="-Bshareable -x"
1194     fi
1195     ;;
1196
1197   *-nextstep*)
1198     SHLIB_CFLAGS=""
1199     SHLIB_LD="cc"
1200     SHLIB_LD_FLAGS="-nostdlib -r"
1201     ;;
1202
1203   *-osf1-1.[012]*)
1204     # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
1205
1206     SHLIB_CFLAGS=""
1207
1208     # Warning: Ugly Makefile Hack 
1209     #   Make package name same as library name
1210
1211     SHLIB_LD='ld -R -export $@:'
1212     ;;
1213
1214   *-osf1-1.*)
1215     # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
1216
1217     SHLIB_CFLAGS="-fpic"
1218     SHLIB_LD="ld -shared"
1219     ;;
1220
1221   *-osf1V*)
1222     # Digital OSF/1
1223
1224     SHLIB_CFLAGS=""
1225     SHLIB_LD='ld'
1226     SHLIB_LD_FLAGS='-shared -expect_unresolved "*"'
1227     LD_RUN_PATH="-Wl,-rpath,${loader_run_path}"
1228     LDFLAGS=""
1229     ;;
1230
1231   *-sco*)
1232     # Note, dlopen is available only on SCO 3.2.5 and greater.  However,
1233     # this test works, since "uname -s" was non-standard in 3.2.4 and
1234     # below.
1235
1236     SHLIB_CFLAGS="-Kpic -belf"
1237     SHLIB_LD="ld"
1238     SHLIB_LD_FLAGS="-G"
1239     LDFLAGS="-belf -Wl,-Bexport"
1240     ;;
1241
1242   *-sni-sysv*)
1243
1244     SHLIB_CFLAGS="-K PIC"
1245     SHLIB_LD="cc"
1246     SHLIB_LD_FLAGS="-G"
1247
1248     EXTRA_LIB_SPECS="-ldl"
1249     ;;
1250
1251   *-sunos4*)
1252
1253     SHLIB_CFLAGS="-PIC"
1254     SHLIB_LD="ld"
1255     SHLIB_LD_FLAGS="-assert pure-text"
1256
1257     EXTRA_LIB_SPECS="-ldl"
1258     ;;
1259
1260   *-solaris2*)
1261
1262     SHLIB_CFLAGS="-KPIC"
1263     if test "${blt_with_gnu_ld}" = "yes" -a "$blt_have_gcc" = "yes" ; then
1264       SHLIB_LD="gcc"
1265       SHLIB_LD_FLAGS='-rdynamic -shared -Wl,-E -Wl,-soname,$@'
1266       LD_RUN_PATH="-Wl,-rpath,${loader_run_path}"
1267     else
1268       SHLIB_LD="/usr/ccs/bin/ld"
1269       SHLIB_LD_FLAGS="-G -z text"
1270       LD_RUN_PATH="-R ${loader_run_path}"
1271     fi
1272     EXTRA_LIB_SPECS="-ldl"
1273   ;;
1274
1275   *-mips-dde-sysv*)
1276
1277     SHLIB_CFLAGS="-KPIC"
1278     SHLIB_LD="cc"
1279     SHLIB_LD_FLAGS="-G"
1280
1281     EXTRA_LIB_SPECS="-ldl"
1282     ;;
1283
1284   *-pc-sysv4* | *-unixware-5*)
1285     SHLIB_CFLAGS="-G -KPIC"
1286     SHLIB_LD="${CC}"
1287     SHLIB_LD_FLAGS=" -Wl,-Bexport"
1288     ;;
1289   
1290   *)
1291     build_shared="no"
1292     ;;
1293
1294 esac
1295
1296 # If we're running gcc, then set SHLIB_CFLAGS flags for compiling
1297 # shared libraries for gcc, instead of those of the vendor's
1298 # compiler.
1299
1300
1301 if test "$blt_have_gcc" = "yes" ; then
1302   SHLIB_CFLAGS="-fPIC"
1303 fi
1304
1305 # We can't back link against static versions of Tcl/Tk. 
1306 # If # ${TCL_SHARED_BUILD} can't be found or isn't "1", assume that
1307 # shared libraies weren't built.
1308
1309 if test "${TCL_SHARED_BUILD}" != "1" ; then
1310   SHLIB_LIB_SPECS=""
1311 fi
1312
1313 if test "${build_shared}" = "yes" ; then
1314   SHLIB_TARGET="build_shared"
1315   AC_SUBST(SHLIB_CFLAGS)
1316   AC_SUBST(SHLIB_TARGET)
1317   AC_SUBST(SHLIB_LD)
1318   AC_SUBST(SHLIB_LD_FLAGS)
1319   AC_SUBST(SHLIB_LIB_SPECS)
1320   AC_SUBST(SHLIB_TCL_ONLY_LIB_SPECS)
1321   AC_SUBST(SHLIB_SUFFIX)
1322 fi
1323
1324 AC_SUBST(LDFLAGS)
1325 AC_SUBST(LD_RUN_PATH)
1326
1327 LIBS=${LIB_SPECS}
1328 AC_SUBST(LIB_SPECS)
1329 AC_SUBST(TCL_ONLY_LIB_SPECS)
1330 AC_SUBST(EXTRA_LIB_SPECS)
1331
1332 INCLUDES=${INC_SPECS}
1333 AC_SUBST(INCLUDES)
1334 AC_SUBST(DEFINES)
1335 AC_SUBST(BLT_MAJOR_VERSION)
1336 AC_SUBST(BLT_MINOR_VERSION)
1337 AC_SUBST(BLT_VERSION)
1338 AC_SUBST(AUX_LIBS)
1339 AC_SUBST(TCL_LIB_DIR)
1340 AC_SUBST(TCL_VERSION)
1341
1342 #--------------------------------------------------------------------
1343 #       Propagate prefix argument as installation directory.
1344 #--------------------------------------------------------------------
1345
1346 BLT_LIBRARY="${prefix}/lib/blt${BLT_VERSION}"
1347 AC_SUBST(BLT_LIBRARY)
1348
1349 #--------------------------------------------------------------------
1350 #       Print out some of the more important settings 
1351 #--------------------------------------------------------------------
1352 echo ""
1353 echo "Configuration results:"
1354 echo ""
1355 echo "  tcl.h      found in  $TCL_INC_DIR"
1356 echo "  tk.h       found in  $TK_INC_DIR"
1357 echo "  X11/Xlib.h found in  $x_includes"
1358 echo "  lib${TCL_LIB_NAME}  found in  $TCL_LIB_DIR"
1359 echo "  lib${TK_LIB_NAME}   found in  $TK_LIB_DIR"
1360 echo "  libX11     found in  $x_libraries"
1361 echo ""
1362 echo "Directories where BLT is to be installed:"
1363 echo ""
1364 echo "  \"\$prefix\" is $prefix"
1365 echo "  \"\$exec_prefix\" is $exec_prefix"
1366 echo ""
1367 echo "  bltwish      to be installed in  $bindir"
1368 echo "  libBLT.a     to be installed in  $libdir"
1369 echo "  scripts      to be installed in  $BLT_LIBRARY"
1370 echo "  manual pages to be installed in  $mandir"
1371 echo ""
1372
1373 #--------------------------------------------------------------------
1374 #
1375 #       Generate the following Makefiles
1376 #
1377 #          ./Makefile
1378 #          ./src/Makefile
1379 #          ./src/shared/Makefile
1380 #          ./man/Makefile
1381 #          ./library/Makefile
1382 #          ./demos/Makefile
1383 #
1384 #--------------------------------------------------------------------
1385 AC_OUTPUT(Makefile src/Makefile src/bltHash.h src/shared/Makefile man/Makefile library/Makefile demos/Makefile)