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-tclconfig 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]]* 2>/dev/null` \
48 ../../tcl \
49 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
50 ../../../tcl \
51 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
52 if test -f "$i/unix/tclConfig.sh" ; then
53 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
54 break
55 fi
56 done
57 fi
58
59 # check in a few common install locations
60 if test x"${ac_cv_c_tclconfig}" = x ; then
61 for i in `ls -d ${prefix}/lib 2>/dev/null` \
62 `ls -d /usr/local/lib 2>/dev/null` ; do
63 if test -f "$i/tclConfig.sh" ; then
64 ac_cv_c_tclconfig=`(cd $i; pwd)`
65 break
66 fi
67 done
68 fi
69
70 # check in a few other private locations
71 if test x"${ac_cv_c_tcliconfig}" = x ; then
72 for i in \
73 ${srcdir}/../tcl \
74 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
75 if test -f "$i/unix/tclConfig.sh" ; then
76 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
77 break
78 fi
79 done
80 fi
81 ])
82
83 if test x"${ac_cv_c_tclconfig}" = x ; then
84 TCL_BIN_DIR="# no Tcl configs found"
85 AC_MSG_WARN(Can't find Tcl configuration definitions)
86 # exit 0
87 else
88 no_tcl=
89 TCL_BIN_DIR=${ac_cv_c_tclconfig}
90 AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
91 fi
92 fi
93 ])
94
95 #------------------------------------------------------------------------
96 # SC_PATH_TKCONFIG --
97 #
98 # Locate the tkConfig.sh file
99 #
100 # Arguments:
101 # none
102 #
103 # Results:
104 #
105 # Adds the following arguments to configure:
106 # --with-tk=...
107 #
108 # Defines the following vars:
109 # TK_BIN_DIR Full path to the directory containing
110 # the tkConfig.sh file
111 #------------------------------------------------------------------------
112
113 AC_DEFUN([SC_PATH_TKCONFIG], [
114 #
115 # Ok, lets find the tk configuration
116 # First, look for one uninstalled.
117 # the alternative search directory is invoked by --with-tk
118 #
119
120 if test x"${no_tk}" = x ; then
121 # we reset no_tk in case something fails here
122 no_tk=true
123 AC_ARG_WITH(tk, [ --with-tk directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval})
124 AC_MSG_CHECKING([for Tk configuration])
125 AC_CACHE_VAL(ac_cv_c_tkconfig,[
126
127 # First check to see if --with-tkconfig was specified.
128 if test x"${with_tkconfig}" != x ; then
129 if test -f "${with_tkconfig}/tkConfig.sh" ; then
130 ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
131 else
132 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
133 fi
134 fi
135
136 # then check for a private Tk library
137 if test x"${ac_cv_c_tkconfig}" = x ; then
138 for i in \
139 ../tk \
140 `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
141 ../../tk \
142 `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
143 ../../../tk \
144 `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
145 if test -f "$i/unix/tkConfig.sh" ; then
146 ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
147 break
148 fi
149 done
150 fi
151 # check in a few common install locations
152 if test x"${ac_cv_c_tkconfig}" = x ; then
153 for i in `ls -d ${prefix}/lib 2>/dev/null` \
154 `ls -d /usr/local/lib 2>/dev/null` ; do
155 if test -f "$i/tkConfig.sh" ; then
156 ac_cv_c_tkconfig=`(cd $i; pwd)`
157 break
158 fi
159 done
160 fi
161 # check in a few other private locations
162 if test x"${ac_cv_c_tkconfig}" = x ; then
163 for i in \
164 ${srcdir}/../tk \
165 `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
166 if test -f "$i/unix/tkConfig.sh" ; then
167 ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
168 break
169 fi
170 done
171 fi
172 ])
173 if test x"${ac_cv_c_tkconfig}" = x ; then
174 TK_BIN_DIR="# no Tk configs found"
175 AC_MSG_WARN(Can't find Tk configuration definitions)
176 # exit 0
177 else
178 no_tk=
179 TK_BIN_DIR=${ac_cv_c_tkconfig}
180 AC_MSG_RESULT(found $TK_BIN_DIR/tkConfig.sh)
181 fi
182 fi
183
184 ])
185
186 #------------------------------------------------------------------------
187 # SC_LOAD_TCLCONFIG --
188 #
189 # Load the tclConfig.sh file
190 #
191 # Arguments:
192 #
193 # Requires the following vars to be set:
194 # TCL_BIN_DIR
195 #
196 # Results:
197 #
198 # Subst the following vars:
199 # TCL_BIN_DIR
200 # TCL_SRC_DIR
201 # TCL_LIB_FILE
202 #
203 #------------------------------------------------------------------------
204
205 AC_DEFUN([SC_LOAD_TCLCONFIG], [
206 AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
207
208 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
209 AC_MSG_RESULT([loading])
210 . $TCL_BIN_DIR/tclConfig.sh
211 else
212 AC_MSG_RESULT([file not found])
213 fi
214
215 #
216 # The eval is required to do the TCL_DBGX substitution in the
217 # TCL_LIB_FILE variable
218 #
219
220 eval TCL_LIB_FILE=${TCL_LIB_FILE}
221 eval TCL_LIB_FLAG=${TCL_LIB_FLAG}
222
223 AC_SUBST(TCL_BIN_DIR)
224 AC_SUBST(TCL_SRC_DIR)
225 AC_SUBST(TCL_LIB_FILE)
226 ])
227
228 #------------------------------------------------------------------------
229 # SC_LOAD_TKCONFIG --
230 #
231 # Load the tkConfig.sh file
232 #
233 # Arguments:
234 #
235 # Requires the following vars to be set:
236 # TK_BIN_DIR
237 #
238 # Results:
239 #
240 # Sets the following vars that should be in tkConfig.sh:
241 # TK_BIN_DIR
242 #------------------------------------------------------------------------
243
244 AC_DEFUN([SC_LOAD_TKCONFIG], [
245 AC_MSG_CHECKING([for existence of $TCLCONFIG])
246
247 if test -f "$TK_BIN_DIR/tkConfig.sh" ; then
248 AC_MSG_CHECKING([loading $TK_BIN_DIR/tkConfig.sh])
249 . $TK_BIN_DIR/tkConfig.sh
250 else
251 AC_MSG_RESULT([could not find $TK_BIN_DIR/tkConfig.sh])
252 fi
253
254 AC_SUBST(TK_BIN_DIR)
255 AC_SUBST(TK_SRC_DIR)
256 AC_SUBST(TK_LIB_FILE)
257 ])
258
259 #------------------------------------------------------------------------
260 # SC_ENABLE_GCC --
261 #
262 # Allows the use of GCC if available
263 #
264 # Arguments:
265 # none
266 #
267 # Results:
268 #
269 # Adds the following arguments to configure:
270 # --enable-gcc
271 #
272 # Sets the following vars:
273 # CC Command to use for the compiler
274 #------------------------------------------------------------------------
275
276 AC_DEFUN([SC_ENABLE_GCC], [
277 AC_ARG_ENABLE(gcc, [ --enable-gcc allow use of gcc if available [--disable-gcc]],
278 [ok=$enableval], [ok=no])
279 if test "$ok" = "yes"; then
280 CC=gcc
281 AC_PROG_CC
282 else
283 CC=${CC-cc}
284 fi
285 ])
286
287 #------------------------------------------------------------------------
288 # SC_ENABLE_SHARED --
289 #
290 # Allows the building of shared libraries
291 #
292 # Arguments:
293 # none
294 #
295 # Results:
296 #
297 # Adds the following arguments to configure:
298 # --enable-shared=yes|no
299 #
300 # Defines the following vars:
301 # STATIC_BUILD Used for building import/export libraries
302 # on Windows.
303 #
304 # Sets the following vars:
305 # SHARED_BUILD Value of 1 or 0
306 #------------------------------------------------------------------------
307
308 AC_DEFUN([SC_ENABLE_SHARED], [
309 AC_MSG_CHECKING([how to build libraries])
310 AC_ARG_ENABLE(shared,
311 [ --enable-shared build and link with shared libraries [--enable-shared]],
312 [tcl_ok=$enableval], [tcl_ok=yes])
313
314 if test "${enable_shared+set}" = set; then
315 enableval="$enable_shared"
316 tcl_ok=$enableval
317 else
318 tcl_ok=yes
319 fi
320
321 if test "$tcl_ok" = "yes" ; then
322 AC_MSG_RESULT([shared])
323 SHARED_BUILD=1
324 else
325 AC_MSG_RESULT([static])
326 SHARED_BUILD=0
327 AC_DEFINE(STATIC_BUILD)
328 fi
329 ])
330
331 #------------------------------------------------------------------------
332 # SC_ENABLE_THREADS --
333 #
334 # Specify if thread support should be enabled
335 #
336 # Arguments:
337 # none
338 #
339 # Results:
340 #
341 # Adds the following arguments to configure:
342 # --enable-threads
343 #
344 # Sets the following vars:
345 # THREADS_LIBS Thread library(s)
346 #
347 # Defines the following vars:
348 # TCL_THREADS
349 # _REENTRANT
350 #
351 #------------------------------------------------------------------------
352
353 AC_DEFUN([SC_ENABLE_THREADS], [
354 AC_MSG_CHECKING(for building with threads)
355 AC_ARG_ENABLE(threads, [ --enable-threads build with threads],
356 [tcl_ok=$enableval], [tcl_ok=no])
357
358 if test "$tcl_ok" = "yes"; then
359 AC_MSG_RESULT(yes)
360 TCL_THREADS=1
361 AC_DEFINE(TCL_THREADS)
362 AC_DEFINE(_REENTRANT)
363 AC_DEFINE(_THREAD_SAFE)
364 AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
365 if test "$tcl_ok" = "no"; then
366 # Check a little harder for __pthread_mutex_init in the same
367 # library, as some systems hide it there until pthread.h is
368 # defined. We could alternatively do an AC_TRY_COMPILE with
369 # pthread.h, but that will work with libpthread really doesn't
370 # exist, like AIX 4.2. [Bug: 4359]
371 AC_CHECK_LIB(pthread,__pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
372 fi
373
374 if test "$tcl_ok" = "yes"; then
375 # The space is needed
376 THREADS_LIBS=" -lpthread"
377 else
378 AC_CHECK_LIB(pthreads,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
379 if test "$tcl_ok" = "yes"; then
380 # The space is needed
381 THREADS_LIBS=" -lpthreads"
382 else
383 AC_CHECK_LIB(c,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
384 if test "$tcl_ok" = "no"; then
385 TCL_THREADS=0
386 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...")
387 fi
388 fi
389 fi
390
391 # Does the pthread-implementation provide
392 # 'pthread_attr_setstacksize' ?
393
394 AC_CHECK_FUNCS(pthread_attr_setstacksize)
395 else
396 TCL_THREADS=0
397 AC_MSG_RESULT(no (default))
398 fi
399 ])
400
401 #------------------------------------------------------------------------
402 # SC_ENABLE_SYMBOLS --
403 #
404 # Specify if debugging symbols should be used
405 #
406 # Arguments:
407 # none
408 #
409 # Requires the following vars to be set:
410 # CFLAGS_DEBUG
411 # CFLAGS_OPTIMIZE
412 # LDFLAGS_DEBUG
413 # LDFLAGS_OPTIMIZE
414 #
415 # Results:
416 #
417 # Adds the following arguments to configure:
418 # --enable-symbols
419 #
420 # Defines the following vars:
421 # CFLAGS_DEFAULT Sets to CFLAGS_DEBUG if true
422 # Sets to CFLAGS_OPTIMIZE if false
423 # LDFLAGS_DEFAULT Sets to LDFLAGS_DEBUG if true
424 # Sets to LDFLAGS_OPTIMIZE if false
425 # DBGX Debug library extension
426 #
427 #------------------------------------------------------------------------
428
429 AC_DEFUN([SC_ENABLE_SYMBOLS], [
430 AC_MSG_CHECKING([for build with symbols])
431 AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no])
432 if test "$tcl_ok" = "yes"; then
433 CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
434 LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
435 DBGX=g
436 AC_MSG_RESULT([yes])
437 else
438 CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}"
439 LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
440 DBGX=""
441 AC_MSG_RESULT([no])
442 fi
443 ])
444
445 #--------------------------------------------------------------------
446 # SC_CONFIG_CFLAGS
447 #
448 # Try to determine the proper flags to pass to the compiler
449 # for building shared libraries and other such nonsense.
450 #
451 # Arguments:
452 # none
453 #
454 # Results:
455 #
456 # Defines the following vars:
457 #
458 # DL_OBJS - Name of the object file that implements dynamic
459 # loading for Tcl on this system.
460 # DL_LIBS - Library file(s) to include in tclsh and other base
461 # applications in order for the "load" command to work.
462 # LDFLAGS - Flags to pass to the compiler when linking object
463 # files into an executable application binary such
464 # as tclsh.
465 # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
466 # that tell the run-time dynamic linker where to look
467 # for shared libraries such as libtcl.so. Depends on
468 # the variable LIB_RUNTIME_DIR in the Makefile.
469 # MAKE_LIB - Command to execute to build the Tcl library;
470 # differs depending on whether or not Tcl is being
471 # compiled as a shared library.
472 # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
473 # of a shared library (may request position-independent
474 # code, among other things).
475 # SHLIB_LD - Base command to use for combining object files
476 # into a shared library.
477 # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
478 # creating shared libraries. This symbol typically
479 # goes at the end of the "ld" commands that build
480 # shared libraries. The value of the symbol is
481 # "${LIBS}" if all of the dependent libraries should
482 # be specified when creating a shared library. If
483 # dependent libraries should not be specified (as on
484 # SunOS 4.x, where they cause the link to fail, or in
485 # general if Tcl and Tk aren't themselves shared
486 # libraries), then this symbol has an empty string
487 # as its value.
488 # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
489 # extensions. An empty string means we don't know how
490 # to use shared libraries on this platform.
491 # TCL_LIB_FILE - Name of the file that contains the Tcl library, such
492 # as libtcl7.8.so or libtcl7.8.a.
493 # TCL_LIB_SUFFIX -Specifies everything that comes after the "libtcl"
494 # in the shared library name, using the $VERSION variable
495 # to put the version in the right place. This is used
496 # by platforms that need non-standard library names.
497 # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
498 # to have a version after the .so, and ${VERSION}.a
499 # on AIX, since the Tcl shared library needs to have
500 # a .a extension whereas shared objects for loadable
501 # extensions have a .so extension. Defaults to
502 # ${VERSION}${SHLIB_SUFFIX}.
503 # TCL_NEEDS_EXP_FILE -
504 # 1 means that an export file is needed to link to a
505 # shared library.
506 # TCL_EXP_FILE - The name of the installed export / import file which
507 # should be used to link to the Tcl shared library.
508 # Empty if Tcl is unshared.
509 # TCL_BUILD_EXP_FILE -
510 # The name of the built export / import file which
511 # should be used to link to the Tcl shared library.
512 # Empty if Tcl is unshared.
513 # CFLAGS_DEBUG -
514 # Flags used when running the compiler in debug mode
515 # CFLAGS_OPTIMIZE -
516 # Flags used when running the compiler in optimize mode
517 #
518 # EXTRA_CFLAGS
519 #
520 # Subst's the following vars:
521 # DL_LIBS
522 # CFLAGS_DEBUG
523 # CFLAGS_OPTIMIZE
524 #--------------------------------------------------------------------
525
526 AC_DEFUN([SC_CONFIG_CFLAGS], [
527
528 # Step 0.a: Enable 64 bit support?
529
530 AC_MSG_CHECKING([if 64bit support is requested])
531 AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)],,enableval="no")
532
533 if test "$enableval" = "yes"; then
534 do64bit=yes
535 else
536 do64bit=no
537 fi
538 AC_MSG_RESULT($do64bit)
539
540 # Step 0.b: Enable Solaris 64 bit VIS support?
541
542 AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
543 AC_ARG_ENABLE(64bit-vis,[ --enable-64bit-vis enable 64bit Sparc VIS support],,enableval="no")
544
545 if test "$enableval" = "yes"; then
546 # Force 64bit on with VIS
547 do64bit=yes
548 do64bitVIS=yes
549 else
550 do64bitVIS=no
551 fi
552 AC_MSG_RESULT($do64bitVIS)
553
554 # Step 1: set the variable "system" to hold the name and version number
555 # for the system. This can usually be done via the "uname" command, but
556 # there are a few systems, like Next, where this doesn't work.
557
558 AC_MSG_CHECKING([system version (for dynamic loading)])
559 if test -f /usr/lib/NextStep/software_version; then
560 system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
561 else
562 system=`uname -s`-`uname -r`
563 if test "$?" -ne 0 ; then
564 AC_MSG_RESULT([unknown (can't find uname command)])
565 system=unknown
566 else
567 # Special check for weird MP-RAS system (uname returns weird
568 # results, and the version is kept in special file).
569
570 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
571 system=MP-RAS-`awk '{print $3}' /etc/.relid'`
572 fi
573 if test "`uname -s`" = "AIX" ; then
574 system=AIX-`uname -v`.`uname -r`
575 fi
576 AC_MSG_RESULT($system)
577 fi
578 fi
579
580 AC_MSG_CHECKING([if gcc is being used])
581 if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
582 using_gcc="yes"
583 else
584 using_gcc="no"
585 fi
586
587 AC_MSG_RESULT([$using_gcc ($CC)])
588
589 # Step 2: check for existence of -ldl library. This is needed because
590 # Linux can use either -ldl or -ldld for dynamic loading.
591
592 AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
593
594 # Step 3: set configuration options based on system name and version.
595
596 do64bit_ok=no
597 fullSrcDir=`cd $srcdir; pwd`
598 EXTRA_CFLAGS=""
599 TCL_EXPORT_FILE_SUFFIX=""
600 UNSHARED_LIB_SUFFIX=""
601 TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
602 ECHO_VERSION='`echo ${VERSION}`'
603 TCL_LIB_VERSIONS_OK=ok
604 CFLAGS_DEBUG=-g
605 CFLAGS_OPTIMIZE=-O
606 if test "$using_gcc" = "yes" ; then
607 CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int"
608 else
609 CFLAGS_WARNING=""
610 fi
611 TCL_NEEDS_EXP_FILE=0
612 TCL_BUILD_EXP_FILE=""
613 TCL_EXP_FILE=""
614 STLIB_LD="ar cr"
615 case $system in
616 AIX-4.[[2-9]])
617 if test "${TCL_THREADS}" = "1" -a "$using_gcc" = "no" ; then
618 # AIX requires the _r compiler when gcc isn't being used
619 if test "${CC}" != "cc_r" ; then
620 CC=${CC}_r
621 fi
622 AC_MSG_RESULT(Using $CC for compiling with threads)
623 fi
624 SHLIB_CFLAGS=""
625 SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
626 SHLIB_LD_LIBS='${LIBS}'
627 SHLIB_SUFFIX=".so"
628 DL_OBJS="tclLoadDl.o"
629 DL_LIBS="-ldl"
630 LDFLAGS=""
631 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
632 TCL_NEEDS_EXP_FILE=1
633 TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
634 ;;
635 AIX-*)
636 if test "${TCL_THREADS}" = "1" -a "$using_gcc" = "no" ; then
637 # AIX requires the _r compiler when gcc isn't being used
638 if test "${CC}" != "cc_r" ; then
639 CC=${CC}_r
640 fi
641 AC_MSG_RESULT(Using $CC for compiling with threads)
642 fi
643 SHLIB_CFLAGS=""
644 SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
645 SHLIB_LD_LIBS='${LIBS}'
646 SHLIB_SUFFIX=".so"
647 DL_OBJS="tclLoadDl.o"
648 LIBOBJS="$LIBOBJS tclLoadAix.o"
649 DL_LIBS="-lld"
650 LDFLAGS=""
651 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
652 TCL_NEEDS_EXP_FILE=1
653 TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
654 ;;
655 BSD/OS-2.1*|BSD/OS-3*)
656 SHLIB_CFLAGS=""
657 SHLIB_LD="shlicc -r"
658 SHLIB_LD_LIBS='${LIBS}'
659 SHLIB_SUFFIX=".so"
660 DL_OBJS="tclLoadDl.o"
661 DL_LIBS="-ldl"
662 LDFLAGS=""
663 LD_SEARCH_FLAGS=""
664 ;;
665 BSD/OS-4.*)
666 SHLIB_CFLAGS="-export-dynamic -fPIC"
667 SHLIB_LD="cc -shared"
668 SHLIB_LD_LIBS='${LIBS}'
669 SHLIB_SUFFIX=".so"
670 DL_OBJS="tclLoadDl.o"
671 DL_LIBS="-ldl"
672 LDFLAGS="-export-dynamic"
673 LD_SEARCH_FLAGS=""
674 ;;
675 dgux*)
676 SHLIB_CFLAGS="-K PIC"
677 SHLIB_LD="cc -G"
678 SHLIB_LD_LIBS=""
679 SHLIB_SUFFIX=".so"
680 DL_OBJS="tclLoadDl.o"
681 DL_LIBS="-ldl"
682 LDFLAGS=""
683 LD_SEARCH_FLAGS=""
684 ;;
685 HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*|HP-UX-*.11.*)
686 SHLIB_SUFFIX=".sl"
687 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
688 if test "$tcl_ok" = yes; then
689 SHLIB_CFLAGS="+z"
690 SHLIB_LD="ld -b"
691 SHLIB_LD_LIBS=""
692 DL_OBJS="tclLoadShl.o"
693 DL_LIBS="-ldld"
694 LDFLAGS="-Wl,-E"
695 LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
696 fi
697 ;;
698 IRIX-4.*)
699 SHLIB_CFLAGS="-G 0"
700 SHLIB_SUFFIX=".a"
701 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
702 SHLIB_LD_LIBS='${LIBS}'
703 DL_OBJS="tclLoadAout.o"
704 DL_LIBS=""
705 LDFLAGS="-Wl,-D,08000000"
706 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
707 SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
708 ;;
709 IRIX-5.*|IRIX-6.*|IRIX64-6.5*)
710 SHLIB_CFLAGS=""
711 SHLIB_LD="ld -n32 -shared -rdata_shared"
712 SHLIB_LD_LIBS='${LIBS}'
713 SHLIB_SUFFIX=".so"
714 DL_OBJS="tclLoadDl.o"
715 DL_LIBS=""
716 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
717 if test "$using_gcc" = "yes" ; then
718 EXTRA_CFLAGS="-mabi=n32"
719 LDFLAGS="-mabi=n32"
720 else
721 case $system in
722 IRIX-6.3)
723 # Use to build 6.2 compatible binaries on 6.3.
724 EXTRA_CFLAGS="-n32 -D_OLD_TERMIOS"
725 ;;
726 *)
727 EXTRA_CFLAGS="-n32"
728 ;;
729 esac
730 LDFLAGS="-n32"
731 fi
732 ;;
733 IRIX64-6.*)
734 SHLIB_CFLAGS=""
735 SHLIB_LD="ld -32 -shared -rdata_shared"
736 SHLIB_LD_LIBS='${LIBS}'
737 SHLIB_SUFFIX=".so"
738 DL_OBJS="tclLoadDl.o"
739 DL_LIBS=""
740 LDFLAGS=""
741 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
742 ;;
743 Linux*)
744 SHLIB_CFLAGS="-fPIC"
745 SHLIB_LD_LIBS='${LIBS}'
746 SHLIB_SUFFIX=".so"
747
748 # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
749 # when you inline the string and math operations. Turn this off to
750 # get rid of the warnings.
751
752 CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
753
754 if test "$have_dl" = yes; then
755 SHLIB_LD="${CC} -shared"
756 DL_OBJS="tclLoadDl.o"
757 DL_LIBS="-ldl"
758 LDFLAGS="-rdynamic"
759 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
760 else
761 AC_CHECK_HEADER(dld.h, [
762 SHLIB_LD="ld -shared"
763 DL_OBJS="tclLoadDld.o"
764 DL_LIBS="-ldld"
765 LDFLAGS=""
766 LD_SEARCH_FLAGS=""])
767 fi
768 if test "`uname -m`" = "alpha" ; then
769 EXTRA_CFLAGS="-mieee"
770 fi
771 ;;
772 MP-RAS-02*)
773 SHLIB_CFLAGS="-K PIC"
774 SHLIB_LD="cc -G"
775 SHLIB_LD_LIBS=""
776 SHLIB_SUFFIX=".so"
777 DL_OBJS="tclLoadDl.o"
778 DL_LIBS="-ldl"
779 LDFLAGS=""
780 LD_SEARCH_FLAGS=""
781 ;;
782 MP-RAS-*)
783 SHLIB_CFLAGS="-K PIC"
784 SHLIB_LD="cc -G"
785 SHLIB_LD_LIBS=""
786 SHLIB_SUFFIX=".so"
787 DL_OBJS="tclLoadDl.o"
788 DL_LIBS="-ldl"
789 LDFLAGS="-Wl,-Bexport"
790 LD_SEARCH_FLAGS=""
791 ;;
792 NetBSD-*|FreeBSD-[[1-2]].*|OpenBSD-*)
793 # Not available on all versions: check for include file.
794 AC_CHECK_HEADER(dlfcn.h, [
795 # NetBSD/SPARC needs -fPIC, -fpic will not do.
796 SHLIB_CFLAGS="-fPIC"
797 SHLIB_LD="ld -Bshareable -x"
798 SHLIB_LD_LIBS=""
799 SHLIB_SUFFIX=".so"
800 DL_OBJS="tclLoadDl.o"
801 DL_LIBS=""
802 LDFLAGS=""
803 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
804 AC_MSG_CHECKING(for ELF)
805 AC_EGREP_CPP(yes, [
806 #ifdef __ELF__
807 yes
808 #endif
809 ],
810 AC_MSG_RESULT(yes)
811 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so',
812 AC_MSG_RESULT(no)
813 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
814 )
815 ], [
816 SHLIB_CFLAGS=""
817 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
818 SHLIB_LD_LIBS='${LIBS}'
819 SHLIB_SUFFIX=".a"
820 DL_OBJS="tclLoadAout.o"
821 DL_LIBS=""
822 LDFLAGS=""
823 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
824 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
825 ])
826
827 # FreeBSD doesn't handle version numbers with dots.
828
829 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
830 TCL_LIB_VERSIONS_OK=nodots
831 ;;
832 FreeBSD-*)
833 # FreeBSD 3.* and greater have ELF.
834 SHLIB_CFLAGS="-fPIC"
835 SHLIB_LD="ld -Bshareable -x"
836 SHLIB_LD_LIBS=""
837 SHLIB_SUFFIX=".so"
838 DL_OBJS="tclLoadDl.o"
839 DL_LIBS=""
840 LDFLAGS="-export-dynamic"
841 LD_SEARCH_FLAGS=""
842 ;;
843 NEXTSTEP-*)
844 SHLIB_CFLAGS=""
845 SHLIB_LD="cc -nostdlib -r"
846 SHLIB_LD_LIBS=""
847 SHLIB_SUFFIX=".so"
848 DL_OBJS="tclLoadNext.o"
849 DL_LIBS=""
850 LDFLAGS=""
851 LD_SEARCH_FLAGS=""
852 ;;
853 OS/390-*)
854 CFLAGS_OPTIMIZE="" # Optimizer is buggy
855 AC_DEFINE(_OE_SOCKETS) # needed in sys/socket.h
856 ;;
857 OSF1-1.0|OSF1-1.1|OSF1-1.2)
858 # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
859 SHLIB_CFLAGS=""
860 # Hack: make package name same as library name
861 SHLIB_LD='ld -R -export $@:'
862 SHLIB_LD_LIBS=""
863 SHLIB_SUFFIX=".so"
864 DL_OBJS="tclLoadOSF.o"
865 DL_LIBS=""
866 LDFLAGS=""
867 LD_SEARCH_FLAGS=""
868 ;;
869 OSF1-1.*)
870 # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
871 SHLIB_CFLAGS="-fPIC"
872 SHLIB_LD="ld -shared"
873 SHLIB_LD_LIBS=""
874 SHLIB_SUFFIX=".so"
875 DL_OBJS="tclLoadDl.o"
876 DL_LIBS=""
877 LDFLAGS=""
878 LD_SEARCH_FLAGS=""
879 ;;
880 OSF1-V*)
881 # Digital OSF/1
882 SHLIB_CFLAGS=""
883 SHLIB_LD='ld -shared -expect_unresolved "*"'
884 SHLIB_LD_LIBS=""
885 SHLIB_SUFFIX=".so"
886 DL_OBJS="tclLoadDl.o"
887 DL_LIBS=""
888 LDFLAGS=""
889 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
890 if test "$using_gcc" = "no" ; then
891 EXTRA_CFLAGS="-DHAVE_TZSET -std1"
892 fi
893 # see pthread_intro(3) for pthread support on osf1, k.furukawa
894 if test "${TCL_THREADS}" = "1" ; then
895 EXTRA_CFLAGS="${EXTRA_CFLAGS} -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
896 if test "$using_gcc" = "no" ; then
897 EXTRA_CFLAGS="${EXTRA_CFLAGS} -pthread"
898 LDFLAGS="-pthread"
899 else
900 LIBS=`echo $LIBS | sed s/-lpthreads//`
901 LIBS="$LIBS -lpthread -lmach -lexc"
902 fi
903 fi
904
905 ;;
906 RISCos-*)
907 SHLIB_CFLAGS="-G 0"
908 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
909 SHLIB_LD_LIBS='${LIBS}'
910 SHLIB_SUFFIX=".a"
911 DL_OBJS="tclLoadAout.o"
912 DL_LIBS=""
913 LDFLAGS="-Wl,-D,08000000"
914 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
915 ;;
916 SCO_SV-3.2*)
917 # Note, dlopen is available only on SCO 3.2.5 and greater. However,
918 # this test works, since "uname -s" was non-standard in 3.2.4 and
919 # below.
920 if test "$using_gcc" = "yes" ; then
921 SHLIB_CFLAGS="-fPIC -melf"
922 LDFLAGS="-melf -Wl,-Bexport"
923 else
924 SHLIB_CFLAGS="-Kpic -belf"
925 LDFLAGS="-belf -Wl,-Bexport"
926 fi
927 SHLIB_LD="ld -G"
928 SHLIB_LD_LIBS=""
929 SHLIB_SUFFIX=".so"
930 DL_OBJS="tclLoadDl.o"
931 DL_LIBS=""
932 LD_SEARCH_FLAGS=""
933 ;;
934 SINIX*5.4*)
935 SHLIB_CFLAGS="-K PIC"
936 SHLIB_LD="cc -G"
937 SHLIB_LD_LIBS=""
938 SHLIB_SUFFIX=".so"
939 DL_OBJS="tclLoadDl.o"
940 DL_LIBS="-ldl"
941 LDFLAGS=""
942 LD_SEARCH_FLAGS=""
943 ;;
944 SunOS-4*)
945 SHLIB_CFLAGS="-PIC"
946 SHLIB_LD="ld"
947 SHLIB_LD_LIBS=""
948 SHLIB_SUFFIX=".so"
949 DL_OBJS="tclLoadDl.o"
950 DL_LIBS="-ldl"
951 LDFLAGS=""
952 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
953
954 # SunOS can't handle version numbers with dots in them in library
955 # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
956 # requires an extra version number at the end of .so file names.
957 # So, the library has to have a name like libtcl75.so.1.0
958
959 SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
960 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
961 TCL_LIB_VERSIONS_OK=nodots
962 ;;
963 SunOS-5.[[0-6]]*)
964 SHLIB_CFLAGS="-KPIC"
965 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
966
967 # Note: need the LIBS below, otherwise Tk won't find Tcl's
968 # symbols when dynamically loaded into tclsh.
969
970 SHLIB_LD_LIBS='${LIBS}'
971 SHLIB_SUFFIX=".so"
972 DL_OBJS="tclLoadDl.o"
973 DL_LIBS="-ldl"
974 LDFLAGS=""
975 LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
976 ;;
977 SunOS-5*)
978 SHLIB_CFLAGS="-KPIC"
979 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
980 LDFLAGS=""
981
982 do64bit_ok=no
983 if test "$do64bit" = "yes" ; then
984 arch=`isainfo`
985 if test "$arch" = "sparcv9 sparc" ; then
986 if test "$using_gcc" = "no" ; then
987 do64bit_ok=yes
988 if test "$do64bitVIS" = "yes" ; then
989 EXTRA_CFLAGS="-xarch=v9a"
990 LDFLAGS="-xarch=v9a"
991 else
992 EXTRA_CFLAGS="-xarch=v9"
993 LDFLAGS="-xarch=v9"
994 fi
995 else
996 AC_MSG_WARN("64bit mode not supported with GCC on $system")
997 fi
998 else
999 AC_MSG_WARN("64bit mode only supported sparcv9 system")
1000 fi
1001 fi
1002
1003 # Note: need the LIBS below, otherwise Tk won't find Tcl's
1004 # symbols when dynamically loaded into tclsh.
1005
1006 SHLIB_LD_LIBS='${LIBS}'
1007 SHLIB_SUFFIX=".so"
1008 DL_OBJS="tclLoadDl.o"
1009 DL_LIBS="-ldl"
1010 if test "$using_gcc" = "yes" ; then
1011 LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1012 else
1013 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1014 fi
1015 ;;
1016 ULTRIX-4.*)
1017 SHLIB_CFLAGS="-G 0"
1018 SHLIB_SUFFIX=".a"
1019 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
1020 SHLIB_LD_LIBS='${LIBS}'
1021 DL_OBJS="tclLoadAout.o"
1022 DL_LIBS=""
1023 LDFLAGS="-Wl,-D,08000000"
1024 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1025 if test "$using_gcc" = "no" ; then
1026 EXTRA_CFLAGS="-DHAVE_TZSET -std1"
1027 fi
1028 ;;
1029 UNIX_SV* | UnixWare-5*)
1030 SHLIB_CFLAGS="-KPIC"
1031 SHLIB_LD="cc -G"
1032 SHLIB_LD_LIBS=""
1033 SHLIB_SUFFIX=".so"
1034 DL_OBJS="tclLoadDl.o"
1035 DL_LIBS="-ldl"
1036 # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
1037 # that don't grok the -Bexport option. Test that it does.
1038 hold_ldflags=$LDFLAGS
1039 AC_MSG_CHECKING(for ld accepts -Bexport flag)
1040 LDFLAGS="${LDFLAGS} -Wl,-Bexport"
1041 AC_TRY_LINK(, [int i;], found=yes, found=no)
1042 LDFLAGS=$hold_ldflags
1043 AC_MSG_RESULT($found)
1044 if test $found = yes; then
1045 LDFLAGS="-Wl,-Bexport"
1046 else
1047 LDFLAGS=""
1048 fi
1049 LD_SEARCH_FLAGS=""
1050 ;;
1051 esac
1052
1053 if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
1054 AC_MSG_WARN("64bit support being disabled -- don\'t know magic for this platform")
1055 fi
1056
1057 # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
1058 # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop,
1059 # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
1060 # to determine which of several header files defines the a.out file
1061 # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we
1062 # support only a file format that is more or less version-7-compatible.
1063 # In particular,
1064 # - a.out files must begin with `struct exec'.
1065 # - the N_TXTOFF on the `struct exec' must compute the seek address
1066 # of the text segment
1067 # - The `struct exec' must contain a_magic, a_text, a_data, a_bss
1068 # and a_entry fields.
1069 # The following compilation should succeed if and only if either sys/exec.h
1070 # or a.out.h is usable for the purpose.
1071 #
1072 # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
1073 # `struct exec' includes a second header that contains information that
1074 # duplicates the v7 fields that are needed.
1075
1076 if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
1077 AC_MSG_CHECKING(sys/exec.h)
1078 AC_TRY_COMPILE([#include <sys/exec.h>],[
1079 struct exec foo;
1080 unsigned long seek;
1081 int flag;
1082 #if defined(__mips) || defined(mips)
1083 seek = N_TXTOFF (foo.ex_f, foo.ex_o);
1084 #else
1085 seek = N_TXTOFF (foo);
1086 #endif
1087 flag = (foo.a_magic == OMAGIC);
1088 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
1089 ], tcl_ok=usable, tcl_ok=unusable)
1090 AC_MSG_RESULT($tcl_ok)
1091 if test $tcl_ok = usable; then
1092 AC_DEFINE(USE_SYS_EXEC_H)
1093 else
1094 AC_MSG_CHECKING(a.out.h)
1095 AC_TRY_COMPILE([#include <a.out.h>],[
1096 struct exec foo;
1097 unsigned long seek;
1098 int flag;
1099 #if defined(__mips) || defined(mips)
1100 seek = N_TXTOFF (foo.ex_f, foo.ex_o);
1101 #else
1102 seek = N_TXTOFF (foo);
1103 #endif
1104 flag = (foo.a_magic == OMAGIC);
1105 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
1106 ], tcl_ok=usable, tcl_ok=unusable)
1107 AC_MSG_RESULT($tcl_ok)
1108 if test $tcl_ok = usable; then
1109 AC_DEFINE(USE_A_OUT_H)
1110 else
1111 AC_MSG_CHECKING(sys/exec_aout.h)
1112 AC_TRY_COMPILE([#include <sys/exec_aout.h>],[
1113 struct exec foo;
1114 unsigned long seek;
1115 int flag;
1116 #if defined(__mips) || defined(mips)
1117 seek = N_TXTOFF (foo.ex_f, foo.ex_o);
1118 #else
1119 seek = N_TXTOFF (foo);
1120 #endif
1121 flag = (foo.a_midmag == OMAGIC);
1122 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
1123 ], tcl_ok=usable, tcl_ok=unusable)
1124 AC_MSG_RESULT($tcl_ok)
1125 if test $tcl_ok = usable; then
1126 AC_DEFINE(USE_SYS_EXEC_AOUT_H)
1127 else
1128 DL_OBJS=""
1129 fi
1130 fi
1131 fi
1132 fi
1133
1134 # Step 5: disable dynamic loading if requested via a command-line switch.
1135
1136 AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command],
1137 [tcl_ok=$enableval], [tcl_ok=yes])
1138 if test "$tcl_ok" = "no"; then
1139 DL_OBJS=""
1140 fi
1141
1142 if test "x$DL_OBJS" != "x" ; then
1143 BUILD_DLTEST="\$(DLTEST_TARGETS)"
1144 else
1145 echo "Can't figure out how to do dynamic loading or shared libraries"
1146 echo "on this system."
1147 SHLIB_CFLAGS=""
1148 SHLIB_LD=""
1149 SHLIB_SUFFIX=""
1150 DL_OBJS="tclLoadNone.o"
1151 DL_LIBS=""
1152 LDFLAGS=""
1153 LD_SEARCH_FLAGS=""
1154 BUILD_DLTEST=""
1155 fi
1156
1157 # If we're running gcc, then change the C flags for compiling shared
1158 # libraries to the right flags for gcc, instead of those for the
1159 # standard manufacturer compiler.
1160
1161 if test "$DL_OBJS" != "tclLoadNone.o" ; then
1162 if test "$using_gcc" = "yes" ; then
1163 case $system in
1164 AIX-*)
1165 ;;
1166 BSD/OS*)
1167 ;;
1168 IRIX*)
1169 ;;
1170 NetBSD-*|FreeBSD-*|OpenBSD-*)
1171 ;;
1172 RISCos-*)
1173 ;;
1174 SCO_SV-3.2*)
1175 ;;
1176 ULTRIX-4.*)
1177 ;;
1178 *)
1179 SHLIB_CFLAGS="-fPIC"
1180 ;;
1181 esac
1182 fi
1183 fi
1184
1185 if test "$SHARED_LIB_SUFFIX" = "" ; then
1186 SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
1187 fi
1188 if test "$UNSHARED_LIB_SUFFIX" = "" ; then
1189 UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
1190 fi
1191
1192 AC_SUBST(DL_LIBS)
1193 AC_SUBST(CFLAGS_DEBUG)
1194 AC_SUBST(CFLAGS_OPTIMIZE)
1195 AC_SUBST(CFLAGS_WARNING)
1196 ])
1197
1198 #--------------------------------------------------------------------
1199 # SC_SERIAL_PORT
1200 #
1201 # Determine which interface to use to talk to the serial port.
1202 # Note that #include lines must begin in leftmost column for
1203 # some compilers to recognize them as preprocessor directives.
1204 #
1205 # Arguments:
1206 # none
1207 #
1208 # Results:
1209 #
1210 # Defines only one of the following vars:
1211 # USE_TERMIOS
1212 # USE_TERMIO
1213 # USE_SGTTY
1214 #
1215 #--------------------------------------------------------------------
1216
1217 AC_DEFUN([SC_SERIAL_PORT], [
1218 AC_MSG_CHECKING([termios vs. termio vs. sgtty])
1219
1220 AC_TRY_RUN([
1221 #include <termios.h>
1222
1223 main()
1224 {
1225 struct termios t;
1226 if (tcgetattr(0, &t) == 0) {
1227 cfsetospeed(&t, 0);
1228 t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
1229 return 0;
1230 }
1231 return 1;
1232 }], tk_ok=termios, tk_ok=no, tk_ok=no)
1233
1234 if test $tk_ok = termios; then
1235 AC_DEFINE(USE_TERMIOS)
1236 else
1237 AC_TRY_RUN([
1238 #include <termio.h>
1239
1240 main()
1241 {
1242 struct termio t;
1243 if (ioctl(0, TCGETA, &t) == 0) {
1244 t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
1245 return 0;
1246 }
1247 return 1;
1248 }], tk_ok=termio, tk_ok=no, tk_ok=no)
1249
1250 if test $tk_ok = termio; then
1251 AC_DEFINE(USE_TERMIO)
1252 else
1253 AC_TRY_RUN([
1254 #include <sgtty.h>
1255
1256 main()
1257 {
1258 struct sgttyb t;
1259 if (ioctl(0, TIOCGETP, &t) == 0) {
1260 t.sg_ospeed = 0;
1261 t.sg_flags |= ODDP | EVENP | RAW;
1262 return 0;
1263 }
1264 return 1;
1265 }], tk_ok=sgtty, tk_ok=none, tk_ok=none)
1266 if test $tk_ok = sgtty; then
1267 AC_DEFINE(USE_SGTTY)
1268 fi
1269 fi
1270 fi
1271 AC_MSG_RESULT($tk_ok)
1272 ])
1273
1274 #--------------------------------------------------------------------
1275 # SC_MISSING_POSIX_HEADERS
1276 #
1277 # Supply substitutes for missing POSIX header files. Special
1278 # notes:
1279 # - stdlib.h doesn't define strtol, strtoul, or
1280 # strtod insome versions of SunOS
1281 # - some versions of string.h don't declare procedures such
1282 # as strstr
1283 #
1284 # Arguments:
1285 # none
1286 #
1287 # Results:
1288 #
1289 # Defines some of the following vars:
1290 # NO_DIRENT_H
1291 # NO_ERRNO_H
1292 # NO_VALUES_H
1293 # NO_LIMITS_H
1294 # NO_STDLIB_H
1295 # NO_STRING_H
1296 # NO_SYS_WAIT_H
1297 # NO_DLFCN_H
1298 # HAVE_UNISTD_H
1299 # HAVE_SYS_PARAM_H
1300 #
1301 # HAVE_STRING_H ?
1302 #
1303 #--------------------------------------------------------------------
1304
1305 AC_DEFUN([SC_MISSING_POSIX_HEADERS], [
1306
1307 AC_MSG_CHECKING(dirent.h)
1308 AC_TRY_LINK([#include <sys/types.h>
1309 #include <dirent.h>], [
1310 #ifndef _POSIX_SOURCE
1311 # ifdef __Lynx__
1312 /*
1313 * Generate compilation error to make the test fail: Lynx headers
1314 * are only valid if really in the POSIX environment.
1315 */
1316
1317 missing_procedure();
1318 # endif
1319 #endif
1320 DIR *d;
1321 struct dirent *entryPtr;
1322 char *p;
1323 d = opendir("foobar");
1324 entryPtr = readdir(d);
1325 p = entryPtr->d_name;
1326 closedir(d);
1327 ], tcl_ok=yes, tcl_ok=no)
1328
1329 if test $tcl_ok = no; then
1330 AC_DEFINE(NO_DIRENT_H)
1331 fi
1332
1333 AC_MSG_RESULT($tcl_ok)
1334 AC_CHECK_HEADER(errno.h, , AC_DEFINE(NO_ERRNO_H))
1335 AC_CHECK_HEADER(float.h, , AC_DEFINE(NO_FLOAT_H))
1336 AC_CHECK_HEADER(values.h, , AC_DEFINE(NO_VALUES_H))
1337 AC_CHECK_HEADER(limits.h, , AC_DEFINE(NO_LIMITS_H))
1338 AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
1339 AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
1340 AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
1341 AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
1342 if test $tcl_ok = 0; then
1343 AC_DEFINE(NO_STDLIB_H)
1344 fi
1345 AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
1346 AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
1347 AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
1348
1349 # See also memmove check below for a place where NO_STRING_H can be
1350 # set and why.
1351
1352 if test $tcl_ok = 0; then
1353 AC_DEFINE(NO_STRING_H)
1354 fi
1355
1356 AC_CHECK_HEADER(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H))
1357 AC_CHECK_HEADER(dlfcn.h, , AC_DEFINE(NO_DLFCN_H))
1358
1359 # OS/390 lacks sys/param.h (and doesn't need it, by chance).
1360
1361 AC_HAVE_HEADERS(unistd.h sys/param.h)
1362
1363 ])
1364
1365 #--------------------------------------------------------------------
1366 # SC_PATH_X
1367 #
1368 # Locate the X11 header files and the X11 library archive. Try
1369 # the ac_path_x macro first, but if it doesn't find the X stuff
1370 # (e.g. because there's no xmkmf program) then check through
1371 # a list of possible directories. Under some conditions the
1372 # autoconf macro will return an include directory that contains
1373 # no include files, so double-check its result just to be safe.
1374 #
1375 # Arguments:
1376 # none
1377 #
1378 # Results:
1379 #
1380 # Sets the the following vars:
1381 # XINCLUDES
1382 # XLIBSW
1383 #
1384 #--------------------------------------------------------------------
1385
1386 AC_DEFUN([SC_PATH_X], [
1387 AC_PATH_X
1388 not_really_there=""
1389 if test "$no_x" = ""; then
1390 if test "$x_includes" = ""; then
1391 AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
1392 else
1393 if test ! -r $x_includes/X11/Intrinsic.h; then
1394 not_really_there="yes"
1395 fi
1396 fi
1397 fi
1398 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
1399 AC_MSG_CHECKING(for X11 header files)
1400 XINCLUDES="# no special path needed"
1401 AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
1402 if test "$XINCLUDES" = nope; then
1403 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"
1404 for i in $dirs ; do
1405 if test -r $i/X11/Intrinsic.h; then
1406 AC_MSG_RESULT($i)
1407 XINCLUDES=" -I$i"
1408 break
1409 fi
1410 done
1411 fi
1412 else
1413 if test "$x_includes" != ""; then
1414 XINCLUDES=-I$x_includes
1415 else
1416 XINCLUDES="# no special path needed"
1417 fi
1418 fi
1419 if test "$XINCLUDES" = nope; then
1420 AC_MSG_RESULT(couldn't find any!)
1421 XINCLUDES="# no include files found"
1422 fi
1423
1424 if test "$no_x" = yes; then
1425 AC_MSG_CHECKING(for X11 libraries)
1426 XLIBSW=nope
1427 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"
1428 for i in $dirs ; do
1429 if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
1430 AC_MSG_RESULT($i)
1431 XLIBSW="-L$i -lX11"
1432 x_libraries="$i"
1433 break
1434 fi
1435 done
1436 else
1437 if test "$x_libraries" = ""; then
1438 XLIBSW=-lX11
1439 else
1440 XLIBSW="-L$x_libraries -lX11"
1441 fi
1442 fi
1443 if test "$XLIBSW" = nope ; then
1444 AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
1445 fi
1446 if test "$XLIBSW" = nope ; then
1447 AC_MSG_RESULT(couldn't find any! Using -lX11.)
1448 XLIBSW=-lX11
1449 fi
1450 ])
1451 #--------------------------------------------------------------------
1452 # SC_BLOCKING_STYLE
1453 #
1454 # The statements below check for systems where POSIX-style
1455 # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
1456 # On these systems (mostly older ones), use the old BSD-style
1457 # FIONBIO approach instead.
1458 #
1459 # Arguments:
1460 # none
1461 #
1462 # Results:
1463 #
1464 # Defines some of the following vars:
1465 # HAVE_SYS_IOCTL_H
1466 # HAVE_SYS_FILIO_H
1467 # USE_FIONBIO
1468 # O_NONBLOCK
1469 #
1470 #--------------------------------------------------------------------
1471
1472 AC_DEFUN([SC_BLOCKING_STYLE], [
1473 AC_CHECK_HEADERS(sys/ioctl.h)
1474 AC_CHECK_HEADERS(sys/filio.h)
1475 AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
1476 if test -f /usr/lib/NextStep/software_version; then
1477 system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
1478 else
1479 system=`uname -s`-`uname -r`
1480 if test "$?" -ne 0 ; then
1481 system=unknown
1482 else
1483 # Special check for weird MP-RAS system (uname returns weird
1484 # results, and the version is kept in special file).
1485
1486 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
1487 system=MP-RAS-`awk '{print $3}' /etc/.relid'`
1488 fi
1489 if test "`uname -s`" = "AIX" ; then
1490 system=AIX-`uname -v`.`uname -r`
1491 fi
1492 fi
1493 fi
1494 case $system in
1495 # There used to be code here to use FIONBIO under AIX. However, it
1496 # was reported that FIONBIO doesn't work under AIX 3.2.5. Since
1497 # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
1498 # code (JO, 5/31/97).
1499
1500 OSF*)
1501 AC_DEFINE(USE_FIONBIO)
1502 AC_MSG_RESULT(FIONBIO)
1503 ;;
1504 SunOS-4*)
1505 AC_DEFINE(USE_FIONBIO)
1506 AC_MSG_RESULT(FIONBIO)
1507 ;;
1508 ULTRIX-4.*)
1509 AC_DEFINE(USE_FIONBIO)
1510 AC_MSG_RESULT(FIONBIO)
1511 ;;
1512 *)
1513 AC_MSG_RESULT(O_NONBLOCK)
1514 ;;
1515 esac
1516 ])
1517
1518 #--------------------------------------------------------------------
1519 # SC_TIME_HANLDER
1520 #
1521 # Checks how the system deals with time.h, what time structures
1522 # are used on the system, and what fields the structures have.
1523 #
1524 # Arguments:
1525 # none
1526 #
1527 # Results:
1528 #
1529 # Defines some of the following vars:
1530 # USE_DELTA_FOR_TZ
1531 # HAVE_TM_GMTOFF
1532 # HAVE_TM_TZADJ
1533 # HAVE_TIMEZONE_VAR
1534 #
1535 #--------------------------------------------------------------------
1536
1537 AC_DEFUN([SC_TIME_HANDLER], [
1538 AC_CHECK_HEADERS(sys/time.h)
1539 AC_HEADER_TIME
1540 AC_STRUCT_TIMEZONE
1541
1542 AC_MSG_CHECKING([tm_tzadj in struct tm])
1543 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
1544 [AC_DEFINE(HAVE_TM_TZADJ)
1545 AC_MSG_RESULT(yes)],
1546 AC_MSG_RESULT(no))
1547
1548 AC_MSG_CHECKING([tm_gmtoff in struct tm])
1549 AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
1550 [AC_DEFINE(HAVE_TM_GMTOFF)
1551 AC_MSG_RESULT(yes)],
1552 AC_MSG_RESULT(no))
1553
1554 #
1555 # Its important to include time.h in this check, as some systems
1556 # (like convex) have timezone functions, etc.
1557 #
1558 have_timezone=no
1559 AC_MSG_CHECKING([long timezone variable])
1560 AC_TRY_COMPILE([#include <time.h>],
1561 [extern long timezone;
1562 timezone += 1;
1563 exit (0);],
1564 [have_timezone=yes
1565 AC_DEFINE(HAVE_TIMEZONE_VAR)
1566 AC_MSG_RESULT(yes)],
1567 AC_MSG_RESULT(no))
1568
1569 #
1570 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
1571 #
1572 if test "$have_timezone" = no; then
1573 AC_MSG_CHECKING([time_t timezone variable])
1574 AC_TRY_COMPILE([#include <time.h>],
1575 [extern time_t timezone;
1576 timezone += 1;
1577 exit (0);],
1578 [AC_DEFINE(HAVE_TIMEZONE_VAR)
1579 AC_MSG_RESULT(yes)],
1580 AC_MSG_RESULT(no))
1581 fi
1582
1583 #
1584 # AIX does not have a timezone field in struct tm. When the AIX bsd
1585 # library is used, the timezone global and the gettimeofday methods are
1586 # to be avoided for timezone deduction instead, we deduce the timezone
1587 # by comparing the localtime result on a known GMT value.
1588 #
1589
1590 if test "`uname -s`" = "AIX" ; then
1591 AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes)
1592 if test $libbsd = yes; then
1593 AC_DEFINE(USE_DELTA_FOR_TZ)
1594 fi
1595 fi
1596 ])
1597
1598 #--------------------------------------------------------------------
1599 # SC_BUGGY_STRTOD
1600 #
1601 # Under Solaris 2.4, strtod returns the wrong value for the
1602 # terminating character under some conditions. Check for this
1603 # and if the problem exists use a substitute procedure
1604 # "fixstrtod" (provided by Tcl) that corrects the error.
1605 # Also, on Compaq's Tru64 Unix 5.0,
1606 # strtod(" ") returns 0.0 instead of a failure to convert.
1607 #
1608 # Arguments:
1609 # none
1610 #
1611 # Results:
1612 #
1613 # Might defines some of the following vars:
1614 # strtod (=fixstrtod)
1615 #
1616 #--------------------------------------------------------------------
1617
1618 AC_DEFUN([SC_BUGGY_STRTOD], [
1619 AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
1620 if test "$tcl_strtod" = 1; then
1621 AC_MSG_CHECKING([for Solaris2.4/Tru64 strtod bugs])
1622 AC_TRY_RUN([
1623 extern double strtod();
1624 int main()
1625 {
1626 char *string = "NaN", *spaceString = " ";
1627 char *term;
1628 double value;
1629 value = strtod(string, &term);
1630 if ((term != string) && (term[-1] == 0)) {
1631 exit(1);
1632 }
1633 value = strtod(spaceString, &term);
1634 if (term == (spaceString+1)) {
1635 exit(1);
1636 }
1637 exit(0);
1638 }], tcl_ok=1, tcl_ok=0, tcl_ok=0)
1639 if test "$tcl_ok" = 1; then
1640 AC_MSG_RESULT(ok)
1641 else
1642 AC_MSG_RESULT(buggy)
1643 LIBOBJS="$LIBOBJS fixstrtod.o"
1644 AC_DEFINE(strtod, fixstrtod)
1645 fi
1646 fi
1647 ])
1648
1649 #--------------------------------------------------------------------
1650 # SC_TCL_LINK_LIBS
1651 #
1652 # Search for the libraries needed to link the Tcl shell.
1653 # Things like the math library (-lm) and socket stuff (-lsocket vs.
1654 # -lnsl) are dealt with here.
1655 #
1656 # Arguments:
1657 # Requires the following vars to be set in the Makefile:
1658 # DL_LIBS
1659 # LIBS
1660 # MATH_LIBS
1661 #
1662 # Results:
1663 #
1664 # Subst's the following var:
1665 # TCL_LIBS
1666 # MATH_LIBS
1667 #
1668 # Might append to the following vars:
1669 # LIBS
1670 #
1671 # Might define the following vars:
1672 # HAVE_NET_ERRNO_H
1673 #
1674 #--------------------------------------------------------------------
1675
1676 AC_DEFUN([SC_TCL_LINK_LIBS], [
1677 #--------------------------------------------------------------------
1678 # On a few very rare systems, all of the libm.a stuff is
1679 # already in libc.a. Set compiler flags accordingly.
1680 # Also, Linux requires the "ieee" library for math to work
1681 # right (and it must appear before "-lm").
1682 #--------------------------------------------------------------------
1683
1684 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
1685 AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
1686
1687 #--------------------------------------------------------------------
1688 # On AIX systems, libbsd.a has to be linked in to support
1689 # non-blocking file IO. This library has to be linked in after
1690 # the MATH_LIBS or it breaks the pow() function. The way to
1691 # insure proper sequencing, is to add it to the tail of MATH_LIBS.
1692 # This library also supplies gettimeofday.
1693 #--------------------------------------------------------------------
1694
1695 libbsd=no
1696 if test "`uname -s`" = "AIX" ; then
1697 AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes)
1698 if test $libbsd = yes; then
1699 MATH_LIBS="$MATH_LIBS -lbsd"
1700 fi
1701 fi
1702
1703
1704 #--------------------------------------------------------------------
1705 # Interactive UNIX requires -linet instead of -lsocket, plus it
1706 # needs net/errno.h to define the socket-related error codes.
1707 #--------------------------------------------------------------------
1708
1709 AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
1710 AC_CHECK_HEADER(net/errno.h, AC_DEFINE(HAVE_NET_ERRNO_H))
1711
1712 #--------------------------------------------------------------------
1713 # Check for the existence of the -lsocket and -lnsl libraries.
1714 # The order here is important, so that they end up in the right
1715 # order in the command line generated by make. Here are some
1716 # special considerations:
1717 # 1. Use "connect" and "accept" to check for -lsocket, and
1718 # "gethostbyname" to check for -lnsl.
1719 # 2. Use each function name only once: can't redo a check because
1720 # autoconf caches the results of the last check and won't redo it.
1721 # 3. Use -lnsl and -lsocket only if they supply procedures that
1722 # aren't already present in the normal libraries. This is because
1723 # IRIX 5.2 has libraries, but they aren't needed and they're
1724 # bogus: they goof up name resolution if used.
1725 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
1726 # To get around this problem, check for both libraries together
1727 # if -lsocket doesn't work by itself.
1728 #--------------------------------------------------------------------
1729
1730 tcl_checkBoth=0
1731 AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
1732 if test "$tcl_checkSocket" = 1; then
1733 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
1734 LIBS="$LIBS -lsocket", tcl_checkBoth=1))
1735 fi
1736 if test "$tcl_checkBoth" = 1; then
1737 tk_oldLibs=$LIBS
1738 LIBS="$LIBS -lsocket -lnsl"
1739 AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
1740 fi
1741 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
1742 [LIBS="$LIBS -lnsl"]))
1743
1744 # Don't perform the eval of the libraries here because DL_LIBS
1745 # won't be set until we call SC_CONFIG_CFLAGS
1746
1747 TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
1748 AC_SUBST(TCL_LIBS)
1749 AC_SUBST(MATH_LIBS)
1750 ])
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.