1
#------------------------------------------------------------------------
4
# Locate the tclConfig.sh file and perform a sanity check on
5
# the Tcl compile flags
12
# Adds the following arguments to configure:
15
# Defines the following vars:
16
# TCL_BIN_DIR Full path to the directory containing
17
# the tclConfig.sh file
18
#------------------------------------------------------------------------
20
AC_DEFUN([SC_PATH_TCLCONFIG], [
22
# Ok, lets find the tcl configuration
23
# First, look for one uninstalled.
24
# the alternative search directory is invoked by --with-tcl
27
if test x"${no_tcl}" = x ; then
28
# we reset no_tcl in case something fails here
31
AC_HELP_STRING([--with-tcl],
32
[directory containing tcl configuration (tclConfig.sh)]),
33
with_tclconfig="${withval}")
34
AC_MSG_CHECKING([for Tcl configuration])
35
AC_CACHE_VAL(ac_cv_c_tclconfig,[
37
# First check to see if --with-tcl was specified.
38
if test x"${with_tclconfig}" != x ; then
39
case "${with_tclconfig}" in
41
if test -f "${with_tclconfig}"; then
42
AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself])
43
with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`"
46
if test -f "${with_tclconfig}/tclConfig.sh" ; then
47
ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`"
49
AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
53
# then check for a private Tcl installation
54
if test x"${ac_cv_c_tclconfig}" = x ; then
57
`ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
58
`ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
59
`ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
61
`ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
62
`ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
63
`ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
65
`ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
66
`ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
67
`ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
68
if test -f "$i/unix/tclConfig.sh" ; then
69
ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
75
# on Darwin, check in Framework installation locations
76
if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
77
for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
78
`ls -d /Library/Frameworks 2>/dev/null` \
79
`ls -d /Network/Library/Frameworks 2>/dev/null` \
80
`ls -d /System/Library/Frameworks 2>/dev/null` \
82
if test -f "$i/Tcl.framework/tclConfig.sh" ; then
83
ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`"
89
# check in a few common install locations
90
if test x"${ac_cv_c_tclconfig}" = x ; then
91
for i in `ls -d ${libdir} 2>/dev/null` \
92
`ls -d ${exec_prefix}/lib 2>/dev/null` \
93
`ls -dr ${exec_prefix}/lib/tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
94
`ls -dr ${exec_prefix}/lib/tcl[[8-9]].[[0-9]] 2>/dev/null` \
95
`ls -dr ${exec_prefix}/lib/tcl[[8-9]].[[0-9]]* 2>/dev/null` \
96
`ls -d ${prefix}/lib 2>/dev/null` \
97
`ls -dr ${prefix}/lib/tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
98
`ls -dr ${prefix}/lib/tcl[[8-9]].[[0-9]] 2>/dev/null` \
99
`ls -dr ${prefix}/lib/tcl[[8-9]].[[0-9]]* 2>/dev/null` \
100
`ls -d /usr/local/lib 2>/dev/null` \
101
`ls -dr /usr/local/lib/tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
102
`ls -dr /usr/local/lib/tcl[[8-9]].[[0-9]] 2>/dev/null` \
103
`ls -dr /usr/local/lib/tcl[[8-9]].[[0-9]]* 2>/dev/null` \
104
`ls -d /usr/lib64 2>/dev/null` \
105
`ls -dr /usr/lib64/tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
106
`ls -dr /usr/lib64/tcl[[8-9]].[[0-9]] 2>/dev/null` \
107
`ls -dr /usr/lib64/tcl[[8-9]].[[0-9]]* 2>/dev/null` \
108
`ls -d /usr/contrib/lib 2>/dev/null` \
109
`ls -dr /usr/contrib/lib/tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
110
`ls -dr /usr/contrib/lib/tcl[[8-9]].[[0-9]] 2>/dev/null` \
111
`ls -dr /usr/contrib/lib/tcl[[8-9]].[[0-9]]* 2>/dev/null` \
112
`ls -d /usr/lib 2>/dev/null` \
113
`ls -dr /usr/lib/tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
114
`ls -dr /usr/lib/tcl[[8-9]].[[0-9]] 2>/dev/null` \
115
`ls -dr /usr/lib/tcl[[8-9]].[[0-9]]* 2>/dev/null` \
117
if test -f "$i/tclConfig.sh" ; then
118
ac_cv_c_tclconfig="`(cd $i; pwd)`"
124
# check in a few other private locations
125
if test x"${ac_cv_c_tclconfig}" = x ; then
128
`ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
129
`ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
130
`ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
131
if test -f "$i/unix/tclConfig.sh" ; then
132
ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
139
if test x"${ac_cv_c_tclconfig}" = x ; then
140
TCL_BIN_DIR="# no Tcl configs found"
141
AC_MSG_ERROR([Can't find Tcl configuration, install the TCL dev package])
144
TCL_BIN_DIR="${ac_cv_c_tclconfig}"
145
AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
150
#------------------------------------------------------------------------
151
# SC_PATH_TKCONFIG --
153
# Locate the tkConfig.sh file
160
# Adds the following arguments to configure:
163
# Defines the following vars:
164
# TK_BIN_DIR Full path to the directory containing
165
# the tkConfig.sh file
166
#------------------------------------------------------------------------
168
AC_DEFUN([SC_PATH_TKCONFIG], [
170
# Ok, lets find the tk configuration
171
# First, look for one uninstalled.
172
# the alternative search directory is invoked by --with-tk
175
if test x"${no_tk}" = x ; then
176
# we reset no_tk in case something fails here
179
AC_HELP_STRING([--with-tk],
180
[directory containing tk configuration (tkConfig.sh)]),
181
with_tkconfig="${withval}")
182
AC_MSG_CHECKING([for Tk configuration])
183
AC_CACHE_VAL(ac_cv_c_tkconfig,[
185
# First check to see if --with-tkconfig was specified.
186
if test x"${with_tkconfig}" != x ; then
187
case "${with_tkconfig}" in
189
if test -f "${with_tkconfig}"; then
190
AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself])
191
with_tkconfig="`echo "${with_tkconfig}" | sed 's!/tkConfig\.sh$!!'`"
194
if test -f "${with_tkconfig}/tkConfig.sh" ; then
195
ac_cv_c_tkconfig="`(cd "${with_tkconfig}"; pwd)`"
197
AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
201
# then check for a private Tk library
202
if test x"${ac_cv_c_tkconfig}" = x ; then
205
`ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
206
`ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \
207
`ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
209
`ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
210
`ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
211
`ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
213
`ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
214
`ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
215
`ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
216
if test -f "$i/unix/tkConfig.sh" ; then
217
ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
223
# on Darwin, check in Framework installation locations
224
if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
225
for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
226
`ls -d /Library/Frameworks 2>/dev/null` \
227
`ls -d /Network/Library/Frameworks 2>/dev/null` \
228
`ls -d /System/Library/Frameworks 2>/dev/null` \
230
if test -f "$i/Tk.framework/tkConfig.sh" ; then
231
ac_cv_c_tkconfig="`(cd $i/Tk.framework; pwd)`"
237
# check in a few common install locations
238
if test x"${ac_cv_c_tkconfig}" = x ; then
239
for i in `ls -d ${libdir} 2>/dev/null` \
240
`ls -d ${exec_prefix}/lib 2>/dev/null` \
241
`ls -d ${prefix}/lib 2>/dev/null` \
242
`ls -d /usr/local/lib 2>/dev/null` \
243
`ls -d /usr/contrib/lib 2>/dev/null` \
244
`ls -d /usr/lib 2>/dev/null` \
246
if test -f "$i/tkConfig.sh" ; then
247
ac_cv_c_tkconfig="`(cd $i; pwd)`"
253
# check in a few other private locations
254
if test x"${ac_cv_c_tkconfig}" = x ; then
257
`ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
258
`ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
259
`ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
260
if test -f "$i/unix/tkConfig.sh" ; then
261
ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
268
if test x"${ac_cv_c_tkconfig}" = x ; then
269
TK_BIN_DIR="# no Tk configs found"
270
AC_MSG_WARN([Can't find Tk configuration definitions])
274
TK_BIN_DIR="${ac_cv_c_tkconfig}"
275
AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
280
#------------------------------------------------------------------------
281
# SC_LOAD_TCLCONFIG --
283
# Load the tclConfig.sh file
287
# Requires the following vars to be set:
292
# Subst the following vars:
297
#------------------------------------------------------------------------
299
AC_DEFUN([SC_LOAD_TCLCONFIG], [
300
AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
302
if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
303
AC_MSG_RESULT([loading])
304
. "${TCL_BIN_DIR}/tclConfig.sh"
306
AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
309
# eval is required to do the TCL_DBGX substitution
310
eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
311
eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
313
# If the TCL_BIN_DIR is the build directory (not the install directory),
314
# then set the common variable name to the value of the build variables.
315
# For example, the variable TCL_LIB_SPEC will be set to the value
316
# of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
317
# instead of TCL_BUILD_LIB_SPEC since it will work with both an
318
# installed and uninstalled version of Tcl.
319
if test -f "${TCL_BIN_DIR}/Makefile" ; then
320
TCL_LIB_SPEC="${TCL_BUILD_LIB_SPEC}"
321
TCL_STUB_LIB_SPEC="${TCL_BUILD_STUB_LIB_SPEC}"
322
TCL_STUB_LIB_PATH="${TCL_BUILD_STUB_LIB_PATH}"
323
elif test "`uname -s`" = "Darwin"; then
324
# If Tcl was built as a framework, attempt to use the libraries
325
# from the framework at the given location so that linking works
326
# against Tcl.framework installed in an arbitary location.
329
if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then
330
for i in "`cd "${TCL_BIN_DIR}"; pwd`" \
331
"`cd "${TCL_BIN_DIR}"/../..; pwd`"; do
332
if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
333
TCL_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TCL_LIB_FILE}"
338
if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then
339
TCL_STUB_LIB_SPEC="-L`echo "${TCL_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TCL_STUB_LIB_FLAG}"
340
TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
346
# eval is required to do the TCL_DBGX substitution
347
eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
348
eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
349
eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
350
eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
352
AC_SUBST(TCL_VERSION)
353
AC_SUBST(TCL_PATCH_LEVEL)
354
AC_SUBST(TCL_BIN_DIR)
355
AC_SUBST(TCL_SRC_DIR)
357
AC_SUBST(TCL_LIB_FILE)
358
AC_SUBST(TCL_LIB_FLAG)
359
AC_SUBST(TCL_LIB_SPEC)
361
AC_SUBST(TCL_STUB_LIB_FILE)
362
AC_SUBST(TCL_STUB_LIB_FLAG)
363
AC_SUBST(TCL_STUB_LIB_SPEC)
366
#------------------------------------------------------------------------
367
# SC_LOAD_TKCONFIG --
369
# Load the tkConfig.sh file
373
# Requires the following vars to be set:
378
# Sets the following vars that should be in tkConfig.sh:
380
#------------------------------------------------------------------------
382
AC_DEFUN([SC_LOAD_TKCONFIG], [
383
AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
385
if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
386
AC_MSG_RESULT([loading])
387
. "${TK_BIN_DIR}/tkConfig.sh"
389
AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
392
# eval is required to do the TK_DBGX substitution
393
eval "TK_LIB_FILE=\"${TK_LIB_FILE}\""
394
eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\""
396
# If the TK_BIN_DIR is the build directory (not the install directory),
397
# then set the common variable name to the value of the build variables.
398
# For example, the variable TK_LIB_SPEC will be set to the value
399
# of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
400
# instead of TK_BUILD_LIB_SPEC since it will work with both an
401
# installed and uninstalled version of Tcl.
402
if test -f "${TK_BIN_DIR}/Makefile" ; then
403
TK_LIB_SPEC="${TK_BUILD_LIB_SPEC}"
404
TK_STUB_LIB_SPEC="${TK_BUILD_STUB_LIB_SPEC}"
405
TK_STUB_LIB_PATH="${TK_BUILD_STUB_LIB_PATH}"
406
elif test "`uname -s`" = "Darwin"; then
407
# If Tk was built as a framework, attempt to use the libraries
408
# from the framework at the given location so that linking works
409
# against Tk.framework installed in an arbitary location.
412
if test -f "${TK_BIN_DIR}/${TK_LIB_FILE}"; then
413
for i in "`cd "${TK_BIN_DIR}"; pwd`" \
414
"`cd "${TK_BIN_DIR}"/../..; pwd`"; do
415
if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
416
TK_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TK_LIB_FILE}"
421
if test -f "${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"; then
422
TK_STUB_LIB_SPEC="-L` echo "${TK_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}"
423
TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
429
# eval is required to do the TK_DBGX substitution
430
eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\""
431
eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\""
432
eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\""
433
eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\""
439
AC_SUBST(TK_LIB_FILE)
440
AC_SUBST(TK_LIB_FLAG)
441
AC_SUBST(TK_LIB_SPEC)
443
AC_SUBST(TK_STUB_LIB_FILE)
444
AC_SUBST(TK_STUB_LIB_FLAG)
445
AC_SUBST(TK_STUB_LIB_SPEC)
448
#------------------------------------------------------------------------
450
# Locate a tclsh shell installed on the system path. This macro
451
# will only find a Tcl shell that already exists on the system.
452
# It will not find a Tcl shell in the Tcl build directory or
453
# a Tcl shell that has been installed from the Tcl build directory.
454
# If a Tcl shell can't be located on the PATH, then TCLSH_PROG will
455
# be set to "". Extensions should take care not to create Makefile
456
# rules that are run by default and depend on TCLSH_PROG. An
457
# extension can't assume that an executable Tcl shell exists at
464
# Subst's the following values:
466
#------------------------------------------------------------------------
468
AC_DEFUN([SC_PROG_TCLSH], [
469
AC_MSG_CHECKING([for tclsh])
470
AC_CACHE_VAL(ac_cv_path_tclsh, [
471
search_path=`echo ${PATH} | sed -e 's/:/ /g'`
472
for dir in $search_path ; do
473
for j in `ls -r $dir/tclsh[[8-9]]* 2> /dev/null` \
474
`ls -r $dir/tclsh* 2> /dev/null` ; do
475
if test x"$ac_cv_path_tclsh" = x ; then
476
if test -f "$j" ; then
485
if test -f "$ac_cv_path_tclsh" ; then
486
TCLSH_PROG="$ac_cv_path_tclsh"
487
AC_MSG_RESULT([$TCLSH_PROG])
489
# It is not an error if an installed version of Tcl can't be located.
491
AC_MSG_RESULT([No tclsh found on PATH])
496
#------------------------------------------------------------------------
498
# Determine the fully qualified path name of the tclsh executable
499
# in the Tcl build directory. This macro will correctly determine
500
# the name of the tclsh executable even if tclsh has not yet
501
# been built in the build directory. The build tclsh must be used
502
# when running tests from an extension build directory. It is not
503
# correct to use the TCLSH_PROG in cases like this.
509
# Subst's the following values:
511
#------------------------------------------------------------------------
513
AC_DEFUN([SC_BUILD_TCLSH], [
514
AC_MSG_CHECKING([for tclsh in Tcl build directory])
515
BUILD_TCLSH="${TCL_BIN_DIR}"/tclsh
516
AC_MSG_RESULT([$BUILD_TCLSH])
517
AC_SUBST(BUILD_TCLSH)
520
#------------------------------------------------------------------------
521
# SC_ENABLE_SHARED --
523
# Allows the building of shared libraries
530
# Adds the following arguments to configure:
531
# --enable-shared=yes|no
533
# Defines the following vars:
534
# STATIC_BUILD Used for building import/export libraries
537
# Sets the following vars:
538
# SHARED_BUILD Value of 1 or 0
539
#------------------------------------------------------------------------
541
AC_DEFUN([SC_ENABLE_SHARED], [
542
AC_MSG_CHECKING([how to build libraries])
543
AC_ARG_ENABLE(shared,
544
AC_HELP_STRING([--enable-shared],
545
[build and link with shared libraries (default: on)]),
546
[tcl_ok=$enableval], [tcl_ok=yes])
548
if test "${enable_shared+set}" = set; then
549
enableval="$enable_shared"
555
if test "$tcl_ok" = "yes" ; then
556
AC_MSG_RESULT([shared])
559
AC_MSG_RESULT([static])
561
AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?])
565
#------------------------------------------------------------------------
566
# SC_ENABLE_FRAMEWORK --
568
# Allows the building of shared libraries into frameworks
575
# Adds the following arguments to configure:
576
# --enable-framework=yes|no
578
# Sets the following vars:
579
# FRAMEWORK_BUILD Value of 1 or 0
580
#------------------------------------------------------------------------
582
AC_DEFUN([SC_ENABLE_FRAMEWORK], [
583
if test "`uname -s`" = "Darwin" ; then
584
AC_MSG_CHECKING([how to package libraries])
585
AC_ARG_ENABLE(framework,
586
AC_HELP_STRING([--enable-framework],
587
[package shared libraries in MacOSX frameworks (default: off)]),
588
[enable_framework=$enableval], [enable_framework=no])
589
if test $enable_framework = yes; then
590
if test $SHARED_BUILD = 0; then
591
AC_MSG_WARN([Frameworks can only be built if --enable-shared is yes])
594
if test $tcl_corefoundation = no; then
595
AC_MSG_WARN([Frameworks can only be used when CoreFoundation is available])
599
if test $enable_framework = yes; then
600
AC_MSG_RESULT([framework])
603
if test $SHARED_BUILD = 1; then
604
AC_MSG_RESULT([shared library])
606
AC_MSG_RESULT([static library])
613
#------------------------------------------------------------------------
614
# SC_ENABLE_THREADS --
616
# Specify if thread support should be enabled
623
# Adds the following arguments to configure:
626
# Sets the following vars:
627
# THREADS_LIBS Thread library(s)
629
# Defines the following vars:
634
#------------------------------------------------------------------------
636
AC_DEFUN([SC_ENABLE_THREADS], [
637
AC_ARG_ENABLE(threads,
638
AC_HELP_STRING([--enable-threads],
639
[build with threads (default: off)]),
640
[tcl_ok=$enableval], [tcl_ok=no])
642
if test "${TCL_THREADS}" = 1; then
646
if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
648
# USE_THREAD_ALLOC tells us to try the special thread-based
649
# allocator that significantly reduces lock contention
650
AC_DEFINE(USE_THREAD_ALLOC, 1,
651
[Do we want to use the threaded memory allocator?])
652
AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
653
if test "`uname -s`" = "SunOS" ; then
654
AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
655
[Do we really want to follow the standard? Yes we do!])
657
AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?])
658
AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
659
if test "$tcl_ok" = "no"; then
660
# Check a little harder for __pthread_mutex_init in the same
661
# library, as some systems hide it there until pthread.h is
662
# defined. We could alternatively do an AC_TRY_COMPILE with
663
# pthread.h, but that will work with libpthread really doesn't
664
# exist, like AIX 4.2. [Bug: 4359]
665
AC_CHECK_LIB(pthread, __pthread_mutex_init,
666
tcl_ok=yes, tcl_ok=no)
669
if test "$tcl_ok" = "yes"; then
670
# The space is needed
671
THREADS_LIBS=" -lpthread"
673
AC_CHECK_LIB(pthreads, pthread_mutex_init,
674
tcl_ok=yes, tcl_ok=no)
675
if test "$tcl_ok" = "yes"; then
676
# The space is needed
677
THREADS_LIBS=" -lpthreads"
679
AC_CHECK_LIB(c, pthread_mutex_init,
680
tcl_ok=yes, tcl_ok=no)
681
if test "$tcl_ok" = "no"; then
682
AC_CHECK_LIB(c_r, pthread_mutex_init,
683
tcl_ok=yes, tcl_ok=no)
684
if test "$tcl_ok" = "yes"; then
685
# The space is needed
686
THREADS_LIBS=" -pthread"
689
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...])
695
# Does the pthread-implementation provide
696
# 'pthread_attr_setstacksize' ?
699
LIBS="$LIBS $THREADS_LIBS"
700
AC_CHECK_FUNCS(pthread_attr_setstacksize)
701
AC_CHECK_FUNC(pthread_attr_get_np,tcl_ok=yes,tcl_ok=no)
702
if test $tcl_ok = yes ; then
703
AC_DEFINE(HAVE_PTHREAD_ATTR_GET_NP, 1,
704
[Do we want a BSD-like thread-attribute interface?])
705
AC_CACHE_CHECK([for pthread_attr_get_np declaration],
706
tcl_cv_grep_pthread_attr_get_np, [
707
AC_EGREP_HEADER(pthread_attr_get_np, pthread.h,
708
tcl_cv_grep_pthread_attr_get_np=present,
709
tcl_cv_grep_pthread_attr_get_np=missing)])
710
if test $tcl_cv_grep_pthread_attr_get_np = missing ; then
711
AC_DEFINE(ATTRGETNP_NOT_DECLARED, 1,
712
[Is pthread_attr_get_np() declared in <pthread.h>?])
715
AC_CHECK_FUNC(pthread_getattr_np,tcl_ok=yes,tcl_ok=no)
716
if test $tcl_ok = yes ; then
717
AC_DEFINE(HAVE_PTHREAD_GETATTR_NP, 1,
718
[Do we want a Linux-like thread-attribute interface?])
719
AC_CACHE_CHECK([for pthread_getattr_np declaration],
720
tcl_cv_grep_pthread_getattr_np, [
721
AC_EGREP_HEADER(pthread_getattr_np, pthread.h,
722
tcl_cv_grep_pthread_getattr_np=present,
723
tcl_cv_grep_pthread_getattr_np=missing)])
724
if test $tcl_cv_grep_pthread_getattr_np = missing ; then
725
AC_DEFINE(GETATTRNP_NOT_DECLARED, 1,
726
[Is pthread_getattr_np declared in <pthread.h>?])
730
if test $tcl_ok = no; then
731
# Darwin thread stacksize API
732
AC_CHECK_FUNCS(pthread_get_stacksize_np)
738
# Do checking message here to not mess up interleaved configure output
739
AC_MSG_CHECKING([for building with threads])
740
if test "${TCL_THREADS}" = 1; then
741
AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
742
if test "${tcl_threaded_core}" = 1; then
743
AC_MSG_RESULT([yes (threaded core)])
748
AC_MSG_RESULT([no (default)])
751
AC_SUBST(TCL_THREADS)
754
#------------------------------------------------------------------------
755
# SC_ENABLE_SYMBOLS --
757
# Specify if debugging symbols should be used.
758
# Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging
759
# can also be enabled.
764
# Requires the following vars to be set in the Makefile:
772
# Adds the following arguments to configure:
775
# Defines the following vars:
776
# CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
777
# Sets to $(CFLAGS_OPTIMIZE) if false
778
# LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
779
# Sets to $(LDFLAGS_OPTIMIZE) if false
780
# DBGX Formerly used as debug library extension;
783
#------------------------------------------------------------------------
785
AC_DEFUN([SC_ENABLE_SYMBOLS], [
786
AC_MSG_CHECKING([for build with symbols])
787
AC_ARG_ENABLE(symbols,
788
AC_HELP_STRING([--enable-symbols],
789
[build with debugging symbols (default: off)]),
790
[tcl_ok=$enableval], [tcl_ok=no])
791
# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
793
if test "$tcl_ok" = "no"; then
794
CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
795
LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
797
AC_DEFINE(TCL_CFG_OPTIMIZED, 1, [Is this an optimized build?])
799
CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
800
LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
801
if test "$tcl_ok" = "yes"; then
802
AC_MSG_RESULT([yes (standard debugging)])
805
AC_SUBST(CFLAGS_DEFAULT)
806
AC_SUBST(LDFLAGS_DEFAULT)
807
### FIXME: Surely TCL_CFG_DEBUG should be set to whether we're debugging?
808
AC_DEFINE(TCL_CFG_DEBUG, 1, [Is debugging enabled?])
810
if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
811
AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?])
814
ifelse($1,bccdebug,dnl Only enable 'compile' for the Tcl core itself
815
if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
816
AC_DEFINE(TCL_COMPILE_DEBUG, 1, [Is bytecode debugging enabled?])
817
AC_DEFINE(TCL_COMPILE_STATS, 1, [Are bytecode statistics enabled?])
820
if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
821
if test "$tcl_ok" = "all"; then
822
AC_MSG_RESULT([enabled symbols mem ]ifelse($1,bccdebug,[compile ])[debugging])
824
AC_MSG_RESULT([enabled $tcl_ok debugging])
829
#------------------------------------------------------------------------
830
# SC_ENABLE_LANGINFO --
832
# Allows use of modern nl_langinfo check for better l10n.
833
# This is only relevant for Unix.
840
# Adds the following arguments to configure:
841
# --enable-langinfo=yes|no (default is yes)
843
# Defines the following vars:
844
# HAVE_LANGINFO Triggers use of nl_langinfo if defined.
846
#------------------------------------------------------------------------
848
AC_DEFUN([SC_ENABLE_LANGINFO], [
849
AC_ARG_ENABLE(langinfo,
850
AC_HELP_STRING([--enable-langinfo],
851
[use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]),
852
[langinfo_ok=$enableval], [langinfo_ok=yes])
855
if test "$langinfo_ok" = "yes"; then
856
AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
858
AC_MSG_CHECKING([whether to use nl_langinfo])
859
if test "$langinfo_ok" = "yes"; then
860
AC_CACHE_VAL(tcl_cv_langinfo_h, [
861
AC_TRY_COMPILE([#include <langinfo.h>], [nl_langinfo(CODESET);],
862
[tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])])
863
AC_MSG_RESULT([$tcl_cv_langinfo_h])
864
if test $tcl_cv_langinfo_h = yes; then
865
AC_DEFINE(HAVE_LANGINFO, 1, [Do we have nl_langinfo()?])
868
AC_MSG_RESULT([$langinfo_ok])
872
#--------------------------------------------------------------------
875
# Decide whether to use symlinks for linking the manpages,
876
# whether to compress the manpages after installation, and
877
# whether to add a package name suffix to the installed
878
# manpages to avoidfile name clashes.
879
# If compression is enabled also find out what file name suffix
880
# the given compression program is using.
887
# Adds the following arguments to configure:
888
# --enable-man-symlinks
889
# --enable-man-compression=PROG
890
# --enable-man-suffix[=STRING]
892
# Defines the following variable:
894
# MAN_FLAGS - The apropriate flags for installManPage
895
# according to the user's selection.
897
#--------------------------------------------------------------------
899
AC_DEFUN([SC_CONFIG_MANPAGES], [
900
AC_MSG_CHECKING([whether to use symlinks for manpages])
901
AC_ARG_ENABLE(man-symlinks,
902
AC_HELP_STRING([--enable-man-symlinks],
903
[use symlinks for the manpages (default: off)]),
904
test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks",
906
AC_MSG_RESULT([$enableval])
908
AC_MSG_CHECKING([whether to compress the manpages])
909
AC_ARG_ENABLE(man-compression,
910
AC_HELP_STRING([--enable-man-compression=PROG],
911
[compress the manpages with PROG (default: off)]),
913
yes) AC_MSG_ERROR([missing argument to --enable-man-compression]);;
915
*) MAN_FLAGS="$MAN_FLAGS --compress $enableval";;
918
AC_MSG_RESULT([$enableval])
919
if test "$enableval" != "no"; then
920
AC_MSG_CHECKING([for compressed file suffix])
923
Z=`ls TeST* | sed 's/^....//'`
925
MAN_FLAGS="$MAN_FLAGS --extension $Z"
929
AC_MSG_CHECKING([whether to add a package name suffix for the manpages])
930
AC_ARG_ENABLE(man-suffix,
931
AC_HELP_STRING([--enable-man-suffix=STRING],
932
[use STRING as a suffix to manpage file names (default: no, AC_PACKAGE_NAME if enabled without specifying STRING)]),
934
yes) enableval="AC_PACKAGE_NAME" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
936
*) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
939
AC_MSG_RESULT([$enableval])
944
#--------------------------------------------------------------------
947
# Determine what the system is (some things cannot be easily checked
948
# on a feature-driven basis, alas). This can usually be done via the
949
# "uname" command, but there are a few systems, like Next, where
956
# Defines the following var:
958
# system - System/platform/version identification code.
960
#--------------------------------------------------------------------
962
AC_DEFUN([SC_CONFIG_SYSTEM], [
963
AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
964
if test -f /usr/lib/NextStep/software_version; then
965
tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
967
tcl_cv_sys_version=`uname -s`-`uname -r`
968
if test "$?" -ne 0 ; then
969
AC_MSG_WARN([can't find uname command])
970
tcl_cv_sys_version=unknown
972
# Special check for weird MP-RAS system (uname returns weird
973
# results, and the version is kept in special file).
975
if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
976
tcl_cv_sys_version=MP-RAS-`awk '{print $[3]}' /etc/.relid`
978
if test "`uname -s`" = "AIX" ; then
979
tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
984
system=$tcl_cv_sys_version
987
#--------------------------------------------------------------------
990
# Try to determine the proper flags to pass to the compiler
991
# for building shared libraries and other such nonsense.
998
# Defines and substitutes the following vars:
1000
# DL_OBJS - Name of the object file that implements dynamic
1001
# loading for Tcl on this system.
1002
# DL_LIBS - Library file(s) to include in tclsh and other base
1003
# applications in order for the "load" command to work.
1004
# LDFLAGS - Flags to pass to the compiler when linking object
1005
# files into an executable application binary such
1007
# LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
1008
# that tell the run-time dynamic linker where to look
1009
# for shared libraries such as libtcl.so. Depends on
1010
# the variable LIB_RUNTIME_DIR in the Makefile. Could
1011
# be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
1012
# CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
1013
# that tell the run-time dynamic linker where to look
1014
# for shared libraries such as libtcl.so. Depends on
1015
# the variable LIB_RUNTIME_DIR in the Makefile.
1016
# MAKE_LIB - Command to execute to build the a library;
1017
# differs when building shared or static.
1019
# Command to execute to build a stub library.
1020
# INSTALL_LIB - Command to execute to install a library;
1021
# differs when building shared or static.
1022
# INSTALL_STUB_LIB -
1023
# Command to execute to install a stub library.
1024
# STLIB_LD - Base command to use for combining object files
1025
# into a static library.
1026
# SHLIB_CFLAGS - Flags to pass to cc when compiling the components
1027
# of a shared library (may request position-independent
1028
# code, among other things).
1029
# SHLIB_LD - Base command to use for combining object files
1030
# into a shared library.
1031
# SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
1032
# creating shared libraries. This symbol typically
1033
# goes at the end of the "ld" commands that build
1034
# shared libraries. The value of the symbol is
1035
# "${LIBS}" if all of the dependent libraries should
1036
# be specified when creating a shared library. If
1037
# dependent libraries should not be specified (as on
1038
# SunOS 4.x, where they cause the link to fail, or in
1039
# general if Tcl and Tk aren't themselves shared
1040
# libraries), then this symbol has an empty string
1042
# SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
1043
# extensions. An empty string means we don't know how
1044
# to use shared libraries on this platform.
1045
# TCL_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS
1046
# TK_SHLIB_LD_EXTRAS for the build of Tcl and Tk, but not recorded in the
1047
# tclConfig.sh, since they are only used for the build
1049
# Examples: MacOS X records the library version and
1050
# compatibility version in the shared library. But
1051
# of course the Tcl version of this is only used for Tcl.
1052
# LIB_SUFFIX - Specifies everything that comes after the "libfoo"
1053
# in a static or shared library name, using the $VERSION variable
1054
# to put the version in the right place. This is used
1055
# by platforms that need non-standard library names.
1056
# Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
1057
# to have a version after the .so, and ${VERSION}.a
1058
# on AIX, since a shared library needs to have
1059
# a .a extension whereas shared objects for loadable
1060
# extensions have a .so extension. Defaults to
1061
# ${VERSION}${SHLIB_SUFFIX}.
1062
# TCL_NEEDS_EXP_FILE -
1063
# 1 means that an export file is needed to link to a
1065
# TCL_EXP_FILE - The name of the installed export / import file which
1066
# should be used to link to the Tcl shared library.
1067
# Empty if Tcl is unshared.
1068
# TCL_BUILD_EXP_FILE -
1069
# The name of the built export / import file which
1070
# should be used to link to the Tcl shared library.
1071
# Empty if Tcl is unshared.
1073
# Libs to use when linking Tcl shell or some other
1074
# shell that includes Tcl libs.
1076
# Flags used when running the compiler in debug mode
1078
# Flags used when running the compiler in optimize mode
1079
# CFLAGS - Additional CFLAGS added as necessary (usually 64-bit)
1081
#--------------------------------------------------------------------
1083
AC_DEFUN([SC_CONFIG_CFLAGS], [
1085
# Step 0.a: Enable 64 bit support?
1087
AC_MSG_CHECKING([if 64bit support is requested])
1088
AC_ARG_ENABLE(64bit,
1089
AC_HELP_STRING([--enable-64bit],
1090
[enable 64bit support (default: off)]),
1091
[do64bit=$enableval], [do64bit=no])
1092
AC_MSG_RESULT([$do64bit])
1094
# Step 0.b: Enable Solaris 64 bit VIS support?
1096
AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
1097
AC_ARG_ENABLE(64bit-vis,
1098
AC_HELP_STRING([--enable-64bit-vis],
1099
[enable 64bit Sparc VIS support (default: off)]),
1100
[do64bitVIS=$enableval], [do64bitVIS=no])
1101
AC_MSG_RESULT([$do64bitVIS])
1102
# Force 64bit on with VIS
1103
AS_IF([test "$do64bitVIS" = "yes"], [do64bit=yes])
1105
# Step 0.c: Check if visibility support is available. Do this here so
1106
# that platform specific alternatives can be used below if this fails.
1108
AC_CACHE_CHECK([if compiler supports visibility "hidden"],
1109
tcl_cv_cc_visibility_hidden, [
1110
hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
1112
extern __attribute__((__visibility__("hidden"))) void f(void);
1113
void f(void) {}], [f();], tcl_cv_cc_visibility_hidden=yes,
1114
tcl_cv_cc_visibility_hidden=no)
1115
CFLAGS=$hold_cflags])
1116
AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [
1117
AC_DEFINE(MODULE_SCOPE,
1118
[extern __attribute__((__visibility__("hidden")))],
1119
[Compiler support for module scope symbols])
1122
# Step 0.d: Disable -rpath support?
1124
AC_MSG_CHECKING([if rpath support is requested])
1125
AC_ARG_ENABLE(rpath,
1126
AC_HELP_STRING([--disable-rpath],
1127
[disable rpath support (default: on)]),
1128
[doRpath=$enableval], [doRpath=yes])
1129
AC_MSG_RESULT([$doRpath])
1131
# Step 1: set the variable "system" to hold the name and version number
1136
# Step 2: check for existence of -ldl library. This is needed because
1137
# Linux can use either -ldl or -ldld for dynamic loading.
1139
AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
1141
# Require ranlib early so we can override it in special cases below.
1143
AS_IF([test x"${SHLIB_VERSION}" = x], [SHLIB_VERSION="1.0"])
1145
AC_REQUIRE([AC_PROG_RANLIB])
1147
# Step 3: set configuration options based on system name and version.
1150
LDFLAGS_ORIG="$LDFLAGS"
1151
# When ld needs options to work in 64-bit mode, put them in
1152
# LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
1153
# is disabled by the user. [Bug 1016796]
1155
TCL_EXPORT_FILE_SUFFIX=""
1156
UNSHARED_LIB_SUFFIX=""
1157
TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
1158
ECHO_VERSION='`echo ${VERSION}`'
1159
TCL_LIB_VERSIONS_OK=ok
1162
AS_IF([test "$GCC" = yes], [
1163
CFLAGS_WARNING="-Wall"
1164
], [CFLAGS_WARNING=""])
1165
TCL_NEEDS_EXP_FILE=0
1166
TCL_BUILD_EXP_FILE=""
1168
dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
1169
dnl AC_CHECK_TOOL(AR, ar)
1170
AC_CHECK_PROG(AR, ar, ar)
1171
AS_IF([test "${AR}" = ""], [
1172
AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
1175
LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
1180
AS_IF([test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"], [
1181
# AIX requires the _r compiler when gcc isn't being used
1190
AC_MSG_RESULT([Using $CC for compiling with threads])
1194
# Note: need the LIBS below, otherwise Tk won't find Tcl's
1195
# symbols when dynamically loaded into tclsh.
1196
SHLIB_LD_LIBS='${LIBS}'
1199
DL_OBJS="tclLoadDl.o"
1200
LD_LIBRARY_PATH_VAR="LIBPATH"
1202
# Check to enable 64-bit flags for compiler/linker on AIX 4+
1203
LDAIX_SRC='$(UNIX_DIR)/ldAix'
1204
AS_IF([test "$do64bit" = yes -a "`uname -v`" -gt 3], [
1205
AS_IF([test "$GCC" = yes], [
1206
AC_MSG_WARN([64bit mode not supported with GCC on $system])
1209
CFLAGS="$CFLAGS -q64"
1211
RANLIB="${RANLIB} -X64"
1213
SHLIB_LD_FLAGS="-b64"
1217
AS_IF([test "`uname -m`" = ia64], [
1218
# AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
1219
SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1220
# AIX-5 has dl* in libc.so
1222
AS_IF([test "$GCC" = yes], [
1223
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1225
CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
1227
LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1229
AS_IF([test "$GCC" = yes], [SHLIB_LD='${CC} -shared'], [
1230
SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
1232
SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}"
1234
CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1235
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1236
TCL_NEEDS_EXP_FILE=1
1237
TCL_EXPORT_FILE_SUFFIX='${VERSION}.exp'
1240
# AIX v<=4.1 has some different flags than 4.2+
1241
AS_IF([test "$system" = "AIX-4.1" -o "`uname -v`" -lt 4], [
1242
AC_LIBOBJ([tclLoadAix])
1246
# On AIX <=v4 systems, libbsd.a has to be linked in to support
1247
# non-blocking file IO. This library has to be linked in after
1248
# the MATH_LIBS or it breaks the pow() function. The way to
1249
# insure proper sequencing, is to add it to the tail of MATH_LIBS.
1250
# This library also supplies gettimeofday.
1252
# AIX does not have a timezone field in struct tm. When the AIX
1253
# bsd library is used, the timezone global and the gettimeofday
1254
# methods are to be avoided for timezone deduction instead, we
1255
# deduce the timezone by comparing the localtime result on a
1258
AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no)
1259
AS_IF([test $libbsd = yes], [
1260
MATH_LIBS="$MATH_LIBS -lbsd"
1261
AC_DEFINE(USE_DELTA_FOR_TZ, 1, [Do we need a special AIX hack for timezones?])
1265
SHLIB_CFLAGS="-fPIC"
1266
SHLIB_LD='${CC} -nostart'
1267
SHLIB_LD_LIBS='${LIBS}'
1269
DL_OBJS="tclLoadDl.o"
1272
#-----------------------------------------------------------
1273
# Check for inet_ntoa in -lbind, for BeOS (which also needs
1274
# -lsocket, even if the network functions are in -lnet which
1275
# is always linked to, for compatibility.
1276
#-----------------------------------------------------------
1277
AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
1279
BSD/OS-2.1*|BSD/OS-3*)
1281
SHLIB_LD="shlicc -r"
1282
SHLIB_LD_LIBS='${LIBS}'
1284
DL_OBJS="tclLoadDl.o"
1290
SHLIB_CFLAGS="-export-dynamic -fPIC"
1291
SHLIB_LD='${CC} -shared'
1292
SHLIB_LD_LIBS='${LIBS}'
1294
DL_OBJS="tclLoadDl.o"
1296
LDFLAGS="$LDFLAGS -export-dynamic"
1301
SHLIB_CFLAGS="-K PIC"
1305
DL_OBJS="tclLoadDl.o"
1311
# Use updated header definitions where possible
1312
AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Do we want to use the XOPEN network library?])
1313
AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
1314
LIBS="$LIBS -lxnet" # Use the XOPEN network library
1316
AS_IF([test "`uname -m`" = ia64], [
1321
AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1322
AS_IF([test "$tcl_ok" = yes], [
1325
SHLIB_LD_LIBS='${LIBS}'
1326
DL_OBJS="tclLoadShl.o"
1328
LDFLAGS="$LDFLAGS -Wl,-E"
1329
CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1330
LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1331
LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1333
AS_IF([test "$GCC" = yes], [
1334
SHLIB_LD='${CC} -shared'
1335
SHLIB_LD_LIBS='${LIBS}'
1336
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1339
# Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
1340
#CFLAGS="$CFLAGS +DAportable"
1342
# Check to enable 64-bit flags for compiler/linker
1343
AS_IF([test "$do64bit" = "yes"], [
1344
AS_IF([test "$GCC" = yes], [
1345
case `${CC} -dumpmachine` in
1347
# 64-bit gcc in use. Fix flags for GNU ld.
1349
SHLIB_LD='${CC} -shared'
1350
SHLIB_LD_LIBS='${LIBS}'
1351
AS_IF([test $doRpath = yes], [
1352
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1353
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1356
AC_MSG_WARN([64bit mode not supported with GCC on $system])
1361
CFLAGS="$CFLAGS +DD64"
1362
LDFLAGS_ARCH="+DD64"
1365
HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
1367
AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
1368
AS_IF([test "$tcl_ok" = yes], [
1372
DL_OBJS="tclLoadShl.o"
1374
LDFLAGS="$LDFLAGS -Wl,-E"
1375
CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
1376
LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
1377
LD_LIBRARY_PATH_VAR="SHLIB_PATH"
1381
SHLIB_LD="ld -shared -rdata_shared"
1382
SHLIB_LD_LIBS='${LIBS}'
1384
DL_OBJS="tclLoadDl.o"
1386
AS_IF([test $doRpath = yes], [
1387
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1388
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1392
SHLIB_LD="ld -n32 -shared -rdata_shared"
1393
SHLIB_LD_LIBS='${LIBS}'
1395
DL_OBJS="tclLoadDl.o"
1397
AS_IF([test $doRpath = yes], [
1398
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1399
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1400
AS_IF([test "$GCC" = yes], [
1401
CFLAGS="$CFLAGS -mabi=n32"
1402
LDFLAGS="$LDFLAGS -mabi=n32"
1406
# Use to build 6.2 compatible binaries on 6.3.
1407
CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
1410
CFLAGS="$CFLAGS -n32"
1413
LDFLAGS="$LDFLAGS -n32"
1418
SHLIB_LD="ld -n32 -shared -rdata_shared"
1419
SHLIB_LD_LIBS='${LIBS}'
1421
DL_OBJS="tclLoadDl.o"
1423
AS_IF([test $doRpath = yes], [
1424
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1425
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1427
# Check to enable 64-bit flags for compiler/linker
1429
AS_IF([test "$do64bit" = yes], [
1430
AS_IF([test "$GCC" = yes], [
1431
AC_MSG_WARN([64bit mode not supported by gcc])
1434
SHLIB_LD="ld -64 -shared -rdata_shared"
1435
CFLAGS="$CFLAGS -64"
1441
SHLIB_CFLAGS="-fPIC"
1442
SHLIB_LD_LIBS='${LIBS}'
1445
CFLAGS_OPTIMIZE="-O2"
1446
# egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
1447
# when you inline the string and math operations. Turn this off to
1448
# get rid of the warnings.
1449
#CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
1451
SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
1452
DL_OBJS="tclLoadDl.o"
1454
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1455
AS_IF([test $doRpath = yes], [
1456
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1457
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1458
AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
1459
AS_IF([test $do64bit = yes], [
1460
AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
1462
CFLAGS="$CFLAGS -m64"
1463
AC_TRY_LINK(,, tcl_cv_cc_m64=yes, tcl_cv_cc_m64=no)
1464
CFLAGS=$hold_cflags])
1465
AS_IF([test $tcl_cv_cc_m64 = yes], [
1466
CFLAGS="$CFLAGS -m64"
1471
# The combo of gcc + glibc has a bug related to inlining of
1472
# functions like strtod(). The -fno-builtin flag should address
1473
# this problem but it does not work. The -fno-inline flag is kind
1474
# of overkill but it works. Disable inlining only when one of the
1475
# files in compat/*.c is being linked in.
1477
AS_IF([test x"${USE_COMPAT}" != x],[CFLAGS="$CFLAGS -fno-inline"])
1480
SHLIB_CFLAGS="-fPIC"
1481
SHLIB_LD_LIBS='${LIBS}'
1484
SHLIB_LD='${CC} -shared'
1487
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
1490
AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
1493
SHLIB_CFLAGS="-fPIC"
1494
SHLIB_LD_LIBS='${LIBS}'
1497
SHLIB_LD='${CC} -shared'
1498
DL_OBJS="tclLoadDl.o"
1499
DL_LIBS="-mshared -ldl"
1500
LD_FLAGS="-Wl,--export-dynamic"
1501
AS_IF([test $doRpath = yes], [
1502
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1503
LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1506
SHLIB_CFLAGS="-K PIC"
1510
DL_OBJS="tclLoadDl.o"
1516
SHLIB_CFLAGS="-K PIC"
1520
DL_OBJS="tclLoadDl.o"
1522
LDFLAGS="$LDFLAGS -Wl,-Bexport"
1526
NetBSD-1.*|FreeBSD-[[1-2]].*)
1527
SHLIB_CFLAGS="-fPIC"
1528
SHLIB_LD="ld -Bshareable -x"
1529
SHLIB_LD_LIBS='${LIBS}'
1531
DL_OBJS="tclLoadDl.o"
1533
AS_IF([test $doRpath = yes], [
1534
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1535
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1536
AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
1541
], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
1542
AS_IF([test $tcl_cv_ld_elf = yes], [
1543
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
1545
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
1548
# Ancient FreeBSD doesn't handle version numbers with dots.
1550
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1551
TCL_LIB_VERSIONS_OK=nodots
1554
CFLAGS_OPTIMIZE='-O2'
1555
SHLIB_CFLAGS="-fPIC"
1556
SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
1557
SHLIB_LD_LIBS='${LIBS}'
1559
DL_OBJS="tclLoadDl.o"
1561
AS_IF([test $doRpath = yes], [
1562
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1563
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1564
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
1565
AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
1570
], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
1571
AS_IF([test $tcl_cv_ld_elf = yes], [
1572
LDFLAGS=-Wl,-export-dynamic
1575
# OpenBSD doesn't do version numbers with dots.
1576
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1577
TCL_LIB_VERSIONS_OK=nodots
1580
# FreeBSD 3.* and greater have ELF.
1581
# NetBSD 2.* has ELF and can use 'cc -shared' to build shared libs
1582
SHLIB_CFLAGS="-fPIC"
1583
SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
1584
SHLIB_LD_LIBS='${LIBS}'
1586
DL_OBJS="tclLoadDl.o"
1588
LDFLAGS="$LDFLAGS -export-dynamic"
1589
AS_IF([test $doRpath = yes], [
1590
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
1591
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1592
AS_IF([test "${TCL_THREADS}" = "1"], [
1593
# The -pthread needs to go in the CFLAGS, not LIBS
1594
LIBS=`echo $LIBS | sed s/-pthread//`
1595
CFLAGS="$CFLAGS -pthread"
1596
LDFLAGS="$LDFLAGS -pthread"
1600
# FreeBSD-3 doesn't handle version numbers with dots.
1601
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1602
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
1603
TCL_LIB_VERSIONS_OK=nodots
1608
CFLAGS_OPTIMIZE="-Os"
1609
SHLIB_CFLAGS="-fno-common"
1610
# To avoid discrepancies between what headers configure sees during
1611
# preprocessing tests and compiling tests, move any -isysroot and
1612
# -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
1613
CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
1614
awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1615
if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`"
1616
CFLAGS="`echo " ${CFLAGS}" | \
1617
awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
1618
if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
1619
AS_IF([test $do64bit = yes], [
1622
AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
1623
tcl_cv_cc_arch_ppc64, [
1625
CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1626
AC_TRY_LINK(,, tcl_cv_cc_arch_ppc64=yes,
1627
tcl_cv_cc_arch_ppc64=no)
1628
CFLAGS=$hold_cflags])
1629
AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [
1630
CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
1634
AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
1635
tcl_cv_cc_arch_x86_64, [
1637
CFLAGS="$CFLAGS -arch x86_64"
1638
AC_TRY_LINK(,, tcl_cv_cc_arch_x86_64=yes,
1639
tcl_cv_cc_arch_x86_64=no)
1640
CFLAGS=$hold_cflags])
1641
AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [
1642
CFLAGS="$CFLAGS -arch x86_64"
1646
AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
1649
# Check for combined 32-bit and 64-bit fat build
1650
AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \
1651
&& echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '], [
1654
SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}'
1655
AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
1656
hold_ldflags=$LDFLAGS
1657
LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
1658
AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no)
1659
LDFLAGS=$hold_ldflags])
1660
AS_IF([test $tcl_cv_ld_single_module = yes], [
1661
SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
1663
SHLIB_LD_LIBS='${LIBS}'
1664
SHLIB_SUFFIX=".dylib"
1665
DL_OBJS="tclLoadDyld.o"
1667
# Don't use -prebind when building for Mac OS X 10.4 or later only:
1668
AS_IF([test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \
1669
"`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4], [
1670
LDFLAGS="$LDFLAGS -prebind"])
1671
LDFLAGS="$LDFLAGS -headerpad_max_install_names"
1672
AC_CACHE_CHECK([if ld accepts -search_paths_first flag],
1673
tcl_cv_ld_search_paths_first, [
1674
hold_ldflags=$LDFLAGS
1675
LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1676
AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes,
1677
tcl_cv_ld_search_paths_first=no)
1678
LDFLAGS=$hold_ldflags])
1679
AS_IF([test $tcl_cv_ld_search_paths_first = yes], [
1680
LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
1682
AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
1683
AC_DEFINE(MODULE_SCOPE, [__private_extern__],
1684
[Compiler support for module scope symbols])
1688
LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
1689
AC_DEFINE(MAC_OSX_TCL, 1, [Is this a Mac I see before me?])
1690
PLAT_OBJS='${MAC_OSX_OBJS}'
1691
PLAT_SRCS='${MAC_OSX_SRCS}'
1692
AC_MSG_CHECKING([whether to use CoreFoundation])
1693
AC_ARG_ENABLE(corefoundation,
1694
AC_HELP_STRING([--enable-corefoundation],
1695
[use CoreFoundation API on MacOSX (default: on)]),
1696
[tcl_corefoundation=$enableval], [tcl_corefoundation=yes])
1697
AC_MSG_RESULT([$tcl_corefoundation])
1698
AS_IF([test $tcl_corefoundation = yes], [
1699
AC_CACHE_CHECK([for CoreFoundation.framework],
1700
tcl_cv_lib_corefoundation, [
1702
AS_IF([test "$fat_32_64" = yes], [
1703
for v in CFLAGS CPPFLAGS LDFLAGS; do
1704
# On Tiger there is no 64-bit CF, so remove 64-bit
1705
# archs from CFLAGS et al. while testing for
1706
# presence of CF. 64-bit CF is disabled in
1707
# tclUnixPort.h if necessary.
1708
eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
1710
LIBS="$LIBS -framework CoreFoundation"
1711
AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>],
1712
[CFBundleRef b = CFBundleGetMainBundle();],
1713
tcl_cv_lib_corefoundation=yes,
1714
tcl_cv_lib_corefoundation=no)
1715
AS_IF([test "$fat_32_64" = yes], [
1716
for v in CFLAGS CPPFLAGS LDFLAGS; do
1717
eval $v'="$hold_'$v'"'
1720
AS_IF([test $tcl_cv_lib_corefoundation = yes], [
1721
LIBS="$LIBS -framework CoreFoundation"
1722
AC_DEFINE(HAVE_COREFOUNDATION, 1,
1723
[Do we have access to Darwin CoreFoundation.framework?])
1724
], [tcl_corefoundation=no])
1725
AS_IF([test "$fat_32_64" = yes -a $tcl_corefoundation = yes],[
1726
AC_CACHE_CHECK([for 64-bit CoreFoundation],
1727
tcl_cv_lib_corefoundation_64, [
1728
for v in CFLAGS CPPFLAGS LDFLAGS; do
1729
eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
1731
AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>],
1732
[CFBundleRef b = CFBundleGetMainBundle();],
1733
tcl_cv_lib_corefoundation_64=yes,
1734
tcl_cv_lib_corefoundation_64=no)
1735
for v in CFLAGS CPPFLAGS LDFLAGS; do
1736
eval $v'="$hold_'$v'"'
1738
AS_IF([test $tcl_cv_lib_corefoundation_64 = no], [
1739
AC_DEFINE(NO_COREFOUNDATION_64, 1,
1740
[Is Darwin CoreFoundation unavailable for 64-bit?])
1741
LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings"
1748
SHLIB_LD='${CC} -nostdlib -r'
1751
DL_OBJS="tclLoadNext.o"
1757
CFLAGS_OPTIMIZE="" # Optimizer is buggy
1758
AC_DEFINE(_OE_SOCKETS, 1, # needed in sys/socket.h
1759
[Should OS/390 do the right thing with sockets?])
1761
OSF1-1.0|OSF1-1.1|OSF1-1.2)
1762
# OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
1764
# Hack: make package name same as library name
1765
SHLIB_LD='ld -R -export $@:'
1768
DL_OBJS="tclLoadOSF.o"
1774
# OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
1775
SHLIB_CFLAGS="-fPIC"
1776
AS_IF([test "$SHARED_BUILD" = 1], [SHLIB_LD="ld -shared"], [
1777
SHLIB_LD="ld -non_shared"
1781
DL_OBJS="tclLoadDl.o"
1789
AS_IF([test "$SHARED_BUILD" = 1], [
1790
SHLIB_LD='ld -shared -expect_unresolved "*"'
1792
SHLIB_LD='ld -non_shared -expect_unresolved "*"'
1796
DL_OBJS="tclLoadDl.o"
1798
AS_IF([test $doRpath = yes], [
1799
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
1800
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
1801
AS_IF([test "$GCC" = yes], [CFLAGS="$CFLAGS -mieee"], [
1802
CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"])
1803
# see pthread_intro(3) for pthread support on osf1, k.furukawa
1804
AS_IF([test "${TCL_THREADS}" = 1], [
1805
CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
1806
CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
1807
LIBS=`echo $LIBS | sed s/-lpthreads//`
1808
AS_IF([test "$GCC" = yes], [
1809
LIBS="$LIBS -lpthread -lmach -lexc"
1811
CFLAGS="$CFLAGS -pthread"
1812
LDFLAGS="$LDFLAGS -pthread"
1818
# This may work for all QNX, but it was only reported for v6.
1819
SHLIB_CFLAGS="-fPIC"
1820
SHLIB_LD="ld -Bshareable -x"
1823
DL_OBJS="tclLoadDl.o"
1824
# dlopen is in -lc on QNX
1830
# Note, dlopen is available only on SCO 3.2.5 and greater. However,
1831
# this test works, since "uname -s" was non-standard in 3.2.4 and
1833
AS_IF([test "$GCC" = yes], [
1834
SHLIB_CFLAGS="-fPIC -melf"
1835
LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
1837
SHLIB_CFLAGS="-Kpic -belf"
1838
LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
1843
DL_OBJS="tclLoadDl.o"
1849
SHLIB_CFLAGS="-K PIC"
1853
DL_OBJS="tclLoadDl.o"
1863
DL_OBJS="tclLoadDl.o"
1865
CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
1866
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1868
# SunOS can't handle version numbers with dots in them in library
1869
# specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
1870
# requires an extra version number at the end of .so file names.
1871
# So, the library has to have a name like libtcl75.so.1.0
1873
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
1874
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
1875
TCL_LIB_VERSIONS_OK=nodots
1878
# Careful to not let 5.10+ fall into this case
1880
# Note: If _REENTRANT isn't defined, then Solaris
1881
# won't define thread-safe library routines.
1883
AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1884
AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1885
[Do we really want to follow the standard? Yes we do!])
1887
SHLIB_CFLAGS="-KPIC"
1889
# Note: need the LIBS below, otherwise Tk won't find Tcl's
1890
# symbols when dynamically loaded into tclsh.
1892
SHLIB_LD_LIBS='${LIBS}'
1894
DL_OBJS="tclLoadDl.o"
1896
AS_IF([test "$GCC" = yes], [
1897
SHLIB_LD='${CC} -shared'
1898
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1899
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1901
SHLIB_LD="/usr/ccs/bin/ld -G -z text"
1902
CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
1903
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1907
# Note: If _REENTRANT isn't defined, then Solaris
1908
# won't define thread-safe library routines.
1910
AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
1911
AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
1912
[Do we really want to follow the standard? Yes we do!])
1914
SHLIB_CFLAGS="-KPIC"
1916
# Check to enable 64-bit flags for compiler/linker
1917
AS_IF([test "$do64bit" = yes], [
1919
AS_IF([test "$arch" = "sparcv9 sparc"], [
1920
AS_IF([test "$GCC" = yes], [
1921
AS_IF([test "`${CC} -dumpversion | awk -F. '{print [$]1}'`" -lt 3], [
1922
AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
1925
CFLAGS="$CFLAGS -m64 -mcpu=v9"
1926
LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
1927
SHLIB_CFLAGS="-fPIC"
1931
AS_IF([test "$do64bitVIS" = yes], [
1932
CFLAGS="$CFLAGS -xarch=v9a"
1933
LDFLAGS_ARCH="-xarch=v9a"
1935
CFLAGS="$CFLAGS -xarch=v9"
1936
LDFLAGS_ARCH="-xarch=v9"
1938
# Solaris 64 uses this as well
1939
#LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
1941
], [AS_IF([test "$arch" = "amd64 i386"], [
1942
AS_IF([test "$GCC" = yes], [
1944
SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
1946
CFLAGS="$CFLAGS -m64"
1947
LDFLAGS="$LDFLAGS -m64";;
1949
AC_MSG_WARN([64bit mode not supported with GCC on $system]);;
1954
SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
1955
CFLAGS="$CFLAGS -m64"
1956
LDFLAGS="$LDFLAGS -m64";;
1958
CFLAGS="$CFLAGS -xarch=amd64"
1959
LDFLAGS="$LDFLAGS -xarch=amd64";;
1962
], [AC_MSG_WARN([64bit mode not supported for $arch])])])
1965
#--------------------------------------------------------------------
1966
# On Solaris 5.x i386 with the sunpro compiler we need to link
1967
# with sunmath to get floating point rounding control
1968
#--------------------------------------------------------------------
1969
AS_IF([test "$GCC" = yes],[use_sunmath=no],[
1971
AC_MSG_CHECKING([whether to use -lsunmath for fp rounding control])
1972
AS_IF([test "$arch" = "amd64 i386"], [
1973
AC_MSG_RESULT([yes])
1974
MATH_LIBS="-lsunmath $MATH_LIBS"
1975
AC_CHECK_HEADER(sunmath.h)
1983
# Note: need the LIBS below, otherwise Tk won't find Tcl's
1984
# symbols when dynamically loaded into tclsh.
1986
SHLIB_LD_LIBS='${LIBS}'
1988
DL_OBJS="tclLoadDl.o"
1990
AS_IF([test "$GCC" = yes], [
1991
SHLIB_LD='${CC} -shared'
1992
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
1993
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
1994
AS_IF([test "$do64bit_ok" = yes], [
1995
AS_IF([test "$arch" = "sparcv9 sparc"], [
1996
# We need to specify -static-libgcc or we need to
1997
# add the path to the sparv9 libgcc.
1998
SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
1999
# for finding sparcv9 libgcc, get the regular libgcc
2000
# path, remove so name and append 'sparcv9'
2001
#v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
2002
#CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
2003
], [AS_IF([test "$arch" = "amd64 i386"], [
2004
SHLIB_LD="$SHLIB_LD -m64 -static-libgcc"
2008
AS_IF([test "$use_sunmath" = yes], [textmode=textoff],[textmode=text])
2010
SunOS-5.[[1-9]][[0-9]]*)
2011
SHLIB_LD="\${CC} -G -z $textmode \${LDFLAGS}";;
2013
SHLIB_LD="/usr/ccs/bin/ld -G -z $textmode";;
2015
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
2016
LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
2019
UNIX_SV* | UnixWare-5*)
2020
SHLIB_CFLAGS="-KPIC"
2024
DL_OBJS="tclLoadDl.o"
2026
# Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
2027
# that don't grok the -Bexport option. Test that it does.
2028
AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
2029
hold_ldflags=$LDFLAGS
2030
LDFLAGS="$LDFLAGS -Wl,-Bexport"
2031
AC_TRY_LINK(, [int i;], tcl_cv_ld_Bexport=yes, tcl_cv_ld_Bexport=no)
2032
LDFLAGS=$hold_ldflags])
2033
AS_IF([test $tcl_cv_ld_Bexport = yes], [
2034
LDFLAGS="$LDFLAGS -Wl,-Bexport"
2041
AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = no], [
2042
AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
2045
AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = yes], [
2046
AC_DEFINE(TCL_CFG_DO64BIT, 1, [Is this a 64-bit build?])
2049
dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
2050
dnl # until the end of configure, as configure's compile and link tests use
2051
dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
2052
dnl # preprocessing tests use only CPPFLAGS.
2053
AC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
2055
# Step 4: disable dynamic loading if requested via a command-line switch.
2058
AC_HELP_STRING([--enable-load],
2059
[allow dynamic loading and "load" command (default: on)]),
2060
[tcl_ok=$enableval], [tcl_ok=yes])
2061
AS_IF([test "$tcl_ok" = no], [DL_OBJS=""])
2063
AS_IF([test "x$DL_OBJS" != x], [BUILD_DLTEST="\$(DLTEST_TARGETS)"], [
2064
AC_MSG_WARN([Can't figure out how to do dynamic loading or shared libraries on this system.])
2068
DL_OBJS="tclLoadNone.o"
2070
LDFLAGS="$LDFLAGS_ORIG"
2075
LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
2077
# If we're running gcc, then change the C flags for compiling shared
2078
# libraries to the right flags for gcc, instead of those for the
2079
# standard manufacturer compiler.
2081
AS_IF([test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes], [
2086
NetBSD-*|FreeBSD-*) ;;
2089
*) SHLIB_CFLAGS="-fPIC" ;;
2092
AS_IF([test "$SHARED_LIB_SUFFIX" = ""], [
2093
SHARED_LIB_SUFFIX='${VERSION}${SHLIB_SUFFIX}'])
2094
AS_IF([test "$UNSHARED_LIB_SUFFIX" = ""], [
2095
UNSHARED_LIB_SUFFIX='${VERSION}.a'])
2097
AS_IF([test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""], [
2098
LIB_SUFFIX=${SHARED_LIB_SUFFIX}
2099
MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
2100
INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)"/$(LIB_FILE)'
2102
LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
2104
AS_IF([test "$RANLIB" = ""], [
2105
MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}'
2106
INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)"/$(LIB_FILE)'
2108
MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@'
2109
INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)"/$(LIB_FILE) ; (cd "$(LIB_INSTALL_DIR)" ; $(RANLIB) $(LIB_FILE))'
2113
# Stub lib does not depend on shared/static configuration
2114
AS_IF([test "$RANLIB" = ""], [
2115
MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}'
2116
INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)"'
2118
MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@'
2119
INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)"/$(STUB_LIB_FILE) ; (cd "$(LIB_INSTALL_DIR)" ; $(RANLIB) $(STUB_LIB_FILE))'
2122
# Define TCL_LIBS now that we know what DL_LIBS is.
2123
# The trick here is that we don't want to change the value of TCL_LIBS if
2124
# it is already set when tclConfig.sh had been loaded by Tk.
2125
AS_IF([test "x${TCL_LIBS}" = x], [
2126
TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}"])
2129
# FIXME: This subst was left in only because the TCL_DL_LIBS
2130
# entry in tclConfig.sh uses it. It is not clear why someone
2131
# would use TCL_DL_LIBS instead of TCL_LIBS.
2139
AC_SUBST(CFLAGS_DEBUG)
2140
AC_SUBST(CFLAGS_OPTIMIZE)
2141
AC_SUBST(CFLAGS_WARNING)
2144
AC_SUBST(LDFLAGS_DEBUG)
2145
AC_SUBST(LDFLAGS_OPTIMIZE)
2146
AC_SUBST(CC_SEARCH_FLAGS)
2147
AC_SUBST(LD_SEARCH_FLAGS)
2151
AC_SUBST(TCL_SHLIB_LD_EXTRAS)
2152
AC_SUBST(TK_SHLIB_LD_EXTRAS)
2153
AC_SUBST(SHLIB_LD_LIBS)
2154
AC_SUBST(SHLIB_CFLAGS)
2155
AC_SUBST(SHLIB_SUFFIX)
2156
AC_DEFINE_UNQUOTED(TCL_SHLIB_EXT,"${SHLIB_SUFFIX}",
2157
[What is the default extension for shared libraries?])
2160
AC_SUBST(MAKE_STUB_LIB)
2161
AC_SUBST(INSTALL_LIB)
2162
AC_SUBST(INSTALL_STUB_LIB)
2166
#--------------------------------------------------------------------
2169
# Determine which interface to use to talk to the serial port.
2170
# Note that #include lines must begin in leftmost column for
2171
# some compilers to recognize them as preprocessor directives,
2172
# and some build environments have stdin not pointing at a
2173
# pseudo-terminal (usually /dev/null instead.)
2180
# Defines only one of the following vars:
2186
#--------------------------------------------------------------------
2188
AC_DEFUN([SC_SERIAL_PORT], [
2189
AC_CHECK_HEADERS(sys/modem.h)
2190
AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [
2192
#include <termios.h>
2196
if (tcgetattr(0, &t) == 0) {
2198
t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2202
}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2203
if test $tcl_cv_api_serial = no ; then
2209
if (ioctl(0, TCGETA, &t) == 0) {
2210
t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2214
}], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2216
if test $tcl_cv_api_serial = no ; then
2222
if (ioctl(0, TIOCGETP, &t) == 0) {
2224
t.sg_flags |= ODDP | EVENP | RAW;
2228
}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2230
if test $tcl_cv_api_serial = no ; then
2232
#include <termios.h>
2237
if (tcgetattr(0, &t) == 0
2238
|| errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2240
t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
2244
}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2246
if test $tcl_cv_api_serial = no; then
2253
if (ioctl(0, TCGETA, &t) == 0
2254
|| errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2255
t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
2259
}], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
2261
if test $tcl_cv_api_serial = no; then
2268
if (ioctl(0, TIOCGETP, &t) == 0
2269
|| errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
2271
t.sg_flags |= ODDP | EVENP | RAW;
2275
}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
2277
case $tcl_cv_api_serial in
2278
termios) AC_DEFINE(USE_TERMIOS, 1, [Use the termios API for serial lines]);;
2279
termio) AC_DEFINE(USE_TERMIO, 1, [Use the termio API for serial lines]);;
2280
sgtty) AC_DEFINE(USE_SGTTY, 1, [Use the sgtty API for serial lines]);;
2284
#--------------------------------------------------------------------
2285
# SC_MISSING_POSIX_HEADERS
2287
# Supply substitutes for missing POSIX header files. Special
2289
# - stdlib.h doesn't define strtol, strtoul, or
2290
# strtod insome versions of SunOS
2291
# - some versions of string.h don't declare procedures such
2299
# Defines some of the following vars:
2302
# HAVE_LIMITS_H or NO_LIMITS_H
2311
#--------------------------------------------------------------------
2313
AC_DEFUN([SC_MISSING_POSIX_HEADERS], [
2314
AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [
2315
AC_TRY_LINK([#include <sys/types.h>
2316
#include <dirent.h>], [
2317
#ifndef _POSIX_SOURCE
2320
* Generate compilation error to make the test fail: Lynx headers
2321
* are only valid if really in the POSIX environment.
2324
missing_procedure();
2328
struct dirent *entryPtr;
2330
d = opendir("foobar");
2331
entryPtr = readdir(d);
2332
p = entryPtr->d_name;
2334
], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no)])
2336
if test $tcl_cv_dirent_h = no; then
2337
AC_DEFINE(NO_DIRENT_H, 1, [Do we have <dirent.h>?])
2340
AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have <float.h>?])])
2341
AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have <values.h>?])])
2342
AC_CHECK_HEADER(limits.h,
2343
[AC_DEFINE(HAVE_LIMITS_H, 1, [Do we have <limits.h>?])],
2344
[AC_DEFINE(NO_LIMITS_H, 1, [Do we have <limits.h>?])])
2345
AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
2346
AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
2347
AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
2348
AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
2349
if test $tcl_ok = 0; then
2350
AC_DEFINE(NO_STDLIB_H, 1, [Do we have <stdlib.h>?])
2352
AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
2353
AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
2354
AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
2356
# See also memmove check below for a place where NO_STRING_H can be
2359
if test $tcl_ok = 0; then
2360
AC_DEFINE(NO_STRING_H, 1, [Do we have <string.h>?])
2363
AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H, 1, [Do we have <sys/wait.h>?])])
2364
AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H, 1, [Do we have <dlfcn.h>?])])
2366
# OS/390 lacks sys/param.h (and doesn't need it, by chance).
2367
AC_HAVE_HEADERS(sys/param.h)
2370
#--------------------------------------------------------------------
2373
# Locate the X11 header files and the X11 library archive. Try
2374
# the ac_path_x macro first, but if it doesn't find the X stuff
2375
# (e.g. because there's no xmkmf program) then check through
2376
# a list of possible directories. Under some conditions the
2377
# autoconf macro will return an include directory that contains
2378
# no include files, so double-check its result just to be safe.
2385
# Sets the the following vars:
2389
#--------------------------------------------------------------------
2391
AC_DEFUN([SC_PATH_X], [
2394
if test "$no_x" = ""; then
2395
if test "$x_includes" = ""; then
2396
AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
2398
if test ! -r $x_includes/X11/Intrinsic.h; then
2399
not_really_there="yes"
2403
if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
2404
AC_MSG_CHECKING([for X11 header files])
2405
found_xincludes="no"
2406
AC_TRY_CPP([#include <X11/Intrinsic.h>], found_xincludes="yes", found_xincludes="no")
2407
if test "$found_xincludes" = "no"; then
2408
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"
2410
if test -r $i/X11/Intrinsic.h; then
2413
found_xincludes="yes"
2419
if test "$x_includes" != ""; then
2420
XINCLUDES="-I$x_includes"
2421
found_xincludes="yes"
2424
if test found_xincludes = "no"; then
2425
AC_MSG_RESULT([couldn't find any!])
2428
if test "$no_x" = yes; then
2429
AC_MSG_CHECKING([for X11 libraries])
2431
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"
2433
if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl -o -r $i/libX11.dylib; then
2441
if test "$x_libraries" = ""; then
2444
XLIBSW="-L$x_libraries -lX11"
2447
if test "$XLIBSW" = nope ; then
2448
AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
2450
if test "$XLIBSW" = nope ; then
2451
AC_MSG_RESULT([could not find any! Using -lX11.])
2456
#--------------------------------------------------------------------
2459
# The statements below check for systems where POSIX-style
2460
# non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
2461
# On these systems (mostly older ones), use the old BSD-style
2462
# FIONBIO approach instead.
2469
# Defines some of the following vars:
2475
#--------------------------------------------------------------------
2477
AC_DEFUN([SC_BLOCKING_STYLE], [
2478
AC_CHECK_HEADERS(sys/ioctl.h)
2479
AC_CHECK_HEADERS(sys/filio.h)
2481
AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
2483
# There used to be code here to use FIONBIO under AIX. However, it
2484
# was reported that FIONBIO doesn't work under AIX 3.2.5. Since
2485
# using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
2486
# code (JO, 5/31/97).
2489
AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
2490
AC_MSG_RESULT([FIONBIO])
2493
AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
2494
AC_MSG_RESULT([FIONBIO])
2497
AC_MSG_RESULT([O_NONBLOCK])
2502
#--------------------------------------------------------------------
2505
# Checks how the system deals with time.h, what time structures
2506
# are used on the system, and what fields the structures have.
2513
# Defines some of the following vars:
2519
#--------------------------------------------------------------------
2521
AC_DEFUN([SC_TIME_HANDLER], [
2522
AC_CHECK_HEADERS(sys/time.h)
2526
AC_CHECK_FUNCS(gmtime_r localtime_r mktime)
2528
AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
2529
AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
2530
tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)])
2531
if test $tcl_cv_member_tm_tzadj = yes ; then
2532
AC_DEFINE(HAVE_TM_TZADJ, 1, [Should we use the tm_tzadj field of struct tm?])
2535
AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
2536
AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
2537
tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)])
2538
if test $tcl_cv_member_tm_gmtoff = yes ; then
2539
AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?])
2543
# Its important to include time.h in this check, as some systems
2544
# (like convex) have timezone functions, etc.
2546
AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
2547
AC_TRY_COMPILE([#include <time.h>],
2548
[extern long timezone;
2551
tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)])
2552
if test $tcl_cv_timezone_long = yes ; then
2553
AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2556
# On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
2558
AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
2559
AC_TRY_COMPILE([#include <time.h>],
2560
[extern time_t timezone;
2563
tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)])
2564
if test $tcl_cv_timezone_time = yes ; then
2565
AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
2570
#--------------------------------------------------------------------
2573
# Under Solaris 2.4, strtod returns the wrong value for the
2574
# terminating character under some conditions. Check for this
2575
# and if the problem exists use a substitute procedure
2576
# "fixstrtod" (provided by Tcl) that corrects the error.
2577
# Also, on Compaq's Tru64 Unix 5.0,
2578
# strtod(" ") returns 0.0 instead of a failure to convert.
2585
# Might defines some of the following vars:
2586
# strtod (=fixstrtod)
2588
#--------------------------------------------------------------------
2590
AC_DEFUN([SC_BUGGY_STRTOD], [
2591
AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
2592
if test "$tcl_strtod" = 1; then
2593
AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
2595
extern double strtod();
2597
char *infString="Inf", *nanString="NaN", *spaceString=" ";
2600
value = strtod(infString, &term);
2601
if ((term != infString) && (term[-1] == 0)) {
2604
value = strtod(nanString, &term);
2605
if ((term != nanString) && (term[-1] == 0)) {
2608
value = strtod(spaceString, &term);
2609
if (term == (spaceString+1)) {
2613
}], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy,
2614
tcl_cv_strtod_buggy=buggy)])
2615
if test "$tcl_cv_strtod_buggy" = buggy; then
2616
AC_LIBOBJ([fixstrtod])
2618
AC_DEFINE(strtod, fixstrtod, [Do we want to use the strtod() in compat?])
2623
#--------------------------------------------------------------------
2626
# Search for the libraries needed to link the Tcl shell.
2627
# Things like the math library (-lm) and socket stuff (-lsocket vs.
2628
# -lnsl) are dealt with here.
2635
# Might append to the following vars:
2639
# Might define the following vars:
2642
#--------------------------------------------------------------------
2644
AC_DEFUN([SC_TCL_LINK_LIBS], [
2645
#--------------------------------------------------------------------
2646
# On a few very rare systems, all of the libm.a stuff is
2647
# already in libc.a. Set compiler flags accordingly.
2648
# Also, Linux requires the "ieee" library for math to work
2649
# right (and it must appear before "-lm").
2650
#--------------------------------------------------------------------
2652
AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
2653
AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
2655
#--------------------------------------------------------------------
2656
# Interactive UNIX requires -linet instead of -lsocket, plus it
2657
# needs net/errno.h to define the socket-related error codes.
2658
#--------------------------------------------------------------------
2660
AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
2661
AC_CHECK_HEADER(net/errno.h, [
2662
AC_DEFINE(HAVE_NET_ERRNO_H, 1, [Do we have <net/errno.h>?])])
2664
#--------------------------------------------------------------------
2665
# Check for the existence of the -lsocket and -lnsl libraries.
2666
# The order here is important, so that they end up in the right
2667
# order in the command line generated by make. Here are some
2668
# special considerations:
2669
# 1. Use "connect" and "accept" to check for -lsocket, and
2670
# "gethostbyname" to check for -lnsl.
2671
# 2. Use each function name only once: can't redo a check because
2672
# autoconf caches the results of the last check and won't redo it.
2673
# 3. Use -lnsl and -lsocket only if they supply procedures that
2674
# aren't already present in the normal libraries. This is because
2675
# IRIX 5.2 has libraries, but they aren't needed and they're
2676
# bogus: they goof up name resolution if used.
2677
# 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
2678
# To get around this problem, check for both libraries together
2679
# if -lsocket doesn't work by itself.
2680
#--------------------------------------------------------------------
2683
AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
2684
if test "$tcl_checkSocket" = 1; then
2685
AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
2686
LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
2688
if test "$tcl_checkBoth" = 1; then
2690
LIBS="$LIBS -lsocket -lnsl"
2691
AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
2693
AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
2694
[LIBS="$LIBS -lnsl"])])
2697
#--------------------------------------------------------------------
2698
# SC_TCL_EARLY_FLAGS
2700
# Check for what flags are needed to be passed so the correct OS
2701
# features are available.
2708
# Might define the following vars:
2710
# _LARGEFILE64_SOURCE
2711
# _LARGEFILE_SOURCE64
2713
#--------------------------------------------------------------------
2715
AC_DEFUN([SC_TCL_EARLY_FLAG],[
2716
AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
2717
AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
2718
AC_TRY_COMPILE([[#define ]$1[ 1
2720
[tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
2721
[tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
2722
if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
2723
AC_DEFINE($1, 1, [Add the ]$1[ flag when building])
2724
tcl_flags="$tcl_flags $1"
2728
AC_DEFUN([SC_TCL_EARLY_FLAGS],[
2729
AC_MSG_CHECKING([for required early compiler flags])
2731
SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
2732
[char *p = (char *)strtoll; char *q = (char *)strtoull;])
2733
SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
2734
[struct stat64 buf; int i = stat64("/", &buf);])
2735
SC_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include <sys/stat.h>],
2736
[char *p = (char *)open64;])
2737
if test "x${tcl_flags}" = "x" ; then
2738
AC_MSG_RESULT([none])
2740
AC_MSG_RESULT([${tcl_flags}])
2744
#--------------------------------------------------------------------
2745
# SC_TCL_64BIT_FLAGS
2747
# Check for what is defined in the way of 64-bit features.
2754
# Might define the following vars:
2755
# TCL_WIDE_INT_IS_LONG
2757
# HAVE_STRUCT_DIRENT64
2758
# HAVE_STRUCT_STAT64
2761
#--------------------------------------------------------------------
2763
AC_DEFUN([SC_TCL_64BIT_FLAGS], [
2764
AC_MSG_CHECKING([for 64-bit integer type])
2765
AC_CACHE_VAL(tcl_cv_type_64bit,[
2766
tcl_cv_type_64bit=none
2767
# See if the compiler knows natively about __int64
2768
AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
2769
tcl_type_64bit=__int64, tcl_type_64bit="long long")
2770
# See if we should use long anyway Note that we substitute in the
2771
# type that is our current guess for a 64-bit type inside this check
2772
# program, so it should be modified only carefully...
2773
AC_TRY_COMPILE(,[switch (0) {
2774
case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ;
2775
}],tcl_cv_type_64bit=${tcl_type_64bit})])
2776
if test "${tcl_cv_type_64bit}" = none ; then
2777
AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Are wide integers to be implemented with C 'long's?])
2778
AC_MSG_RESULT([using long])
2780
AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
2781
[What type should be used to define wide integers?])
2782
AC_MSG_RESULT([${tcl_cv_type_64bit}])
2784
# Now check for auxiliary declarations
2785
AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
2786
AC_TRY_COMPILE([#include <sys/types.h>
2787
#include <sys/dirent.h>],[struct dirent64 p;],
2788
tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
2789
if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
2790
AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?])
2793
AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
2794
AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
2796
tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
2797
if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
2798
AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in <sys/stat.h>?])
2801
AC_CHECK_FUNCS(open64 lseek64)
2802
AC_MSG_CHECKING([for off64_t])
2803
AC_CACHE_VAL(tcl_cv_type_off64_t,[
2804
AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
2806
tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
2807
dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
2808
dnl functions lseek64 and open64 are defined.
2809
if test "x${tcl_cv_type_off64_t}" = "xyes" && \
2810
test "x${ac_cv_func_lseek64}" = "xyes" && \
2811
test "x${ac_cv_func_open64}" = "xyes" ; then
2812
AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in <sys/types.h>?])
2813
AC_MSG_RESULT([yes])
2820
#--------------------------------------------------------------------
2821
# SC_TCL_CFG_ENCODING TIP #59
2823
# Declare the encoding to use for embedded configuration information.
2829
# Might append to the following vars:
2832
# Will define the following vars:
2833
# TCL_CFGVAL_ENCODING
2835
#--------------------------------------------------------------------
2837
AC_DEFUN([SC_TCL_CFG_ENCODING], [
2838
AC_ARG_WITH(encoding,
2839
AC_HELP_STRING([--with-encoding],
2840
[encoding for configuration values (default: iso8859-1)]),
2841
with_tcencoding=${withval})
2843
if test x"${with_tcencoding}" != x ; then
2844
AC_DEFINE_UNQUOTED(TCL_CFGVAL_ENCODING,"${with_tcencoding}",
2845
[What encoding should be used for embedded configuration info?])
2847
AC_DEFINE(TCL_CFGVAL_ENCODING,"iso8859-1",
2848
[What encoding should be used for embedded configuration info?])
2852
#--------------------------------------------------------------------
2853
# SC_TCL_CHECK_BROKEN_FUNC
2855
# Check for broken function.
2858
# funcName - function to test for
2859
# advancedTest - the advanced test to run if the function is present
2862
# Might cause compatability versions of the function to be used.
2863
# Might affect the following vars:
2864
# USE_COMPAT (implicit)
2866
#--------------------------------------------------------------------
2868
AC_DEFUN([SC_TCL_CHECK_BROKEN_FUNC],[
2869
AC_CHECK_FUNC($1, tcl_ok=1, tcl_ok=0)
2870
if test ["$tcl_ok"] = 1; then
2871
AC_CACHE_CHECK([proper ]$1[ implementation], [tcl_cv_]$1[_unbroken],
2872
AC_TRY_RUN([[int main() {]$2[}]],[tcl_cv_]$1[_unbroken]=ok,
2873
[tcl_cv_]$1[_unbroken]=broken,[tcl_cv_]$1[_unbroken]=unknown))
2874
if test ["$tcl_cv_]$1[_unbroken"] = "ok"; then
2880
if test ["$tcl_ok"] = 0; then
2886
#--------------------------------------------------------------------
2887
# SC_TCL_GETHOSTBYADDR_R
2889
# Check if we have MT-safe variant of gethostbyaddr().
2896
# Might define the following vars:
2897
# HAVE_GETHOSTBYADDR_R
2898
# HAVE_GETHOSTBYADDR_R_7
2899
# HAVE_GETHOSTBYADDR_R_8
2901
#--------------------------------------------------------------------
2903
AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [AC_CHECK_FUNC(gethostbyaddr_r, [
2904
AC_CACHE_CHECK([for gethostbyaddr_r with 7 args], tcl_cv_api_gethostbyaddr_r_7, [
2911
struct hostent *result;
2916
(void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
2918
], tcl_cv_api_gethostbyaddr_r_7=yes, tcl_cv_api_gethostbyaddr_r_7=no)])
2919
tcl_ok=$tcl_cv_api_gethostbyaddr_r_7
2920
if test "$tcl_ok" = yes; then
2921
AC_DEFINE(HAVE_GETHOSTBYADDR_R_7, 1,
2922
[Define to 1 if gethostbyaddr_r takes 7 args.])
2924
AC_CACHE_CHECK([for gethostbyaddr_r with 8 args], tcl_cv_api_gethostbyaddr_r_8, [
2931
struct hostent *result, *resultp;
2936
(void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
2937
&resultp, &h_errnop);
2938
], tcl_cv_api_gethostbyaddr_r_8=yes, tcl_cv_api_gethostbyaddr_r_8=no)])
2939
tcl_ok=$tcl_cv_api_gethostbyaddr_r_8
2940
if test "$tcl_ok" = yes; then
2941
AC_DEFINE(HAVE_GETHOSTBYADDR_R_8, 1,
2942
[Define to 1 if gethostbyaddr_r takes 8 args.])
2945
if test "$tcl_ok" = yes; then
2946
AC_DEFINE(HAVE_GETHOSTBYADDR_R, 1,
2947
[Define to 1 if gethostbyaddr_r is available.])
2951
#--------------------------------------------------------------------
2952
# SC_TCL_GETHOSTBYNAME_R
2954
# Check to see what variant of gethostbyname_r() we have.
2955
# Based on David Arnold's example from the comp.programming.threads
2963
# Might define the following vars:
2964
# HAVE_GETHOSTBYADDR_R
2965
# HAVE_GETHOSTBYADDR_R_3
2966
# HAVE_GETHOSTBYADDR_R_5
2967
# HAVE_GETHOSTBYADDR_R_6
2969
#--------------------------------------------------------------------
2971
AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [AC_CHECK_FUNC(gethostbyname_r, [
2972
AC_CACHE_CHECK([for gethostbyname_r with 6 args], tcl_cv_api_gethostbyname_r_6, [
2977
struct hostent *he, *res;
2982
(void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop);
2983
], tcl_cv_api_gethostbyname_r_6=yes, tcl_cv_api_gethostbyname_r_6=no)])
2984
tcl_ok=$tcl_cv_api_gethostbyname_r_6
2985
if test "$tcl_ok" = yes; then
2986
AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1,
2987
[Define to 1 if gethostbyname_r takes 6 args.])
2989
AC_CACHE_CHECK([for gethostbyname_r with 5 args], tcl_cv_api_gethostbyname_r_5, [
2999
(void) gethostbyname_r(name, he, buffer, buflen, &h_errnop);
3000
], tcl_cv_api_gethostbyname_r_5=yes, tcl_cv_api_gethostbyname_r_5=no)])
3001
tcl_ok=$tcl_cv_api_gethostbyname_r_5
3002
if test "$tcl_ok" = yes; then
3003
AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1,
3004
[Define to 1 if gethostbyname_r takes 5 args.])
3006
AC_CACHE_CHECK([for gethostbyname_r with 3 args], tcl_cv_api_gethostbyname_r_3, [
3012
struct hostent_data data;
3014
(void) gethostbyname_r(name, he, &data);
3015
], tcl_cv_api_gethostbyname_r_3=yes, tcl_cv_api_gethostbyname_r_3=no)])
3016
tcl_ok=$tcl_cv_api_gethostbyname_r_3
3017
if test "$tcl_ok" = yes; then
3018
AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1,
3019
[Define to 1 if gethostbyname_r takes 3 args.])
3023
if test "$tcl_ok" = yes; then
3024
AC_DEFINE(HAVE_GETHOSTBYNAME_R, 1,
3025
[Define to 1 if gethostbyname_r is available.])
3029
#--------------------------------------------------------------------
3030
# SC_TCL_GETADDRINFO
3032
# Check if we have 'getaddrinfo'
3038
# Might define the following vars:
3041
#--------------------------------------------------------------------
3043
AC_DEFUN([SC_TCL_GETADDRINFO], [AC_CHECK_FUNC(getaddrinfo, [
3044
AC_CACHE_CHECK([for working getaddrinfo], tcl_cv_api_getaddrinfo, [
3048
const char *name, *port;
3049
struct addrinfo *aiPtr, hints;
3050
(void)getaddrinfo(name,port, &hints, &aiPtr);
3051
(void)freeaddrinfo(aiPtr);
3052
], tcl_cv_api_getaddrinfo=yes, tcl_cv_getaddrinfo=no)])
3053
tcl_ok=$tcl_cv_api_getaddrinfo
3054
if test "$tcl_ok" = yes; then
3055
AC_DEFINE(HAVE_GETADDRINFO, 1,
3056
[Define to 1 if getaddrinfo is available.])
3060
#--------------------------------------------------------------------
3063
# Check if we have MT-safe variant of getpwuid() and if yes,
3064
# which one exactly.
3071
# Might define the following vars:
3076
#--------------------------------------------------------------------
3078
AC_DEFUN([SC_TCL_GETPWUID_R], [AC_CHECK_FUNC(getpwuid_r, [
3079
AC_CACHE_CHECK([for getpwuid_r with 5 args], tcl_cv_api_getpwuid_r_5, [
3081
#include <sys/types.h>
3085
struct passwd pw, *pwp;
3089
(void) getpwuid_r(uid, &pw, buf, buflen, &pwp);
3090
], tcl_cv_api_getpwuid_r_5=yes, tcl_cv_api_getpwuid_r_5=no)])
3091
tcl_ok=$tcl_cv_api_getpwuid_r_5
3092
if test "$tcl_ok" = yes; then
3093
AC_DEFINE(HAVE_GETPWUID_R_5, 1,
3094
[Define to 1 if getpwuid_r takes 5 args.])
3096
AC_CACHE_CHECK([for getpwuid_r with 4 args], tcl_cv_api_getpwuid_r_4, [
3098
#include <sys/types.h>
3106
(void)getpwnam_r(uid, &pw, buf, buflen);
3107
], tcl_cv_api_getpwuid_r_4=yes, tcl_cv_api_getpwuid_r_4=no)])
3108
tcl_ok=$tcl_cv_api_getpwuid_r_4
3109
if test "$tcl_ok" = yes; then
3110
AC_DEFINE(HAVE_GETPWUID_R_4, 1,
3111
[Define to 1 if getpwuid_r takes 4 args.])
3114
if test "$tcl_ok" = yes; then
3115
AC_DEFINE(HAVE_GETPWUID_R, 1,
3116
[Define to 1 if getpwuid_r is available.])
3120
#--------------------------------------------------------------------
3123
# Check if we have MT-safe variant of getpwnam() and if yes,
3124
# which one exactly.
3131
# Might define the following vars:
3136
#--------------------------------------------------------------------
3138
AC_DEFUN([SC_TCL_GETPWNAM_R], [AC_CHECK_FUNC(getpwnam_r, [
3139
AC_CACHE_CHECK([for getpwnam_r with 5 args], tcl_cv_api_getpwnam_r_5, [
3141
#include <sys/types.h>
3145
struct passwd pw, *pwp;
3149
(void) getpwnam_r(name, &pw, buf, buflen, &pwp);
3150
], tcl_cv_api_getpwnam_r_5=yes, tcl_cv_api_getpwnam_r_5=no)])
3151
tcl_ok=$tcl_cv_api_getpwnam_r_5
3152
if test "$tcl_ok" = yes; then
3153
AC_DEFINE(HAVE_GETPWNAM_R_5, 1,
3154
[Define to 1 if getpwnam_r takes 5 args.])
3156
AC_CACHE_CHECK([for getpwnam_r with 4 args], tcl_cv_api_getpwnam_r_4, [
3158
#include <sys/types.h>
3166
(void)getpwnam_r(name, &pw, buf, buflen);
3167
], tcl_cv_api_getpwnam_r_4=yes, tcl_cv_api_getpwnam_r_4=no)])
3168
tcl_ok=$tcl_cv_api_getpwnam_r_4
3169
if test "$tcl_ok" = yes; then
3170
AC_DEFINE(HAVE_GETPWNAM_R_4, 1,
3171
[Define to 1 if getpwnam_r takes 4 args.])
3174
if test "$tcl_ok" = yes; then
3175
AC_DEFINE(HAVE_GETPWNAM_R, 1,
3176
[Define to 1 if getpwnam_r is available.])
3180
#--------------------------------------------------------------------
3183
# Check if we have MT-safe variant of getgrgid() and if yes,
3184
# which one exactly.
3191
# Might define the following vars:
3196
#--------------------------------------------------------------------
3198
AC_DEFUN([SC_TCL_GETGRGID_R], [AC_CHECK_FUNC(getgrgid_r, [
3199
AC_CACHE_CHECK([for getgrgid_r with 5 args], tcl_cv_api_getgrgid_r_5, [
3201
#include <sys/types.h>
3205
struct group gr, *grp;
3209
(void) getgrgid_r(gid, &gr, buf, buflen, &grp);
3210
], tcl_cv_api_getgrgid_r_5=yes, tcl_cv_api_getgrgid_r_5=no)])
3211
tcl_ok=$tcl_cv_api_getgrgid_r_5
3212
if test "$tcl_ok" = yes; then
3213
AC_DEFINE(HAVE_GETGRGID_R_5, 1,
3214
[Define to 1 if getgrgid_r takes 5 args.])
3216
AC_CACHE_CHECK([for getgrgid_r with 4 args], tcl_cv_api_getgrgid_r_4, [
3218
#include <sys/types.h>
3226
(void)getgrgid_r(gid, &gr, buf, buflen);
3227
], tcl_cv_api_getgrgid_r_4=yes, tcl_cv_api_getgrgid_r_4=no)])
3228
tcl_ok=$tcl_cv_api_getgrgid_r_4
3229
if test "$tcl_ok" = yes; then
3230
AC_DEFINE(HAVE_GETGRGID_R_4, 1,
3231
[Define to 1 if getgrgid_r takes 4 args.])
3234
if test "$tcl_ok" = yes; then
3235
AC_DEFINE(HAVE_GETGRGID_R, 1,
3236
[Define to 1 if getgrgid_r is available.])
3240
#--------------------------------------------------------------------
3243
# Check if we have MT-safe variant of getgrnam() and if yes,
3244
# which one exactly.
3251
# Might define the following vars:
3256
#--------------------------------------------------------------------
3258
AC_DEFUN([SC_TCL_GETGRNAM_R], [AC_CHECK_FUNC(getgrnam_r, [
3259
AC_CACHE_CHECK([for getgrnam_r with 5 args], tcl_cv_api_getgrnam_r_5, [
3261
#include <sys/types.h>
3265
struct group gr, *grp;
3269
(void) getgrnam_r(name, &gr, buf, buflen, &grp);
3270
], tcl_cv_api_getgrnam_r_5=yes, tcl_cv_api_getgrnam_r_5=no)])
3271
tcl_ok=$tcl_cv_api_getgrnam_r_5
3272
if test "$tcl_ok" = yes; then
3273
AC_DEFINE(HAVE_GETGRNAM_R_5, 1,
3274
[Define to 1 if getgrnam_r takes 5 args.])
3276
AC_CACHE_CHECK([for getgrnam_r with 4 args], tcl_cv_api_getgrnam_r_4, [
3278
#include <sys/types.h>
3286
(void)getgrnam_r(name, &gr, buf, buflen);
3287
], tcl_cv_api_getgrnam_r_4=yes, tcl_cv_api_getgrnam_r_4=no)])
3288
tcl_ok=$tcl_cv_api_getgrnam_r_4
3289
if test "$tcl_ok" = yes; then
3290
AC_DEFINE(HAVE_GETGRNAM_R_4, 1,
3291
[Define to 1 if getgrnam_r takes 4 args.])
3294
if test "$tcl_ok" = yes; then
3295
AC_DEFINE(HAVE_GETGRNAM_R, 1,
3296
[Define to 1 if getgrnam_r is available.])