Debian Codegraph @

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