with_tcl.m4 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #
  2. # Copyright (C) 1994-2018 Altair Engineering, Inc.
  3. # For more information, contact Altair at www.altair.com.
  4. #
  5. # This file is part of the PBS Professional ("PBS Pro") software.
  6. #
  7. # Open Source License Information:
  8. #
  9. # PBS Pro is free software. You can redistribute it and/or modify it under the
  10. # terms of the GNU Affero General Public License as published by the Free
  11. # Software Foundation, either version 3 of the License, or (at your option) any
  12. # later version.
  13. #
  14. # PBS Pro is distributed in the hope that it will be useful, but WITHOUT ANY
  15. # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16. # FOR A PARTICULAR PURPOSE.
  17. # See the GNU Affero General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU Affero General Public License
  20. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. #
  22. # Commercial License Information:
  23. #
  24. # For a copy of the commercial license terms and conditions,
  25. # go to: (http://www.pbspro.com/UserArea/agreement.html)
  26. # or contact the Altair Legal Department.
  27. #
  28. # Altair’s dual-license business model allows companies, individuals, and
  29. # organizations to create proprietary derivative works of PBS Pro and
  30. # distribute them - whether embedded or bundled with other software -
  31. # under a commercial license agreement.
  32. #
  33. # Use of Altair’s trademarks, including but not limited to "PBS™",
  34. # "PBS Professional®", and "PBS Pro™" and Altair’s logos is subject to Altair's
  35. # trademark licensing policies.
  36. #
  37. AC_DEFUN([PBS_AC_WITH_TCL],
  38. [
  39. AC_ARG_WITH([tcl],
  40. AS_HELP_STRING([--with-tcl=DIR],
  41. [Specify the directory where Tcl is installed.]
  42. )
  43. )
  44. AS_IF([test "x$with_tcl" != "x"],
  45. tcl_dir=["$with_tcl"],
  46. tcl_dir=["/usr"]
  47. )
  48. AC_MSG_CHECKING([for Tcl])
  49. AS_IF([test -r "$tcl_dir/lib64/tclConfig.sh"],
  50. [. "$tcl_dir/lib64/tclConfig.sh"],
  51. AS_IF([test -r "$tcl_dir/lib/tclConfig.sh"],
  52. [. "$tcl_dir/lib/tclConfig.sh"],
  53. AS_IF([test -r "$tcl_dir/lib/x86_64-linux-gnu/tclConfig.sh"],
  54. [. "$tcl_dir/lib/x86_64-linux-gnu/tclConfig.sh"],
  55. AC_MSG_ERROR([tclConfig.sh not found]))))
  56. AC_MSG_RESULT([$tcl_dir])
  57. AC_MSG_CHECKING([for Tcl version])
  58. AS_IF([test "x$TCL_VERSION" = "x"],
  59. AC_MSG_ERROR([Could not determine Tcl version]))
  60. AC_MSG_RESULT([$TCL_VERSION])
  61. [tcl_version="$TCL_VERSION"]
  62. AC_SUBST(tcl_version)
  63. AC_MSG_CHECKING([for Tk])
  64. AS_IF([test -r "$tcl_dir/lib64/tkConfig.sh"],
  65. [. "$tcl_dir/lib64/tkConfig.sh"],
  66. AS_IF([test -r "$tcl_dir/lib/tkConfig.sh"],
  67. [. "$tcl_dir/lib/tkConfig.sh"],
  68. AS_IF([test -r "$tcl_dir/lib/x86_64-linux-gnu/tkConfig.sh"],
  69. [. "$tcl_dir/lib/x86_64-linux-gnu/tkConfig.sh"],
  70. AC_MSG_ERROR([tkConfig.sh not found]))))
  71. AC_MSG_RESULT([$tcl_dir])
  72. AC_MSG_CHECKING([for Tk version])
  73. AS_IF([test "x$TK_VERSION" = "x"],
  74. AC_MSG_ERROR([Could not determine Tk version]))
  75. AC_MSG_RESULT([$TK_VERSION])
  76. [tk_version="$TK_VERSION"]
  77. AC_SUBST(tk_version)
  78. AS_IF([test x$TCL_INCLUDE_SPEC = x],
  79. # Using developer installed tcl
  80. [tcl_inc="-I$tcl_dir/include"]
  81. [tcl_lib="$tcl_dir/lib/libtcl$TCL_VERSION.a $TCL_LIBS"]
  82. [tk_inc="-I$tcl_dir/include"]
  83. [tk_lib="$tcl_dir/lib/libtcl$TCL_VERSION.a $tcl_dir/lib/libtk$TK_VERSION.a $TK_LIBS"],
  84. # Using system installed tcl
  85. [tcl_inc="$TCL_INCLUDE_SPEC"]
  86. [tcl_lib="$TCL_LIB_SPEC $TCL_LIBS"]
  87. [tk_inc="$TK_INCLUDE_SPEC"]
  88. [tk_lib=`echo "$TCL_LIB_SPEC $TK_LIB_SPEC $TK_LIBS" | ${SED} -e 's/-lXss //'`])
  89. AC_SUBST(tcl_inc)
  90. AC_SUBST(tcl_lib)
  91. AC_SUBST(tk_inc)
  92. AC_SUBST(tk_lib)
  93. [TCLSH_PATH=$tcl_dir/bin/tclsh$tcl_version]
  94. AC_SUBST(TCLSH_PATH)
  95. AC_DEFINE([TCL], [], [Defined when Tcl is available])
  96. AC_DEFINE([TK], [], [Defined when TK is available])
  97. ])