tcl.m4.orig
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:98k
源码类别:

通讯编程

开发平台:

Visual C++

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