Tcl Source Code

Artifact Content
Login
Bounty program for improvements to Tcl and certain Tcl packages.

Artifact 67cc05d5acf1179a6dbbd82de022af019abcd4f0:


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