Debian Codegraph @

lib/tcl.m4

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