source: trunk/kitgen/8.x/blt/tclconfig/tcl.m4@ 175

Last change on this file since 175 was 175, checked in by demin, 12 years ago

initial commit

File size: 127.1 KB
Line 
1# tcl.m4 --
2#
3# This file provides a set of autoconf macros to help TEA-enable
4# a Tcl extension.
5#
6# Copyright (c) 1999-2000 Ajuba Solutions.
7# Copyright (c) 2002-2005 ActiveState Corporation.
8#
9# See the file "license.terms" for information on usage and redistribution
10# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11#
12# RCS: @(#) $Id: tcl.m4,v 1.153 2010/11/23 09:46:00 nijtmans Exp $
13
14AC_PREREQ(2.57)
15
16dnl TEA extensions pass us the version of TEA they think they
17dnl are compatible with (must be set in TEA_INIT below)
18dnl TEA_VERSION="3.9"
19
20# Possible values for key variables defined:
21#
22# TEA_WINDOWINGSYSTEM - win32 aqua x11 (mirrors 'tk windowingsystem')
23# TEA_PLATFORM - windows unix
24#
25
26#------------------------------------------------------------------------
27# TEA_PATH_TCLCONFIG --
28#
29# Locate the tclConfig.sh file and perform a sanity check on
30# the Tcl compile flags
31#
32# Arguments:
33# none
34#
35# Results:
36#
37# Adds the following arguments to configure:
38# --with-tcl=...
39#
40# Defines the following vars:
41# TCL_BIN_DIR Full path to the directory containing
42# the tclConfig.sh file
43#------------------------------------------------------------------------
44
45AC_DEFUN([TEA_PATH_TCLCONFIG], [
46 dnl TEA specific: Make sure we are initialized
47 AC_REQUIRE([TEA_INIT])
48 #
49 # Ok, lets find the tcl configuration
50 # First, look for one uninstalled.
51 # the alternative search directory is invoked by --with-tcl
52 #
53
54 if test x"${no_tcl}" = x ; then
55 # we reset no_tcl in case something fails here
56 no_tcl=true
57 AC_ARG_WITH(tcl,
58 AC_HELP_STRING([--with-tcl],
59 [directory containing tcl configuration (tclConfig.sh)]),
60 with_tclconfig="${withval}")
61 AC_MSG_CHECKING([for Tcl configuration])
62 AC_CACHE_VAL(ac_cv_c_tclconfig,[
63
64 # First check to see if --with-tcl was specified.
65 if test x"${with_tclconfig}" != x ; then
66 case "${with_tclconfig}" in
67 */tclConfig.sh )
68 if test -f "${with_tclconfig}"; then
69 AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself])
70 with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`"
71 fi ;;
72 esac
73 if test -f "${with_tclconfig}/tclConfig.sh" ; then
74 ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`"
75 else
76 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
77 fi
78 fi
79
80 # then check for a private Tcl installation
81 if test x"${ac_cv_c_tclconfig}" = x ; then
82 for i in \
83 ../tcl \
84 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
85 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
86 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
87 ../../tcl \
88 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
89 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
90 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
91 ../../../tcl \
92 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
93 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
94 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
95 if test "${TEA_PLATFORM}" = "windows" \
96 -a -f "$i/win/tclConfig.sh" ; then
97 ac_cv_c_tclconfig="`(cd $i/win; pwd)`"
98 break
99 fi
100 if test -f "$i/unix/tclConfig.sh" ; then
101 ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
102 break
103 fi
104 done
105 fi
106
107 # on Darwin, check in Framework installation locations
108 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
109 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
110 `ls -d /Library/Frameworks 2>/dev/null` \
111 `ls -d /Network/Library/Frameworks 2>/dev/null` \
112 `ls -d /System/Library/Frameworks 2>/dev/null` \
113 ; do
114 if test -f "$i/Tcl.framework/tclConfig.sh" ; then
115 ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`"
116 break
117 fi
118 done
119 fi
120
121 # TEA specific: on Windows, check in common installation locations
122 if test "${TEA_PLATFORM}" = "windows" \
123 -a x"${ac_cv_c_tclconfig}" = x ; then
124 for i in `ls -d C:/Tcl/lib 2>/dev/null` \
125 `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
126 ; do
127 if test -f "$i/tclConfig.sh" ; then
128 ac_cv_c_tclconfig="`(cd $i; pwd)`"
129 break
130 fi
131 done
132 fi
133
134 # check in a few common install locations
135 if test x"${ac_cv_c_tclconfig}" = x ; then
136 for i in `ls -d ${libdir} 2>/dev/null` \
137 `ls -d ${exec_prefix}/lib 2>/dev/null` \
138 `ls -d ${prefix}/lib 2>/dev/null` \
139 `ls -d /usr/local/lib 2>/dev/null` \
140 `ls -d /usr/contrib/lib 2>/dev/null` \
141 `ls -d /usr/lib 2>/dev/null` \
142 `ls -d /usr/lib64 2>/dev/null` \
143 ; do
144 if test -f "$i/tclConfig.sh" ; then
145 ac_cv_c_tclconfig="`(cd $i; pwd)`"
146 break
147 fi
148 done
149 fi
150
151 # check in a few other private locations
152 if test x"${ac_cv_c_tclconfig}" = x ; then
153 for i in \
154 ${srcdir}/../tcl \
155 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
156 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
157 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
158 if test "${TEA_PLATFORM}" = "windows" \
159 -a -f "$i/win/tclConfig.sh" ; then
160 ac_cv_c_tclconfig="`(cd $i/win; pwd)`"
161 break
162 fi
163 if test -f "$i/unix/tclConfig.sh" ; then
164 ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
165 break
166 fi
167 done
168 fi
169 ])
170
171 if test x"${ac_cv_c_tclconfig}" = x ; then
172 TCL_BIN_DIR="# no Tcl configs found"
173 AC_MSG_ERROR([Can't find Tcl configuration definitions])
174 else
175 no_tcl=
176 TCL_BIN_DIR="${ac_cv_c_tclconfig}"
177 AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
178 fi
179 fi
180])
181
182#------------------------------------------------------------------------
183# TEA_PATH_TKCONFIG --
184#
185# Locate the tkConfig.sh file
186#
187# Arguments:
188# none
189#
190# Results:
191#
192# Adds the following arguments to configure:
193# --with-tk=...
194#
195# Defines the following vars:
196# TK_BIN_DIR Full path to the directory containing
197# the tkConfig.sh file
198#------------------------------------------------------------------------
199
200AC_DEFUN([TEA_PATH_TKCONFIG], [
201 #
202 # Ok, lets find the tk configuration
203 # First, look for one uninstalled.
204 # the alternative search directory is invoked by --with-tk
205 #
206
207 if test x"${no_tk}" = x ; then
208 # we reset no_tk in case something fails here
209 no_tk=true
210 AC_ARG_WITH(tk,
211 AC_HELP_STRING([--with-tk],
212 [directory containing tk configuration (tkConfig.sh)]),
213 with_tkconfig="${withval}")
214 AC_MSG_CHECKING([for Tk configuration])
215 AC_CACHE_VAL(ac_cv_c_tkconfig,[
216
217 # First check to see if --with-tkconfig was specified.
218 if test x"${with_tkconfig}" != x ; then
219 case "${with_tkconfig}" in
220 */tkConfig.sh )
221 if test -f "${with_tkconfig}"; then
222 AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself])
223 with_tkconfig="`echo "${with_tkconfig}" | sed 's!/tkConfig\.sh$!!'`"
224 fi ;;
225 esac
226 if test -f "${with_tkconfig}/tkConfig.sh" ; then
227 ac_cv_c_tkconfig="`(cd "${with_tkconfig}"; pwd)`"
228 else
229 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
230 fi
231 fi
232
233 # then check for a private Tk library
234 if test x"${ac_cv_c_tkconfig}" = x ; then
235 for i in \
236 ../tk \
237 `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
238 `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \
239 `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
240 ../../tk \
241 `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
242 `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
243 `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
244 ../../../tk \
245 `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
246 `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
247 `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
248 if test "${TEA_PLATFORM}" = "windows" \
249 -a -f "$i/win/tkConfig.sh" ; then
250 ac_cv_c_tkconfig="`(cd $i/win; pwd)`"
251 break
252 fi
253 if test -f "$i/unix/tkConfig.sh" ; then
254 ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
255 break
256 fi
257 done
258 fi
259
260 # on Darwin, check in Framework installation locations
261 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
262 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
263 `ls -d /Library/Frameworks 2>/dev/null` \
264 `ls -d /Network/Library/Frameworks 2>/dev/null` \
265 `ls -d /System/Library/Frameworks 2>/dev/null` \
266 ; do
267 if test -f "$i/Tk.framework/tkConfig.sh" ; then
268 ac_cv_c_tkconfig="`(cd $i/Tk.framework; pwd)`"
269 break
270 fi
271 done
272 fi
273
274 # check in a few common install locations
275 if test x"${ac_cv_c_tkconfig}" = x ; then
276 for i in `ls -d ${libdir} 2>/dev/null` \
277 `ls -d ${exec_prefix}/lib 2>/dev/null` \
278 `ls -d ${prefix}/lib 2>/dev/null` \
279 `ls -d /usr/local/lib 2>/dev/null` \
280 `ls -d /usr/contrib/lib 2>/dev/null` \
281 `ls -d /usr/lib 2>/dev/null` \
282 `ls -d /usr/lib64 2>/dev/null` \
283 ; do
284 if test -f "$i/tkConfig.sh" ; then
285 ac_cv_c_tkconfig="`(cd $i; pwd)`"
286 break
287 fi
288 done
289 fi
290
291 # TEA specific: on Windows, check in common installation locations
292 if test "${TEA_PLATFORM}" = "windows" \
293 -a x"${ac_cv_c_tkconfig}" = x ; then
294 for i in `ls -d C:/Tcl/lib 2>/dev/null` \
295 `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
296 ; do
297 if test -f "$i/tkConfig.sh" ; then
298 ac_cv_c_tkconfig="`(cd $i; pwd)`"
299 break
300 fi
301 done
302 fi
303
304 # check in a few other private locations
305 if test x"${ac_cv_c_tkconfig}" = x ; then
306 for i in \
307 ${srcdir}/../tk \
308 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
309 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
310 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
311 if test "${TEA_PLATFORM}" = "windows" \
312 -a -f "$i/win/tkConfig.sh" ; then
313 ac_cv_c_tkconfig="`(cd $i/win; pwd)`"
314 break
315 fi
316 if test -f "$i/unix/tkConfig.sh" ; then
317 ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
318 break
319 fi
320 done
321 fi
322 ])
323
324 if test x"${ac_cv_c_tkconfig}" = x ; then
325 TK_BIN_DIR="# no Tk configs found"
326 AC_MSG_ERROR([Can't find Tk configuration definitions])
327 else
328 no_tk=
329 TK_BIN_DIR="${ac_cv_c_tkconfig}"
330 AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
331 fi
332 fi
333])
334
335#------------------------------------------------------------------------
336# TEA_LOAD_TCLCONFIG --
337#
338# Load the tclConfig.sh file
339#
340# Arguments:
341#
342# Requires the following vars to be set:
343# TCL_BIN_DIR
344#
345# Results:
346#
347# Subst the following vars:
348# TCL_BIN_DIR
349# TCL_SRC_DIR
350# TCL_LIB_FILE
351#
352#------------------------------------------------------------------------
353
354AC_DEFUN([TEA_LOAD_TCLCONFIG], [
355 AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
356
357 if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
358 AC_MSG_RESULT([loading])
359 . "${TCL_BIN_DIR}/tclConfig.sh"
360 else
361 AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
362 fi
363
364 # eval is required to do the TCL_DBGX substitution
365 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
366 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
367
368 # If the TCL_BIN_DIR is the build directory (not the install directory),
369 # then set the common variable name to the value of the build variables.
370 # For example, the variable TCL_LIB_SPEC will be set to the value
371 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
372 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
373 # installed and uninstalled version of Tcl.
374 if test -f "${TCL_BIN_DIR}/Makefile" ; then
375 TCL_LIB_SPEC="${TCL_BUILD_LIB_SPEC}"
376 TCL_STUB_LIB_SPEC="${TCL_BUILD_STUB_LIB_SPEC}"
377 TCL_STUB_LIB_PATH="${TCL_BUILD_STUB_LIB_PATH}"
378 elif test "`uname -s`" = "Darwin"; then
379 # If Tcl was built as a framework, attempt to use the libraries
380 # from the framework at the given location so that linking works
381 # against Tcl.framework installed in an arbitrary location.
382 case ${TCL_DEFS} in
383 *TCL_FRAMEWORK*)
384 if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then
385 for i in "`cd "${TCL_BIN_DIR}"; pwd`" \
386 "`cd "${TCL_BIN_DIR}"/../..; pwd`"; do
387 if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
388 TCL_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TCL_LIB_FILE}"
389 break
390 fi
391 done
392 fi
393 if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then
394 TCL_STUB_LIB_SPEC="-L`echo "${TCL_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TCL_STUB_LIB_FLAG}"
395 TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
396 fi
397 ;;
398 esac
399 fi
400
401 # eval is required to do the TCL_DBGX substitution
402 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
403 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
404 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
405 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
406
407 AC_SUBST(TCL_VERSION)
408 AC_SUBST(TCL_PATCH_LEVEL)
409 AC_SUBST(TCL_BIN_DIR)
410 AC_SUBST(TCL_SRC_DIR)
411
412 AC_SUBST(TCL_LIB_FILE)
413 AC_SUBST(TCL_LIB_FLAG)
414 AC_SUBST(TCL_LIB_SPEC)
415
416 AC_SUBST(TCL_STUB_LIB_FILE)
417 AC_SUBST(TCL_STUB_LIB_FLAG)
418 AC_SUBST(TCL_STUB_LIB_SPEC)
419
420 case "`uname -s`" in
421 *CYGWIN_*)
422 AC_MSG_CHECKING([for cygwin variant])
423 case ${TCL_EXTRA_CFLAGS} in
424 *-mwin32*|*-mno-cygwin*)
425 TEA_PLATFORM="windows"
426 CFLAGS="$CFLAGS -mwin32"
427 AC_MSG_RESULT([win32])
428 ;;
429 *)
430 TEA_PLATFORM="unix"
431 AC_MSG_RESULT([unix])
432 ;;
433 esac
434 EXEEXT=".exe"
435 ;;
436 *)
437 ;;
438 esac
439
440 # The BUILD_$pkg is to define the correct extern storage class
441 # handling when making this package
442 AC_DEFINE_UNQUOTED(BUILD_${PACKAGE_NAME}, [],
443 [Building extension source?])
444 # Do this here as we have fully defined TEA_PLATFORM now
445 if test "${TEA_PLATFORM}" = "windows" ; then
446 CLEANFILES="$CLEANFILES *.lib *.dll *.pdb *.exp"
447 fi
448
449 # TEA specific:
450 AC_SUBST(CLEANFILES)
451 AC_SUBST(TCL_LIBS)
452 AC_SUBST(TCL_DEFS)
453 AC_SUBST(TCL_EXTRA_CFLAGS)
454 AC_SUBST(TCL_LD_FLAGS)
455 AC_SUBST(TCL_SHLIB_LD_LIBS)
456])
457
458#------------------------------------------------------------------------
459# TEA_LOAD_TKCONFIG --
460#
461# Load the tkConfig.sh file
462#
463# Arguments:
464#
465# Requires the following vars to be set:
466# TK_BIN_DIR
467#
468# Results:
469#
470# Sets the following vars that should be in tkConfig.sh:
471# TK_BIN_DIR
472#------------------------------------------------------------------------
473
474AC_DEFUN([TEA_LOAD_TKCONFIG], [
475 AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
476
477 if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
478 AC_MSG_RESULT([loading])
479 . "${TK_BIN_DIR}/tkConfig.sh"
480 else
481 AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
482 fi
483
484 # eval is required to do the TK_DBGX substitution
485 eval "TK_LIB_FILE=\"${TK_LIB_FILE}\""
486 eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\""
487
488 # If the TK_BIN_DIR is the build directory (not the install directory),
489 # then set the common variable name to the value of the build variables.
490 # For example, the variable TK_LIB_SPEC will be set to the value
491 # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
492 # instead of TK_BUILD_LIB_SPEC since it will work with both an
493 # installed and uninstalled version of Tcl.
494 if test -f "${TK_BIN_DIR}/Makefile" ; then
495 TK_LIB_SPEC="${TK_BUILD_LIB_SPEC}"
496 TK_STUB_LIB_SPEC="${TK_BUILD_STUB_LIB_SPEC}"
497 TK_STUB_LIB_PATH="${TK_BUILD_STUB_LIB_PATH}"
498 elif test "`uname -s`" = "Darwin"; then
499 # If Tk was built as a framework, attempt to use the libraries
500 # from the framework at the given location so that linking works
501 # against Tk.framework installed in an arbitrary location.
502 case ${TK_DEFS} in
503 *TK_FRAMEWORK*)
504 if test -f "${TK_BIN_DIR}/${TK_LIB_FILE}"; then
505 for i in "`cd "${TK_BIN_DIR}"; pwd`" \
506 "`cd "${TK_BIN_DIR}"/../..; pwd`"; do
507 if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
508 TK_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TK_LIB_FILE}"
509 break
510 fi
511 done
512 fi
513 if test -f "${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"; then
514 TK_STUB_LIB_SPEC="-L` echo "${TK_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}"
515 TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
516 fi
517 ;;
518 esac
519 fi
520
521 # eval is required to do the TK_DBGX substitution
522 eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\""
523 eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\""
524 eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\""
525 eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\""
526
527 # TEA specific: Ensure windowingsystem is defined
528 if test "${TEA_PLATFORM}" = "unix" ; then
529 case ${TK_DEFS} in
530 *MAC_OSX_TK*)
531 AC_DEFINE(MAC_OSX_TK, 1, [Are we building against Mac OS X TkAqua?])
532 TEA_WINDOWINGSYSTEM="aqua"
533 ;;
534 *)
535 TEA_WINDOWINGSYSTEM="x11"
536 ;;
537 esac
538 elif test "${TEA_PLATFORM}" = "windows" ; then
539 TEA_WINDOWINGSYSTEM="win32"
540 fi
541
542 AC_SUBST(TK_VERSION)
543 AC_SUBST(TK_BIN_DIR)
544 AC_SUBST(TK_SRC_DIR)
545
546 AC_SUBST(TK_LIB_FILE)
547 AC_SUBST(TK_LIB_FLAG)
548 AC_SUBST(TK_LIB_SPEC)
549
550 AC_SUBST(TK_STUB_LIB_FILE)
551 AC_SUBST(TK_STUB_LIB_FLAG)
552 AC_SUBST(TK_STUB_LIB_SPEC)
553
554 # TEA specific:
555 AC_SUBST(TK_LIBS)
556 AC_SUBST(TK_XINCLUDES)
557])
558
559#------------------------------------------------------------------------
560# TEA_PROG_TCLSH
561# Determine the fully qualified path name of the tclsh executable
562# in the Tcl build directory or the tclsh installed in a bin
563# directory. This macro will correctly determine the name
564# of the tclsh executable even if tclsh has not yet been
565# built in the build directory. The tclsh found is always
566# associated with a tclConfig.sh file. This tclsh should be used
567# only for running extension test cases. It should never be
568# or generation of files (like pkgIndex.tcl) at build time.
569#
570# Arguments
571# none
572#
573# Results
574# Subst's the following values:
575# TCLSH_PROG
576#------------------------------------------------------------------------
577
578AC_DEFUN([TEA_PROG_TCLSH], [
579 AC_MSG_CHECKING([for tclsh])
580 if test -f "${TCL_BIN_DIR}/Makefile" ; then
581 # tclConfig.sh is in Tcl build directory
582 if test "${TEA_PLATFORM}" = "windows"; then
583 TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
584 else
585 TCLSH_PROG="${TCL_BIN_DIR}/tclsh"
586 fi
587 else
588 # tclConfig.sh is in install location
589 if test "${TEA_PLATFORM}" = "windows"; then
590 TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
591 else
592 TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}${TCL_DBGX}"
593 fi
594 list="`ls -d ${TCL_BIN_DIR}/../bin 2>/dev/null` \
595 `ls -d ${TCL_BIN_DIR}/.. 2>/dev/null` \
596 `ls -d ${TCL_PREFIX}/bin 2>/dev/null`"
597 for i in $list ; do
598 if test -f "$i/${TCLSH_PROG}" ; then
599 REAL_TCL_BIN_DIR="`cd "$i"; pwd`/"
600 break
601 fi
602 done
603 TCLSH_PROG="${REAL_TCL_BIN_DIR}${TCLSH_PROG}"
604 fi
605 AC_MSG_RESULT([${TCLSH_PROG}])
606 AC_SUBST(TCLSH_PROG)
607])
608
609#------------------------------------------------------------------------
610# TEA_PROG_WISH
611# Determine the fully qualified path name of the wish executable
612# in the Tk build directory or the wish installed in a bin
613# directory. This macro will correctly determine the name
614# of the wish executable even if wish has not yet been
615# built in the build directory. The wish found is always
616# associated with a tkConfig.sh file. This wish should be used
617# only for running extension test cases. It should never be
618# or generation of files (like pkgIndex.tcl) at build time.
619#
620# Arguments
621# none
622#
623# Results
624# Subst's the following values:
625# WISH_PROG
626#------------------------------------------------------------------------
627
628AC_DEFUN([TEA_PROG_WISH], [
629 AC_MSG_CHECKING([for wish])
630 if test -f "${TK_BIN_DIR}/Makefile" ; then
631 # tkConfig.sh is in Tk build directory
632 if test "${TEA_PLATFORM}" = "windows"; then
633 WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}"
634 else
635 WISH_PROG="${TK_BIN_DIR}/wish"
636 fi
637 else
638 # tkConfig.sh is in install location
639 if test "${TEA_PLATFORM}" = "windows"; then
640 WISH_PROG="wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}"
641 else
642 WISH_PROG="wish${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_DBGX}"
643 fi
644 list="`ls -d ${TK_BIN_DIR}/../bin 2>/dev/null` \
645 `ls -d ${TK_BIN_DIR}/.. 2>/dev/null` \
646 `ls -d ${TK_PREFIX}/bin 2>/dev/null`"
647 for i in $list ; do
648 if test -f "$i/${WISH_PROG}" ; then
649 REAL_TK_BIN_DIR="`cd "$i"; pwd`/"
650 break
651 fi
652 done
653 WISH_PROG="${REAL_TK_BIN_DIR}${WISH_PROG}"
654 fi
655 AC_MSG_RESULT([${WISH_PROG}])
656 AC_SUBST(WISH_PROG)
657])
658
659#------------------------------------------------------------------------
660# TEA_ENABLE_SHARED --
661#
662# Allows the building of shared libraries
663#
664# Arguments:
665# none
666#
667# Results:
668#
669# Adds the following arguments to configure:
670# --enable-shared=yes|no
671#
672# Defines the following vars:
673# STATIC_BUILD Used for building import/export libraries
674# on Windows.
675#
676# Sets the following vars:
677# SHARED_BUILD Value of 1 or 0
678#------------------------------------------------------------------------
679
680AC_DEFUN([TEA_ENABLE_SHARED], [
681 AC_MSG_CHECKING([how to build libraries])
682 AC_ARG_ENABLE(shared,
683 AC_HELP_STRING([--enable-shared],
684 [build and link with shared libraries (default: on)]),
685 [tcl_ok=$enableval], [tcl_ok=yes])
686
687 if test "${enable_shared+set}" = set; then
688 enableval="$enable_shared"
689 tcl_ok=$enableval
690 else
691 tcl_ok=yes
692 fi
693
694 if test "$tcl_ok" = "yes" ; then
695 AC_MSG_RESULT([shared])
696 SHARED_BUILD=1
697 else
698 AC_MSG_RESULT([static])
699 SHARED_BUILD=0
700 AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?])
701 fi
702 AC_SUBST(SHARED_BUILD)
703])
704
705#------------------------------------------------------------------------
706# TEA_ENABLE_THREADS --
707#
708# Specify if thread support should be enabled. If "yes" is specified
709# as an arg (optional), threads are enabled by default, "no" means
710# threads are disabled. "yes" is the default.
711#
712# TCL_THREADS is checked so that if you are compiling an extension
713# against a threaded core, your extension must be compiled threaded
714# as well.
715#
716# Note that it is legal to have a thread enabled extension run in a
717# threaded or non-threaded Tcl core, but a non-threaded extension may
718# only run in a non-threaded Tcl core.
719#
720# Arguments:
721# none
722#
723# Results:
724#
725# Adds the following arguments to configure:
726# --enable-threads
727#
728# Sets the following vars:
729# THREADS_LIBS Thread library(s)
730#
731# Defines the following vars:
732# TCL_THREADS
733# _REENTRANT
734# _THREAD_SAFE
735#
736#------------------------------------------------------------------------
737
738AC_DEFUN([TEA_ENABLE_THREADS], [
739 AC_ARG_ENABLE(threads,
740 AC_HELP_STRING([--enable-threads],
741 [build with threads]),
742 [tcl_ok=$enableval], [tcl_ok=yes])
743
744 if test "${enable_threads+set}" = set; then
745 enableval="$enable_threads"
746 tcl_ok=$enableval
747 else
748 tcl_ok=yes
749 fi
750
751 if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
752 TCL_THREADS=1
753
754 if test "${TEA_PLATFORM}" != "windows" ; then
755 # We are always OK on Windows, so check what this platform wants:
756
757 # USE_THREAD_ALLOC tells us to try the special thread-based
758 # allocator that significantly reduces lock contention
759 AC_DEFINE(USE_THREAD_ALLOC, 1,
760 [Do we want to use the threaded memory allocator?])
761 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
762 if test "`uname -s`" = "SunOS" ; then
763 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
764 [Do we really want to follow the standard? Yes we do!])
765 fi
766 AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?])
767 AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
768 if test "$tcl_ok" = "no"; then
769 # Check a little harder for __pthread_mutex_init in the same
770 # library, as some systems hide it there until pthread.h is
771 # defined. We could alternatively do an AC_TRY_COMPILE with
772 # pthread.h, but that will work with libpthread really doesn't
773 # exist, like AIX 4.2. [Bug: 4359]
774 AC_CHECK_LIB(pthread, __pthread_mutex_init,
775 tcl_ok=yes, tcl_ok=no)
776 fi
777
778 if test "$tcl_ok" = "yes"; then
779 # The space is needed
780 THREADS_LIBS=" -lpthread"
781 else
782 AC_CHECK_LIB(pthreads, pthread_mutex_init,
783 tcl_ok=yes, tcl_ok=no)
784 if test "$tcl_ok" = "yes"; then
785 # The space is needed
786 THREADS_LIBS=" -lpthreads"
787 else
788 AC_CHECK_LIB(c, pthread_mutex_init,
789 tcl_ok=yes, tcl_ok=no)
790 if test "$tcl_ok" = "no"; then
791 AC_CHECK_LIB(c_r, pthread_mutex_init,
792 tcl_ok=yes, tcl_ok=no)
793 if test "$tcl_ok" = "yes"; then
794 # The space is needed
795 THREADS_LIBS=" -pthread"
796 else
797 TCL_THREADS=0
798 AC_MSG_WARN([Do not know how to find pthread lib on your system - thread support disabled])
799 fi
800 fi
801 fi
802 fi
803 fi
804 else
805 TCL_THREADS=0
806 fi
807 # Do checking message here to not mess up interleaved configure output
808 AC_MSG_CHECKING([for building with threads])
809 if test "${TCL_THREADS}" = 1; then
810 AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
811 AC_MSG_RESULT([yes (default)])
812 else
813 AC_MSG_RESULT([no])
814 fi
815 # TCL_THREADS sanity checking. See if our request for building with
816 # threads is the same as the way Tcl was built. If not, warn the user.
817 case ${TCL_DEFS} in
818 *THREADS=1*)
819 if test "${TCL_THREADS}" = "0"; then
820 AC_MSG_WARN([
821 Building ${PACKAGE_NAME} without threads enabled, but building against Tcl
822 that IS thread-enabled. It is recommended to use --enable-threads.])
823 fi
824 ;;
825 *)
826 if test "${TCL_THREADS}" = "1"; then
827 AC_MSG_WARN([
828 --enable-threads requested, but building against a Tcl that is NOT
829 thread-enabled. This is an OK configuration that will also run in
830 a thread-enabled core.])
831 fi
832 ;;
833 esac
834 AC_SUBST(TCL_THREADS)
835])
836
837#------------------------------------------------------------------------
838# TEA_ENABLE_SYMBOLS --
839#
840# Specify if debugging symbols should be used.
841# Memory (TCL_MEM_DEBUG) debugging can also be enabled.
842#
843# Arguments:
844# none
845#
846# TEA varies from core Tcl in that C|LDFLAGS_DEFAULT receives
847# the value of C|LDFLAGS_OPTIMIZE|DEBUG already substituted.
848# Requires the following vars to be set in the Makefile:
849# CFLAGS_DEFAULT
850# LDFLAGS_DEFAULT
851#
852# Results:
853#
854# Adds the following arguments to configure:
855# --enable-symbols
856#
857# Defines the following vars:
858# CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
859# Sets to $(CFLAGS_OPTIMIZE) if false
860# LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
861# Sets to $(LDFLAGS_OPTIMIZE) if false
862# DBGX Formerly used as debug library extension;
863# always blank now.
864#
865#------------------------------------------------------------------------
866
867AC_DEFUN([TEA_ENABLE_SYMBOLS], [
868 dnl TEA specific: Make sure we are initialized
869 AC_REQUIRE([TEA_CONFIG_CFLAGS])
870 AC_MSG_CHECKING([for build with symbols])
871 AC_ARG_ENABLE(symbols,
872 AC_HELP_STRING([--enable-symbols],
873 [build with debugging symbols (default: off)]),
874 [tcl_ok=$enableval], [tcl_ok=no])
875 DBGX=""
876 if test "$tcl_ok" = "no"; then
877 CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}"
878 LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
879 AC_MSG_RESULT([no])
880 else
881 CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
882 LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
883 if test "$tcl_ok" = "yes"; then
884 AC_MSG_RESULT([yes (standard debugging)])
885 fi
886 fi
887 # TEA specific:
888 if test "${TEA_PLATFORM}" != "windows" ; then
889 LDFLAGS_DEFAULT="${LDFLAGS}"
890 fi
891 AC_SUBST(CFLAGS_DEFAULT)
892 AC_SUBST(LDFLAGS_DEFAULT)
893 AC_SUBST(TCL_DBGX)
894
895 if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
896 AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?])
897 fi
898
899 if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
900 if test "$tcl_ok" = "all"; then
901 AC_MSG_RESULT([enabled symbols mem debugging])
902 else
903 AC_MSG_RESULT([enabled $tcl_ok debugging])
904 fi
905 fi
906])
907
908#------------------------------------------------------------------------
909# TEA_ENABLE_LANGINFO --
910#
911# Allows use of modern nl_langinfo check for better l10n.
912# This is only relevant for Unix.
913#
914# Arguments:
915# none
916#
917# Results:
918#
919# Adds the following arguments to configure:
920# --enable-langinfo=yes|no (default is yes)
921#
922# Defines the following vars:
923# HAVE_LANGINFO Triggers use of nl_langinfo if defined.
924#
925#------------------------------------------------------------------------
926
927AC_DEFUN([TEA_ENABLE_LANGINFO], [
928 AC_ARG_ENABLE(langinfo,
929 AC_HELP_STRING([--enable-langinfo],
930 [use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]),
931 [langinfo_ok=$enableval], [langinfo_ok=yes])
932
933 HAVE_LANGINFO=0
934 if test "$langinfo_ok" = "yes"; then
935 AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
936 fi
937 AC_MSG_CHECKING([whether to use nl_langinfo])
938 if test "$langinfo_ok" = "yes"; then
939 AC_CACHE_VAL(tcl_cv_langinfo_h, [
940 AC_TRY_COMPILE([#include <langinfo.h>], [nl_langinfo(CODESET);],
941 [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])])
942 AC_MSG_RESULT([$tcl_cv_langinfo_h])
943 if test $tcl_cv_langinfo_h = yes; then
944 AC_DEFINE(HAVE_LANGINFO, 1, [Do we have nl_langinfo()?])
945 fi
946 else
947 AC_MSG_RESULT([$langinfo_ok])
948 fi
949])
950
951#--------------------------------------------------------------------
952# TEA_CONFIG_SYSTEM
953#
954# Determine what the system is (some things cannot be easily checked
955# on a feature-driven basis, alas). This can usually be done via the
956# "uname" command.
957#
958# Arguments:
959# none
960#
961# Results:
962# Defines the following var:
963#
964# system - System/platform/version identification code.
965#
966#--------------------------------------------------------------------
967
968AC_DEFUN([TEA_CONFIG_SYSTEM], [
969 AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
970 # TEA specific:
971 if test "${TEA_PLATFORM}" = "windows" ; then
972 tcl_cv_sys_version=windows
973 else
974 tcl_cv_sys_version=`uname -s`-`uname -r`
975 if test "$?" -ne 0 ; then
976 AC_MSG_WARN([can't find uname command])
977 tcl_cv_sys_version=unknown
978 else
979 if test "`uname -s`" = "AIX" ; then
980 tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
981 fi
982 fi
983 fi
984 ])
985 system=$tcl_cv_sys_version
986])
987
988#--------------------------------------------------------------------
989# TEA_CONFIG_CFLAGS
990#
991# Try to determine the proper flags to pass to the compiler
992# for building shared libraries and other such nonsense.
993#
994# Arguments:
995# none
996#
997# Results:
998#
999# Defines and substitutes the following vars:
1000#
1001# DL_OBJS, DL_LIBS - removed for TEA, only needed by core.
1002# LDFLAGS - Flags to pass to the compiler when linking object
1003# files into an executable application binary such
1004# as tclsh.
1005# LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
1006# that tell the run-time dynamic linker where to look
1007# for shared libraries such as libtcl.so. Depends on
1008# the variable LIB_RUNTIME_DIR in the Makefile. Could
1009# be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
1010# CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
1011# that tell the run-time dynamic linker where to look
1012# for shared libraries such as libtcl.so. Depends on
1013# the variable LIB_RUNTIME_DIR in the Makefile.
1014# SHLIB_CFLAGS - Flags to pass to cc when compiling the components
1015# of a shared library (may request position-independent
1016# code, among other things).
1017# SHLIB_LD - Base command to use for combining object files
1018# into a shared library.
1019# SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
1020# creating shared libraries. This symbol typically
1021# goes at the end of the "ld" commands that build
1022# shared libraries. The value of the symbol defaults to
1023# "${LIBS}" if all of the dependent libraries should
1024# be specified when creating a shared library. If
1025# dependent libraries should not be specified (as on
1026# SunOS 4.x, where they cause the link to fail, or in
1027# general if Tcl and Tk aren't themselves shared
1028# libraries), then this symbol has an empty string
1029# as its value.
1030# SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
1031# extensions. An empty string means we don't know how
1032# to use shared libraries on this platform.
1033# LIB_SUFFIX - Specifies everything that comes after the "libfoo"
1034# in a static or shared library name, using the $VERSION variable
1035# to put the version in the right place. This is used
1036# by platforms that need non-standard library names.
1037# Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
1038# to have a version after the .so, and ${VERSION}.a
1039# on AIX, since a shared library needs to have
1040# a .a extension whereas shared objects for loadable
1041# extensions have a .so extension. Defaults to
1042# ${VERSION}${SHLIB_SUFFIX}.
1043# CFLAGS_DEBUG -
1044# Flags used when running the compiler in debug mode
1045# CFLAGS_OPTIMIZE -
1046# Flags used when running the compiler in optimize mode
1047# CFLAGS - Additional CFLAGS added as necessary (usually 64-bit)
1048#
1049#--------------------------------------------------------------------
1050
1051AC_DEFUN([TEA_CONFIG_CFLAGS], [
1052 dnl TEA specific: Make sure we are initialized
1053 AC_REQUIRE([TEA_INIT])
1054
1055 # Step 0.a: Enable 64 bit support?
1056
1057 AC_MSG_CHECKING([if 64bit support is requested])
1058 AC_ARG_ENABLE(64bit,
1059 AC_HELP_STRING([--enable-64bit],
1060 [enable 64bit support (default: off)]),
1061 [do64bit=$enableval], [do64bit=no])
1062 AC_MSG_RESULT([$do64bit])
1063
1064 # Step 0.b: Enable Solaris 64 bit VIS support?
1065
1066 AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
1067 AC_ARG_ENABLE(64bit-vis,
1068 AC_HELP_STRING([--enable-64bit-vis],
1069 [enable 64bit Sparc VIS support (default: off)]),
1070 [do64bitVIS=$enableval], [do64bitVIS=no])
1071 AC_MSG_RESULT([$do64bitVIS])
1072 # Force 64bit on with VIS
1073 AS_IF([test "$do64bitVIS" = "yes"], [do64bit=yes])
1074
1075 # Step 0.c: Check if visibility support is available. Do this here so
1076 # that platform specific alternatives can be used below if this fails.
1077
1078 AC_CACHE_CHECK([if compiler supports visibility "hidden"],
1079 tcl_cv_cc_visibility_hidden, [
1080 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
1081 AC_TRY_LINK([
1082 extern __attribute__((__visibility__("hidden"))) void f(void);
1083 void f(void) {}], [f();], tcl_cv_cc_visibility_hidden=yes,
1084 tcl_cv_cc_visibility_hidden=no)
1085 CFLAGS=$hold_cflags])
1086 AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [
1087 AC_DEFINE(MODULE_SCOPE,
1088 [extern __attribute__((__visibility__("hidden")))],
1089 [Compiler support for module scope symbols])
1090 ])
1091
1092 # Step 0.d: Disable -rpath support?
1093
1094 AC_MSG_CHECKING([if rpath support is requested])
1095 AC_ARG_ENABLE(rpath,
1096 AC_HELP_STRING([--disable-rpath],
1097 [disable rpath support (default: on)]),
1098 [doRpath=$enableval], [doRpath=yes])
1099 AC_MSG_RESULT([$doRpath])
1100
1101 # TEA specific: Cross-compiling options for Windows/CE builds?
1102
1103 AS_IF([test "${TEA_PLATFORM}" = windows], [
1104 AC_MSG_CHECKING([if Windows/CE build is requested])
1105 AC_ARG_ENABLE(wince,
1106 AC_HELP_STRING([--enable-wince],
1107 [enable Win/CE support (where applicable)]),
1108 [doWince=$enableval], [doWince=no])
1109 AC_MSG_RESULT([$doWince])
1110 ])
1111
1112 # Set the variable "system" to hold the name and version number
1113 # for the system.
1114
1115 TEA_CONFIG_SYSTEM
1116
1117 # Require ranlib early so we can override it in special cases below.
1118
1119 AC_REQUIRE([AC_PROG_RANLIB])
1120
1121 # Set configuration options based on system name and version.
1122 # This is similar to Tcl's unix/tcl.m4 except that we've added a
1123 # "windows" case and removed some core-only vars.
1124
1125 do64bit_ok=no
1126 # default to '{$LIBS}' and set to "" on per-platform necessary basis
1127 SHLIB_LD_LIBS='${LIBS}'
1128 # When ld needs options to work in 64-bit mode, put them in
1129 # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
1130 # is disabled by the user. [Bug 1016796]
1131 LDFLAGS_ARCH=""
1132 UNSHARED_LIB_SUFFIX=""
1133 # TEA specific: use PACKAGE_VERSION instead of VERSION
1134 TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`'
1135 ECHO_VERSION='`echo ${PACKAGE_VERSION}`'
1136 TCL_LIB_VERSIONS_OK=ok
1137 CFLAGS_DEBUG=-g
1138 CFLAGS_OPTIMIZE=-O
1139 AS_IF([test "$GCC" = yes], [
1140 # TEA specific:
1141 CFLAGS_OPTIMIZE=-O2
1142 CFLAGS_WARNING="-Wall"
1143 ], [CFLAGS_WARNING=""])
1144 AC_CHECK_TOOL(AR, ar)
1145 STLIB_LD='${AR} cr'
1146 LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
1147 AS_IF([test "x$SHLIB_VERSION" = x],[SHLIB_VERSION="1.0"])
1148 case $system in
1149 # TEA specific:
1150 windows)
1151 # This is a 2-stage check to make sure we have the 64-bit SDK
1152 # We have to know where the SDK is installed.
1153 # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs
1154 # MACHINE is IX86 for LINK, but this is used by the manifest,
1155 # which requires x86|amd64|ia64.
1156 MACHINE="X86"
1157 if test "$do64bit" != "no" ; then
1158 if test "x${MSSDK}x" = "xx" ; then
1159 MSSDK="C:/Progra~1/Microsoft Platform SDK"
1160 fi
1161 MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'`
1162 PATH64=""
1163 case "$do64bit" in
1164 amd64|x64|yes)
1165 MACHINE="AMD64" ; # default to AMD64 64-bit build
1166 PATH64="${MSSDK}/Bin/Win64/x86/AMD64"
1167 ;;
1168 ia64)
1169 MACHINE="IA64"
1170 PATH64="${MSSDK}/Bin/Win64"
1171 ;;
1172 esac
1173 if test ! -d "${PATH64}" ; then
1174 AC_MSG_WARN([Could not find 64-bit $MACHINE SDK to enable 64bit mode])
1175 AC_MSG_WARN([Ensure latest Platform SDK is installed])
1176 do64bit="no"
1177 else
1178 AC_MSG_RESULT([ Using 64-bit $MACHINE mode])
1179 do64bit_ok="yes"
1180 fi
1181 fi
1182
1183 if test "$doWince" != "no" ; then
1184 if test "$do64bit" != "no" ; then
1185 AC_MSG_ERROR([Windows/CE and 64-bit builds incompatible])
1186 fi
1187 if test "$GCC" = "yes" ; then
1188 AC_MSG_ERROR([Windows/CE and GCC builds incompatible])
1189 fi
1190 TEA_PATH_CELIB
1191 # Set defaults for common evc4/PPC2003 setup
1192 # Currently Tcl requires 300+, possibly 420+ for sockets
1193 CEVERSION=420; # could be 211 300 301 400 420 ...
1194 TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ...
1195 ARCH=ARM; # could be ARM MIPS X86EM ...
1196 PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002"
1197 if test "$doWince" != "yes"; then
1198 # If !yes then the user specified something
1199 # Reset ARCH to allow user to skip specifying it
1200 ARCH=
1201 eval `echo $doWince | awk -F, '{ \
1202 if (length([$]1)) { printf "CEVERSION=\"%s\"\n", [$]1; \
1203 if ([$]1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \
1204 if (length([$]2)) { printf "TARGETCPU=\"%s\"\n", toupper([$]2) }; \
1205 if (length([$]3)) { printf "ARCH=\"%s\"\n", toupper([$]3) }; \
1206 if (length([$]4)) { printf "PLATFORM=\"%s\"\n", [$]4 }; \
1207 }'`
1208 if test "x${ARCH}" = "x" ; then
1209 ARCH=$TARGETCPU;
1210 fi
1211 fi
1212 OSVERSION=WCE$CEVERSION;
1213 if test "x${WCEROOT}" = "x" ; then
1214 WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0"
1215 if test ! -d "${WCEROOT}" ; then
1216 WCEROOT="C:/Program Files/Microsoft eMbedded Tools"
1217 fi
1218 fi
1219 if test "x${SDKROOT}" = "x" ; then
1220 SDKROOT="C:/Program Files/Windows CE Tools"
1221 if test ! -d "${SDKROOT}" ; then
1222 SDKROOT="C:/Windows CE Tools"
1223 fi
1224 fi
1225 WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'`
1226 SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'`
1227 if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \
1228 -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then
1229 AC_MSG_ERROR([could not find PocketPC SDK or target compiler to enable WinCE mode [$CEVERSION,$TARGETCPU,$ARCH,$PLATFORM]])
1230 doWince="no"
1231 else
1232 # We could PATH_NOSPACE these, but that's not important,
1233 # as long as we quote them when used.
1234 CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include"
1235 if test -d "${CEINCLUDE}/${TARGETCPU}" ; then
1236 CEINCLUDE="${CEINCLUDE}/${TARGETCPU}"
1237 fi
1238 CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"
1239 fi
1240 fi
1241
1242 if test "$GCC" != "yes" ; then
1243 if test "${SHARED_BUILD}" = "0" ; then
1244 runtime=-MT
1245 else
1246 runtime=-MD
1247 fi
1248
1249 if test "$do64bit" != "no" ; then
1250 # All this magic is necessary for the Win64 SDK RC1 - hobbs
1251 CC="\"${PATH64}/cl.exe\""
1252 CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\""
1253 RC="\"${MSSDK}/bin/rc.exe\""
1254 lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
1255 LINKBIN="\"${PATH64}/link.exe\""
1256 CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
1257 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
1258 # Avoid 'unresolved external symbol __security_cookie'
1259 # errors, c.f. http://support.microsoft.com/?id=894573
1260 TEA_ADD_LIBS([bufferoverflowU.lib])
1261 elif test "$doWince" != "no" ; then
1262 CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin"
1263 if test "${TARGETCPU}" = "X86"; then
1264 CC="\"${CEBINROOT}/cl.exe\""
1265 else
1266 CC="\"${CEBINROOT}/cl${ARCH}.exe\""
1267 fi
1268 CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
1269 RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\""
1270 arch=`echo ${ARCH} | awk '{print tolower([$]0)}'`
1271 defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _WINDOWS"
1272 if test "${SHARED_BUILD}" = "1" ; then
1273 # Static CE builds require static celib as well
1274 defs="${defs} _DLL"
1275 fi
1276 for i in $defs ; do
1277 AC_DEFINE_UNQUOTED($i, 1, [WinCE def ]$i)
1278 done
1279 AC_DEFINE_UNQUOTED(_WIN32_WCE, $CEVERSION, [_WIN32_WCE version])
1280 AC_DEFINE_UNQUOTED(UNDER_CE, $CEVERSION, [UNDER_CE version])
1281 CFLAGS_DEBUG="-nologo -Zi -Od"
1282 CFLAGS_OPTIMIZE="-nologo -Ox"
1283 lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
1284 lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
1285 LINKBIN="\"${CEBINROOT}/link.exe\""
1286 AC_SUBST(CELIB_DIR)
1287 else
1288 RC="rc"
1289 lflags="-nologo"
1290 LINKBIN="link"
1291 CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
1292 CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
1293 fi
1294 fi
1295
1296 if test "$GCC" = "yes"; then
1297 # mingw gcc mode
1298 RC="windres"
1299 CFLAGS_DEBUG="-g"
1300 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
1301 SHLIB_LD="$CC -shared"
1302 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1303 LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}"
1304 LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}"
1305 else
1306 SHLIB_LD="${LINKBIN} -dll ${lflags}"
1307 # link -lib only works when -lib is the first arg
1308 STLIB_LD="${LINKBIN} -lib ${lflags}"
1309 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib'
1310 PATHTYPE=-w
1311 # For information on what debugtype is most useful, see:
1312 # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp
1313 # and also
1314 # http://msdn2.microsoft.com/en-us/library/y0zzbyt4%28VS.80%29.aspx
1315 # This essentially turns it all on.
1316 LDFLAGS_DEBUG="-debug -debugtype:cv"
1317 LDFLAGS_OPTIMIZE="-release"
1318 if test "$doWince" != "no" ; then
1319 LDFLAGS_CONSOLE="-link ${lflags}"
1320 LDFLAGS_WINDOW=${LDFLAGS_CONSOLE}
1321 else
1322 LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}"
1323 LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}"
1324 fi
1325 fi
1326
1327 SHLIB_SUFFIX=".dll"
1328 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll'
1329
1330 TCL_LIB_VERSIONS_OK=nodots
1331 ;;
1332 AIX-*)
1333 AS_IF([test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"], [
1334 # AIX requires the _r compiler when gcc isn't being used
1335 case "${CC}" in
1336 *_r|*_r\ *)
1337 # ok ...
1338 ;;
1339 *)
1340 # Make sure only first arg gets _r
1341 CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'`
1342 ;;
1343 esac
1344 AC_MSG_RESULT([Using $CC for compiling with threads])
1345 ])
1346 LIBS="$LIBS -lc"
1347 SHLIB_CFLAGS=""
1348 SHLIB_SUFFIX=".so"
1349
1350 LD_LIBRARY_PATH_VAR="LIBPATH"
1351
1352 # Check to enable 64-bit flags for compiler/linker
1353 AS_IF([test "$do64bit" = yes], [
1354 AS_IF([test "$GCC" = yes], [
1355 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1356 ], [
1357 do64bit_ok=yes
1358 CFLAGS="$CFLAGS -q64"
1359 LDFLAGS_ARCH="-q64"
1360 RANLIB="${RANLIB} -X64"
1361 AR="${AR} -X64"
1362 SHLIB_LD_FLAGS="-b64"
1363 ])
1364 ])
1365
1366 AS_IF([test "`uname -m`" = ia64], [
1367 # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
1368 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1369 AS_IF([test "$GCC" = yes], [
1370 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1371 ], [
1372 CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
1373 ])
1374 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1375 ], [
1376 AS_IF([test "$GCC" = yes], [
1377 SHLIB_LD='${CC} -shared -Wl,-bexpall'
1378 ], [
1379 SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bexpall -H512 -T512 -bnoentry"
1380 LDFLAGS="$LDFLAGS -brtl"
1381 ])
1382 SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}"
1383 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1384 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1385 ])
1386 ;;
1387 BeOS*)
1388 SHLIB_CFLAGS="-fPIC"
1389 SHLIB_LD='${CC} -nostart'
1390 SHLIB_SUFFIX=".so"
1391
1392 #-----------------------------------------------------------
1393 # Check for inet_ntoa in -lbind, for BeOS (which also needs
1394 # -lsocket, even if the network functions are in -lnet which
1395 # is always linked to, for compatibility.
1396 #-----------------------------------------------------------
1397 AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
1398 ;;
1399 BSD/OS-4.*)
1400 SHLIB_CFLAGS="-export-dynamic -fPIC"
1401 SHLIB_LD='${CC} -shared'
1402 SHLIB_SUFFIX=".so"
1403 LDFLAGS="$LDFLAGS -export-dynamic"
1404 CC_SEARCH_FLAGS=""
1405 LD_SEARCH_FLAGS=""
1406 ;;
1407 CYGWIN_*)
1408 SHLIB_CFLAGS=""
1409 SHLIB_LD='${CC} -shared'
1410 SHLIB_SUFFIX=".dll"
1411 EXE_SUFFIX=".exe"
1412 CC_SEARCH_FLAGS=""
1413 LD_SEARCH_FLAGS=""
1414 ;;
1415 Haiku*)
1416 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1417 SHLIB_CFLAGS="-fPIC"
1418 SHLIB_SUFFIX=".so"
1419 SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
1420 AC_CHECK_LIB(network, inet_ntoa, [LIBS="$LIBS -lnetwork"])
1421 ;;
1422 HP-UX-*.11.*)
1423 # Use updated header definitions where possible
1424 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Do we want to use the XOPEN network library?])
1425 # TEA specific: Needed by Tcl, but not most extensions
1426 #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
1427 #LIBS="$LIBS -lxnet" # Use the XOPEN network library
1428
1429 AS_IF([test "`uname -m`" = ia64], [
1430 SHLIB_SUFFIX=".so"
1431 # Use newer C++ library for C++ extensions
1432 #if test "$GCC" != "yes" ; then
1433 # CPPFLAGS="-AA"
1434 #fi
1435 ], [
1436 SHLIB_SUFFIX=".sl"
1437 ])
1438 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1439 AS_IF([test "$tcl_ok" = yes], [
1440 LDFLAGS="$LDFLAGS -Wl,-E"
1441 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1442 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1443 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1444 ])
1445 AS_IF([test "$GCC" = yes], [
1446 SHLIB_LD='${CC} -shared'
1447 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1448 ], [
1449 CFLAGS="$CFLAGS -z"
1450 # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
1451 #CFLAGS="$CFLAGS +DAportable"
1452 SHLIB_CFLAGS="+z"
1453 SHLIB_LD="ld -b"
1454 ])
1455
1456 # Check to enable 64-bit flags for compiler/linker
1457 AS_IF([test "$do64bit" = "yes"], [
1458 AS_IF([test "$GCC" = yes], [
1459 case `${CC} -dumpmachine` in
1460 hppa64*)
1461 # 64-bit gcc in use. Fix flags for GNU ld.
1462 do64bit_ok=yes
1463 SHLIB_LD='${CC} -shared'
1464 AS_IF([test $doRpath = yes], [
1465 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1466 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1467 ;;
1468 *)
1469 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1470 ;;
1471 esac
1472 ], [
1473 do64bit_ok=yes
1474 CFLAGS="$CFLAGS +DD64"
1475 LDFLAGS_ARCH="+DD64"
1476 ])
1477 ]) ;;
1478 IRIX-6.*)
1479 SHLIB_CFLAGS=""
1480 SHLIB_LD="ld -n32 -shared -rdata_shared"
1481 SHLIB_SUFFIX=".so"
1482 AS_IF([test $doRpath = yes], [
1483 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1484 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1485 AS_IF([test "$GCC" = yes], [
1486 CFLAGS="$CFLAGS -mabi=n32"
1487 LDFLAGS="$LDFLAGS -mabi=n32"
1488 ], [
1489 case $system in
1490 IRIX-6.3)
1491 # Use to build 6.2 compatible binaries on 6.3.
1492 CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
1493 ;;
1494 *)
1495 CFLAGS="$CFLAGS -n32"
1496 ;;
1497 esac
1498 LDFLAGS="$LDFLAGS -n32"
1499 ])
1500 ;;
1501 IRIX64-6.*)
1502 SHLIB_CFLAGS=""
1503 SHLIB_LD="ld -n32 -shared -rdata_shared"
1504 SHLIB_SUFFIX=".so"
1505 AS_IF([test $doRpath = yes], [
1506 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1507 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1508
1509 # Check to enable 64-bit flags for compiler/linker
1510
1511 AS_IF([test "$do64bit" = yes], [
1512 AS_IF([test "$GCC" = yes], [
1513 AC_MSG_WARN([64bit mode not supported by gcc])
1514 ], [
1515 do64bit_ok=yes
1516 SHLIB_LD="ld -64 -shared -rdata_shared"
1517 CFLAGS="$CFLAGS -64"
1518 LDFLAGS_ARCH="-64"
1519 ])
1520 ])
1521 ;;
1522 Linux*)
1523 SHLIB_CFLAGS="-fPIC"
1524 SHLIB_SUFFIX=".so"
1525
1526 # TEA specific:
1527 CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
1528
1529 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1530 SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS_DEFAULT}'
1531 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1532 AS_IF([test $doRpath = yes], [
1533 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1534 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1535 AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
1536 AS_IF([test $do64bit = yes], [
1537 AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
1538 hold_cflags=$CFLAGS
1539 CFLAGS="$CFLAGS -m64"
1540 AC_TRY_LINK(,, tcl_cv_cc_m64=yes, tcl_cv_cc_m64=no)
1541 CFLAGS=$hold_cflags])
1542 AS_IF([test $tcl_cv_cc_m64 = yes], [
1543 CFLAGS="$CFLAGS -m64"
1544 do64bit_ok=yes
1545 ])
1546 ])
1547
1548 # The combo of gcc + glibc has a bug related to inlining of
1549 # functions like strtod(). The -fno-builtin flag should address
1550 # this problem but it does not work. The -fno-inline flag is kind
1551 # of overkill but it works. Disable inlining only when one of the
1552 # files in compat/*.c is being linked in.
1553
1554 AS_IF([test x"${USE_COMPAT}" != x],[CFLAGS="$CFLAGS -fno-inline"])
1555
1556 ;;
1557 GNU*)
1558 SHLIB_CFLAGS="-fPIC"
1559 SHLIB_SUFFIX=".so"
1560
1561 SHLIB_LD='${CC} -shared'
1562 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1563 CC_SEARCH_FLAGS=""
1564 LD_SEARCH_FLAGS=""
1565 AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
1566 ;;
1567 Lynx*)
1568 SHLIB_CFLAGS="-fPIC"
1569 SHLIB_SUFFIX=".so"
1570 CFLAGS_OPTIMIZE=-02
1571 SHLIB_LD='${CC} -shared'
1572 LD_FLAGS="-Wl,--export-dynamic"
1573 AS_IF([test $doRpath = yes], [
1574 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1575 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1576 ;;
1577 OpenBSD-*)
1578 SHLIB_CFLAGS="-fPIC"
1579 SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
1580 SHLIB_SUFFIX=".so"
1581 AS_IF([test $doRpath = yes], [
1582 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1583 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1584 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
1585 AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
1586 AC_EGREP_CPP(yes, [
1587#ifdef __ELF__
1588 yes
1589#endif
1590 ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
1591 AS_IF([test $tcl_cv_ld_elf = yes], [
1592 LDFLAGS=-Wl,-export-dynamic
1593 ], [LDFLAGS=""])
1594 AS_IF([test "${TCL_THREADS}" = "1"], [
1595 # OpenBSD builds and links with -pthread, never -lpthread.
1596 LIBS=`echo $LIBS | sed s/-lpthread//`
1597 CFLAGS="$CFLAGS -pthread"
1598 SHLIB_CFLAGS="$SHLIB_CFLAGS -pthread"
1599 ])
1600 # OpenBSD doesn't do version numbers with dots.
1601 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1602 TCL_LIB_VERSIONS_OK=nodots
1603 ;;
1604 NetBSD-*|FreeBSD-[[3-4]].*)
1605 # FreeBSD 3.* and greater have ELF.
1606 # NetBSD 2.* has ELF and can use 'cc -shared' to build shared libs
1607 SHLIB_CFLAGS="-fPIC"
1608 SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
1609 SHLIB_SUFFIX=".so"
1610 LDFLAGS="$LDFLAGS -export-dynamic"
1611 AS_IF([test $doRpath = yes], [
1612 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1613 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1614 AS_IF([test "${TCL_THREADS}" = "1"], [
1615 # The -pthread needs to go in the CFLAGS, not LIBS
1616 LIBS=`echo $LIBS | sed s/-pthread//`
1617 CFLAGS="$CFLAGS -pthread"
1618 LDFLAGS="$LDFLAGS -pthread"
1619 ])
1620 case $system in
1621 FreeBSD-3.*)
1622 # FreeBSD-3 doesn't handle version numbers with dots.
1623 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1624 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
1625 TCL_LIB_VERSIONS_OK=nodots
1626 ;;
1627 esac
1628 ;;
1629 FreeBSD-*)
1630 # This configuration from FreeBSD Ports.
1631 SHLIB_CFLAGS="-fPIC"
1632 SHLIB_LD="${CC} -shared"
1633 TCL_SHLIB_LD_EXTRAS="-soname \$[@]"
1634 SHLIB_SUFFIX=".so"
1635 LDFLAGS=""
1636 AS_IF([test $doRpath = yes], [
1637 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1638 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1639 AS_IF([test "${TCL_THREADS}" = "1"], [
1640 # The -pthread needs to go in the LDFLAGS, not LIBS
1641 LIBS=`echo $LIBS | sed s/-pthread//`
1642 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1643 LDFLAGS="$LDFLAGS $PTHREAD_LIBS"])
1644 # Version numbers are dot-stripped by system policy.
1645 TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .`
1646 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1647 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1'
1648 TCL_LIB_VERSIONS_OK=nodots
1649 ;;
1650 Darwin-*)
1651 CFLAGS_OPTIMIZE="-Os"
1652 SHLIB_CFLAGS="-fno-common"
1653 # To avoid discrepancies between what headers configure sees during
1654 # preprocessing tests and compiling tests, move any -isysroot and
1655 # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
1656 CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
1657 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1658 if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`"
1659 CFLAGS="`echo " ${CFLAGS}" | \
1660 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1661 if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
1662 AS_IF([test $do64bit = yes], [
1663 case `arch` in
1664 ppc)
1665 AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
1666 tcl_cv_cc_arch_ppc64, [
1667 hold_cflags=$CFLAGS
1668 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1669 AC_TRY_LINK(,, tcl_cv_cc_arch_ppc64=yes,
1670 tcl_cv_cc_arch_ppc64=no)
1671 CFLAGS=$hold_cflags])
1672 AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [
1673 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1674 do64bit_ok=yes
1675 ]);;
1676 i386)
1677 AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
1678 tcl_cv_cc_arch_x86_64, [
1679 hold_cflags=$CFLAGS
1680 CFLAGS="$CFLAGS -arch x86_64"
1681 AC_TRY_LINK(,, tcl_cv_cc_arch_x86_64=yes,
1682 tcl_cv_cc_arch_x86_64=no)
1683 CFLAGS=$hold_cflags])
1684 AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [
1685 CFLAGS="$CFLAGS -arch x86_64"
1686 do64bit_ok=yes
1687 ]);;
1688 *)
1689 AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
1690 esac
1691 ], [
1692 # Check for combined 32-bit and 64-bit fat build
1693 AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \
1694 && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '], [
1695 fat_32_64=yes])
1696 ])
1697 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1698 SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}'
1699 AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
1700 hold_ldflags=$LDFLAGS
1701 LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
1702 AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no)
1703 LDFLAGS=$hold_ldflags])
1704 AS_IF([test $tcl_cv_ld_single_module = yes], [
1705 SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
1706 ])
1707 # TEA specific: link shlib with current and compatiblity version flags
1708 vers=`echo ${PACKAGE_VERSION} | sed -e 's/^\([[0-9]]\{1,5\}\)\(\(\.[[0-9]]\{1,3\}\)\{0,2\}\).*$/\1\2/p' -e d`
1709 SHLIB_LD="${SHLIB_LD} -current_version ${vers:-0} -compatibility_version ${vers:-0}"
1710 SHLIB_SUFFIX=".dylib"
1711 # Don't use -prebind when building for Mac OS X 10.4 or later only:
1712 AS_IF([test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \
1713 "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4], [
1714 LDFLAGS="$LDFLAGS -prebind"])
1715 LDFLAGS="$LDFLAGS -headerpad_max_install_names"
1716 AC_CACHE_CHECK([if ld accepts -search_paths_first flag],
1717 tcl_cv_ld_search_paths_first, [
1718 hold_ldflags=$LDFLAGS
1719 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1720 AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes,
1721 tcl_cv_ld_search_paths_first=no)
1722 LDFLAGS=$hold_ldflags])
1723 AS_IF([test $tcl_cv_ld_search_paths_first = yes], [
1724 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1725 ])
1726 AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
1727 AC_DEFINE(MODULE_SCOPE, [__private_extern__],
1728 [Compiler support for module scope symbols])
1729 tcl_cv_cc_visibility_hidden=yes
1730 ])
1731 CC_SEARCH_FLAGS=""
1732 LD_SEARCH_FLAGS=""
1733 LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
1734 # TEA specific: for combined 32 & 64 bit fat builds of Tk
1735 # extensions, verify that 64-bit build is possible.
1736 AS_IF([test "$fat_32_64" = yes && test -n "${TK_BIN_DIR}"], [
1737 AS_IF([test "${TEA_WINDOWINGSYSTEM}" = x11], [
1738 AC_CACHE_CHECK([for 64-bit X11], tcl_cv_lib_x11_64, [
1739 for v in CFLAGS CPPFLAGS LDFLAGS; do
1740 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
1741 done
1742 CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include"
1743 LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
1744 AC_TRY_LINK([#include <X11/Xlib.h>], [XrmInitialize();],
1745 tcl_cv_lib_x11_64=yes, tcl_cv_lib_x11_64=no)
1746 for v in CFLAGS CPPFLAGS LDFLAGS; do
1747 eval $v'="$hold_'$v'"'
1748 done])
1749 ])
1750 AS_IF([test "${TEA_WINDOWINGSYSTEM}" = aqua], [
1751 AC_CACHE_CHECK([for 64-bit Tk], tcl_cv_lib_tk_64, [
1752 for v in CFLAGS CPPFLAGS LDFLAGS; do
1753 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
1754 done
1755 CPPFLAGS="$CPPFLAGS -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 ${TCL_INCLUDES} ${TK_INCLUDES}"
1756 LDFLAGS="$LDFLAGS ${TCL_STUB_LIB_SPEC} ${TK_STUB_LIB_SPEC}"
1757 AC_TRY_LINK([#include <tk.h>], [Tk_InitStubs(NULL, "", 0);],
1758 tcl_cv_lib_tk_64=yes, tcl_cv_lib_tk_64=no)
1759 for v in CFLAGS CPPFLAGS LDFLAGS; do
1760 eval $v'="$hold_'$v'"'
1761 done])
1762 ])
1763 # remove 64-bit arch flags from CFLAGS et al. if configuration
1764 # does not support 64-bit.
1765 AS_IF([test "$tcl_cv_lib_tk_64" = no -o "$tcl_cv_lib_x11_64" = no], [
1766 AC_MSG_NOTICE([Removing 64-bit architectures from compiler & linker flags])
1767 for v in CFLAGS CPPFLAGS LDFLAGS; do
1768 eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
1769 done])
1770 ])
1771 ;;
1772 OS/390-*)
1773 CFLAGS_OPTIMIZE="" # Optimizer is buggy
1774 AC_DEFINE(_OE_SOCKETS, 1, # needed in sys/socket.h
1775 [Should OS/390 do the right thing with sockets?])
1776 ;;
1777 OSF1-V*)
1778 # Digital OSF/1
1779 SHLIB_CFLAGS=""
1780 AS_IF([test "$SHARED_BUILD" = 1], [
1781 SHLIB_LD='ld -shared -expect_unresolved "*"'
1782 ], [
1783 SHLIB_LD='ld -non_shared -expect_unresolved "*"'
1784 ])
1785 SHLIB_SUFFIX=".so"
1786 AS_IF([test $doRpath = yes], [
1787 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1788 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1789 AS_IF([test "$GCC" = yes], [CFLAGS="$CFLAGS -mieee"], [
1790 CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"])
1791 # see pthread_intro(3) for pthread support on osf1, k.furukawa
1792 AS_IF([test "${TCL_THREADS}" = 1], [
1793 CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
1794 CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
1795 LIBS=`echo $LIBS | sed s/-lpthreads//`
1796 AS_IF([test "$GCC" = yes], [
1797 LIBS="$LIBS -lpthread -lmach -lexc"
1798 ], [
1799 CFLAGS="$CFLAGS -pthread"
1800 LDFLAGS="$LDFLAGS -pthread"
1801 ])
1802 ])
1803 ;;
1804 QNX-6*)
1805 # QNX RTP
1806 # This may work for all QNX, but it was only reported for v6.
1807 SHLIB_CFLAGS="-fPIC"
1808 SHLIB_LD="ld -Bshareable -x"
1809 SHLIB_LD_LIBS=""
1810 SHLIB_SUFFIX=".so"
1811 CC_SEARCH_FLAGS=""
1812 LD_SEARCH_FLAGS=""
1813 ;;
1814 SCO_SV-3.2*)
1815 AS_IF([test "$GCC" = yes], [
1816 SHLIB_CFLAGS="-fPIC -melf"
1817 LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
1818 ], [
1819 SHLIB_CFLAGS="-Kpic -belf"
1820 LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
1821 ])
1822 SHLIB_LD="ld -G"
1823 SHLIB_LD_LIBS=""
1824 SHLIB_SUFFIX=".so"
1825 CC_SEARCH_FLAGS=""
1826 LD_SEARCH_FLAGS=""
1827 ;;
1828 SunOS-5.[[0-6]])
1829 # Careful to not let 5.10+ fall into this case
1830
1831 # Note: If _REENTRANT isn't defined, then Solaris
1832 # won't define thread-safe library routines.
1833
1834 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1835 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1836 [Do we really want to follow the standard? Yes we do!])
1837
1838 SHLIB_CFLAGS="-KPIC"
1839 SHLIB_SUFFIX=".so"
1840 AS_IF([test "$GCC" = yes], [
1841 SHLIB_LD='${CC} -shared'
1842 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1843 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1844 ], [
1845 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1846 CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1847 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1848 ])
1849 ;;
1850 SunOS-5*)
1851 # Note: If _REENTRANT isn't defined, then Solaris
1852 # won't define thread-safe library routines.
1853
1854 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1855 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1856 [Do we really want to follow the standard? Yes we do!])
1857
1858 SHLIB_CFLAGS="-KPIC"
1859
1860 # Check to enable 64-bit flags for compiler/linker
1861 AS_IF([test "$do64bit" = yes], [
1862 arch=`isainfo`
1863 AS_IF([test "$arch" = "sparcv9 sparc"], [
1864 AS_IF([test "$GCC" = yes], [
1865 AS_IF([test "`${CC} -dumpversion | awk -F. '{print [$]1}'`" -lt 3], [
1866 AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
1867 ], [
1868 do64bit_ok=yes
1869 CFLAGS="$CFLAGS -m64 -mcpu=v9"
1870 LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
1871 SHLIB_CFLAGS="-fPIC"
1872 ])
1873 ], [
1874 do64bit_ok=yes
1875 AS_IF([test "$do64bitVIS" = yes], [
1876 CFLAGS="$CFLAGS -xarch=v9a"
1877 LDFLAGS_ARCH="-xarch=v9a"
1878 ], [
1879 CFLAGS="$CFLAGS -xarch=v9"
1880 LDFLAGS_ARCH="-xarch=v9"
1881 ])
1882 # Solaris 64 uses this as well
1883 #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
1884 ])
1885 ], [AS_IF([test "$arch" = "amd64 i386"], [
1886 AS_IF([test "$GCC" = yes], [
1887 case $system in
1888 SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
1889 do64bit_ok=yes
1890 CFLAGS="$CFLAGS -m64"
1891 LDFLAGS="$LDFLAGS -m64";;
1892 *)
1893 AC_MSG_WARN([64bit mode not supported with GCC on $system]);;
1894 esac
1895 ], [
1896 do64bit_ok=yes
1897 case $system in
1898 SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
1899 CFLAGS="$CFLAGS -m64"
1900 LDFLAGS="$LDFLAGS -m64";;
1901 *)
1902 CFLAGS="$CFLAGS -xarch=amd64"
1903 LDFLAGS="$LDFLAGS -xarch=amd64";;
1904 esac
1905 ])
1906 ], [AC_MSG_WARN([64bit mode not supported for $arch])])])
1907 ])
1908
1909 SHLIB_SUFFIX=".so"
1910 AS_IF([test "$GCC" = yes], [
1911 SHLIB_LD='${CC} -shared'
1912 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1913 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1914 AS_IF([test "$do64bit_ok" = yes], [
1915 AS_IF([test "$arch" = "sparcv9 sparc"], [
1916 # We need to specify -static-libgcc or we need to
1917 # add the path to the sparv9 libgcc.
1918 # JH: static-libgcc is necessary for core Tcl, but may
1919 # not be necessary for extensions.
1920 SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
1921 # for finding sparcv9 libgcc, get the regular libgcc
1922 # path, remove so name and append 'sparcv9'
1923 #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
1924 #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
1925 ], [AS_IF([test "$arch" = "amd64 i386"], [
1926 # JH: static-libgcc is necessary for core Tcl, but may
1927 # not be necessary for extensions.
1928 SHLIB_LD="$SHLIB_LD -m64 -static-libgcc"
1929 ])])
1930 ])
1931 ], [
1932 case $system in
1933 SunOS-5.[[1-9]][[0-9]]*)
1934 # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
1935 SHLIB_LD='${CC} -G -z text ${LDFLAGS_DEFAULT}';;
1936 *)
1937 SHLIB_LD='/usr/ccs/bin/ld -G -z text';;
1938 esac
1939 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1940 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1941 ])
1942 ;;
1943 esac
1944
1945 AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = no], [
1946 AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
1947 ])
1948
1949dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
1950dnl # until the end of configure, as configure's compile and link tests use
1951dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
1952dnl # preprocessing tests use only CPPFLAGS.
1953 AC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
1954
1955 # Add in the arch flags late to ensure it wasn't removed.
1956 # Not necessary in TEA, but this is aligned with core
1957 LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
1958
1959 # If we're running gcc, then change the C flags for compiling shared
1960 # libraries to the right flags for gcc, instead of those for the
1961 # standard manufacturer compiler.
1962
1963 AS_IF([test "$GCC" = yes], [
1964 case $system in
1965 AIX-*) ;;
1966 BSD/OS*) ;;
1967 CYGWIN_*) ;;
1968 IRIX*) ;;
1969 NetBSD-*|FreeBSD-*|OpenBSD-*) ;;
1970 Darwin-*) ;;
1971 SCO_SV-3.2*) ;;
1972 windows) ;;
1973 *) SHLIB_CFLAGS="-fPIC" ;;
1974 esac])
1975
1976 AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
1977 AC_DEFINE(MODULE_SCOPE, [extern],
1978 [No Compiler support for module scope symbols])
1979 AC_DEFINE(NO_VIZ, [], [No visibility hidden passed to zlib?])
1980 ])
1981
1982 AS_IF([test "$SHARED_LIB_SUFFIX" = ""], [
1983 # TEA specific: use PACKAGE_VERSION instead of VERSION
1984 SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'])
1985 AS_IF([test "$UNSHARED_LIB_SUFFIX" = ""], [
1986 # TEA specific: use PACKAGE_VERSION instead of VERSION
1987 UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'])
1988
1989 AC_SUBST(CFLAGS_DEBUG)
1990 AC_SUBST(CFLAGS_OPTIMIZE)
1991 AC_SUBST(CFLAGS_WARNING)
1992
1993 AC_SUBST(STLIB_LD)
1994 AC_SUBST(SHLIB_LD)
1995
1996 AC_SUBST(SHLIB_LD_LIBS)
1997 AC_SUBST(SHLIB_CFLAGS)
1998
1999 AC_SUBST(LD_LIBRARY_PATH_VAR)
2000
2001 # These must be called after we do the basic CFLAGS checks and
2002 # verify any possible 64-bit or similar switches are necessary
2003 TEA_TCL_EARLY_FLAGS
2004 TEA_TCL_64BIT_FLAGS
2005])
2006
2007#--------------------------------------------------------------------
2008# TEA_SERIAL_PORT
2009#
2010# Determine which interface to use to talk to the serial port.
2011# Note that #include lines must begin in leftmost column for
2012# some compilers to recognize them as preprocessor directives,
2013# and some build environments have stdin not pointing at a
2014# pseudo-terminal (usually /dev/null instead.)
2015#
2016# Arguments:
2017# none
2018#
2019# Results:
2020#
2021# Defines only one of the following vars:
2022# HAVE_SYS_MODEM_H
2023# USE_TERMIOS
2024# USE_TERMIO
2025# USE_SGTTY
2026#
2027#--------------------------------------------------------------------
2028
2029AC_DEFUN([TEA_SERIAL_PORT], [
2030 AC_CHECK_HEADERS(sys/modem.h)
2031 AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [
2032 AC_TRY_RUN([
2033#include <termios.h>
2034
2035int main() {
2036 struct termios t;
2037 if (tcgetattr(0, &t) == 0) {
2038 cfsetospeed(&t, 0);
2039 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2040 return 0;
2041 }
2042 return 1;
2043}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2044 if test $tcl_cv_api_serial = no ; then
2045 AC_TRY_RUN([
2046#include <termio.h>
2047
2048int main() {
2049 struct termio t;
2050 if (ioctl(0, TCGETA, &t) == 0) {
2051 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2052 return 0;
2053 }
2054 return 1;
2055}], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2056 fi
2057 if test $tcl_cv_api_serial = no ; then
2058 AC_TRY_RUN([
2059#include <sgtty.h>
2060
2061int main() {
2062 struct sgttyb t;
2063 if (ioctl(0, TIOCGETP, &t) == 0) {
2064 t.sg_ospeed = 0;
2065 t.sg_flags |= ODDP | EVENP | RAW;
2066 return 0;
2067 }
2068 return 1;
2069}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2070 fi
2071 if test $tcl_cv_api_serial = no ; then
2072 AC_TRY_RUN([
2073#include <termios.h>
2074#include <errno.h>
2075
2076int main() {
2077 struct termios t;
2078 if (tcgetattr(0, &t) == 0
2079 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2080 cfsetospeed(&t, 0);
2081 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2082 return 0;
2083 }
2084 return 1;
2085}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2086 fi
2087 if test $tcl_cv_api_serial = no; then
2088 AC_TRY_RUN([
2089#include <termio.h>
2090#include <errno.h>
2091
2092int main() {
2093 struct termio t;
2094 if (ioctl(0, TCGETA, &t) == 0
2095 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2096 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2097 return 0;
2098 }
2099 return 1;
2100 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2101 fi
2102 if test $tcl_cv_api_serial = no; then
2103 AC_TRY_RUN([
2104#include <sgtty.h>
2105#include <errno.h>
2106
2107int main() {
2108 struct sgttyb t;
2109 if (ioctl(0, TIOCGETP, &t) == 0
2110 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2111 t.sg_ospeed = 0;
2112 t.sg_flags |= ODDP | EVENP | RAW;
2113 return 0;
2114 }
2115 return 1;
2116}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
2117 fi])
2118 case $tcl_cv_api_serial in
2119 termios) AC_DEFINE(USE_TERMIOS, 1, [Use the termios API for serial lines]);;
2120 termio) AC_DEFINE(USE_TERMIO, 1, [Use the termio API for serial lines]);;
2121 sgtty) AC_DEFINE(USE_SGTTY, 1, [Use the sgtty API for serial lines]);;
2122 esac
2123])
2124
2125#--------------------------------------------------------------------
2126# TEA_MISSING_POSIX_HEADERS
2127#
2128# Supply substitutes for missing POSIX header files. Special
2129# notes:
2130# - stdlib.h doesn't define strtol, strtoul, or
2131# strtod in some versions of SunOS
2132# - some versions of string.h don't declare procedures such
2133# as strstr
2134#
2135# Arguments:
2136# none
2137#
2138# Results:
2139#
2140# Defines some of the following vars:
2141# NO_DIRENT_H
2142# NO_ERRNO_H
2143# NO_VALUES_H
2144# HAVE_LIMITS_H or NO_LIMITS_H
2145# NO_STDLIB_H
2146# NO_STRING_H
2147# NO_SYS_WAIT_H
2148# NO_DLFCN_H
2149# HAVE_SYS_PARAM_H
2150#
2151# HAVE_STRING_H ?
2152#
2153# tkUnixPort.h checks for HAVE_LIMITS_H, so do both HAVE and
2154# CHECK on limits.h
2155#--------------------------------------------------------------------
2156
2157AC_DEFUN([TEA_MISSING_POSIX_HEADERS], [
2158 AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [
2159 AC_TRY_LINK([#include <sys/types.h>
2160#include <dirent.h>], [
2161#ifndef _POSIX_SOURCE
2162# ifdef __Lynx__
2163 /*
2164 * Generate compilation error to make the test fail: Lynx headers
2165 * are only valid if really in the POSIX environment.
2166 */
2167
2168 missing_procedure();
2169# endif
2170#endif
2171DIR *d;
2172struct dirent *entryPtr;
2173char *p;
2174d = opendir("foobar");
2175entryPtr = readdir(d);
2176p = entryPtr->d_name;
2177closedir(d);
2178], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no)])
2179
2180 if test $tcl_cv_dirent_h = no; then
2181 AC_DEFINE(NO_DIRENT_H, 1, [Do we have <dirent.h>?])
2182 fi
2183
2184 # TEA specific:
2185 AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H, 1, [Do we have <errno.h>?])])
2186 AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have <float.h>?])])
2187 AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have <values.h>?])])
2188 AC_CHECK_HEADER(limits.h,
2189 [AC_DEFINE(HAVE_LIMITS_H, 1, [Do we have <limits.h>?])],
2190 [AC_DEFINE(NO_LIMITS_H, 1, [Do we have <limits.h>?])])
2191 AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
2192 AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
2193 AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
2194 AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
2195 if test $tcl_ok = 0; then
2196 AC_DEFINE(NO_STDLIB_H, 1, [Do we have <stdlib.h>?])
2197 fi
2198 AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
2199 AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
2200 AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
2201
2202 # See also memmove check below for a place where NO_STRING_H can be
2203 # set and why.
2204
2205 if test $tcl_ok = 0; then
2206 AC_DEFINE(NO_STRING_H, 1, [Do we have <string.h>?])
2207 fi
2208
2209 AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H, 1, [Do we have <sys/wait.h>?])])
2210 AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H, 1, [Do we have <dlfcn.h>?])])
2211
2212 # OS/390 lacks sys/param.h (and doesn't need it, by chance).
2213 AC_HAVE_HEADERS(sys/param.h)
2214])
2215
2216#--------------------------------------------------------------------
2217# TEA_PATH_X
2218#
2219# Locate the X11 header files and the X11 library archive. Try
2220# the ac_path_x macro first, but if it doesn't find the X stuff
2221# (e.g. because there's no xmkmf program) then check through
2222# a list of possible directories. Under some conditions the
2223# autoconf macro will return an include directory that contains
2224# no include files, so double-check its result just to be safe.
2225#
2226# This should be called after TEA_CONFIG_CFLAGS as setting the
2227# LIBS line can confuse some configure macro magic.
2228#
2229# Arguments:
2230# none
2231#
2232# Results:
2233#
2234# Sets the following vars:
2235# XINCLUDES
2236# XLIBSW
2237# PKG_LIBS (appends to)
2238#
2239#--------------------------------------------------------------------
2240
2241AC_DEFUN([TEA_PATH_X], [
2242 if test "${TEA_WINDOWINGSYSTEM}" = "x11" ; then
2243 TEA_PATH_UNIX_X
2244 fi
2245])
2246
2247AC_DEFUN([TEA_PATH_UNIX_X], [
2248 AC_PATH_X
2249 not_really_there=""
2250 if test "$no_x" = ""; then
2251 if test "$x_includes" = ""; then
2252 AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
2253 else
2254 if test ! -r $x_includes/X11/Intrinsic.h; then
2255 not_really_there="yes"
2256 fi
2257 fi
2258 fi
2259 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
2260 AC_MSG_CHECKING([for X11 header files])
2261 found_xincludes="no"
2262 AC_TRY_CPP([#include <X11/Intrinsic.h>], found_xincludes="yes", found_xincludes="no")
2263 if test "$found_xincludes" = "no"; then
2264 dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
2265 for i in $dirs ; do
2266 if test -r $i/X11/Intrinsic.h; then
2267 AC_MSG_RESULT([$i])
2268 XINCLUDES=" -I$i"
2269 found_xincludes="yes"
2270 break
2271 fi
2272 done
2273 fi
2274 else
2275 if test "$x_includes" != ""; then
2276 XINCLUDES="-I$x_includes"
2277 found_xincludes="yes"
2278 fi
2279 fi
2280 if test "$found_xincludes" = "no"; then
2281 AC_MSG_RESULT([couldn't find any!])
2282 fi
2283
2284 if test "$no_x" = yes; then
2285 AC_MSG_CHECKING([for X11 libraries])
2286 XLIBSW=nope
2287 dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
2288 for i in $dirs ; do
2289 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl -o -r $i/libX11.dylib; then
2290 AC_MSG_RESULT([$i])
2291 XLIBSW="-L$i -lX11"
2292 x_libraries="$i"
2293 break
2294 fi
2295 done
2296 else
2297 if test "$x_libraries" = ""; then
2298 XLIBSW=-lX11
2299 else
2300 XLIBSW="-L$x_libraries -lX11"
2301 fi
2302 fi
2303 if test "$XLIBSW" = nope ; then
2304 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
2305 fi
2306 if test "$XLIBSW" = nope ; then
2307 AC_MSG_RESULT([could not find any! Using -lX11.])
2308 XLIBSW=-lX11
2309 fi
2310 # TEA specific:
2311 if test x"${XLIBSW}" != x ; then
2312 PKG_LIBS="${PKG_LIBS} ${XLIBSW}"
2313 fi
2314])
2315
2316#--------------------------------------------------------------------
2317# TEA_BLOCKING_STYLE
2318#
2319# The statements below check for systems where POSIX-style
2320# non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
2321# On these systems (mostly older ones), use the old BSD-style
2322# FIONBIO approach instead.
2323#
2324# Arguments:
2325# none
2326#
2327# Results:
2328#
2329# Defines some of the following vars:
2330# HAVE_SYS_IOCTL_H
2331# HAVE_SYS_FILIO_H
2332# USE_FIONBIO
2333# O_NONBLOCK
2334#
2335#--------------------------------------------------------------------
2336
2337AC_DEFUN([TEA_BLOCKING_STYLE], [
2338 AC_CHECK_HEADERS(sys/ioctl.h)
2339 AC_CHECK_HEADERS(sys/filio.h)
2340 TEA_CONFIG_SYSTEM
2341 AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
2342 case $system in
2343 OSF*)
2344 AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
2345 AC_MSG_RESULT([FIONBIO])
2346 ;;
2347 *)
2348 AC_MSG_RESULT([O_NONBLOCK])
2349 ;;
2350 esac
2351])
2352
2353#--------------------------------------------------------------------
2354# TEA_TIME_HANDLER
2355#
2356# Checks how the system deals with time.h, what time structures
2357# are used on the system, and what fields the structures have.
2358#
2359# Arguments:
2360# none
2361#
2362# Results:
2363#
2364# Defines some of the following vars:
2365# USE_DELTA_FOR_TZ
2366# HAVE_TM_GMTOFF
2367# HAVE_TM_TZADJ
2368# HAVE_TIMEZONE_VAR
2369#
2370#--------------------------------------------------------------------
2371
2372AC_DEFUN([TEA_TIME_HANDLER], [
2373 AC_CHECK_HEADERS(sys/time.h)
2374 AC_HEADER_TIME
2375 AC_STRUCT_TIMEZONE
2376
2377 AC_CHECK_FUNCS(gmtime_r localtime_r)
2378
2379 AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
2380 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
2381 tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)])
2382 if test $tcl_cv_member_tm_tzadj = yes ; then
2383 AC_DEFINE(HAVE_TM_TZADJ, 1, [Should we use the tm_tzadj field of struct tm?])
2384 fi
2385
2386 AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
2387 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
2388 tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)])
2389 if test $tcl_cv_member_tm_gmtoff = yes ; then
2390 AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?])
2391 fi
2392
2393 #
2394 # Its important to include time.h in this check, as some systems
2395 # (like convex) have timezone functions, etc.
2396 #
2397 AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
2398 AC_TRY_COMPILE([#include <time.h>],
2399 [extern long timezone;
2400 timezone += 1;
2401 exit (0);],
2402 tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)])
2403 if test $tcl_cv_timezone_long = yes ; then
2404 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2405 else
2406 #
2407 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
2408 #
2409 AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
2410 AC_TRY_COMPILE([#include <time.h>],
2411 [extern time_t timezone;
2412 timezone += 1;
2413 exit (0);],
2414 tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)])
2415 if test $tcl_cv_timezone_time = yes ; then
2416 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2417 fi
2418 fi
2419])
2420
2421#--------------------------------------------------------------------
2422# TEA_BUGGY_STRTOD
2423#
2424# Under Solaris 2.4, strtod returns the wrong value for the
2425# terminating character under some conditions. Check for this
2426# and if the problem exists use a substitute procedure
2427# "fixstrtod" (provided by Tcl) that corrects the error.
2428# Also, on Compaq's Tru64 Unix 5.0,
2429# strtod(" ") returns 0.0 instead of a failure to convert.
2430#
2431# Arguments:
2432# none
2433#
2434# Results:
2435#
2436# Might defines some of the following vars:
2437# strtod (=fixstrtod)
2438#
2439#--------------------------------------------------------------------
2440
2441AC_DEFUN([TEA_BUGGY_STRTOD], [
2442 AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
2443 if test "$tcl_strtod" = 1; then
2444 AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
2445 AC_TRY_RUN([
2446 extern double strtod();
2447 int main() {
2448 char *infString="Inf", *nanString="NaN", *spaceString=" ";
2449 char *term;
2450 double value;
2451 value = strtod(infString, &term);
2452 if ((term != infString) && (term[-1] == 0)) {
2453 exit(1);
2454 }
2455 value = strtod(nanString, &term);
2456 if ((term != nanString) && (term[-1] == 0)) {
2457 exit(1);
2458 }
2459 value = strtod(spaceString, &term);
2460 if (term == (spaceString+1)) {
2461 exit(1);
2462 }
2463 exit(0);
2464 }], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy,
2465 tcl_cv_strtod_buggy=buggy)])
2466 if test "$tcl_cv_strtod_buggy" = buggy; then
2467 AC_LIBOBJ([fixstrtod])
2468 USE_COMPAT=1
2469 AC_DEFINE(strtod, fixstrtod, [Do we want to use the strtod() in compat?])
2470 fi
2471 fi
2472])
2473
2474#--------------------------------------------------------------------
2475# TEA_TCL_LINK_LIBS
2476#
2477# Search for the libraries needed to link the Tcl shell.
2478# Things like the math library (-lm) and socket stuff (-lsocket vs.
2479# -lnsl) are dealt with here.
2480#
2481# Arguments:
2482# Requires the following vars to be set in the Makefile:
2483# DL_LIBS (not in TEA, only needed in core)
2484# LIBS
2485# MATH_LIBS
2486#
2487# Results:
2488#
2489# Subst's the following var:
2490# TCL_LIBS
2491# MATH_LIBS
2492#
2493# Might append to the following vars:
2494# LIBS
2495#
2496# Might define the following vars:
2497# HAVE_NET_ERRNO_H
2498#
2499#--------------------------------------------------------------------
2500
2501AC_DEFUN([TEA_TCL_LINK_LIBS], [
2502 #--------------------------------------------------------------------
2503 # On a few very rare systems, all of the libm.a stuff is
2504 # already in libc.a. Set compiler flags accordingly.
2505 # Also, Linux requires the "ieee" library for math to work
2506 # right (and it must appear before "-lm").
2507 #--------------------------------------------------------------------
2508
2509 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
2510 AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
2511
2512 #--------------------------------------------------------------------
2513 # Interactive UNIX requires -linet instead of -lsocket, plus it
2514 # needs net/errno.h to define the socket-related error codes.
2515 #--------------------------------------------------------------------
2516
2517 AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
2518 AC_CHECK_HEADER(net/errno.h, [
2519 AC_DEFINE(HAVE_NET_ERRNO_H, 1, [Do we have <net/errno.h>?])])
2520
2521 #--------------------------------------------------------------------
2522 # Check for the existence of the -lsocket and -lnsl libraries.
2523 # The order here is important, so that they end up in the right
2524 # order in the command line generated by make. Here are some
2525 # special considerations:
2526 # 1. Use "connect" and "accept" to check for -lsocket, and
2527 # "gethostbyname" to check for -lnsl.
2528 # 2. Use each function name only once: can't redo a check because
2529 # autoconf caches the results of the last check and won't redo it.
2530 # 3. Use -lnsl and -lsocket only if they supply procedures that
2531 # aren't already present in the normal libraries. This is because
2532 # IRIX 5.2 has libraries, but they aren't needed and they're
2533 # bogus: they goof up name resolution if used.
2534 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
2535 # To get around this problem, check for both libraries together
2536 # if -lsocket doesn't work by itself.
2537 #--------------------------------------------------------------------
2538
2539 tcl_checkBoth=0
2540 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
2541 if test "$tcl_checkSocket" = 1; then
2542 AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
2543 LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
2544 fi
2545 if test "$tcl_checkBoth" = 1; then
2546 tk_oldLibs=$LIBS
2547 LIBS="$LIBS -lsocket -lnsl"
2548 AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
2549 fi
2550 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
2551 [LIBS="$LIBS -lnsl"])])
2552
2553 # TEA specific: Don't perform the eval of the libraries here because
2554 # DL_LIBS won't be set until we call TEA_CONFIG_CFLAGS
2555
2556 TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
2557 AC_SUBST(TCL_LIBS)
2558 AC_SUBST(MATH_LIBS)
2559])
2560
2561#--------------------------------------------------------------------
2562# TEA_TCL_EARLY_FLAGS
2563#
2564# Check for what flags are needed to be passed so the correct OS
2565# features are available.
2566#
2567# Arguments:
2568# None
2569#
2570# Results:
2571#
2572# Might define the following vars:
2573# _ISOC99_SOURCE
2574# _LARGEFILE64_SOURCE
2575# _LARGEFILE_SOURCE64
2576#
2577#--------------------------------------------------------------------
2578
2579AC_DEFUN([TEA_TCL_EARLY_FLAG],[
2580 AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
2581 AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
2582 AC_TRY_COMPILE([[#define ]$1[ 1
2583]$2], $3,
2584 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
2585 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
2586 if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
2587 AC_DEFINE($1, 1, [Add the ]$1[ flag when building])
2588 tcl_flags="$tcl_flags $1"
2589 fi
2590])
2591
2592AC_DEFUN([TEA_TCL_EARLY_FLAGS],[
2593 AC_MSG_CHECKING([for required early compiler flags])
2594 tcl_flags=""
2595 TEA_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
2596 [char *p = (char *)strtoll; char *q = (char *)strtoull;])
2597 TEA_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
2598 [struct stat64 buf; int i = stat64("/", &buf);])
2599 TEA_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include <sys/stat.h>],
2600 [char *p = (char *)open64;])
2601 if test "x${tcl_flags}" = "x" ; then
2602 AC_MSG_RESULT([none])
2603 else
2604 AC_MSG_RESULT([${tcl_flags}])
2605 fi
2606])
2607
2608#--------------------------------------------------------------------
2609# TEA_TCL_64BIT_FLAGS
2610#
2611# Check for what is defined in the way of 64-bit features.
2612#
2613# Arguments:
2614# None
2615#
2616# Results:
2617#
2618# Might define the following vars:
2619# TCL_WIDE_INT_IS_LONG
2620# TCL_WIDE_INT_TYPE
2621# HAVE_STRUCT_DIRENT64
2622# HAVE_STRUCT_STAT64
2623# HAVE_TYPE_OFF64_T
2624#
2625#--------------------------------------------------------------------
2626
2627AC_DEFUN([TEA_TCL_64BIT_FLAGS], [
2628 AC_MSG_CHECKING([for 64-bit integer type])
2629 AC_CACHE_VAL(tcl_cv_type_64bit,[
2630 tcl_cv_type_64bit=none
2631 # See if the compiler knows natively about __int64
2632 AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
2633 tcl_type_64bit=__int64, tcl_type_64bit="long long")
2634 # See if we should use long anyway Note that we substitute in the
2635 # type that is our current guess for a 64-bit type inside this check
2636 # program, so it should be modified only carefully...
2637 AC_TRY_COMPILE(,[switch (0) {
2638 case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ;
2639 }],tcl_cv_type_64bit=${tcl_type_64bit})])
2640 if test "${tcl_cv_type_64bit}" = none ; then
2641 AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Are wide integers to be implemented with C 'long's?])
2642 AC_MSG_RESULT([using long])
2643 elif test "${tcl_cv_type_64bit}" = "__int64" \
2644 -a "${TEA_PLATFORM}" = "windows" ; then
2645 # TEA specific: We actually want to use the default tcl.h checks in
2646 # this case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER*
2647 AC_MSG_RESULT([using Tcl header defaults])
2648 else
2649 AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
2650 [What type should be used to define wide integers?])
2651 AC_MSG_RESULT([${tcl_cv_type_64bit}])
2652
2653 # Now check for auxiliary declarations
2654 AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
2655 AC_TRY_COMPILE([#include <sys/types.h>
2656#include <sys/dirent.h>],[struct dirent64 p;],
2657 tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
2658 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
2659 AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?])
2660 fi
2661
2662 AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
2663 AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
2664],
2665 tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
2666 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
2667 AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in <sys/stat.h>?])
2668 fi
2669
2670 AC_CHECK_FUNCS(open64 lseek64)
2671 AC_MSG_CHECKING([for off64_t])
2672 AC_CACHE_VAL(tcl_cv_type_off64_t,[
2673 AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
2674],
2675 tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
2676 dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
2677 dnl functions lseek64 and open64 are defined.
2678 if test "x${tcl_cv_type_off64_t}" = "xyes" && \
2679 test "x${ac_cv_func_lseek64}" = "xyes" && \
2680 test "x${ac_cv_func_open64}" = "xyes" ; then
2681 AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in <sys/types.h>?])
2682 AC_MSG_RESULT([yes])
2683 else
2684 AC_MSG_RESULT([no])
2685 fi
2686 fi
2687])
2688
2689##
2690## Here ends the standard Tcl configuration bits and starts the
2691## TEA specific functions
2692##
2693
2694#------------------------------------------------------------------------
2695# TEA_INIT --
2696#
2697# Init various Tcl Extension Architecture (TEA) variables.
2698# This should be the first called TEA_* macro.
2699#
2700# Arguments:
2701# none
2702#
2703# Results:
2704#
2705# Defines and substs the following vars:
2706# CYGPATH
2707# EXEEXT
2708# Defines only:
2709# TEA_VERSION
2710# TEA_INITED
2711# TEA_PLATFORM (windows or unix)
2712#
2713# "cygpath" is used on windows to generate native path names for include
2714# files. These variables should only be used with the compiler and linker
2715# since they generate native path names.
2716#
2717# EXEEXT
2718# Select the executable extension based on the host type. This
2719# is a lightweight replacement for AC_EXEEXT that doesn't require
2720# a compiler.
2721#------------------------------------------------------------------------
2722
2723AC_DEFUN([TEA_INIT], [
2724 # TEA extensions pass this us the version of TEA they think they
2725 # are compatible with.
2726 TEA_VERSION="3.9"
2727
2728 AC_MSG_CHECKING([for correct TEA configuration])
2729 if test x"${PACKAGE_NAME}" = x ; then
2730 AC_MSG_ERROR([
2731The PACKAGE_NAME variable must be defined by your TEA configure.in])
2732 fi
2733 if test x"$1" = x ; then
2734 AC_MSG_ERROR([
2735TEA version not specified.])
2736 elif test "$1" != "${TEA_VERSION}" ; then
2737 AC_MSG_RESULT([warning: requested TEA version "$1", have "${TEA_VERSION}"])
2738 else
2739 AC_MSG_RESULT([ok (TEA ${TEA_VERSION})])
2740 fi
2741 case "`uname -s`" in
2742 *win32*|*WIN32*|*MINGW32_*)
2743 AC_CHECK_PROG(CYGPATH, cygpath, cygpath -w, echo)
2744 EXEEXT=".exe"
2745 TEA_PLATFORM="windows"
2746 ;;
2747 *CYGWIN_*)
2748 CYGPATH=echo
2749 EXEEXT=".exe"
2750 # TEA_PLATFORM is determined later in LOAD_TCLCONFIG
2751 ;;
2752 *)
2753 CYGPATH=echo
2754 # Maybe we are cross-compiling....
2755 case ${host_alias} in
2756 *mingw32*)
2757 EXEEXT=".exe"
2758 TEA_PLATFORM="windows"
2759 ;;
2760 *)
2761 EXEEXT=""
2762 TEA_PLATFORM="unix"
2763 ;;
2764 esac
2765 ;;
2766 esac
2767
2768 # Check if exec_prefix is set. If not use fall back to prefix.
2769 # Note when adjusted, so that TEA_PREFIX can correct for this.
2770 # This is needed for recursive configures, since autoconf propagates
2771 # $prefix, but not $exec_prefix (doh!).
2772 if test x$exec_prefix = xNONE ; then
2773 exec_prefix_default=yes
2774 exec_prefix=$prefix
2775 fi
2776
2777 AC_MSG_NOTICE([configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}])
2778
2779 AC_SUBST(EXEEXT)
2780 AC_SUBST(CYGPATH)
2781
2782 # This package name must be replaced statically for AC_SUBST to work
2783 AC_SUBST(PKG_LIB_FILE)
2784 # Substitute STUB_LIB_FILE in case package creates a stub library too.
2785 AC_SUBST(PKG_STUB_LIB_FILE)
2786
2787 # We AC_SUBST these here to ensure they are subst'ed,
2788 # in case the user doesn't call TEA_ADD_...
2789 AC_SUBST(PKG_STUB_SOURCES)
2790 AC_SUBST(PKG_STUB_OBJECTS)
2791 AC_SUBST(PKG_TCL_SOURCES)
2792 AC_SUBST(PKG_HEADERS)
2793 AC_SUBST(PKG_INCLUDES)
2794 AC_SUBST(PKG_LIBS)
2795 AC_SUBST(PKG_CFLAGS)
2796])
2797
2798#------------------------------------------------------------------------
2799# TEA_ADD_SOURCES --
2800#
2801# Specify one or more source files. Users should check for
2802# the right platform before adding to their list.
2803# It is not important to specify the directory, as long as it is
2804# in the generic, win or unix subdirectory of $(srcdir).
2805#
2806# Arguments:
2807# one or more file names
2808#
2809# Results:
2810#
2811# Defines and substs the following vars:
2812# PKG_SOURCES
2813# PKG_OBJECTS
2814#------------------------------------------------------------------------
2815AC_DEFUN([TEA_ADD_SOURCES], [
2816 vars="$@"
2817 for i in $vars; do
2818 case $i in
2819 [\$]*)
2820 # allow $-var names
2821 PKG_SOURCES="$PKG_SOURCES $i"
2822 PKG_OBJECTS="$PKG_OBJECTS $i"
2823 ;;
2824 *)
2825 # check for existence - allows for generic/win/unix VPATH
2826 # To add more dirs here (like 'src'), you have to update VPATH
2827 # in Makefile.in as well
2828 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
2829 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
2830 -a ! -f "${srcdir}/macosx/$i" \
2831 ; then
2832 AC_MSG_ERROR([could not find source file '$i'])
2833 fi
2834 PKG_SOURCES="$PKG_SOURCES $i"
2835 # this assumes it is in a VPATH dir
2836 i=`basename $i`
2837 # handle user calling this before or after TEA_SETUP_COMPILER
2838 if test x"${OBJEXT}" != x ; then
2839 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
2840 else
2841 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
2842 fi
2843 PKG_OBJECTS="$PKG_OBJECTS $j"
2844 ;;
2845 esac
2846 done
2847 AC_SUBST(PKG_SOURCES)
2848 AC_SUBST(PKG_OBJECTS)
2849])
2850
2851#------------------------------------------------------------------------
2852# TEA_ADD_STUB_SOURCES --
2853#
2854# Specify one or more source files. Users should check for
2855# the right platform before adding to their list.
2856# It is not important to specify the directory, as long as it is
2857# in the generic, win or unix subdirectory of $(srcdir).
2858#
2859# Arguments:
2860# one or more file names
2861#
2862# Results:
2863#
2864# Defines and substs the following vars:
2865# PKG_STUB_SOURCES
2866# PKG_STUB_OBJECTS
2867#------------------------------------------------------------------------
2868AC_DEFUN([TEA_ADD_STUB_SOURCES], [
2869 vars="$@"
2870 for i in $vars; do
2871 # check for existence - allows for generic/win/unix VPATH
2872 if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
2873 -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
2874 -a ! -f "${srcdir}/macosx/$i" \
2875 ; then
2876 AC_MSG_ERROR([could not find stub source file '$i'])
2877 fi
2878 PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i"
2879 # this assumes it is in a VPATH dir
2880 i=`basename $i`
2881 # handle user calling this before or after TEA_SETUP_COMPILER
2882 if test x"${OBJEXT}" != x ; then
2883 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
2884 else
2885 j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
2886 fi
2887 PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j"
2888 done
2889 AC_SUBST(PKG_STUB_SOURCES)
2890 AC_SUBST(PKG_STUB_OBJECTS)
2891])
2892
2893#------------------------------------------------------------------------
2894# TEA_ADD_TCL_SOURCES --
2895#
2896# Specify one or more Tcl source files. These should be platform
2897# independent runtime files.
2898#
2899# Arguments:
2900# one or more file names
2901#
2902# Results:
2903#
2904# Defines and substs the following vars:
2905# PKG_TCL_SOURCES
2906#------------------------------------------------------------------------
2907AC_DEFUN([TEA_ADD_TCL_SOURCES], [
2908 vars="$@"
2909 for i in $vars; do
2910 # check for existence, be strict because it is installed
2911 if test ! -f "${srcdir}/$i" ; then
2912 AC_MSG_ERROR([could not find tcl source file '${srcdir}/$i'])
2913 fi
2914 PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i"
2915 done
2916 AC_SUBST(PKG_TCL_SOURCES)
2917])
2918
2919#------------------------------------------------------------------------
2920# TEA_ADD_HEADERS --
2921#
2922# Specify one or more source headers. Users should check for
2923# the right platform before adding to their list.
2924#
2925# Arguments:
2926# one or more file names
2927#
2928# Results:
2929#
2930# Defines and substs the following vars:
2931# PKG_HEADERS
2932#------------------------------------------------------------------------
2933AC_DEFUN([TEA_ADD_HEADERS], [
2934 vars="$@"
2935 for i in $vars; do
2936 # check for existence, be strict because it is installed
2937 if test ! -f "${srcdir}/$i" ; then
2938 AC_MSG_ERROR([could not find header file '${srcdir}/$i'])
2939 fi
2940 PKG_HEADERS="$PKG_HEADERS $i"
2941 done
2942 AC_SUBST(PKG_HEADERS)
2943])
2944
2945#------------------------------------------------------------------------
2946# TEA_ADD_INCLUDES --
2947#
2948# Specify one or more include dirs. Users should check for
2949# the right platform before adding to their list.
2950#
2951# Arguments:
2952# one or more file names
2953#
2954# Results:
2955#
2956# Defines and substs the following vars:
2957# PKG_INCLUDES
2958#------------------------------------------------------------------------
2959AC_DEFUN([TEA_ADD_INCLUDES], [
2960 vars="$@"
2961 for i in $vars; do
2962 PKG_INCLUDES="$PKG_INCLUDES $i"
2963 done
2964 AC_SUBST(PKG_INCLUDES)
2965])
2966
2967#------------------------------------------------------------------------
2968# TEA_ADD_LIBS --
2969#
2970# Specify one or more libraries. Users should check for
2971# the right platform before adding to their list. For Windows,
2972# libraries provided in "foo.lib" format will be converted to
2973# "-lfoo" when using GCC (mingw).
2974#
2975# Arguments:
2976# one or more file names
2977#
2978# Results:
2979#
2980# Defines and substs the following vars:
2981# PKG_LIBS
2982#------------------------------------------------------------------------
2983AC_DEFUN([TEA_ADD_LIBS], [
2984 vars="$@"
2985 for i in $vars; do
2986 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
2987 # Convert foo.lib to -lfoo for GCC. No-op if not *.lib
2988 i=`echo "$i" | sed -e 's/^\([[^-]].*\)\.lib[$]/-l\1/i'`
2989 fi
2990 PKG_LIBS="$PKG_LIBS $i"
2991 done
2992 AC_SUBST(PKG_LIBS)
2993])
2994
2995#------------------------------------------------------------------------
2996# TEA_ADD_CFLAGS --
2997#
2998# Specify one or more CFLAGS. Users should check for
2999# the right platform before adding to their list.
3000#
3001# Arguments:
3002# one or more file names
3003#
3004# Results:
3005#
3006# Defines and substs the following vars:
3007# PKG_CFLAGS
3008#------------------------------------------------------------------------
3009AC_DEFUN([TEA_ADD_CFLAGS], [
3010 PKG_CFLAGS="$PKG_CFLAGS $@"
3011 AC_SUBST(PKG_CFLAGS)
3012])
3013
3014#------------------------------------------------------------------------
3015# TEA_ADD_CLEANFILES --
3016#
3017# Specify one or more CLEANFILES.
3018#
3019# Arguments:
3020# one or more file names to clean target
3021#
3022# Results:
3023#
3024# Appends to CLEANFILES, already defined for subst in LOAD_TCLCONFIG
3025#------------------------------------------------------------------------
3026AC_DEFUN([TEA_ADD_CLEANFILES], [
3027 CLEANFILES="$CLEANFILES $@"
3028])
3029
3030#------------------------------------------------------------------------
3031# TEA_PREFIX --
3032#
3033# Handle the --prefix=... option by defaulting to what Tcl gave
3034#
3035# Arguments:
3036# none
3037#
3038# Results:
3039#
3040# If --prefix or --exec-prefix was not specified, $prefix and
3041# $exec_prefix will be set to the values given to Tcl when it was
3042# configured.
3043#------------------------------------------------------------------------
3044AC_DEFUN([TEA_PREFIX], [
3045 if test "${prefix}" = "NONE"; then
3046 prefix_default=yes
3047 if test x"${TCL_PREFIX}" != x; then
3048 AC_MSG_NOTICE([--prefix defaulting to TCL_PREFIX ${TCL_PREFIX}])
3049 prefix=${TCL_PREFIX}
3050 else
3051 AC_MSG_NOTICE([--prefix defaulting to /usr/local])
3052 prefix=/usr/local
3053 fi
3054 fi
3055 if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" \
3056 -o x"${exec_prefix_default}" = x"yes" ; then
3057 if test x"${TCL_EXEC_PREFIX}" != x; then
3058 AC_MSG_NOTICE([--exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}])
3059 exec_prefix=${TCL_EXEC_PREFIX}
3060 else
3061 AC_MSG_NOTICE([--exec-prefix defaulting to ${prefix}])
3062 exec_prefix=$prefix
3063 fi
3064 fi
3065])
3066
3067#------------------------------------------------------------------------
3068# TEA_SETUP_COMPILER_CC --
3069#
3070# Do compiler checks the way we want. This is just a replacement
3071# for AC_PROG_CC in TEA configure.in files to make them cleaner.
3072#
3073# Arguments:
3074# none
3075#
3076# Results:
3077#
3078# Sets up CC var and other standard bits we need to make executables.
3079#------------------------------------------------------------------------
3080AC_DEFUN([TEA_SETUP_COMPILER_CC], [
3081 # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE)
3082 # in this macro, they need to go into TEA_SETUP_COMPILER instead.
3083
3084 # If the user did not set CFLAGS, set it now to keep
3085 # the AC_PROG_CC macro from adding "-g -O2".
3086 if test "${CFLAGS+set}" != "set" ; then
3087 CFLAGS=""
3088 fi
3089
3090 AC_PROG_CC
3091 AC_PROG_CPP
3092
3093 AC_PROG_INSTALL
3094
3095 #--------------------------------------------------------------------
3096 # Checks to see if the make program sets the $MAKE variable.
3097 #--------------------------------------------------------------------
3098
3099 AC_PROG_MAKE_SET
3100
3101 #--------------------------------------------------------------------
3102 # Find ranlib
3103 #--------------------------------------------------------------------
3104
3105 AC_CHECK_TOOL(RANLIB, ranlib)
3106
3107 #--------------------------------------------------------------------
3108 # Determines the correct binary file extension (.o, .obj, .exe etc.)
3109 #--------------------------------------------------------------------
3110
3111 AC_OBJEXT
3112 AC_EXEEXT
3113])
3114
3115#------------------------------------------------------------------------
3116# TEA_SETUP_COMPILER --
3117#
3118# Do compiler checks that use the compiler. This must go after
3119# TEA_SETUP_COMPILER_CC, which does the actual compiler check.
3120#
3121# Arguments:
3122# none
3123#
3124# Results:
3125#
3126# Sets up CC var and other standard bits we need to make executables.
3127#------------------------------------------------------------------------
3128AC_DEFUN([TEA_SETUP_COMPILER], [
3129 # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here.
3130 AC_REQUIRE([TEA_SETUP_COMPILER_CC])
3131
3132 #------------------------------------------------------------------------
3133 # If we're using GCC, see if the compiler understands -pipe. If so, use it.
3134 # It makes compiling go faster. (This is only a performance feature.)
3135 #------------------------------------------------------------------------
3136
3137 if test -z "$no_pipe" -a -n "$GCC"; then
3138 AC_CACHE_CHECK([if the compiler understands -pipe],
3139 tcl_cv_cc_pipe, [
3140 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
3141 AC_TRY_COMPILE(,, tcl_cv_cc_pipe=yes, tcl_cv_cc_pipe=no)
3142 CFLAGS=$hold_cflags])
3143 if test $tcl_cv_cc_pipe = yes; then
3144 CFLAGS="$CFLAGS -pipe"
3145 fi
3146 fi
3147
3148 #--------------------------------------------------------------------
3149 # Common compiler flag setup
3150 #--------------------------------------------------------------------
3151
3152 AC_C_BIGENDIAN
3153 if test "${TEA_PLATFORM}" = "unix" ; then
3154 TEA_TCL_LINK_LIBS
3155 TEA_MISSING_POSIX_HEADERS
3156 # Let the user call this, because if it triggers, they will
3157 # need a compat/strtod.c that is correct. Users can also
3158 # use Tcl_GetDouble(FromObj) instead.
3159 #TEA_BUGGY_STRTOD
3160 fi
3161])
3162
3163#------------------------------------------------------------------------
3164# TEA_MAKE_LIB --
3165#
3166# Generate a line that can be used to build a shared/unshared library
3167# in a platform independent manner.
3168#
3169# Arguments:
3170# none
3171#
3172# Requires:
3173#
3174# Results:
3175#
3176# Defines the following vars:
3177# CFLAGS - Done late here to note disturb other AC macros
3178# MAKE_LIB - Command to execute to build the Tcl library;
3179# differs depending on whether or not Tcl is being
3180# compiled as a shared library.
3181# MAKE_SHARED_LIB Makefile rule for building a shared library
3182# MAKE_STATIC_LIB Makefile rule for building a static library
3183# MAKE_STUB_LIB Makefile rule for building a stub library
3184# VC_MANIFEST_EMBED_DLL Makefile rule for embedded VC manifest in DLL
3185# VC_MANIFEST_EMBED_EXE Makefile rule for embedded VC manifest in EXE
3186#------------------------------------------------------------------------
3187
3188AC_DEFUN([TEA_MAKE_LIB], [
3189 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then
3190 MAKE_STATIC_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_OBJECTS)"
3191 MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\[$]@ \$(PKG_OBJECTS)"
3192 AC_EGREP_CPP([manifest needed], [
3193#if defined(_MSC_VER) && _MSC_VER >= 1400
3194print("manifest needed")
3195#endif
3196 ], [
3197 # Could do a CHECK_PROG for mt, but should always be with MSVC8+
3198 VC_MANIFEST_EMBED_DLL="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest -outputresource:\[$]@\;2 ; fi"
3199 VC_MANIFEST_EMBED_EXE="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest -outputresource:\[$]@\;1 ; fi"
3200 MAKE_SHARED_LIB="${MAKE_SHARED_LIB} ; ${VC_MANIFEST_EMBED_DLL}"
3201 TEA_ADD_CLEANFILES([*.manifest])
3202 ])
3203 MAKE_STUB_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_STUB_OBJECTS)"
3204 else
3205 MAKE_STATIC_LIB="\${STLIB_LD} \[$]@ \$(PKG_OBJECTS)"
3206 MAKE_SHARED_LIB="\${SHLIB_LD} -o \[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
3207 MAKE_STUB_LIB="\${STLIB_LD} \[$]@ \$(PKG_STUB_OBJECTS)"
3208 fi
3209
3210 if test "${SHARED_BUILD}" = "1" ; then
3211 MAKE_LIB="${MAKE_SHARED_LIB} "
3212 else
3213 MAKE_LIB="${MAKE_STATIC_LIB} "
3214 fi
3215
3216 #--------------------------------------------------------------------
3217 # Shared libraries and static libraries have different names.
3218 # Use the double eval to make sure any variables in the suffix is
3219 # substituted. (@@@ Might not be necessary anymore)
3220 #--------------------------------------------------------------------
3221
3222 if test "${TEA_PLATFORM}" = "windows" ; then
3223 if test "${SHARED_BUILD}" = "1" ; then
3224 # We force the unresolved linking of symbols that are really in
3225 # the private libraries of Tcl and Tk.
3226 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\""
3227 if test x"${TK_BIN_DIR}" != x ; then
3228 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
3229 fi
3230 eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3231 else
3232 eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3233 fi
3234 # Some packages build their own stubs libraries
3235 eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
3236 if test "$GCC" = "yes"; then
3237 PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE}
3238 fi
3239 # These aren't needed on Windows (either MSVC or gcc)
3240 RANLIB=:
3241 RANLIB_STUB=:
3242 else
3243 RANLIB_STUB="${RANLIB}"
3244 if test "${SHARED_BUILD}" = "1" ; then
3245 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
3246 if test x"${TK_BIN_DIR}" != x ; then
3247 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
3248 fi
3249 eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
3250 RANLIB=:
3251 else
3252 eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
3253 fi
3254 # Some packages build their own stubs libraries
3255 eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
3256 fi
3257
3258 # These are escaped so that only CFLAGS is picked up at configure time.
3259 # The other values will be substituted at make time.
3260 CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
3261 if test "${SHARED_BUILD}" = "1" ; then
3262 CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}"
3263 fi
3264
3265 AC_SUBST(MAKE_LIB)
3266 AC_SUBST(MAKE_SHARED_LIB)
3267 AC_SUBST(MAKE_STATIC_LIB)
3268 AC_SUBST(MAKE_STUB_LIB)
3269 AC_SUBST(RANLIB_STUB)
3270 AC_SUBST(VC_MANIFEST_EMBED_DLL)
3271 AC_SUBST(VC_MANIFEST_EMBED_EXE)
3272])
3273
3274#------------------------------------------------------------------------
3275# TEA_LIB_SPEC --
3276#
3277# Compute the name of an existing object library located in libdir
3278# from the given base name and produce the appropriate linker flags.
3279#
3280# Arguments:
3281# basename The base name of the library without version
3282# numbers, extensions, or "lib" prefixes.
3283# extra_dir Extra directory in which to search for the
3284# library. This location is used first, then
3285# $prefix/$exec-prefix, then some defaults.
3286#
3287# Requires:
3288# TEA_INIT and TEA_PREFIX must be called first.
3289#
3290# Results:
3291#
3292# Defines the following vars:
3293# ${basename}_LIB_NAME The computed library name.
3294# ${basename}_LIB_SPEC The computed linker flags.
3295#------------------------------------------------------------------------
3296
3297AC_DEFUN([TEA_LIB_SPEC], [
3298 AC_MSG_CHECKING([for $1 library])
3299
3300 # Look in exec-prefix for the library (defined by TEA_PREFIX).
3301
3302 tea_lib_name_dir="${exec_prefix}/lib"
3303
3304 # Or in a user-specified location.
3305
3306 if test x"$2" != x ; then
3307 tea_extra_lib_dir=$2
3308 else
3309 tea_extra_lib_dir=NONE
3310 fi
3311
3312 for i in \
3313 `ls -dr ${tea_extra_lib_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
3314 `ls -dr ${tea_extra_lib_dir}/lib$1[[0-9]]* 2>/dev/null ` \
3315 `ls -dr ${tea_lib_name_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
3316 `ls -dr ${tea_lib_name_dir}/lib$1[[0-9]]* 2>/dev/null ` \
3317 `ls -dr /usr/lib/$1[[0-9]]*.lib 2>/dev/null ` \
3318 `ls -dr /usr/lib/lib$1[[0-9]]* 2>/dev/null ` \
3319 `ls -dr /usr/lib64/$1[[0-9]]*.lib 2>/dev/null ` \
3320 `ls -dr /usr/lib64/lib$1[[0-9]]* 2>/dev/null ` \
3321 `ls -dr /usr/local/lib/$1[[0-9]]*.lib 2>/dev/null ` \
3322 `ls -dr /usr/local/lib/lib$1[[0-9]]* 2>/dev/null ` ; do
3323 if test -f "$i" ; then
3324 tea_lib_name_dir=`dirname $i`
3325 $1_LIB_NAME=`basename $i`
3326 $1_LIB_PATH_NAME=$i
3327 break
3328 fi
3329 done
3330
3331 if test "${TEA_PLATFORM}" = "windows"; then
3332 $1_LIB_SPEC=\"`${CYGPATH} ${$1_LIB_PATH_NAME} 2>/dev/null`\"
3333 else
3334 # Strip off the leading "lib" and trailing ".a" or ".so"
3335
3336 tea_lib_name_lib=`echo ${$1_LIB_NAME}|sed -e 's/^lib//' -e 's/\.[[^.]]*$//' -e 's/\.so.*//'`
3337 $1_LIB_SPEC="-L${tea_lib_name_dir} -l${tea_lib_name_lib}"
3338 fi
3339
3340 if test "x${$1_LIB_NAME}" = x ; then
3341 AC_MSG_ERROR([not found])
3342 else
3343 AC_MSG_RESULT([${$1_LIB_SPEC}])
3344 fi
3345])
3346
3347#------------------------------------------------------------------------
3348# TEA_PRIVATE_TCL_HEADERS --
3349#
3350# Locate the private Tcl include files
3351#
3352# Arguments:
3353#
3354# Requires:
3355# TCL_SRC_DIR Assumes that TEA_LOAD_TCLCONFIG has
3356# already been called.
3357#
3358# Results:
3359#
3360# Substs the following vars:
3361# TCL_TOP_DIR_NATIVE
3362# TCL_INCLUDES
3363#------------------------------------------------------------------------
3364
3365AC_DEFUN([TEA_PRIVATE_TCL_HEADERS], [
3366 # Allow for --with-tclinclude to take effect and define ${ac_cv_c_tclh}
3367 AC_REQUIRE([TEA_PUBLIC_TCL_HEADERS])
3368 AC_MSG_CHECKING([for Tcl private include files])
3369
3370 TCL_SRC_DIR_NATIVE=`${CYGPATH} ${TCL_SRC_DIR}`
3371 TCL_TOP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}\"
3372
3373 # Check to see if tcl<Plat>Port.h isn't already with the public headers
3374 # Don't look for tclInt.h because that resides with tcl.h in the core
3375 # sources, but the <plat>Port headers are in a different directory
3376 if test "${TEA_PLATFORM}" = "windows" -a \
3377 -f "${ac_cv_c_tclh}/tclWinPort.h"; then
3378 result="private headers found with public headers"
3379 elif test "${TEA_PLATFORM}" = "unix" -a \
3380 -f "${ac_cv_c_tclh}/tclUnixPort.h"; then
3381 result="private headers found with public headers"
3382 else
3383 TCL_GENERIC_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/generic\"
3384 if test "${TEA_PLATFORM}" = "windows"; then
3385 TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/win\"
3386 else
3387 TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/unix\"
3388 fi
3389 # Overwrite the previous TCL_INCLUDES as this should capture both
3390 # public and private headers in the same set.
3391 # We want to ensure these are substituted so as not to require
3392 # any *_NATIVE vars be defined in the Makefile
3393 TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}"
3394 if test "`uname -s`" = "Darwin"; then
3395 # If Tcl was built as a framework, attempt to use
3396 # the framework's Headers and PrivateHeaders directories
3397 case ${TCL_DEFS} in
3398 *TCL_FRAMEWORK*)
3399 if test -d "${TCL_BIN_DIR}/Headers" -a \
3400 -d "${TCL_BIN_DIR}/PrivateHeaders"; then
3401 TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/PrivateHeaders\" ${TCL_INCLUDES}"
3402 else
3403 TCL_INCLUDES="${TCL_INCLUDES} ${TCL_INCLUDE_SPEC} `echo "${TCL_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"
3404 fi
3405 ;;
3406 esac
3407 result="Using ${TCL_INCLUDES}"
3408 else
3409 if test ! -f "${TCL_SRC_DIR}/generic/tclInt.h" ; then
3410 AC_MSG_ERROR([Cannot find private header tclInt.h in ${TCL_SRC_DIR}])
3411 fi
3412 result="Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}"
3413 fi
3414 fi
3415
3416 AC_SUBST(TCL_TOP_DIR_NATIVE)
3417
3418 AC_SUBST(TCL_INCLUDES)
3419 AC_MSG_RESULT([${result}])
3420])
3421
3422#------------------------------------------------------------------------
3423# TEA_PUBLIC_TCL_HEADERS --
3424#
3425# Locate the installed public Tcl header files
3426#
3427# Arguments:
3428# None.
3429#
3430# Requires:
3431# CYGPATH must be set
3432#
3433# Results:
3434#
3435# Adds a --with-tclinclude switch to configure.
3436# Result is cached.
3437#
3438# Substs the following vars:
3439# TCL_INCLUDES
3440#------------------------------------------------------------------------
3441
3442AC_DEFUN([TEA_PUBLIC_TCL_HEADERS], [
3443 AC_MSG_CHECKING([for Tcl public headers])
3444
3445 AC_ARG_WITH(tclinclude, [ --with-tclinclude directory containing the public Tcl header files], with_tclinclude=${withval})
3446
3447 AC_CACHE_VAL(ac_cv_c_tclh, [
3448 # Use the value from --with-tclinclude, if it was given
3449
3450 if test x"${with_tclinclude}" != x ; then
3451 if test -f "${with_tclinclude}/tcl.h" ; then
3452 ac_cv_c_tclh=${with_tclinclude}
3453 else
3454 AC_MSG_ERROR([${with_tclinclude} directory does not contain tcl.h])
3455 fi
3456 else
3457 list=""
3458 if test "`uname -s`" = "Darwin"; then
3459 # If Tcl was built as a framework, attempt to use
3460 # the framework's Headers directory
3461 case ${TCL_DEFS} in
3462 *TCL_FRAMEWORK*)
3463 list="`ls -d ${TCL_BIN_DIR}/Headers 2>/dev/null`"
3464 ;;
3465 esac
3466 fi
3467
3468 # Look in the source dir only if Tcl is not installed,
3469 # and in that situation, look there before installed locations.
3470 if test -f "${TCL_BIN_DIR}/Makefile" ; then
3471 list="$list `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`"
3472 fi
3473
3474 # Check order: pkg --prefix location, Tcl's --prefix location,
3475 # relative to directory of tclConfig.sh.
3476
3477 eval "temp_includedir=${includedir}"
3478 list="$list \
3479 `ls -d ${temp_includedir} 2>/dev/null` \
3480 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
3481 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
3482 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
3483 list="$list /usr/local/include /usr/include"
3484 if test x"${TCL_INCLUDE_SPEC}" != x ; then
3485 d=`echo "${TCL_INCLUDE_SPEC}" | sed -e 's/^-I//'`
3486 list="$list `ls -d ${d} 2>/dev/null`"
3487 fi
3488 fi
3489 for i in $list ; do
3490 if test -f "$i/tcl.h" ; then
3491 ac_cv_c_tclh=$i
3492 break
3493 fi
3494 done
3495 fi
3496 ])
3497
3498 # Print a message based on how we determined the include path
3499
3500 if test x"${ac_cv_c_tclh}" = x ; then
3501 AC_MSG_ERROR([tcl.h not found. Please specify its location with --with-tclinclude])
3502 else
3503 AC_MSG_RESULT([${ac_cv_c_tclh}])
3504 fi
3505
3506 # Convert to a native path and substitute into the output files.
3507
3508 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}`
3509
3510 TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3511
3512 AC_SUBST(TCL_INCLUDES)
3513])
3514
3515#------------------------------------------------------------------------
3516# TEA_PRIVATE_TK_HEADERS --
3517#
3518# Locate the private Tk include files
3519#
3520# Arguments:
3521#
3522# Requires:
3523# TK_SRC_DIR Assumes that TEA_LOAD_TKCONFIG has
3524# already been called.
3525#
3526# Results:
3527#
3528# Substs the following vars:
3529# TK_INCLUDES
3530#------------------------------------------------------------------------
3531
3532AC_DEFUN([TEA_PRIVATE_TK_HEADERS], [
3533 # Allow for --with-tkinclude to take effect and define ${ac_cv_c_tkh}
3534 AC_REQUIRE([TEA_PUBLIC_TK_HEADERS])
3535 AC_MSG_CHECKING([for Tk private include files])
3536
3537 TK_SRC_DIR_NATIVE=`${CYGPATH} ${TK_SRC_DIR}`
3538 TK_TOP_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}\"
3539
3540 # Check to see if tk<Plat>Port.h isn't already with the public headers
3541 # Don't look for tkInt.h because that resides with tk.h in the core
3542 # sources, but the <plat>Port headers are in a different directory
3543 if test "${TEA_PLATFORM}" = "windows" -a \
3544 -f "${ac_cv_c_tkh}/tkWinPort.h"; then
3545 result="private headers found with public headers"
3546 elif test "${TEA_PLATFORM}" = "unix" -a \
3547 -f "${ac_cv_c_tkh}/tkUnixPort.h"; then
3548 result="private headers found with public headers"
3549 else
3550 TK_GENERIC_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/generic\"
3551 TK_XLIB_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/xlib\"
3552 if test "${TEA_PLATFORM}" = "windows"; then
3553 TK_PLATFORM_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/win\"
3554 else
3555 TK_PLATFORM_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/unix\"
3556 fi
3557 # Overwrite the previous TK_INCLUDES as this should capture both
3558 # public and private headers in the same set.
3559 # We want to ensure these are substituted so as not to require
3560 # any *_NATIVE vars be defined in the Makefile
3561 TK_INCLUDES="-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE}"
3562 # Detect and add ttk subdir
3563 if test -d "${TK_SRC_DIR}/generic/ttk"; then
3564 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/generic/ttk\""
3565 fi
3566 if test "${TEA_WINDOWINGSYSTEM}" != "x11"; then
3567 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_XLIB_DIR_NATIVE}\""
3568 fi
3569 if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then
3570 TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/macosx\""
3571 fi
3572 if test "`uname -s`" = "Darwin"; then
3573 # If Tk was built as a framework, attempt to use
3574 # the framework's Headers and PrivateHeaders directories
3575 case ${TK_DEFS} in
3576 *TK_FRAMEWORK*)
3577 if test -d "${TK_BIN_DIR}/Headers" -a \
3578 -d "${TK_BIN_DIR}/PrivateHeaders"; then
3579 TK_INCLUDES="-I\"${TK_BIN_DIR}/Headers\" -I\"${TK_BIN_DIR}/PrivateHeaders\" ${TK_INCLUDES}"
3580 else
3581 TK_INCLUDES="${TK_INCLUDES} ${TK_INCLUDE_SPEC} `echo "${TK_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"
3582 fi
3583 ;;
3584 esac
3585 result="Using ${TK_INCLUDES}"
3586 else
3587 if test ! -f "${TK_SRC_DIR}/generic/tkInt.h" ; then
3588 AC_MSG_ERROR([Cannot find private header tkInt.h in ${TK_SRC_DIR}])
3589 fi
3590 result="Using srcdir found in tkConfig.sh: ${TK_SRC_DIR}"
3591 fi
3592 fi
3593
3594 AC_SUBST(TK_TOP_DIR_NATIVE)
3595 AC_SUBST(TK_XLIB_DIR_NATIVE)
3596
3597 AC_SUBST(TK_INCLUDES)
3598 AC_MSG_RESULT([${result}])
3599])
3600
3601#------------------------------------------------------------------------
3602# TEA_PUBLIC_TK_HEADERS --
3603#
3604# Locate the installed public Tk header files
3605#
3606# Arguments:
3607# None.
3608#
3609# Requires:
3610# CYGPATH must be set
3611#
3612# Results:
3613#
3614# Adds a --with-tkinclude switch to configure.
3615# Result is cached.
3616#
3617# Substs the following vars:
3618# TK_INCLUDES
3619#------------------------------------------------------------------------
3620
3621AC_DEFUN([TEA_PUBLIC_TK_HEADERS], [
3622 AC_MSG_CHECKING([for Tk public headers])
3623
3624 AC_ARG_WITH(tkinclude, [ --with-tkinclude directory containing the public Tk header files], with_tkinclude=${withval})
3625
3626 AC_CACHE_VAL(ac_cv_c_tkh, [
3627 # Use the value from --with-tkinclude, if it was given
3628
3629 if test x"${with_tkinclude}" != x ; then
3630 if test -f "${with_tkinclude}/tk.h" ; then
3631 ac_cv_c_tkh=${with_tkinclude}
3632 else
3633 AC_MSG_ERROR([${with_tkinclude} directory does not contain tk.h])
3634 fi
3635 else
3636 list=""
3637 if test "`uname -s`" = "Darwin"; then
3638 # If Tk was built as a framework, attempt to use
3639 # the framework's Headers directory.
3640 case ${TK_DEFS} in
3641 *TK_FRAMEWORK*)
3642 list="`ls -d ${TK_BIN_DIR}/Headers 2>/dev/null`"
3643 ;;
3644 esac
3645 fi
3646
3647 # Look in the source dir only if Tk is not installed,
3648 # and in that situation, look there before installed locations.
3649 if test -f "${TK_BIN_DIR}/Makefile" ; then
3650 list="$list `ls -d ${TK_SRC_DIR}/generic 2>/dev/null`"
3651 fi
3652
3653 # Check order: pkg --prefix location, Tk's --prefix location,
3654 # relative to directory of tkConfig.sh, Tcl's --prefix location,
3655 # relative to directory of tclConfig.sh.
3656
3657 eval "temp_includedir=${includedir}"
3658 list="$list \
3659 `ls -d ${temp_includedir} 2>/dev/null` \
3660 `ls -d ${TK_PREFIX}/include 2>/dev/null` \
3661 `ls -d ${TK_BIN_DIR}/../include 2>/dev/null` \
3662 `ls -d ${TCL_PREFIX}/include 2>/dev/null` \
3663 `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
3664 if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
3665 list="$list /usr/local/include /usr/include"
3666 if test x"${TK_INCLUDE_SPEC}" != x ; then
3667 d=`echo "${TK_INCLUDE_SPEC}" | sed -e 's/^-I//'`
3668 list="$list `ls -d ${d} 2>/dev/null`"
3669 fi
3670 fi
3671 for i in $list ; do
3672 if test -f "$i/tk.h" ; then
3673 ac_cv_c_tkh=$i
3674 break
3675 fi
3676 done
3677 fi
3678 ])
3679
3680 # Print a message based on how we determined the include path
3681
3682 if test x"${ac_cv_c_tkh}" = x ; then
3683 AC_MSG_ERROR([tk.h not found. Please specify its location with --with-tkinclude])
3684 else
3685 AC_MSG_RESULT([${ac_cv_c_tkh}])
3686 fi
3687
3688 # Convert to a native path and substitute into the output files.
3689
3690 INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tkh}`
3691
3692 TK_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3693
3694 AC_SUBST(TK_INCLUDES)
3695
3696 if test "${TEA_WINDOWINGSYSTEM}" != "x11"; then
3697 # On Windows and Aqua, we need the X compat headers
3698 AC_MSG_CHECKING([for X11 header files])
3699 if test ! -r "${INCLUDE_DIR_NATIVE}/X11/Xlib.h"; then
3700 INCLUDE_DIR_NATIVE="`${CYGPATH} ${TK_SRC_DIR}/xlib`"
3701 TK_XINCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
3702 AC_SUBST(TK_XINCLUDES)
3703 fi
3704 AC_MSG_RESULT([${INCLUDE_DIR_NATIVE}])
3705 fi
3706])
3707
3708#------------------------------------------------------------------------
3709# TEA_PATH_CONFIG --
3710#
3711# Locate the ${1}Config.sh file and perform a sanity check on
3712# the ${1} compile flags. These are used by packages like
3713# [incr Tk] that load *Config.sh files from more than Tcl and Tk.
3714#
3715# Arguments:
3716# none
3717#
3718# Results:
3719#
3720# Adds the following arguments to configure:
3721# --with-$1=...
3722#
3723# Defines the following vars:
3724# $1_BIN_DIR Full path to the directory containing
3725# the $1Config.sh file
3726#------------------------------------------------------------------------
3727
3728AC_DEFUN([TEA_PATH_CONFIG], [
3729 #
3730 # Ok, lets find the $1 configuration
3731 # First, look for one uninstalled.
3732 # the alternative search directory is invoked by --with-$1
3733 #
3734
3735 if test x"${no_$1}" = x ; then
3736 # we reset no_$1 in case something fails here
3737 no_$1=true
3738 AC_ARG_WITH($1, [ --with-$1 directory containing $1 configuration ($1Config.sh)], with_$1config=${withval})
3739 AC_MSG_CHECKING([for $1 configuration])
3740 AC_CACHE_VAL(ac_cv_c_$1config,[
3741
3742 # First check to see if --with-$1 was specified.
3743 if test x"${with_$1config}" != x ; then
3744 case ${with_$1config} in
3745 */$1Config.sh )
3746 if test -f ${with_$1config}; then
3747 AC_MSG_WARN([--with-$1 argument should refer to directory containing $1Config.sh, not to $1Config.sh itself])
3748 with_$1config=`echo ${with_$1config} | sed 's!/$1Config\.sh$!!'`
3749 fi;;
3750 esac
3751 if test -f "${with_$1config}/$1Config.sh" ; then
3752 ac_cv_c_$1config=`(cd ${with_$1config}; pwd)`
3753 else
3754 AC_MSG_ERROR([${with_$1config} directory doesn't contain $1Config.sh])
3755 fi
3756 fi
3757
3758 # then check for a private $1 installation
3759 if test x"${ac_cv_c_$1config}" = x ; then
3760 for i in \
3761 ../$1 \
3762 `ls -dr ../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3763 `ls -dr ../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3764 `ls -dr ../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3765 `ls -dr ../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3766 ../../$1 \
3767 `ls -dr ../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3768 `ls -dr ../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3769 `ls -dr ../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3770 `ls -dr ../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3771 ../../../$1 \
3772 `ls -dr ../../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3773 `ls -dr ../../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3774 `ls -dr ../../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3775 `ls -dr ../../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3776 ${srcdir}/../$1 \
3777 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
3778 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
3779 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]] 2>/dev/null` \
3780 `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
3781 ; do
3782 if test -f "$i/$1Config.sh" ; then
3783 ac_cv_c_$1config=`(cd $i; pwd)`
3784 break
3785 fi
3786 if test -f "$i/unix/$1Config.sh" ; then
3787 ac_cv_c_$1config=`(cd $i/unix; pwd)`
3788 break
3789 fi
3790 done
3791 fi
3792
3793 # check in a few common install locations
3794 if test x"${ac_cv_c_$1config}" = x ; then
3795 for i in `ls -d ${libdir} 2>/dev/null` \
3796 `ls -d ${exec_prefix}/lib 2>/dev/null` \
3797 `ls -d ${prefix}/lib 2>/dev/null` \
3798 `ls -d /usr/local/lib 2>/dev/null` \
3799 `ls -d /usr/contrib/lib 2>/dev/null` \
3800 `ls -d /usr/lib 2>/dev/null` \
3801 `ls -d /usr/lib64 2>/dev/null` \
3802 ; do
3803 if test -f "$i/$1Config.sh" ; then
3804 ac_cv_c_$1config=`(cd $i; pwd)`
3805 break
3806 fi
3807 done
3808 fi
3809 ])
3810
3811 if test x"${ac_cv_c_$1config}" = x ; then
3812 $1_BIN_DIR="# no $1 configs found"
3813 AC_MSG_WARN([Cannot find $1 configuration definitions])
3814 exit 0
3815 else
3816 no_$1=
3817 $1_BIN_DIR=${ac_cv_c_$1config}
3818 AC_MSG_RESULT([found $$1_BIN_DIR/$1Config.sh])
3819 fi
3820 fi
3821])
3822
3823#------------------------------------------------------------------------
3824# TEA_LOAD_CONFIG --
3825#
3826# Load the $1Config.sh file
3827#
3828# Arguments:
3829#
3830# Requires the following vars to be set:
3831# $1_BIN_DIR
3832#
3833# Results:
3834#
3835# Subst the following vars:
3836# $1_SRC_DIR
3837# $1_LIB_FILE
3838# $1_LIB_SPEC
3839#
3840#------------------------------------------------------------------------
3841
3842AC_DEFUN([TEA_LOAD_CONFIG], [
3843 AC_MSG_CHECKING([for existence of ${$1_BIN_DIR}/$1Config.sh])
3844
3845 if test -f "${$1_BIN_DIR}/$1Config.sh" ; then
3846 AC_MSG_RESULT([loading])
3847 . "${$1_BIN_DIR}/$1Config.sh"
3848 else
3849 AC_MSG_RESULT([file not found])
3850 fi
3851
3852 #
3853 # If the $1_BIN_DIR is the build directory (not the install directory),
3854 # then set the common variable name to the value of the build variables.
3855 # For example, the variable $1_LIB_SPEC will be set to the value
3856 # of $1_BUILD_LIB_SPEC. An extension should make use of $1_LIB_SPEC
3857 # instead of $1_BUILD_LIB_SPEC since it will work with both an
3858 # installed and uninstalled version of Tcl.
3859 #
3860
3861 if test -f "${$1_BIN_DIR}/Makefile" ; then
3862 AC_MSG_WARN([Found Makefile - using build library specs for $1])
3863 $1_LIB_SPEC=${$1_BUILD_LIB_SPEC}
3864 $1_STUB_LIB_SPEC=${$1_BUILD_STUB_LIB_SPEC}
3865 $1_STUB_LIB_PATH=${$1_BUILD_STUB_LIB_PATH}
3866 $1_INCLUDE_SPEC=${$1_BUILD_INCLUDE_SPEC}
3867 $1_LIBRARY_PATH=${$1_LIBRARY_PATH}
3868 fi
3869
3870 AC_SUBST($1_VERSION)
3871 AC_SUBST($1_BIN_DIR)
3872 AC_SUBST($1_SRC_DIR)
3873
3874 AC_SUBST($1_LIB_FILE)
3875 AC_SUBST($1_LIB_SPEC)
3876
3877 AC_SUBST($1_STUB_LIB_FILE)
3878 AC_SUBST($1_STUB_LIB_SPEC)
3879 AC_SUBST($1_STUB_LIB_PATH)
3880
3881 # Allow the caller to prevent this auto-check by specifying any 2nd arg
3882 AS_IF([test "x$2" = x], [
3883 # Check both upper and lower-case variants
3884 # If a dev wanted non-stubs libs, this function could take an option
3885 # to not use _STUB in the paths below
3886 AS_IF([test "x${$1_STUB_LIB_SPEC}" = x],
3887 [TEA_LOAD_CONFIG_LIB(translit($1,[a-z],[A-Z])_STUB)],
3888 [TEA_LOAD_CONFIG_LIB($1_STUB)])
3889 ])
3890])
3891
3892#------------------------------------------------------------------------
3893# TEA_LOAD_CONFIG_LIB --
3894#
3895# Helper function to load correct library from another extension's
3896# ${PACKAGE}Config.sh.
3897#
3898# Results:
3899# Adds to LIBS the appropriate extension library
3900#
3901#------------------------------------------------------------------------
3902AC_DEFUN([TEA_LOAD_CONFIG_LIB], [
3903 AC_MSG_CHECKING([For $1 library for LIBS])
3904 # This simplifies the use of stub libraries by automatically adding
3905 # the stub lib to your path. Normally this would add to SHLIB_LD_LIBS,
3906 # but this is called before CONFIG_CFLAGS. More importantly, this adds
3907 # to PKG_LIBS, which becomes LIBS, and that is only used by SHLIB_LD.
3908 if test "x${$1_LIB_SPEC}" != "x" ; then
3909 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes" ; then
3910 TEA_ADD_LIBS([\"`${CYGPATH} ${$1_LIB_PATH}`\"])
3911 AC_MSG_RESULT([using $1_LIB_PATH ${$1_LIB_PATH}])
3912 else
3913 TEA_ADD_LIBS([${$1_LIB_SPEC}])
3914 AC_MSG_RESULT([using $1_LIB_SPEC ${$1_LIB_SPEC}])
3915 fi
3916 else
3917 AC_MSG_RESULT([file not found])
3918 fi
3919])
3920
3921#------------------------------------------------------------------------
3922# TEA_EXPORT_CONFIG --
3923#
3924# Define the data to insert into the ${PACKAGE}Config.sh file
3925#
3926# Arguments:
3927#
3928# Requires the following vars to be set:
3929# $1
3930#
3931# Results:
3932# Subst the following vars:
3933#
3934#------------------------------------------------------------------------
3935
3936AC_DEFUN([TEA_EXPORT_CONFIG], [
3937 #--------------------------------------------------------------------
3938 # These are for $1Config.sh
3939 #--------------------------------------------------------------------
3940
3941 # pkglibdir must be a fully qualified path and (not ${exec_prefix}/lib)
3942 eval pkglibdir="[$]{libdir}/$1${PACKAGE_VERSION}"
3943 if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
3944 eval $1_LIB_FLAG="-l$1${PACKAGE_VERSION}${DBGX}"
3945 eval $1_STUB_LIB_FLAG="-l$1stub${PACKAGE_VERSION}${DBGX}"
3946 else
3947 eval $1_LIB_FLAG="-l$1`echo ${PACKAGE_VERSION} | tr -d .`${DBGX}"
3948 eval $1_STUB_LIB_FLAG="-l$1stub`echo ${PACKAGE_VERSION} | tr -d .`${DBGX}"
3949 fi
3950 $1_BUILD_LIB_SPEC="-L`pwd` ${$1_LIB_FLAG}"
3951 $1_LIB_SPEC="-L${pkglibdir} ${$1_LIB_FLAG}"
3952 $1_BUILD_STUB_LIB_SPEC="-L`pwd` [$]{$1_STUB_LIB_FLAG}"
3953 $1_STUB_LIB_SPEC="-L${pkglibdir} [$]{$1_STUB_LIB_FLAG}"
3954 $1_BUILD_STUB_LIB_PATH="`pwd`/[$]{PKG_STUB_LIB_FILE}"
3955 $1_STUB_LIB_PATH="${pkglibdir}/[$]{PKG_STUB_LIB_FILE}"
3956
3957 AC_SUBST($1_BUILD_LIB_SPEC)
3958 AC_SUBST($1_LIB_SPEC)
3959 AC_SUBST($1_BUILD_STUB_LIB_SPEC)
3960 AC_SUBST($1_STUB_LIB_SPEC)
3961 AC_SUBST($1_BUILD_STUB_LIB_PATH)
3962 AC_SUBST($1_STUB_LIB_PATH)
3963
3964 AC_SUBST(MAJOR_VERSION)
3965 AC_SUBST(MINOR_VERSION)
3966 AC_SUBST(PATCHLEVEL)
3967])
3968
3969
3970#------------------------------------------------------------------------
3971# TEA_PATH_CELIB --
3972#
3973# Locate Keuchel's celib emulation layer for targeting Win/CE
3974#
3975# Arguments:
3976# none
3977#
3978# Results:
3979#
3980# Adds the following arguments to configure:
3981# --with-celib=...
3982#
3983# Defines the following vars:
3984# CELIB_DIR Full path to the directory containing
3985# the include and platform lib files
3986#------------------------------------------------------------------------
3987
3988AC_DEFUN([TEA_PATH_CELIB], [
3989 # First, look for one uninstalled.
3990 # the alternative search directory is invoked by --with-celib
3991
3992 if test x"${no_celib}" = x ; then
3993 # we reset no_celib in case something fails here
3994 no_celib=true
3995 AC_ARG_WITH(celib,[ --with-celib=DIR use Windows/CE support library from DIR], with_celibconfig=${withval})
3996 AC_MSG_CHECKING([for Windows/CE celib directory])
3997 AC_CACHE_VAL(ac_cv_c_celibconfig,[
3998 # First check to see if --with-celibconfig was specified.
3999 if test x"${with_celibconfig}" != x ; then
4000 if test -d "${with_celibconfig}/inc" ; then
4001 ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)`
4002 else
4003 AC_MSG_ERROR([${with_celibconfig} directory doesn't contain inc directory])
4004 fi
4005 fi
4006
4007 # then check for a celib library
4008 if test x"${ac_cv_c_celibconfig}" = x ; then
4009 for i in \
4010 ../celib-palm-3.0 \
4011 ../celib \
4012 ../../celib-palm-3.0 \
4013 ../../celib \
4014 `ls -dr ../celib-*3.[[0-9]]* 2>/dev/null` \
4015 ${srcdir}/../celib-palm-3.0 \
4016 ${srcdir}/../celib \
4017 `ls -dr ${srcdir}/../celib-*3.[[0-9]]* 2>/dev/null` \
4018 ; do
4019 if test -d "$i/inc" ; then
4020 ac_cv_c_celibconfig=`(cd $i; pwd)`
4021 break
4022 fi
4023 done
4024 fi
4025 ])
4026 if test x"${ac_cv_c_celibconfig}" = x ; then
4027 AC_MSG_ERROR([Cannot find celib support library directory])
4028 else
4029 no_celib=
4030 CELIB_DIR=${ac_cv_c_celibconfig}
4031 CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'`
4032 AC_MSG_RESULT([found $CELIB_DIR])
4033 fi
4034 fi
4035])
4036
4037
4038# Local Variables:
4039# mode: autoconf
4040# End:
Note: See TracBrowser for help on using the repository browser.