Debian Codegraph @

unix/tcl.m4

raw
1 #------------------------------------------------------------------------
2 # SC_PATH_TCLCONFIG --
3 #
4 # Locate the tclConfig.sh file and perform a sanity check on
5 # the Tcl compile flags
6 #
7 # Arguments:
8 # none
9 #
10 # Results:
11 #
12 # Adds the following arguments to configure:
13 # --with-tcl=...
14 #
15 # Defines the following vars:
16 # TCL_BIN_DIR Full path to the directory containing
17 # the tclConfig.sh file
18 #------------------------------------------------------------------------
19
20 AC_DEFUN([SC_PATH_TCLCONFIG], [
21 #
22 # Ok, lets find the tcl configuration
23 # First, look for one uninstalled.
24 # the alternative search directory is invoked by --with-tcl
25 #
26
27 if test x"${no_tcl}" = x ; then
28 # we reset no_tcl in case something fails here
29 no_tcl=true
30 AC_ARG_WITH(tcl,
31 AS_HELP_STRING([--with-tcl],
32 [directory containing tcl configuration (tclConfig.sh)]),
33 [with_tclconfig="${withval}"])
34 AC_MSG_CHECKING([for Tcl configuration])
35 AC_CACHE_VAL(ac_cv_c_tclconfig,[
36
37 # First check to see if --with-tcl was specified.
38 if test x"${with_tclconfig}" != x ; then
39 case "${with_tclconfig}" in
40 */tclConfig.sh )
41 if test -f "${with_tclconfig}"; then
42 AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself])
43 with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`"
44 fi ;;
45 esac
46 if test -f "${with_tclconfig}/tclConfig.sh" ; then
47 ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`"
48 else
49 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
50 fi
51 fi
52
53 # then check for a private Tcl installation
54 if test x"${ac_cv_c_tclconfig}" = x ; then
55 for i in \
56 ../tcl \
57 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
58 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
59 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
60 ../../tcl \
61 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
62 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
63 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
64 ../../../tcl \
65 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
66 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
67 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
68 if test -f "$i/unix/tclConfig.sh" ; then
69 ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
70 break
71 fi
72 done
73 fi
74
75 # on Darwin, check in Framework installation locations
76 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
77 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
78 `ls -d /Library/Frameworks 2>/dev/null` \
79 `ls -d /Network/Library/Frameworks 2>/dev/null` \
80 ; do
81 if test -f "$i/Tcl.framework/tclConfig.sh" ; then
82 ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`"
83 break
84 fi
85 done
86 fi
87
88 # check in a few common install locations
89 if test x"${ac_cv_c_tclconfig}" = x ; then
90 for i in `ls -d ${libdir} 2>/dev/null` \
91 `ls -d ${exec_prefix}/lib 2>/dev/null` \
92 `ls -d ${prefix}/lib 2>/dev/null` \
93 `ls -d /usr/local/lib 2>/dev/null` \
94 `ls -d /usr/contrib/lib 2>/dev/null` \
95 `ls -d /usr/pkg/lib 2>/dev/null` \
96 `ls -d /usr/lib/tcl8.6 2>/dev/null` \
97 `ls -d /usr/lib 2>/dev/null` \
98 `ls -d /usr/lib64 2>/dev/null` \
99 `ls -d /usr/local/lib/tcl8.6 2>/dev/null` \
100 `ls -d /usr/local/lib/tcl/tcl8.6 2>/dev/null` \
101 ; do
102 if test -f "$i/tclConfig.sh" ; then
103 ac_cv_c_tclconfig="`(cd $i; pwd)`"
104 break
105 fi
106 done
107 fi
108
109 # check in a few other private locations
110 if test x"${ac_cv_c_tclconfig}" = x ; then
111 for i in \
112 ${srcdir}/../tcl \
113 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
114 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
115 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
116 if test -f "$i/unix/tclConfig.sh" ; then
117 ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
118 break
119 fi
120 done
121 fi
122 ])
123
124 if test x"${ac_cv_c_tclconfig}" = x ; then
125 TCL_BIN_DIR="# no Tcl configs found"
126 AC_MSG_ERROR([Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh])
127 else
128 no_tcl=
129 TCL_BIN_DIR="${ac_cv_c_tclconfig}"
130 AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
131 fi
132 fi
133 ])
134
135 #------------------------------------------------------------------------
136 # SC_PATH_TKCONFIG --
137 #
138 # Locate the tkConfig.sh file
139 #
140 # Arguments:
141 # none
142 #
143 # Results:
144 #
145 # Adds the following arguments to configure:
146 # --with-tk=...
147 #
148 # Defines the following vars:
149 # TK_BIN_DIR Full path to the directory containing
150 # the tkConfig.sh file
151 #------------------------------------------------------------------------
152
153 AC_DEFUN([SC_PATH_TKCONFIG], [
154 #
155 # Ok, lets find the tk configuration
156 # First, look for one uninstalled.
157 # the alternative search directory is invoked by --with-tk
158 #
159
160 if test x"${no_tk}" = x ; then
161 # we reset no_tk in case something fails here
162 no_tk=true
163 AC_ARG_WITH(tk,
164 AS_HELP_STRING([--with-tk],
165 [directory containing tk configuration (tkConfig.sh)]),
166 [with_tkconfig="${withval}"])
167 AC_MSG_CHECKING([for Tk configuration])
168 AC_CACHE_VAL(ac_cv_c_tkconfig,[
169
170 # First check to see if --with-tkconfig was specified.
171 if test x"${with_tkconfig}" != x ; then
172 case "${with_tkconfig}" in
173 */tkConfig.sh )
174 if test -f "${with_tkconfig}"; then
175 AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself])
176 with_tkconfig="`echo "${with_tkconfig}" | sed 's!/tkConfig\.sh$!!'`"
177 fi ;;
178 esac
179 if test -f "${with_tkconfig}/tkConfig.sh" ; then
180 ac_cv_c_tkconfig="`(cd "${with_tkconfig}"; pwd)`"
181 else
182 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
183 fi
184 fi
185
186 # then check for a private Tk library
187 if test x"${ac_cv_c_tkconfig}" = x ; then
188 for i in \
189 ../tk \
190 `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
191 `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \
192 `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
193 ../../tk \
194 `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
195 `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
196 `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
197 ../../../tk \
198 `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
199 `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
200 `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
201 if test -f "$i/unix/tkConfig.sh" ; then
202 ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
203 break
204 fi
205 done
206 fi
207
208 # on Darwin, check in Framework installation locations
209 if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
210 for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
211 `ls -d /Library/Frameworks 2>/dev/null` \
212 `ls -d /Network/Library/Frameworks 2>/dev/null` \
213 ; do
214 if test -f "$i/Tk.framework/tkConfig.sh" ; then
215 ac_cv_c_tkconfig="`(cd $i/Tk.framework; pwd)`"
216 break
217 fi
218 done
219 fi
220
221 # check in a few common install locations
222 if test x"${ac_cv_c_tkconfig}" = x ; then
223 for i in `ls -d ${libdir} 2>/dev/null` \
224 `ls -d ${exec_prefix}/lib 2>/dev/null` \
225 `ls -d ${prefix}/lib 2>/dev/null` \
226 `ls -d /usr/local/lib 2>/dev/null` \
227 `ls -d /usr/contrib/lib 2>/dev/null` \
228 `ls -d /usr/pkg/lib 2>/dev/null` \
229 `ls -d /usr/lib/tk8.6 2>/dev/null` \
230 `ls -d /usr/lib 2>/dev/null` \
231 `ls -d /usr/lib64 2>/dev/null` \
232 `ls -d /usr/local/lib/tk8.6 2>/dev/null` \
233 `ls -d /usr/local/lib/tcl/tk8.6 2>/dev/null` \
234 ; do
235 if test -f "$i/tkConfig.sh" ; then
236 ac_cv_c_tkconfig="`(cd $i; pwd)`"
237 break
238 fi
239 done
240 fi
241
242 # check in a few other private locations
243 if test x"${ac_cv_c_tkconfig}" = x ; then
244 for i in \
245 ${srcdir}/../tk \
246 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
247 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
248 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
249 if test -f "$i/unix/tkConfig.sh" ; then
250 ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
251 break
252 fi
253 done
254 fi
255 ])
256
257 if test x"${ac_cv_c_tkconfig}" = x ; then
258 TK_BIN_DIR="# no Tk configs found"
259 AC_MSG_ERROR([Can't find Tk configuration definitions. Use --with-tk to specify a directory containing tkConfig.sh])
260 else
261 no_tk=
262 TK_BIN_DIR="${ac_cv_c_tkconfig}"
263 AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
264 fi
265 fi
266 ])
267
268 #------------------------------------------------------------------------
269 # SC_LOAD_TCLCONFIG --
270 #
271 # Load the tclConfig.sh file
272 #
273 # Arguments:
274 #
275 # Requires the following vars to be set:
276 # TCL_BIN_DIR
277 #
278 # Results:
279 #
280 # Substitutes the following vars:
281 # TCL_BIN_DIR
282 # TCL_SRC_DIR
283 # TCL_LIB_FILE
284 #------------------------------------------------------------------------
285
286 AC_DEFUN([SC_LOAD_TCLCONFIG], [
287 AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
288
289 if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
290 AC_MSG_RESULT([loading])
291 . "${TCL_BIN_DIR}/tclConfig.sh"
292 else
293 AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
294 fi
295
296 # If the TCL_BIN_DIR is the build directory (not the install directory),
297 # then set the common variable name to the value of the build variables.
298 # For example, the variable TCL_LIB_SPEC will be set to the value
299 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
300 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
301 # installed and uninstalled version of Tcl.
302 if test -f "${TCL_BIN_DIR}/Makefile" ; then
303 TCL_LIB_SPEC="${TCL_BUILD_LIB_SPEC}"
304 TCL_STUB_LIB_SPEC="${TCL_BUILD_STUB_LIB_SPEC}"
305 TCL_STUB_LIB_PATH="${TCL_BUILD_STUB_LIB_PATH}"
306 elif test "`uname -s`" = "Darwin"; then
307 # If Tcl was built as a framework, attempt to use the libraries
308 # from the framework at the given location so that linking works
309 # against Tcl.framework installed in an arbitrary location.
310 case ${TCL_DEFS} in
311 *TCL_FRAMEWORK*)
312 if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then
313 for i in "`cd "${TCL_BIN_DIR}"; pwd`" \
314 "`cd "${TCL_BIN_DIR}"/../..; pwd`"; do
315 if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
316 TCL_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TCL_LIB_FILE}"
317 break
318 fi
319 done
320 fi
321 if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then
322 TCL_STUB_LIB_SPEC="-L`echo "${TCL_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TCL_STUB_LIB_FLAG}"
323 TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
324 fi
325 ;;
326 esac
327 fi
328
329 AC_SUBST(TCL_VERSION)
330 AC_SUBST(TCL_PATCH_LEVEL)
331 AC_SUBST(TCL_BIN_DIR)
332 AC_SUBST(TCL_SRC_DIR)
333
334 AC_SUBST(TCL_LIB_FILE)
335 AC_SUBST(TCL_LIB_FLAG)
336 AC_SUBST(TCL_LIB_SPEC)
337
338 AC_SUBST(TCL_STUB_LIB_FILE)
339 AC_SUBST(TCL_STUB_LIB_FLAG)
340 AC_SUBST(TCL_STUB_LIB_SPEC)
341 ])
342
343 #------------------------------------------------------------------------
344 # SC_LOAD_TKCONFIG --
345 #
346 # Load the tkConfig.sh file
347 #
348 # Arguments:
349 #
350 # Requires the following vars to be set:
351 # TK_BIN_DIR
352 #
353 # Results:
354 #
355 # Sets the following vars that should be in tkConfig.sh:
356 # TK_BIN_DIR
357 #------------------------------------------------------------------------
358
359 AC_DEFUN([SC_LOAD_TKCONFIG], [
360 AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
361
362 if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
363 AC_MSG_RESULT([loading])
364 . "${TK_BIN_DIR}/tkConfig.sh"
365 else
366 AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
367 fi
368
369 # If the TK_BIN_DIR is the build directory (not the install directory),
370 # then set the common variable name to the value of the build variables.
371 # For example, the variable TK_LIB_SPEC will be set to the value
372 # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
373 # instead of TK_BUILD_LIB_SPEC since it will work with both an
374 # installed and uninstalled version of Tcl.
375 if test -f "${TK_BIN_DIR}/Makefile" ; then
376 TK_LIB_SPEC="${TK_BUILD_LIB_SPEC}"
377 TK_STUB_LIB_SPEC="${TK_BUILD_STUB_LIB_SPEC}"
378 TK_STUB_LIB_PATH="${TK_BUILD_STUB_LIB_PATH}"
379 elif test "`uname -s`" = "Darwin"; then
380 # If Tk was built as a framework, attempt to use the libraries
381 # from the framework at the given location so that linking works
382 # against Tk.framework installed in an arbitrary location.
383 case ${TK_DEFS} in
384 *TK_FRAMEWORK*)
385 if test -f "${TK_BIN_DIR}/${TK_LIB_FILE}"; then
386 for i in "`cd "${TK_BIN_DIR}"; pwd`" \
387 "`cd "${TK_BIN_DIR}"/../..; pwd`"; do
388 if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
389 TK_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TK_LIB_FILE}"
390 break
391 fi
392 done
393 fi
394 if test -f "${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"; then
395 TK_STUB_LIB_SPEC="-L` echo "${TK_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}"
396 TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
397 fi
398 ;;
399 esac
400 fi
401
402 AC_SUBST(TK_VERSION)
403 AC_SUBST(TK_BIN_DIR)
404 AC_SUBST(TK_SRC_DIR)
405
406 AC_SUBST(TK_LIB_FILE)
407 AC_SUBST(TK_LIB_FLAG)
408 AC_SUBST(TK_LIB_SPEC)
409
410 AC_SUBST(TK_STUB_LIB_FILE)
411 AC_SUBST(TK_STUB_LIB_FLAG)
412 AC_SUBST(TK_STUB_LIB_SPEC)
413 ])
414
415 #------------------------------------------------------------------------
416 # SC_PROG_TCLSH
417 # Locate a tclsh shell installed on the system path. This macro
418 # will only find a Tcl shell that already exists on the system.
419 # It will not find a Tcl shell in the Tcl build directory or
420 # a Tcl shell that has been installed from the Tcl build directory.
421 # If a Tcl shell can't be located on the PATH, then TCLSH_PROG will
422 # be set to "". Extensions should take care not to create Makefile
423 # rules that are run by default and depend on TCLSH_PROG. An
424 # extension can't assume that an executable Tcl shell exists at
425 # build time.
426 #
427 # Arguments:
428 # none
429 #
430 # Results:
431 # Substitutes the following vars:
432 # TCLSH_PROG
433 #------------------------------------------------------------------------
434
435 AC_DEFUN([SC_PROG_TCLSH], [
436 AC_MSG_CHECKING([for tclsh])
437 AC_CACHE_VAL(ac_cv_path_tclsh, [
438 search_path=`echo ${PATH} | sed -e 's/:/ /g'`
439 for dir in $search_path ; do
440 for j in `ls -r $dir/tclsh[[8-9]]* 2> /dev/null` \
441 `ls -r $dir/tclsh* 2> /dev/null` ; do
442 if test x"$ac_cv_path_tclsh" = x ; then
443 if test -f "$j" ; then
444 ac_cv_path_tclsh=$j
445 break
446 fi
447 fi
448 done
449 done
450 ])
451
452 if test -f "$ac_cv_path_tclsh" ; then
453 TCLSH_PROG="$ac_cv_path_tclsh"
454 AC_MSG_RESULT([$TCLSH_PROG])
455 else
456 # It is not an error if an installed version of Tcl can't be located.
457 TCLSH_PROG=""
458 AC_MSG_RESULT([No tclsh found on PATH])
459 fi
460 AC_SUBST(TCLSH_PROG)
461 ])
462
463 #------------------------------------------------------------------------
464 # SC_BUILD_TCLSH
465 # Determine the fully qualified path name of the tclsh executable
466 # in the Tcl build directory. This macro will correctly determine
467 # the name of the tclsh executable even if tclsh has not yet
468 # been built in the build directory. The build tclsh must be used
469 # when running tests from an extension build directory. It is not
470 # correct to use the TCLSH_PROG in cases like this.
471 #
472 # Arguments:
473 # none
474 #
475 # Results:
476 # Substitutes the following values:
477 # BUILD_TCLSH
478 #------------------------------------------------------------------------
479
480 AC_DEFUN([SC_BUILD_TCLSH], [
481 AC_MSG_CHECKING([for tclsh in Tcl build directory])
482 BUILD_TCLSH="${TCL_BIN_DIR}"/tclsh
483 AC_MSG_RESULT([$BUILD_TCLSH])
484 AC_SUBST(BUILD_TCLSH)
485 ])
486
487 #------------------------------------------------------------------------
488 # SC_ENABLE_SHARED --
489 #
490 # Allows the building of shared libraries
491 #
492 # Arguments:
493 # none
494 #
495 # Results:
496 #
497 # Adds the following arguments to configure:
498 # --enable-shared=yes|no
499 #
500 # Defines the following vars:
501 # STATIC_BUILD Used for building import/export libraries
502 # on Windows.
503 #
504 # Sets the following vars:
505 # SHARED_BUILD Value of 1 or 0
506 #------------------------------------------------------------------------
507
508 AC_DEFUN([SC_ENABLE_SHARED], [
509 AC_MSG_CHECKING([how to build libraries])
510 AC_ARG_ENABLE(shared,
511 AS_HELP_STRING([--enable-shared],
512 [build and link with shared libraries (default: on)]),
513 [tcl_ok=$enableval], [tcl_ok=yes])
514 if test "$tcl_ok" = "yes" ; then
515 AC_MSG_RESULT([shared])
516 SHARED_BUILD=1
517 else
518 AC_MSG_RESULT([static])
519 SHARED_BUILD=0
520 AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?])
521 fi
522 AC_SUBST(SHARED_BUILD)
523 ])
524
525 #------------------------------------------------------------------------
526 # SC_ENABLE_FRAMEWORK --
527 #
528 # Allows the building of shared libraries into frameworks
529 #
530 # Arguments:
531 # none
532 #
533 # Results:
534 #
535 # Adds the following arguments to configure:
536 # --enable-framework=yes|no
537 #
538 # Sets the following vars:
539 # FRAMEWORK_BUILD Value of 1 or 0
540 #------------------------------------------------------------------------
541
542 AC_DEFUN([SC_ENABLE_FRAMEWORK], [
543 if test "`uname -s`" = "Darwin" ; then
544 AC_MSG_CHECKING([how to package libraries])
545 AC_ARG_ENABLE(framework,
546 AS_HELP_STRING([--enable-framework],
547 [package shared libraries in MacOSX frameworks (default: off)]),
548 [enable_framework=$enableval], [enable_framework=no])
549 if test $enable_framework = yes; then
550 if test $SHARED_BUILD = 0; then
551 AC_MSG_WARN([Frameworks can only be built if --enable-shared is yes])
552 enable_framework=no
553 fi
554 if test $tcl_corefoundation = no; then
555 AC_MSG_WARN([Frameworks can only be used when CoreFoundation is available])
556 enable_framework=no
557 fi
558 fi
559 if test $enable_framework = yes; then
560 AC_MSG_RESULT([framework])
561 FRAMEWORK_BUILD=1
562 else
563 if test $SHARED_BUILD = 1; then
564 AC_MSG_RESULT([shared library])
565 else
566 AC_MSG_RESULT([static library])
567 fi
568 FRAMEWORK_BUILD=0
569 fi
570 fi
571 ])
572
573 #------------------------------------------------------------------------
574 # SC_ENABLE_THREADS --
575 #
576 # Specify if thread support should be enabled
577 #
578 # Arguments:
579 # none
580 #
581 # Results:
582 #
583 # Adds the following arguments to configure:
584 # --enable-threads
585 #
586 # Sets the following vars:
587 # THREADS_LIBS Thread library(s)
588 #
589 # Defines the following vars:
590 # TCL_THREADS
591 # _REENTRANT
592 # _THREAD_SAFE
593 #------------------------------------------------------------------------
594
595 AC_DEFUN([SC_ENABLE_THREADS], [
596 AC_ARG_ENABLE(threads,
597 AS_HELP_STRING([--enable-threads],
598 [build with threads (default: on)]),
599 [tcl_ok=$enableval], [tcl_ok=yes])
600
601 if test "${TCL_THREADS}" = 1; then
602 tcl_threaded_core=1;
603 fi
604
605 if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
606 TCL_THREADS=1
607 # USE_THREAD_ALLOC tells us to try the special thread-based
608 # allocator that significantly reduces lock contention
609 AC_DEFINE(USE_THREAD_ALLOC, 1,
610 [Do we want to use the threaded memory allocator?])
611 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
612 if test "`uname -s`" = "SunOS" ; then
613 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
614 [Do we really want to follow the standard? Yes we do!])
615 fi
616 AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?])
617 AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
618 if test "$tcl_ok" = "no"; then
619 # Check a little harder for __pthread_mutex_init in the same
620 # library, as some systems hide it there until pthread.h is
621 # defined. We could alternatively do an AC_TRY_COMPILE with
622 # pthread.h, but that will work with libpthread really doesn't
623 # exist, like AIX 4.2. [Bug: 4359]
624 AC_CHECK_LIB(pthread, __pthread_mutex_init,
625 tcl_ok=yes, tcl_ok=no)
626 fi
627
628 if test "$tcl_ok" = "yes"; then
629 # The space is needed
630 THREADS_LIBS=" -lpthread"
631 else
632 AC_CHECK_LIB(pthreads, pthread_mutex_init,
633 tcl_ok=yes, tcl_ok=no)
634 if test "$tcl_ok" = "yes"; then
635 # The space is needed
636 THREADS_LIBS=" -lpthreads"
637 else
638 AC_CHECK_LIB(c, pthread_mutex_init,
639 tcl_ok=yes, tcl_ok=no)
640 if test "$tcl_ok" = "no"; then
641 AC_CHECK_LIB(c_r, pthread_mutex_init,
642 tcl_ok=yes, tcl_ok=no)
643 if test "$tcl_ok" = "yes"; then
644 # The space is needed
645 THREADS_LIBS=" -pthread"
646 else
647 TCL_THREADS=0
648 AC_MSG_WARN([Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...])
649 fi
650 fi
651 fi
652 fi
653
654 # Does the pthread-implementation provide
655 # 'pthread_attr_setstacksize' ?
656
657 ac_saved_libs=$LIBS
658 LIBS="$LIBS $THREADS_LIBS"
659 AC_CHECK_FUNCS(pthread_attr_setstacksize pthread_atfork)
660 LIBS=$ac_saved_libs
661 else
662 TCL_THREADS=0
663 fi
664 # Do checking message here to not mess up interleaved configure output
665 AC_MSG_CHECKING([for building with threads])
666 if test "${TCL_THREADS}" = 1; then
667 AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
668 if test "${tcl_threaded_core}" = 1; then
669 AC_MSG_RESULT([yes (threaded core)])
670 else
671 AC_MSG_RESULT([yes])
672 fi
673 else
674 AC_MSG_RESULT([no])
675 fi
676
677 AC_SUBST(TCL_THREADS)
678 ])
679
680 #------------------------------------------------------------------------
681 # SC_ENABLE_SYMBOLS --
682 #
683 # Specify if debugging symbols should be used.
684 # Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging
685 # can also be enabled.
686 #
687 # Arguments:
688 # none
689 #
690 # Requires the following vars to be set in the Makefile:
691 # CFLAGS_DEBUG
692 # CFLAGS_OPTIMIZE
693 # LDFLAGS_DEBUG
694 # LDFLAGS_OPTIMIZE
695 #
696 # Results:
697 #
698 # Adds the following arguments to configure:
699 # --enable-symbols
700 #
701 # Defines the following vars:
702 # CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
703 # Sets to $(CFLAGS_OPTIMIZE) if false
704 # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
705 # Sets to $(LDFLAGS_OPTIMIZE) if false
706 #------------------------------------------------------------------------
707
708 AC_DEFUN([SC_ENABLE_SYMBOLS], [
709 AC_MSG_CHECKING([for build with symbols])
710 AC_ARG_ENABLE(symbols,
711 AS_HELP_STRING([--enable-symbols],
712 [build with debugging symbols (default: off)]),
713 [tcl_ok=$enableval], [tcl_ok=no])
714 # FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
715 if test "$tcl_ok" = "no"; then
716 CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
717 LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
718 AC_DEFINE(NDEBUG, 1, [Is no debugging enabled?])
719 AC_MSG_RESULT([no])
720 AC_DEFINE(TCL_CFG_OPTIMIZED, 1, [Is this an optimized build?])
721 else
722 CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
723 LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
724 if test "$tcl_ok" = "yes"; then
725 AC_MSG_RESULT([yes (standard debugging)])
726 fi
727 fi
728 AC_SUBST(CFLAGS_DEFAULT)
729 AC_SUBST(LDFLAGS_DEFAULT)
730
731 if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
732 AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?])
733 fi
734
735 ifelse($1,bccdebug,dnl Only enable 'compile' for the Tcl core itself
736 if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
737 AC_DEFINE(TCL_COMPILE_DEBUG, 1, [Is bytecode debugging enabled?])
738 AC_DEFINE(TCL_COMPILE_STATS, 1, [Are bytecode statistics enabled?])
739 fi)
740
741 if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
742 if test "$tcl_ok" = "all"; then
743 AC_MSG_RESULT([enabled symbols mem ]ifelse($1,bccdebug,[compile ])[debugging])
744 else
745 AC_MSG_RESULT([enabled $tcl_ok debugging])
746 fi
747 fi
748 ])
749
750 #------------------------------------------------------------------------
751 # SC_ENABLE_LANGINFO --
752 #
753 # Allows use of modern nl_langinfo check for better l10n.
754 # This is only relevant for Unix.
755 #
756 # Arguments:
757 # none
758 #
759 # Results:
760 #
761 # Adds the following arguments to configure:
762 # --enable-langinfo=yes|no (default is yes)
763 #
764 # Defines the following vars:
765 # HAVE_LANGINFO Triggers use of nl_langinfo if defined.
766 #------------------------------------------------------------------------
767
768 AC_DEFUN([SC_ENABLE_LANGINFO], [
769 AC_ARG_ENABLE(langinfo,
770 AS_HELP_STRING([--enable-langinfo],
771 [use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]),
772 [langinfo_ok=$enableval], [langinfo_ok=yes])
773
774 HAVE_LANGINFO=0
775 if test "$langinfo_ok" = "yes"; then
776 AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
777 fi
778 AC_MSG_CHECKING([whether to use nl_langinfo])
779 if test "$langinfo_ok" = "yes"; then
780 AC_CACHE_VAL(tcl_cv_langinfo_h, [
781 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], [[nl_langinfo(CODESET);]])],
782 [tcl_cv_langinfo_h=yes], [tcl_cv_langinfo_h=no])])
783 AC_MSG_RESULT([$tcl_cv_langinfo_h])
784 if test $tcl_cv_langinfo_h = yes; then
785 AC_DEFINE(HAVE_LANGINFO, 1, [Do we have nl_langinfo()?])
786 fi
787 else
788 AC_MSG_RESULT([$langinfo_ok])
789 fi
790 ])
791
792 #--------------------------------------------------------------------
793 # SC_CONFIG_MANPAGES
794 #
795 # Decide whether to use symlinks for linking the manpages,
796 # whether to compress the manpages after installation, and
797 # whether to add a package name suffix to the installed
798 # manpages to avoidfile name clashes.
799 # If compression is enabled also find out what file name suffix
800 # the given compression program is using.
801 #
802 # Arguments:
803 # none
804 #
805 # Results:
806 #
807 # Adds the following arguments to configure:
808 # --enable-man-symlinks
809 # --enable-man-compression=PROG
810 # --enable-man-suffix[=STRING]
811 #
812 # Defines the following variable:
813 #
814 # MAN_FLAGS - The apropriate flags for installManPage
815 # according to the user's selection.
816 #
817 #--------------------------------------------------------------------
818
819 AC_DEFUN([SC_CONFIG_MANPAGES], [
820 AC_MSG_CHECKING([whether to use symlinks for manpages])
821 AC_ARG_ENABLE(man-symlinks,
822 AS_HELP_STRING([--enable-man-symlinks],
823 [use symlinks for the manpages (default: off)]),
824 [test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks"],
825 [enableval="no"])
826 AC_MSG_RESULT([$enableval])
827
828 AC_MSG_CHECKING([whether to compress the manpages])
829 AC_ARG_ENABLE(man-compression,
830 AS_HELP_STRING([--enable-man-compression=PROG],
831 [compress the manpages with PROG (default: off)]),
832 [case $enableval in
833 yes) AC_MSG_ERROR([missing argument to --enable-man-compression]);;
834 no) ;;
835 *) MAN_FLAGS="$MAN_FLAGS --compress $enableval";;
836 esac],
837 [enableval="no"])
838 AC_MSG_RESULT([$enableval])
839 if test "$enableval" != "no"; then
840 AC_MSG_CHECKING([for compressed file suffix])
841 touch TeST
842 $enableval TeST
843 Z=`ls TeST.* | sed 's/^....//'`
844 rm -f TeST*
845 MAN_FLAGS="$MAN_FLAGS --extension $Z"
846 AC_MSG_RESULT([$Z])
847 fi
848
849 AC_MSG_CHECKING([whether to add a package name suffix for the manpages])
850 AC_ARG_ENABLE(man-suffix,
851 AS_HELP_STRING([--enable-man-suffix=STRING],
852 [use STRING as a suffix to manpage file names (default: no, AC_PACKAGE_NAME if enabled without specifying STRING)]),
853 [case $enableval in
854 yes) enableval="AC_PACKAGE_NAME" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
855 no) ;;
856 *) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
857 esac],
858 [enableval="no"])
859 AC_MSG_RESULT([$enableval])
860
861 AC_SUBST(MAN_FLAGS)
862 ])
863
864 #--------------------------------------------------------------------
865 # SC_CONFIG_SYSTEM
866 #
867 # Determine what the system is (some things cannot be easily checked
868 # on a feature-driven basis, alas). This can usually be done via the
869 # "uname" command, but there are a few systems, like Next, where
870 # this doesn't work.
871 #
872 # Arguments:
873 # none
874 #
875 # Results:
876 # Defines the following var:
877 #
878 # system - System/platform/version identification code.
879 #
880 #--------------------------------------------------------------------
881
882 AC_DEFUN([SC_CONFIG_SYSTEM], [
883 AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
884 if test -f /usr/lib/NextStep/software_version; then
885 tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
886 else
887 tcl_cv_sys_version=`uname -s`-`uname -r`
888 if test "$?" -ne 0 ; then
889 AC_MSG_WARN([can't find uname command])
890 tcl_cv_sys_version=unknown
891 else
892 # Special check for weird MP-RAS system (uname returns weird
893 # results, and the version is kept in special file).
894
895 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
896 tcl_cv_sys_version=MP-RAS-`awk '{print $[3]}' /etc/.relid`
897 fi
898 if test "`uname -s`" = "AIX" ; then
899 tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
900 fi
901 if test "`uname -s`" = "NetBSD" -a -f /etc/debian_version ; then
902 tcl_cv_sys_version=NetBSD-Debian
903 fi
904 fi
905 fi
906 ])
907 system=$tcl_cv_sys_version
908 ])
909
910 #--------------------------------------------------------------------
911 # SC_CONFIG_CFLAGS
912 #
913 # Try to determine the proper flags to pass to the compiler
914 # for building shared libraries and other such nonsense.
915 #
916 # Arguments:
917 # none
918 #
919 # Results:
920 #
921 # Defines and substitutes the following vars:
922 #
923 # DL_OBJS - Name of the object file that implements dynamic
924 # loading for Tcl on this system.
925 # DL_LIBS - Library file(s) to include in tclsh and other base
926 # applications in order for the "load" command to work.
927 # LDFLAGS - Flags to pass to the compiler when linking object
928 # files into an executable application binary such
929 # as tclsh.
930 # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
931 # that tell the run-time dynamic linker where to look
932 # for shared libraries such as libtcl.so. Depends on
933 # the variable LIB_RUNTIME_DIR in the Makefile. Could
934 # be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
935 # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
936 # that tell the run-time dynamic linker where to look
937 # for shared libraries such as libtcl.so. Depends on
938 # the variable LIB_RUNTIME_DIR in the Makefile.
939 # MAKE_LIB - Command to execute to build the a library;
940 # differs when building shared or static.
941 # MAKE_STUB_LIB -
942 # Command to execute to build a stub library.
943 # INSTALL_LIB - Command to execute to install a library;
944 # differs when building shared or static.
945 # INSTALL_STUB_LIB -
946 # Command to execute to install a stub library.
947 # STLIB_LD - Base command to use for combining object files
948 # into a static library.
949 # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
950 # of a shared library (may request position-independent
951 # code, among other things).
952 # SHLIB_LD - Base command to use for combining object files
953 # into a shared library.
954 # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
955 # creating shared libraries. This symbol typically
956 # goes at the end of the "ld" commands that build
957 # shared libraries. The value of the symbol defaults to
958 # "${LIBS}" if all of the dependent libraries should
959 # be specified when creating a shared library. If
960 # dependent libraries should not be specified (as on
961 # SunOS 4.x, where they cause the link to fail, or in
962 # general if Tcl and Tk aren't themselves shared
963 # libraries), then this symbol has an empty string
964 # as its value.
965 # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
966 # extensions. An empty string means we don't know how
967 # to use shared libraries on this platform.
968 # TCL_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS
969 # TK_SHLIB_LD_EXTRAS for the build of Tcl and Tk, but not recorded in the
970 # tclConfig.sh, since they are only used for the build
971 # of Tcl and Tk.
972 # Examples: MacOS X records the library version and
973 # compatibility version in the shared library. But
974 # of course the Tcl version of this is only used for Tcl.
975 # LIB_SUFFIX - Specifies everything that comes after the "libfoo"
976 # in a static or shared library name, using the $VERSION variable
977 # to put the version in the right place. This is used
978 # by platforms that need non-standard library names.
979 # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
980 # to have a version after the .so, and ${VERSION}.a
981 # on AIX, since a shared library needs to have
982 # a .a extension whereas shared objects for loadable
983 # extensions have a .so extension. Defaults to
984 # ${VERSION}${SHLIB_SUFFIX}.
985 # TCL_LIBS -
986 # Libs to use when linking Tcl shell or some other
987 # shell that includes Tcl libs.
988 # CFLAGS_DEBUG -
989 # Flags used when running the compiler in debug mode
990 # CFLAGS_OPTIMIZE -
991 # Flags used when running the compiler in optimize mode
992 # CFLAGS - Additional CFLAGS added as necessary (usually 64-bit)
993 #
994 #--------------------------------------------------------------------
995
996 AC_DEFUN([SC_CONFIG_CFLAGS], [
997
998 # Step 0.a: Enable 64 bit support?
999
1000 AC_MSG_CHECKING([if 64bit support is requested])
1001 AC_ARG_ENABLE(64bit,
1002 AS_HELP_STRING([--enable-64bit],
1003 [enable 64bit support (default: off)]),
1004 [do64bit=$enableval], [do64bit=no])
1005 AC_MSG_RESULT([$do64bit])
1006
1007 # Step 0.b: Enable Solaris 64 bit VIS support?
1008
1009 AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
1010 AC_ARG_ENABLE(64bit-vis,
1011 AS_HELP_STRING([--enable-64bit-vis],
1012 [enable 64bit Sparc VIS support (default: off)]),
1013 [do64bitVIS=$enableval], [do64bitVIS=no])
1014 AC_MSG_RESULT([$do64bitVIS])
1015 # Force 64bit on with VIS
1016 AS_IF([test "$do64bitVIS" = "yes"], [do64bit=yes])
1017
1018 # Step 0.c: Check if visibility support is available. Do this here so
1019 # that platform specific alternatives can be used below if this fails.
1020
1021 AC_CACHE_CHECK([if compiler supports visibility "hidden"],
1022 tcl_cv_cc_visibility_hidden, [
1023 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
1024 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1025 extern __attribute__((__visibility__("hidden"))) void f(void);
1026 void f(void) {}]], [[f();]])],
1027 [tcl_cv_cc_visibility_hidden=yes],
1028 [tcl_cv_cc_visibility_hidden=no])
1029 CFLAGS=$hold_cflags])
1030 AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [
1031 AC_DEFINE(MODULE_SCOPE,
1032 [extern __attribute__((__visibility__("hidden")))],
1033 [Compiler support for module scope symbols])
1034 AC_DEFINE(HAVE_HIDDEN, [1], [Compiler support for module scope symbols])
1035 ])
1036
1037 # Step 0.d: Disable -rpath support?
1038
1039 AC_MSG_CHECKING([if rpath support is requested])
1040 AC_ARG_ENABLE(rpath,
1041 AS_HELP_STRING([--disable-rpath],
1042 [disable rpath support (default: on)]),
1043 [doRpath=$enableval], [doRpath=yes])
1044 AC_MSG_RESULT([$doRpath])
1045
1046 # Step 1: set the variable "system" to hold the name and version number
1047 # for the system.
1048
1049 SC_CONFIG_SYSTEM
1050
1051 # Step 2: check for existence of -ldl library. This is needed because
1052 # Linux can use either -ldl or -ldld for dynamic loading.
1053
1054 AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
1055
1056 # Require ranlib early so we can override it in special cases below.
1057
1058 AC_REQUIRE([AC_PROG_RANLIB])
1059
1060 # Step 3: set configuration options based on system name and version.
1061
1062 do64bit_ok=no
1063 # default to '{$LIBS}' and set to "" on per-platform necessary basis
1064 SHLIB_LD_LIBS='${LIBS}'
1065 LDFLAGS_ORIG="$LDFLAGS"
1066 # When ld needs options to work in 64-bit mode, put them in
1067 # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
1068 # is disabled by the user. [Bug 1016796]
1069 LDFLAGS_ARCH=""
1070 UNSHARED_LIB_SUFFIX=""
1071 TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
1072 ECHO_VERSION='`echo ${VERSION}`'
1073 TCL_LIB_VERSIONS_OK=ok
1074 CFLAGS_DEBUG=-g
1075 AS_IF([test "$GCC" = yes], [
1076 CFLAGS_OPTIMIZE=-O2
1077 CFLAGS_WARNING="-Wall -Wpointer-arith"
1078 ], [
1079 CFLAGS_OPTIMIZE=-O
1080 CFLAGS_WARNING=""
1081 ])
1082 AC_CHECK_TOOL(AR, ar)
1083 STLIB_LD='${AR} cr'
1084 LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
1085 PLAT_OBJS=""
1086 PLAT_SRCS=""
1087 LDAIX_SRC=""
1088 AS_IF([test "x${SHLIB_VERSION}" = x],[SHLIB_VERSION=".1.0"],[SHLIB_VERSION=".${SHLIB_VERSION}"])
1089 case $system in
1090 AIX-*)
1091 AS_IF([test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"], [
1092 # AIX requires the _r compiler when gcc isn't being used
1093 case "${CC}" in
1094 *_r|*_r\ *)
1095 # ok ...
1096 ;;
1097 *)
1098 # Make sure only first arg gets _r
1099 CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'`
1100 ;;
1101 esac
1102 AC_MSG_RESULT([Using $CC for compiling with threads])
1103 ])
1104 LIBS="$LIBS -lc"
1105 SHLIB_CFLAGS=""
1106 SHLIB_SUFFIX=".so"
1107
1108 DL_OBJS="tclLoadDl.o"
1109 LD_LIBRARY_PATH_VAR="LIBPATH"
1110
1111 # ldAix No longer needed with use of -bexpall/-brtl
1112 # but some extensions may still reference it
1113 LDAIX_SRC='$(UNIX_DIR)/ldAix'
1114
1115 # Check to enable 64-bit flags for compiler/linker
1116 AS_IF([test "$do64bit" = yes], [
1117 AS_IF([test "$GCC" = yes], [
1118 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1119 ], [
1120 do64bit_ok=yes
1121 CFLAGS="$CFLAGS -q64"
1122 LDFLAGS_ARCH="-q64"
1123 RANLIB="${RANLIB} -X64"
1124 AR="${AR} -X64"
1125 SHLIB_LD_FLAGS="-b64"
1126 ])
1127 ])
1128
1129 AS_IF([test "`uname -m`" = ia64], [
1130 # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
1131 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1132 # AIX-5 has dl* in libc.so
1133 DL_LIBS=""
1134 AS_IF([test "$GCC" = yes], [
1135 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1136 ], [
1137 CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
1138 ])
1139 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1140 ], [
1141 AS_IF([test "$GCC" = yes], [
1142 SHLIB_LD='${CC} -shared -Wl,-bexpall'
1143 ], [
1144 SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bexpall -H512 -T512 -bnoentry"
1145 LDFLAGS="$LDFLAGS -brtl"
1146 ])
1147 SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}"
1148 DL_LIBS="-ldl"
1149 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1150 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1151 ])
1152 ;;
1153 BeOS*)
1154 SHLIB_CFLAGS="-fPIC"
1155 SHLIB_LD='${CC} -nostart'
1156 SHLIB_SUFFIX=".so"
1157 DL_OBJS="tclLoadDl.o"
1158 DL_LIBS="-ldl"
1159
1160 #-----------------------------------------------------------
1161 # Check for inet_ntoa in -lbind, for BeOS (which also needs
1162 # -lsocket, even if the network functions are in -lnet which
1163 # is always linked to, for compatibility.
1164 #-----------------------------------------------------------
1165 AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
1166 ;;
1167 BSD/OS-2.1*|BSD/OS-3*)
1168 SHLIB_CFLAGS=""
1169 SHLIB_LD="shlicc -r"
1170 SHLIB_SUFFIX=".so"
1171 DL_OBJS="tclLoadDl.o"
1172 DL_LIBS="-ldl"
1173 CC_SEARCH_FLAGS=""
1174 LD_SEARCH_FLAGS=""
1175 ;;
1176 BSD/OS-4.*)
1177 SHLIB_CFLAGS="-export-dynamic -fPIC"
1178 SHLIB_LD='${CC} -shared'
1179 SHLIB_SUFFIX=".so"
1180 DL_OBJS="tclLoadDl.o"
1181 DL_LIBS="-ldl"
1182 LDFLAGS="$LDFLAGS -export-dynamic"
1183 CC_SEARCH_FLAGS=""
1184 LD_SEARCH_FLAGS=""
1185 ;;
1186 CYGWIN_*|MINGW32_*|MSYS_*)
1187 SHLIB_CFLAGS="-fno-common"
1188 SHLIB_LD='${CC} -shared'
1189 SHLIB_SUFFIX=".dll"
1190 DL_OBJS="tclLoadDl.o"
1191 PLAT_OBJS='${CYGWIN_OBJS}'
1192 PLAT_SRCS='${CYGWIN_SRCS}'
1193 DL_LIBS="-ldl"
1194 CC_SEARCH_FLAGS=""
1195 LD_SEARCH_FLAGS=""
1196 AC_CACHE_CHECK(for Cygwin version of gcc,
1197 ac_cv_cygwin,
1198 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1199 #ifdef __CYGWIN__
1200 #error cygwin
1201 #endif
1202 ]], [[]])],
1203 [ac_cv_cygwin=no],
1204 [ac_cv_cygwin=yes])
1205 )
1206 if test "$ac_cv_cygwin" = "no"; then
1207 AC_MSG_ERROR([${CC} is not a cygwin compiler.])
1208 fi
1209 if test "x${TCL_THREADS}" = "x0"; then
1210 AC_MSG_ERROR([CYGWIN compile is only supported with --enable-threads])
1211 fi
1212 do64bit_ok=yes
1213 if test "x${SHARED_BUILD}" = "x1"; then
1214 echo "running cd ../win; ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args --enable-64bit --host=x86_64-w64-mingw32"
1215 # The eval makes quoting arguments work.
1216 if cd ../win; eval ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args --enable-64bit --host=x86_64-w64-mingw32; cd ../unix
1217 then :
1218 else
1219 { echo "configure: error: configure failed for ../win" 1>&2; exit 1; }
1220 fi
1221 fi
1222 ;;
1223 dgux*)
1224 SHLIB_CFLAGS="-K PIC"
1225 SHLIB_LD='${CC} -G'
1226 SHLIB_LD_LIBS=""
1227 SHLIB_SUFFIX=".so"
1228 DL_OBJS="tclLoadDl.o"
1229 DL_LIBS="-ldl"
1230 CC_SEARCH_FLAGS=""
1231 LD_SEARCH_FLAGS=""
1232 ;;
1233 Haiku*)
1234 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1235 SHLIB_CFLAGS="-fPIC"
1236 SHLIB_SUFFIX=".so"
1237 SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared'
1238 DL_OBJS="tclLoadDl.o"
1239 DL_LIBS="-lroot"
1240 AC_CHECK_LIB(network, inet_ntoa, [LIBS="$LIBS -lnetwork"])
1241 ;;
1242 HP-UX-*.11.*)
1243 # Use updated header definitions where possible
1244 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Do we want to use the XOPEN network library?])
1245 AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
1246 LIBS="$LIBS -lxnet" # Use the XOPEN network library
1247
1248 AS_IF([test "`uname -m`" = ia64], [
1249 SHLIB_SUFFIX=".so"
1250 ], [
1251 SHLIB_SUFFIX=".sl"
1252 ])
1253 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1254 AS_IF([test "$tcl_ok" = yes], [
1255 SHLIB_CFLAGS="+z"
1256 SHLIB_LD="ld -b"
1257 DL_OBJS="tclLoadShl.o"
1258 DL_LIBS="-ldld"
1259 LDFLAGS="$LDFLAGS -Wl,-E"
1260 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1261 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1262 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1263 ])
1264 AS_IF([test "$GCC" = yes], [
1265 SHLIB_LD='${CC} -shared'
1266 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1267 ], [
1268 CFLAGS="$CFLAGS -z"
1269 ])
1270
1271 # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
1272 #CFLAGS="$CFLAGS +DAportable"
1273
1274 # Check to enable 64-bit flags for compiler/linker
1275 AS_IF([test "$do64bit" = "yes"], [
1276 AS_IF([test "$GCC" = yes], [
1277 case `${CC} -dumpmachine` in
1278 hppa64*)
1279 # 64-bit gcc in use. Fix flags for GNU ld.
1280 do64bit_ok=yes
1281 SHLIB_LD='${CC} -shared'
1282 AS_IF([test $doRpath = yes], [
1283 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1284 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1285 ;;
1286 *)
1287 AC_MSG_WARN([64bit mode not supported with GCC on $system])
1288 ;;
1289 esac
1290 ], [
1291 do64bit_ok=yes
1292 CFLAGS="$CFLAGS +DD64"
1293 LDFLAGS_ARCH="+DD64"
1294 ])
1295 ]) ;;
1296 HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
1297 SHLIB_SUFFIX=".sl"
1298 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1299 AS_IF([test "$tcl_ok" = yes], [
1300 SHLIB_CFLAGS="+z"
1301 SHLIB_LD="ld -b"
1302 SHLIB_LD_LIBS=""
1303 DL_OBJS="tclLoadShl.o"
1304 DL_LIBS="-ldld"
1305 LDFLAGS="$LDFLAGS -Wl,-E"
1306 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1307 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1308 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1309 ]) ;;
1310 IRIX-5.*)
1311 SHLIB_CFLAGS=""
1312 SHLIB_LD="ld -shared -rdata_shared"
1313 SHLIB_SUFFIX=".so"
1314 DL_OBJS="tclLoadDl.o"
1315 DL_LIBS=""
1316 AC_LIBOBJ(mkstemp)
1317 AS_IF([test $doRpath = yes], [
1318 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1319 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1320 ;;
1321 IRIX-6.*)
1322 SHLIB_CFLAGS=""
1323 SHLIB_LD="ld -n32 -shared -rdata_shared"
1324 SHLIB_SUFFIX=".so"
1325 DL_OBJS="tclLoadDl.o"
1326 DL_LIBS=""
1327 AC_LIBOBJ(mkstemp)
1328 AS_IF([test $doRpath = yes], [
1329 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1330 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1331 AS_IF([test "$GCC" = yes], [
1332 CFLAGS="$CFLAGS -mabi=n32"
1333 LDFLAGS="$LDFLAGS -mabi=n32"
1334 ], [
1335 case $system in
1336 IRIX-6.3)
1337 # Use to build 6.2 compatible binaries on 6.3.
1338 CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
1339 ;;
1340 *)
1341 CFLAGS="$CFLAGS -n32"
1342 ;;
1343 esac
1344 LDFLAGS="$LDFLAGS -n32"
1345 ])
1346 ;;
1347 IRIX64-6.*)
1348 SHLIB_CFLAGS=""
1349 SHLIB_LD="ld -n32 -shared -rdata_shared"
1350 SHLIB_SUFFIX=".so"
1351 DL_OBJS="tclLoadDl.o"
1352 DL_LIBS=""
1353 AC_LIBOBJ(mkstemp)
1354 AS_IF([test $doRpath = yes], [
1355 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1356 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1357
1358 # Check to enable 64-bit flags for compiler/linker
1359
1360 AS_IF([test "$do64bit" = yes], [
1361 AS_IF([test "$GCC" = yes], [
1362 AC_MSG_WARN([64bit mode not supported by gcc])
1363 ], [
1364 do64bit_ok=yes
1365 SHLIB_LD="ld -64 -shared -rdata_shared"
1366 CFLAGS="$CFLAGS -64"
1367 LDFLAGS_ARCH="-64"
1368 ])
1369 ])
1370 ;;
1371 Linux*|GNU*|NetBSD-Debian|DragonFly-*|FreeBSD-*)
1372 SHLIB_CFLAGS="-fPIC -fno-common"
1373 SHLIB_SUFFIX=".so"
1374
1375 CFLAGS_OPTIMIZE="-O2"
1376 # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
1377 # when you inline the string and math operations. Turn this off to
1378 # get rid of the warnings.
1379 #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
1380
1381 SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared'
1382 DL_OBJS="tclLoadDl.o"
1383 DL_LIBS="-ldl"
1384 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1385
1386 case $system in
1387 DragonFly-*|FreeBSD-*)
1388 AS_IF([test "${TCL_THREADS}" = "1"], [
1389 # The -pthread needs to go in the LDFLAGS, not LIBS
1390 LIBS=`echo $LIBS | sed s/-pthread//`
1391 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1392 LDFLAGS="$LDFLAGS $PTHREAD_LIBS"])
1393 ;;
1394 esac
1395
1396 AS_IF([test $doRpath = yes], [
1397 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1398 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1399 AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
1400 AS_IF([test $do64bit = yes], [
1401 AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
1402 hold_cflags=$CFLAGS
1403 CFLAGS="$CFLAGS -m64"
1404 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1405 [tcl_cv_cc_m64=yes],[tcl_cv_cc_m64=no])
1406 CFLAGS=$hold_cflags])
1407 AS_IF([test $tcl_cv_cc_m64 = yes], [
1408 CFLAGS="$CFLAGS -m64"
1409 do64bit_ok=yes
1410 ])
1411 ])
1412
1413 # The combo of gcc + glibc has a bug related to inlining of
1414 # functions like strtod(). The -fno-builtin flag should address
1415 # this problem but it does not work. The -fno-inline flag is kind
1416 # of overkill but it works. Disable inlining only when one of the
1417 # files in compat/*.c is being linked in.
1418
1419 AS_IF([test x"${USE_COMPAT}" != x],[CFLAGS="$CFLAGS -fno-inline"])
1420 ;;
1421 Lynx*)
1422 SHLIB_CFLAGS="-fPIC"
1423 SHLIB_SUFFIX=".so"
1424 CFLAGS_OPTIMIZE=-02
1425 SHLIB_LD='${CC} -shared'
1426 DL_OBJS="tclLoadDl.o"
1427 DL_LIBS="-mshared -ldl"
1428 LD_FLAGS="-Wl,--export-dynamic"
1429 AS_IF([test $doRpath = yes], [
1430 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1431 LD_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1432 ;;
1433 MP-RAS-02*)
1434 SHLIB_CFLAGS="-K PIC"
1435 SHLIB_LD='${CC} -G'
1436 SHLIB_LD_LIBS=""
1437 SHLIB_SUFFIX=".so"
1438 DL_OBJS="tclLoadDl.o"
1439 DL_LIBS="-ldl"
1440 CC_SEARCH_FLAGS=""
1441 LD_SEARCH_FLAGS=""
1442 ;;
1443 MP-RAS-*)
1444 SHLIB_CFLAGS="-K PIC"
1445 SHLIB_LD='${CC} -G'
1446 SHLIB_LD_LIBS=""
1447 SHLIB_SUFFIX=".so"
1448 DL_OBJS="tclLoadDl.o"
1449 DL_LIBS="-ldl"
1450 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1451 CC_SEARCH_FLAGS=""
1452 LD_SEARCH_FLAGS=""
1453 ;;
1454 OpenBSD-*)
1455 arch=`arch -s`
1456 case "$arch" in
1457 alpha|sparc64)
1458 SHLIB_CFLAGS="-fPIC"
1459 ;;
1460 *)
1461 SHLIB_CFLAGS="-fpic"
1462 ;;
1463 esac
1464 SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared'
1465 SHLIB_SUFFIX=".so"
1466 DL_OBJS="tclLoadDl.o"
1467 DL_LIBS=""
1468 AS_IF([test $doRpath = yes], [
1469 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1470 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1471 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
1472 LDFLAGS="-Wl,-export-dynamic"
1473 CFLAGS_OPTIMIZE="-O2"
1474 AS_IF([test "${TCL_THREADS}" = "1"], [
1475 # On OpenBSD: Compile with -pthread
1476 # Don't link with -lpthread
1477 LIBS=`echo $LIBS | sed s/-lpthread//`
1478 CFLAGS="$CFLAGS -pthread"
1479 ])
1480 # OpenBSD doesn't do version numbers with dots.
1481 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1482 TCL_LIB_VERSIONS_OK=nodots
1483 ;;
1484 NetBSD-*)
1485 # NetBSD has ELF and can use 'cc -shared' to build shared libs
1486 SHLIB_CFLAGS="-fPIC"
1487 SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared'
1488 SHLIB_SUFFIX=".so"
1489 DL_OBJS="tclLoadDl.o"
1490 DL_LIBS=""
1491 LDFLAGS="$LDFLAGS -export-dynamic"
1492 AS_IF([test $doRpath = yes], [
1493 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
1494 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1495 AS_IF([test "${TCL_THREADS}" = "1"], [
1496 # The -pthread needs to go in the CFLAGS, not LIBS
1497 LIBS=`echo $LIBS | sed s/-pthread//`
1498 CFLAGS="$CFLAGS -pthread"
1499 LDFLAGS="$LDFLAGS -pthread"
1500 ])
1501 ;;
1502 Darwin-*)
1503 CFLAGS_OPTIMIZE="-O2"
1504 SHLIB_CFLAGS="-fno-common"
1505 # To avoid discrepancies between what headers configure sees during
1506 # preprocessing tests and compiling tests, move any -isysroot and
1507 # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
1508 CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
1509 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1510 if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`"
1511 CFLAGS="`echo " ${CFLAGS}" | \
1512 awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1513 if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
1514 AS_IF([test $do64bit = yes], [
1515 case `arch` in
1516 ppc)
1517 AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
1518 tcl_cv_cc_arch_ppc64, [
1519 hold_cflags=$CFLAGS
1520 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1521 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1522 [tcl_cv_cc_arch_ppc64=yes],[tcl_cv_cc_arch_ppc64=no])
1523 CFLAGS=$hold_cflags])
1524 AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [
1525 CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1526 do64bit_ok=yes
1527 ]);;
1528 i386|x86_64)
1529 AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
1530 tcl_cv_cc_arch_x86_64, [
1531 hold_cflags=$CFLAGS
1532 CFLAGS="$CFLAGS -arch x86_64"
1533 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1534 [tcl_cv_cc_arch_x86_64=yes],[tcl_cv_cc_arch_x86_64=no])
1535 CFLAGS=$hold_cflags])
1536 AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [
1537 CFLAGS="$CFLAGS -arch x86_64"
1538 do64bit_ok=yes
1539 ]);;
1540 arm64)
1541 AC_CACHE_CHECK([if compiler accepts -arch arm64 flag],
1542 tcl_cv_cc_arch_arm64, [
1543 hold_cflags=$CFLAGS
1544 CFLAGS="$CFLAGS -arch arm64"
1545 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1546 [tcl_cv_cc_arch_arm64=yes],[tcl_cv_cc_arch_arm64=no])
1547 CFLAGS=$hold_cflags])
1548 AS_IF([test $tcl_cv_cc_arch_arm64 = yes], [
1549 CFLAGS="$CFLAGS -arch arm64"
1550 do64bit_ok=yes
1551 ]);;
1552 *)
1553 AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
1554 esac
1555 ], [
1556 # Check for combined 32-bit and 64-bit fat build
1557 AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64|arm64) ' \
1558 && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '], [
1559 fat_32_64=yes])
1560 ])
1561 SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}'
1562 AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
1563 hold_ldflags=$LDFLAGS
1564 LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
1565 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],[tcl_cv_ld_single_module=yes],
1566 [tcl_cv_ld_single_module=no])
1567 LDFLAGS=$hold_ldflags])
1568 AS_IF([test $tcl_cv_ld_single_module = yes], [
1569 SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
1570 ])
1571 SHLIB_SUFFIX=".dylib"
1572 DL_OBJS="tclLoadDyld.o"
1573 DL_LIBS=""
1574 LDFLAGS="$LDFLAGS -headerpad_max_install_names"
1575 AC_CACHE_CHECK([if ld accepts -search_paths_first flag],
1576 tcl_cv_ld_search_paths_first, [
1577 hold_ldflags=$LDFLAGS
1578 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1579 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],
1580 [tcl_cv_ld_search_paths_first=yes],
1581 [tcl_cv_ld_search_paths_first=no])
1582 LDFLAGS=$hold_ldflags])
1583 AS_IF([test $tcl_cv_ld_search_paths_first = yes], [
1584 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1585 ])
1586 AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
1587 AC_DEFINE(MODULE_SCOPE, [__private_extern__],
1588 [Compiler support for module scope symbols])
1589 tcl_cv_cc_visibility_hidden=yes
1590 ])
1591 CC_SEARCH_FLAGS=""
1592 LD_SEARCH_FLAGS=""
1593 LD_LIBRARY_PATH_VAR="DYLD_FALLBACK_LIBRARY_PATH"
1594 AC_DEFINE(MAC_OSX_TCL, 1, [Is this a Mac I see before me?])
1595 PLAT_OBJS='${MAC_OSX_OBJS}'
1596 PLAT_SRCS='${MAC_OSX_SRCS}'
1597 AC_MSG_CHECKING([whether to use CoreFoundation])
1598 AC_ARG_ENABLE(corefoundation,
1599 AS_HELP_STRING([--enable-corefoundation],
1600 [use CoreFoundation API on MacOSX (default: on)]),
1601 [tcl_corefoundation=$enableval], [tcl_corefoundation=yes])
1602 AC_MSG_RESULT([$tcl_corefoundation])
1603 AS_IF([test $tcl_corefoundation = yes], [
1604 AC_CACHE_CHECK([for CoreFoundation.framework],
1605 tcl_cv_lib_corefoundation, [
1606 hold_libs=$LIBS
1607 AS_IF([test "$fat_32_64" = yes], [
1608 for v in CFLAGS CPPFLAGS LDFLAGS; do
1609 # On Tiger there is no 64-bit CF, so remove 64-bit
1610 # archs from CFLAGS et al. while testing for
1611 # presence of CF. 64-bit CF is disabled in
1612 # tclUnixPort.h if necessary.
1613 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
1614 done])
1615 LIBS="$LIBS -framework CoreFoundation"
1616 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <CoreFoundation/CoreFoundation.h>]],
1617 [[CFBundleRef b = CFBundleGetMainBundle();]])],
1618 [tcl_cv_lib_corefoundation=yes],
1619 [tcl_cv_lib_corefoundation=no])
1620 AS_IF([test "$fat_32_64" = yes], [
1621 for v in CFLAGS CPPFLAGS LDFLAGS; do
1622 eval $v'="$hold_'$v'"'
1623 done])
1624 LIBS=$hold_libs])
1625 AS_IF([test $tcl_cv_lib_corefoundation = yes], [
1626 LIBS="$LIBS -framework CoreFoundation"
1627 AC_DEFINE(HAVE_COREFOUNDATION, 1,
1628 [Do we have access to Darwin CoreFoundation.framework?])
1629 ], [tcl_corefoundation=no])
1630 AS_IF([test "$fat_32_64" = yes -a $tcl_corefoundation = yes],[
1631 AC_CACHE_CHECK([for 64-bit CoreFoundation],
1632 tcl_cv_lib_corefoundation_64, [
1633 for v in CFLAGS CPPFLAGS LDFLAGS; do
1634 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
1635 done
1636 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <CoreFoundation/CoreFoundation.h>]],
1637 [[CFBundleRef b = CFBundleGetMainBundle();]])],
1638 [tcl_cv_lib_corefoundation_64=yes],
1639 [tcl_cv_lib_corefoundation_64=no])
1640 for v in CFLAGS CPPFLAGS LDFLAGS; do
1641 eval $v'="$hold_'$v'"'
1642 done])
1643 AS_IF([test $tcl_cv_lib_corefoundation_64 = no], [
1644 AC_DEFINE(NO_COREFOUNDATION_64, 1,
1645 [Is Darwin CoreFoundation unavailable for 64-bit?])
1646 LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings"
1647 ])
1648 ])
1649 ])
1650 ;;
1651 NEXTSTEP-*)
1652 SHLIB_CFLAGS=""
1653 SHLIB_LD='${CC} -nostdlib -r'
1654 SHLIB_LD_LIBS=""
1655 SHLIB_SUFFIX=".so"
1656 DL_OBJS="tclLoadNext.o"
1657 DL_LIBS=""
1658 CC_SEARCH_FLAGS=""
1659 LD_SEARCH_FLAGS=""
1660 ;;
1661 OS/390-*)
1662 SHLIB_LD_LIBS=""
1663 CFLAGS_OPTIMIZE="" # Optimizer is buggy
1664 AC_DEFINE(_OE_SOCKETS, 1, # needed in sys/socket.h
1665 [Should OS/390 do the right thing with sockets?])
1666 ;;
1667 OSF1-1.0|OSF1-1.1|OSF1-1.2)
1668 # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
1669 SHLIB_CFLAGS=""
1670 # Hack: make package name same as library name
1671 SHLIB_LD='ld -R -export $@:'
1672 SHLIB_LD_LIBS=""
1673 SHLIB_SUFFIX=".so"
1674 DL_OBJS="tclLoadOSF.o"
1675 DL_LIBS=""
1676 CC_SEARCH_FLAGS=""
1677 LD_SEARCH_FLAGS=""
1678 ;;
1679 OSF1-1.*)
1680 # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
1681 SHLIB_CFLAGS="-fPIC"
1682 AS_IF([test "$SHARED_BUILD" = 1], [SHLIB_LD="ld -shared"], [
1683 SHLIB_LD="ld -non_shared"
1684 ])
1685 SHLIB_LD_LIBS=""
1686 SHLIB_SUFFIX=".so"
1687 DL_OBJS="tclLoadDl.o"
1688 DL_LIBS=""
1689 CC_SEARCH_FLAGS=""
1690 LD_SEARCH_FLAGS=""
1691 ;;
1692 OSF1-V*)
1693 # Digital OSF/1
1694 SHLIB_CFLAGS=""
1695 AS_IF([test "$SHARED_BUILD" = 1], [
1696 SHLIB_LD='${CC} -shared'
1697 ], [
1698 SHLIB_LD='${CC} -non_shared'
1699 ])
1700 SHLIB_SUFFIX=".so"
1701 DL_OBJS="tclLoadDl.o"
1702 DL_LIBS=""
1703 AS_IF([test $doRpath = yes], [
1704 CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
1705 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1706 AS_IF([test "$GCC" = yes], [CFLAGS="$CFLAGS -mieee"], [
1707 CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"])
1708 # see pthread_intro(3) for pthread support on osf1, k.furukawa
1709 AS_IF([test "${TCL_THREADS}" = 1], [
1710 CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
1711 CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
1712 LIBS=`echo $LIBS | sed s/-lpthreads//`
1713 AS_IF([test "$GCC" = yes], [
1714 LIBS="$LIBS -lpthread -lmach -lexc"
1715 ], [
1716 CFLAGS="$CFLAGS -pthread"
1717 LDFLAGS="$LDFLAGS -pthread"
1718 ])
1719 ])
1720 ;;
1721 QNX-6*)
1722 # QNX RTP
1723 # This may work for all QNX, but it was only reported for v6.
1724 SHLIB_CFLAGS="-fPIC"
1725 SHLIB_LD="ld -Bshareable -x"
1726 SHLIB_LD_LIBS=""
1727 SHLIB_SUFFIX=".so"
1728 DL_OBJS="tclLoadDl.o"
1729 # dlopen is in -lc on QNX
1730 DL_LIBS=""
1731 CC_SEARCH_FLAGS=""
1732 LD_SEARCH_FLAGS=""
1733 ;;
1734 SCO_SV-3.2*)
1735 # Note, dlopen is available only on SCO 3.2.5 and greater. However,
1736 # this test works, since "uname -s" was non-standard in 3.2.4 and
1737 # below.
1738 AS_IF([test "$GCC" = yes], [
1739 SHLIB_CFLAGS="-fPIC -melf"
1740 LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
1741 ], [
1742 SHLIB_CFLAGS="-Kpic -belf"
1743 LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
1744 ])
1745 SHLIB_LD="ld -G"
1746 SHLIB_LD_LIBS=""
1747 SHLIB_SUFFIX=".so"
1748 DL_OBJS="tclLoadDl.o"
1749 DL_LIBS=""
1750 CC_SEARCH_FLAGS=""
1751 LD_SEARCH_FLAGS=""
1752 ;;
1753 SINIX*5.4*)
1754 SHLIB_CFLAGS="-K PIC"
1755 SHLIB_LD='${CC} -G'
1756 SHLIB_LD_LIBS=""
1757 SHLIB_SUFFIX=".so"
1758 DL_OBJS="tclLoadDl.o"
1759 DL_LIBS="-ldl"
1760 CC_SEARCH_FLAGS=""
1761 LD_SEARCH_FLAGS=""
1762 ;;
1763 SunOS-4*)
1764 SHLIB_CFLAGS="-PIC"
1765 SHLIB_LD="ld"
1766 SHLIB_LD_LIBS=""
1767 SHLIB_SUFFIX=".so"
1768 DL_OBJS="tclLoadDl.o"
1769 DL_LIBS="-ldl"
1770 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1771 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1772
1773 # SunOS can't handle version numbers with dots in them in library
1774 # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
1775 # requires an extra version number at the end of .so file names.
1776 # So, the library has to have a name like libtcl75.so.1.0
1777
1778 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
1779 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1780 TCL_LIB_VERSIONS_OK=nodots
1781 ;;
1782 SunOS-5.[[0-6]])
1783 # Careful to not let 5.10+ fall into this case
1784
1785 # Note: If _REENTRANT isn't defined, then Solaris
1786 # won't define thread-safe library routines.
1787
1788 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1789 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1790 [Do we really want to follow the standard? Yes we do!])
1791
1792 SHLIB_CFLAGS="-KPIC"
1793 SHLIB_SUFFIX=".so"
1794 DL_OBJS="tclLoadDl.o"
1795 DL_LIBS="-ldl"
1796 AS_IF([test "$GCC" = yes], [
1797 SHLIB_LD='${CC} -shared'
1798 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1799 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1800 ], [
1801 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1802 CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1803 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1804 ])
1805 ;;
1806 SunOS-5*)
1807 # Note: If _REENTRANT isn't defined, then Solaris
1808 # won't define thread-safe library routines.
1809
1810 AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1811 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1812 [Do we really want to follow the standard? Yes we do!])
1813
1814 SHLIB_CFLAGS="-KPIC"
1815
1816 # Check to enable 64-bit flags for compiler/linker
1817 AS_IF([test "$do64bit" = yes], [
1818 arch=`isainfo`
1819 AS_IF([test "$arch" = "sparcv9 sparc"], [
1820 AS_IF([test "$GCC" = yes], [
1821 AS_IF([test "`${CC} -dumpversion | awk -F. '{print [$]1}'`" -lt 3], [
1822 AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
1823 ], [
1824 do64bit_ok=yes
1825 CFLAGS="$CFLAGS -m64 -mcpu=v9"
1826 LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
1827 SHLIB_CFLAGS="-fPIC"
1828 ])
1829 ], [
1830 do64bit_ok=yes
1831 AS_IF([test "$do64bitVIS" = yes], [
1832 CFLAGS="$CFLAGS -xarch=v9a"
1833 LDFLAGS_ARCH="-xarch=v9a"
1834 ], [
1835 CFLAGS="$CFLAGS -xarch=v9"
1836 LDFLAGS_ARCH="-xarch=v9"
1837 ])
1838 # Solaris 64 uses this as well
1839 #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
1840 ])
1841 ], [AS_IF([test "$arch" = "amd64 i386"], [
1842 AS_IF([test "$GCC" = yes], [
1843 case $system in
1844 SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
1845 do64bit_ok=yes
1846 CFLAGS="$CFLAGS -m64"
1847 LDFLAGS="$LDFLAGS -m64";;
1848 *)
1849 AC_MSG_WARN([64bit mode not supported with GCC on $system]);;
1850 esac
1851 ], [
1852 do64bit_ok=yes
1853 case $system in
1854 SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
1855 CFLAGS="$CFLAGS -m64"
1856 LDFLAGS="$LDFLAGS -m64";;
1857 *)
1858 CFLAGS="$CFLAGS -xarch=amd64"
1859 LDFLAGS="$LDFLAGS -xarch=amd64";;
1860 esac
1861 ])
1862 ], [AC_MSG_WARN([64bit mode not supported for $arch])])])
1863 ])
1864
1865 #--------------------------------------------------------------------
1866 # On Solaris 5.x i386 with the sunpro compiler we need to link
1867 # with sunmath to get floating point rounding control
1868 #--------------------------------------------------------------------
1869 AS_IF([test "$GCC" = yes],[use_sunmath=no],[
1870 arch=`isainfo`
1871 AC_MSG_CHECKING([whether to use -lsunmath for fp rounding control])
1872 AS_IF([test "$arch" = "amd64 i386" -o "$arch" = "i386"], [
1873 AC_MSG_RESULT([yes])
1874 MATH_LIBS="-lsunmath $MATH_LIBS"
1875 AC_CHECK_HEADER(sunmath.h)
1876 use_sunmath=yes
1877 ], [
1878 AC_MSG_RESULT([no])
1879 use_sunmath=no
1880 ])
1881 ])
1882 SHLIB_SUFFIX=".so"
1883 DL_OBJS="tclLoadDl.o"
1884 DL_LIBS="-ldl"
1885 AS_IF([test "$GCC" = yes], [
1886 SHLIB_LD='${CC} -shared'
1887 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1888 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1889 AS_IF([test "$do64bit_ok" = yes], [
1890 AS_IF([test "$arch" = "sparcv9 sparc"], [
1891 # We need to specify -static-libgcc or we need to
1892 # add the path to the sparv9 libgcc.
1893 SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
1894 # for finding sparcv9 libgcc, get the regular libgcc
1895 # path, remove so name and append 'sparcv9'
1896 #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
1897 #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
1898 ], [AS_IF([test "$arch" = "amd64 i386"], [
1899 SHLIB_LD="$SHLIB_LD -m64 -static-libgcc"
1900 ])])
1901 ])
1902 ], [
1903 AS_IF([test "$use_sunmath" = yes], [textmode=textoff],[textmode=text])
1904 case $system in
1905 SunOS-5.[[1-9]][[0-9]]*|SunOS-5.[[7-9]])
1906 SHLIB_LD="\${CC} -G -z $textmode \${LDFLAGS}";;
1907 *)
1908 SHLIB_LD="/usr/ccs/bin/ld -G -z $textmode";;
1909 esac
1910 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1911 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1912 ])
1913 ;;
1914 UNIX_SV* | UnixWare-5*)
1915 SHLIB_CFLAGS="-KPIC"
1916 SHLIB_LD='${CC} -G'
1917 SHLIB_LD_LIBS=""
1918 SHLIB_SUFFIX=".so"
1919 DL_OBJS="tclLoadDl.o"
1920 DL_LIBS="-ldl"
1921 # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
1922 # that don't grok the -Bexport option. Test that it does.
1923 AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
1924 hold_ldflags=$LDFLAGS
1925 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1926 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],[tcl_cv_ld_Bexport=yes],[tcl_cv_ld_Bexport=no])
1927 LDFLAGS=$hold_ldflags])
1928 AS_IF([test $tcl_cv_ld_Bexport = yes], [
1929 LDFLAGS="$LDFLAGS -Wl,-Bexport"
1930 ])
1931 CC_SEARCH_FLAGS=""
1932 LD_SEARCH_FLAGS=""
1933 ;;
1934 esac
1935
1936 AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = no], [
1937 AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
1938 ])
1939
1940 AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = yes], [
1941 AC_DEFINE(TCL_CFG_DO64BIT, 1, [Is this a 64-bit build?])
1942 ])
1943
1944 dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
1945 dnl # until the end of configure, as configure's compile and link tests use
1946 dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
1947 dnl # preprocessing tests use only CPPFLAGS.
1948 AC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
1949
1950 # Step 4: disable dynamic loading if requested via a command-line switch.
1951
1952 AC_ARG_ENABLE(load,
1953 AS_HELP_STRING([--enable-load],
1954 [allow dynamic loading and "load" command (default: on)]),
1955 [tcl_ok=$enableval], [tcl_ok=yes])
1956 AS_IF([test "$tcl_ok" = no], [DL_OBJS=""])
1957
1958 AS_IF([test "x$DL_OBJS" != x], [BUILD_DLTEST="\$(DLTEST_TARGETS)"], [
1959 AC_MSG_WARN([Can't figure out how to do dynamic loading or shared libraries on this system.])
1960 SHLIB_CFLAGS=""
1961 SHLIB_LD=""
1962 SHLIB_SUFFIX=""
1963 DL_OBJS="tclLoadNone.o"
1964 DL_LIBS=""
1965 LDFLAGS="$LDFLAGS_ORIG"
1966 CC_SEARCH_FLAGS=""
1967 LD_SEARCH_FLAGS=""
1968 BUILD_DLTEST=""
1969 ])
1970 LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
1971
1972 # If we're running gcc, then change the C flags for compiling shared
1973 # libraries to the right flags for gcc, instead of those for the
1974 # standard manufacturer compiler.
1975
1976 AS_IF([test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes], [
1977 case $system in
1978 AIX-*) ;;
1979 BSD/OS*) ;;
1980 CYGWIN_*|MINGW32_*|MSYS_*) ;;
1981 HP-UX*) ;;
1982 Darwin-*) ;;
1983 IRIX*) ;;
1984 NetBSD-*|OpenBSD-*) ;;
1985 OSF1-*) ;;
1986 SCO_SV-3.2*) ;;
1987 *) SHLIB_CFLAGS="-fPIC" ;;
1988 esac])
1989
1990 AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
1991 AC_DEFINE(MODULE_SCOPE, [extern],
1992 [No Compiler support for module scope symbols])
1993 ])
1994
1995 AS_IF([test "$SHARED_LIB_SUFFIX" = ""], [
1996 SHARED_LIB_SUFFIX='${VERSION}${SHLIB_SUFFIX}'])
1997 AS_IF([test "$UNSHARED_LIB_SUFFIX" = ""], [
1998 UNSHARED_LIB_SUFFIX='${VERSION}.a'])
1999 DLL_INSTALL_DIR="\$(LIB_INSTALL_DIR)"
2000
2001 AS_IF([test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""], [
2002 LIB_SUFFIX=${SHARED_LIB_SUFFIX}
2003 MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${LDFLAGS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
2004 AS_IF([test "${SHLIB_SUFFIX}" = ".dll"], [
2005 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)"'
2006 DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)"
2007 ], [
2008 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"'
2009 ])
2010 ], [
2011 LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
2012
2013 AS_IF([test "$RANLIB" = ""], [
2014 MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}'
2015 ], [
2016 MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@'
2017 ])
2018 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"'
2019 ])
2020
2021 # Stub lib does not depend on shared/static configuration
2022 AS_IF([test "$RANLIB" = ""], [
2023 MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}'
2024 ], [
2025 MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@'
2026 ])
2027 INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)"'
2028
2029 # Define TCL_LIBS now that we know what DL_LIBS is.
2030 # The trick here is that we don't want to change the value of TCL_LIBS if
2031 # it is already set when tclConfig.sh had been loaded by Tk.
2032 AS_IF([test "x${TCL_LIBS}" = x], [
2033 TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}"])
2034 AC_SUBST(TCL_LIBS)
2035
2036 # See if the compiler supports casting to a union type.
2037 # This is used to stop gcc from printing a compiler
2038 # warning when initializing a union member.
2039
2040 AC_CACHE_CHECK(for cast to union support,
2041 tcl_cv_cast_to_union,
2042 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2043 union foo { int i; double d; };
2044 union foo f = (union foo) (int) 0;
2045 ]])],
2046 [tcl_cv_cast_to_union=yes],
2047 [tcl_cv_cast_to_union=no])
2048 )
2049 if test "$tcl_cv_cast_to_union" = "yes"; then
2050 AC_DEFINE(HAVE_CAST_TO_UNION, 1,
2051 [Defined when compiler supports casting to union type.])
2052 fi
2053 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fno-lto"
2054 AC_CACHE_CHECK(for working -fno-lto,
2055 ac_cv_nolto,
2056 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
2057 [ac_cv_nolto=yes],
2058 [ac_cv_nolto=no])
2059 )
2060 CFLAGS=$hold_cflags
2061 if test "$ac_cv_nolto" = "yes" ; then
2062 CFLAGS_NOLTO="-fno-lto"
2063 else
2064 CFLAGS_NOLTO=""
2065 fi
2066
2067 # Check for vfork, posix_spawnp() and friends unconditionally
2068 AC_CHECK_FUNCS(vfork posix_spawnp posix_spawn_file_actions_adddup2 posix_spawnattr_setflags)
2069
2070 # FIXME: This subst was left in only because the TCL_DL_LIBS
2071 # entry in tclConfig.sh uses it. It is not clear why someone
2072 # would use TCL_DL_LIBS instead of TCL_LIBS.
2073 AC_SUBST(DL_LIBS)
2074
2075 AC_SUBST(DL_OBJS)
2076 AC_SUBST(PLAT_OBJS)
2077 AC_SUBST(PLAT_SRCS)
2078 AC_SUBST(LDAIX_SRC)
2079 AC_SUBST(CFLAGS)
2080 AC_SUBST(CFLAGS_DEBUG)
2081 AC_SUBST(CFLAGS_OPTIMIZE)
2082 AC_SUBST(CFLAGS_WARNING)
2083 AC_SUBST(CFLAGS_NOLTO)
2084
2085 AC_SUBST(LDFLAGS)
2086 AC_SUBST(LDFLAGS_DEBUG)
2087 AC_SUBST(LDFLAGS_OPTIMIZE)
2088 AC_SUBST(CC_SEARCH_FLAGS)
2089 AC_SUBST(LD_SEARCH_FLAGS)
2090
2091 AC_SUBST(STLIB_LD)
2092 AC_SUBST(SHLIB_LD)
2093 AC_SUBST(TCL_SHLIB_LD_EXTRAS)
2094 AC_SUBST(TK_SHLIB_LD_EXTRAS)
2095 AC_SUBST(SHLIB_LD_LIBS)
2096 AC_SUBST(SHLIB_CFLAGS)
2097 AC_SUBST(SHLIB_SUFFIX)
2098 AC_DEFINE_UNQUOTED(TCL_SHLIB_EXT,"${SHLIB_SUFFIX}",
2099 [What is the default extension for shared libraries?])
2100
2101 AC_SUBST(MAKE_LIB)
2102 AC_SUBST(MAKE_STUB_LIB)
2103 AC_SUBST(INSTALL_LIB)
2104 AC_SUBST(DLL_INSTALL_DIR)
2105 AC_SUBST(INSTALL_STUB_LIB)
2106 AC_SUBST(RANLIB)
2107 ])
2108
2109 #--------------------------------------------------------------------
2110 # SC_MISSING_POSIX_HEADERS
2111 #
2112 # Supply substitutes for missing POSIX header files. Special
2113 # notes:
2114 # - stdlib.h doesn't define strtol, strtoul, or
2115 # strtod insome versions of SunOS
2116 # - some versions of string.h don't declare procedures such
2117 # as strstr
2118 #
2119 # Arguments:
2120 # none
2121 #
2122 # Results:
2123 #
2124 # Defines some of the following vars:
2125 # NO_DIRENT_H
2126 # NO_FLOAT_H
2127 # NO_VALUES_H
2128 # NO_STDLIB_H
2129 # NO_STRING_H
2130 # NO_SYS_WAIT_H
2131 # NO_DLFCN_H
2132 # HAVE_SYS_PARAM_H
2133 # HAVE_STRING_H ?
2134 #
2135 #--------------------------------------------------------------------
2136
2137 AC_DEFUN([SC_MISSING_POSIX_HEADERS], [
2138 AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [
2139 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2140 #include <dirent.h>]], [[
2141 #ifndef _POSIX_SOURCE
2142 # ifdef __Lynx__
2143 /*
2144 * Generate compilation error to make the test fail: Lynx headers
2145 * are only valid if really in the POSIX environment.
2146 */
2147
2148 missing_procedure();
2149 # endif
2150 #endif
2151 DIR *d;
2152 struct dirent *entryPtr;
2153 char *p;
2154 d = opendir("foobar");
2155 entryPtr = readdir(d);
2156 p = entryPtr->d_name;
2157 closedir(d);
2158 ]])],[tcl_cv_dirent_h=yes],[tcl_cv_dirent_h=no])])
2159
2160 if test $tcl_cv_dirent_h = no; then
2161 AC_DEFINE(NO_DIRENT_H, 1, [Do we have <dirent.h>?])
2162 fi
2163
2164 AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have <float.h>?])])
2165 AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have <values.h>?])])
2166 AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
2167 AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
2168 AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
2169 AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
2170 if test $tcl_ok = 0; then
2171 AC_DEFINE(NO_STDLIB_H, 1, [Do we have <stdlib.h>?])
2172 fi
2173 AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
2174 AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
2175 AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
2176
2177 # See also memmove check below for a place where NO_STRING_H can be
2178 # set and why.
2179
2180 if test $tcl_ok = 0; then
2181 AC_DEFINE(NO_STRING_H, 1, [Do we have <string.h>?])
2182 fi
2183
2184 AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H, 1, [Do we have <sys/wait.h>?])])
2185 AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H, 1, [Do we have <dlfcn.h>?])])
2186
2187 # OS/390 lacks sys/param.h (and doesn't need it, by chance).
2188 AC_CHECK_HEADERS([sys/param.h])
2189 ])
2190
2191 #--------------------------------------------------------------------
2192 # SC_PATH_X
2193 #
2194 # Locate the X11 header files and the X11 library archive. Try
2195 # the ac_path_x macro first, but if it doesn't find the X stuff
2196 # (e.g. because there's no xmkmf program) then check through
2197 # a list of possible directories. Under some conditions the
2198 # autoconf macro will return an include directory that contains
2199 # no include files, so double-check its result just to be safe.
2200 #
2201 # Arguments:
2202 # none
2203 #
2204 # Results:
2205 #
2206 # Sets the following vars:
2207 # XINCLUDES
2208 # XLIBSW
2209 #
2210 #--------------------------------------------------------------------
2211
2212 AC_DEFUN([SC_PATH_X], [
2213 AC_PATH_X
2214 not_really_there=""
2215 if test "$no_x" = ""; then
2216 if test "$x_includes" = ""; then
2217 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <X11/Xlib.h>]])],[],[not_really_there="yes"])
2218 else
2219 if test ! -r $x_includes/X11/Xlib.h; then
2220 not_really_there="yes"
2221 fi
2222 fi
2223 fi
2224 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
2225 AC_MSG_CHECKING([for X11 header files])
2226 found_xincludes="no"
2227 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <X11/Xlib.h>]])],[found_xincludes="yes"],[found_xincludes="no"])
2228 if test "$found_xincludes" = "no"; then
2229 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"
2230 for i in $dirs ; do
2231 if test -r $i/X11/Xlib.h; then
2232 AC_MSG_RESULT([$i])
2233 XINCLUDES=" -I$i"
2234 found_xincludes="yes"
2235 break
2236 fi
2237 done
2238 fi
2239 else
2240 if test "$x_includes" != ""; then
2241 XINCLUDES="-I$x_includes"
2242 found_xincludes="yes"
2243 fi
2244 fi
2245 if test "$found_xincludes" = "no"; then
2246 AC_MSG_RESULT([couldn't find any!])
2247 fi
2248
2249 if test "$no_x" = yes; then
2250 AC_MSG_CHECKING([for X11 libraries])
2251 XLIBSW=nope
2252 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"
2253 for i in $dirs ; do
2254 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl -o -r $i/libX11.dylib; then
2255 AC_MSG_RESULT([$i])
2256 XLIBSW="-L$i -lX11"
2257 x_libraries="$i"
2258 break
2259 fi
2260 done
2261 else
2262 if test "$x_libraries" = ""; then
2263 XLIBSW=-lX11
2264 else
2265 XLIBSW="-L$x_libraries -lX11"
2266 fi
2267 fi
2268 if test "$XLIBSW" = nope ; then
2269 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
2270 fi
2271 if test "$XLIBSW" = nope ; then
2272 AC_MSG_RESULT([could not find any! Using -lX11.])
2273 XLIBSW=-lX11
2274 fi
2275 ])
2276
2277 #--------------------------------------------------------------------
2278 # SC_BLOCKING_STYLE
2279 #
2280 # The statements below check for systems where POSIX-style
2281 # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
2282 # On these systems (mostly older ones), use the old BSD-style
2283 # FIONBIO approach instead.
2284 #
2285 # Arguments:
2286 # none
2287 #
2288 # Results:
2289 #
2290 # Defines some of the following vars:
2291 # HAVE_SYS_IOCTL_H
2292 # HAVE_SYS_FILIO_H
2293 # USE_FIONBIO
2294 # O_NONBLOCK
2295 #
2296 #--------------------------------------------------------------------
2297
2298 AC_DEFUN([SC_BLOCKING_STYLE], [
2299 AC_CHECK_HEADERS(sys/ioctl.h)
2300 AC_CHECK_HEADERS(sys/filio.h)
2301 SC_CONFIG_SYSTEM
2302 AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
2303 case $system in
2304 OSF*)
2305 AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
2306 AC_MSG_RESULT([FIONBIO])
2307 ;;
2308 SunOS-4*)
2309 AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
2310 AC_MSG_RESULT([FIONBIO])
2311 ;;
2312 *)
2313 AC_MSG_RESULT([O_NONBLOCK])
2314 ;;
2315 esac
2316 ])
2317
2318 #--------------------------------------------------------------------
2319 # SC_TIME_HANLDER
2320 #
2321 # Checks how the system deals with time.h, what time structures
2322 # are used on the system, and what fields the structures have.
2323 #
2324 # Arguments:
2325 # none
2326 #
2327 # Results:
2328 #
2329 # Defines some of the following vars:
2330 # USE_DELTA_FOR_TZ
2331 # HAVE_TM_GMTOFF
2332 # HAVE_TM_TZADJ
2333 # HAVE_TIMEZONE_VAR
2334 #
2335 #--------------------------------------------------------------------
2336
2337 AC_DEFUN([SC_TIME_HANDLER], [
2338 AC_CHECK_HEADERS(sys/time.h)
2339 AC_HEADER_TIME
2340
2341 AC_CHECK_FUNCS(gmtime_r localtime_r mktime)
2342
2343 AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
2344 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm tm; (void)tm.tm_tzadj;]])],
2345 [tcl_cv_member_tm_tzadj=yes],
2346 [tcl_cv_member_tm_tzadj=no])])
2347 if test $tcl_cv_member_tm_tzadj = yes ; then
2348 AC_DEFINE(HAVE_TM_TZADJ, 1, [Should we use the tm_tzadj field of struct tm?])
2349 fi
2350
2351 AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
2352 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm tm; (void)tm.tm_gmtoff;]])],
2353 [tcl_cv_member_tm_gmtoff=yes],
2354 [tcl_cv_member_tm_gmtoff=no])])
2355 if test $tcl_cv_member_tm_gmtoff = yes ; then
2356 AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?])
2357 fi
2358
2359 #
2360 # Its important to include time.h in this check, as some systems
2361 # (like convex) have timezone functions, etc.
2362 #
2363 AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
2364 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>
2365 #include <stdlib.h>]],
2366 [[extern long timezone;
2367 timezone += 1;
2368 exit (0);]])],
2369 [tcl_cv_timezone_long=yes], [tcl_cv_timezone_long=no])])
2370 if test $tcl_cv_timezone_long = yes ; then
2371 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2372 else
2373 #
2374 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
2375 #
2376 AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
2377 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>
2378 #include <stdlib.h>]],
2379 [[extern time_t timezone;
2380 timezone += 1;
2381 exit (0);]])],
2382 [tcl_cv_timezone_time=yes], [tcl_cv_timezone_time=no])])
2383 if test $tcl_cv_timezone_time = yes ; then
2384 AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2385 fi
2386 fi
2387 ])
2388
2389 #--------------------------------------------------------------------
2390 # SC_TCL_LINK_LIBS
2391 #
2392 # Search for the libraries needed to link the Tcl shell.
2393 # Things like the math library (-lm), socket stuff (-lsocket vs.
2394 # -lnsl), zlib (-lz) and libtommath (-ltommath) are dealt with here.
2395 #
2396 # Arguments:
2397 # None.
2398 #
2399 # Results:
2400 #
2401 # Might append to the following vars:
2402 # LIBS
2403 # MATH_LIBS
2404 #
2405 # Might define the following vars:
2406 # HAVE_NET_ERRNO_H
2407 #
2408 #--------------------------------------------------------------------
2409
2410 AC_DEFUN([SC_TCL_LINK_LIBS], [
2411 #--------------------------------------------------------------------
2412 # On a few very rare systems, all of the libm.a stuff is
2413 # already in libc.a. Set compiler flags accordingly.
2414 #--------------------------------------------------------------------
2415
2416 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
2417
2418 #--------------------------------------------------------------------
2419 # Interactive UNIX requires -linet instead of -lsocket, plus it
2420 # needs net/errno.h to define the socket-related error codes.
2421 #--------------------------------------------------------------------
2422
2423 AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
2424 AC_CHECK_HEADER(net/errno.h, [
2425 AC_DEFINE(HAVE_NET_ERRNO_H, 1, [Do we have <net/errno.h>?])])
2426
2427 #--------------------------------------------------------------------
2428 # Check for the existence of the -lsocket and -lnsl libraries.
2429 # The order here is important, so that they end up in the right
2430 # order in the command line generated by make. Here are some
2431 # special considerations:
2432 # 1. Use "connect" and "accept" to check for -lsocket, and
2433 # "gethostbyname" to check for -lnsl.
2434 # 2. Use each function name only once: can't redo a check because
2435 # autoconf caches the results of the last check and won't redo it.
2436 # 3. Use -lnsl and -lsocket only if they supply procedures that
2437 # aren't already present in the normal libraries. This is because
2438 # IRIX 5.2 has libraries, but they aren't needed and they're
2439 # bogus: they goof up name resolution if used.
2440 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
2441 # To get around this problem, check for both libraries together
2442 # if -lsocket doesn't work by itself.
2443 #--------------------------------------------------------------------
2444
2445 tcl_checkBoth=0
2446 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
2447 if test "$tcl_checkSocket" = 1; then
2448 AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
2449 LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
2450 fi
2451 if test "$tcl_checkBoth" = 1; then
2452 tk_oldLibs=$LIBS
2453 LIBS="$LIBS -lsocket -lnsl"
2454 AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
2455 fi
2456 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
2457 [LIBS="$LIBS -lnsl"])])
2458 ])
2459
2460 #--------------------------------------------------------------------
2461 # SC_TCL_EARLY_FLAGS
2462 #
2463 # Check for what flags are needed to be passed so the correct OS
2464 # features are available.
2465 #
2466 # Arguments:
2467 # None
2468 #
2469 # Results:
2470 #
2471 # Might define the following vars:
2472 # _ISOC99_SOURCE
2473 # _LARGEFILE64_SOURCE
2474 #
2475 #--------------------------------------------------------------------
2476
2477 AC_DEFUN([SC_TCL_EARLY_FLAG],[
2478 AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
2479 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])],
2480 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[[#define ]$1[ ]m4_default([$4],[1])[
2481 ]$2]], [[$3]])],
2482 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
2483 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)]))
2484 if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
2485 AC_DEFINE($1, m4_default([$4],[1]), [Add the ]$1[ flag when building])
2486 tcl_flags="$tcl_flags $1"
2487 fi
2488 ])
2489
2490 AC_DEFUN([SC_TCL_EARLY_FLAGS],[
2491 AC_MSG_CHECKING([for required early compiler flags])
2492 tcl_flags=""
2493 SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
2494 [char *p = (char *)strtoll; char *q = (char *)strtoull;])
2495 SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
2496 [struct stat64 buf; int i = stat64("/", &buf);])
2497 if test "x${tcl_flags}" = "x" ; then
2498 AC_MSG_RESULT([none])
2499 else
2500 AC_MSG_RESULT([${tcl_flags}])
2501 fi
2502 ])
2503
2504 #--------------------------------------------------------------------
2505 # SC_TCL_64BIT_FLAGS
2506 #
2507 # Check for what is defined in the way of 64-bit features.
2508 #
2509 # Arguments:
2510 # None
2511 #
2512 # Results:
2513 #
2514 # Might define the following vars:
2515 # TCL_WIDE_INT_IS_LONG
2516 # TCL_WIDE_INT_TYPE
2517 # HAVE_STRUCT_DIRENT64, HAVE_DIR64
2518 # HAVE_STRUCT_STAT64
2519 # HAVE_TYPE_OFF64_T
2520 #
2521 #--------------------------------------------------------------------
2522
2523 AC_DEFUN([SC_TCL_64BIT_FLAGS], [
2524 AC_MSG_CHECKING([for 64-bit integer type])
2525 AC_CACHE_VAL(tcl_cv_type_64bit,[
2526 tcl_cv_type_64bit=none
2527 # See if the compiler knows natively about __int64
2528 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[__int64 value = (__int64) 0;]])],
2529 [tcl_type_64bit=__int64], [tcl_type_64bit="long long"])
2530 # See if we should use long anyway Note that we substitute in the
2531 # type that is our current guess for a 64-bit type inside this check
2532 # program, so it should be modified only carefully...
2533 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[switch (0) {
2534 case 1: case (sizeof(${tcl_type_64bit})==sizeof(long)): ;
2535 }]])],[tcl_cv_type_64bit=${tcl_type_64bit}],[])])
2536 if test "${tcl_cv_type_64bit}" = none ; then
2537 AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Are wide integers to be implemented with C 'long's?])
2538 AC_MSG_RESULT([using long])
2539 else
2540 AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
2541 [What type should be used to define wide integers?])
2542 AC_MSG_RESULT([${tcl_cv_type_64bit}])
2543
2544 # Now check for auxiliary declarations
2545 AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
2546 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2547 #include <dirent.h>]], [[struct dirent64 p;]])],
2548 [tcl_cv_struct_dirent64=yes],[tcl_cv_struct_dirent64=no])])
2549 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
2550 AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?])
2551 fi
2552
2553 AC_CACHE_CHECK([for DIR64], tcl_cv_DIR64,[
2554 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2555 #include <dirent.h>]], [[struct dirent64 *p; DIR64 d = opendir64(".");
2556 p = readdir64(d); rewinddir64(d); closedir64(d);]])],
2557 [tcl_cv_DIR64=yes], [tcl_cv_DIR64=no])])
2558 if test "x${tcl_cv_DIR64}" = "xyes" ; then
2559 AC_DEFINE(HAVE_DIR64, 1, [Is 'DIR64' in <sys/types.h>?])
2560 fi
2561
2562 AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
2563 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[struct stat64 p;
2564 ]])],
2565 [tcl_cv_struct_stat64=yes], [tcl_cv_struct_stat64=no])])
2566 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
2567 AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in <sys/stat.h>?])
2568 fi
2569
2570 AC_CHECK_FUNCS(open64 lseek64)
2571 AC_MSG_CHECKING([for off64_t])
2572 AC_CACHE_VAL(tcl_cv_type_off64_t,[
2573 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], [[off64_t offset;
2574 ]])],
2575 [tcl_cv_type_off64_t=yes], [tcl_cv_type_off64_t=no])])
2576 dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
2577 dnl functions lseek64 and open64 are defined.
2578 if test "x${tcl_cv_type_off64_t}" = "xyes" && \
2579 test "x${ac_cv_func_lseek64}" = "xyes" && \
2580 test "x${ac_cv_func_open64}" = "xyes" ; then
2581 AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in <sys/types.h>?])
2582 AC_MSG_RESULT([yes])
2583 else
2584 AC_MSG_RESULT([no])
2585 fi
2586 fi
2587 ])
2588
2589 #--------------------------------------------------------------------
2590 # SC_TCL_CFG_ENCODING TIP #59
2591 #
2592 # Declare the encoding to use for embedded configuration information.
2593 #
2594 # Arguments:
2595 # None.
2596 #
2597 # Results:
2598 # Might append to the following vars:
2599 # DEFS (implicit)
2600 #
2601 # Will define the following vars:
2602 # TCL_CFGVAL_ENCODING
2603 #
2604 #--------------------------------------------------------------------
2605
2606 AC_DEFUN([SC_TCL_CFG_ENCODING], [
2607 AC_ARG_WITH(encoding,
2608 AS_HELP_STRING([--with-encoding],
2609 [encoding for configuration values (default: iso8859-1)]),
2610 [with_tcencoding=${withval}])
2611
2612 if test x"${with_tcencoding}" != x ; then
2613 AC_DEFINE_UNQUOTED(TCL_CFGVAL_ENCODING,"${with_tcencoding}",
2614 [What encoding should be used for embedded configuration info?])
2615 else
2616 AC_DEFINE(TCL_CFGVAL_ENCODING,"iso8859-1",
2617 [What encoding should be used for embedded configuration info?])
2618 fi
2619 ])
2620
2621 #--------------------------------------------------------------------
2622 # SC_TCL_CHECK_BROKEN_FUNC
2623 #
2624 # Check for broken function.
2625 #
2626 # Arguments:
2627 # funcName - function to test for
2628 # advancedTest - the advanced test to run if the function is present
2629 #
2630 # Results:
2631 # Might cause compatibility versions of the function to be used.
2632 # Might affect the following vars:
2633 # USE_COMPAT (implicit)
2634 #
2635 #--------------------------------------------------------------------
2636
2637 AC_DEFUN([SC_TCL_CHECK_BROKEN_FUNC],[
2638 AC_CHECK_FUNC($1, tcl_ok=1, tcl_ok=0)
2639 if test ["$tcl_ok"] = 1; then
2640 AC_CACHE_CHECK([proper ]$1[ implementation], [tcl_cv_]$1[_unbroken],
2641 AC_RUN_IFELSE([AC_LANG_SOURCE([[[
2642 #include <stdlib.h>
2643 #include <string.h>
2644 int main() {]$2[}]]])],[tcl_cv_$1_unbroken=ok],
2645 [tcl_cv_$1_unbroken=broken],[tcl_cv_$1_unbroken=unknown]))
2646 if test ["$tcl_cv_]$1[_unbroken"] = "ok"; then
2647 tcl_ok=1
2648 else
2649 tcl_ok=0
2650 fi
2651 fi
2652 if test ["$tcl_ok"] = 0; then
2653 AC_LIBOBJ($1)
2654 USE_COMPAT=1
2655 fi
2656 ])
2657
2658 #--------------------------------------------------------------------
2659 # SC_TCL_GETHOSTBYADDR_R
2660 #
2661 # Check if we have MT-safe variant of gethostbyaddr().
2662 #
2663 # Arguments:
2664 # None
2665 #
2666 # Results:
2667 #
2668 # Might define the following vars:
2669 # HAVE_GETHOSTBYADDR_R
2670 # HAVE_GETHOSTBYADDR_R_7
2671 # HAVE_GETHOSTBYADDR_R_8
2672 #
2673 #--------------------------------------------------------------------
2674
2675 AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [
2676 # Avoids picking hidden internal symbol from libc
2677 SC_TCL_GETHOSTBYADDR_R_DECL
2678
2679 if test "$tcl_cv_api_gethostbyaddr_r" = yes; then
2680 SC_TCL_GETHOSTBYADDR_R_TYPE
2681 fi
2682 ])
2683
2684 AC_DEFUN([SC_TCL_GETHOSTBYADDR_R_DECL], [AC_CHECK_DECLS(gethostbyaddr_r, [
2685 tcl_cv_api_gethostbyaddr_r=yes],[tcl_cv_api_gethostbyaddr_r=no],[#include <netdb.h>])
2686 ])
2687
2688 AC_DEFUN([SC_TCL_GETHOSTBYADDR_R_TYPE], [AC_CHECK_FUNC(gethostbyaddr_r, [
2689 AC_CACHE_CHECK([for gethostbyaddr_r with 7 args], tcl_cv_api_gethostbyaddr_r_7, [
2690 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2691 #include <netdb.h>
2692 ]], [[
2693 char *addr;
2694 int length;
2695 int type;
2696 struct hostent *result;
2697 char buffer[2048];
2698 int buflen = 2048;
2699 int h_errnop;
2700
2701 (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
2702 &h_errnop);
2703 ]])],[tcl_cv_api_gethostbyaddr_r_7=yes],[tcl_cv_api_gethostbyaddr_r_7=no])])
2704 tcl_ok=$tcl_cv_api_gethostbyaddr_r_7
2705 if test "$tcl_ok" = yes; then
2706 AC_DEFINE(HAVE_GETHOSTBYADDR_R_7, 1,
2707 [Define to 1 if gethostbyaddr_r takes 7 args.])
2708 else
2709 AC_CACHE_CHECK([for gethostbyaddr_r with 8 args], tcl_cv_api_gethostbyaddr_r_8, [
2710 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2711 #include <netdb.h>
2712 ]], [[
2713 char *addr;
2714 int length;
2715 int type;
2716 struct hostent *result, *resultp;
2717 char buffer[2048];
2718 int buflen = 2048;
2719 int h_errnop;
2720
2721 (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
2722 &resultp, &h_errnop);
2723 ]])],[tcl_cv_api_gethostbyaddr_r_8=yes],[tcl_cv_api_gethostbyaddr_r_8=no])])
2724 tcl_ok=$tcl_cv_api_gethostbyaddr_r_8
2725 if test "$tcl_ok" = yes; then
2726 AC_DEFINE(HAVE_GETHOSTBYADDR_R_8, 1,
2727 [Define to 1 if gethostbyaddr_r takes 8 args.])
2728 fi
2729 fi
2730 if test "$tcl_ok" = yes; then
2731 AC_DEFINE(HAVE_GETHOSTBYADDR_R, 1,
2732 [Define to 1 if gethostbyaddr_r is available.])
2733 fi
2734 ])])
2735
2736 #--------------------------------------------------------------------
2737 # SC_TCL_GETHOSTBYNAME_R
2738 #
2739 # Check to see what variant of gethostbyname_r() we have.
2740 # Based on David Arnold's example from the comp.programming.threads
2741 # FAQ Q213
2742 #
2743 # Arguments:
2744 # None
2745 #
2746 # Results:
2747 #
2748 # Might define the following vars:
2749 # HAVE_GETHOSTBYNAME_R
2750 # HAVE_GETHOSTBYNAME_R_3
2751 # HAVE_GETHOSTBYNAME_R_5
2752 # HAVE_GETHOSTBYNAME_R_6
2753 #
2754 #--------------------------------------------------------------------
2755
2756 AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [
2757 # Avoids picking hidden internal symbol from libc
2758 SC_TCL_GETHOSTBYNAME_R_DECL
2759
2760 if test "$tcl_cv_api_gethostbyname_r" = yes; then
2761 SC_TCL_GETHOSTBYNAME_R_TYPE
2762 fi
2763 ])
2764
2765 AC_DEFUN([SC_TCL_GETHOSTBYNAME_R_DECL], [AC_CHECK_DECLS(gethostbyname_r, [
2766 tcl_cv_api_gethostbyname_r=yes],[tcl_cv_api_gethostbyname_r=no],[#include <netdb.h>])
2767 ])
2768
2769 AC_DEFUN([SC_TCL_GETHOSTBYNAME_R_TYPE], [AC_CHECK_FUNC(gethostbyname_r, [
2770 AC_CACHE_CHECK([for gethostbyname_r with 6 args], tcl_cv_api_gethostbyname_r_6, [
2771 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2772 #include <netdb.h>
2773 ]], [[
2774 char *name;
2775 struct hostent *he, *res;
2776 char buffer[2048];
2777 int buflen = 2048;
2778 int h_errnop;
2779
2780 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop);
2781 ]])],[tcl_cv_api_gethostbyname_r_6=yes],[tcl_cv_api_gethostbyname_r_6=no])])
2782 tcl_ok=$tcl_cv_api_gethostbyname_r_6
2783 if test "$tcl_ok" = yes; then
2784 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1,
2785 [Define to 1 if gethostbyname_r takes 6 args.])
2786 else
2787 AC_CACHE_CHECK([for gethostbyname_r with 5 args], tcl_cv_api_gethostbyname_r_5, [
2788 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2789 #include <netdb.h>
2790 ]], [[
2791 char *name;
2792 struct hostent *he;
2793 char buffer[2048];
2794 int buflen = 2048;
2795 int h_errnop;
2796
2797 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop);
2798 ]])],[tcl_cv_api_gethostbyname_r_5=yes],[tcl_cv_api_gethostbyname_r_5=no])])
2799 tcl_ok=$tcl_cv_api_gethostbyname_r_5
2800 if test "$tcl_ok" = yes; then
2801 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1,
2802 [Define to 1 if gethostbyname_r takes 5 args.])
2803 else
2804 AC_CACHE_CHECK([for gethostbyname_r with 3 args], tcl_cv_api_gethostbyname_r_3, [
2805 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2806 #include <netdb.h>
2807 ]], [[
2808 char *name;
2809 struct hostent *he;
2810 struct hostent_data data;
2811
2812 (void) gethostbyname_r(name, he, &data);
2813 ]])],[tcl_cv_api_gethostbyname_r_3=yes],[tcl_cv_api_gethostbyname_r_3=no])])
2814 tcl_ok=$tcl_cv_api_gethostbyname_r_3
2815 if test "$tcl_ok" = yes; then
2816 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1,
2817 [Define to 1 if gethostbyname_r takes 3 args.])
2818 fi
2819 fi
2820 fi
2821 if test "$tcl_ok" = yes; then
2822 AC_DEFINE(HAVE_GETHOSTBYNAME_R, 1,
2823 [Define to 1 if gethostbyname_r is available.])
2824 fi
2825 ])])
2826
2827 #--------------------------------------------------------------------
2828 # SC_TCL_GETPWUID_R
2829 #
2830 # Check if we have MT-safe variant of getpwuid() and if yes,
2831 # which one exactly.
2832 #
2833 # Arguments:
2834 # None
2835 #
2836 # Results:
2837 #
2838 # Might define the following vars:
2839 # HAVE_GETPWUID_R
2840 # HAVE_GETPWUID_R_4
2841 # HAVE_GETPWUID_R_5
2842 #
2843 #--------------------------------------------------------------------
2844
2845 AC_DEFUN([SC_TCL_GETPWUID_R], [AC_CHECK_FUNC(getpwuid_r, [
2846 AC_CACHE_CHECK([for getpwuid_r with 5 args], tcl_cv_api_getpwuid_r_5, [
2847 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2848 #include <sys/types.h>
2849 #include <pwd.h>
2850 ]], [[
2851 uid_t uid;
2852 struct passwd pw, *pwp;
2853 char buf[512];
2854 int buflen = 512;
2855
2856 (void) getpwuid_r(uid, &pw, buf, buflen, &pwp);
2857 ]])],[tcl_cv_api_getpwuid_r_5=yes],[tcl_cv_api_getpwuid_r_5=no])])
2858 tcl_ok=$tcl_cv_api_getpwuid_r_5
2859 if test "$tcl_ok" = yes; then
2860 AC_DEFINE(HAVE_GETPWUID_R_5, 1,
2861 [Define to 1 if getpwuid_r takes 5 args.])
2862 else
2863 AC_CACHE_CHECK([for getpwuid_r with 4 args], tcl_cv_api_getpwuid_r_4, [
2864 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2865 #include <sys/types.h>
2866 #include <pwd.h>
2867 ]], [[
2868 uid_t uid;
2869 struct passwd pw;
2870 char buf[512];
2871 int buflen = 512;
2872
2873 (void)getpwnam_r(uid, &pw, buf, buflen);
2874 ]])],[tcl_cv_api_getpwuid_r_4=yes],[tcl_cv_api_getpwuid_r_4=no])])
2875 tcl_ok=$tcl_cv_api_getpwuid_r_4
2876 if test "$tcl_ok" = yes; then
2877 AC_DEFINE(HAVE_GETPWUID_R_4, 1,
2878 [Define to 1 if getpwuid_r takes 4 args.])
2879 fi
2880 fi
2881 if test "$tcl_ok" = yes; then
2882 AC_DEFINE(HAVE_GETPWUID_R, 1,
2883 [Define to 1 if getpwuid_r is available.])
2884 fi
2885 ])])
2886
2887 #--------------------------------------------------------------------
2888 # SC_TCL_GETPWNAM_R
2889 #
2890 # Check if we have MT-safe variant of getpwnam() and if yes,
2891 # which one exactly.
2892 #
2893 # Arguments:
2894 # None
2895 #
2896 # Results:
2897 #
2898 # Might define the following vars:
2899 # HAVE_GETPWNAM_R
2900 # HAVE_GETPWNAM_R_4
2901 # HAVE_GETPWNAM_R_5
2902 #
2903 #--------------------------------------------------------------------
2904
2905 AC_DEFUN([SC_TCL_GETPWNAM_R], [AC_CHECK_FUNC(getpwnam_r, [
2906 AC_CACHE_CHECK([for getpwnam_r with 5 args], tcl_cv_api_getpwnam_r_5, [
2907 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2908 #include <sys/types.h>
2909 #include <pwd.h>
2910 ]], [[
2911 char *name;
2912 struct passwd pw, *pwp;
2913 char buf[512];
2914 int buflen = 512;
2915
2916 (void) getpwnam_r(name, &pw, buf, buflen, &pwp);
2917 ]])],[tcl_cv_api_getpwnam_r_5=yes],[tcl_cv_api_getpwnam_r_5=no])])
2918 tcl_ok=$tcl_cv_api_getpwnam_r_5
2919 if test "$tcl_ok" = yes; then
2920 AC_DEFINE(HAVE_GETPWNAM_R_5, 1,
2921 [Define to 1 if getpwnam_r takes 5 args.])
2922 else
2923 AC_CACHE_CHECK([for getpwnam_r with 4 args], tcl_cv_api_getpwnam_r_4, [
2924 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2925 #include <sys/types.h>
2926 #include <pwd.h>
2927 ]], [[
2928 char *name;
2929 struct passwd pw;
2930 char buf[512];
2931 int buflen = 512;
2932
2933 (void)getpwnam_r(name, &pw, buf, buflen);
2934 ]])],[tcl_cv_api_getpwnam_r_4=yes],[tcl_cv_api_getpwnam_r_4=no])])
2935 tcl_ok=$tcl_cv_api_getpwnam_r_4
2936 if test "$tcl_ok" = yes; then
2937 AC_DEFINE(HAVE_GETPWNAM_R_4, 1,
2938 [Define to 1 if getpwnam_r takes 4 args.])
2939 fi
2940 fi
2941 if test "$tcl_ok" = yes; then
2942 AC_DEFINE(HAVE_GETPWNAM_R, 1,
2943 [Define to 1 if getpwnam_r is available.])
2944 fi
2945 ])])
2946
2947 #--------------------------------------------------------------------
2948 # SC_TCL_GETGRGID_R
2949 #
2950 # Check if we have MT-safe variant of getgrgid() and if yes,
2951 # which one exactly.
2952 #
2953 # Arguments:
2954 # None
2955 #
2956 # Results:
2957 #
2958 # Might define the following vars:
2959 # HAVE_GETGRGID_R
2960 # HAVE_GETGRGID_R_4
2961 # HAVE_GETGRGID_R_5
2962 #
2963 #--------------------------------------------------------------------
2964
2965 AC_DEFUN([SC_TCL_GETGRGID_R], [AC_CHECK_FUNC(getgrgid_r, [
2966 AC_CACHE_CHECK([for getgrgid_r with 5 args], tcl_cv_api_getgrgid_r_5, [
2967 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2968 #include <sys/types.h>
2969 #include <grp.h>
2970 ]], [[
2971 gid_t gid;
2972 struct group gr, *grp;
2973 char buf[512];
2974 int buflen = 512;
2975
2976 (void) getgrgid_r(gid, &gr, buf, buflen, &grp);
2977 ]])],[tcl_cv_api_getgrgid_r_5=yes],[tcl_cv_api_getgrgid_r_5=no])])
2978 tcl_ok=$tcl_cv_api_getgrgid_r_5
2979 if test "$tcl_ok" = yes; then
2980 AC_DEFINE(HAVE_GETGRGID_R_5, 1,
2981 [Define to 1 if getgrgid_r takes 5 args.])
2982 else
2983 AC_CACHE_CHECK([for getgrgid_r with 4 args], tcl_cv_api_getgrgid_r_4, [
2984 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2985 #include <sys/types.h>
2986 #include <grp.h>
2987 ]], [[
2988 gid_t gid;
2989 struct group gr;
2990 char buf[512];
2991 int buflen = 512;
2992
2993 (void)getgrgid_r(gid, &gr, buf, buflen);
2994 ]])],[tcl_cv_api_getgrgid_r_4=yes],[tcl_cv_api_getgrgid_r_4=no])])
2995 tcl_ok=$tcl_cv_api_getgrgid_r_4
2996 if test "$tcl_ok" = yes; then
2997 AC_DEFINE(HAVE_GETGRGID_R_4, 1,
2998 [Define to 1 if getgrgid_r takes 4 args.])
2999 fi
3000 fi
3001 if test "$tcl_ok" = yes; then
3002 AC_DEFINE(HAVE_GETGRGID_R, 1,
3003 [Define to 1 if getgrgid_r is available.])
3004 fi
3005 ])])
3006
3007 #--------------------------------------------------------------------
3008 # SC_TCL_GETGRNAM_R
3009 #
3010 # Check if we have MT-safe variant of getgrnam() and if yes,
3011 # which one exactly.
3012 #
3013 # Arguments:
3014 # None
3015 #
3016 # Results:
3017 #
3018 # Might define the following vars:
3019 # HAVE_GETGRNAM_R
3020 # HAVE_GETGRNAM_R_4
3021 # HAVE_GETGRNAM_R_5
3022 #
3023 #--------------------------------------------------------------------
3024
3025 AC_DEFUN([SC_TCL_GETGRNAM_R], [AC_CHECK_FUNC(getgrnam_r, [
3026 AC_CACHE_CHECK([for getgrnam_r with 5 args], tcl_cv_api_getgrnam_r_5, [
3027 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3028 #include <sys/types.h>
3029 #include <grp.h>
3030 ]], [[
3031 char *name;
3032 struct group gr, *grp;
3033 char buf[512];
3034 int buflen = 512;
3035
3036 (void) getgrnam_r(name, &gr, buf, buflen, &grp);
3037 ]])],[tcl_cv_api_getgrnam_r_5=yes],[tcl_cv_api_getgrnam_r_5=no])])
3038 tcl_ok=$tcl_cv_api_getgrnam_r_5
3039 if test "$tcl_ok" = yes; then
3040 AC_DEFINE(HAVE_GETGRNAM_R_5, 1,
3041 [Define to 1 if getgrnam_r takes 5 args.])
3042 else
3043 AC_CACHE_CHECK([for getgrnam_r with 4 args], tcl_cv_api_getgrnam_r_4, [
3044 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3045 #include <sys/types.h>
3046 #include <grp.h>
3047 ]], [[
3048 char *name;
3049 struct group gr;
3050 char buf[512];
3051 int buflen = 512;
3052
3053 (void)getgrnam_r(name, &gr, buf, buflen);
3054 ]])],[tcl_cv_api_getgrnam_r_4=yes],[tcl_cv_api_getgrnam_r_4=no])])
3055 tcl_ok=$tcl_cv_api_getgrnam_r_4
3056 if test "$tcl_ok" = yes; then
3057 AC_DEFINE(HAVE_GETGRNAM_R_4, 1,
3058 [Define to 1 if getgrnam_r takes 4 args.])
3059 fi
3060 fi
3061 if test "$tcl_ok" = yes; then
3062 AC_DEFINE(HAVE_GETGRNAM_R, 1,
3063 [Define to 1 if getgrnam_r is available.])
3064 fi
3065 ])])
3066
3067 AC_DEFUN([SC_TCL_IPV6],[
3068 NEED_FAKE_RFC2553=0
3069 AC_CHECK_FUNCS(getnameinfo getaddrinfo freeaddrinfo gai_strerror,,[NEED_FAKE_RFC2553=1])
3070 AC_CHECK_TYPES([
3071 struct addrinfo,
3072 struct in6_addr,
3073 struct sockaddr_in6,
3074 struct sockaddr_storage],,[NEED_FAKE_RFC2553=1],[[
3075 #include <sys/types.h>
3076 #include <sys/socket.h>
3077 #include <netinet/in.h>
3078 #include <netdb.h>
3079 ]])
3080 if test "x$NEED_FAKE_RFC2553" = "x1"; then
3081 AC_DEFINE([NEED_FAKE_RFC2553], 1,
3082 [Use compat implementation of getaddrinfo() and friends])
3083 AC_LIBOBJ([fake-rfc2553])
3084 AC_CHECK_FUNC(strlcpy)
3085 fi
3086 ])
3087 # Local Variables:
3088 # mode: autoconf
3089 # End: