comparison mupdf-source/thirdparty/zint/backend_tcl/tclconfig/tcl.m4 @ 2:b50eed0cc0ef upstream

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