home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / subcfg.tcl < prev    next >
Encoding:
Text File  |  1996-12-18  |  7.4 KB  |  272 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. # Copyright (c) 1993 by Westmount Technology B.V., Delft, The Netherlands.
  4. #
  5. # This software is furnished under a license and may be used only in
  6. # accordance with the terms of such license and with the inclusion of
  7. # the above copyright notice. This software or any other copies thereof
  8. # may not be provided or otherwise made available to any other person.
  9. # No title to and ownership of the software is hereby transferred.
  10. #
  11. # The information in this software is subject to change without notice
  12. # and should not be construed as a commitment by Westmount Technology B.V.
  13. #
  14. #---------------------------------------------------------------------------
  15. #
  16. #    File        : @(#)subcfg.tcl    /main/hindenburg/1 04 Apr 1996
  17. #    Author        : peku
  18. #    Original date    : 17-11-1993
  19. #    Description    : specific config file for CC 3.0 and
  20. #              RogueWave class library
  21. #
  22. #---------------------------------------------------------------------------
  23. #
  24.  
  25. global default_cxx
  26. set default_cxx CC
  27. global default_cxxdebug
  28. set default_cxxdebug -g0
  29. global default_RWinc
  30. set default_RWinc /usr/local/include
  31. global default_RWlib
  32. set default_RWlib /usr/local/lib/librwtool.a
  33. global default_templates
  34. set default_templates 1
  35.  
  36. # set help variabele 'base'
  37.  
  38. global base
  39. if $projcf {
  40.     set base [m4basedir]
  41.     [[ClientContext::global] currentConfig] setProperty makeCommand "make"
  42. } else {
  43.     set base [m4_var get M4_home]
  44. }
  45.  
  46. global set_default_actions
  47. set set_default_actions {
  48.     dfl_librw4omt
  49.     dfl_librwdbobj
  50.     dfl_maketmpl
  51.     dfl_cpp_config_tcl
  52. }
  53. global ask_actions
  54. set ask_actions {
  55.     ask_config
  56. }
  57.  
  58. global copy_actions
  59. set copy_actions {
  60.     cp_librw4omt
  61.     cp_librwdbobj
  62.     cp_maketmpl
  63.     cp_cpp_config_tcl
  64. }
  65.  
  66. global config_actions
  67. set config_actions {
  68.     cf_librw4omt
  69.     cf_librwdbobj
  70.     cf_maketmpl
  71.     cf_cpp_config_tcl
  72. }
  73.  
  74. global msg_actions
  75. set msg_actions {
  76.     msg_config
  77. }
  78.  
  79. # this configuration asks for  c++ compiler and templates
  80. # other defines are implied by choosing this file
  81.  
  82. proc ask_config {} {
  83.     global cxx_def templates_def RWlib_def RWinc_def
  84.  
  85.     set prompt "Enter command name for the C++ compiler"
  86.     get_config_var $prompt cxx_def
  87.     set prompt "What is the Rogue Wave class library path + name"
  88.     get_config_var $prompt RWlib_def
  89.     set prompt "What is the Rogue Wave class library include directory"
  90.     get_config_var $prompt RWinc_def
  91.     set templates_def 1
  92.     if [file exists [location $base include]] {
  93.         # previous installation ??
  94.         set answer_def n
  95.         puts "\nA previous C++ configuration exists."
  96.         puts "overwrite or reconfigure only"
  97.         puts -nonewline "Overwrite y/n \[$answer_def]: "
  98.         set answer [string trim [gets stdin]]
  99.         if {$answer == ""} {
  100.             set answer $answer_def
  101.         }
  102.         if {$answer != "y" && $answer != "Y"} {
  103.             global copy_actions config_actions msg_actions
  104.             set copy_actions ""
  105.             set config_actions ""
  106.             set msg_actions ""
  107.         }
  108.     }
  109. }
  110.  
  111. proc msg_config {} {
  112.     puts "\nNow you have to build the library manually by giving the following commands"
  113.     puts "(this may need proper search path setting for the compiler):\n"
  114.     puts "cd [location $base src librw4omt]; make install"
  115.     if [file exist [location $base src librwdbobj]] {
  116.         puts "cd [location $base src librwdbobj]; make install"
  117.     }
  118.     puts ""
  119. }
  120.  
  121. #-------------------------------------------------------------------------------
  122.  
  123. # Makefile for librw4omt needs:    c++ compiler
  124. #                Rogue Wave include directory
  125.  
  126. proc dfl_librw4omt {} {
  127.     global cxx_def
  128.     set cxx_def $default_cxx
  129.     global RWinc_def
  130.     set RWinc_def $default_RWinc
  131. }
  132.  
  133. proc cp_librw4omt {} {
  134.     m4copydir [location src librw4omt]
  135. }
  136.  
  137. proc cf_librw4omt {} {
  138.     set cxx_line "CXX =\t\t$cxx_def"
  139.     set cxx_patt {^CXX =.*$}
  140.     set incs_line "INCS =\t\t-I../../include -I$RWinc_def"
  141.     set incs_patt {^INCS =.*$}
  142.     set cfg(cxx) [list $cxx_patt $cxx_line]
  143.     set cfg(incs) [list $incs_patt $incs_line]
  144.  
  145.         add_ranlib_config cfg
  146.     config_file [location src librw4omt] Makefile cfg
  147. }
  148.  
  149. #-------------------------------------------------------------------------------
  150. #
  151. # Makefile for librwdbobj.a needs:    c++ compiler
  152. #                    Rogue Wave include directory
  153. #                    (fixed: Westmount RW-wrap include)
  154.  
  155. proc dfl_librwdbobj {} {
  156.     global cxx_def
  157.     set cxx_def $default_cxx
  158.     global RWinc_def
  159.     set RWinc_def $default_RWinc
  160. }
  161.  
  162. proc cp_librwdbobj {} {
  163.     m4copydir [location src librwdbobj]
  164.  
  165.         global target
  166.         $target::copy
  167. }
  168.  
  169. proc cf_librwdbobj {} {
  170.     set cxx_line "CXX =\t\t$cxx_def"
  171.     set cxx_patt {^CXX =.*$}
  172.     set incs_line "INCS =\t\t-I../../include -I$RWinc_def"
  173.     set incs_patt {^INCS =.*$}
  174.  
  175.     set cfg(cxx) [list $cxx_patt $cxx_line]
  176.     set cfg(incs) [list $incs_patt $incs_line]
  177.  
  178.         add_ranlib_config cfg
  179.     config_file [location src librwdbobj] Makefile cfg
  180.  
  181.         global target
  182.         $target::config
  183. }
  184.  
  185. #-------------------------------------------------------------------------------
  186.  
  187. # maketmpl needs:        c++ compiler
  188. #                c++ compiler debug flags
  189. #                Rogue Wave class library include
  190. #                Rogue Wave class library name
  191. #                Westmount class library include
  192. #                Westmount class library name
  193. #                DBObject library include
  194. #                DBObject library name
  195.  
  196. proc dfl_maketmpl {} {
  197.     global cxx_def
  198.     set cxx_def $default_cxx
  199.     global cxxdebug_def
  200.     set cxxdebug_def $default_cxxdebug
  201.  
  202.     global classinc_def
  203.     set classinc_def [location \
  204.         {~[[[ClientContext::global] currentConfig] path]} include]
  205.     global classlib_def
  206.     set classlib_def [location \
  207.         {~[[[ClientContext::global] currentConfig] path]} lib librw4omt.a]
  208.     global dbobjinc_def
  209.     set dbobjinc_def [location \
  210.         {~[[[ClientContext::global] currentConfig] path]} include]
  211.     global dbobjlib_def
  212.     set dbobjlib_def [location \
  213.         {~[[[ClientContext::global] currentConfig] path]} lib librwdbobj.a]
  214.     global RWinc_def
  215.     set RWinc_def $default_RWinc
  216.     global RWlib_def
  217.     set RWlib_def $default_RWlib
  218. }
  219.  
  220. proc cp_maketmpl {} {
  221.     m4copyfile etc maketmpl.maketmpl maketmpl
  222. }
  223.  
  224. proc cf_maketmpl {} {
  225.     set cxx_line "CXX =\t\t$cxx_def"
  226.     set cxx_patt {^CXX =.*$}
  227.     set cxxdebug_line "DEBUGFLAGS =\t$cxxdebug_def"
  228.     set cxxdebug_patt {^DEBUGFLAGS =.*$}
  229.     if {$classinc_def != $dbobjinc_def} {
  230.         set incs_line "INCS =\t\t-I$classinc_def -I$dbobjinc_def"
  231.     } else {
  232.         set incs_line "INCS =\t\t-I$classinc_def"
  233.     }
  234.     append incs_line " -I$RWinc_def"
  235.     set incs_patt {^INCS =.*$}
  236.     set classlib_line "CLASSLIB =\t$classlib_def $RWlib_def"
  237.     set classlib_patt {^CLASSLIB =.*$}
  238.     set dbobjlib_line "DBOBJLIB =\t$dbobjlib_def"
  239.     set dbobjlib_patt {^DBOBJLIB =.*$}
  240.  
  241.     set cfg(cxx) [list $cxx_patt $cxx_line]
  242.     set cfg(cxxdebug) [list $cxxdebug_patt $cxxdebug_line]
  243.     set cfg(incs) [list $incs_patt $incs_line]
  244.     set cfg(classlib) [list $classlib_patt $classlib_line]
  245.     set cfg(dbobjlib) [list $dbobjlib_patt $dbobjlib_line]
  246.  
  247.     config_file etc maketmpl.maketmpl cfg maketmpl
  248. }
  249.  
  250. #-------------------------------------------------------------------------------
  251.  
  252. proc dfl_cpp_config_tcl {} {
  253.     global templates_def
  254.     set templates_def $default_templates
  255. }
  256.  
  257. proc cp_cpp_config_tcl {} {
  258.     m4copyfile tcl cpp_config.tcl
  259. }
  260.  
  261. # cpp_config.tcl needs:        templates y/n
  262. #                 (is fixed 'y' on for this configuration)
  263.  
  264. proc cf_cpp_config_tcl {} {
  265.     set has_templates_line "set has_templates $templates_def"
  266.     set has_templates_patt {set has_templates .*$}
  267.     set cfg(templates) [list $has_templates_patt $has_templates_line]
  268.  
  269.     config_file tcl cpp_config.tcl cfg
  270. }
  271.  
  272.