Debian Codegraph @

xpa/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, [ --with-tcl directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval})
31 AC_MSG_CHECKING([for Tcl configuration])
32 if test x"${withval}" != xno ; then
33 AC_CACHE_VAL(ac_cv_c_tclconfig,[
34
35 # First check to see if --with-tcl was specified.
36 if test x"${with_tclconfig}" != x ; then
37 if test -f "${with_tclconfig}/tclConfig.sh" ; then
38 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
39 else
40 AC_MSG_RESULT([${with_tclconfig} directory doesn't contain tclConfig.sh])
41 fi
42 fi
43
44 # then check for a private Tcl installation
45 if test x"${ac_cv_c_tclconfig}" = x ; then
46 for i in \
47 ../tcl \
48 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
49 ../../tcl \
50 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
51 ../../../tcl \
52 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
53 if test -f "$i/unix/tclConfig.sh" ; then
54 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
55 break
56 fi
57 done
58 fi
59
60 # check in a few common install locations
61 if test x"${ac_cv_c_tclconfig}" = x ; then
62 for i in `ls -d ${libdir} 2>/dev/null` \
63 `ls -d /usr/local/lib 2>/dev/null` \
64 `ls -d /usr/contrib/lib 2>/dev/null` \
65 `ls -d /usr/lib 2>/dev/null` \
66 ; do
67 if test -f "$i/tclConfig.sh" ; then
68 ac_cv_c_tclconfig=`(cd $i; pwd)`
69 break
70 fi
71 done
72 fi
73
74 # check in a few other private locations
75 if test x"${ac_cv_c_tclconfig}" = x ; then
76 for i in \
77 ${srcdir}/../tcl \
78 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
79 if test -f "$i/unix/tclConfig.sh" ; then
80 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
81 break
82 fi
83 done
84 fi
85 ])
86 else
87 AC_MSG_RESULT(skipping Tcl configuration)
88 ac_cv_c_tclconfig="none"
89 fi
90
91 if test x"${ac_cv_c_tclconfig}" = x ; then
92 TCL_BIN_DIR="# no Tcl configs found"
93 AC_MSG_RESULT(can't find Tcl configuration definitions)
94 # no Tcl is OK egm 03/25/03
95 # AC_MSG_WARN(Can't find Tcl configuration definitions)
96 # exit 0
97 elif test x"${ac_cv_c_tclconfig}" = xnone ; then
98 TCL_BIN_DIR=""
99 else
100 no_tcl=
101 TCL_BIN_DIR=${ac_cv_c_tclconfig}
102 AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
103 fi
104 fi
105 ])
106
107 #------------------------------------------------------------------------
108 # SC_PATH_TKCONFIG --
109 #
110 # Locate the tkConfig.sh file
111 #
112 # Arguments:
113 # none
114 #
115 # Results:
116 #
117 # Adds the following arguments to configure:
118 # --with-tk=...
119 #
120 # Defines the following vars:
121 # TK_BIN_DIR Full path to the directory containing
122 # the tkConfig.sh file
123 #------------------------------------------------------------------------
124
125 AC_DEFUN(SC_PATH_TKCONFIG, [
126 #
127 # Ok, lets find the tk configuration
128 # First, look for one uninstalled.
129 # the alternative search directory is invoked by --with-tk
130 #
131
132 if test x"${no_tk}" = x ; then
133 # we reset no_tk in case something fails here
134 no_tk=true
135 AC_ARG_WITH(tk, [ --with-tk directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval})
136 AC_MSG_CHECKING([for Tk configuration])
137 AC_CACHE_VAL(ac_cv_c_tkconfig,[
138
139 # First check to see if --with-tkconfig was specified.
140 if test x"${with_tkconfig}" != x ; then
141 if test -f "${with_tkconfig}/tkConfig.sh" ; then
142 ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
143 else
144 AC_MSG_RESULT([${with_tkconfig} directory doesn't contain tkConfig.sh])
145 fi
146 fi
147
148 # then check for a private Tk library
149 if test x"${ac_cv_c_tkconfig}" = x ; then
150 for i in \
151 ../tk \
152 `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
153 ../../tk \
154 `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
155 ../../../tk \
156 `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
157 if test -f "$i/unix/tkConfig.sh" ; then
158 ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
159 break
160 fi
161 done
162 fi
163 # check in a few common install locations
164 if test x"${ac_cv_c_tkconfig}" = x ; then
165 for i in `ls -d ${libdir} 2>/dev/null` \
166 `ls -d /usr/local/lib 2>/dev/null` \
167 `ls -d /usr/contrib/lib 2>/dev/null` \
168 `ls -d /usr/lib 2>/dev/null` \
169 ; do
170 if test -f "$i/tkConfig.sh" ; then
171 ac_cv_c_tkconfig=`(cd $i; pwd)`
172 break
173 fi
174 done
175 fi
176 # check in a few other private locations
177 if test x"${ac_cv_c_tkconfig}" = x ; then
178 for i in \
179 ${srcdir}/../tk \
180 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
181 if test -f "$i/unix/tkConfig.sh" ; then
182 ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
183 break
184 fi
185 done
186 fi
187 ])
188 if test x"${ac_cv_c_tkconfig}" = x ; then
189 TK_BIN_DIR="# no Tk configs found"
190 AC_MSG_RESULT(can't find Tk configuration definitions)
191 # no Tk is OK egm 03/25/03
192 # AC_MSG_WARN(Can't find Tk configuration definitions)
193 # exit 0
194 else
195 no_tk=
196 TK_BIN_DIR=${ac_cv_c_tkconfig}
197 AC_MSG_RESULT(found $TK_BIN_DIR/tkConfig.sh)
198 fi
199 fi
200
201 ])
202
203 #------------------------------------------------------------------------
204 # SC_LOAD_TCLCONFIG --
205 #
206 # Load the tclConfig.sh file
207 #
208 # Arguments:
209 #
210 # Requires the following vars to be set:
211 # TCL_BIN_DIR
212 #
213 # Results:
214 #
215 # Subst the following vars:
216 # TCL_BIN_DIR
217 # TCL_SRC_DIR
218 # TCL_LIB_FILE
219 #
220 #------------------------------------------------------------------------
221
222 AC_DEFUN(SC_LOAD_TCLCONFIG, [
223 AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
224
225 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
226 AC_MSG_RESULT([loading])
227 . $TCL_BIN_DIR/tclConfig.sh
228 else
229 AC_MSG_RESULT([file not found])
230 fi
231
232 #
233 # If the TCL_BIN_DIR is the build directory (not the install directory),
234 # then set the common variable name to the value of the build variables.
235 # For example, the variable TCL_LIB_SPEC will be set to the value
236 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
237 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
238 # installed and uninstalled version of Tcl.
239 #
240
241 if test -f $TCL_BIN_DIR/Makefile ; then
242 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
243 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
244 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
245 fi
246
247 #
248 # eval is required to do the TCL_DBGX substitution
249 #
250
251 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
252 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
253 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
254
255 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
256 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
257 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
258
259 AC_SUBST(TCL_VERSION)
260 AC_SUBST(TCL_BIN_DIR)
261 AC_SUBST(TCL_SRC_DIR)
262
263 AC_SUBST(TCL_LIB_FILE)
264 AC_SUBST(TCL_LIB_FLAG)
265 AC_SUBST(TCL_LIB_SPEC)
266
267 AC_SUBST(TCL_STUB_LIB_FILE)
268 AC_SUBST(TCL_STUB_LIB_FLAG)
269 AC_SUBST(TCL_STUB_LIB_SPEC)
270 ])
271
272 #------------------------------------------------------------------------
273 # SC_LOAD_TKCONFIG --
274 #
275 # Load the tkConfig.sh file
276 #
277 # Arguments:
278 #
279 # Requires the following vars to be set:
280 # TK_BIN_DIR
281 #
282 # Results:
283 #
284 # Sets the following vars that should be in tkConfig.sh:
285 # TK_BIN_DIR
286 #------------------------------------------------------------------------
287
288 AC_DEFUN(SC_LOAD_TKCONFIG, [
289 AC_MSG_CHECKING([for existence of $TK_BIN_DIR/tkConfig.sh])
290
291 if test -f "$TK_BIN_DIR/tkConfig.sh" ; then
292 AC_MSG_RESULT([loading])
293 . $TK_BIN_DIR/tkConfig.sh
294 else
295 AC_MSG_RESULT([could not find $TK_BIN_DIR/tkConfig.sh])
296 fi
297
298 AC_SUBST(TK_VERSION)
299 AC_SUBST(TK_BIN_DIR)
300 AC_SUBST(TK_SRC_DIR)
301 AC_SUBST(TK_LIB_FILE)
302 ])
303
304 #------------------------------------------------------------------------
305 # SC_ENABLE_SHARED --
306 #
307 # Allows the building of shared libraries
308 #
309 # Arguments:
310 # none
311 #
312 # Results:
313 #
314 # Adds the following arguments to configure:
315 # --enable-shared=yes|no
316 #
317 # Defines the following vars:
318 # STATIC_BUILD Used for building import/export libraries
319 # on Windows.
320 #
321 # Sets the following vars:
322 # SHARED_BUILD Value of 1 or 0
323 #------------------------------------------------------------------------
324
325 AC_DEFUN(SC_ENABLE_SHARED, [
326 AC_MSG_CHECKING([how to build libraries])
327 AC_ARG_ENABLE(shared,
328 [ --enable-shared build and link with shared libraries [--enable-shared]],
329 [tcl_ok=$enableval], [tcl_ok=yes])
330
331 if test "${enable_shared+set}" = set; then
332 enableval="$enable_shared"
333 tcl_ok=$enableval
334 else
335 tcl_ok=yes
336 fi
337
338 if test "$tcl_ok" = "yes" ; then
339 AC_MSG_RESULT([shared])
340 SHARED_BUILD=1
341 else
342 AC_MSG_RESULT([static])
343 SHARED_BUILD=0
344 AC_DEFINE(STATIC_BUILD)
345 fi
346 ])
347
348 #------------------------------------------------------------------------
349 # SC_ENABLE_FRAMEWORK --
350 #
351 # Allows the building of shared libraries into frameworks
352 #
353 # Arguments:
354 # none
355 #
356 # Results:
357 #
358 # Adds the following arguments to configure:
359 # --enable-framework=yes|no
360 #
361 # Sets the following vars:
362 # FRAMEWORK_BUILD Value of 1 or 0
363 #------------------------------------------------------------------------
364
365 AC_DEFUN(SC_ENABLE_FRAMEWORK, [
366 AC_MSG_CHECKING([how to package libraries])
367 AC_ARG_ENABLE(framework,
368 [ --enable-framework package shared libraries in frameworks [--disable-framework]],
369 [tcl_ok=$enableval], [tcl_ok=no])
370
371 if test "${enable_framework+set}" = set; then
372 enableval="$enable_framework"
373 tcl_ok=$enableval
374 else
375 tcl_ok=no
376 fi
377
378 if test "$tcl_ok" = "yes" ; then
379 AC_MSG_RESULT([framework])
380 FRAMEWORK_BUILD=1
381 if test "${SHARED_BUILD}" = "0" ; then
382 AC_MSG_WARN("Frameworks can only be built if --enable-shared is yes")
383 FRAMEWORK_BUILD=0
384 fi
385 else
386 AC_MSG_RESULT([standard shared library])
387 FRAMEWORK_BUILD=0
388 fi
389 ])
390
391 #------------------------------------------------------------------------
392 # SC_ENABLE_THREADS --
393 #
394 # Specify if thread support should be enabled
395 #
396 # Arguments:
397 # none
398 #
399 # Results:
400 #
401 # Adds the following arguments to configure:
402 # --enable-threads
403 #
404 # Sets the following vars:
405 # THREADS_LIBS Thread library(s)
406 #
407 # Defines the following vars:
408 # TCL_THREADS
409 # _REENTRANT
410 # _THREAD_SAFE
411 #
412 #------------------------------------------------------------------------
413
414 AC_DEFUN(SC_ENABLE_THREADS, [
415 AC_MSG_CHECKING(for building with threads)
416 AC_ARG_ENABLE(threads, [ --enable-threads build with threads],
417 [tcl_ok=$enableval], [tcl_ok=no])
418
419 if test "$tcl_ok" = "yes"; then
420 AC_MSG_RESULT(yes)
421 TCL_THREADS=1
422 AC_DEFINE(TCL_THREADS)
423 # USE_THREAD_ALLOC tells us to try the special thread-based
424 # allocator that significantly reduces lock contention
425 AC_DEFINE(USE_THREAD_ALLOC)
426 AC_DEFINE(_REENTRANT)
427 AC_DEFINE(_THREAD_SAFE)
428 AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
429 if test "$tcl_ok" = "no"; then
430 # Check a little harder for __pthread_mutex_init in the same
431 # library, as some systems hide it there until pthread.h is
432 # defined. We could alternatively do an AC_TRY_COMPILE with
433 # pthread.h, but that will work with libpthread really doesn't
434 # exist, like AIX 4.2. [Bug: 4359]
435 AC_CHECK_LIB(pthread,__pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
436 fi
437
438 if test "$tcl_ok" = "yes"; then
439 # The space is needed
440 THREADS_LIBS=" -lpthread"
441 else
442 AC_CHECK_LIB(pthreads,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
443 if test "$tcl_ok" = "yes"; then
444 # The space is needed
445 THREADS_LIBS=" -lpthreads"
446 else
447 AC_CHECK_LIB(c,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
448 if test "$tcl_ok" = "no"; then
449 AC_CHECK_LIB(c_r,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
450 if test "$tcl_ok" = "yes"; then
451 # The space is needed
452 THREADS_LIBS=" -pthread"
453 else
454 TCL_THREADS=0
455 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...")
456 fi
457 fi
458 fi
459 fi
460
461 # Does the pthread-implementation provide
462 # 'pthread_attr_setstacksize' ?
463
464 ac_saved_libs=$LIBS
465 LIBS="$LIBS $THREADS_LIBS"
466 AC_CHECK_FUNCS(pthread_attr_setstacksize)
467 LIBS=$ac_saved_libs
468 AC_CHECK_FUNCS(readdir_r)
469 else
470 TCL_THREADS=0
471 AC_MSG_RESULT([no (default)])
472 fi
473 AC_SUBST(TCL_THREADS)
474 ])
475
476 #------------------------------------------------------------------------
477 # SC_ENABLE_SYMBOLS --
478 #
479 # Specify if debugging symbols should be used.
480 # Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging
481 # can also be enabled.
482 #
483 # Arguments:
484 # none
485 #
486 # Requires the following vars to be set in the Makefile:
487 # CFLAGS_DEBUG
488 # CFLAGS_OPTIMIZE
489 # LDFLAGS_DEBUG
490 # LDFLAGS_OPTIMIZE
491 #
492 # Results:
493 #
494 # Adds the following arguments to configure:
495 # --enable-symbols
496 #
497 # Defines the following vars:
498 # CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
499 # Sets to $(CFLAGS_OPTIMIZE) if false
500 # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
501 # Sets to $(LDFLAGS_OPTIMIZE) if false
502 # DBGX Debug library extension
503 #
504 #------------------------------------------------------------------------
505
506 AC_DEFUN(SC_ENABLE_SYMBOLS, [
507 AC_MSG_CHECKING([for build with symbols])
508 AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no])
509 # FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
510 if test "$tcl_ok" = "no"; then
511 CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
512 LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
513 DBGX=""
514 AC_MSG_RESULT([no])
515 else
516 CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
517 LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
518 DBGX=g
519 if test "$tcl_ok" = "yes"; then
520 AC_MSG_RESULT([yes (standard debugging)])
521 fi
522 fi
523 AC_SUBST(CFLAGS_DEFAULT)
524 AC_SUBST(LDFLAGS_DEFAULT)
525
526 if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
527 AC_DEFINE(TCL_MEM_DEBUG)
528 fi
529
530 if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
531 AC_DEFINE(TCL_COMPILE_DEBUG)
532 AC_DEFINE(TCL_COMPILE_STATS)
533 fi
534
535 if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
536 if test "$tcl_ok" = "all"; then
537 AC_MSG_RESULT([enabled symbols mem compile debugging])
538 else
539 AC_MSG_RESULT([enabled $tcl_ok debugging])
540 fi
541 fi
542 ])
543
544 #------------------------------------------------------------------------
545 # SC_ENABLE_LANGINFO --
546 #
547 # Allows use of modern nl_langinfo check for better l10n.
548 # This is only relevant for Unix.
549 #
550 # Arguments:
551 # none
552 #
553 # Results:
554 #
555 # Adds the following arguments to configure:
556 # --enable-langinfo=yes|no (default is yes)
557 #
558 # Defines the following vars:
559 # HAVE_LANGINFO Triggers use of nl_langinfo if defined.
560 #
561 #------------------------------------------------------------------------
562
563 AC_DEFUN(SC_ENABLE_LANGINFO, [
564 AC_ARG_ENABLE(langinfo,
565 [ --enable-langinfo use nl_langinfo if possible to determine
566 encoding at startup, otherwise use old heuristic],
567 [langinfo_ok=$enableval], [langinfo_ok=yes])
568
569 HAVE_LANGINFO=0
570 if test "$langinfo_ok" = "yes"; then
571 if test "$langinfo_ok" = "yes"; then
572 AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
573 fi
574 fi
575 AC_MSG_CHECKING([whether to use nl_langinfo])
576 if test "$langinfo_ok" = "yes"; then
577 AC_TRY_COMPILE([#include <langinfo.h>],
578 [nl_langinfo(CODESET);],[langinfo_ok=yes],[langinfo_ok=no])
579 if test "$langinfo_ok" = "no"; then
580 langinfo_ok="no (could not compile with nl_langinfo)";
581 fi
582 if test "$langinfo_ok" = "yes"; then
583 AC_DEFINE(HAVE_LANGINFO)
584 fi
585 fi
586 AC_MSG_RESULT([$langinfo_ok])
587 ])
588
589 #--------------------------------------------------------------------
590 # SC_CONFIG_MANPAGES
591 #
592 # Decide whether to use symlinks for linking the manpages and
593 # whether to compress the manpages after installation.
594 #
595 # Arguments:
596 # none
597 #
598 # Results:
599 #
600 # Adds the following arguments to configure:
601 # --enable-man-symlinks
602 # --enable-man-compression=PROG
603 #
604 # Defines the following variable:
605 #
606 # MKLINKS_FLAGS - The apropriate flags for mkLinks
607 # according to the user's selection.
608 #
609 #--------------------------------------------------------------------
610 AC_DEFUN(SC_CONFIG_MANPAGES, [
611
612 AC_MSG_CHECKING([whether to use symlinks for manpages])
613 AC_ARG_ENABLE(man-symlinks,
614 [ --enable-man-symlinks use symlinks for the manpages],
615 test "$enableval" != "no" && MKLINKS_FLAGS="$MKLINKS_FLAGS --symlinks",
616 enableval="no")
617 AC_MSG_RESULT([$enableval])
618
619 AC_MSG_CHECKING([compression for manpages])
620 AC_ARG_ENABLE(man-compression,
621 [ --enable-man-compression=PROG
622 compress the manpages with PROG],
623 test "$enableval" = "yes" && echo && AC_MSG_ERROR([missing argument to --enable-man-compression])
624 test "$enableval" != "no" && MKLINKS_FLAGS="$MKLINKS_FLAGS --compress $enableval",
625 enableval="no")
626 AC_MSG_RESULT([$enableval])
627
628 AC_SUBST(MKLINKS_FLAGS)
629 ])
630
631 #--------------------------------------------------------------------
632 # SC_CONFIG_CFLAGS
633 #
634 # Try to determine the proper flags to pass to the compiler
635 # for building shared libraries and other such nonsense.
636 #
637 # Arguments:
638 # none
639 #
640 # Results:
641 #
642 # Defines and substitutes the following vars:
643 #
644 # DL_OBJS - Name of the object file that implements dynamic
645 # loading for Tcl on this system.
646 # DL_LIBS - Library file(s) to include in tclsh and other base
647 # applications in order for the "load" command to work.
648 # LDFLAGS - Flags to pass to the compiler when linking object
649 # files into an executable application binary such
650 # as tclsh.
651 # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
652 # that tell the run-time dynamic linker where to look
653 # for shared libraries such as libtcl.so. Depends on
654 # the variable LIB_RUNTIME_DIR in the Makefile. Could
655 # be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
656 # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
657 # that tell the run-time dynamic linker where to look
658 # for shared libraries such as libtcl.so. Depends on
659 # the variable LIB_RUNTIME_DIR in the Makefile.
660 # MAKE_LIB - Command to execute to build the a library;
661 # differs when building shared or static.
662 # MAKE_STUB_LIB -
663 # Command to execute to build a stub library.
664 # INSTALL_LIB - Command to execute to install a library;
665 # differs when building shared or static.
666 # INSTALL_STUB_LIB -
667 # Command to execute to install a stub library.
668 # STLIB_LD - Base command to use for combining object files
669 # into a static library.
670 # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
671 # of a shared library (may request position-independent
672 # code, among other things).
673 # SHLIB_LD - Base command to use for combining object files
674 # into a shared library.
675 # SHLIB_LD_FLAGS -Flags to pass when building a shared library. This
676 # differes from the SHLIB_CFLAGS as it is not used
677 # when building object files or executables.
678 # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
679 # creating shared libraries. This symbol typically
680 # goes at the end of the "ld" commands that build
681 # shared libraries. The value of the symbol is
682 # "${LIBS}" if all of the dependent libraries should
683 # be specified when creating a shared library. If
684 # dependent libraries should not be specified (as on
685 # SunOS 4.x, where they cause the link to fail, or in
686 # general if Tcl and Tk aren't themselves shared
687 # libraries), then this symbol has an empty string
688 # as its value.
689 # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
690 # extensions. An empty string means we don't know how
691 # to use shared libraries on this platform.
692 # TCL_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS
693 # TK_SHLIB_LD_EXTRAS for the build of Tcl and Tk, but not recorded in the
694 # tclConfig.sh, since they are only used for the build
695 # of Tcl and Tk.
696 # Examples: MacOS X records the library version and
697 # compatibility version in the shared library. But
698 # of course the Tcl version of this is only used for Tcl.
699 # LIB_SUFFIX - Specifies everything that comes after the "libfoo"
700 # in a static or shared library name, using the $VERSION variable
701 # to put the version in the right place. This is used
702 # by platforms that need non-standard library names.
703 # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
704 # to have a version after the .so, and ${VERSION}.a
705 # on AIX, since a shared library needs to have
706 # a .a extension whereas shared objects for loadable
707 # extensions have a .so extension. Defaults to
708 # ${VERSION}${SHLIB_SUFFIX}.
709 # TCL_NEEDS_EXP_FILE -
710 # 1 means that an export file is needed to link to a
711 # shared library.
712 # TCL_EXP_FILE - The name of the installed export / import file which
713 # should be used to link to the Tcl shared library.
714 # Empty if Tcl is unshared.
715 # TCL_BUILD_EXP_FILE -
716 # The name of the built export / import file which
717 # should be used to link to the Tcl shared library.
718 # Empty if Tcl is unshared.
719 # CFLAGS_DEBUG -
720 # Flags used when running the compiler in debug mode
721 # CFLAGS_OPTIMIZE -
722 # Flags used when running the compiler in optimize mode
723 # EXTRA_CFLAGS
724 #
725 #--------------------------------------------------------------------
726
727 AC_DEFUN(SC_CONFIG_CFLAGS, [
728
729 # Step 0.a: Enable 64 bit support?
730
731 AC_MSG_CHECKING([if 64bit support is requested])
732 AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)],,enableval="no")
733
734 if test "$enableval" = "yes"; then
735 do64bit=yes
736 else
737 do64bit=no
738 fi
739 AC_MSG_RESULT($do64bit)
740
741 # Step 0.b: Enable Solaris 64 bit VIS support?
742
743 AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
744 AC_ARG_ENABLE(64bit-vis,[ --enable-64bit-vis enable 64bit Sparc VIS support],,enableval="no")
745
746 if test "$enableval" = "yes"; then
747 # Force 64bit on with VIS
748 do64bit=yes
749 do64bitVIS=yes
750 else
751 do64bitVIS=no
752 fi
753 AC_MSG_RESULT($do64bitVIS)
754
755 # Step 1: set the variable "system" to hold the name and version number
756 # for the system. This can usually be done via the "uname" command, but
757 # there are a few systems, like Next, where this doesn't work.
758
759 AC_MSG_CHECKING([system version (for dynamic loading)])
760 if test -f /usr/lib/NextStep/software_version; then
761 system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
762 else
763 system=`uname -s`-`uname -r`
764 if test "$?" -ne 0 ; then
765 AC_MSG_RESULT([unknown (can't find uname command)])
766 system=unknown
767 else
768 # Special check for weird MP-RAS system (uname returns weird
769 # results, and the version is kept in special file).
770
771 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
772 system=MP-RAS-`awk '{print $3}' /etc/.relid'`
773 fi
774 if test "`uname -s`" = "AIX" ; then
775 system=AIX-`uname -v`.`uname -r`
776 fi
777 AC_MSG_RESULT($system)
778 fi
779 fi
780
781 # Step 2: check for existence of -ldl library. This is needed because
782 # Linux can use either -ldl or -ldld for dynamic loading.
783
784 AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
785
786 # Require ranlib early so we can override it in special cases below.
787
788 AC_REQUIRE([AC_PROG_RANLIB])
789
790 # Step 3: set configuration options based on system name and version.
791
792 do64bit_ok=no
793 EXTRA_CFLAGS=""
794 TCL_EXPORT_FILE_SUFFIX=""
795 UNSHARED_LIB_SUFFIX=""
796 TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
797 ECHO_VERSION='`echo ${VERSION}`'
798 TCL_LIB_VERSIONS_OK=ok
799 CFLAGS_DEBUG=-g
800 CFLAGS_OPTIMIZE=-O
801 if test "$GCC" = "yes" ; then
802 CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int"
803 else
804 CFLAGS_WARNING=""
805 fi
806 TCL_NEEDS_EXP_FILE=0
807 TCL_BUILD_EXP_FILE=""
808 TCL_EXP_FILE=""
809 dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
810 dnl AC_CHECK_TOOL(AR, ar)
811 AC_CHECK_PROG(AR, ar, ar)
812 if test "${AR}" = "" ; then
813 AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
814 fi
815 STLIB_LD='${AR} cr'
816 LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
817 PLAT_OBJS=""
818 case $system in
819 AIX-5.*)
820 if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
821 # AIX requires the _r compiler when gcc isn't being used
822 if test "${CC}" != "cc_r" ; then
823 CC=${CC}_r
824 fi
825 AC_MSG_RESULT(Using $CC for compiling with threads)
826 fi
827 LIBS="$LIBS -lc"
828 # AIX-5 uses ELF style dynamic libraries
829 SHLIB_CFLAGS=""
830 SHLIB_LD_LIBS='${LIBS}'
831 SHLIB_SUFFIX=".so"
832 if test "`uname -m`" = "ia64" ; then
833 # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
834 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
835 # AIX-5 has dl* in libc.so
836 DL_LIBS=""
837 if test "$GCC" = "yes" ; then
838 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
839 else
840 CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
841 fi
842 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
843 else
844 SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
845 DL_LIBS="-ldl"
846 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
847 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
848 TCL_NEEDS_EXP_FILE=1
849 TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
850 fi
851
852 # Note: need the LIBS below, otherwise Tk won't find Tcl's
853 # symbols when dynamically loaded into tclsh.
854
855 DL_OBJS="tclLoadDl.o"
856 LDFLAGS=""
857
858 LD_LIBRARY_PATH_VAR="LIBPATH"
859
860 # Check to enable 64-bit flags for compiler/linker
861 if test "$do64bit" = "yes" ; then
862 if test "$GCC" = "yes" ; then
863 AC_MSG_WARN("64bit mode not supported with GCC on $system")
864 else
865 do64bit_ok=yes
866 EXTRA_CFLAGS="-q64"
867 LDFLAGS="-q64"
868 RANLIB="${RANLIB} -X64"
869 AR="${AR} -X64"
870 SHLIB_LD_FLAGS="-b64"
871 fi
872 fi
873 ;;
874 AIX-*)
875 if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
876 # AIX requires the _r compiler when gcc isn't being used
877 if test "${CC}" != "cc_r" ; then
878 CC=${CC}_r
879 fi
880 AC_MSG_RESULT(Using $CC for compiling with threads)
881 fi
882 LIBS="$LIBS -lc"
883 SHLIB_CFLAGS=""
884 SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
885 SHLIB_LD_LIBS='${LIBS}'
886 SHLIB_SUFFIX=".so"
887 DL_OBJS="tclLoadDl.o"
888 DL_LIBS="-ldl"
889 LDFLAGS=""
890 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
891 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
892 LD_LIBRARY_PATH_VAR="LIBPATH"
893 TCL_NEEDS_EXP_FILE=1
894 TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
895
896 # AIX v<=4.1 has some different flags than 4.2+
897 if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
898 # upgrade to 2.5x egm 3/25/03
899 AC_LIBOBJ(tclLoadAix.o)
900 HAVE_COMPAT=true
901 DL_LIBS="-lld"
902 fi
903
904 # On AIX <=v4 systems, libbsd.a has to be linked in to support
905 # non-blocking file IO. This library has to be linked in after
906 # the MATH_LIBS or it breaks the pow() function. The way to
907 # insure proper sequencing, is to add it to the tail of MATH_LIBS.
908 # This library also supplies gettimeofday.
909 #
910 # AIX does not have a timezone field in struct tm. When the AIX
911 # bsd library is used, the timezone global and the gettimeofday
912 # methods are to be avoided for timezone deduction instead, we
913 # deduce the timezone by comparing the localtime result on a
914 # known GMT value.
915
916 AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no)
917 if test $libbsd = yes; then
918 MATH_LIBS="$MATH_LIBS -lbsd"
919 AC_DEFINE(USE_DELTA_FOR_TZ)
920 fi
921
922 # Check to enable 64-bit flags for compiler/linker
923 if test "$do64bit" = "yes" ; then
924 if test "$GCC" = "yes" ; then
925 AC_MSG_WARN("64bit mode not supported with GCC on $system")
926 else
927 do64bit_ok=yes
928 EXTRA_CFLAGS="-q64"
929 LDFLAGS="-q64"
930 RANLIB="${RANLIB} -X64"
931 AR="${AR} -X64"
932 SHLIB_LD_FLAGS="-b64"
933 fi
934 fi
935 ;;
936 BSD/OS-2.1*|BSD/OS-3*)
937 SHLIB_CFLAGS=""
938 SHLIB_LD="shlicc -r"
939 SHLIB_LD_LIBS='${LIBS}'
940 SHLIB_SUFFIX=".so"
941 DL_OBJS="tclLoadDl.o"
942 DL_LIBS="-ldl"
943 LDFLAGS=""
944 CC_SEARCH_FLAGS=""
945 LD_SEARCH_FLAGS=""
946 ;;
947 BSD/OS-4.*)
948 SHLIB_CFLAGS="-export-dynamic -fPIC"
949 SHLIB_LD="cc -shared"
950 SHLIB_LD_LIBS='${LIBS}'
951 SHLIB_SUFFIX=".so"
952 DL_OBJS="tclLoadDl.o"
953 DL_LIBS="-ldl"
954 LDFLAGS="-export-dynamic"
955 CC_SEARCH_FLAGS=""
956 LD_SEARCH_FLAGS=""
957 ;;
958 dgux*)
959 SHLIB_CFLAGS="-K PIC"
960 SHLIB_LD="cc -G"
961 SHLIB_LD_LIBS=""
962 SHLIB_SUFFIX=".so"
963 DL_OBJS="tclLoadDl.o"
964 DL_LIBS="-ldl"
965 LDFLAGS=""
966 CC_SEARCH_FLAGS=""
967 LD_SEARCH_FLAGS=""
968 ;;
969 HP-UX-*.11.*)
970 # Use updated header definitions where possible
971 AC_DEFINE(_XOPEN_SOURCE) # Use the XOPEN network library
972 AC_DEFINE(_XOPEN_SOURCE_EXTENDED) # Use the XOPEN network library
973 LIBS="$LIBS -lxnet" # Use the XOPEN network library
974
975 SHLIB_SUFFIX=".sl"
976 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
977 if test "$tcl_ok" = yes; then
978 SHLIB_CFLAGS="+z"
979 SHLIB_LD="ld -b"
980 SHLIB_LD_LIBS='${LIBS}'
981 DL_OBJS="tclLoadShl.o"
982 DL_LIBS="-ldld"
983 LDFLAGS="-Wl,-E"
984 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
985 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
986 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
987 fi
988
989 # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
990 #EXTRA_CFLAGS="+DAportable"
991
992 # Check to enable 64-bit flags for compiler/linker
993 if test "$do64bit" = "yes" ; then
994 if test "$GCC" = "yes" ; then
995 hpux_arch=`gcc -dumpmachine`
996 case $hpux_arch in
997 hppa64*)
998 # 64-bit gcc in use. Fix flags for GNU ld.
999 do64bit_ok=yes
1000 SHLIB_LD="gcc -shared"
1001 SHLIB_LD_LIBS=""
1002 LD_SEARCH_FLAGS=''
1003 CC_SEARCH_FLAGS=''
1004 ;;
1005 *)
1006 AC_MSG_WARN("64bit mode not supported with GCC on $system")
1007 ;;
1008 esac
1009 else
1010 do64bit_ok=yes
1011 if test "`uname -m`" = "ia64" ; then
1012 EXTRA_CFLAGS="+DD64"
1013 LDFLAGS="+DD64 $LDFLAGS"
1014 else
1015 EXTRA_CFLAGS="+DA2.0W"
1016 LDFLAGS="+DA2.0W $LDFLAGS"
1017 fi
1018 fi
1019 fi
1020 ;;
1021 HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
1022 SHLIB_SUFFIX=".sl"
1023 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1024 if test "$tcl_ok" = yes; then
1025 SHLIB_CFLAGS="+z"
1026 SHLIB_LD="ld -b"
1027 SHLIB_LD_LIBS=""
1028 DL_OBJS="tclLoadShl.o"
1029 DL_LIBS="-ldld"
1030 LDFLAGS="-Wl,-E"
1031 CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1032 LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1033 LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1034 fi
1035 ;;
1036 IRIX-4.*)
1037 SHLIB_CFLAGS="-G 0"
1038 SHLIB_SUFFIX=".a"
1039 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
1040 SHLIB_LD_LIBS='${LIBS}'
1041 DL_OBJS="tclLoadAout.o"
1042 DL_LIBS=""
1043 LDFLAGS="-Wl,-D,08000000"
1044 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1045 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1046 SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
1047 ;;
1048 IRIX-5.*)
1049 SHLIB_CFLAGS=""
1050 SHLIB_LD="ld -shared -rdata_shared"
1051 SHLIB_LD_LIBS='${LIBS}'
1052 SHLIB_SUFFIX=".so"
1053 DL_OBJS="tclLoadDl.o"
1054 DL_LIBS=""
1055 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1056 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1057 EXTRA_CFLAGS=""
1058 LDFLAGS=""
1059 ;;
1060 IRIX-6.*|IRIX64-6.5*)
1061 SHLIB_CFLAGS=""
1062 SHLIB_LD="ld -n32 -shared -rdata_shared"
1063 SHLIB_LD_LIBS='${LIBS}'
1064 SHLIB_SUFFIX=".so"
1065 DL_OBJS="tclLoadDl.o"
1066 DL_LIBS=""
1067 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1068 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1069 if test "$GCC" = "yes" ; then
1070 EXTRA_CFLAGS="-mabi=n32"
1071 LDFLAGS="-mabi=n32"
1072 else
1073 case $system in
1074 IRIX-6.3)
1075 # Use to build 6.2 compatible binaries on 6.3.
1076 EXTRA_CFLAGS="-n32 -D_OLD_TERMIOS"
1077 ;;
1078 *)
1079 EXTRA_CFLAGS="-n32"
1080 ;;
1081 esac
1082 LDFLAGS="-n32"
1083 fi
1084 ;;
1085 IRIX64-6.*)
1086 SHLIB_CFLAGS=""
1087 SHLIB_LD="ld -n32 -shared -rdata_shared"
1088 SHLIB_LD_LIBS='${LIBS}'
1089 SHLIB_SUFFIX=".so"
1090 DL_OBJS="tclLoadDl.o"
1091 DL_LIBS=""
1092 LDFLAGS=""
1093 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1094 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1095
1096 # Check to enable 64-bit flags for compiler/linker
1097
1098 if test "$do64bit" = "yes" ; then
1099 if test "$GCC" = "yes" ; then
1100 AC_MSG_WARN([64bit mode not supported by gcc])
1101 else
1102 do64bit_ok=yes
1103 SHLIB_LD="ld -64 -shared -rdata_shared"
1104 EXTRA_CFLAGS="-64"
1105 LDFLAGS="-64"
1106 fi
1107 fi
1108 ;;
1109 Linux*)
1110 SHLIB_CFLAGS="-fPIC"
1111 SHLIB_LD_LIBS='${LIBS}'
1112 SHLIB_SUFFIX=".so"
1113
1114 # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
1115 # when you inline the string and math operations. Turn this off to
1116 # get rid of the warnings.
1117
1118 CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
1119
1120 if test "$have_dl" = yes; then
1121 SHLIB_LD="${CC} -shared"
1122 DL_OBJS="tclLoadDl.o"
1123 DL_LIBS="-ldl"
1124 LDFLAGS="-rdynamic"
1125 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1126 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1127 else
1128 AC_CHECK_HEADER(dld.h, [
1129 SHLIB_LD="ld -shared"
1130 DL_OBJS="tclLoadDld.o"
1131 DL_LIBS="-ldld"
1132 LDFLAGS=""
1133 CC_SEARCH_FLAGS=""
1134 LD_SEARCH_FLAGS=""])
1135 fi
1136 if test "`uname -m`" = "alpha" ; then
1137 EXTRA_CFLAGS="-mieee"
1138 fi
1139
1140 # The combo of gcc + glibc has a bug related
1141 # to inlining of functions like strtod(). The
1142 # -fno-builtin flag should address this problem
1143 # but it does not work. The -fno-inline flag
1144 # is kind of overkill but it works.
1145 # Disable inlining only when one of the
1146 # files in compat/*.c is being linked in.
1147 if test x"${HAVE_COMPAT}" = "xtrue" ; then
1148 EXTRA_CFLAGS="${EXTRA_CFLAGS} -fno-inline"
1149 fi
1150
1151 # XIM peeking works under XFree86.
1152 AC_DEFINE(PEEK_XCLOSEIM)
1153
1154 ;;
1155 GNU*)
1156 SHLIB_CFLAGS="-fPIC"
1157 SHLIB_LD_LIBS='${LIBS}'
1158 SHLIB_SUFFIX=".so"
1159
1160 if test "$have_dl" = yes; then
1161 SHLIB_LD="${CC} -shared"
1162 DL_OBJS=""
1163 DL_LIBS="-ldl"
1164 LDFLAGS="-rdynamic"
1165 CC_SEARCH_FLAGS=""
1166 LD_SEARCH_FLAGS=""
1167 else
1168 AC_CHECK_HEADER(dld.h, [
1169 SHLIB_LD="ld -shared"
1170 DL_OBJS=""
1171 DL_LIBS="-ldld"
1172 LDFLAGS=""
1173 CC_SEARCH_FLAGS=""
1174 LD_SEARCH_FLAGS=""])
1175 fi
1176 if test "`uname -m`" = "alpha" ; then
1177 EXTRA_CFLAGS="-mieee"
1178 fi
1179 ;;
1180 MP-RAS-02*)
1181 SHLIB_CFLAGS="-K PIC"
1182 SHLIB_LD="cc -G"
1183 SHLIB_LD_LIBS=""
1184 SHLIB_SUFFIX=".so"
1185 DL_OBJS="tclLoadDl.o"
1186 DL_LIBS="-ldl"
1187 LDFLAGS=""
1188 CC_SEARCH_FLAGS=""
1189 LD_SEARCH_FLAGS=""
1190 ;;
1191 MP-RAS-*)
1192 SHLIB_CFLAGS="-K PIC"
1193 SHLIB_LD="cc -G"
1194 SHLIB_LD_LIBS=""
1195 SHLIB_SUFFIX=".so"
1196 DL_OBJS="tclLoadDl.o"
1197 DL_LIBS="-ldl"
1198 LDFLAGS="-Wl,-Bexport"
1199 CC_SEARCH_FLAGS=""
1200 LD_SEARCH_FLAGS=""
1201 ;;
1202 NetBSD-*|FreeBSD-[[1-2]].*|OpenBSD-*)
1203 # Not available on all versions: check for include file.
1204 AC_CHECK_HEADER(dlfcn.h, [
1205 # NetBSD/SPARC needs -fPIC, -fpic will not do.
1206 SHLIB_CFLAGS="-fPIC"
1207 SHLIB_LD="ld -Bshareable -x"
1208 SHLIB_LD_LIBS=""
1209 SHLIB_SUFFIX=".so"
1210 DL_OBJS="tclLoadDl.o"
1211 DL_LIBS=""
1212 LDFLAGS=""
1213 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1214 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1215 AC_MSG_CHECKING(for ELF)
1216 AC_EGREP_CPP(yes, [
1217 #ifdef __ELF__
1218 yes
1219 #endif
1220 ],
1221 AC_MSG_RESULT(yes)
1222 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so',
1223 AC_MSG_RESULT(no)
1224 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
1225 )
1226 ], [
1227 SHLIB_CFLAGS=""
1228 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
1229 SHLIB_LD_LIBS='${LIBS}'
1230 SHLIB_SUFFIX=".a"
1231 DL_OBJS="tclLoadAout.o"
1232 DL_LIBS=""
1233 LDFLAGS=""
1234 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1235 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1236 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1237 ])
1238
1239 # FreeBSD doesn't handle version numbers with dots.
1240
1241 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1242 TCL_LIB_VERSIONS_OK=nodots
1243 ;;
1244 FreeBSD-*)
1245 # FreeBSD 3.* and greater have ELF.
1246 SHLIB_CFLAGS="-fPIC"
1247 SHLIB_LD="ld -Bshareable -x"
1248 SHLIB_LD_LIBS='${LIBS}'
1249 SHLIB_SUFFIX=".so"
1250 DL_OBJS="tclLoadDl.o"
1251 DL_LIBS=""
1252 LDFLAGS="-export-dynamic"
1253 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1254 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1255 if test "${TCL_THREADS}" = "1" ; then
1256 # The -pthread needs to go in the CFLAGS, not LIBS
1257 LIBS=`echo $LIBS | sed s/-pthread//`
1258 EXTRA_CFLAGS="-pthread"
1259 LDFLAGS="$LDFLAGS -pthread"
1260 fi
1261 case $system in
1262 FreeBSD-3.*)
1263 # FreeBSD-3 doesn't handle version numbers with dots.
1264 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1265 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
1266 TCL_LIB_VERSIONS_OK=nodots
1267 ;;
1268 esac
1269 ;;
1270 Rhapsody-*|Darwin-*)
1271 SHLIB_CFLAGS="-fno-common"
1272 SHLIB_LD="cc -dynamiclib \${LDFLAGS}"
1273 TCL_SHLIB_LD_EXTRAS="-compatibility_version ${TCL_VERSION} -current_version \${VERSION} -install_name \${DYLIB_INSTALL_DIR}/\${TCL_LIB_FILE} -prebind -seg1addr 0xa000000"
1274 TK_SHLIB_LD_EXTRAS="-compatibility_version ${TK_VERSION} -current_version \${VERSION} -install_name \${DYLIB_INSTALL_DIR}/\${TK_LIB_FILE} -prebind -seg1addr 0xb000000"
1275 SHLIB_LD_LIBS='${LIBS}'
1276 SHLIB_SUFFIX=".dylib"
1277 DL_OBJS="tclLoadDyld.o"
1278 PLAT_OBJS="tclMacOSXBundle.o"
1279 DL_LIBS=""
1280 LDFLAGS="-prebind"
1281 CC_SEARCH_FLAGS=""
1282 LD_SEARCH_FLAGS=""
1283 CFLAGS_OPTIMIZE="-Os"
1284 LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
1285 # for compatibility with autoconf vers 2.13 :
1286 HACK=""
1287 EXTRA_CFLAGS="-DMA${HACK}C_OSX_TCL -DHAVE_CFBUNDLE -DUSE_VFORK -DTCL_DEFAULT_ENCODING=\\\"utf-8\\\""
1288 LIBS="$LIBS -framework CoreFoundation"
1289 ;;
1290 NEXTSTEP-*)
1291 SHLIB_CFLAGS=""
1292 SHLIB_LD="cc -nostdlib -r"
1293 SHLIB_LD_LIBS=""
1294 SHLIB_SUFFIX=".so"
1295 DL_OBJS="tclLoadNext.o"
1296 DL_LIBS=""
1297 LDFLAGS=""
1298 CC_SEARCH_FLAGS=""
1299 LD_SEARCH_FLAGS=""
1300 ;;
1301 OS/390-*)
1302 CFLAGS_OPTIMIZE="" # Optimizer is buggy
1303 AC_DEFINE(_OE_SOCKETS) # needed in sys/socket.h
1304 ;;
1305 OSF1-1.0|OSF1-1.1|OSF1-1.2)
1306 # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
1307 SHLIB_CFLAGS=""
1308 # Hack: make package name same as library name
1309 SHLIB_LD='ld -R -export $@:'
1310 SHLIB_LD_LIBS=""
1311 SHLIB_SUFFIX=".so"
1312 DL_OBJS="tclLoadOSF.o"
1313 DL_LIBS=""
1314 LDFLAGS=""
1315 CC_SEARCH_FLAGS=""
1316 LD_SEARCH_FLAGS=""
1317 ;;
1318 OSF1-1.*)
1319 # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
1320 SHLIB_CFLAGS="-fPIC"
1321 if test "$SHARED_BUILD" = "1" ; then
1322 SHLIB_LD="ld -shared"
1323 else
1324 SHLIB_LD="ld -non_shared"
1325 fi
1326 SHLIB_LD_LIBS=""
1327 SHLIB_SUFFIX=".so"
1328 DL_OBJS="tclLoadDl.o"
1329 DL_LIBS=""
1330 LDFLAGS=""
1331 CC_SEARCH_FLAGS=""
1332 LD_SEARCH_FLAGS=""
1333 ;;
1334 OSF1-V*)
1335 # Digital OSF/1
1336 SHLIB_CFLAGS=""
1337 if test "$SHARED_BUILD" = "1" ; then
1338 SHLIB_LD='ld -shared -expect_unresolved "*"'
1339 else
1340 SHLIB_LD='ld -non_shared -expect_unresolved "*"'
1341 fi
1342 SHLIB_LD_LIBS=""
1343 SHLIB_SUFFIX=".so"
1344 DL_OBJS="tclLoadDl.o"
1345 DL_LIBS=""
1346 LDFLAGS=""
1347 CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1348 LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
1349 if test "$GCC" != "yes" ; then
1350 EXTRA_CFLAGS="-DHAVE_TZSET -std1"
1351 fi
1352 # see pthread_intro(3) for pthread support on osf1, k.furukawa
1353 if test "${TCL_THREADS}" = "1" ; then
1354 EXTRA_CFLAGS="${EXTRA_CFLAGS} -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
1355 EXTRA_CFLAGS="${EXTRA_CFLAGS} -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
1356 LIBS=`echo $LIBS | sed s/-lpthreads//`
1357 if test "$GCC" = "yes" ; then
1358 LIBS="$LIBS -lpthread -lmach -lexc"
1359 else
1360 EXTRA_CFLAGS="${EXTRA_CFLAGS} -pthread"
1361 LDFLAGS="-pthread"
1362 fi
1363 fi
1364
1365 ;;
1366 QNX-6*)
1367 # QNX RTP
1368 # This may work for all QNX, but it was only reported for v6.
1369 SHLIB_CFLAGS="-fPIC"
1370 SHLIB_LD="ld -Bshareable -x"
1371 SHLIB_LD_LIBS=""
1372 SHLIB_SUFFIX=".so"
1373 DL_OBJS="tclLoadDl.o"
1374 # dlopen is in -lc on QNX
1375 DL_LIBS=""
1376 LDFLAGS=""
1377 CC_SEARCH_FLAGS=""
1378 LD_SEARCH_FLAGS=""
1379 ;;
1380 RISCos-*)
1381 SHLIB_CFLAGS="-G 0"
1382 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
1383 SHLIB_LD_LIBS='${LIBS}'
1384 SHLIB_SUFFIX=".a"
1385 DL_OBJS="tclLoadAout.o"
1386 DL_LIBS=""
1387 LDFLAGS="-Wl,-D,08000000"
1388 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1389 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1390 ;;
1391 SCO_SV-3.2*)
1392 # Note, dlopen is available only on SCO 3.2.5 and greater. However,
1393 # this test works, since "uname -s" was non-standard in 3.2.4 and
1394 # below.
1395 if test "$GCC" = "yes" ; then
1396 SHLIB_CFLAGS="-fPIC -melf"
1397 LDFLAGS="-melf -Wl,-Bexport"
1398 else
1399 SHLIB_CFLAGS="-Kpic -belf"
1400 LDFLAGS="-belf -Wl,-Bexport"
1401 fi
1402 SHLIB_LD="ld -G"
1403 SHLIB_LD_LIBS=""
1404 SHLIB_SUFFIX=".so"
1405 DL_OBJS="tclLoadDl.o"
1406 DL_LIBS=""
1407 CC_SEARCH_FLAGS=""
1408 LD_SEARCH_FLAGS=""
1409 ;;
1410 SINIX*5.4*)
1411 SHLIB_CFLAGS="-K PIC"
1412 SHLIB_LD="cc -G"
1413 SHLIB_LD_LIBS=""
1414 SHLIB_SUFFIX=".so"
1415 DL_OBJS="tclLoadDl.o"
1416 DL_LIBS="-ldl"
1417 LDFLAGS=""
1418 CC_SEARCH_FLAGS=""
1419 LD_SEARCH_FLAGS=""
1420 ;;
1421 SunOS-4*)
1422 SHLIB_CFLAGS="-PIC"
1423 SHLIB_LD="ld"
1424 SHLIB_LD_LIBS=""
1425 SHLIB_SUFFIX=".so"
1426 DL_OBJS="tclLoadDl.o"
1427 DL_LIBS="-ldl"
1428 LDFLAGS=""
1429 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1430 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1431
1432 # SunOS can't handle version numbers with dots in them in library
1433 # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
1434 # requires an extra version number at the end of .so file names.
1435 # So, the library has to have a name like libtcl75.so.1.0
1436
1437 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
1438 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
1439 TCL_LIB_VERSIONS_OK=nodots
1440 ;;
1441 SunOS-5.[[0-6]]*)
1442
1443 # Note: If _REENTRANT isn't defined, then Solaris
1444 # won't define thread-safe library routines.
1445
1446 AC_DEFINE(_REENTRANT)
1447 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
1448
1449 SHLIB_CFLAGS="-KPIC"
1450
1451 # Note: need the LIBS below, otherwise Tk won't find Tcl's
1452 # symbols when dynamically loaded into tclsh.
1453
1454 SHLIB_LD_LIBS='${LIBS}'
1455 SHLIB_SUFFIX=".so"
1456 DL_OBJS="tclLoadDl.o"
1457 DL_LIBS="-ldl"
1458 LDFLAGS=""
1459 if test "$GCC" = "yes" ; then
1460 SHLIB_LD="$CC -shared"
1461 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1462 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1463 else
1464 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1465 CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1466 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1467 fi
1468 ;;
1469 SunOS-5*)
1470
1471 # Note: If _REENTRANT isn't defined, then Solaris
1472 # won't define thread-safe library routines.
1473
1474 AC_DEFINE(_REENTRANT)
1475 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
1476
1477 SHLIB_CFLAGS="-KPIC"
1478 LDFLAGS=""
1479
1480 # Check to enable 64-bit flags for compiler/linker
1481 if test "$do64bit" = "yes" ; then
1482 arch=`isainfo`
1483 if test "$arch" = "sparcv9 sparc" ; then
1484 if test "$GCC" = "yes" ; then
1485 AC_MSG_WARN("64bit mode not supported with GCC on $system")
1486 else
1487 do64bit_ok=yes
1488 if test "$do64bitVIS" = "yes" ; then
1489 EXTRA_CFLAGS="-xarch=v9a"
1490 LDFLAGS="-xarch=v9a"
1491 else
1492 EXTRA_CFLAGS="-xarch=v9"
1493 LDFLAGS="-xarch=v9"
1494 fi
1495 fi
1496 else
1497 AC_MSG_WARN("64bit mode only supported sparcv9 system")
1498 fi
1499 fi
1500
1501 # Note: need the LIBS below, otherwise Tk won't find Tcl's
1502 # symbols when dynamically loaded into tclsh.
1503
1504 SHLIB_LD_LIBS='${LIBS}'
1505 SHLIB_SUFFIX=".so"
1506 DL_OBJS="tclLoadDl.o"
1507 DL_LIBS="-ldl"
1508 if test "$GCC" = "yes" ; then
1509 SHLIB_LD="$CC -shared"
1510 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1511 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1512 else
1513 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1514 CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1515 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1516 fi
1517 ;;
1518 ULTRIX-4.*)
1519 SHLIB_CFLAGS="-G 0"
1520 SHLIB_SUFFIX=".a"
1521 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
1522 SHLIB_LD_LIBS='${LIBS}'
1523 DL_OBJS="tclLoadAout.o"
1524 DL_LIBS=""
1525 LDFLAGS="-Wl,-D,08000000"
1526 CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1527 LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1528 if test "$GCC" != "yes" ; then
1529 EXTRA_CFLAGS="-DHAVE_TZSET -std1"
1530 fi
1531 ;;
1532 UNIX_SV* | UnixWare-5*)
1533 SHLIB_CFLAGS="-KPIC"
1534 SHLIB_LD="cc -G"
1535 SHLIB_LD_LIBS=""
1536 SHLIB_SUFFIX=".so"
1537 DL_OBJS="tclLoadDl.o"
1538 DL_LIBS="-ldl"
1539 # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
1540 # that don't grok the -Bexport option. Test that it does.
1541 hold_ldflags=$LDFLAGS
1542 AC_MSG_CHECKING(for ld accepts -Bexport flag)
1543 LDFLAGS="${LDFLAGS} -Wl,-Bexport"
1544 AC_TRY_LINK(, [int i;], found=yes, found=no)
1545 LDFLAGS=$hold_ldflags
1546 AC_MSG_RESULT($found)
1547 if test $found = yes; then
1548 LDFLAGS="-Wl,-Bexport"
1549 else
1550 LDFLAGS=""
1551 fi
1552 CC_SEARCH_FLAGS=""
1553 LD_SEARCH_FLAGS=""
1554 ;;
1555 esac
1556
1557 if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
1558 AC_MSG_WARN("64bit support being disabled -- don\'t know magic for this platform")
1559 fi
1560
1561 # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
1562 # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop,
1563 # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
1564 # to determine which of several header files defines the a.out file
1565 # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we
1566 # support only a file format that is more or less version-7-compatible.
1567 # In particular,
1568 # - a.out files must begin with `struct exec'.
1569 # - the N_TXTOFF on the `struct exec' must compute the seek address
1570 # of the text segment
1571 # - The `struct exec' must contain a_magic, a_text, a_data, a_bss
1572 # and a_entry fields.
1573 # The following compilation should succeed if and only if either sys/exec.h
1574 # or a.out.h is usable for the purpose.
1575 #
1576 # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
1577 # `struct exec' includes a second header that contains information that
1578 # duplicates the v7 fields that are needed.
1579
1580 if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
1581 AC_MSG_CHECKING(sys/exec.h)
1582 AC_TRY_COMPILE([#include <sys/exec.h>],[
1583 struct exec foo;
1584 unsigned long seek;
1585 int flag;
1586 #if defined(__mips) || defined(mips)
1587 seek = N_TXTOFF (foo.ex_f, foo.ex_o);
1588 #else
1589 seek = N_TXTOFF (foo);
1590 #endif
1591 flag = (foo.a_magic == OMAGIC);
1592 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
1593 ], tcl_ok=usable, tcl_ok=unusable)
1594 AC_MSG_RESULT($tcl_ok)
1595 if test $tcl_ok = usable; then
1596 AC_DEFINE(USE_SYS_EXEC_H)
1597 else
1598 AC_MSG_CHECKING(a.out.h)
1599 AC_TRY_COMPILE([#include <a.out.h>],[
1600 struct exec foo;
1601 unsigned long seek;
1602 int flag;
1603 #if defined(__mips) || defined(mips)
1604 seek = N_TXTOFF (foo.ex_f, foo.ex_o);
1605 #else
1606 seek = N_TXTOFF (foo);
1607 #endif
1608 flag = (foo.a_magic == OMAGIC);
1609 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
1610 ], tcl_ok=usable, tcl_ok=unusable)
1611 AC_MSG_RESULT($tcl_ok)
1612 if test $tcl_ok = usable; then
1613 AC_DEFINE(USE_A_OUT_H)
1614 else
1615 AC_MSG_CHECKING(sys/exec_aout.h)
1616 AC_TRY_COMPILE([#include <sys/exec_aout.h>],[
1617 struct exec foo;
1618 unsigned long seek;
1619 int flag;
1620 #if defined(__mips) || defined(mips)
1621 seek = N_TXTOFF (foo.ex_f, foo.ex_o);
1622 #else
1623 seek = N_TXTOFF (foo);
1624 #endif
1625 flag = (foo.a_midmag == OMAGIC);
1626 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
1627 ], tcl_ok=usable, tcl_ok=unusable)
1628 AC_MSG_RESULT($tcl_ok)
1629 if test $tcl_ok = usable; then
1630 AC_DEFINE(USE_SYS_EXEC_AOUT_H)
1631 else
1632 DL_OBJS=""
1633 fi
1634 fi
1635 fi
1636 fi
1637
1638 # Step 5: disable dynamic loading if requested via a command-line switch.
1639
1640 AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command],
1641 [tcl_ok=$enableval], [tcl_ok=yes])
1642 if test "$tcl_ok" = "no"; then
1643 DL_OBJS=""
1644 fi
1645
1646 if test "x$DL_OBJS" != "x" ; then
1647 BUILD_DLTEST="\$(DLTEST_TARGETS)"
1648 else
1649 echo "Can't figure out how to do dynamic loading or shared libraries"
1650 echo "on this system."
1651 SHLIB_CFLAGS=""
1652 SHLIB_LD=""
1653 SHLIB_SUFFIX=""
1654 DL_OBJS="tclLoadNone.o"
1655 DL_LIBS=""
1656 LDFLAGS=""
1657 CC_SEARCH_FLAGS=""
1658 LD_SEARCH_FLAGS=""
1659 BUILD_DLTEST=""
1660 fi
1661
1662 # If we're running gcc, then change the C flags for compiling shared
1663 # libraries to the right flags for gcc, instead of those for the
1664 # standard manufacturer compiler.
1665
1666 if test "$DL_OBJS" != "tclLoadNone.o" ; then
1667 if test "$GCC" = "yes" ; then
1668 case $system in
1669 AIX-*)
1670 ;;
1671 BSD/OS*)
1672 ;;
1673 IRIX*)
1674 ;;
1675 NetBSD-*|FreeBSD-*|OpenBSD-*)
1676 ;;
1677 Rhapsody-*|Darwin-*)
1678 ;;
1679 RISCos-*)
1680 ;;
1681 SCO_SV-3.2*)
1682 ;;
1683 ULTRIX-4.*)
1684 ;;
1685 *)
1686 SHLIB_CFLAGS="-fPIC"
1687 ;;
1688 esac
1689 fi
1690 fi
1691
1692 if test "$SHARED_LIB_SUFFIX" = "" ; then
1693 SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
1694 fi
1695 if test "$UNSHARED_LIB_SUFFIX" = "" ; then
1696 UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
1697 fi
1698
1699 if test "${SHARED_BUILD}" = "1" && test "${SHLIB_SUFFIX}" != "" ; then
1700 LIB_SUFFIX=${SHARED_LIB_SUFFIX}
1701 MAKE_LIB='${SHLIB_LD} -o [$]@ ${SHLIB_LD_FLAGS} ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
1702 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
1703 else
1704 LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
1705
1706 if test "$RANLIB" = "" ; then
1707 MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}'
1708 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
1709 else
1710 MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@'
1711 INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(LIB_FILE))'
1712 fi
1713
1714 dnl Not at all clear what this was doing in Tcl's configure.in
1715 dnl or why it was needed was needed. In any event, this sort of
1716 dnl things needs to be done in the big loop above.
1717 dnl REMOVE THIS BLOCK LATER! (mdejong)
1718 dnl case $system in
1719 dnl BSD/OS*)
1720 dnl ;;
1721 dnl AIX-[[1-4]].*)
1722 dnl ;;
1723 dnl *)
1724 dnl SHLIB_LD_LIBS=""
1725 dnl ;;
1726 dnl esac
1727 fi
1728
1729
1730 # Stub lib does not depend on shared/static configuration
1731 if test "$RANLIB" = "" ; then
1732 MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}'
1733 INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)'
1734 else
1735 MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@'
1736 INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(STUB_LIB_FILE))'
1737 fi
1738
1739
1740 AC_SUBST(DL_LIBS)
1741
1742 AC_SUBST(DL_OBJS)
1743 AC_SUBST(PLAT_OBJS)
1744 AC_SUBST(CFLAGS)
1745 AC_SUBST(CFLAGS_DEBUG)
1746 AC_SUBST(CFLAGS_OPTIMIZE)
1747 AC_SUBST(CFLAGS_WARNING)
1748 AC_SUBST(EXTRA_CFLAGS)
1749
1750 AC_SUBST(LDFLAGS)
1751 AC_SUBST(LDFLAGS_DEBUG)
1752 AC_SUBST(LDFLAGS_OPTIMIZE)
1753 AC_SUBST(CC_SEARCH_FLAGS)
1754 AC_SUBST(LD_SEARCH_FLAGS)
1755
1756 AC_SUBST(STLIB_LD)
1757 AC_SUBST(SHLIB_LD)
1758 AC_SUBST(TCL_SHLIB_LD_EXTRAS)
1759 AC_SUBST(TK_SHLIB_LD_EXTRAS)
1760 AC_SUBST(SHLIB_LD_FLAGS)
1761 AC_SUBST(SHLIB_LD_LIBS)
1762 AC_SUBST(SHLIB_CFLAGS)
1763 AC_SUBST(SHLIB_SUFFIX)
1764
1765 AC_SUBST(MAKE_LIB)
1766 AC_SUBST(MAKE_STUB_LIB)
1767 AC_SUBST(INSTALL_LIB)
1768 AC_SUBST(INSTALL_STUB_LIB)
1769 AC_SUBST(RANLIB)
1770 ])
1771
1772 #--------------------------------------------------------------------
1773 # SC_SERIAL_PORT
1774 #
1775 # Determine which interface to use to talk to the serial port.
1776 # Note that #include lines must begin in leftmost column for
1777 # some compilers to recognize them as preprocessor directives,
1778 # and some build environments have stdin not pointing at a
1779 # pseudo-terminal (usually /dev/null instead.)
1780 #
1781 # Arguments:
1782 # none
1783 #
1784 # Results:
1785 #
1786 # Defines only one of the following vars:
1787 # HAVE_SYS_MODEM_H
1788 # USE_TERMIOS
1789 # USE_TERMIO
1790 # USE_SGTTY
1791 #
1792 #--------------------------------------------------------------------
1793
1794 AC_DEFUN(SC_SERIAL_PORT, [
1795 AC_CHECK_HEADERS(sys/modem.h)
1796 AC_MSG_CHECKING([termios vs. termio vs. sgtty])
1797 AC_CACHE_VAL(tcl_cv_api_serial, [
1798 AC_TRY_RUN([
1799 #include <termios.h>
1800
1801 int main() {
1802 struct termios t;
1803 if (tcgetattr(0, &t) == 0) {
1804 cfsetospeed(&t, 0);
1805 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
1806 return 0;
1807 }
1808 return 1;
1809 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
1810 if test $tcl_cv_api_serial = no ; then
1811 AC_TRY_RUN([
1812 #include <termio.h>
1813
1814 int main() {
1815 struct termio t;
1816 if (ioctl(0, TCGETA, &t) == 0) {
1817 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
1818 return 0;
1819 }
1820 return 1;
1821 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
1822 fi
1823 if test $tcl_cv_api_serial = no ; then
1824 AC_TRY_RUN([
1825 #include <sgtty.h>
1826
1827 int main() {
1828 struct sgttyb t;
1829 if (ioctl(0, TIOCGETP, &t) == 0) {
1830 t.sg_ospeed = 0;
1831 t.sg_flags |= ODDP | EVENP | RAW;
1832 return 0;
1833 }
1834 return 1;
1835 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
1836 fi
1837 if test $tcl_cv_api_serial = no ; then
1838 AC_TRY_RUN([
1839 #include <termios.h>
1840 #include <errno.h>
1841
1842 int main() {
1843 struct termios t;
1844 if (tcgetattr(0, &t) == 0
1845 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
1846 cfsetospeed(&t, 0);
1847 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
1848 return 0;
1849 }
1850 return 1;
1851 }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
1852 fi
1853 if test $tcl_cv_api_serial = no; then
1854 AC_TRY_RUN([
1855 #include <termio.h>
1856 #include <errno.h>
1857
1858 int main() {
1859 struct termio t;
1860 if (ioctl(0, TCGETA, &t) == 0
1861 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
1862 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
1863 return 0;
1864 }
1865 return 1;
1866 }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
1867 fi
1868 if test $tcl_cv_api_serial = no; then
1869 AC_TRY_RUN([
1870 #include <sgtty.h>
1871 #include <errno.h>
1872
1873 int main() {
1874 struct sgttyb t;
1875 if (ioctl(0, TIOCGETP, &t) == 0
1876 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
1877 t.sg_ospeed = 0;
1878 t.sg_flags |= ODDP | EVENP | RAW;
1879 return 0;
1880 }
1881 return 1;
1882 }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
1883 fi])
1884 case $tcl_cv_api_serial in
1885 termios) AC_DEFINE(USE_TERMIOS);;
1886 termio) AC_DEFINE(USE_TERMIO);;
1887 sgtty) AC_DEFINE(USE_SGTTY);;
1888 esac
1889 AC_MSG_RESULT($tcl_cv_api_serial)
1890 ])
1891
1892 #--------------------------------------------------------------------
1893 # SC_MISSING_POSIX_HEADERS
1894 #
1895 # Supply substitutes for missing POSIX header files. Special
1896 # notes:
1897 # - stdlib.h doesn't define strtol, strtoul, or
1898 # strtod insome versions of SunOS
1899 # - some versions of string.h don't declare procedures such
1900 # as strstr
1901 #
1902 # Arguments:
1903 # none
1904 #
1905 # Results:
1906 #
1907 # Defines some of the following vars:
1908 # NO_DIRENT_H
1909 # NO_ERRNO_H
1910 # NO_VALUES_H
1911 # NO_LIMITS_H
1912 # NO_STDLIB_H
1913 # NO_STRING_H
1914 # NO_SYS_WAIT_H
1915 # NO_DLFCN_H
1916 # HAVE_UNISTD_H
1917 # HAVE_SYS_PARAM_H
1918 #
1919 # HAVE_STRING_H ?
1920 #
1921 #--------------------------------------------------------------------
1922
1923 AC_DEFUN(SC_MISSING_POSIX_HEADERS, [
1924 AC_MSG_CHECKING(dirent.h)
1925 AC_TRY_LINK([#include <sys/types.h>
1926 #include <dirent.h>], [
1927 #ifndef _POSIX_SOURCE
1928 # ifdef __Lynx__
1929 /*
1930 * Generate compilation error to make the test fail: Lynx headers
1931 * are only valid if really in the POSIX environment.
1932 */
1933
1934 missing_procedure();
1935 # endif
1936 #endif
1937 DIR *d;
1938 struct dirent *entryPtr;
1939 char *p;
1940 d = opendir("foobar");
1941 entryPtr = readdir(d);
1942 p = entryPtr->d_name;
1943 closedir(d);
1944 ], tcl_ok=yes, tcl_ok=no)
1945
1946 if test $tcl_ok = no; then
1947 AC_DEFINE(NO_DIRENT_H)
1948 fi
1949
1950 AC_MSG_RESULT($tcl_ok)
1951 AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H)])
1952 AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H)])
1953 AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H)])
1954 AC_CHECK_HEADER(limits.h, , [AC_DEFINE(NO_LIMITS_H)])
1955 AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
1956 AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
1957 AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
1958 AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
1959 if test $tcl_ok = 0; then
1960 AC_DEFINE(NO_STDLIB_H)
1961 fi
1962 AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
1963 AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
1964 AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
1965
1966 # See also memmove check below for a place where NO_STRING_H can be
1967 # set and why.
1968
1969 if test $tcl_ok = 0; then
1970 AC_DEFINE(NO_STRING_H)
1971 fi
1972
1973 AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H)])
1974 AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H)])
1975
1976 # OS/390 lacks sys/param.h (and doesn't need it, by chance).
1977
1978 AC_HAVE_HEADERS(unistd.h sys/param.h)
1979
1980 ])
1981
1982 #--------------------------------------------------------------------
1983 # SC_PATH_X
1984 #
1985 # Locate the X11 header files and the X11 library archive. Try
1986 # the ac_path_x macro first, but if it doesn't find the X stuff
1987 # (e.g. because there's no xmkmf program) then check through
1988 # a list of possible directories. Under some conditions the
1989 # autoconf macro will return an include directory that contains
1990 # no include files, so double-check its result just to be safe.
1991 #
1992 # Arguments:
1993 # none
1994 #
1995 # Results:
1996 #
1997 # Sets the the following vars:
1998 # XINCLUDES
1999 # XLIBSW
2000 #
2001 #--------------------------------------------------------------------
2002
2003 AC_DEFUN(SC_PATH_X, [
2004 AC_PATH_X
2005 not_really_there=""
2006 if test "$no_x" = ""; then
2007 if test "$x_includes" = ""; then
2008 AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
2009 else
2010 if test ! -r $x_includes/X11/Intrinsic.h; then
2011 not_really_there="yes"
2012 fi
2013 fi
2014 fi
2015 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
2016 AC_MSG_CHECKING(for X11 header files)
2017 found_xincludes="no"
2018 AC_TRY_CPP([#include <X11/Intrinsic.h>], found_xincludes="yes", found_xincludes="no")
2019 if test "$found_xincludes" = "no"; then
2020 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"
2021 for i in $dirs ; do
2022 if test -r $i/X11/Intrinsic.h; then
2023 AC_MSG_RESULT($i)
2024 XINCLUDES=" -I$i"
2025 found_xincludes="yes"
2026 break
2027 fi
2028 done
2029 fi
2030 else
2031 if test "$x_includes" != ""; then
2032 XINCLUDES="-I$x_includes"
2033 found_xincludes="yes"
2034 fi
2035 fi
2036 if test found_xincludes = "no"; then
2037 AC_MSG_RESULT(couldn't find any!)
2038 fi
2039
2040 if test "$no_x" = yes; then
2041 AC_MSG_CHECKING(for X11 libraries)
2042 XLIBSW=nope
2043 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"
2044 for i in $dirs ; do
2045 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
2046 AC_MSG_RESULT($i)
2047 XLIBSW="-L$i -lX11"
2048 x_libraries="$i"
2049 break
2050 fi
2051 done
2052 else
2053 if test "$x_libraries" = ""; then
2054 XLIBSW=-lX11
2055 else
2056 XLIBSW="-L$x_libraries -lX11"
2057 fi
2058 fi
2059 if test "$XLIBSW" = nope ; then
2060 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
2061 fi
2062 if test "$XLIBSW" = nope ; then
2063 AC_MSG_RESULT(couldn't find any! Using -lX11.)
2064 XLIBSW=-lX11
2065 fi
2066 ])
2067 #--------------------------------------------------------------------
2068 # SC_BLOCKING_STYLE
2069 #
2070 # The statements below check for systems where POSIX-style
2071 # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
2072 # On these systems (mostly older ones), use the old BSD-style
2073 # FIONBIO approach instead.
2074 #
2075 # Arguments:
2076 # none
2077 #
2078 # Results:
2079 #
2080 # Defines some of the following vars:
2081 # HAVE_SYS_IOCTL_H
2082 # HAVE_SYS_FILIO_H
2083 # USE_FIONBIO
2084 # O_NONBLOCK
2085 #
2086 #--------------------------------------------------------------------
2087
2088 AC_DEFUN(SC_BLOCKING_STYLE, [
2089 AC_CHECK_HEADERS(sys/ioctl.h)
2090 AC_CHECK_HEADERS(sys/filio.h)
2091 AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
2092 if test -f /usr/lib/NextStep/software_version; then
2093 system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
2094 else
2095 system=`uname -s`-`uname -r`
2096 if test "$?" -ne 0 ; then
2097 system=unknown
2098 else
2099 # Special check for weird MP-RAS system (uname returns weird
2100 # results, and the version is kept in special file).
2101
2102 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
2103 system=MP-RAS-`awk '{print $3}' /etc/.relid'`
2104 fi
2105 if test "`uname -s`" = "AIX" ; then
2106 system=AIX-`uname -v`.`uname -r`
2107 fi
2108 fi
2109 fi
2110 case $system in
2111 # There used to be code here to use FIONBIO under AIX. However, it
2112 # was reported that FIONBIO doesn't work under AIX 3.2.5. Since
2113 # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
2114 # code (JO, 5/31/97).
2115
2116 OSF*)
2117 AC_DEFINE(USE_FIONBIO)
2118 AC_MSG_RESULT(FIONBIO)
2119 ;;
2120 SunOS-4*)
2121 AC_DEFINE(USE_FIONBIO)
2122 AC_MSG_RESULT(FIONBIO)
2123 ;;
2124 ULTRIX-4.*)
2125 AC_DEFINE(USE_FIONBIO)
2126 AC_MSG_RESULT(FIONBIO)
2127 ;;
2128 *)
2129 AC_MSG_RESULT(O_NONBLOCK)
2130 ;;
2131 esac
2132 ])
2133
2134 #--------------------------------------------------------------------
2135 # SC_TIME_HANLDER
2136 #
2137 # Checks how the system deals with time.h, what time structures
2138 # are used on the system, and what fields the structures have.
2139 #
2140 # Arguments:
2141 # none
2142 #
2143 # Results:
2144 #
2145 # Defines some of the following vars:
2146 # USE_DELTA_FOR_TZ
2147 # HAVE_TM_GMTOFF
2148 # HAVE_TM_TZADJ
2149 # HAVE_TIMEZONE_VAR
2150 #
2151 #--------------------------------------------------------------------
2152
2153 AC_DEFUN(SC_TIME_HANDLER, [
2154 AC_CHECK_HEADERS(sys/time.h)
2155 AC_HEADER_TIME
2156 AC_STRUCT_TIMEZONE
2157
2158 AC_CHECK_FUNCS(gmtime_r localtime_r)
2159
2160 AC_MSG_CHECKING([tm_tzadj in struct tm])
2161 AC_CACHE_VAL(tcl_cv_member_tm_tzadj,
2162 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
2163 tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no))
2164 AC_MSG_RESULT($tcl_cv_member_tm_tzadj)
2165 if test $tcl_cv_member_tm_tzadj = yes ; then
2166 AC_DEFINE(HAVE_TM_TZADJ)
2167 fi
2168
2169 AC_MSG_CHECKING([tm_gmtoff in struct tm])
2170 AC_CACHE_VAL(tcl_cv_member_tm_gmtoff,
2171 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
2172 tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no))
2173 AC_MSG_RESULT($tcl_cv_member_tm_gmtoff)
2174 if test $tcl_cv_member_tm_gmtoff = yes ; then
2175 AC_DEFINE(HAVE_TM_GMTOFF)
2176 fi
2177
2178 #
2179 # Its important to include time.h in this check, as some systems
2180 # (like convex) have timezone functions, etc.
2181 #
2182 AC_MSG_CHECKING([long timezone variable])
2183 AC_CACHE_VAL(tcl_cv_var_timezone,
2184 AC_TRY_COMPILE([#include <time.h>],
2185 [extern long timezone;
2186 timezone += 1;
2187 exit (0);],
2188 tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no))
2189 AC_MSG_RESULT($tcl_cv_timezone_long)
2190 if test $tcl_cv_timezone_long = yes ; then
2191 AC_DEFINE(HAVE_TIMEZONE_VAR)
2192 else
2193 #
2194 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
2195 #
2196 AC_MSG_CHECKING([time_t timezone variable])
2197 AC_CACHE_VAL(tcl_cv_timezone_time,
2198 AC_TRY_COMPILE([#include <time.h>],
2199 [extern time_t timezone;
2200 timezone += 1;
2201 exit (0);],
2202 tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no))
2203 AC_MSG_RESULT($tcl_cv_timezone_time)
2204 if test $tcl_cv_timezone_time = yes ; then
2205 AC_DEFINE(HAVE_TIMEZONE_VAR)
2206 fi
2207 fi
2208 ])
2209
2210 #--------------------------------------------------------------------
2211 # SC_BUGGY_STRTOD
2212 #
2213 # Under Solaris 2.4, strtod returns the wrong value for the
2214 # terminating character under some conditions. Check for this
2215 # and if the problem exists use a substitute procedure
2216 # "fixstrtod" (provided by Tcl) that corrects the error.
2217 # Also, on Compaq's Tru64 Unix 5.0,
2218 # strtod(" ") returns 0.0 instead of a failure to convert.
2219 #
2220 # Arguments:
2221 # none
2222 #
2223 # Results:
2224 #
2225 # Might defines some of the following vars:
2226 # strtod (=fixstrtod)
2227 #
2228 #--------------------------------------------------------------------
2229
2230 AC_DEFUN(SC_BUGGY_STRTOD, [
2231 AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
2232 if test "$tcl_strtod" = 1; then
2233 AC_MSG_CHECKING([for Solaris2.4/Tru64 strtod bugs])
2234 AC_CACHE_VAL(tcl_cv_strtod_buggy,[
2235 AC_TRY_RUN([
2236 extern double strtod();
2237 int main() {
2238 char *infString="Inf", *nanString="NaN", *spaceString=" ";
2239 char *term;
2240 double value;
2241 value = strtod(infString, &term);
2242 if ((term != infString) && (term[-1] == 0)) {
2243 exit(1);
2244 }
2245 value = strtod(nanString, &term);
2246 if ((term != nanString) && (term[-1] == 0)) {
2247 exit(1);
2248 }
2249 value = strtod(spaceString, &term);
2250 if (term == (spaceString+1)) {
2251 exit(1);
2252 }
2253 exit(0);
2254 }], tcl_cv_strtod_buggy=1, tcl_cv_strtod_buggy=0, tcl_cv_strtod_buggy=0)])
2255 if test "$tcl_cv_strtod_buggy" = 1; then
2256 AC_MSG_RESULT(ok)
2257 else
2258 AC_MSG_RESULT(buggy)
2259 # upgrade to 2.5x egm 3/25/03
2260 AC_LIBOBJ(fixstrtod.o)
2261 HAVE_COMPAT=true
2262 AC_DEFINE(strtod, fixstrtod)
2263 fi
2264 fi
2265 ])
2266
2267 #--------------------------------------------------------------------
2268 # SC_TCL_LINK_LIBS
2269 #
2270 # Search for the libraries needed to link the Tcl shell.
2271 # Things like the math library (-lm) and socket stuff (-lsocket vs.
2272 # -lnsl) are dealt with here.
2273 #
2274 # Arguments:
2275 # Requires the following vars to be set in the Makefile:
2276 # DL_LIBS
2277 # LIBS
2278 # MATH_LIBS
2279 #
2280 # Results:
2281 #
2282 # Subst's the following var:
2283 # TCL_LIBS
2284 # MATH_LIBS
2285 #
2286 # Might append to the following vars:
2287 # LIBS
2288 #
2289 # Might define the following vars:
2290 # HAVE_NET_ERRNO_H
2291 #
2292 #--------------------------------------------------------------------
2293
2294 AC_DEFUN(SC_TCL_LINK_LIBS, [
2295 #--------------------------------------------------------------------
2296 # On a few very rare systems, all of the libm.a stuff is
2297 # already in libc.a. Set compiler flags accordingly.
2298 # Also, Linux requires the "ieee" library for math to work
2299 # right (and it must appear before "-lm").
2300 #--------------------------------------------------------------------
2301
2302 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
2303 AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
2304
2305 #--------------------------------------------------------------------
2306 # Interactive UNIX requires -linet instead of -lsocket, plus it
2307 # needs net/errno.h to define the socket-related error codes.
2308 #--------------------------------------------------------------------
2309
2310 AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
2311 AC_CHECK_HEADER(net/errno.h, [AC_DEFINE(HAVE_NET_ERRNO_H)])
2312
2313 #--------------------------------------------------------------------
2314 # Check for the existence of the -lsocket and -lnsl libraries.
2315 # The order here is important, so that they end up in the right
2316 # order in the command line generated by make. Here are some
2317 # special considerations:
2318 # 1. Use "connect" and "accept" to check for -lsocket, and
2319 # "gethostbyname" to check for -lnsl.
2320 # 2. Use each function name only once: can't redo a check because
2321 # autoconf caches the results of the last check and won't redo it.
2322 # 3. Use -lnsl and -lsocket only if they supply procedures that
2323 # aren't already present in the normal libraries. This is because
2324 # IRIX 5.2 has libraries, but they aren't needed and they're
2325 # bogus: they goof up name resolution if used.
2326 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
2327 # To get around this problem, check for both libraries together
2328 # if -lsocket doesn't work by itself.
2329 #--------------------------------------------------------------------
2330
2331 tcl_checkBoth=0
2332 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
2333 if test "$tcl_checkSocket" = 1; then
2334 AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
2335 LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
2336 fi
2337 if test "$tcl_checkBoth" = 1; then
2338 tk_oldLibs=$LIBS
2339 LIBS="$LIBS -lsocket -lnsl"
2340 AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
2341 fi
2342 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
2343 [LIBS="$LIBS -lnsl"])])
2344
2345 # Don't perform the eval of the libraries here because DL_LIBS
2346 # won't be set until we call SC_CONFIG_CFLAGS
2347
2348 TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
2349 AC_SUBST(TCL_LIBS)
2350 AC_SUBST(MATH_LIBS)
2351 ])
2352
2353 #--------------------------------------------------------------------
2354 # SC_TCL_EARLY_FLAGS
2355 #
2356 # Check for what flags are needed to be passed so the correct OS
2357 # features are available.
2358 #
2359 # Arguments:
2360 # None
2361 #
2362 # Results:
2363 #
2364 # Might define the following vars:
2365 # _ISOC99_SOURCE
2366 # _LARGEFILE64_SOURCE
2367 #
2368 #--------------------------------------------------------------------
2369
2370 AC_DEFUN(SC_TCL_EARLY_FLAG,[
2371 AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
2372 AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
2373 AC_TRY_COMPILE([[#define ]$1[ 1
2374 ]$2], $3,
2375 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
2376 [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
2377 if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
2378 AC_DEFINE($1)
2379 tcl_flags="$tcl_flags $1"
2380 fi])
2381
2382 AC_DEFUN(SC_TCL_EARLY_FLAGS,[
2383 AC_MSG_CHECKING([for required early compiler flags])
2384 tcl_flags=""
2385 SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
2386 [char *p = (char *)strtoll; char *q = (char *)strtoull;])
2387 SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
2388 [struct stat64 buf; int i = stat64("/", &buf);])
2389 if test "x${tcl_flags}" = "x" ; then
2390 AC_MSG_RESULT(none)
2391 else
2392 AC_MSG_RESULT(${tcl_flags})
2393 fi])
2394
2395 #--------------------------------------------------------------------
2396 # SC_TCL_64BIT_FLAGS
2397 #
2398 # Check for what is defined in the way of 64-bit features.
2399 #
2400 # Arguments:
2401 # None
2402 #
2403 # Results:
2404 #
2405 # Might define the following vars:
2406 # TCL_WIDE_INT_IS_LONG
2407 # TCL_WIDE_INT_TYPE
2408 # HAVE_STRUCT_DIRENT64
2409 # HAVE_STRUCT_STAT64
2410 # HAVE_TYPE_OFF64_T
2411 #
2412 #--------------------------------------------------------------------
2413
2414 AC_DEFUN(SC_TCL_64BIT_FLAGS, [
2415 AC_MSG_CHECKING([for 64-bit integer type])
2416 AC_CACHE_VAL(tcl_cv_type_64bit,[
2417 tcl_cv_type_64bit=none
2418 # See if the compiler knows natively about __int64
2419 AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
2420 tcl_type_64bit=__int64, tcl_type_64bit="long long")
2421 # See if we should use long anyway Note that we substitute in the
2422 # type that is our current guess for a 64-bit type inside this check
2423 # program, so it should be modified only carefully...
2424 AC_TRY_RUN([#include <unistd.h>
2425 int main() {exit(!(sizeof(]${tcl_type_64bit}[) > sizeof(long)));}
2426 ], tcl_cv_type_64bit=${tcl_type_64bit},:,:)])
2427 if test "${tcl_cv_type_64bit}" = none ; then
2428 AC_DEFINE(TCL_WIDE_INT_IS_LONG)
2429 AC_MSG_RESULT(using long)
2430 else
2431 AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit})
2432 AC_MSG_RESULT(${tcl_cv_type_64bit})
2433
2434 # Now check for auxiliary declarations
2435 AC_MSG_CHECKING([for struct dirent64])
2436 AC_CACHE_VAL(tcl_cv_struct_dirent64,[
2437 AC_TRY_COMPILE([#include <sys/types.h>
2438 #include <sys/dirent.h>],[struct dirent64 p;],
2439 tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
2440 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
2441 AC_DEFINE(HAVE_STRUCT_DIRENT64)
2442 fi
2443 AC_MSG_RESULT(${tcl_cv_struct_dirent64})
2444
2445 AC_MSG_CHECKING([for struct stat64])
2446 AC_CACHE_VAL(tcl_cv_struct_stat64,[
2447 AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
2448 ],
2449 tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
2450 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
2451 AC_DEFINE(HAVE_STRUCT_STAT64)
2452 fi
2453 AC_MSG_RESULT(${tcl_cv_struct_stat64})
2454
2455 AC_MSG_CHECKING([for off64_t])
2456 AC_CACHE_VAL(tcl_cv_type_off64_t,[
2457 AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
2458 ],
2459 tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
2460 if test "x${tcl_cv_type_off64_t}" = "xyes" ; then
2461 AC_DEFINE(HAVE_TYPE_OFF64_T)
2462 fi
2463 AC_MSG_RESULT(${tcl_cv_type_off64_t})
2464 fi])