Unnamed Fossil Project

Check-in [04d844dab4]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:remove old tmk
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:04d844dab425e907a5e3aae197ef9a2576d9fdcf
User & Date: pooryorick 2012-03-02 03:30:10
Context
2012-03-03
13:49
new tmk check-in: 7b94b12db5 user: pooryorick tags: trunk
2012-03-02
03:30
remove old tmk check-in: 04d844dab4 user: pooryorick tags: trunk
2012-03-01
12:29
added new tmk check-in: 3746bce196 user: pooryorick tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Deleted support/tmk/ChangeLog.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
2005-04-23  Hitoshi Yamauchi  <hitoshi@ytrium.mpii>

	* Put release version 1.0.1.

	* src/tmk, src/cmdline.tmk, src/module_config.tmk,
	config/soft/comp/gcc.tmk: Introduce `runmode' to tmk for building
	64 bit executable, switching gcc executable. 

	* translate CHANGES.LOG to ChangeLog according to CVS log.

	* There are a lot of changes so far, e.g., multi-thread (Stefan
	Brabec, Hendrik Lensch, ..), Darwin ports (Wolfgang Heidrich), and
	so forth. But I am sorry not to be able to find those information
	at CHANGES.LOG file. Please add some information in this file. 

2000-11-01 htschirm
	
	* added ::arch_name, removed DEFAULT_ARCH 

2000-10-23 htschirm

	* added module::DEFS (c/c++ -D options)

2000-10-17 htschirm
	
	* set_lazy now really usable, incl. override of lazy value

	* bugs fixed: module versioning and default versions

2000-10-16 htschirm

	* bugs fixed:
	  file name normalization (x/.., /./)
	  automatic lib names (base/util///)

2000-10-11 ag4-adm 

	* -DCOMP_ -DARCH_ now always completely uppercase
	
2000-08-30 htschirm 

	* The last line of the .libspec files was not correct in the previous tmk 
	  release. This bug has been fixed. However, this means that you should 
	  regenerate all .libspec files to make sure (e.g. by enforcing linking 
	  with -force).

	* Added the "noprefix" option to log_msg
	
2000-08-30 htschirm 

	* new "local_only" command: declares targets as local-only, so
	that when one of these targets is specified, no subdirectory
	processing will take place

	* introduced SUBDIR_PROCESSING variable that can either be
	"bottom-up" or "top-down" or "none". In the case of top-down,
	subdirectories are processed AFTER processing the local targets,
	for bottom-up the subdirectories are built first.


2000-08-04 ag4-adm

	* introduced link::exe_only: commands can be 'redirected' to only
	affect the library specification for the local executables, as
	opposed to both libraries and executables. This is implemented by
	'aliasing' the linker's LIBPATH, SYSLIBS, PROJLIBS, and OPTIONS
	variables to EXE_LIBPATH, EXE_PROJLIBS, .... Here is an example of
	how to use it:
	  #---------------------------------------------------------------------
	  # this affects local lib and executables
	  module {cxx math}

	  # only the application uses qt for testing, but it's not required for
	  #   using the local lib
	  exe_only {
	    module qt
	  }
	  #---------------------------------------------------------------------

	* ===========
	  tmk-0.9beta
	  ===========
	- first public release
	- modules now live in separate namespaces
	- redesign of c, cxx, and link modules
	- can choose among multiple compilers in TMakefile
	- each compiler has separate FLAGS for each language
	- can set the linker to any language/compiler separately
	- introduced abstract meta compiler options to render
	  some things more transparent
	- introduced EXE_PROJLIBS, EXE_LIBPATH, EXE_SYSLIBS, EXE_OPTIONS 
	  to allow specifying different libraries and options for the 
	  local executables as for the local library
	- introduced tmk-based 'transitive linking' (.libspec files)

	- new documentation on 'installing and configuring tmk'
	- updated tutorial

	*==================
	before tmk-0.9beta
	==================
	- in-house use only at the 'Max-Planck-Institut fuer Informatik'
	- in use for more than one year
	- 20-30 users in a LAN (IRIX + Linux + Windows)


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































Deleted support/tmk/IDEAS.txt.

1
2
3
4
5
6
7
8
9
10
11
- subdir-order umkehren (top-down / bottom up) per flag?

- libspec dependency checking ist zu langsam und redundant
  -> symbolische handles fuer libspec, und dann nur einmal fuer alle
     gleichen was checken!
- versioning ausprobieren!!!
- if [string match mpino* $HOST] ... in site-config.tmk

- wer setzt wann IPA fuer den Linker?!

- was ist das INIT-Skript?
<
<
<
<
<
<
<
<
<
<
<






















Deleted support/tmk/LICENSE.TXT.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
		    GNU GENERAL PUBLIC LICENSE
		       Version 2, June 1991

 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

			    Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.)  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

  The precise terms and conditions for copying, distribution and
modification follow.
 
		    GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term "modification".)  Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

  1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.

You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

  2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

    a) You must cause the modified files to carry prominent notices
    stating that you changed the files and the date of any change.

    b) You must cause any work that you distribute or publish, that in
    whole or in part contains or is derived from the Program or any
    part thereof, to be licensed as a whole at no charge to all third
    parties under the terms of this License.

    c) If the modified program normally reads commands interactively
    when run, you must cause it, when started running for such
    interactive use in the most ordinary way, to print or display an
    announcement including an appropriate copyright notice and a
    notice that there is no warranty (or else, saying that you provide
    a warranty) and that users may redistribute the program under
    these conditions, and telling the user how to view a copy of this
    License.  (Exception: if the Program itself is interactive but
    does not normally print such an announcement, your work based on
    the Program is not required to print an announcement.)
 
These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

    a) Accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of Sections
    1 and 2 above on a medium customarily used for software interchange; or,

    b) Accompany it with a written offer, valid for at least three
    years, to give any third party, for a charge no more than your
    cost of physically performing source distribution, a complete
    machine-readable copy of the corresponding source code, to be
    distributed under the terms of Sections 1 and 2 above on a medium
    customarily used for software interchange; or,

    c) Accompany it with the information you received as to the offer
    to distribute corresponding source code.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form with such
    an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
 
  4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

  5. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

  7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
 
  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.

  9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number.  If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.

  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

			    NO WARRANTY

  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

		     END OF TERMS AND CONDITIONS
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































































































































































































































































































































































Deleted support/tmk/Makefile.

1
2
3
4
5
6
.PHONY: all
all:
	src/tmk

%:
	src/tmk $@
<
<
<
<
<
<












Deleted support/tmk/README.INSTALL.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
1 Getting TMK Up and Running
----------------------------

(This document corresponds to Section 1 of the document "Configuring
 and Installing tmk", available from http://www.tmk-site.org/doc/)

This section briefly explains the steps that are needed to install TMK
from scratch and get the basic system running.

1.1 Unpack files from the archive
---------------------------------

When you obtain the TMK distribution from the TMK web site, it comes
as a packed archive file tmk-release-number.tar.gz. You have to extract
the files from these archives in some software package directory,
e.g. with the gunzip and tar tools on UNIX systems:

  gunzip tmk-release-number.tar.gz
  tar xvf tmk-release-number.tar

or programs like winzip on Windows systems (using its graphical user
interface). The extracted files will reside in a subdirectory called
tmk-release-number. The actual TMK system is located in
tmk-release-number/tmk. We will call this directory the TMK home
directory for now.


1.2 Install TCL
---------------

Next, you need to make sure that you have a reasonably new version of
TCL installed on your system. The current TMK release requires TCL
versions 8.x, since TMK relies on the namespace functionality and
operations such as file copy. You can obtain TCL for free from
http:://dev.scriptics.com. Usually, you should have a program called
tclsh in you path. You can find out its version by starting tclsh and
then typing

  info tclversion

You can leave the TCL shell again by typing exit. If the TCL shell
used for TMK is not the one in your system s search path, you can set
the environment variable TMK_TCLSH to the desired shell program, and
TMK will start using that shell.

1.3 Make TMK accessible
-----------------------

Next, you should include TMK's src subdirectory in the system's search
path (PATH environment variable), or create a symbolic link or alias
to the the actual executable. On UNIX systems, this is a TCL script
simply called tmk in the src subdirectory, while on Windows system
this script is invoked via a batch file called tmk.bat in the same
directory. Don't forget to type rehash if you are using csh or
tcsh. Furthermore, on Windows systems you must set the environment
variable TMK HOME to the absolute location (also including the drive
letter) of the TMK home directory, so that the batch file can find the
TCL script.

If it should happen that TMK cannot find its own location on UNIX
systems (e.g. it crashes inside the ::tmk::scriptname function), you
can also try to set the TMK_HOME environment variable manually. If
even this does not work, please report the problem via
www.tmk-site.org.

1.4 Site-Specific Configuration
-------------------------------

Now the basic TMK system should be ready to run. The only thing left
to do is con-figuring the different TMK modules you want to use,
mostly by specifying a number of site-dependent path names. Let s
start by typing

  tmk -sysinfo


Now TMK should display some information about the system it is running
on. Par-ticularly interesting items are the name of your machine
(HOST), the currently used network domain (DOMAIN), and the operating
system class (OSCLASS). If you re not in a network, the domain name
will be set to localdomain.

Now change to config/site in your TMK home directory. This is the
location where TMK tries to find site-specific configuration. On your
system, TMK will look for the following files, and read all existent
files in the specified order:

- site-config.tmk
- DOMAIN
- DOMAIN:OSCLASS
- HOST:DOMAIN
- HOST:DOMAIN:OSCLASS

where HOST, DOMAIN, and OSCLASS are again the placeholders for the
actual sys-tem information. So now you can create one or more of these
files in order to do the site-specific configuration for your machine
or all machines in your network. For example, if your machine is
called mymachine, and you are not connected to a network, you could
create the file

 mymachine:localdomain

e.g. by copying one of the example configuration files in the examples
subdirectory. The example files are named in such way that you can
guess for which kind of systems they are designed. Here is a small
part of such an example site config file for a Linux machine:

  # example from site config for a RedHat Linux system
  
  # specify include/lib path + lib names for X11
  config set x11::INCPATH /usr/X11R6/include
  config set x11::LIBPATH /usr/X11R6/lib
  config set x11::LIBS    {Xt Xi Xext Xmu X11} 
  
  # specify include/lib path + lib names for QT
  config set qt::INCPATH /usr/include/qt2
  config set qt::LIBPATH /usr/lib/qt2
  config set qt::LIBS    {qt}
  
  # on UNIX, for QT you also need X11
  config set qt::DEPEND  {x11}

As you can easily derive from this example, the main purpose of the
site-specific configuration is to specify the directory names, library
names, and similar things such as the executable files for some helper
programs. Just check if the paths in the example files match those on
your system, and modify them if necessary. If you want to know more
about the meaning of the config set command and the config variables
specified in the files, please refer to the later sections of this
document and other detailed documentation on TMK.

Of course you only need to configure those TMK modules that you intend
to use. You can simply comment out all other lines by preceeding them
with a hash character ('#').

After completing the site-specific configuration, just type

  tmk -reconfig

and TMK will read all the relevant config files and store the result
in its so-called config cache file for the current system. The name of
that file is also displayed after successful configuration.

1.5 Problems...?
----------------

After the steps described above, TMK should be ready to go. However,
there can always arise circumstances in which the described procedure
fails. If so, please consider looking at the frequently asked
questions (FAQ), and specifically the installation FAQ in the
documentation section of the TMK web pages (www.tmk-site.org), or
contact the TMK team.
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































































































Deleted support/tmk/TMakefile.

1
2
3
4
5
6
7
8
9
10
#! /bin/env tclsh

subdir [list tests] 

lappend PKGDATA config contrib modules tools
lappend PKGDATA {*}[glob -dir [file join $PROJDIR] -tails src/*.tmk]
lappend PKGDATA {*}[glob -dir [file join $PROJDIR] -tails src/*.msg]
lappend PKGDATA {*}[glob -dir [file join $PROJDIR] -tails src/*.msg]
lappend PKGDATA {*}[glob -dir [file join $PROJDIR] -tails *.tcl]
lappend PROGRAMS src/tmk src/tmk.bat src/cygtmk
<
<
<
<
<
<
<
<
<
<




















Deleted support/tmk/TMakefile.proj.

1
2
3
4
5
6
7
8
9
#! /bin/env tclsh

set_ifndef ::PACKAGE tmk
set_ifndef ::VERSION 1.0.1

config set ::ARCH build

module ac_env
module am
<
<
<
<
<
<
<
<
<


















Deleted support/tmk/TODO.txt.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
TODO:
-----

- FAQ: 'eval cmd ...' erklaeren, z.B. mit 'set v "-jdk /usr/blah"'

- init.tmk in soft/comp, COMPILERS init dahin verlegen!

- Kolja: es waere einfacher fuer den User, wenn tmk alle drei nehmen wuerde:::
  - cxx::FLAGS
  - cxx::MIPSPRO::FLAGS
  _ cxx::MIPSPRO::FLAGS_$CODELEVEL
  - evtl noch cxx::FLAGS_$CODELEVEL

- CYGWIN support wieder einbauen/fixen / pwd unter Windows anschauen

- DEFAULT_VERSION testen/fixen/dokumentieren; 

- module macro vars evtl. mit eval_later ausstatten?!

- env(HOME) unter Windows abfragen und dann nicht die Registry verwenden,
  sondern halt HOME/.tmk/cache (PrivDir setzen etc.)

- issue ptrace later if proc not defined

- mipspro: Pfadnamen mit nativename ...

- bc/vc reinhauen

- evtl. einen INCPATH fuer die Sprachmodule einfuehren? 
  (also dann auch automatisch file nativename benutzen)


TODO documentation
------------------

- compiler config
- local_only und SUBDIR_PROCESSING dokumentieren
- Modul-Versionen dokumentieren / Examples!
- LIB_ARCH() gibt's auch noch!
- tmk depend in tutorial dokumentieren?!

BUGS 
----

- dist geht unter Linux nicht richtig, weil -rpath den Vorzug vor 
  LD_LIBRARY_PATH hat. Ist das so? Warum ist das so? Kann man das umgehen?

- geht file nativename mit mehreren Filenamen (ich glaube nicht)???
  - e.g. wegen purify
 
- filename_*lib muss zwischen dir und tail unterscheiden, bevor es 
  einfach so einen prefix vor den Namen knallt

- unneccessary dependency: exe does not depend on ***shared*** lib
  - maybe compiler-dependent?!

- recursive module version loading uses wrong eval order
  (should eval top-down, not bottom-up)

- during link::exe_only, vtrace shows irritating results -> fix!

- tmk depend does not update the libspec file. (once wrong libspec is
  generated, only tmk clean can solve the problem.) 2005-11-25(Fri) 
  hitoshi

MAINTENANCE
-----------

- das Array-Zeugs aus den Modul-Makro-Vars rauswerfen


Solved?
-------

- DRINGEND eine einfache generische Compiler-Konfig (nur Flags) machen!
  
  Now environment to compiler-flag mapping is in
  config/soft/comp/gcc-*.  Is it enough? Hitoshi
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































Deleted support/tmk/config/arch/os/cygwin.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# ==========================================================================
# $Id: cygwin.tmk,v 1.3 2001/04/24 10:24:43 brabec Exp $
# architecture-dependent config for CygWin
# ==========================================================================
# $Log: cygwin.tmk,v $
# Revision 1.3  2001/04/24 10:24:43  brabec
# cygwin/vc port
#
# Revision 1.2  2000/08/10 15:05:42  htschirm
# Windows/cygwin port
#
# Revision 1.1  2000/08/01 14:45:49  htschirm
# new config tree structure
#
# Revision 1.3  2000/07/20 16:15:52  htschirm
# towards tmk release 0.9
#
# ==========================================================================

# list of available compilers, default compiler
config set cxx::COMPILERS {gcc vc}
config set cxx::COMPILER  vc
config set c::COMPILERS   {gcc vc}
config set c::COMPILER    vc

# standard GUI is not x11, but that of windows!
config set gui::DEPEND {win_gui}

# currently no config helpers
config set ::CONFIG_HELPERS {}

# ??? simulate pwd command (otherwise [pwd] will fail)
#config proc ::pwd {} { 
#    set _pwd [exec sh -c pwd]
#    if [regexp \^//\(\[a-z\]\) $_pwd dummy drive] {
#	return "${drive}:[string range $_pwd 3 end]"
#    } else {
#	return $_pwd
#    }
#}


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































Deleted support/tmk/config/arch/os/darwin.tmk.

1
2
3
4
5
6
7
8
9
10
config proc ::filename_shlib  { shortname } { return "lib${shortname}.dylib" }

# list of available compilers, and preferred default compiler
config set cxx::COMPILERS { gcc }
config set cxx::COMPILER  gcc
config set c::COMPILERS   { gcc }
config set c::COMPILER    gcc

# currently no config helpers
config set ::CONFIG_HELPERS {}
<
<
<
<
<
<
<
<
<
<




















Deleted support/tmk/config/arch/os/irix.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# ==========================================================================
# $Id: irix.tmk,v 1.2 2004/08/09 14:29:34 yamauchih Exp $
# architecture-dependent config for 32-bit IRIX 
# ==========================================================================
# $Log: irix.tmk,v $
# Revision 1.2  2004/08/09 14:29:34  yamauchih
# integrate duplicated codes in config/arch/os/linux.tmk and config/arch/sysinfo/unix.tmk
#
# Revision 1.1  2000/08/01 14:45:49  htschirm
# new config tree structure
#
# Revision 1.2  2000/07/20 16:15:52  htschirm
# towards tmk release 0.9
#
# ==========================================================================

assert { [string tolower $OS] eq "irix"] }
dbg_msg "reading [info script]." 1

# list of available C/C++ compilers, preferred default compiler
config set cxx::COMPILERS {mipspro gcc}
config set cxx::COMPILER  mipspro

config set c::COMPILERS   {mipspro gcc}
config set c::COMPILER    mipspro

# standard GUI on IRIX is x11
config set gui::DEPEND x11

# currently no config helpers
config set ::CONFIG_HELPERS {}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































Deleted support/tmk/config/arch/os/irix64.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# ==========================================================================
# $Id: irix64.tmk,v 1.1 2000/08/01 14:45:49 htschirm Exp $
# architecture-dependent config for 64-bit IRIX 
# ==========================================================================
# $Log: irix64.tmk,v $
# Revision 1.1  2000/08/01 14:45:49  htschirm
# new config tree structure
#
# Revision 1.2  2000/07/20 16:15:52  htschirm
# towards tmk release 0.9
#
# ==========================================================================

# list of available C/C++ compilers, preferred default compiler
config set cxx::COMPILERS {mipspro gcc}
config set cxx::COMPILER  mipspro

config set c::COMPILERS   {mipspro gcc}
config set c::COMPILER    mipspro

# standard GUI on IRIX is x11
config set gui::DEPEND x11

# currently no config helpers
config set ::CONFIG_HELPERS {}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































Deleted support/tmk/config/arch/os/linux.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# ==========================================================================
# $Id: linux.tmk,v 1.14 2008/04/21 12:04:07 cfuchs_sf Exp $
# architecture-dependent config for Linux
# ==========================================================================
# $Log: linux.tmk,v $
# Revision 1.14  2008/04/21 12:04:07  cfuchs_sf
# added cuda stuff
#
# Revision 1.13  2004/08/09 14:29:34  yamauchih
# integrate duplicated codes in config/arch/os/linux.tmk and config/arch/sysinfo/unix.tmk
#
# Revision 1.12  2004/08/08 18:20:03  yamauchih
# get distribution name based on lsb_release.
#
# Revision 1.11  2002/11/18 11:06:55  brabec
# *** empty log message ***
#
# Revision 1.10  2002/04/19 08:10:47  brabec
# added qt support for gcc3
#
# Revision 1.9  2001/10/31 18:56:10  ag4-adm
# added debug info about NVIDIA drivers
#
# Revision 1.8  2001/02/20 16:02:04  brabec
# added PGI compiler support (experimental)
#
# Revision 1.7  2001/01/22 10:23:10  botsch
# Mario ist doof
#
# Revision 1.6  2001/01/14 15:47:35  htschirm
# changes during Hartmut's stay at Phil's lab
#
# Revision 1.5  2000/11/01 15:32:47  htschirm
# added ::arch_name, removed DEFAULT_ARCH
#
# Revision 1.4  2000/09/26 09:20:41  brabec
# fixed linux graphics driver support
#
# Revision 1.3  2000/08/07 15:29:22  htschirm
# *** empty log message ***
#
# Revision 1.2  2000/08/01 14:53:08  htschirm
# SuSE
#
# Revision 1.1  2000/08/01 14:45:49  htschirm
# new config tree structure
#
# Revision 1.3  2000/07/20 16:55:07  brabec
# correct handling of DISTVER (added MAJORVER and MINORVER)
#
# Revision 1.2  2000/07/20 16:15:53  htschirm
# towards tmk release 0.9
#
# ==========================================================================

assert {![string compare $OS Linux]}
dbg_msg "reading [info script]." 1

# list of available compilers, and preferred default compiler
config set cxx::COMPILERS { gcc icc pgi nvcc }
config set cxx::COMPILER  gcc
config set c::COMPILERS   { gcc icc pgi nvcc }
config set c::COMPILER    gcc 

# standard GUI on Linux is x11
config set gui::DEPEND x11

# currently no config helpers
config set ::CONFIG_HELPERS {}

# find out which kind of Linux distribution we have here
config set LINUX_DIST unknown
config set LINUX_DISTVER {}

# ::DIST and ::DISTVER is set by <tmk>/config/arch/sysinfo/unix.tmk. 
# (which calls unix_linux_sysinfo.tmk)
if { [info exists ::DIST ] }    { 
    config set LINUX_DIST    $::DIST
} else {
    dbg_msg "DIST is not defined, forget to source tmk/config/arch/sysinfo/unix.tmk?"
}
if { [info exists ::DISTVER ] } { 
    config set LINUX_DISTVER $::DISTVER
}

# resolve major and minor version number 
if [regexp \(\[0-9\]+\)\.\(\[0-9\]+\) $LINUX_DISTVER allVer majVer minVer] {
    config set LINUX_DIST_MAJORVER $majVer
    config set LINUX_DIST_MINORVER $minVer
} else {
    config set LINUX_DIST_MAJORVER 0
    config set LINUX_DIST_MINORVER 0
}

config set ::FILECOMPRESSOR    ::compress_target_gzip
config set ::FILECOMPRESSOR_PRG gzip
config set ::FILECOMPRESSOR_ARGS -9

config proc ::compress_target_gzip { target } {
    global ::FILECOMPRESSOR_PRG
    global ::FILECOMPRESSOR_ARGS


    if { [info exists ::env(TMK_USE_COMPRESSION)] == 0 } {
	return
    }

    foreach i $target {
	puts "doing $i"
	if { [file extension $i] eq [::filename_obj {}] && \
		[file exists $i.gz] == 0 } {
	    set  size_old [file size $i]
	    set  oldtime [file mtime $i]
	    exec $::FILECOMPRESSOR_PRG $::FILECOMPRESSOR_ARGS -f $i
	    file mtime $i.gz $oldtime
	    set  size_new [file size $i.gz]
	    puts "compressed: $i ([format %2.1f [expr ($size_new * 100.0)/($size_old * 1.0)]] \%)"
	}
    }
}
    
# since different distributions use different glibc versions etc, 
#   use the distribution name for the output directory 
if {$LINUX_DIST ne "unknown"} {
    log_msg "using Linux distribution name for architecture directory" 

    config proc ::arch_name {codelevel} {
	if {($codelevel eq "dbg") || ($codelevel eq {})} {
	    set cl {}
	} else {
	    set cl _$codelevel
	}
	return ${::LINUX_DIST}${::LINUX_DISTVER}$cl
    }
}

config set LINUX_GRAPHICS unknown
# nVIDIA graphics drivers?
set has_nv_mod 0
catch { set has_nv_mod [expr [string first NVdriver [exec lsmod]] != -1]}
if $has_nv_mod {
    config set LINUX_GRAPHICS nvidia
    log_msg "found NVIDIA graphics module"
} else {
    log_msg "*** no NVIDIA graphics module found (see lsmod)!"
}

# SGI VPro for linux ?
set has_vpro_mod 0
catch { set has_vpro_mod [expr [string first sgivpro [exec lsmod]] != -1]}
if $has_vpro_mod {
    config set LINUX_GRAPHICS sgivpro
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































































Deleted support/tmk/config/arch/os/mswin.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# ==========================================================================
# $Id: mswin.tmk,v 1.3 2001/10/29 22:15:10 brabec Exp $
# architecture-dependent config for Linux
# ==========================================================================
# $Log: mswin.tmk,v $
# Revision 1.3  2001/10/29 22:15:10  brabec
# ready for Windows2000 and VisualC++
#
# Revision 1.2  2001/04/24 10:24:43  brabec
# cygwin/vc port
#
# Revision 1.1  2000/08/01 14:45:49  htschirm
# new config tree structure
#
# Revision 1.4  2000/07/20 16:15:53  htschirm
# towards tmk release 0.9
#
# ==========================================================================

# list of available compilers, default compiler
# vc -- Microsoft Visual C++
# bc -- Borland C/C++ (based on the free command line edition 5.5)
#       - skipped due to some problems . Stefan
config set cxx::COMPILERS {vc gcc}
config set cxx::COMPILER  vc

config set c::COMPILERS   {vc}
config set c::COMPILER    vc 

# what's the standard GUI on Windows called?
config set gui::DEPEND {win_gui}

# currently no config helpers
config set ::CONFIG_HELPERS {}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































Deleted support/tmk/config/arch/os/sunos.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# ==========================================================================
# $Id: sunos.tmk,v 1.1 2000/08/01 14:45:50 htschirm Exp $
# architecture-dependent config for SunOS
# ==========================================================================
# $Log: sunos.tmk,v $
# Revision 1.1  2000/08/01 14:45:50  htschirm
# new config tree structure
#
# Revision 1.3  2000/07/20 16:57:34  brabec
# added gui::DEPEND x11
#
# Revision 1.2  2000/07/20 16:15:53  htschirm
# towards tmk release 0.9
#
# ==========================================================================

# list of available compilers, default compiler
config set cxx::COMPILERS { gcc }
config set cxx::COMPILER  gcc
config set c::COMPILERS   { gcc }
config set c::COMPILER    gcc

# standard GUI on Sun is x11
config set gui::DEPEND {x11}

# currently no config helpers
config set ::CONFIG_HELPERS {}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































Deleted support/tmk/config/arch/osclass/macintosh.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# ===========================================================================
# $Id: macintosh.tmk,v 1.1 2000/08/01 14:45:50 htschirm Exp $
# standard configuration for all Macintosh systems
# ===========================================================================

config proc ::filename_lib    {shortname} {return "lib${shortname}.a"}
config proc ::filename_shlib  {shortname} {return "lib${shortname}.so"}
config proc ::filename_obj    {shortname} {return "${shortname}.o"}
config proc ::filename_shobj  {shortname} {return "${shortname}.so"}
config proc ::filename_exe    {shortname} {return "${shortname}"}

# ====================================================================
# determine directory for temporary system files
#   this is just stolen from unix -- how does it work for macintosh?
# ====================================================================

config set ::TMPDIR [file join ${::tmk::PrivDir} tmp]
foreach x {/usr/tmp /var/tmp /tmp} {
    if [file isdirectory $x] {
	config set ::TMPDIR $x 
	break
    }
}
if {![file exists $::TMPDIR]} {
    if {![catch {file mkdir -force $::TMPDIR} msg]} {
	dbg_msg "could not create temporary directory:\n  $msg"
    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































Deleted support/tmk/config/arch/osclass/unix.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# ===========================================================================
# $Id: unix.tmk,v 1.1 2000/08/01 14:45:50 htschirm Exp $
# standard configuration for all UNIX-like systems
# ===========================================================================

config proc ::filename_lib    {shortname} {return "lib${shortname}.a"}
config proc ::filename_shlib  {shortname} {return "lib${shortname}.so"}
config proc ::filename_shobj  {shortname} {return "${shortname}.so"}
config proc ::filename_obj    {shortname} {return "${shortname}.o"}
config proc ::filename_exe    {shortname} {return "${shortname}"}

# ====================================================================
# determine directory for temporary system files
# ====================================================================

config set ::TMPDIR [file join $::tmk::dir_priv tmp]
foreach x {/usr/tmp /var/tmp /tmp} {
    if [file isdirectory $x] {
	config set ::TMPDIR $x 
	break
    }
}
if {![file exists $::TMPDIR]} {
    if {![catch {file mkdir -force $::TMPDIR} msg]} {
	dbg_msg "could not create temporary directory:\n  $msg"
    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































Deleted support/tmk/config/arch/osclass/windows.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# ===========================================================================
# $Id: windows.tmk,v 1.3 2001/04/24 10:24:43 brabec Exp $
# standard configuration for Windows systems
# ===========================================================================

config proc ::filename_lib {shortname} {
    if [info exists ::cxx::COMPILER] {
	if {$::cxx::COMPILER eq "gcc"} {
	    return lib$shortname.a
	} 
    }
    if [info exists ::c::COMPILER] {
	if {$::c::COMPILER eq "gcc"} {
	    return lib$shortname.a
	} 
    }
    return $shortname.lib
}

config proc ::filename_shlib  {shortname} {return $shortname.dll}
config proc ::filename_obj    {shortname} {return $shortname.obj}
config proc ::filename_shobj  {shortname} {return $shortname.dll}
config proc ::filename_exe    {shortname} {return $shortname.exe}

# ====================================================================
# determine directory for temporary system files
# ====================================================================

config set ::TMPDIR [file join ${::tmk::dir_priv} tmp]
foreach x {c:\\temp c:\\tmp d:\\temp d:\\tmp} {
    if [file isdirectory $x] {
	config set ::TMPDIR $x 
	break
    }
}
if {![file exists $::TMPDIR]} {
    if {![catch {file mkdir -force $::TMPDIR} msg]} {
	dbg_msg "could not create temporary directory:\n  $msg"
    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Deleted support/tmk/config/arch/sysinfo.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#! /bin/env tclsh

# default - will be refined later 
set ::NRCPUS  1
set ::CPUFREQ "<unknown>"

set ::CPU     $::tcl_platform(machine)
set ::OSVER   $::tcl_platform(osVersion)

# the OS class is determined by Tcl
set ::OS      $::tcl_platform(os)
switch -glob -- $::OS {
    *CYGWIN* {
	::tmk::os_cygwin
    }
    *Windows* {
	set ::OS $STR_WINDOWS
    }
}
set ::OSCLASS $::tcl_platform(platform)
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































Deleted support/tmk/config/arch/sysinfo/macintosh.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# ===========================================================================
# $Id: macintosh.tmk,v 1.1 2000/08/01 14:45:51 htschirm Exp $
# get system information on a Macintosh system
# ===========================================================================
# $Log: macintosh.tmk,v $
# Revision 1.1  2000/08/01 14:45:51  htschirm
# new config tree structure
#
# Revision 1.1  2000/07/20 16:15:54  htschirm
# towards tmk release 0.9
#
# ===========================================================================

puts stderr "*** warning: the macintosh platform is not supported yet ***"

# just try the UNIX code ;-)
__source $tmk::dir_arch/sysinfo/unix.tmk
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































Deleted support/tmk/config/arch/sysinfo/unix.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# ===========================================================================
# $Id: unix.tmk,v 1.13 2006/11/26 21:17:22 yamauchih Exp $
# get system information on a UNIX-like system
# ===========================================================================
# $Log: unix.tmk,v $
# Revision 1.13  2006/11/26 21:17:22  yamauchih
# add Qt4 32bit entry
#
# Revision 1.12  2004/08/09 14:17:08  yamauchih
# separate system dependent sysinfo
#
# Revision 1.11  2003/02/14 22:17:49  brabec
# *** empty log message ***
#
# Revision 1.10  2003/02/14 16:18:07  brabec
# fixed P4 detection
#
# Revision 1.9  2002/11/18 11:06:55  brabec
# *** empty log message ***
#
# Revision 1.8  2001/12/04 15:20:51  brabec
# *** empty log message ***
#
# Revision 1.7  2001/10/29 23:38:44  brabec
# *** empty log message ***
#
# Revision 1.6  2001/05/09 13:50:31  brabec
# fixed cpu handling for irix
#
# Revision 1.5  2001/05/09 13:32:06  brabec
# fixed cpu handling for linux
#
# Revision 1.4  2001/05/09 13:18:42  brabec
# correct cpu names
#
# Revision 1.3  2001/02/20 16:02:28  brabec
# added ::NRCPUS and ::CPUFREQ
#
# Revision 1.2  2000/12/12 12:16:21  brabec
# added athlon support (experimental)
#
# Revision 1.1  2000/08/01 14:45:51  htschirm
# new config tree structure
#
# Revision 1.7  2000/07/20 16:15:55  htschirm
# towards tmk release 0.9
#
# Revision 1.6  2000/05/05 13:58:26  ag4-adm
# remove trailing domainname in hostname
#
# Revision 1.1  2000/01/24 18:03:21  brabec
# added sysinfo.tmk to util/unix and util/win
#
#=========================================================

# !!! these informations are always determined directly, and never read
#     from the config cache !!!

dbg_msg "reading [info script]." 1

# ====================================================================
# things that are already set by Tcl 
# ===================================================================

::tmk::osvers_posix

# --- old stuff, obsolete? ---
# get os/cpu stuff (using uname)
# set uname_s "unknown"
# catch {set uname_s [exec uname -s]}
# addAndSet OS      $uname_s
# addAndSet OSVER   [exec uname -r | cut -d \. -f 1,2]
# addAndSet OSCLASS "UNIX"
# addAndSet CPU    [exec uname -m]

# ====================================================================
# name of machine and network domain
# ===================================================================

::tmk::arch_domain_unix

if [catch {set tmpHost [exec hostname]}] {
    if [catch {set tmpHost $env(HOSTNAME)}] {
	if [catch {set tmpHost $env(HOST)}] {
	    set tmpHost localhost
	}
    }
}
# remove trailing domain name in hostname 
set tmpStr  .$::DOMAIN
regsub -all {\.} $tmpStr {\.} tmpStr
regsub $tmpStr\$ $tmpHost {} tmpHost
set ::HOST $tmpHost

# ====================================================================
# determine/refine vendor+cpu by some heuristics
# ====================================================================

set_ifndef ::VENDOR unknown

switch -glob [string tolower $OS] {
    irix*   {set ::VENDOR sgi; set ::CPU mips}
    *hp*ux* {set ::VENDOR hp}
}

switch -glob [string tolower $CPU] {
    intel {set ::VENDOR intel}
    i?86  {set ::VENDOR intel}
    x86*  {set ::VENDOR amd}
} 

# ============================================================
# find system dependent sysinfo 
# ============================================================
set ::DIST    UnknownDist
set ::DISTVER 1.0

# ::tmkdir is guaranteed in src/tmk file.
if {[string tolower $OS] eq "linux"} {
    source $::tmk::dir/config/arch/sysinfo/unix_linux_sysinfo.tmk
} elseif {[string tolower $OS] eq "irix"} {
    source $::tmk::dir/config/arch/sysinfo/unix_irix_sysinfo.tmk
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































Deleted support/tmk/config/arch/sysinfo/unix_irix_sysinfo.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# ===========================================================================
# $Id: unix_irix_sysinfo.tmk,v 1.1 2004/08/09 14:17:08 yamauchih Exp $
# get system information on a irix system
# ===========================================================================
# $Log: unix_irix_sysinfo.tmk,v $
# Revision 1.1  2004/08/09 14:17:08  yamauchih
# separate system dependent sysinfo
#
#=========================================================

# !!! these informations are always determined directly, and never read
#     from the config cache !!!

assert { [string tolower $::tcl_platform(os)] eq "irix" } 

dbg_msg "reading [info script]." 1

set ::DIST    sgi
set ::DISTVER 1.0

set _irixPlat {} 
catch { set _irixPlat [exec hinv -c processor] }
foreach _irixPlat [split $_irixPlat \n] {
    if [regexp {([0-9]+)\s([0-9]+)\sMHZ\sIP([0-9]+)} \
	    $_irixPlat _dummyMatch _numProc _MHZ _irixArch] {
	set ::NRCPUS $_numProc
	set ::CPUFREQ $_MHZ
    }
    if [regexp {^CPU: MIPS (.*) Processor} $_irixPlat _a _irixCpu] {
	set _irixCpu [string trim [string tolower $_irixCpu]]
	regsub {000$} $_irixCpu k _irixCpu
	set ::CPU $_irixCpu
    }
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































Deleted support/tmk/config/arch/sysinfo/unix_linux_sysinfo.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# ===========================================================================
# $Id: unix_linux_sysinfo.tmk,v 1.10 2008/10/24 07:25:52 cfuchs_sf Exp $
# get system information on a linux system
# ===========================================================================
# $Log: unix_linux_sysinfo.tmk,v $
# Revision 1.10  2008/10/24 07:25:52  cfuchs_sf
# added nvcc stuff
#
# Revision 1.9  2008/01/31 02:25:41  yamauchih
# Adapted openSuSE's release file format.
#
# Revision 1.8  2007/08/31 08:16:06  cfuchs_sf
# support for Debian 4.0 (Etch) at the MPI
#
# Revision 1.7  2005/10/21 10:58:00  yamauchih
# add Fedora distribution
#
# Revision 1.6  2005/06/30 22:12:05  yamauchih
# fix: SuSE 9.3 stupidly includes distributer name Linux with space in lsb_release.
#
# Revision 1.5  2005/04/23 20:53:58  yamauchih
# add runmode to build 64bit executables
#
# Revision 1.4  2004/09/30 18:24:23  yamauchih
# fix old redhat wrong ARCH
#
# Revision 1.3  2004/08/09 17:07:34  yamauchih
# *** empty log message ***
#
# Revision 1.2  2004/08/09 16:11:08  yamauchih
# fix non exist lsb_release
#
# Revision 1.1  2004/08/09 14:17:08  yamauchih
# separate system dependent sysinfo
#
#=========================================================

# !!! these informations are always determined directly, and never read
#     from the config cache !!!

assert {[string tolower $::tcl_platform(os)] eq "linux"}

dbg_msg "reading [info script]." 1

if {[catch {set tmp_lsb_release [exec which lsb_release]} ] == 0} {
    if {[ file exist $tmp_lsb_release ]} {
	dbg_msg "linux base standard command lsb_release is found." 1
	set ::DIST    [exec lsb_release -si ]
	# stupid novel SuSE. Distributer == SUSE LINUX. Why `Linux' is in the distributer name?
	# puts [ string trim ${::DIST} ]
	# puts [ string wordstart ${::DIST} end ]
	# puts [ string replace ${::DIST} [ string wordstart ${::DIST} end ] end ]
	set ::DIST    [regsub { [^ ].*} ${::DIST} {}]
	set ::DISTVER [exec lsb_release -sr ]
    } else {
	dbg_msg "which returns something but not correct??" 1
    }
}

# for Debian, remove the r? part from the Version (e.g. 4.0r0->4.0)
if {$::DIST eq "Debian"} {
    set ::DISTVER [regsub {r.*} ${::DISTVER} {}]
}

if {$::DIST eq "UnknownDist"} {
    dbg_msg "linux base standard command lsb_release is not found."
    if [file readable /etc/SuSE-release]   {
	set ::DIST    SuSE
	set ::DISTVER [lindex [exec grep VERSION /etc/SuSE-release] 2]
    }
    if [file readable /etc/redhat-release]   {
	set ::DIST    Redhat
	set ::DISTVER [lindex [exec cat /etc/redhat-release] 4]
    }
    if [file readable /etc/fedora-release]   {
	set ::DIST    RedhatFC
	set ::DISTVER [lindex [exec cat /etc/fedora-release] 3]
    }
    if [file readable /etc/mandrake-release] {
	set ::DIST    Mandrake
	set ::DISTVER [lindex [exec cat /etc/mandrake-release] 3]
    }
    if [file readable /etc/debian_version] {
	set ::DIST    Debian
	set ::DISTVER [lindex [exec cat /etc/debian_version] 0]
    }
}

if [file exists /proc/cpuinfo] {
    set ::NRCPUS 0
    set cpuinfo [split [exec cat /proc/cpuinfo] \n]
    foreach l $cpuinfo {
	if {[string range $l 0 9] eq "model name"} {
	    incr ::NRCPUS
	    if {$::NRCPUS == 1} {
		switch -regexp [string tolower $l] {
		    {.*pentium\(r\) 4 cpu} {set ::CPU pentium4}
		    .*intel.*xeon.*     {set ::CPU opteron}
		    .*pentium.*xeon.*   {set ::CPU pentium4}
		    ".*pentium.*iii .*" {set ::CPU pentium3}
		    ".*pentium.*ii .*"  {set ::CPU pentium2}
		    .*pentium.*         {set ::CPU pentium}
		    .*amd.*athlon.*     {set ::CPU athlon}
		    .*amd.*opteron.*    {set ::CPU opteron}
		    default             {set ::CPU ix86unknown}
		}
	    }
	} elseif {[string range $l 0 6] eq "cpu MHz"} {
	    set _l [split $l]
	    set ::CPUFREQ [lindex $_l end]
	}
    }
}

# ======================================================================
# determine/refine cpu info (nr of cpus in NRCPUS + frequency in CPUFREQ)
# ======================================================================
# nothing so far.
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































Deleted support/tmk/config/arch/sysinfo/windows.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# ===========================================================================
# $Id: windows.tmk,v 1.11 2001/11/22 12:47:49 brabec Exp $
# windows/cygwin configuration
# ===========================================================================
# $Log: windows.tmk,v $
# Revision 1.11  2001/11/22 12:47:49  brabec
# blablub VisualC++ changes
#
# Revision 1.10  2001/10/29 22:15:11  brabec
# ready for Windows2000 and VisualC++
#
# Revision 1.9  2001/05/18 09:58:46  brabec
# *** empty log message ***
#
# Revision 1.8  2001/05/09 13:32:06  brabec
# fixed cpu handling for linux
#
# Revision 1.7  2001/05/09 13:18:43  brabec
# correct cpu names
#
# Revision 1.6  2001/05/09 11:51:53  brabec
# *** empty log message ***
#
# Revision 1.5  2001/05/09 11:47:16  brabec
# fixed for WindowsME
#
# Revision 1.4  2001/04/24 10:24:43  brabec
# cygwin/vc port
#
# Revision 1.3  2000/10/12 07:24:10  htschirm
# adapted to Win NT4.0
#
# Revision 1.2  2000/08/10 15:05:43  htschirm
# Windows/cygwin port
#
# Revision 1.1  2000/08/01 14:45:51  htschirm
# new config tree structure
#
# ===========================================================================

# default - will be refined later 
set ::NRCPUS  1
set ::CPUFREQ <unknown>

# cygwin has very different file name conventions, so we need to overload
#   some Tcl 'file' subcommands
if $__IsCygwinSystem {

    # dispatch file commands to Tcl 'file' if there is no tmk implementation
    rename file ::tmk::tcl_file_cmd
    proc ::file args {
	set cmd [lindex $args 0]
	if {[info commands ::tmk::file__$cmd] != {}} {
	    return [eval ::tmk::file__$cmd [lrange $args 1 end]]
	} else {
	    return [eval ::tmk::tcl_file_cmd $args]
	}
    }

    # file pathtype: needs to handle //c, c:, and /cygdrive/c
    proc ::tmk::dummy_file__pathtype {path} {
	switch -glob $path {
	    {//[a-zA-Z]*} {return absolute}
	    {[a-zA-Z]:/*} {return absolute}
	    {/cygdrive/[a-z][A-Z]} {return absolute}
	    /* {return volumerelative}
	    default {return relative}
	}
    }

    # the native name should somehow replace all '/' by '\\'
    proc ::tmk::dummy_file__nativename {name} {
	switch -exact $::OSCLASS {
	    $::STR_WINDOWS {
		regsub -all {/} $name {\\} name
		return $name
	    } 
	    $STR_UNIX {return $name}
	    default {return $name}
	}
    }
} else {
    
    proc ::tmk::file__delete {args} {
	set tmp_args {}
	foreach i $args {
	    if [regexp ^\- $i] {
		continue;
	    }
	    if [file exists $i] {
		if [file isdirectory $i] {
		    regsub -all / $i \\ itmp
		    exec cmd {*}[list /C RMDIR /S /Q $itmp]
		} else {
		    regsub -all / $i \\ itmp
		    lappend tmp_args $itmp
		}
	    }
	}
	if [llength $tmp_args] {
	    set tmp_args [join $tmp_args { }]
	    exec cmd [list /C del /Q $tmp_args]
	}
    }
    
    # dispatch file commands to Tcl 'file' if there is no tmk implementation
    rename file ::tmk::tcl_file_cmd
    proc ::file args {
	set cmd [lindex $args 0]
	if {[info commands ::tmk::file__$cmd] != {}} {
	    return [eval ::tmk::file__$cmd [lrange $args 1 end]]
	} else {
	    return [eval ::tmk::tcl_file_cmd $args]
	}
    }
}

if $__IsCygwinSystem {
    ::tmk::arch_cygwin
} else {

    # =====================================
    # normal windows setup - using registry 
    # =====================================

    if [catch {package require registry}] {
	exit_msg "missing Tcl package 'registry' (please use a newer version of tclsh) !"
    }

    set key {HKEY_LOCAL_MACHINE\\System\\CurrentControlSet}

    set __hostNameKeys [list \
	    "${key}\\\\Control\\\\ComputerName\\\\ActiveComputerName ComputerName"  \
	    "${key}\\\\Services\\\\VxD\\\\MSTCP HostName" \
	    "${key}\\\\Control ComputerName"  \
	    "${key}\\\\Control\\\\ComputerName ComputerName"  \
	    "${key}\\\\Control\\\\ComputerName\\\\ComputerName ComputerName"  \
	    "${key}\\\\Services\\\\VxD\\\\VNETSUP ComputerName" ]
 	
 
    # try to figure out the name of this machine
    set ::HOST unknown
    foreach i $__hostNameKeys {
	set key [lindex $i 0]
	set val [lindex $i 1]
	
	if {![catch {set ::HOST [string tolower [registry get $key $val]]}]} {
	    break
	}
    }
 
    set key {HKEY_LOCAL_MACHINE\\System\\CurrentControlSet}
    set __domainNameKeys [list \
	    "${key}\\\\Services\\\\Tcpip\\\\Parameters Domain" \
	    "${key}\\\\Services\\\\VxD\\\\MSTCP Domain" ]
    # get domainname 
    set ::DOMAIN localdomain
    foreach i $__domainNameKeys {
	set key [lindex $i 0]
	set val [lindex $i 1]
	if {![catch {set ::DOMAIN [string tolower [registry get $key $val]]}]} {
	    break
	}
    }

    # get CPU info
    set __cpuCentralKey "HKEY_LOCAL_MACHINE\\Hardware\\Description\\System\\CentralProcessor"
    set __cpuKeys [registry keys $__cpuCentralKey]

    # get first CPU (multi-processor stuff not yet implemented)
    set __cpu unknowncpu
    if {[llength $__cpuKeys] > 0} {
	set __cpuName [string tolower \
			   [registry get $__cpuCentralKey\\[lindex $__cpuKeys 0] Identifier]]
	
	switch -regexp $__cpuName {
	    {.*family 6.*}      {set ::CPU pentium3}
	    {.*pentium.*III .*} {set ::CPU pentium3}
	    {.*pentium.*II .*}  {set ::CPU pentium2}
	    {.*pentium.*}       {set ::CPU pentium}
	    {.*amd.*athlon.*}   {set ::CPU athlon}
	    default             {set ::CPU ix86}
	} 

    }
    
    set ::VENDOR pc

    # get OS info
    set key HKEY_LOCAL_MACHINE\\Software\\Microsoft
    set ntkeys {}
    catch {set ntkeys [registry keys "$key\\Windows NT"]} 
    if {$ntkeys != {}} {
	set key HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion
	set __windowsVersion NT[registry get $key CurrentVersion]
    } else {
	set key HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion
	set __windowsVersion [registry get $key Version] 
    }

    switch $::OS {
	$::STR_CYGWIN {
	    ::tmk::osvers_posix
	}
	$::STR_WINDOWS {
	    switch -glob $__windowsVersion {
		*98 {set ::OSVER 98} 
		*95 {set ::OSVER 95} 
		NT5* {set ::OSVER 2K}
		NT* {set ::OSVER $__windowsVersion} 
		default {set ::OSVER unknown}
	    }
	}
    }
} 

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































































































































































































































Deleted support/tmk/config/arch/util/mkdep.exe.

cannot compute difference between binary files

Deleted support/tmk/config/arch/util/msstrings.exe.

cannot compute difference between binary files

Deleted support/tmk/config/arch/util/xmkmf.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# ===========================================================================
# dump system information using 'xmkmf' 
# ===========================================================================

# currently out of order
dbg_msg "xmkmf.tmk skipped - currently out of order"
return

# this function tries to dump system information
# using xmkmf/imake , which is installed on nearly all (?) X11 machines
# on success, the array 'arrayname' holds a number of (key,value) pairs.
# example:
# tclsh> dumpSystemInformation_XMKMF xyz
# tclsh> puts $xyz(XTOOLLIB) 
#  -lXt -lSM -lICE
# tclsh> puts $xyz(YACC)
#  bison -y
proc dumpSystemInformation_XMKMF {arrayname} {
    upvar \#0 $arrayname allvars
    global TMPDIR

    
    if [catch {set xmkmfbin [exec which xmkmf]}] {
	__Dbg "no 'xmkmf' found (non-X11 system ?)"
	puts $xmkmfbin
	return 0
    }

    if [catch {set mypid [exec sh -c "echo $$"]}] {
	set mypid ___
    }
    set prefix XMKMF${mypid}_
    set prefix_len [string length $prefix]

    set tmpdir ${TMPDIR}/.::tmk::_xmkmf_$mypid

    # create dir in /tmp to dump output 
    catch {exec rm -fr $tmpdir}
    if [catch {exec mkdir $tmpdir}] {
	__Dbg "cannot create tmpdir $tmpdir"
	return 0
    }
    set outf [open $tmpdir/config.tcl w]
    set vars [genConfigFile_XMKMF $prefix $outf $tmpdir]
    close $outf
    if {[llength $vars] == 0} {
	catch {exec rm -fr $tmpdir}
	return 0
    } 
 
    source $tmpdir/config.tcl
    catch {exec rm -fr $tmpdir}

    # filter out 'unset' or 'duplicated' vars...
    set pre {}
    foreach var $vars {
	if {$var ne $pre} {
	    set pre $var
	    eval set val $$var
	    if {$val ne {}} {
		set allvars([string range $var $prefix_len end]) $val
	    }
	}
    }
    return 1
}



# prefix: the leading part for every variable generated
#         e.g. if prefix is 'MK_' we get names like 'MK_CC'
# out:    out-file (descriptor, not name)
# tmpdir: tmp-dir used for 'xmkmf' (e.g. /usr/tmp or $ARCH/)
proc genConfigFile_XMKMF {prefix out tmpdir} {
    
    set allvars {}

    if [catch {exec touch $tmpdir/Imakefile}] {
	__Dbg "cannot create Imakefile in $tmpdir"
	return {}
    }

    set shcmd "(cd $tmpdir ; [exec which xmkmf] )"
    catch {exec sh -c $shcmd}

    if {[catch {set mf [exec cat $tmpdir/Makefile ]}]} {
	__Dbg "missing xmkmf output (failed)"
	return {}
    }

    # process each line separately 
    set txt [split $mf \n]
    # join lines separeted by '\'
    set newtxt {}
    set actline {}
    foreach line $txt {
	set l [expr [string length $line] - 1]
	set c [string range $line $l end]
	if {$c == \\} {
	    set actline "$actline [string range $line 0 [expr $l - 1]]"
	} else {
	    append actline $line
	    lappend newtxt $actline
	    set actline {}
	}
    }
    set mf [join $newtxt \n]

    # strip comments...
    regsub -all ^# $mf {} mf
    puts $out "set _${prefix}unknownVar -2"
    puts $out "set _${prefix}knownVar -2"
    puts $out "set _${prefix}unknownVar_Old -1"
    puts $out "set _${prefix}knownVar_Old -1"

    puts $out "while {(\$_${prefix}unknownVar ne \$_${prefix}unknownVar_Old) || (\$_${prefix}knownVar ne \$_${prefix}knownVar_Old)} {"
    puts $out "  set _${prefix}unknownVar_Old \$_${prefix}unknownVar"
    puts $out "  set _${prefix}knownVar_Old \$_${prefix}knownVar"
    puts $out "  set _${prefix}unknownVar 0"
    puts $out "  set _${prefix}knownVar 0"

    regsub -all {\\\n} $mf { } mf
    set mf [split $mf \n]

    foreach i $mf {
	if {[regexp {[A-Z]+ = .*} $i j]} {
	    # reduce whitespace
	    regsub -all {[ 	\n]+} $j { } j
	    regsub -all {^[ ]+} $j {} j
	    # regsub -all {=[ ]+} $j {} j
	    set d [split $j =]
	    if {[llength $d] == 2} {
		set lvalue [lindex $d 0]
		set rvalue [lindex $d 1]
		
		regsub -all {^[ ]+} $lvalue {} lvalue
		regsub -all {[ ]+$} $lvalue {} lvalue
		regsub -all {^[ ]+} $rvalue {} rvalue
		regsub -all {[ ]+$} $rvalue {} rvalue
		regsub -all {\$\$([A-Z0-9_]+)} $rvalue {$(\1)} rvalue
		
		set varRefs [extractVars_XMKMF $rvalue]
		foreach v $varRefs {
		    puts $out "  if {!\[info exists ${prefix}$v\]} {"
		    puts $out "      incr _${prefix}unknownVar"
		    puts $out "      set ${prefix}$v \"\" } else {"
		    puts $out "      incr _${prefix}knownVar }"
		}
		regsub -all {\$\(} $rvalue "$\{${prefix}" rvalue

		regsub -all {\)}   $rvalue "\}" rvalue
		
		puts $out "  set ${prefix}$lvalue \"$rvalue\""
		lappend allvars "${prefix}$lvalue"
		
		if {[llength $varRefs] > 1} {
		    puts $out "  regsub -all \"^\\\[ \\\]+\" \$${prefix}$lvalue \"\" ${prefix}$lvalue"
		    puts $out "  regsub -all \"\\\[ \\\]+\" \$${prefix}$lvalue \" \" ${prefix}$lvalue"
		}
	    }
	}
    }

    puts $out }
    return [lsort $allvars]
}

# extract variables: 
# ------------------
# if 'str' is something like "$(INCLUDES) $(TOP_INCLUDES)"
# the result will (or should :-) be a tcl-list like 
# { INCLUDES TOP_INCLUDES }
proc extractVars_XMKMF str {

    if [regexp {\$\(([A-Z0-9_]+)\)} $str m] {
	regsub {\$\(([A-Z0-9_]+)\)} $str {} str
	regsub {\$\(} $m {} m
	regsub {\)} $m {} m
	return [list {*}[extractVars_XMKMF $str] $m]
    } else {
	if [regexp {\$([A-Z0-9_]+)} $str m] {
	    regsub  {\$([A-Z0-9_]+)} $str {} str
	    set m [string range $m 1 end]
	    if {$m ne {}} {
		return [list {*}[extractVars_XMKMF $str] $m]
	    }
	}
    }
    return {}
}


proc getValueFromKey {array_name key} {
    upvar \#0 $array_name an
    set val {}
    catch {set val $an($key)}
    return $val
}

proc dumpArray {array_name} {
    upvar \#0 $array_name an
    set names [array names an]
    puts ...
    foreach i $names {
	set val [getValueFromKey $array_name $i]
	puts "$i = $val"
    }
}

set res [dumpSystemInformation_XMKMF xmkmf_array]]

if {$res == 0} {
    __Dbg "config: 'xmkmf.tmk' failed !"
} else {

    set xvars {PROJECTROOT YACC MV TROFF GZIPCMD INSTALL RM
	    LATEX NROFF TAGS LINT MAKE LEX DVIPS DEPEND CXXFILT LN }
    
    foreach i $xvars {
	set tmp [getValueFromKey xmkmf_array $i]
	if {$tmp ne {}} {
	    addAndSet $i $tmp
	}
    }
}


	

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































Deleted support/tmk/config/config.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# ===========================================================================
# tmk: config.tmk
#
# Copyright (C) 1999-2005  Hartmut Schirmacher, Stefan Brabec
#                          Hitoshi Yamauchi
#                          Max-Planck Institute f"ur Informatik
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program (LICENSE.TXT); if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# ===========================================================================
# $Id: config.tmk,v 1.51 2007/10/25 12:57:28 cfuchs_sf Exp $
# configuration system's main script
# ===========================================================================
# $Log: config.tmk,v $
# Revision 1.51  2007/10/25 12:57:28  cfuchs_sf
# added support for 64-bit ag4 machines and the new ix64
#
# Revision 1.50  2005/04/23 23:25:38  yamauchih
# add runmode +folloegccname
#
# Revision 1.49  2005/04/23 20:53:57  yamauchih
# add runmode to build 64bit executables
#
# Revision 1.48  2002/11/18 11:06:54  brabec
# *** empty log message ***
#
# Revision 1.47  2001/11/01 16:45:51  ag4-adm
# now also works for non-valid file names or directories
#
# Revision 1.46  2001/10/29 22:15:10  brabec
# ready for Windows2000 and VisualC++
#
# Revision 1.45  2000/11/01 15:32:47  htschirm
# added ::arch_name, removed DEFAULT_ARCH
#
# Revision 1.44  2000/08/10 15:05:42  htschirm
# Windows/cygwin port
#
# Revision 1.43  2000/08/10 08:39:48  htschirm
# Windows file name port
#
# Revision 1.42  2000/08/08 11:38:30  ag4-adm
# *** empty log message ***
#
#
# Revision 1.34  2000/05/08 09:33:22  ag4-adm
# changed site-config handling: reading global, then private
#
# Revision 1.33  2000/05/05 14:09:57  ag4-adm
# private site-config files
# ===========================================================================

# config directory structure
set ::tmk::dir_arch     [file join ${::tmk::dir_config} "arch"]
set ::tmk::dir_site     [file join ${::tmk::dir_config} "site"]
set ::tmk::dir_privsite [file join ${::tmk::dir_priv}   "site-config"]
set ::tmk::dir_soft     [file join ${::tmk::dir_config} "soft"]
set ::tmk::dir_comp     [file join ${::tmk::dir_soft}   "comp"]
set ::tmk::dir_util     [file join ${::tmk::dir_config} "util"]

# don't print the whole path ...
proc ::tmk::ConfigLog {msg} {
    global ::tmk::dir_config 
    set tmp  [file normalize "${::tmk::dir_config}"]
	 #this was a bug on OS X, where $tmp contained crazy characters
    #regsub $tmp $msg "<tmk>/config" msg
	 set msg [string map [list $tmp "<tmk>/config"] $msg]
#    set first [string first $tmp $msg]
#    if { $first != -1 } {
#	set head "[string range $msg 0 [expr $first - 1]]config"
#	set tail "[string range $msg [expr [string length $tmp] + $first] end]"
#	set msg "$head$tail"
#    }
    log_msg $msg
}

# execute config file
proc ::tmk::DoConfig {f {mod {}} } {

    set mod [string tolower $mod]
    if {$mod != {}} {set mod " (in namespace $mod)"} 
    global ::CONFIG_FAILED
    set_ifndef ::CONFIG_FAILED 0
    set dir [file dirname $f]
    set file [string tolower [file tail $f]]
    set f [file join $dir $file]
    if { [file readable $f ] && [file isfile $f] } {
	::tmk::ConfigLog "*** reading: $f$mod"
	uplevel 1 [list source $f]
    } else {
	::tmk::ConfigLog " (not found: $f)"
    }

    return $::CONFIG_FAILED
}

#=========================================================
# get system type: cpu, vendor and os (global variables)
#=========================================================
proc ::tmk::getSystemInformation {} {
    uplevel \#0 [list __source [file join $::tmk::dir_arch sysinfo.tmk]]

    # execute OSCLASS-dependent sysinfo script
    set file [file join "${::tmk::dir_arch}" sysinfo $::OSCLASS.tmk]
    uplevel \#0 [list __source $file]
}

# load config management methods
__source [file join $::tmk::dir_src module_config.tmk]
set ::tmk::dir_cache [config dir]

# default procedure for setting the ARCH variable, depending on 
#   some user- and system-dependent settings
config proc ::arch_name {codelevel} {
    if {($codelevel eq "dbg") || ($codelevel eq {})} {
	set cl {}
    } else {
	set cl "_$codelevel"
    }
    return "${::OS}${::OSVER}$cl"
}

# ==================================================================
# config starts here; execute in config cache namespace
# ==================================================================
# this has to be done every time - the cache file name depends on it
::tmk::getSystemInformation

# only output user info?
if $__SysInfoOnly {
    config read
    set txt {}
    read_file [file join $::tmk::dir_src sysinfo.msg] txt
    set cache_file [config name]
    set ARCH_DEF [::arch_name ""]
    puts stdout [subst -nocommands $txt]
    exit
}

# read cached config
if {![config read]} {

    # cache read failed, so parse all config files and create cache 
    ::tmk::ConfigLog "starting configuration"
    ::tmk::ConfigLog "system: $::CPU $::VENDOR $::OS $::OSVER $::HOST $::DOMAIN"
    
    # =================================================================
    # process config files in proper order
    # =================================================================

    # the directories
    set arch ${::tmk::dir_arch}
    set util ${::tmk::dir_soft}
    set comp [file join ${::tmk::dir_soft} comp]
    set util ${::tmk::dir_util}
    set site ${::tmk::dir_site}
    set priv_site ${::tmk::dir_privsite}
    set files {}

    # arch-dependent config files
    ::tmk::DoConfig [file join $arch default.tmk]
    ::tmk::DoConfig [file join $arch osclass ${::OSCLASS}.tmk]
    ::tmk::DoConfig [file join $arch os ${::OS}.tmk]
    ::tmk::DoConfig [file join $arch os ${::VENDOR}_${::OS}.tmk]
    ::tmk::DoConfig [file join $arch os ${::CPU}_${::VENDOR}_${::OS}.tmk]

    # arch-dependent utility config files
    dbg_msg "config helpers: $::CONFIG_HELPERS"
    foreach u $::CONFIG_HELPERS {
	::tmk::DoConfig [file join $util $u.tmk]
    }

    # look for all compilers in all modules
    set all_compiler_vars [config vars *::COMPILERS]
    dbg_msg "all compiler lists: \[$all_compiler_vars\]"
    foreach var $all_compiler_vars {
	set __module   [string range [namespace qualifiers $var] 2 end]
	eval foreach __compiler \$$var {{
	    # the compiler config file is read multiple times in different
	    # namespaces; so you can use $__compiler and $__module 
	    dbg_msg "configuring $__compiler for module $__module"
	    set ns [string tolower "::${__module}::$__compiler"]
	    set file [file join $comp $__compiler.tmk] 
	    namespace eval $ns [list ::tmk::DoConfig $file $ns]
        }}
    }

    # central and private site-config files 
    set addressmode [::tmk::get_runmodestat "addressmode" ]
    ::tmk::DoConfig [file join $site      site-config.tmk ]	
    ::tmk::DoConfig [file join $priv_site site-config.tmk ]	
    ::tmk::DoConfig [file join $site      site-config-${addressmode}.tmk ]	
    ::tmk::DoConfig [file join $priv_site site-config.tmk ]	
    ::tmk::DoConfig [file join $priv_site site-config-${addressmode}.tmk ]	
    set _site_config_list "${DOMAIN}          
                           ${DOMAIN}_${OSCLASS}          
                           ${HOST}
                           ${HOST}_${OSCLASS} 
                           ${HOST}_${DOMAIN} 
                           ${HOST}_${DOMAIN}_${OSCLASS}"
    foreach conf " $_site_config_list " {
	::tmk::DoConfig [file join $site      ${conf} ]	
	::tmk::DoConfig [file join $site      ${conf}_${addressmode} ]	
	::tmk::DoConfig [file join $priv_site ${conf} ]	
	::tmk::DoConfig [file join $priv_site ${conf}_${addressmode} ]	
    }

    # save all settings
    ::tmk::ConfigLog "writing [config fullname]"
    config save

    # if user specified -reconfig, don't go any further 
    if $__ForceReconfig {
	log_msg "configuration finished successfully."
	exit 0
    } 
    
    # if we want to continue, let's now read/activate the cached config
    if {![config read]} {
	exit_msg "could not read [config fullname]"
    }
}

# run init script
#set initScripts [list \
#    ${::tmk::dir_cache}/init.tmk \
#    ${::tmk::ArchConfigUtilDir}/init.tmk ]
#
#foreach f $initScripts {
#    if [file readable $f] {
#	dbg_msg "running init script $f"
#	uplevel \#0 [list source $initScript]
#	break
#    }
#}

# if ARCH is not already defined, use DEFAULT_ARCH and append CODELEVEL with runmode
ifdef ARCH {
    dbg_msg "\$ARCH already defined within config system."
} {
    set ARCH [::arch_name $CODELEVEL]

    set addressmode [::tmk::get_runmodestat "addressmode" ]
    # 64bit
    if {[regexp {Debian4\.0.*} $ARCH]} {
	set DEBCPU [exec dpkg-architecture -qDEB_BUILD_GNU_CPU]
	if {$DEBCPU eq "x86_64"} {
		set addressmode "64bit"
	}
    }
      
    if { $addressmode eq "64bit" } {
	append ARCH "_${addressmode}"
    }

    # use gcc version name with ARCH?
    set archmode [::tmk::get_runmodestat "archmode" ]
    if { $archmode eq "+gccver" } { 
	# force to add version name 
	append ARCH "_gcc$::cxx::gcc::DUMPVERSION"
    } elseif { $archmode eq "+followgccname" } { 
	# if gcc executable is explicitly specified, add gcc version name 
	if {[::tmk::get_runmodestat "gccexename" ] != "default" } {
	    append ARCH "_gcc$::cxx::gcc::DUMPVERSION"
	}
    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































































































































































































































































Deleted support/tmk/config/rebuild_cache.

1
2
3
4
5
6
7
8
9
10
11
The modification time of this file is used to compare the
age of the user's config cache with the date of the latest
central config change.

So if you want that all users' config cache files are 
updated, simply do a 'touch rebuild_cache' in this 
directory. When a user invokes tmk the next time, the
config cache will be rebuilt (automatic -reconfig).

2006-11-26: Qt4 port

<
<
<
<
<
<
<
<
<
<
<






















Deleted support/tmk/config/site/README.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

README for site configuration directory.

		2004-5-19(Wed) Yamauchi Hitoshi@MPII

Here (tmk/config/site/), there are some site-config samples.
These files are used for generating ~/.tmk/cache/config-* files.

The effective files (site-config file) are:

	 /usr/lib/tmk/config/site/site-config.tmk
	 /usr/lib/tmk/config/site/${DOMAIN} 

tmk -sysinfo tells you what is the ${DOMAIN}.


1. For domain wide administrator.
--------------------------------

When you install some softwares and teach them to tmk, you might
change a site-config file.

The effect of change is to all users in the domain except one who uses
personal setting file (see the next section).


2.For personal user.
--------------------------------

You can directory change your site-config file as a domain wide
administrator does. (If you have the root password.)

Otherwise, as one usual user, you can copy the site-config file to
$HOME/.tmk/site-config/site-config.tmk . And change it.

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































Deleted support/tmk/config/site/ag4.mpi-sb.mpg.de.

1
2
# use the same settings as for mpi-sb.mpg.de
source ${tmk::dir_site}/mpi-sb.mpg.de
<
<




Deleted support/tmk/config/site/computer.graphics.nis.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# where to find the centrally compiled shared projects
config set PROJ_LOCATIONS [list /proj/mpi/shared_proj]

# skip GMU/f2c
config set ::MAKE_NO_F2C 1

# this is a pseudo module that will load the actual windowing system
namespace eval gui {
  config set DEPEND x11
}

namespace eval x11 {
  config set LIBS {Xext Xmu Xt Xi X11}
  config set INCPATH /usr/X11R6/include
  config set LIBPATH /usr/X11R6/lib
}

namespace eval opengl {
  config set DEPEND x11
  config set LIBS {GL GLU}
}

namespace eval glut {
  config set DEPEND opengl
  config set LIBS {glut}
}

namespace eval math {
  config set LIBS {m}
}

# thread library
namespace eval pthread {
    config set LIBS {pthread}
}

# misc
config set zlib::LIBS z
config set tiff::LIBS tiff
config set png::LIBS  png



# find all installed qt and qgl versions; always use multi-threaded lib
foreach x [glob /soft/common/software/qt-*] {
  set version [string range [file tail $x] 3 end]
  config set ::qt::${version}::DIR $x
  if [file exists $x/lib/libqt-mt.so] {
	config set ::qt::${version}::LIBS {qt-mt}
  } else {
	config set ::qt::${version}::LIBS {qt}
  }
  config set ::qgl::${version}::DEPEND [list qt::$version opengl]
}

# old qt had its own qgl library
config set qgl::2.00::LIBS {qgl}
# default versions
config set qt::DEFAULT_VERSION 2.2.2
config set qgl::DEFAULT_VERSION 2.2.2
# sometimes 'qt-mt' is requested explicitly
set qtd qt::${qt::DEFAULT_VERSION}::DIR
eval config set qt::mt::DIR \$\{$qtd\}
config set qt::mt::LIBS {qt-mt}
# define clean namespace to avoid naming conflicts
config set qt::DEFS {QT_CLEAN_NAMESPACE}

# stable version of firewire lib l1394
namespace eval l1394 {
    config set INCPATH /home/repplix/include/stable/
    config set LIBPATH /home/repplix/lib
    config set LIBS    {l1394_stable raw1394}
    config set DEPEND  {pthread}

    namespace eval 08 {
	config set INCPATH {/proj/mpi/l1394_image08/l1394 /proj/mpi}
	config set LIBPATH {/proj/mpi/l1394_image08/l1394 /proj/mpi/libraw1394}
	config set LIBS    {l1394 raw1394}
	config set DEPEND  {x11 pthread}
    }
}

# Intel's image processing library
namespace eval ipl {
    config set INCPATH /soft/common/software/ImageProcessingLib/include
    config set LIBPATH /soft/common/software/ImageProcessingLib/lib
    config set LIBS    {ipla6}
    # also available: iplm6 and iplpx
}

# Intel's open source computer vision library
namespace eval opencv {
    config set INCPATH /soft/common/software/OpenCV/include
    config set LIBPATH /soft/common/software/OpenCV/lib
    config set LIBS    {opencv}
    config set DEPEND  {ipl}

}

# vector + matrix library meschach
namespace eval meschach {
    config set INCPATH /proj/mpi/pckg/meschach
    config set LIBPATH /proj/mpi/pckg/meschach/Debian2.2_max
    config set LIBS    {meschach}
}


# don't use glx in Marc's programs
config set APP_NO_GLX 1

# always use thread support in multi-processor Linux environment
config set ::USE_PTHREADS 1


# Ingo's pgcc compiler
config set cxx::pgcc::EXECUTABLE /home/wald/pub/usr/local/pgcc/bin/g++ 
config set cxx::pgcc::AR         /home/wald/pub/usr/local/pgcc/bin/ar
config set env(PATH) $env(PATH):/home/wald/pub/usr/local/pgcc/lib/gcc-lib/i686-pc-linux-gnu/pgcc-2.95.2



# assembly language compiler
config set asm::ASM /proj/mpi/pckg/nasm-0.98/nasm
config set asm::FLAGS -felf
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































Deleted support/tmk/config/site/cs.ubc.ca.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# -*-Mode: tcl -*-
# site config file, UBC, Imager

# directories in which tmk should NOT check dependencies
config set DEPEND_EXCLUDE {
    /usr/include/* 
    /opt/* 
    /usr/*
    /CYGWIN-B20/*
    /cygwin-b20/*
    /CYGWIN/*  
}

# we use the C++ standard library in our projects 
# (e.g. MIPSpro needs to be configured for that!)
foreach x {cxx::OPTIONS c::OPTIONS link::OPTIONS} {
    config variable $x
    lappend $x std
}

# --------------------------------------------------------------
# where are software packages located?
# special configuration for our test-linux boxes / laptops
# --------------------------------------------------------------

set pckg /cs/public/lib/pkg/
set pckg_generic /cs/public/generic/lib/pkg/

set pckg_windows P:/pkg

# this is only temporary for packages not yet installed department wide
set pckg_wh	/imager/people/heidrich


# lex and yacc location for windows
if {$OSCLASS eq $STR_WINDOWS} {
    config set ::yacc::YACC         $pckg_windows/bison/bison.exe
    config set ::yacc::BISON_SIMPLE $pckg_windows/bison/bison.simple
    config set ::yacc::BISON_HAIRY  $pckg_windows/bison/bison.hairy
    config set ::lex::LEX           $pckg_windows/flex/flex.exe
}

# --------------------------------------------------------------
# X11 (default)
# --------------------------------------------------------------

namespace eval x11 {

    if {$OSCLASS ne $STR_WINDOWS} {
	
	if {$OS eq $STR_LINUX} {
	    
	    # find X11
	    if [info exists PROJECTROOT] {
		set xpath $PROJECTROOT
	    } else {
		regsub /bin/X [exec which X] {} ::xpath
		if {0 == [file isdirectory $xpath]} {
		    set xpath /usr/X11R6
		} else {
		    set all_x [glob -nocomplain /usr/X11*]
		    if [llength $all_x] {
			set xpath [lindex $all_x 0] 
		    } else {
			set xpath /usr/X11R6
		    }
		}
	    }
	    
	    config set INCPATH $xpath/include
	    config set LIBPATH $xpath/lib
	    config set BINDIR  $xpath/bin
	    config set LIBS   {Xt Xi Xext Xmu X11}
	
	} else {

	    # non-Linux
	    config set INCPATH {}
	    config set LIBPATH {}
	    catch {config set BINDIR [file dirname [exec which xterm]]}
	    config set LIBS    {Xt Xi Xext Xmu X11}

	}
    }
}

# --------------------------------------------------------------
# DGA (direct gfx access) - only on solaris !
# --------------------------------------------------------------
namespace eval dga {

    if {$OS eq $STR_SUNOS} {
	config set LIBPATH /usr/openwin/lib
	config set LIBS    {dga}
    } else {
	config set LIBPATH {}
	config set LIBS   {}
    }

}

# --------------------------------------------------------------
# OpenGL 
# --------------------------------------------------------------
namespace eval opengl {
    
    # should be in default path
    config set INCPATH {/usr/local/include}
    config set LIBPATH {}
    
    if {$OSCLASS eq $STR_WINDOWS} {
	config set LIBS {glu32 opengl32}
    } else {
	config set LIBS {GLU GL}
    }
    
    if {$OSCLASS eq $STR_UNIX} {
	config set DEPEND {dga x11}
    }
}

# --------------------------------------------------------------
# QT 
# --------------------------------------------------------------
namespace eval qt {

# !! make windows configuration !
#    switch $OSCLASS {
#	$STR_WINDOWS {config set DIR L:/opt/qt}
#    }

    # !! change to central installation some time !
    if {$OSCLASS eq $STR_UNIX} {
	config set INCPATH $pckg/include/Qt
	config set LIBPATH $pckg/lib/$env(CS_MACH)
	config set LIBS   {qt}
	config set DEPEND {opengl gui}
    }

    # comes with every Linux distribution
    if {$OS eq $STR_LINUX} {
	config set INCPATH /usr/lib/qt-3.1/include
	config set LIBPATH /usr/lib/qt-3.1/lib
	config set LIBS    {qt}
	config set DEPEND  {opengl gui}
	config set DIR	   /usr/lib/qt-3.1
	# config set INCPATH /usr/lib/qt-2.3.0/include	      #
	# config set LIBPATH /usr/lib/qt-2.3.0/lib	      #
	# config set LIBS    {qt}			      #
	# config set DEPEND  {opengl gui}		      #
	# config set DIR	   /usr/lib/qt-2.3.0	      #
    }
}

# --------------------------------------------------------------
# QGL (QT's opengl extension)
# --------------------------------------------------------------
namespace eval qgl {

    config set LIBS   {}
    config set DEPEND {qt opengl gui}
    
    if {$OSCLASS eq $STR_UNIX} {lappend DEPEND x11} 
}


# --------------------------------------------------------------
# GLUT
# current version: 3.7beta
# --------------------------------------------------------------

namespace eval glut {

    config set DEPEND OPENGL

    # !! windows part not valid
    if {$OSCLASS eq $STR_WINDOWS} {
	
	config set LIBS    {glut32}
	config set INCPATH $pckg_windows/glut/include
	config set LIBPATH $pckg_windows/glut/lib
    } else {
	
	config set LIBS {glut}
	
	# use central installation of GLUT
	# (GLUT 3.7 is maintained by Wolfgang Heidrich)
	config set INCPATH $pckg_generic/glut-3.7/include
	config set LIBPATH $pckg/glut-3.7/lib

    }
}


# --------------------------------------------------------------
# GLUI
# --------------------------------------------------------------
namespace eval glui {
    # GLUI V2 is maintained by Wolfgang Heidrich
    config set INCPATH $pckg_generic/glui-v2/include
    config set LIBPATH $pckg/glui-v2/lib
    config set LIBS    {glui}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# TIFF
# --------------------------------------------------------------

namespace eval tiff {

    # should be in standard path on Linux - check for other platforms
    config set LIBPATH {}
    config set INCPATH {}
    config set LIBS    {tiff}
}

# --------------------------------------------------------------
# PNG
# --------------------------------------------------------------

namespace eval png {
    
    # should be in standard path on Linux - check for other platforms
    if {$OSCLASS eq $STR_WINDOWS} {
	config set INCPATH $pckg_windows/libpng/include
	config set LIBPATH $pckg_windows/libpng/lib
	config set LIBS    libpng
    } else {
	config set LIBS    png
    }
    config set DEPEND  zlib
}

# --------------------------------------------------------------
# ZLIB
# --------------------------------------------------------------

namespace eval zlib {
    # should be in standard path on Linux - check for other platforms
    if {$OSCLASS eq $STR_WINDOWS} {
	config set INCPATH      $pckg_windows/zlib/include
	config set LIBPATH      $pckg_windows/zlib/lib
	config set LIBS         {zlib}
    } else {
	config set LIBS         {z}
    }
}

# --------------------------------------------------------------
# BZLIB
# --------------------------------------------------------------

namespace eval bzlib {
    # should be in standard path on Linux - check for other platforms
    config set INCPATH {}
    config set LIBPATH {}
    config set LIBS    bz2
}

# --------------------------------------------------------------
# LUG (not installed in the department currently)
# --------------------------------------------------------------

#namespace eval lug {
#    config set INCPATH $pckg/lug/include
#    config set LIBPATH $pckg/lug/lib
#    config set LIBS    {lug}
#}


# --------------------------------------------------------------
# Math library (includes should be set automatically)
# --------------------------------------------------------------
if {$OSCLASS ne $STR_WINDOWS} {
    config set math::LIBS {m}
} else {
    config set math::LIBS {}
}

# pthread library
namespace eval pthread {
    config set LIBS {pthread}
}

# --------------------------------------------------------------
# OpenCV - Intel's Computer Vision Library
# --------------------------------------------------------------
namespace eval opencv {
#  config set DEPEND {ipl}
  config set DEPEND {}
  config set LIBPATH $pckg/opencv-0.0.7/lib
  config set INCPATH $pckg_generic/opencv-0.0.7/include
  config set LIBS    {opencv}
}
 
# --------------------------------------------------------------
# IPL - Intel's Image Processing Library
# --------------------------------------------------------------
namespace eval ipl {
  config set DEPEND {}
  config set LIBPATH {}
  config set INCPATH {}
  config set LIBS    {iplpx ipla6 iplm6 }
}

# --------------------------------------------------------------
# Various stuff
# --------------------------------------------------------------
if {$OSCLASS eq $STR_WINDOWS} {
#    config set g::PCCTS L:/opt/pccts
} else {
#    config set g::PCCTS         $pckg/pccts
#    config set purify::PURIFY   /opt/pure/purify-4.1-irix6/purify
    catch {config set doxygen::DOXYGEN [exec which doxygen]}
}

#config set INCPATH /usr/local/include
#config set LIBPATH $pckg_wh/lib/$env(CS_MACH)
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































































































































































































































































































































































































































Deleted support/tmk/config/site/mpi-sb.mpg.de.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*-Mode: tcl -*-
# $Id: mpi-sb.mpg.de,v 1.5 2007/02/19 02:07:30 yamauchih Exp $
# site config file, Max-Planck-Institut fur Informatik, AG4
#

#
# read config in order to the OS.
#
if {$OS eq $STR_LINUX} {
    source $::tmk::dir_site/mpi-sb.mpg.de_confdir/linux.config
} elseif {$OS eq $STR_IRIX} {
    source $::tmk::dir_site/mpi-sb.mpg.de_confdir/irix.config
} elseif {$OS eq $STR_IRIX64} {
    source $::tmk::dir_site/mpi-sb.mpg.de_confdir/irix64.config
} elseif {$OS eq $STR_SUNOS} {    
    source $::tmk::dir_site/mpi-sb.mpg.de_confdir/sunos.config
} elseif {$OSCLASS eq $STR_WINDOWS} {    
    source $::tmk::dir_site/mpi-sb.mpg.de_confdir/windows.config
} else {
    # $OSCLASS eq $STR_MACINTOSH is possible.
    puts "Error! : mpi-sb.mpg.de : Unknown operating system under the AG4 configration."
    puts "Please contact to ag4-admin."
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































Deleted support/tmk/config/site/mpi-sb.mpg.de_confdir/README.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

mpi-sb.mpg.de_confdir 

configration files for AG4
				Yamauchi, Hitoshi
				2004-7-19(Mon)

This directory contains tmk config file for each environment.

---

The idea of this directory is the same to move from old BSD style
rc.local to SysV init.d. The file mpi-sb.mpg.de contains {Linux, IRIX,
SunOS, windows} related codes in one file. But now if someone edit the
windows related part, there should be no effect to Linux,IRIX,SunOS
part.

---

When new environment is added, 

1. You can edit 

	tmk/config/site/mpi-sb.mpg.de 
	tmk/config/site/mpi-sb.mpg.de_confdir/Linux.config (for Linux)

   These files are dispatcher to which file will be finally read.

2. Add a new environment file. (e.g., linux.debian2.2.config)

The file names are lowercase, because the same name to $ARCH might be
some problems in some environment. (e.g., set CVS global ignore as
IRIX*, Debian*).


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































Deleted support/tmk/config/site/mpi-sb.mpg.de_confdir/irix.config.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
# -*-Mode: tcl -*-
# $Id: irix.config,v 1.5 2004/08/09 17:16:06 yamauchih Exp $
# site config file, Max-Planck-Institut f-Ar Informatik, AG4$)B
# IRIX, 32bit
#
assert {![string compare $OS IRIX]}
dbg_msg "reading : [info script]" 1

# where to find the AG4 shared projects
config set ::PROJ_LOCATIONS [list /HPS/usr/ag4-adm/shared_proj]

# directories in which tmk should NOT check dependencies
config set DEPEND_EXCLUDE {
    /usr/include/* 
    /HPS/opt/* 
    /opt/* 
    /usr/X11R6/*
    /usr/*
    /CYGWIN-B20/*
    /cygwin-b20/*
    /CYGWIN/*  
}

# for the automatic compilation at night, we switch ALL dependencies on!
if {[info exists env(USER)]} {
    if {$env(USER) == ag4-adm} {
	puts "switching on ***all*** dependency checks for ag4-adm"
	config set DEPEND_EXCLUDE {}
    }
}

# we use the C++ standard library in our projects 
# (e.g. MIPSpro needs to be configured for that!)
foreach x {cxx::OPTIONS c::OPTIONS link::OPTIONS} {
    config variable $x
    lappend $x std
}

# --------------------------------------------------------------
# where are software packages located?
# special configuration for our test-linux boxes / laptops
# --------------------------------------------------------------
if {! [info exists pckg]} {
    set pckg /HPS/opt/pckg
}

# --------------------------------------------------------------
# X11 (default)
# --------------------------------------------------------------
namespace eval x11 {
    config set INCPATH {}
    config set LIBPATH {}
    catch {config set BINDIR [file dirname [exec which xterm]]}
    config set LIBS    {Xt Xi Xext Xmu X11}
}

# --------------------------------------------------------------
# MOTIF
# --------------------------------------------------------------
namespace eval motif {
    config set LIBPATH {}
    config set INCPATH {}
    config set LIBS    {Xm}
    config set DEPEND  {x11}
}

# --------------------------------------------------------------
# DGA (direct gfx access) - only on solaris !
# --------------------------------------------------------------
namespace eval dga {
    config set LIBPATH {}
    config set LIBS   {}
}

# --------------------------------------------------------------
# OpenGL 
# --------------------------------------------------------------
namespace eval opengl {
    config set INCPATH {}
    config set LIBPATH {}
    config set LIBS    { GLU GL }
    config set DEPEND  { dga x11 }
}

# --------------------------------------------------------------
# OpenInventor
# --------------------------------------------------------------
namespace eval inventor {
    config set LIBS   {Inventor}
    config set DEPEND {opengl}
}

namespace eval inventorxt {
  config set LIBS {InventorXt}
  config set DEPEND {Inventor}
}
   

# --------------------------------------------------------------
# QT 
# --------------------------------------------------------------
namespace eval qt {
    # current version 
    config set DEFS   {QT_CLEAN_NAMESPACE} ; # avoids name conflicts
    config set LIBS   {qt}
    config set DEPEND {gui opengl}
    config set DIR $pckg/qt
    
    # multi-threaded current version
    namespace eval mt {
	config set DEFS   {QT_THREAD_SUPPORT}
	config set LIBS   {qt-mt}
    }

    # other versions
    namespace eval 3 {
	config set DIR $pckg/qt3
    }
    namespace eval 2.2 {
	config set DIR $pckg/qt-2.2.1
    }
    namespace eval 2.0 {
	config set DIR $pckg/qt2
        config set DEPEND gui
    }
}


# --------------------------------------------------------------
# QGL (QT's opengl extension)
# --------------------------------------------------------------
namespace eval qgl {
    # current version is integrated in qt (>= 2.2) 
    config set LIBS   {}
    config set DEPEND {qt opengl gui}

    namespace eval 2.0 {
	config set LIBS {qgl}
	config set DEPEND {qt::2.0 opengl gui}
    }
    
    namespace eval 2.2 {
	config set LIBS {}
	config set DEPEND {qt::2.2 opengl gui}
    }
}

# --------------------------------------------------------------
# GLUT
# current version: 3.7beta
# --------------------------------------------------------------

namespace eval glut {
    config set DEPEND { OPENGL }
    config set LIBS {glut}
    config set INCPATH $pckg/glut/include
    # libpath depends on the compiler/linker
    config set_lazy LIBPATH [subst -nocommands {
	switch -glob \$::link::LINKER {
	    *mipspro {return $pckg/glut/lib}
	    *gcc     {return $pckg/glut/lib}
	    default  {return $pckg/glut/lib}
	}
    }]
}

# --------------------------------------------------------------
# GLOW
# --------------------------------------------------------------
namespace eval glow {
    config set INCPATH $pckg/glow/include
    config set LIBPATH $pckg/glow/lib
    config set LIBS    {glow}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# GLUI
# --------------------------------------------------------------
namespace eval glui {
    set pckgglui $pckg/glui
    config set INCPATH $pckgglui/include
    config set LIBPATH $pckgglui/lib
    config set LIBS    {glui}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# GLE
# --------------------------------------------------------------
namespace eval gle {
    config set INCPATH $pckg/gle/include
    config set LIBPATH $pckg/gle/lib
    config set LIBS    {gle}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# ACGL
# --------------------------------------------------------------
namespace eval acgl {
    config set INCPATH $pckg/ACGL/include
    config set LIBPATH $pckg/ACGL/lib
    config set LIBS    {acgl}
    config set DEPEND  {opengl}
}

# --------------------------------------------------------------
# LIB3DS - 3D studio import library
# --------------------------------------------------------------
namespace eval lib3ds {
    config set LIBPATH $pckg/lib3ds/lib
    config set INCPATH $pckg/lib3ds/include
    config set LIBS { 3ds }
}


# --------------------------------------------------------------
# TIFF
# --------------------------------------------------------------

namespace eval tiff {
    config set LIBPATH $pckg/tiff/lib32
    config set INCPATH $pckg/tiff/include 
    config set LIBS    {tiff}
    # patched version
    namespace eval patched {
	config set LIBPATH $pckg/tiff-patched/lib32
	config set INCPATH $pckg/tiff-patched/include 
    }
}

# --------------------------------------------------------------
# PNG
# --------------------------------------------------------------

namespace eval png {
    #    config set INCPATH $pckg/libpng/include
    #    config set LIBPATH $pckg/libpng/lib
    config set LIBS    {png z}
    config set DEPEND  {zlib}
}

# --------------------------------------------------------------
# JPEG
# --------------------------------------------------------------

namespace eval jpeg {
    #    config set INCPATH $pckg/jpeg-6b/include
    #    config set LIBPATH $pckg/jpeg-6b/lib
    config set LIBS    {jpeg}
    config set DEPEND  {}
}

# --------------------------------------------------------------
# ZLIB
# --------------------------------------------------------------

namespace eval zlib {
    config set INCPATH      $pckg/zlib/include
    config set LIBPATH      $pckg/zlib/lib
    config set LIBS         {z}
}

# --------------------------------------------------------------
# BZLIB
# --------------------------------------------------------------

namespace eval bzlib {
    config set INCPATH $pckg/bzip2/include
    config set LIBPATH $pckg/bzip2/lib
    config set LIBS    { bz2 }
}

# --------------------------------------------------------------
# LUG
# --------------------------------------------------------------

namespace eval lug {
    config set INCPATH $pckg/lug/include
    config set LIBPATH $pckg/lug/lib
    config set LIBS    {lug}
}

# --------------------------------------------------------------
# flTk
# --------------------------------------------------------------

namespace eval fltk {
  config set DEPEND {gui}
  config set LIBPATH /HPS/opt/lib32
  config set INCPATH /HPS/opt/include
  config set LIBS    {fltk}
}

# --------------------------------------------------------------
# quicktime4linux - reading & writing .mov files
# --------------------------------------------------------------
namespace eval quicktime4linux {
  config set DEPEND {pthread}
  config set LIBPATH $pckg/quicktime/lib
  config set INCPATH $pckg/quicktime/include
  config set LIBS    {quicktime glib}
}

# --------------------------------------------------------------
# OpenCV - Intel's Computer Vision Library
# --------------------------------------------------------------
namespace eval opencv {
  config set DEPEND {ipl}
  config set LIBPATH $pckg/opencv/lib
  config set INCPATH $pckg/opencv/include
  config set LIBS    {opencv}
}

# --------------------------------------------------------------
# IPL - Intel's Image Processing Library
# --------------------------------------------------------------
namespace eval ipl {
  config set DEPEND  {}
  config set LIBPATH {}
  config set INCPATH {/usr/include/ipl}
  config set LIBS    {iplpx ipla6 iplm6 }
}

# --------------------------------------------------------------
# ImageMagick C++ 
# --------------------------------------------------------------
namespace eval magick++ {
    config set DEPEND {}
    config set LIBPATH $pckg/ImageMagick/lib
    config set INCPATH $pckg/ImageMagick/include
    config set LIBS    {Magick}
    config set DEPEND {Magick}
}

# --------------------------------------------------------------
# ImageMagick  
# --------------------------------------------------------------
namespace eval magick {
    #    config set DEPEND {pthread}
    config set LIBPATH $pckg/ImageMagick/lib
    config set INCPATH $pckg/ImageMagick/include
    config set LIBS    {Magick}
}

# --------------------------------------------------------------
# TCL 
# --------------------------------------------------------------
namespace eval tcl {
  config set DEPEND {}
  config set LIBPATH $pckg/tcl8.4a1/lib
  config set INCPATH $pckg/tcl8.4a1/include
  config set LIBS    {tcl8.4}
}

# --------------------------------------------------------------
# TK 
# --------------------------------------------------------------
namespace eval tk {
  config set DEPEND {tcl}
  config set LIBPATH $pckg/tk8.4a1/lib
  config set INCPATH $pckg/tk8.4a1/include
  config set LIBS    {tk8.4}
}

# --------------------------------------------------------------
# POSIX threads
# --------------------------------------------------------------

namespace eval pthread {
    config set LIBS {}
}

# --------------------------------------------------------------
# Math library (includes should be set automatically)
# --------------------------------------------------------------

namespace eval math {
    config set LIBS { m }
}

# --------------------------------------------------------------
# NVIDIA Cg 'C for graphics' toolkit 
# --------------------------------------------------------------

namespace eval cg {
    config set INCPATH $pckg/Cg/include
    config set LIBPATH $pckg/Cg/lib
    config set LIBS    { CgGL Cg  }
    config set DEPEND  { opengl math }
}

# --------------------------------------------------------------
# Fortran->C Compiler
# --------------------------------------------------------------

namespace eval f2c {
    # What is the right way to do this???
    config set INCPATH $pckg/f2c/include
    config set LIBPATH $pckg/f2c/lib
    config set LIBS    { f2c }
}

# --------------------------------------------------------------
# CLAPACK/CBLAS
# --------------------------------------------------------------

namespace eval clapack {
    config set INCPATH $pckg/CLAPACK/include
    config set LIBPATH $pckg/CLAPACK/lib
    config set LIBS    { cblas clapack F77 I77 } 
    config set DEPEND  { math }

    #
    # NOTE: This might interfere with f2c!!! Not tested!
    #
}

#----------------------------------------
# Metis graph partitioning
#----------------------------------------

namespace eval metis {
    config set INCPATH $pckg/metis/include
    config set LIBPATH $pckg/metis/lib
    config set LIBS    { metis } 
    config set DEPEND  { math }
}

#----------------------------------------
# TAUCS sparse linear solvers
#----------------------------------------

namespace eval taucs {
    config set INCPATH $pckg/taucs/include
    config set LIBPATH $pckg/taucs/lib
    config set LIBS    { taucs blas clapack } 
    #removed g2c
    config set DEPEND  { math metis }

    # note: BLAS is installed in /usr/lib for Debian3.0 and IRIX
}

#----------------------------------------
# J.R. Shewchuk's triangle library/binaries 
# http://www-2.cs.cmu.edu/~quake/triangle.html
#----------------------------------------

namespace eval triangle {
    config set INCPATH $pckg/triangle/include
    config set LIBPATH $pckg/triangle/lib
    config set LIBS    { triangle } 
}


# --------------------------------------------------------------
# Various stuff
# --------------------------------------------------------------
config set g::PCCTS         $pckg/pccts
config set purify::PURIFY   /opt/pure/purify-4.1-irix6/purify
catch {config set doxygen::DOXYGEN [exec which doxygen]}

# we don't have NASM installed - don't use MMX
config set USE_MMX 0

# we don't have pgcc installed
lremove cxx::COMPILERS pgcc
lremove c::COMPILERS pgcc

# --------------------------------------------------------------
# Digital Media Software Development Kit by SGI
# --------------------------------------------------------------

namespace eval dmsdk {
    config set INCPATH {}
    config set LIBPATH {}
    config set LIBS    {dmedia audio}
}

# ------------------------------------------------------------
# ghost
# ------------------------------------------------------------
namespace eval ghost {
    if {$HOST == potassium} {
	if {$::cxx::COMPILER ne "gcc" || $::cxx::gcc::VERSION ne "2.96"} {
	    puts stderr "*****************************************************************"
	    puts stderr "Error: GHOST SDK can only be used with GNU compiler version 2.96"
	    puts stderr "       please set PATH variable to /HPS/opt/pckg/gcc-2.96/usr/bin"
	    puts stderr "       and re-configure tmk !!!"
	    puts stderr "*****************************************************************"
	    if {$HOST ne "samarium"} {
		exit 1
	    }
	}
    }
    
    config set INCPATH /HPS/opt/pckg/GHOST/usr/include/GHOST
    config set LIBPATH /HPS/opt/pckg/GHOST/usr/lib
    config set LIBS {
	PHANToMIO	
	ghost	
	rt
	dl
    }
    config set DEPEND { pthread }
}

namespace eval ghost_gl {
    config set LIBS { ghostGL ghostGLDraw gstVRML ghostGLManager ghostGLUTManager }
    config set DEPEND { ghost glut X11 }
}

namespace eval ghost_hapticview {
    config set LIBS { widgets-sgi Xm HapticView reset_screen quit pmouseComClient STIComServer }
    config set DEPEND {ghost_gl}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted support/tmk/config/site/mpi-sb.mpg.de_confdir/irix64.config.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
# -*-Mode: tcl -*-
# $Id: irix64.config,v 1.9 2004/12/13 14:13:43 yamauchih Exp $
# site config file, Max-Planck-Institut f"ur Informatik, AG4
# IRIX64, 32 bit mode 

assert {![string compare $OS   "IRIX64"]}
dbg_msg "reading : [info script]" 1

# where to find the AG4 shared projects
config set ::PROJ_LOCATIONS [list /HPS/usr/ag4-adm/shared_proj]

# directories in which tmk should NOT check dependencies
config set DEPEND_EXCLUDE {
    /usr/include/* 
    /HPS/opt/* 
    /opt/* 
    /usr/X11R6/*
    /usr/*
    /CYGWIN-B20/*
    /cygwin-b20/*
    /CYGWIN/*  
}

# for the automatic compilation at night, we switch ALL dependencies on!
if {[info exists env(USER)]} {
    if {$env(USER) == "ag4-adm"} {
	puts "switching on ***all*** dependency checks for ag4-adm"
	config set DEPEND_EXCLUDE {}
    }
}

# we use the C++ standard library in our projects 
# (e.g. MIPSpro needs to be configured for that!)
foreach x {cxx::OPTIONS c::OPTIONS link::OPTIONS} {
    config variable $x
    lappend $x "std"
}

# --------------------------------------------------------------
# where are software packages located?
# special configuration for our test-linux boxes / laptops
# --------------------------------------------------------------
if { ! [info exists pckg] } {
    set pckg "/HPS/opt/pckg"
}

# --------------------------------------------------------------
# X11 (default)
# --------------------------------------------------------------
namespace eval x11 {
    config set INCPATH {}
    config set LIBPATH {}
    catch {config set BINDIR [file dirname [exec which xterm]]}
    config set LIBS    {Xt Xi Xext Xmu X11}
}

# --------------------------------------------------------------
# MOTIF
# --------------------------------------------------------------
namespace eval motif {
    config set LIBPATH {}
    config set INCPATH {}
    config set LIBS    {Xm}
    config set DEPEND  {x11}
}

# --------------------------------------------------------------
# DGA (direct gfx access) - only on solaris !
# --------------------------------------------------------------
namespace eval dga {
    config set LIBPATH {}
    config set LIBS   {}
}

# --------------------------------------------------------------
# OpenGL 
# --------------------------------------------------------------
namespace eval opengl {
    config set INCPATH {}
    config set LIBPATH {}
    config set LIBS    { GLU GL }
    config set DEPEND  { dga x11 }
}

# --------------------------------------------------------------
# OpenInventor
# --------------------------------------------------------------
namespace eval inventor {
    config set LIBS   {Inventor}
    config set DEPEND {opengl}
}

namespace eval inventorxt {
  config set LIBS {InventorXt}
  config set DEPEND {Inventor}
}
   

# --------------------------------------------------------------
# QT 
# --------------------------------------------------------------
namespace eval qt {
    # current version 
    config set DEFS   {QT_CLEAN_NAMESPACE} ; # avoids name conflicts
    config set LIBS   {qt}
    config set DEPEND {gui opengl}
    config set DIR "$pckg/qt"
    
    # multi-threaded current version
    namespace eval mt {
	config set DEFS   {QT_THREAD_SUPPORT}
	config set LIBS   {qt-mt}
    }

    # other versions
    namespace eval 3 {
	config set DIR "$pckg/qt3"
    }
    namespace eval 2.2 {
	config set DIR "$pckg/qt-2.2.1"
    }
    namespace eval 2.0 {
	config set DIR "$pckg/qt2"
        config set DEPEND gui
    }
}


# --------------------------------------------------------------
# QGL (QT's opengl extension)
# --------------------------------------------------------------
namespace eval qgl {
    # current version is integrated in qt (>= 2.2) 
    config set LIBS   {}
    config set DEPEND {qt opengl gui}

    namespace eval 2.0 {
	config set LIBS {qgl}
	config set DEPEND {qt::2.0 opengl gui}
    }
    namespace eval 2.2 {
	config set LIBS {}
	config set DEPEND {qt::2.2 opengl gui}
    }
}


# --------------------------------------------------------------
# GLUT
# current version: 3.7beta
# --------------------------------------------------------------

namespace eval glut {

    config set DEPEND { OPENGL }
    config set LIBS {glut}
    config set INCPATH $pckg/glut/include
    # libpath depends on the compiler/linker
    config set_lazy LIBPATH [subst -nocommands {
	switch -glob \$::link::LINKER {
	    *mipspro {return "$pckg/glut/lib"}
	    *gcc     {return "$pckg/glut/lib"}
	    default  {return "$pckg/glut/lib"}
	}
    }]
}

# --------------------------------------------------------------
# GLOW
# --------------------------------------------------------------
namespace eval glow {
    config set INCPATH $pckg/glow/include
    config set LIBPATH $pckg/glow/lib
    config set LIBS {glow}
     config set DEPEND  {glut}
}

# --------------------------------------------------------------
# GLUI
# --------------------------------------------------------------
namespace eval glui {
    set pckgglui $pckg/glui
    config set INCPATH $pckgglui/include
    config set LIBPATH "$pckgglui/lib"
    config set LIBS    {glui}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# GLE
# --------------------------------------------------------------
namespace eval gle {
    config set INCPATH $pckg/gle/include
    config set LIBPATH $pckg/gle/lib
    config set LIBS    {gle}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# ACGL
# --------------------------------------------------------------
namespace eval acgl {
    config set INCPATH $pckg/ACGL/include
    config set LIBPATH $pckg/ACGL/lib
    config set LIBS    {acgl}
    config set DEPEND  {opengl}
}

# --------------------------------------------------------------
# LIB3DS - 3D studio import library
# --------------------------------------------------------------
namespace eval lib3ds {
    config set LIBPATH $pckg/lib3ds/lib
    config set INCPATH $pckg/lib3ds/include
    config set LIBS { 3ds }
}


# --------------------------------------------------------------
# TIFF
# --------------------------------------------------------------

namespace eval tiff {
    config set LIBPATH $pckg/tiff/lib32
    config set INCPATH $pckg/tiff/include 
    config set LIBS    {tiff}

    # patched version
    namespace eval patched {
	config set LIBPATH $pckg/tiff-patched/lib32
	config set INCPATH $pckg/tiff-patched/include 
    }

}

# --------------------------------------------------------------
# PNG
# --------------------------------------------------------------

namespace eval png {
    #    config set INCPATH $pckg/libpng/include
    #    config set LIBPATH $pckg/libpng/lib
    config set LIBS    {png z}
    config set DEPEND  {zlib}
}

# --------------------------------------------------------------
# JPEG
# --------------------------------------------------------------

namespace eval jpeg {
    #    config set INCPATH $pckg/jpeg-6b/include
    #    config set LIBPATH $pckg/jpeg-6b/lib
    config set LIBS    {jpeg}
    config set DEPEND  {}
}

# --------------------------------------------------------------
# ZLIB
# --------------------------------------------------------------

namespace eval zlib {
    config set INCPATH      $pckg/zlib/include
    config set LIBPATH      $pckg/zlib/lib
    config set LIBS         {z}
}

# --------------------------------------------------------------
# BZLIB
# --------------------------------------------------------------

namespace eval bzlib {
    config set INCPATH $pckg/bzip2/include
    config set LIBPATH $pckg/bzip2/lib
    config set LIBS    { bz2 }
}

# --------------------------------------------------------------
# LUG
# --------------------------------------------------------------

namespace eval lug {
    config set INCPATH $pckg/lug/include
    config set LIBPATH $pckg/lug/lib
    config set LIBS    {lug}
}

# --------------------------------------------------------------
# flTk
# --------------------------------------------------------------

namespace eval fltk {
  config set DEPEND {gui}
  config set LIBPATH /HPS/opt/lib32
  config set INCPATH /HPS/opt/include
  config set LIBS    {fltk}
}

# --------------------------------------------------------------
# quicktime4linux - reading & writing .mov files
# --------------------------------------------------------------
namespace eval quicktime4linux {
  config set DEPEND {pthread}
  config set LIBPATH $pckg/quicktime/lib
  config set INCPATH $pckg/quicktime/include
  config set LIBS    {quicktime glib}
}

# --------------------------------------------------------------
# OpenCV - Intel's Computer Vision Library
# --------------------------------------------------------------
namespace eval opencv {
  config set DEPEND {ipl}
  config set LIBPATH $pckg/opencv/lib
  config set INCPATH $pckg/opencv/include
  config set LIBS    {opencv}
}

# --------------------------------------------------------------
# IPL - Intel's Image Processing Library
# --------------------------------------------------------------
namespace eval ipl {
  config set DEPEND  {}
  config set LIBPATH {}
  config set INCPATH {/usr/include/ipl}
  config set LIBS    {iplpx ipla6 iplm6 }
}

# --------------------------------------------------------------
# ImageMagick C++ 
# --------------------------------------------------------------
namespace eval magick++ {
    config set DEPEND {}
    config set LIBPATH $pckg/ImageMagick/lib
    config set INCPATH $pckg/ImageMagick/include
    config set LIBS    {Magick++}
}

# --------------------------------------------------------------
# ImageMagick  
# --------------------------------------------------------------
namespace eval magick {
    #    config set DEPEND {pthread}
    config set LIBPATH $pckg/ImageMagick/lib
    config set INCPATH $pckg/ImageMagick/include
    config set LIBS    {Magick}
}

# --------------------------------------------------------------
# TCL 
# --------------------------------------------------------------
namespace eval tcl {
  config set DEPEND {}
  config set LIBPATH $pckg/tcl/lib
  config set INCPATH $pckg/tcl/include
  config set LIBS    {tcl8.4}
}

# --------------------------------------------------------------
# TK 
# --------------------------------------------------------------
namespace eval tk {
  config set DEPEND {tcl}
  config set LIBPATH $pckg/tcl/lib
  config set INCPATH $pckg/tcl/include
  config set LIBS    {tk8.4}
}

# --------------------------------------------------------------
# POSIX threads
# --------------------------------------------------------------

namespace eval pthread {
    config set LIBS {}
}

# --------------------------------------------------------------
# Math library (includes should be set automatically)
# --------------------------------------------------------------

namespace eval math {
    config set LIBS { m }
}

# --------------------------------------------------------------
# NVIDIA Cg 'C for graphics' toolkit 
# --------------------------------------------------------------

namespace eval cg {
    config set INCPATH $pckg/Cg/include
    config set LIBPATH $pckg/Cg/lib
    config set LIBS    { CgGL Cg  }
    config set DEPEND  { opengl math }
}

# --------------------------------------------------------------
# Fortran->C Compiler
# --------------------------------------------------------------

namespace eval f2c {
    # What is the right way to do this???
    config set INCPATH $pckg/f2c/include
    config set LIBPATH $pckg/f2c/lib
    config set LIBS    { f2c }
}

# --------------------------------------------------------------
# CLAPACK/CBLAS
# --------------------------------------------------------------

namespace eval clapack {
    config set INCPATH $pckg/CLAPACK/include
    config set LIBPATH $pckg/CLAPACK/lib
    config set LIBS    { cblas clapack F77 I77 } 
    config set DEPEND  { math }

    #
    # NOTE: This might interfere with f2c!!! Not tested!
    #
}

#----------------------------------------
# Metis graph partitioning
#----------------------------------------

namespace eval metis {
    config set INCPATH $pckg/metis/include
    config set LIBPATH $pckg/metis/lib
    config set LIBS    { metis } 
    config set DEPEND  { math }
}

#----------------------------------------
# TAUCS sparse linear solvers
#----------------------------------------

namespace eval taucs {
    config set INCPATH $pckg/taucs/include
    config set LIBPATH $pckg/taucs/lib
    config set LIBS    { taucs blas clapack } 
    #removed g2c
    config set DEPEND  { math metis }

    # note: BLAS is installed in /usr/lib for Debian3.0 and IRIX
}

#----------------------------------------
# J.R. Shewchuk's triangle library/binaries 
# http://www-2.cs.cmu.edu/~quake/triangle.html
#----------------------------------------

namespace eval triangle {
    config set INCPATH $pckg/triangle/include
    config set LIBPATH $pckg/triangle/lib
    config set LIBS    { triangle } 
}


# --------------------------------------------------------------
# Various stuff
# --------------------------------------------------------------
config set g::PCCTS         $pckg/pccts
config set purify::PURIFY   /opt/pure/purify-4.1-irix6/purify
catch {config set doxygen::DOXYGEN [exec which doxygen]}

# we don't have NASM installed - don't use MMX
config set USE_MMX 0

# we don't have pgcc installed
lremove cxx::COMPILERS pgcc
lremove c::COMPILERS   pgcc

# --------------------------------------------------------------
# Digital Media Software Development Kit by SGI
# --------------------------------------------------------------

namespace eval dmsdk {
    config set INCPATH {}
    config set LIBPATH {}
    config set LIBS    {dmedia audio}
}

# ------------------------------------------------------------
# ghost
# ------------------------------------------------------------
namespace eval ghost {
      
    if { $HOST == "potassium" } {
	if { $::cxx::COMPILER != "gcc" || $::cxx::gcc::VERSION != "2.96" } {
	    puts stderr "*****************************************************************"
	    puts stderr "Error: GHOST SDK can only be used with GNU compiler version 2.96"
	    puts stderr "       please set PATH variable to /HPS/opt/pckg/gcc-2.96/usr/bin"
	    puts stderr "       and re-configure tmk !!!"
	    puts stderr "*****************************************************************"
	    if { $HOST != "samarium" } {
		exit 1
	    }
	}
    }
    
    config set INCPATH /HPS/opt/pckg/GHOST/usr/include/GHOST
    config set LIBPATH /HPS/opt/pckg/GHOST/usr/lib
    config set LIBS {
	PHANToMIO	
	ghost	
	rt
	dl
    }
    config set DEPEND { pthread }
}

namespace eval ghost_gl {
    config set LIBS { ghostGL ghostGLDraw gstVRML ghostGLManager ghostGLUTManager }
    config set DEPEND { ghost glut X11 }
}


namespace eval ghost_hapticview {
    config set LIBS { widgets-sgi Xm HapticView reset_screen quit pmouseComClient STIComServer }
    config set DEPEND {ghost_gl}
}

# --------------------------------------------------------------
# readline 
# --------------------------------------------------------------

namespace eval readline {
    config set INCPATH { /HPS/opt/pckg/readline/include } 
    config set LIBPATH { /HPS/opt/pckg/readline/lib } 
    config set LIBS {readline}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted support/tmk/config/site/mpi-sb.mpg.de_confdir/linux.config.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# -*-Mode: tcl -*-
# $Id: linux.config,v 1.7 2007/10/25 12:57:28 cfuchs_sf Exp $
# Linux config file, Max-Planck-Institut fuer Informatik, AG4
# Dispatcher.
assert {![string compare $OS $STR_LINUX]}
dbg_msg "reading : [info script]" 1

# where to find the AG4 shared projects
config set ::PROJ_LOCATIONS [list /HPS/usr/ag4-adm/linux_shared_proj]

# for the automatic compilation at night, we switch ALL dependencies on!
if {[info exists env(USER)]} {
    if {$env(USER) eq "ag4-adm"} {
	puts "switching on ***all*** dependency checks for ag4-adm"
	config set DEPEND_EXCLUDE {}
    }
}

#
# source each environment
#
if {! [ info exist ARCH ] } {
    set ARCH [arch_name {}]
}

if {[regexp {Debian4\.0.*} $ARCH]} {
    set addressmode [::tmk::get_runmodestat addressmode ]
    if {$addressmode eq "default"} {
	source $::tmk::dir_site/mpi-sb.mpg.de_confdir/linux.debian4.0.config
    } elseif {$addressmode eq "64bit"} {
	source $::tmk::dir_site/mpi-sb.mpg.de_confdir/linux.debian4.0-64bit.config	
    } else {
	puts "Error! : no config for runmode $addressmode."
	exit
    }
} elseif {$ARCH eq "Debian3.1"} {
    set addressmode [::tmk::get_runmodestat addressmode ]
    if {$addressmode eq "default"} {
	source $::tmk::dir_site/mpi-sb.mpg.de_confdir/linux.debian3.1.config
    } elseif {$addressmode eq "64bit"} {
	source $::tmk::dir_site/mpi-sb.mpg.de_confdir/linux.debian3.1-opteron-64bit.config	
    } else {
	puts "Error! : no config for runmode $addressmode."
	exit
    }
} elseif {$ARCH eq "Debian3.0"} {
    source $::tmk::dir_site/mpi-sb.mpg.de_confdir/linux.debian3.0.config
} elseif {$ARCH eq "Debian2.2"} {
    source $::tmk::dir_site/mpi-sb.mpg.de_confdir/linux.debian2.2.config
} else {
    puts "Error! : mpi-sb.mpg.de_confdir/linux.config: Unknown ARCH ($ARCH). "
    puts "Please contact to ag4-adm."
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































Deleted support/tmk/config/site/mpi-sb.mpg.de_confdir/linux.debian2.2.config.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
# -*-Mode: tcl -*-
# $Id: linux.debian2.2.config,v 1.3 2004/08/09 15:42:32 yamauchih Exp $
# Linux config file, Max-Planck-Institut fuer Informatik, AG4
# Debian 2.2, gcc 2.95.x
#
assert {![string compare $OS   Linux]}
assert {![string compare $ARCH Debian2.2]}
dbg_msg "reading : [info script]" 1

# directories in which tmk should NOT check dependencies
config set DEPEND_EXCLUDE {
    /usr/include/* 
    /HPS/opt/* 
    /opt/* 
    /usr/X11R6/*
    /usr/*
}

# we use the C++ standard library in our projects 
# (e.g. MIPSpro needs to be configured for that!)
foreach x {cxx::OPTIONS c::OPTIONS link::OPTIONS} {
    config variable $x
    lappend $x std
}

# --------------------------------------------------------------
# where are software packages located?
# special configuration for our test-linux boxes / laptops
# --------------------------------------------------------------
if {! [info exists pckg]} {
    set pckg /HPS/opt/pckg

    if {[regexp {mpi[dn]o4...} $HOST] == 0} {
	# package directory depends on Linux distribution name
	switch [string tolower $LINUX_DIST] {
	    redhat   {set pckg /HPS/opt/pckg-mdk}
	    mandrake {set pckg /HPS/opt/pckg-mdk}
	    debian   {set pckg /HPS/opt/pckg-deb}
	}
    }
}

# --------------------------------------------------------------
# X11 (default)
# --------------------------------------------------------------
namespace eval x11 {
    # find X11
    if [info exists PROJECTROOT] {
	set xpath $PROJECTROOT
    } else {
	set xpath /notset
	catch {regsub /bin/X [exec which X] {} xpath}
	if {0 == [file isdirectory $xpath]} {
	    set xpath /usr/X11R6
	} else {
	    set all_x [glob -nocomplain /usr/X11*]
	    if [llength $all_x] {
		set xpath [lindex $all_x 0] 
	    } else {
		set xpath /usr/X11R6
	    }
	}
    }
	    
    config set INCPATH $xpath/include
    config set LIBPATH $xpath/lib
    config set BINDIR  $xpath/bin
    config set LIBS   {Xt Xi Xext Xmu X11}
    
}

# --------------------------------------------------------------
# MOTIF
# --------------------------------------------------------------
namespace eval motif {
    config set LIBPATH $pckg/lesstif/lib
    config set INCPATH $pckg/lesstif/include
    config set LIBS {Xm}
    config set DEPEND {x11}
}

# --------------------------------------------------------------
# DGA (direct gfx access) - only on solaris !
# --------------------------------------------------------------
namespace eval dga {
    config set LIBPATH {}
    config set LIBS   {}
}

# --------------------------------------------------------------
# OpenGL 
# --------------------------------------------------------------
namespace eval opengl {

    if {$OS eq "Linux"} {
	switch $LINUX_GRAPHICS {
	    nvidia {
		config set INCPATH $pckg/OpenGL/include
		config set LIBPATH $pckg/OpenGL/lib
	    }
	    sgivpro {
		#   config set INCPATH /usr/include
		#   config set LIBPATH /usr/lib
	    }
	    default {
		config set INCPATH $pckg/mesa/include
		config set LIBPATH $pckg/mesa/lib
	    }
	}
    } 
    config set LIBS   { GLU GL }
    config set DEPEND { dga x11 }
}

# --------------------------------------------------------------
# OpenInventor
# --------------------------------------------------------------
namespace eval inventor {
    if [file readable /usr/lib/libFL.so] {
	config set LIBS   {Inventor FL}
    } else {
	config set LIBS   {Inventor}
    }
    config set DEPEND {opengl}
}

namespace eval inventorxt {
  config set LIBS {InventorXt}
  config set DEPEND {Inventor}
}
   

# --------------------------------------------------------------
# QT 
# --------------------------------------------------------------
namespace eval qt {
    # current version 
    config set DEFS   {QT_CLEAN_NAMESPACE} ; # avoids name conflicts
    config set LIBS   {qt}
    config set DEPEND {gui opengl}

    # original code means this, but why?
    if { $::cxx::gcc::GCCRELEASE eq 3 } {
	config set DIR $pckg/qt.gcc3
    }
    config set DIR $pckg/qt

    # multi-threaded current version
    namespace eval mt {
	config set DEFS   {QT_THREAD_SUPPORT}
	config set LIBS   {qt-mt}
    }

    # other versions
    namespace eval 3 {
	config set DIR $pckg/qt3
    }

    # other versions
    namespace eval 2.2 {
	config set DIR $pckg/qt-2.2.1
    }

    namespace eval 2.0 {
	config set DIR $pckg/qt2
        config set DEPEND gui
    }
}


# --------------------------------------------------------------
# QGL (QT's opengl extension)
# --------------------------------------------------------------
namespace eval qgl {

    # current version is integrated in qt (>= 2.2) 
    config set LIBS   {}
    config set DEPEND {qt opengl gui}

    namespace eval 2.0 {
	config set LIBS {qgl}
	config set DEPEND {qt::2.0 opengl gui}
    }
    
    namespace eval 2.2 {
	config set LIBS {}
	config set DEPEND {qt::2.2 opengl gui}
    }
}


# --------------------------------------------------------------
# GLUT
# current version: 3.7beta
# --------------------------------------------------------------

namespace eval glut {

    config set DEPEND { OPENGL }
    config set LIBS {glut}
    switch $LINUX_GRAPHICS {
	nvidia {
	    config set INCPATH $pckg/OpenGL/include
	    config set LIBPATH $pckg/OpenGL/lib
	}
	sgivpro {
	    #   config set INCPATH /usr/include
	    #   config set LIBPATH /usr/lib
	}
	default {
	    config set INCPATH $pckg/glut/include
	    config set LIBPATH $pckg/glut/lib
	}
    }
}

# --------------------------------------------------------------
# GLOW
# --------------------------------------------------------------
namespace eval glow {
    config set INCPATH $pckg/glow/include
    config set LIBPATH $pckg/glow/lib
    config set LIBS {glow}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# GLUI
# --------------------------------------------------------------
namespace eval glui {

    set pckgglui $pckg/glui

    config set INCPATH $pckgglui/include
    config set_lazy LIBPATH [subst -nocommands {
	switch -glob \$::link::LINKER {
	    *icc     {return $pckgglui/lib.icc}
	    default  {return $pckgglui/lib}
	}
    }]
    
    config set LIBS    {glui}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# GLE
# --------------------------------------------------------------
namespace eval gle {
    config set INCPATH $pckg/gle/include
    config set LIBPATH $pckg/gle/lib
    config set LIBS    {gle}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# ACGL
# --------------------------------------------------------------
namespace eval acgl {
    config set INCPATH $pckg/ACGL/include
    config set LIBPATH $pckg/ACGL/lib
    config set LIBS    {acgl}
    config set DEPEND  {opengl}
}

# --------------------------------------------------------------
# LIB3DS - 3D studio import library
# --------------------------------------------------------------
namespace eval lib3ds {
    config set LIBPATH $pckg/lib3ds/lib
    config set INCPATH $pckg/lib3ds/include
    config set LIBS { 3ds }
}


# --------------------------------------------------------------
# TIFF
# --------------------------------------------------------------
namespace eval tiff {
    
    config set LIBPATH $pckg/tiff/lib
    config set INCPATH $pckg/tiff/include 
    config set LIBS    {tiff}

    # patched version
    namespace eval patched {
	config set LIBPATH $pckg/tiff-patched/lib32
	config set INCPATH $pckg/tiff-patched/include 
    }

}

# --------------------------------------------------------------
# PNG
# --------------------------------------------------------------

namespace eval png {
#    config set INCPATH $pckg/libpng/include
#    config set LIBPATH $pckg/libpng/lib
    config set LIBS    {png z}
    config set DEPEND  {zlib}
}

# --------------------------------------------------------------
# JPEG
# --------------------------------------------------------------

namespace eval jpeg {
#    config set INCPATH $pckg/jpeg-6b/include
#    config set LIBPATH $pckg/jpeg-6b/lib
    config set LIBS    {jpeg}
    config set DEPEND  {}
}

# --------------------------------------------------------------
# ZLIB
# --------------------------------------------------------------

namespace eval zlib {
    config set INCPATH      $pckg/zlib/include
    config set LIBPATH      $pckg/zlib/lib
    config set LIBS         {z}
}

# --------------------------------------------------------------
# BZLIB
# --------------------------------------------------------------

namespace eval bzlib {
    config set INCPATH $pckg/bzip2/include
    config set LIBPATH $pckg/bzip2/lib
    config set LIBS    { bz2 }
}

# --------------------------------------------------------------
# LUG
# --------------------------------------------------------------

namespace eval lug {
    config set INCPATH $pckg/lug/include
    config set LIBPATH $pckg/lug/lib
    config set LIBS    {lug}
}

# --------------------------------------------------------------
# flTk
# --------------------------------------------------------------

namespace eval fltk {
  config set DEPEND {gui}
  config set LIBPATH /HPS/opt/lib32
  config set INCPATH /HPS/opt/include
  config set LIBS    {fltk}
}

# --------------------------------------------------------------
# quicktime4linux - reading & writing .mov files
# --------------------------------------------------------------
namespace eval quicktime4linux {
  config set DEPEND {pthread}
  config set LIBPATH $pckg/quicktime/lib
  config set INCPATH $pckg/quicktime/include
  config set LIBS    {quicktime glib}
}

# --------------------------------------------------------------
# OpenCV - Intel's Computer Vision Library
# --------------------------------------------------------------
namespace eval opencv {
  config set DEPEND {ipl}
  config set LIBPATH $pckg/opencv/lib
  config set INCPATH $pckg/opencv/include
  config set LIBS    {opencv}
}

# --------------------------------------------------------------
# IPL - Intel's Image Processing Library
# --------------------------------------------------------------
namespace eval ipl {
  config set DEPEND {}
  config set LIBPATH {}
  config set INCPATH {/usr/include/ipl}
  config set LIBS    {iplpx ipla6 iplm6 }
}

# --------------------------------------------------------------
# ImageMagick C++ 
# --------------------------------------------------------------
namespace eval magick++ {
    config set DEPEND {}
    config set LIBPATH $pckg/ImageMagick/lib
    config set INCPATH $pckg/ImageMagick/include
    config set LIBS   {Magick}
    config set DEPEND {Magick}
}

# --------------------------------------------------------------
# ImageMagick  
# --------------------------------------------------------------
namespace eval magick {
    #    config set DEPEND {pthread}
    config set LIBPATH $pckg/ImageMagick/lib
    config set INCPATH $pckg/ImageMagick/include
    config set LIBS    {Magick}
}

# --------------------------------------------------------------
# TCL 
# --------------------------------------------------------------
namespace eval tcl {
  config set DEPEND {}
  config set LIBPATH $pckg/tcl8.4a1/lib
  config set INCPATH $pckg/tcl8.4a1/include
  config set LIBS    {tcl8.4}
}

# --------------------------------------------------------------
# TK 
# --------------------------------------------------------------
namespace eval tk {
  config set DEPEND {tcl}
  config set LIBPATH $pckg/tk8.4a1/lib
  config set INCPATH $pckg/tk8.4a1/include
  config set LIBS    {tk8.4}
}

# --------------------------------------------------------------
# POSIX threads
# --------------------------------------------------------------

namespace eval pthread {
    config set LIBS {}
}

# --------------------------------------------------------------
# Math library (includes should be set automatically)
# --------------------------------------------------------------
namespace eval math {
    config set LIBS {}
}

# --------------------------------------------------------------
# NVIDIA Cg 'C for graphics' toolkit 
# --------------------------------------------------------------

namespace eval cg {
    config set INCPATH $pckg/Cg/include
    config set LIBPATH $pckg/Cg/lib
    config set LIBS    { CgGL Cg  }
    config set DEPEND  { opengl math }
}

# --------------------------------------------------------------
# Fortran->C Compiler
# --------------------------------------------------------------

namespace eval f2c {
    # What is the right way to do this???
    config set INCPATH $pckg/f2c/include
    config set LIBPATH $pckg/f2c/lib
    config set LIBS    { f2c }
}

# --------------------------------------------------------------
# CLAPACK/CBLAS
# --------------------------------------------------------------

namespace eval clapack {
    config set INCPATH $pckg/CLAPACK/include
    config set LIBPATH $pckg/CLAPACK/lib
    config set LIBS    { cblas clapack F77 I77 } 
    config set DEPEND  { math }

    #
    # NOTE: This might interfere with f2c!!! Not tested!
    #
}

#----------------------------------------
# Metis graph partitioning
#----------------------------------------

namespace eval metis {
    config set INCPATH $pckg/metis/include
    config set LIBPATH $pckg/metis/lib
    config set LIBS    { metis } 
    config set DEPEND  { math }
}

#----------------------------------------
# TAUCS sparse linear solvers
#----------------------------------------

namespace eval taucs {
    config set INCPATH $pckg/taucs/include
    config set LIBPATH $pckg/taucs/lib
    config set LIBS    { taucs blas clapack } 
    #removed g2c
    config set DEPEND  { math metis }

    # note: BLAS is installed in /usr/lib for Debian3.0 and IRIX
}

#----------------------------------------
# J.R. Shewchuk's triangle library/binaries 
# http://www-2.cs.cmu.edu/~quake/triangle.html
#----------------------------------------

namespace eval triangle {
    config set INCPATH $pckg/triangle/include
    config set LIBPATH $pckg/triangle/lib
    config set LIBS    { triangle } 
}


# --------------------------------------------------------------
# Various stuff
# --------------------------------------------------------------
config set g::PCCTS         $pckg/pccts
config set purify::PURIFY   /opt/pure/purify-4.1-irix6/purify
catch {config set doxygen::DOXYGEN [exec which doxygen]}

# we don't have NASM installed - don't use MMX
config set USE_MMX 0

# we don't have pgcc installed
lremove cxx::COMPILERS pgcc
lremove c::COMPILERS   pgcc

# --------------------------------------------------------------
# Digital Media Software Development Kit by SGI
# --------------------------------------------------------------

namespace eval dmsdk {
    config set INCPATH /HPS/projects/medusa/dmsdk/linux/root/usr/include
    config set LIBPATH /HPS/projects/medusa/dmsdk/linux/root/usr/lib
    config set LIBS    {dmutil dmsdk}
}


#
# ghost 
# 
namespace eval ghost {
    if { $HOST eq "potassium" } {
	if { $::cxx::COMPILER ne "gcc" || $::cxx::gcc::VERSION ne "2.96" } {
	    puts stderr "*****************************************************************"
	    puts stderr "Error: GHOST SDK can only be used with GNU compiler version 2.96"
	    puts stderr "       please set PATH variable to /HPS/opt/pckg/gcc-2.96/usr/bin"
	    puts stderr "       and re-configure tmk !!!"
	    puts stderr "*****************************************************************"
	    if { $HOST ne "samarium" } {
		exit 1
	    }
	}
    }
    config set INCPATH /HPS/opt/pckg/GHOST/usr/include/GHOST
    config set LIBPATH /HPS/opt/pckg/GHOST/usr/lib
    config set LIBS {
	PHANToMIO	
	ghost	
	rt
	dl
    }
    config set DEPEND { pthread }
}

namespace eval ghost_gl {
    config set LIBS { ghostGL ghostGLDraw gstVRML ghostGLManager ghostGLUTManager }
    config set DEPEND { ghost glut X11 }
}

namespace eval ghost_hapticview {
    config set LIBS { widgets-sgi Xm HapticView reset_screen quit pmouseComClient STIComServer }
    config set DEPEND {ghost_gl}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted support/tmk/config/site/mpi-sb.mpg.de_confdir/linux.debian3.0.config.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# -*-Mode: tcl -*-
# $Id: linux.debian3.0.config,v 1.8 2005/04/23 20:53:58 yamauchih Exp $
# site config file, Max-Planck-Institut f-Ar Informatik, AG4$)B
# Debian3.0, gcc 3.2 or more 
#
assert {![string compare $OS   "Linux"]}
assert {![string compare $ARCH "Debian3.0"]}
dbg_msg "reading : [info script]" 1

# directories in which tmk should NOT check dependencies
config set DEPEND_EXCLUDE {
    /usr/include/* 
    /HPS/opt/* 
    /opt/* 
    /usr/X11R6/*
    /usr/*
}

set pckg "/HPS/opt/pckg"

namespace eval gcc3modules {
    config set INCPATH {/usr/gcc-3.2/usr/include}
    config set LIBPATH {/usr/gcc-3.2/usr/lib}
}

# --------------------------------------------------------------
# X11 (default)
# --------------------------------------------------------------

namespace eval x11 {
    config set INCPATH /usr/X11R6/include
    config set LIBPATH /usr/X11R6/lib
    config set BINDIR  /usr/X11R6/bin
    config set LIBS   {Xt Xi Xext Xmu X11}
}

# --------------------------------------------------------------
# MOTIF
# --------------------------------------------------------------
namespace eval motif {
    config set LIBS {Xm}
    config set DEPEND {x11}
}

# --------------------------------------------------------------
# DGA (direct gfx access) - only on solaris !
# --------------------------------------------------------------
namespace eval dga {
    config set LIBPATH {}
    config set LIBS   {}
}

# --------------------------------------------------------------
# OpenGL 
# --------------------------------------------------------------
namespace eval opengl {

    config set INCPATH {}
    config set LIBPATH {}
    config set LIBS { GLU GL }
    config set DEPEND { dga x11 }
}

# --------------------------------------------------------------
# OpenInventor
# --------------------------------------------------------------
namespace eval inventor {
    config set LIBS   {Inventor}
    config set DEPEND {opengl gcc3modules}
}

namespace eval inventorxt {
  config set LIBS {InventorXt}
  config set DEPEND {Inventor}
}
   

# --------------------------------------------------------------
# QT 
# --------------------------------------------------------------

namespace eval qt {
    
    # current version 
    config set DEFS   {QT_CLEAN_NAMESPACE} ; # avoids name conflicts
    config set LIBS   {qt}
    config set DEPEND {gui opengl}
    config set DIR     /usr/gcc-3.2/usr
    config set INCPATH /usr/gcc-3.2/usr/include/qt
    config set LIBPATH /usr/gcc-3.2/usr/lib


    # multi-threaded current version
    namespace eval mt {
	config set DEFS   {QT_THREAD_SUPPORT}
	config set LIBS   {qt-mt}
    }
}


# --------------------------------------------------------------
# QGL (QT's opengl extension)
# --------------------------------------------------------------

namespace eval qgl {
    # current version is integrated in qt (>= 2.2) 
    config set DEPEND {qt}
}


# --------------------------------------------------------------
# GLUT
# current version: 3.7beta
# --------------------------------------------------------------

namespace eval glut {

    config set DEPEND { opengl }
    config set LIBS   { glut }
}

# --------------------------------------------------------------
# GLOW
# --------------------------------------------------------------
namespace eval glow {
    config set LIBS {glow}
    config set DEPEND  {glut gcc3modules}
}

# --------------------------------------------------------------
# GLUI
# --------------------------------------------------------------
namespace eval glui {
    config set LIBS    {glui}
    config set DEPEND  {glut gcc3modules}
}


# --------------------------------------------------------------
# LIB3DS - 3D studio import library
# --------------------------------------------------------------
namespace eval lib3ds {
    config set LIBS { 3ds }
}


# --------------------------------------------------------------
# TIFF
# --------------------------------------------------------------
namespace eval tiff {
    config set LIBS    {tiff}
}

# --------------------------------------------------------------
# OpenEXR
# --------------------------------------------------------------
namespace eval openexr {
    config set LIBPATH {/usr/gcc-3.2/usr/lib}
    config set INCPATH {/usr/gcc-3.2/usr/include/OpenEXR}
    config set LIBS    {Imath IlmImf Iex Half }
    config set DEPEND  {zlib}
}

# --------------------------------------------------------------
# PNG
# --------------------------------------------------------------
namespace eval png {
    config set LIBS    {png}
    config set DEPEND  {zlib}
}

# --------------------------------------------------------------
# JPEG
# --------------------------------------------------------------
namespace eval jpeg {
    config set LIBS    {jpeg}
}

# --------------------------------------------------------------
# ZLIB
# --------------------------------------------------------------
namespace eval zlib {
    config set LIBS         {z}
}

# --------------------------------------------------------------
# BZLIB
# --------------------------------------------------------------

namespace eval bzlib {
    config set LIBS    { bz2 }
}


# --------------------------------------------------------------
# flTk
# --------------------------------------------------------------

namespace eval fltk {
  config set DEPEND {gui gcc3modules}
  config set LIBS    {fltk}
}


# --------------------------------------------------------------
# OpenCV - Intel's Computer Vision Library
# --------------------------------------------------------------
namespace eval opencv {
  config set DEPEND {ipl gcc3modules}
  config set LIBS   {opencv}
}

# --------------------------------------------------------------
# IPL - Intel's Image Processing Library
# --------------------------------------------------------------
namespace eval ipl {
  config set DEPEND {}
  config set LIBPATH {}
  config set INCPATH {/usr/include/ipl}
  config set LIBS    {iplpx ipla6 iplm6 }
}

# --------------------------------------------------------------
# ImageMagick C++ 
# --------------------------------------------------------------
namespace eval magick++ {
    config set DEPEND {gcc3modules }
    config set LIBS   {Magick++}
}

# --------------------------------------------------------------
# ImageMagick  
# --------------------------------------------------------------
namespace eval magick {
   config set DEPEND {pthread gcc3modules}
   config set LIBS    {Magick}
}

# --------------------------------------------------------------
# TCL 
# --------------------------------------------------------------
namespace eval tcl {
    config set LIBPATH {/HPS/opt/pckg/tcl8.4.8/lib}
    config set INCPATH {/HPS/opt/pckg/tcl8.4.8/include}
    config set DEPEND {}
    config set LIBS    {tcl8.4}
}

# --------------------------------------------------------------
# TK 
# --------------------------------------------------------------
namespace eval tk {
    config set DEPEND {tcl}
    config set LIBS    {tk8.4}
}

# --------------------------------------------------------------
# POSIX threads
# --------------------------------------------------------------

namespace eval pthread {
    config set LIBS {pthread}
}

# --------------------------------------------------------------
# Math library (includes should be set automatically)
# --------------------------------------------------------------
config set math::LIBS {m}

# --------------------------------------------------------------
# NVIDIA Cg 'C for graphics' toolkit 
# --------------------------------------------------------------

namespace eval cg {
    config set INCPATH $pckg/Cg/include
    config set LIBPATH $pckg/Cg/lib
    config set LIBS    { CgGL Cg  }
    config set DEPEND  { opengl math }
}

# --------------------------------------------------------------
# Fortran->C Compiler
# --------------------------------------------------------------

namespace eval f2c {
    # What is the right way to do this???
    config set INCPATH $pckg/f2c/include
    config set LIBPATH $pckg/f2c/lib
    config set LIBS    { f2c }
}

# --------------------------------------------------------------
# CLAPACK/CBLAS
# --------------------------------------------------------------

namespace eval clapack {
    config set INCPATH $pckg/CLAPACK/include
    config set LIBPATH $pckg/CLAPACK/lib
    config set LIBS    { cblas clapack F77 I77 } 
    config set DEPEND  { math }

    #
    # NOTE: This might interfere with f2c!!! Not tested!
    #
}

#----------------------------------------
# Metis graph partitioning
#----------------------------------------

namespace eval metis {
    config set INCPATH $pckg/metis/include
    config set LIBPATH $pckg/metis/lib
    config set LIBS    { metis } 
    config set DEPEND  { math }
}

#----------------------------------------
# TAUCS sparse linear solvers
#----------------------------------------

namespace eval taucs {
    config set INCPATH $pckg/taucs/include
    config set LIBPATH $pckg/taucs/lib
    config set LIBS    { taucs blas clapack g2c } 
    config set DEPEND  { math metis }

    # note: BLAS is installed in /usr/lib for Debian3.0 and IRIX
}

#----------------------------------------
# J.R. Shewchuk's triangle library/binaries 
# http://www-2.cs.cmu.edu/~quake/triangle.html
#----------------------------------------

namespace eval triangle {
    config set INCPATH $pckg/triangle/include
    config set LIBPATH $pckg/triangle/lib
    config set LIBS    { triangle } 
}


# --------------------------------------------------------------
# Various stuff
# --------------------------------------------------------------
config set g::PCCTS         $pckg/pccts
config set purify::PURIFY   /opt/pure/purify-4.1-irix6/purify
catch {config set doxygen::DOXYGEN [exec which doxygen]}

# we don't have NASM installed - don't use MMX
config set USE_MMX 0

# we don't have pgcc installed
lremove cxx::COMPILERS pgcc
lremove c::COMPILERS   pgcc

# --------------------------------------------------------------
# Digital Media Software Development Kit by SGI
# --------------------------------------------------------------

namespace eval dmsdk {
    config set INCPATH /HPS/projects/medusa/dmsdk/linux/root/usr/include
    config set LIBPATH /HPS/projects/medusa/dmsdk/linux/root/usr/lib
    config set LIBS    {dmutil dmsdk}
}


# --------------------------------------------------------------
# readline 
# --------------------------------------------------------------

namespace eval readline {
    # config set INCPATH {} # it is in /usr/include, no need to put.
    # config set LIBPATH {} # it is in /usr/lib,     no need to put.
    config set LIBS {readline}
}

# --------------------------------------------------------------
# doxygen 
# --------------------------------------------------------------
namespace eval doxygen {
    # accept_version (accept --version) is more than 1.3?
    config set DOXYGEN_VERSION "accept_version"
}
    
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































































































































































































































































































































































































































































































Deleted support/tmk/config/site/mpi-sb.mpg.de_confdir/linux.debian3.1-opteron-64bit.config.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
# -*-Mode: tcl -*-
# $Id: linux.debian3.1-opteron-64bit.config,v 1.8 2007/01/12 00:35:01 yamauchih Exp $
# site config file, Max-Planck-Institut f"ur Informatik, AG4
# Debian3.1, Sarge, opteron, 64bit mode
#
assert {![string compare $OS        "Linux"]}
assert {![string compare $ARCH      "Debian3.1"]}
assert {![string compare [ ::tmk::get_runmodestat "addressmode" ] "64bit"]}
dbg_msg "reading : [info script]" 1

if { $CPU != "opteron" } {
    log_msg "******************************************************************"
    log_msg "** Error! : this configuration (64bit) supposes an opteron machine."
    log_msg "** Try to configure tmk, however, it may not work."
    log_msg "******************************************************************"
}


# directories in which tmk should NOT check dependencies
config set DEPEND_EXCLUDE {
    /usr/include/* 
    /HPS/opt/* 
    /opt/* 
    /usr/X11R6/*
    /usr/*
}

set pckg "/HPS/opt/pckg"

# --------------------------------------------------------------
# X11 (default)
# --------------------------------------------------------------
namespace eval x11 {
    config set INCPATH {/amd64/usr/X11R6/include}
    config set LIBPATH {/amd64/usr/X11R6/lib}
    config set BINDIR  {/usr/X11R6/bin}
    config set LIBS    {Xt Xi Xext Xmu X11}
}

# --------------------------------------------------------------
# MOTIF
# --------------------------------------------------------------
namespace eval motif {
    config set LIBS    {Xm}
    config set LIBPATH {/amd64/usr/X11R6/lib}
    config set DEPEND  {x11}
}

# --------------------------------------------------------------
# DGA (direct gfx access) - only on solaris !
# --------------------------------------------------------------
namespace eval dga {
    config set LIBPATH {}
    config set LIBS    {}
}

# --------------------------------------------------------------
# OpenGL 
# --------------------------------------------------------------
namespace eval opengl {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS { GLU GL }
    config set DEPEND { dga x11 }
}

# --------------------------------------------------------------
# OpenInventor
# --------------------------------------------------------------
namespace eval inventor {
    config set LIBS   {Inventor}
    config set DEPEND {opengl}
}

namespace eval inventorxt {
  config set LIBS {InventorXt}
  config set DEPEND {Inventor}
}
   

# --------------------------------------------------------------
# QT 
# --------------------------------------------------------------
namespace eval qt {
    # current version 
    config set DEFS   {QT_CLEAN_NAMESPACE} ; # avoids name conflicts
    # can not find libqt.so (instead of libqt.so.3)
    config set LIBS   {qt-mt}
    config set DEPEND {gui opengl}
    config set DIR     {/amd64/usr} 
    config set INCPATH {/amd64/usr/include/qt3}
    config set LIBPATH {/amd64/usr/lib}

    # multi-threaded current version
    namespace eval mt {
	config set DEFS   {QT_THREAD_SUPPORT}
	config set LIBS   {qt-mt}
    }
}


# --------------------------------------------------------------
# QGL (QT's opengl extension)
# --------------------------------------------------------------
namespace eval qgl {
    # current version is integrated in qt (>= 2.2) 
    config set DEPEND {qt}
}


# --------------------------------------------------------------
# QT 4
# Usually you need { qt4 qt4qtcore }
# --------------------------------------------------------------
namespace eval qt4 {
    config set DIR      /HPS/opt/pckg/Qt4_64
    config set INCPATH  { /HPS/opt/pckg/Qt4_64/include }
    config set LIBPATH  /HPS/opt/pckg/Qt4_64/lib
}

namespace eval qt4qtcore {
    config set INCPATH  { /HPS/opt/pckg/Qt4_64/include/QtCore /HPS/opt/pckg/Qt4_64/include/Qt }
    config set LIBS   { QtCore }
    config set DEPEND {qt4}
}

#
# new qt feature, modules
#
namespace eval qt4activeqt {
    config set INCPATH { /HPS/opt/pckg/Qt4_64/include/ActiveQt }
    config set LIBS   {QtGui}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qt3support {
    config set INCPATH { /HPS/opt/pckg/Qt4_64/include/Qt3Support }
    config set LIBS   {Qt3Support}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtgui {
    config set INCPATH { /HPS/opt/pckg/Qt4_64/include/QtGui }
    config set LIBS   {QtGui}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtopengl {
    config set INCPATH { /HPS/opt/pckg/Qt4_64/include/QtOpenGL }
    config set LIBS   {QtOpenGL}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtsvg {
    config set INCPATH { /HPS/opt/pckg/Qt4_64/include/QtSvg }
    config set LIBS   {QtSvg}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtuitools {
    config set INCPATH { /HPS/opt/pckg/Qt4_64/include/QtUiTools }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtassistant {
    config set INCPATH { /HPS/opt/pckg/Qt4_64/include/QtAssistant }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtdesigner {
    config set INCPATH { /HPS/opt/pckg/Qt4_64/include/QtDesigner }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtnetwork {
    config set INCPATH { /HPS/opt/pckg/Qt4_64/include/QtNetwork }
    config set LIBS   {QtNetwork}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtsql {
    config set INCPATH { /HPS/opt/pckg/Qt4_64/include/QtSql }
    config set LIBS   {QtSql}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qttest {
    config set INCPATH { /HPS/opt/pckg/Qt4_64/include/QtTest }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtxml {
    config set INCPATH { /HPS/opt/pckg/Qt4_64/include/QtXml }
    config set LIBS   {QtXml}
    config set DEPEND {qt4qtcore}
}

# namespace eval qt3support {
#     config set DIR    /HPS/opt/pckg/Qt4_64
#     config set INCPATH        /HPS/opt/pckg/Qt4_64/include
#     config set LIBPATH        /HPS/opt/pckg/Qt4_64/lib
#     config set DEFS   {QT3_SUPPORT} ;
# }



# --------------------------------------------------------------
# GLUT
# current version: 3.7beta
# --------------------------------------------------------------
namespace eval glut {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set DEPEND { opengl }
    config set LIBS   { glut }
}

# --------------------------------------------------------------
# GLOW
# --------------------------------------------------------------
namespace eval glow {
    config set LIBS {glow}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# GLUI
# --------------------------------------------------------------
namespace eval glui {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS    {glui}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# LIB3DS - 3D studio import library
# --------------------------------------------------------------
namespace eval lib3ds {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS { 3ds }
}

# --------------------------------------------------------------
# TIFF
# --------------------------------------------------------------
namespace eval tiff {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS    {tiff}
}

# --------------------------------------------------------------
# OpenEXR
# --------------------------------------------------------------
namespace eval openexr {
    config set LIBPATH {/usr/lib}
    config set INCPATH {/usr/include/OpenEXR}
    config set LIBS    {Imath IlmImf Iex Half }
    config set DEPEND  {zlib}
}

# --------------------------------------------------------------
# PNG
# --------------------------------------------------------------
namespace eval png {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS    {png}
    config set DEPEND  {zlib}
}

# --------------------------------------------------------------
# JPEG
# --------------------------------------------------------------
namespace eval jpeg {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS    {jpeg}
}

# --------------------------------------------------------------
# ZLIB
# --------------------------------------------------------------
namespace eval zlib {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS    {z}
}

# --------------------------------------------------------------
# BZLIB
# --------------------------------------------------------------
namespace eval bzlib {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS    { bz2 }
}

# --------------------------------------------------------------
# flTk
# --------------------------------------------------------------
namespace eval fltk {
    config set DEPEND {gui }
    config set LIBS   {fltk}
}


# --------------------------------------------------------------
# OpenCV - Intel's Computer Vision Library
# --------------------------------------------------------------
namespace eval opencv {
    config set DEPEND {ipl }
    config set LIBS   {opencv}
}

# --------------------------------------------------------------
# IPL - Intel's Image Processing Library
# --------------------------------------------------------------
namespace eval ipl {
  config set DEPEND {}
  config set LIBPATH {}
  config set INCPATH {/usr/include/ipl}
  config set LIBS    {iplpx ipla6 iplm6 }
}

# --------------------------------------------------------------
# ImageMagick C++ 
# --------------------------------------------------------------
namespace eval magick++ {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS   {Magick++}
}

# --------------------------------------------------------------
# ImageMagick  
# --------------------------------------------------------------
namespace eval magick {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set DEPEND { pthread }
    config set LIBS    {Magick}
}

# --------------------------------------------------------------
# TCL 
# --------------------------------------------------------------
namespace eval tcl {
    config set INCPATH {/amd64/usr/include/tcl8.4}
    config set LIBPATH {/amd64/usr/lib}
    config set DEPEND {}
    config set LIBS    {tcl8.4}
}

# --------------------------------------------------------------
# TK 
# --------------------------------------------------------------
namespace eval tk {
    config set INCPATH {/amd64/usr/include/tcl8.4}
    config set LIBPATH {/amd64/usr/lib}
    config set DEPEND {tcl}
    config set LIBS    {tk8.4}
}

# --------------------------------------------------------------
# POSIX threads
# --------------------------------------------------------------
namespace eval pthread {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}    
    config set LIBS {pthread}
}

# --------------------------------------------------------------
# Math library (includes should be set automatically)
# --------------------------------------------------------------
namespace eval math {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}    
    config set LIBS {m}
}

# --------------------------------------------------------------
# NVIDIA Cg 'C for graphics' toolkit 
# --------------------------------------------------------------
namespace eval cg {
    config set INCPATH $pckg/Cg/include
    config set LIBPATH $pckg/Cg/lib
    config set LIBS    { CgGL Cg  }
    config set DEPEND  { opengl math }
}

# --------------------------------------------------------------
# Fortran->C Compiler 
# --------------------------------------------------------------
namespace eval f2c {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}    
    config set LIBS    { f2c }
}

# --------------------------------------------------------------
# (C)LAPACK/(C)BLAS -> ATLAS. 
# clapack may be obsolete, please use the module name lapack.
# --------------------------------------------------------------
namespace eval clapack {   
    config set LIBPATH /usr/lib/atlas/
    config set LIBS    { blas lapack } 
    config set DEPEND  { math }
}

# --------------------------------------------------------------
# ATLAS LAPACK/BLAS
# --------------------------------------------------------------
namespace eval lapack {   
    config set LIBPATH /usr/lib/atlas/
    config set LIBS    { blas lapack } 
    config set DEPEND  { math }
}

#----------------------------------------
# Metis graph partitioning
#----------------------------------------
namespace eval metis {
    config set INCPATH $pckg/metis/include
    config set LIBPATH $pckg/metis/lib
    config set LIBS    { metis } 
    config set DEPEND  { math }
}

#----------------------------------------
# TAUCS sparse linear solvers
#----------------------------------------
namespace eval taucs {
    config set INCPATH $pckg/taucs/include
    config set LIBPATH $pckg/taucs/lib
    config set LIBS    { taucs } 
    config set DEPEND  { math metis clapack }
}

#----------------------------------------
# J.R. Shewchuk's triangle library/binaries 
# http://www-2.cs.cmu.edu/~quake/triangle.html
#----------------------------------------
namespace eval triangle {
    config set INCPATH $pckg/triangle/include
    config set LIBPATH $pckg/triangle/lib
    config set LIBS    { triangle } 
}


# --------------------------------------------------------------
# Various stuff
# --------------------------------------------------------------
config set g::PCCTS         $pckg/pccts
config set purify::PURIFY   /opt/pure/purify-4.1-irix6/purify
catch {config set doxygen::DOXYGEN [exec which doxygen]}

# we don't have NASM installed - don't use MMX
config set USE_MMX 0

# we don't have pgcc installed
lremove cxx::COMPILERS pgcc
lremove c::COMPILERS   pgcc

# --------------------------------------------------------------
# Digital Media Software Development Kit by SGI
# --------------------------------------------------------------

namespace eval dmsdk {
    config set INCPATH /HPS/projects/medusa/dmsdk/linux/root/usr/include
    config set LIBPATH /HPS/projects/medusa/dmsdk/linux/root/usr/lib
    config set LIBS    {dmutil dmsdk}
}

# --------------------------------------------------------------
# readline 
# --------------------------------------------------------------

namespace eval readline {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}    
    config set LIBS {readline}
}

# --------------------------------------------------------------
# doxygen 
# --------------------------------------------------------------
namespace eval doxygen {
    # accept_version (accept --version) is more than 1.3?
    config set DOXYGEN_VERSION "accept_version"
}

# --------------------------------------------------------------
# add gcc options
# --------------------------------------------------------------
namespace eval ::cxx::gcc {
    # add 64bit option 
    if { [ string compare "g++-3.4" [ file tail $EXECUTABLE ] ] != 0 } {
	log_msg "******************************************************************"
	log_msg "****** !!WARNING!! EXECUTABLE = $EXECUTABLE"
	log_msg "****** Found gcc executable at /usr/bin/g++."
	log_msg "****** This compiler may not for 64 bit. Please check your path."
	log_msg "****** Assuming /amd64/usr/bin/g++-3.4. "
	log_msg "****** !!WARNING!!"
	log_msg "******************************************************************"
    }
}

namespace eval ::c::gcc {
    # add 64bit option 
    if { [ string compare "gcc-3.4" [ file tail $EXECUTABLE ] ] != 0 } {
	log_msg "******************************************************************"
	log_msg "****** !!WARNING!! EXECUTABLE = $EXECUTABLE"
	log_msg "****** Found gcc executable at /usr/bin/gcc."
	log_msg "****** This compiler may not for 64 bit. Please check your path."
	log_msg "****** Assuming /amd64/usr/bin/gcc-3.4. "
	log_msg "****** !!WARNING!!"
	log_msg "******************************************************************"
    }
}

# --------------------------------------------------------------
# ANN: Approximate Nearest Neighbor Searching
#      http://www.cs.umd.edu/~mount/ANN/
# --------------------------------------------------------------
# namespace eval ann {
#     config set INCPATH ${pckg}/ann/include
#     config set LIBPATH ${pckg}/ann/lib
#     config set LIBS    { ANN }
# }

# --------------------------------------------------------------
# Ruby
# --------------------------------------------------------------
namespace eval ruby {
    config set INCPATH {/usr/lib/ruby/1.8/i386-linux}
    config set DEPEND  {}
    config set LIBS    {ruby1.8}
}	    
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted support/tmk/config/site/mpi-sb.mpg.de_confdir/linux.debian3.1.config.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
# -*-Mode: tcl -*-
# $Id: linux.debian3.1.config,v 1.21 2008/04/21 12:04:08 cfuchs_sf Exp $
# site config file, Max-Planck-Institut f"ur Informatik, AG4
# Debian3.1, Sarge
#
assert {![string compare $OS   "Linux"]}
assert {![string compare $ARCH "Debian3.1"]}
dbg_msg "reading : [info script]" 1

# directories in which tmk should NOT check dependencies
config set DEPEND_EXCLUDE {
    /usr/include/* 
    /HPS/opt/* 
    /opt/* 
    /usr/X11R6/*
    /usr/*
}

set pckg "/HPS/opt/pckg"

# --------------------------------------------------------------
# X11 (default)
# --------------------------------------------------------------
namespace eval x11 {
    config set INCPATH /usr/X11R6/include
    config set LIBPATH /usr/X11R6/lib
    config set BINDIR  /usr/X11R6/bin
    config set LIBS   {Xt Xi Xext Xmu X11}
}

# --------------------------------------------------------------
# MOTIF
# --------------------------------------------------------------
namespace eval motif {
    config set LIBS   {Xm}
    config set DEPEND {x11}
}

# --------------------------------------------------------------
# DGA (direct gfx access) - only on solaris !
# --------------------------------------------------------------
namespace eval dga {
    config set LIBPATH {}
    config set LIBS    {}
}

# --------------------------------------------------------------
# OpenGL 
# --------------------------------------------------------------
namespace eval opengl {
    config set INCPATH {}
    config set LIBPATH {}
    config set LIBS { GLU GL }
    config set DEPEND { dga x11 }
}

# --------------------------------------------------------------
# OpenInventor
# --------------------------------------------------------------
namespace eval inventor {
    config set LIBS   {Inventor}
    config set DEPEND {opengl}
}

namespace eval inventorxt {
  config set LIBS {InventorXt}
  config set DEPEND {Inventor}
}
   

# --------------------------------------------------------------
# QT 
# --------------------------------------------------------------
namespace eval qt {
    # current version 
    config set DEFS   {QT_CLEAN_NAMESPACE} ; # avoids name conflicts
    # can not find libqt.so (instead of libqt.so.3)
    config set LIBS   {qt-mt}
    config set DEPEND {gui opengl}
    config set DIR     /usr
    config set INCPATH /usr/include/qt3
    config set LIBPATH /usr/lib

    # multi-threaded current version
    namespace eval mt {
	config set DEFS   {QT_THREAD_SUPPORT}
	config set LIBS   {qt-mt}
    }
}


# --------------------------------------------------------------
# QGL (QT's opengl extension)
# --------------------------------------------------------------
namespace eval qgl {
    # current version is integrated in qt (>= 2.2) 
    config set DEPEND {qt}
}

# --------------------------------------------------------------
# QT 4
# Usually you need { qt4 qt4qtcore }
# --------------------------------------------------------------
namespace eval qt4 {
    config set DIR      /HPS/opt/pckg/Qt4
    config set INCPATH  { /HPS/opt/pckg/Qt4/include }
    config set LIBPATH  /HPS/opt/pckg/Qt4/lib
}

namespace eval qt4qtcore {
    config set INCPATH  { /HPS/opt/pckg/Qt4/include/QtCore /HPS/opt/pckg/Qt4/include/Qt }
    config set LIBS   { QtCore }
    config set DEPEND {qt4}
}

#
# new qt feature, modules
#
namespace eval qt4qtactiveqt {
    config set INCPATH { /HPS/opt/pckg/Qt4/include/ActiveQt }
    config set LIBS   {QtGui}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qt3support {
    config set INCPATH { /HPS/opt/pckg/Qt4/include/Qt3Support }
    config set LIBS   {Qt3Support}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtgui {
    config set INCPATH { /HPS/opt/pckg/Qt4/include/QtGui }
    config set LIBS   {QtGui}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtopengl {
    config set INCPATH { /HPS/opt/pckg/Qt4/include/QtOpenGL }
    config set LIBS   {QtOpenGL}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtsvg {
    config set INCPATH { /HPS/opt/pckg/Qt4/include/QtSvg }
    config set LIBS   {QtSvg}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtuitools {
    config set INCPATH { /HPS/opt/pckg/Qt4/include/QtUiTools }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtassistant {
    config set INCPATH { /HPS/opt/pckg/Qt4/include/QtAssistant }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtdesigner {
    config set INCPATH { /HPS/opt/pckg/Qt4/include/QtDesigner }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtnetwork {
    config set INCPATH { /HPS/opt/pckg/Qt4/include/QtNetwork }
    config set LIBS   {QtNetwork}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtsql {
    config set INCPATH { /HPS/opt/pckg/Qt4/include/QtSql }
    config set LIBS   {QtSql}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qttest {
    config set INCPATH { /HPS/opt/pckg/Qt4/include/QtTest }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtxml {
    config set INCPATH { /HPS/opt/pckg/Qt4/include/QtXml }
    config set LIBS   {QtXml}
    config set DEPEND {qt4qtcore}
}

# namespace eval qt3support {
#     config set DIR    /HPS/opt/pckg/Qt4
#     config set INCPATH        /HPS/opt/pckg/Qt4/include
#     config set LIBPATH        /HPS/opt/pckg/Qt4/lib
#     config set DEFS   {QT3_SUPPORT} ;
# }

# --------------------------------------------------------------
# GLUT
# current version: 3.7beta
# --------------------------------------------------------------
namespace eval glut {
    config set DEPEND { opengl }
    config set LIBS   { glut }
}

# --------------------------------------------------------------
# GLOW
# --------------------------------------------------------------
namespace eval glow {
    config set LIBS {glow}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# GLUI
# --------------------------------------------------------------
namespace eval glui {
    config set LIBS    {glui}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# LIB3DS - 3D studio import library
# --------------------------------------------------------------
namespace eval lib3ds {
    config set LIBS { 3ds }
}

# --------------------------------------------------------------
# TIFF
# --------------------------------------------------------------
namespace eval tiff {
    config set LIBS    {tiff}
}

# --------------------------------------------------------------
# OpenEXR
# --------------------------------------------------------------
namespace eval openexr {
    config set LIBPATH {/usr/lib}
    config set INCPATH {/usr/include/OpenEXR}
    config set LIBS    {Imath IlmImf Iex Half }
    config set DEPEND  {zlib}
}

# --------------------------------------------------------------
# PNG
# --------------------------------------------------------------
namespace eval png {
    config set LIBS    {png}
    config set DEPEND  {zlib}
}

# --------------------------------------------------------------
# JPEG
# --------------------------------------------------------------
namespace eval jpeg {
    config set LIBS    {jpeg}
}

# --------------------------------------------------------------
# ZLIB
# --------------------------------------------------------------
namespace eval zlib {
    config set LIBS         {z}
}

# --------------------------------------------------------------
# BZLIB
# --------------------------------------------------------------
namespace eval bzlib {
    config set LIBS    { bz2 }
}

# --------------------------------------------------------------
# flTk
# --------------------------------------------------------------
namespace eval fltk {
    config set DEPEND {gui }
    config set LIBS   {fltk}
}


# --------------------------------------------------------------
# OpenCV - Intel's Computer Vision Library
# --------------------------------------------------------------
namespace eval opencv {
    config set DEPEND {ipl }
    config set LIBS   {opencv}
}

# --------------------------------------------------------------
# IPL - Intel's Image Processing Library
# --------------------------------------------------------------
namespace eval ipl {
  config set DEPEND {}
  config set LIBPATH {}
  config set INCPATH {/usr/include/ipl}
  config set LIBS    {iplpx ipla6 iplm6 }
}

# --------------------------------------------------------------
# ImageMagick C++ 
# --------------------------------------------------------------
namespace eval magick++ {
    config set LIBS   {Magick++}
}

# --------------------------------------------------------------
# ImageMagick  
# --------------------------------------------------------------
namespace eval magick {
    config set DEPEND { pthread }
    config set LIBS    {Magick}
}

# --------------------------------------------------------------
# TCL 
# --------------------------------------------------------------
namespace eval tcl {
  config set INCPATH {/usr/include/tcl8.4}
  config set DEPEND {}
  config set LIBS    {tcl8.4}
}

# --------------------------------------------------------------
# TK 
# --------------------------------------------------------------
namespace eval tk {
  config set INCPATH {/usr/include/tcl8.4}
  config set DEPEND {tcl}
  config set LIBS    {tk8.4}
}

# --------------------------------------------------------------
# POSIX threads
# --------------------------------------------------------------
namespace eval pthread {
    config set LIBS {pthread}
}

# --------------------------------------------------------------
# Math library (includes should be set automatically)
# --------------------------------------------------------------
config set math::LIBS {m}

# --------------------------------------------------------------
# NVIDIA Cg 'C for graphics' toolkit 
# --------------------------------------------------------------
namespace eval cg {
    config set INCPATH $pckg/Cg/include
    config set LIBPATH $pckg/Cg/lib
    config set LIBS    { CgGL Cg  }
    config set DEPEND  { opengl math }
}

# --------------------------------------------------------------
# Fortran->C Compiler 
# --------------------------------------------------------------
namespace eval f2c {
    config set LIBS    { f2c }
}

# --------------------------------------------------------------
# (C)LAPACK/(C)BLAS -> ATLAS. 
# clapack may be obsolete, please use the module name lapack.
# --------------------------------------------------------------
namespace eval clapack {   
    config set LIBPATH /usr/lib/atlas/
    config set LIBS    { blas lapack } 
    config set DEPEND  { math }
}

# --------------------------------------------------------------
# ATLAS LAPACK/BLAS
# --------------------------------------------------------------
namespace eval lapack {   
    config set LIBPATH /usr/lib/atlas/
    config set LIBS    { blas lapack } 
    config set DEPEND  { math }
}

#----------------------------------------
# Metis graph partitioning
#----------------------------------------
namespace eval metis {
    config set INCPATH $pckg/metis/include
    config set LIBPATH $pckg/metis/lib
    config set LIBS    { metis } 
    config set DEPEND  { math }
}

#----------------------------------------
# TAUCS sparse linear solvers
#----------------------------------------
namespace eval taucs {
    config set INCPATH $pckg/taucs/include
    config set LIBPATH $pckg/taucs/lib
    config set LIBS    { taucs } 
    config set DEPEND  { math metis clapack }
}

#----------------------------------------
# J.R. Shewchuk's triangle library/binaries 
# http://www-2.cs.cmu.edu/~quake/triangle.html
#----------------------------------------
namespace eval triangle {
    config set INCPATH $pckg/triangle/include
    config set LIBPATH $pckg/triangle/lib
    config set LIBS    { triangle } 
}


# --------------------------------------------------------------
# Various stuff
# --------------------------------------------------------------
config set g::PCCTS         $pckg/pccts
config set purify::PURIFY   /opt/pure/purify-4.1-irix6/purify
catch {config set doxygen::DOXYGEN [exec which doxygen]}

# we don't have NASM installed - don't use MMX
config set USE_MMX 0

# we don't have pgcc installed
lremove cxx::COMPILERS pgcc
lremove c::COMPILERS   pgcc

# --------------------------------------------------------------
# Digital Media Software Development Kit by SGI
# --------------------------------------------------------------

namespace eval dmsdk {
    config set INCPATH /HPS/projects/medusa/dmsdk/linux/root/usr/include
    config set LIBPATH /HPS/projects/medusa/dmsdk/linux/root/usr/lib
    config set LIBS    {dmutil dmsdk}
}

# --------------------------------------------------------------
# readline 
# --------------------------------------------------------------

namespace eval readline {
    # config set INCPATH {} # it is in /usr/include, no need to put.
    # config set LIBPATH {} # it is in /usr/lib,     no need to put.
    config set LIBS {readline}
}

# --------------------------------------------------------------
# doxygen 
# --------------------------------------------------------------
namespace eval doxygen {
    # accept_version (accept --version) is more than 1.3?
    config set DOXYGEN_VERSION "accept_version"
}

# --------------------------------------------------------------
# namazu 
# --------------------------------------------------------------
namespace eval namazu {
    catch { set MKNMZ [exec which mknmz] }
}

# --------------------------------------------------------------
# matlab, mex, mcc
# --------------------------------------------------------------
namespace eval matlab {
    config set MATLABROOT /usr/lib/matlab
    config set MATLAB     ${MATLABROOT}/bin/matlab
    config set INCPATH {/usr/lib/matlab/ /usr/lib/matlab/extern/include/}
    config set LIBPATH { /usr/lib/matlab/bin/glnx86 }
}

namespace eval mex {

    config set MATLABROOT /usr/lib/matlab
    config set MATLAB     ${MATLABROOT}/bin/matlab
    config set MEX        ${MATLABROOT}/bin/mex

    config set LIBPATH    ${MATLABROOT}/bin/glnx86
    # PEFER NOT  [mkpath $p sys/java/jre/glnx86/jre1.4.2/lib/i386/client]
    # PEFER NOT [mkpath $p sys/java/jre/glnx86/jre1.4.2/lib/i386]
    # NOT [mkpath $p sys/os/glnx86]	

    config set INCPATH    ${MATLABROOT}/extern/include/cpp 
    lappend INCPATH       ${MATLABROOT}/extern/include 

    config set LIBS    { mwmclmcrrt}
    config set DEPEND  { cxx math }
    config set SYSLIBS { pthread }

    config set MEX_CFLAGS " -DHAVE_MATLAB -DUNIX -DX11 -ansi -D_GNU_SOURCE "
}

namespace eval mcc {
    config set MCC    /usr/lib/matlab/bin/mcc

    # INCPATH or LIBPATH is necessary to register this module
    config set INCPATH {}     
}

# --------------------------------------------------------------
# UFsparce
#   metis:   partitioning unstructured graphs
#   amd:     approximate minimum degree ordering
#   colmod:  column approximate minimum degree ordering algorithm
#   ccolmod: column approximate minimum degree ordering algorithm 
#   umfpack: space linear system solver
#   cholmod: a sparse Cholesky factorization package.
# --------------------------------------------------------------
# namespace eval metis {
#     config set INCPATH ${pckg}/metis/Program
#     config set LIBPATH ${pckg}/metis 
#     config set LIBS    { metis }
# }
namespace eval amd {
    config set INCPATH ${pckg}/UFsparse/AMD/Include
    config set LIBPATH ${pckg}/UFsparse/AMD/Lib
    config set LIBS    { amd }
}
namespace eval colamd {
    config set INCPATH ${pckg}/UFsparse/COLAMD 
    config set LIBPATH ${pckg}/UFsparse/COLAMD  
    config set LIBS    { colamd }
}
namespace eval ccolamd {
    config set INCPATH ${pckg}/UFsparse/CCOLAMD 
    config set LIBPATH ${pckg}/UFsparse/CCOLAMD  
    config set LIBS    { ccolamd }
}
namespace eval umfpack {
    config set INCPATH ${pckg}/UFsparse/UMFPACK/Include
    config set LIBPATH ${pckg}/UFsparse/UMFPACK/Lib
    config set LIBS    { umfpack }
    config set DEPEND  { amd }
}
namespace eval cholmod {
    config set INCPATH ${pckg}/UFsparse/CHOLMOD/Include 
    config set LIBPATH ${pckg}/UFsparse/CHOLMOD/Lib 
    config set LIBS    { cholmod }
    config set DEPEND  { colamd amd metis ccolamd umfpack } 
}

# --------------------------------------------------------------
# ANN: Approximate Nearest Neighbor Searching
#      http://www.cs.umd.edu/~mount/ANN/
# --------------------------------------------------------------
namespace eval ann {
    config set INCPATH ${pckg}/ann/include
    config set LIBPATH ${pckg}/ann/lib
    config set LIBS    { ANN }
}

# but with float as primary data type for coordinates

namespace eval ann_float {
    config set INCPATH ${pckg}/ann_float/include
    config set LIBPATH ${pckg}/ann_float/lib
    config set LIBS    { ANN }
}

# --------------------------------------------------------------
# Ruby
# --------------------------------------------------------------
namespace eval ruby {
    config set INCPATH {/usr/lib/ruby/1.8/i386-linux}
    config set DEPEND  {}
    config set LIBS    {ruby1.8}
}

# --------------------------------------------------------------
# OpenRT
# --------------------------------------------------------------
namespace eval openrt {
    config set LIBPATH /HPS/opt/pckg/OpenRT/rtrt/lib
    config set INCPATH {/HPS/opt/pckg/OpenRT/rtrt/include}
    config set LIBS    {OpenRT}
}

# --------------------------------------------------------------
# ooqp
# --------------------------------------------------------------
namespace eval ooqp {
    config set LIBPATH /HPS/opt/pckg/ooqp/lib
    config set INCPATH {/HPS/opt/pckg/ooqp/include}
    config set LIBS {ooqpbase ooqpbound ooqpdense ooqpgendense ooqpgensparse ooqpgondzio ooqpmehrotra ooqpsparse g2c blas}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted support/tmk/config/site/mpi-sb.mpg.de_confdir/linux.debian4.0-64bit.config.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
# -*-Mode: tcl -*-
# $Id: linux.debian4.0-64bit.config,v 1.1 2008/04/21 12:08:54 cfuchs_sf Exp $
# site config file, Max-Planck-Institut f"ur Informatik, AG4
# Debian4.0, Etch, opteron, 64bit mode
#
assert {![string compare $OS        "Linux"]}
assert {[regexp {Debian4\.0.*} $ARCH]}
assert {![string compare [ ::tmk::get_runmodestat "addressmode" ] "64bit"]}
dbg_msg "reading : [info script]" 1

# this may be obsolete
# recently opteron changed into athlon
if { $CPU != "athlon" } {
    log_msg "******************************************************************"
    log_msg "** Error! : this configuration (64bit) supposes an opteron machine."
    log_msg "** Try to configure tmk, however, it may not work."
    log_msg "******************************************************************"
}


# directories in which tmk should NOT check dependencies
config set DEPEND_EXCLUDE {
    /usr/include/* 
    /HPS/opt/* 
    /opt/* 
    /usr/X11R6/*
    /usr/*
}

set pckg "/HPS/opt/pckg"

# --------------------------------------------------------------
# X11 (default)
# --------------------------------------------------------------
namespace eval x11 {
    config set INCPATH {/amd64/usr/X11R6/include}
    config set LIBPATH {/amd64/usr/X11R6/lib}
    config set BINDIR  {/usr/X11R6/bin}
    config set LIBS    {Xt Xi Xext Xmu X11}
}

# --------------------------------------------------------------
# MOTIF
# --------------------------------------------------------------
namespace eval motif {
    config set LIBS    {Xm}
    config set LIBPATH {/amd64/usr/X11R6/lib}
    config set DEPEND  {x11}
}

# --------------------------------------------------------------
# DGA (direct gfx access) - only on solaris !
# --------------------------------------------------------------
namespace eval dga {
    config set LIBPATH {}
    config set LIBS    {}
}

# --------------------------------------------------------------
# OpenGL 
# --------------------------------------------------------------
namespace eval opengl {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS { GLU GL }
    config set DEPEND { dga x11 }
}

# --------------------------------------------------------------
# OpenInventor
# --------------------------------------------------------------
namespace eval inventor {
    config set LIBS   {Inventor}
    config set DEPEND {opengl}
}

namespace eval inventorxt {
  config set LIBS {InventorXt}
  config set DEPEND {Inventor}
}
   

# --------------------------------------------------------------
# QT 
# --------------------------------------------------------------
namespace eval qt {
    # current version 
    config set DEFS   {QT_CLEAN_NAMESPACE} ; # avoids name conflicts
    # can not find libqt.so (instead of libqt.so.3)
    config set LIBS   {qt-mt}
    config set DEPEND {gui opengl}
    config set DIR     {/amd64/usr} 
    config set INCPATH {/amd64/usr/include/qt3}
    config set LIBPATH {/amd64/usr/lib}

    # multi-threaded current version
    namespace eval mt {
	config set DEFS   {QT_THREAD_SUPPORT}
	config set LIBS   {qt-mt}
    }
}


# --------------------------------------------------------------
# QGL (QT's opengl extension)
# --------------------------------------------------------------
namespace eval qgl {
    # current version is integrated in qt (>= 2.2) 
    config set DEPEND {qt}
}


# --------------------------------------------------------------
# QT 4
# Usually you need { qt4 qt4qtcore }
# --------------------------------------------------------------
namespace eval qt4 {
    config set DIR      /usr
    config set INCPATH  { /usr/include/qt4 }
    config set LIBPATH  /usr/lib/qt4
}

namespace eval qt4qtcore {
    config set INCPATH  { /usr/include/qt4/QtCore /usr/include/qt4/Qt }
    config set LIBS   { QtCore }
    config set DEPEND {qt4}
}

#
# new qt feature, modules
#
#namespace eval qt4activeqt {
#    config set INCPATH { /HPS/opt/pckg/Qt4_64/include/ActiveQt }
#    config set LIBS   {QtGui}
#    config set DEPEND {qt4qtcore}
#}
namespace eval qt4qt3support {
    config set INCPATH { /usr/include/qt4/Qt3Support }
    config set LIBS   {Qt3Support}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtgui {
    config set INCPATH { /usr/include/qt4/QtGui }
    config set LIBS   {QtGui}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtopengl {
    config set INCPATH { /usr/include/qt4/QtOpenGL }
    config set LIBS   {QtOpenGL}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtsvg {
    config set INCPATH { /usr/include/qt4/QtSvg }
    config set LIBS   {QtSvg}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtuitools {
    config set INCPATH { /usr/include/qt4/QtUiTools }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtassistant {
    config set INCPATH { /usr/include/qt4/QtAssistant }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtdesigner {
    config set INCPATH { /usr/include/qt4/QtDesigner }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtnetwork {
    config set INCPATH { /usr/include/qt4/QtNetwork }
    config set LIBS   {QtNetwork}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtsql {
    config set INCPATH { /usr/include/qt4/QtSql }
    config set LIBS   {QtSql}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qttest {
    config set INCPATH { /usr/include/qt4/QtTest }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtxml {
    config set INCPATH { /usr/include/qt4/QtXml }
    config set LIBS   {QtXml}
    config set DEPEND {qt4qtcore}
}

# namespace eval qt3support {
#     config set DIR    /HPS/opt/pckg/Qt4_64
#     config set INCPATH        /HPS/opt/pckg/Qt4_64/include
#     config set LIBPATH        /HPS/opt/pckg/Qt4_64/lib
#     config set DEFS   {QT3_SUPPORT} ;
# }



# --------------------------------------------------------------
# GLUT
# current version: 3.7beta
# --------------------------------------------------------------
namespace eval glut {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set DEPEND { opengl }
    config set LIBS   { glut }
}

# --------------------------------------------------------------
# GLOW
# --------------------------------------------------------------
namespace eval glow {
    config set LIBS {glow}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# GLUI
# --------------------------------------------------------------
namespace eval glui {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS    {glui}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# LIB3DS - 3D studio import library
# --------------------------------------------------------------
namespace eval lib3ds {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS { 3ds }
}

# --------------------------------------------------------------
# TIFF
# --------------------------------------------------------------
namespace eval tiff {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS    {tiff}
}

# --------------------------------------------------------------
# OpenEXR
# --------------------------------------------------------------
namespace eval openexr {
    config set LIBPATH {/usr/lib}
    config set INCPATH {/usr/include/OpenEXR}
    config set LIBS    {Imath IlmImf Iex Half }
    config set DEPEND  {zlib}
}

# --------------------------------------------------------------
# PNG
# --------------------------------------------------------------
namespace eval png {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS    {png}
    config set DEPEND  {zlib}
}

# --------------------------------------------------------------
# JPEG
# --------------------------------------------------------------
namespace eval jpeg {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS    {jpeg}
}

# --------------------------------------------------------------
# ZLIB
# --------------------------------------------------------------
namespace eval zlib {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS    {z}
}

# --------------------------------------------------------------
# BZLIB
# --------------------------------------------------------------
namespace eval bzlib {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS    { bz2 }
}

# --------------------------------------------------------------
# flTk
# --------------------------------------------------------------
namespace eval fltk {
    config set DEPEND {gui }
    config set LIBS   {fltk}
}


# --------------------------------------------------------------
# OpenCV - Intel's Computer Vision Library
# --------------------------------------------------------------
namespace eval opencv {
    config set DEPEND {ipl }
    config set LIBS   {opencv}
}

# --------------------------------------------------------------
# IPL - Intel's Image Processing Library
# --------------------------------------------------------------
namespace eval ipl {
  config set DEPEND {}
  config set LIBPATH {}
  config set INCPATH {/usr/include/ipl}
  config set LIBS    {iplpx ipla6 iplm6 }
}

# --------------------------------------------------------------
# ImageMagick C++ 
# --------------------------------------------------------------
namespace eval magick++ {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS   {Magick++}
}

# --------------------------------------------------------------
# ImageMagick  
# --------------------------------------------------------------
namespace eval magick {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set DEPEND { pthread }
    config set LIBS    {Magick}
}

# --------------------------------------------------------------
# TCL 
# --------------------------------------------------------------
namespace eval tcl {
    config set INCPATH {/amd64/usr/include/tcl8.4}
    config set LIBPATH {/amd64/usr/lib}
    config set DEPEND {}
    config set LIBS    {tcl8.4}
}

# --------------------------------------------------------------
# TK 
# --------------------------------------------------------------
namespace eval tk {
    config set INCPATH {/amd64/usr/include/tcl8.4}
    config set LIBPATH {/amd64/usr/lib}
    config set DEPEND {tcl}
    config set LIBS    {tk8.4}
}

# --------------------------------------------------------------
# POSIX threads
# --------------------------------------------------------------
namespace eval pthread {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}    
    config set LIBS {pthread}
}

# --------------------------------------------------------------
# Math library (includes should be set automatically)
# --------------------------------------------------------------
namespace eval math {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}    
    config set LIBS {m}
}

# --------------------------------------------------------------
# NVIDIA Cg 'C for graphics' toolkit 
# --------------------------------------------------------------
namespace eval cg {
    config set INCPATH $pckg/Cg/include
    config set LIBPATH $pckg/Cg/lib
    config set LIBS    { CgGL Cg  }
    config set DEPEND  { opengl math }
}

# --------------------------------------------------------------
# Fortran->C Compiler 
# --------------------------------------------------------------
namespace eval f2c {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}    
    config set LIBS    { f2c }
}

# --------------------------------------------------------------
# (C)LAPACK/(C)BLAS -> ATLAS. 
# clapack may be obsolete, please use the module name lapack.
# --------------------------------------------------------------
namespace eval clapack {   
    config set LIBPATH /usr/lib/atlas/
    config set LIBS    { blas lapack } 
    config set DEPEND  { math }
}

# --------------------------------------------------------------
# ATLAS LAPACK/BLAS
# --------------------------------------------------------------
namespace eval lapack {   
    config set LIBPATH /usr/lib/atlas/
    config set LIBS    { blas lapack } 
    config set DEPEND  { math }
}

#----------------------------------------
# Metis graph partitioning
#----------------------------------------
namespace eval metis {
    config set INCPATH $pckg/metis/include
    config set LIBPATH $pckg/metis/lib
    config set LIBS    { metis } 
    config set DEPEND  { math }
}

#----------------------------------------
# TAUCS sparse linear solvers
#----------------------------------------
namespace eval taucs {
    config set INCPATH $pckg/taucs/include
    config set LIBPATH $pckg/taucs/lib
    config set LIBS    { taucs } 
    config set DEPEND  { math metis clapack }
}

#----------------------------------------
# J.R. Shewchuk's triangle library/binaries 
# http://www-2.cs.cmu.edu/~quake/triangle.html
#----------------------------------------
namespace eval triangle {
    config set INCPATH $pckg/triangle/include
    config set LIBPATH $pckg/triangle/lib
    config set LIBS    { triangle } 
}


# --------------------------------------------------------------
# Various stuff
# --------------------------------------------------------------
config set g::PCCTS         $pckg/pccts
config set purify::PURIFY   /opt/pure/purify-4.1-irix6/purify
catch {config set doxygen::DOXYGEN [exec which doxygen]}

# we don't have NASM installed - don't use MMX
config set USE_MMX 0

# we don't have pgcc installed
lremove cxx::COMPILERS pgcc
lremove c::COMPILERS   pgcc

# --------------------------------------------------------------
# Digital Media Software Development Kit by SGI
# --------------------------------------------------------------

namespace eval dmsdk {
    config set INCPATH /HPS/projects/medusa/dmsdk/linux/root/usr/include
    config set LIBPATH /HPS/projects/medusa/dmsdk/linux/root/usr/lib
    config set LIBS    {dmutil dmsdk}
}

# --------------------------------------------------------------
# readline 
# --------------------------------------------------------------

namespace eval readline {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}    
    config set LIBS {readline}
}

# --------------------------------------------------------------
# doxygen 
# --------------------------------------------------------------
namespace eval doxygen {
    # accept_version (accept --version) is more than 1.3?
    config set DOXYGEN_VERSION "accept_version"
}

# --------------------------------------------------------------
# add gcc options
# --------------------------------------------------------------
namespace eval ::cxx::gcc {
    # add 64bit option 
    if { [ string compare "g++" [ file tail $EXECUTABLE ] ] != 0 } {
	log_msg "******************************************************************"
	log_msg "****** !!WARNING!! EXECUTABLE = $EXECUTABLE"
	log_msg "****** Found gcc executable at /usr/bin/g++."
	log_msg "****** This compiler may not for 64 bit. Please check your path."
	log_msg "****** Assuming /amd64/usr/bin/g++-3.4. "
	log_msg "****** !!WARNING!!"
	log_msg "******************************************************************"
    }
}

namespace eval ::c::gcc {
    # add 64bit option 
    if { [ string compare "gcc" [ file tail $EXECUTABLE ] ] != 0 } {
	log_msg "******************************************************************"
	log_msg "****** !!WARNING!! EXECUTABLE = $EXECUTABLE"
	log_msg "****** Found gcc executable at /usr/bin/gcc."
	log_msg "****** This compiler may not for 64 bit. Please check your path."
	log_msg "****** Assuming /amd64/usr/bin/gcc-3.4. "
	log_msg "****** !!WARNING!!"
	log_msg "******************************************************************"
    }
}

# --------------------------------------------------------------
# ANN: Approximate Nearest Neighbor Searching
#      http://www.cs.umd.edu/~mount/ANN/
# --------------------------------------------------------------
# namespace eval ann {
#     config set INCPATH ${pckg}/ann/include
#     config set LIBPATH ${pckg}/ann/lib
#     config set LIBS    { ANN }
# }

# --------------------------------------------------------------
# Ruby
# --------------------------------------------------------------
namespace eval ruby {
    config set INCPATH {/usr/lib/ruby/1.8/i486-linux}
    config set DEPEND  {}
    config set LIBS    {ruby1.8}
}	    

# --------------------------------------------------------------
# matlab, mex, mcc
# --------------------------------------------------------------
namespace eval matlab {
    config set MATLABROOT /usr/lib/matlab-7.4
    config set MATLAB     ${MATLABROOT}/bin/matlab
    config set INCPATH { /usr/lib/matlab-7.4 /usr/lib/matlab-7.4/extern/include/}
    config set LIBPATH { /usr/lib/matlab-7.4/bin/glnx86 }
}

namespace eval mex {

    config set MATLABROOT /usr/lib/matlab-7.4
    config set MATLAB     ${MATLABROOT}/bin/matlab
    config set MEX        ${MATLABROOT}/bin/mex

    config set LIBPATH    ${MATLABROOT}/bin/glnx86
    # PEFER NOT  [mkpath $p sys/java/jre/glnx86/jre1.4.2/lib/i386/client]
    # PEFER NOT [mkpath $p sys/java/jre/glnx86/jre1.4.2/lib/i386]
    # NOT [mkpath $p sys/os/glnx86]	

    config set INCPATH    ${MATLABROOT}/extern/include/cpp 
    lappend INCPATH       ${MATLABROOT}/extern/include 

    config set LIBS    { mwmclmcrrt}
    config set DEPEND  { cxx math }
    config set SYSLIBS { pthread }

    config set MEX_CFLAGS " -DHAVE_MATLAB -DUNIX -DX11 -ansi -D_GNU_SOURCE "
}

namespace eval mcc {
    config set MCC    /usr/lib/matlab-7.4/bin/mcc

    # INCPATH or LIBPATH is necessary to register this module
    config set INCPATH {}     
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted support/tmk/config/site/mpi-sb.mpg.de_confdir/linux.debian4.0-opteron-64bit.config.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
# -*-Mode: tcl -*-
# $Id: linux.debian4.0-opteron-64bit.config,v 1.3 2007/10/25 12:57:28 cfuchs_sf Exp $
# site config file, Max-Planck-Institut f"ur Informatik, AG4
# Debian4.0, Etch, opteron, 64bit mode
#
assert {![string compare $OS        "Linux"]}
assert {[regexp {Debian4\.0.*} $ARCH]}
assert {![string compare [ ::tmk::get_runmodestat "addressmode" ] "64bit"]}
dbg_msg "reading : [info script]" 1

# this may be obsolete
# recently opteron changed into athlon
if { $CPU != "athlon" } {
    log_msg "******************************************************************"
    log_msg "** Error! : this configuration (64bit) supposes an opteron machine."
    log_msg "** Try to configure tmk, however, it may not work."
    log_msg "******************************************************************"
}


# directories in which tmk should NOT check dependencies
config set DEPEND_EXCLUDE {
    /usr/include/* 
    /HPS/opt/* 
    /opt/* 
    /usr/X11R6/*
    /usr/*
}

set pckg "/HPS/opt/pckg"

# --------------------------------------------------------------
# X11 (default)
# --------------------------------------------------------------
namespace eval x11 {
    config set INCPATH {/amd64/usr/X11R6/include}
    config set LIBPATH {/amd64/usr/X11R6/lib}
    config set BINDIR  {/usr/X11R6/bin}
    config set LIBS    {Xt Xi Xext Xmu X11}
}

# --------------------------------------------------------------
# MOTIF
# --------------------------------------------------------------
namespace eval motif {
    config set LIBS    {Xm}
    config set LIBPATH {/amd64/usr/X11R6/lib}
    config set DEPEND  {x11}
}

# --------------------------------------------------------------
# DGA (direct gfx access) - only on solaris !
# --------------------------------------------------------------
namespace eval dga {
    config set LIBPATH {}
    config set LIBS    {}
}

# --------------------------------------------------------------
# OpenGL 
# --------------------------------------------------------------
namespace eval opengl {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS { GLU GL }
    config set DEPEND { dga x11 }
}

# --------------------------------------------------------------
# OpenInventor
# --------------------------------------------------------------
namespace eval inventor {
    config set LIBS   {Inventor}
    config set DEPEND {opengl}
}

namespace eval inventorxt {
  config set LIBS {InventorXt}
  config set DEPEND {Inventor}
}
   

# --------------------------------------------------------------
# QT 
# --------------------------------------------------------------
namespace eval qt {
    # current version 
    config set DEFS   {QT_CLEAN_NAMESPACE} ; # avoids name conflicts
    # can not find libqt.so (instead of libqt.so.3)
    config set LIBS   {qt-mt}
    config set DEPEND {gui opengl}
    config set DIR     {/amd64/usr} 
    config set INCPATH {/amd64/usr/include/qt3}
    config set LIBPATH {/amd64/usr/lib}

    # multi-threaded current version
    namespace eval mt {
	config set DEFS   {QT_THREAD_SUPPORT}
	config set LIBS   {qt-mt}
    }
}


# --------------------------------------------------------------
# QGL (QT's opengl extension)
# --------------------------------------------------------------
namespace eval qgl {
    # current version is integrated in qt (>= 2.2) 
    config set DEPEND {qt}
}


# --------------------------------------------------------------
# QT 4
# Usually you need { qt4 qt4qtcore }
# --------------------------------------------------------------
namespace eval qt4 {
    config set DIR      /usr
    config set INCPATH  { /usr/include/qt4 }
    config set LIBPATH  /usr/lib/qt4
}

namespace eval qt4qtcore {
    config set INCPATH  { /usr/include/qt4/QtCore /usr/include/qt4/Qt }
    config set LIBS   { QtCore }
    config set DEPEND {qt4}
}

#
# new qt feature, modules
#
#namespace eval qt4activeqt {
#    config set INCPATH { /HPS/opt/pckg/Qt4_64/include/ActiveQt }
#    config set LIBS   {QtGui}
#    config set DEPEND {qt4qtcore}
#}
namespace eval qt4qt3support {
    config set INCPATH { /usr/include/qt4/Qt3Support }
    config set LIBS   {Qt3Support}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtgui {
    config set INCPATH { /usr/include/qt4/QtGui }
    config set LIBS   {QtGui}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtopengl {
    config set INCPATH { /usr/include/qt4/QtOpenGL }
    config set LIBS   {QtOpenGL}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtsvg {
    config set INCPATH { /usr/include/qt4/QtSvg }
    config set LIBS   {QtSvg}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtuitools {
    config set INCPATH { /usr/include/qt4/QtUiTools }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtassistant {
    config set INCPATH { /usr/include/qt4/QtAssistant }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtdesigner {
    config set INCPATH { /usr/include/qt4/QtDesigner }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtnetwork {
    config set INCPATH { /usr/include/qt4/QtNetwork }
    config set LIBS   {QtNetwork}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtsql {
    config set INCPATH { /usr/include/qt4/QtSql }
    config set LIBS   {QtSql}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qttest {
    config set INCPATH { /usr/include/qt4/QtTest }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtxml {
    config set INCPATH { /usr/include/qt4/QtXml }
    config set LIBS   {QtXml}
    config set DEPEND {qt4qtcore}
}

# namespace eval qt3support {
#     config set DIR    /HPS/opt/pckg/Qt4_64
#     config set INCPATH        /HPS/opt/pckg/Qt4_64/include
#     config set LIBPATH        /HPS/opt/pckg/Qt4_64/lib
#     config set DEFS   {QT3_SUPPORT} ;
# }



# --------------------------------------------------------------
# GLUT
# current version: 3.7beta
# --------------------------------------------------------------
namespace eval glut {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set DEPEND { opengl }
    config set LIBS   { glut }
}

# --------------------------------------------------------------
# GLOW
# --------------------------------------------------------------
namespace eval glow {
    config set LIBS {glow}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# GLUI
# --------------------------------------------------------------
namespace eval glui {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS    {glui}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# LIB3DS - 3D studio import library
# --------------------------------------------------------------
namespace eval lib3ds {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS { 3ds }
}

# --------------------------------------------------------------
# TIFF
# --------------------------------------------------------------
namespace eval tiff {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS    {tiff}
}

# --------------------------------------------------------------
# OpenEXR
# --------------------------------------------------------------
namespace eval openexr {
    config set LIBPATH {/usr/lib}
    config set INCPATH {/usr/include/OpenEXR}
    config set LIBS    {Imath IlmImf Iex Half }
    config set DEPEND  {zlib}
}

# --------------------------------------------------------------
# PNG
# --------------------------------------------------------------
namespace eval png {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS    {png}
    config set DEPEND  {zlib}
}

# --------------------------------------------------------------
# JPEG
# --------------------------------------------------------------
namespace eval jpeg {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS    {jpeg}
}

# --------------------------------------------------------------
# ZLIB
# --------------------------------------------------------------
namespace eval zlib {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS    {z}
}

# --------------------------------------------------------------
# BZLIB
# --------------------------------------------------------------
namespace eval bzlib {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS    { bz2 }
}

# --------------------------------------------------------------
# flTk
# --------------------------------------------------------------
namespace eval fltk {
    config set DEPEND {gui }
    config set LIBS   {fltk}
}


# --------------------------------------------------------------
# OpenCV - Intel's Computer Vision Library
# --------------------------------------------------------------
namespace eval opencv {
    config set DEPEND {ipl }
    config set LIBS   {opencv}
}

# --------------------------------------------------------------
# IPL - Intel's Image Processing Library
# --------------------------------------------------------------
namespace eval ipl {
  config set DEPEND {}
  config set LIBPATH {}
  config set INCPATH {/usr/include/ipl}
  config set LIBS    {iplpx ipla6 iplm6 }
}

# --------------------------------------------------------------
# ImageMagick C++ 
# --------------------------------------------------------------
namespace eval magick++ {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set LIBS   {Magick++}
}

# --------------------------------------------------------------
# ImageMagick  
# --------------------------------------------------------------
namespace eval magick {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}
    config set DEPEND { pthread }
    config set LIBS    {Magick}
}

# --------------------------------------------------------------
# TCL 
# --------------------------------------------------------------
namespace eval tcl {
    config set INCPATH {/amd64/usr/include/tcl8.4}
    config set LIBPATH {/amd64/usr/lib}
    config set DEPEND {}
    config set LIBS    {tcl8.4}
}

# --------------------------------------------------------------
# TK 
# --------------------------------------------------------------
namespace eval tk {
    config set INCPATH {/amd64/usr/include/tcl8.4}
    config set LIBPATH {/amd64/usr/lib}
    config set DEPEND {tcl}
    config set LIBS    {tk8.4}
}

# --------------------------------------------------------------
# POSIX threads
# --------------------------------------------------------------
namespace eval pthread {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}    
    config set LIBS {pthread}
}

# --------------------------------------------------------------
# Math library (includes should be set automatically)
# --------------------------------------------------------------
namespace eval math {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}    
    config set LIBS {m}
}

# --------------------------------------------------------------
# NVIDIA Cg 'C for graphics' toolkit 
# --------------------------------------------------------------
namespace eval cg {
    config set INCPATH $pckg/Cg/include
    config set LIBPATH $pckg/Cg/lib
    config set LIBS    { CgGL Cg  }
    config set DEPEND  { opengl math }
}

# --------------------------------------------------------------
# Fortran->C Compiler 
# --------------------------------------------------------------
namespace eval f2c {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}    
    config set LIBS    { f2c }
}

# --------------------------------------------------------------
# (C)LAPACK/(C)BLAS -> ATLAS. 
# clapack may be obsolete, please use the module name lapack.
# --------------------------------------------------------------
namespace eval clapack {   
    config set LIBPATH /usr/lib/atlas/
    config set LIBS    { blas lapack } 
    config set DEPEND  { math }
}

# --------------------------------------------------------------
# ATLAS LAPACK/BLAS
# --------------------------------------------------------------
namespace eval lapack {   
    config set LIBPATH /usr/lib/atlas/
    config set LIBS    { blas lapack } 
    config set DEPEND  { math }
}

#----------------------------------------
# Metis graph partitioning
#----------------------------------------
namespace eval metis {
    config set INCPATH $pckg/metis/include
    config set LIBPATH $pckg/metis/lib
    config set LIBS    { metis } 
    config set DEPEND  { math }
}

#----------------------------------------
# TAUCS sparse linear solvers
#----------------------------------------
namespace eval taucs {
    config set INCPATH $pckg/taucs/include
    config set LIBPATH $pckg/taucs/lib
    config set LIBS    { taucs } 
    config set DEPEND  { math metis clapack }
}

#----------------------------------------
# J.R. Shewchuk's triangle library/binaries 
# http://www-2.cs.cmu.edu/~quake/triangle.html
#----------------------------------------
namespace eval triangle {
    config set INCPATH $pckg/triangle/include
    config set LIBPATH $pckg/triangle/lib
    config set LIBS    { triangle } 
}


# --------------------------------------------------------------
# Various stuff
# --------------------------------------------------------------
config set g::PCCTS         $pckg/pccts
config set purify::PURIFY   /opt/pure/purify-4.1-irix6/purify
catch {config set doxygen::DOXYGEN [exec which doxygen]}

# we don't have NASM installed - don't use MMX
config set USE_MMX 0

# we don't have pgcc installed
lremove cxx::COMPILERS pgcc
lremove c::COMPILERS   pgcc

# --------------------------------------------------------------
# Digital Media Software Development Kit by SGI
# --------------------------------------------------------------

namespace eval dmsdk {
    config set INCPATH /HPS/projects/medusa/dmsdk/linux/root/usr/include
    config set LIBPATH /HPS/projects/medusa/dmsdk/linux/root/usr/lib
    config set LIBS    {dmutil dmsdk}
}

# --------------------------------------------------------------
# readline 
# --------------------------------------------------------------

namespace eval readline {
    config set INCPATH {/amd64/usr/include}
    config set LIBPATH {/amd64/usr/lib}    
    config set LIBS {readline}
}

# --------------------------------------------------------------
# doxygen 
# --------------------------------------------------------------
namespace eval doxygen {
    # accept_version (accept --version) is more than 1.3?
    config set DOXYGEN_VERSION "accept_version"
}

# --------------------------------------------------------------
# add gcc options
# --------------------------------------------------------------
namespace eval ::cxx::gcc {
    # add 64bit option 
    if { [ string compare "g++" [ file tail $EXECUTABLE ] ] != 0 } {
	log_msg "******************************************************************"
	log_msg "****** !!WARNING!! EXECUTABLE = $EXECUTABLE"
	log_msg "****** Found gcc executable at /usr/bin/g++."
	log_msg "****** This compiler may not for 64 bit. Please check your path."
	log_msg "****** Assuming /amd64/usr/bin/g++-3.4. "
	log_msg "****** !!WARNING!!"
	log_msg "******************************************************************"
    }
}

namespace eval ::c::gcc {
    # add 64bit option 
    if { [ string compare "gcc" [ file tail $EXECUTABLE ] ] != 0 } {
	log_msg "******************************************************************"
	log_msg "****** !!WARNING!! EXECUTABLE = $EXECUTABLE"
	log_msg "****** Found gcc executable at /usr/bin/gcc."
	log_msg "****** This compiler may not for 64 bit. Please check your path."
	log_msg "****** Assuming /amd64/usr/bin/gcc-3.4. "
	log_msg "****** !!WARNING!!"
	log_msg "******************************************************************"
    }
}

# --------------------------------------------------------------
# ANN: Approximate Nearest Neighbor Searching
#      http://www.cs.umd.edu/~mount/ANN/
# --------------------------------------------------------------
# namespace eval ann {
#     config set INCPATH ${pckg}/ann/include
#     config set LIBPATH ${pckg}/ann/lib
#     config set LIBS    { ANN }
# }

# --------------------------------------------------------------
# Ruby
# --------------------------------------------------------------
namespace eval ruby {
    config set INCPATH {/usr/lib/ruby/1.8/i486-linux}
    config set DEPEND  {}
    config set LIBS    {ruby1.8}
}	    

# --------------------------------------------------------------
# matlab, mex, mcc
# --------------------------------------------------------------
namespace eval matlab {
    config set MATLABROOT /usr/lib/matlab-7.4
    config set MATLAB     ${MATLABROOT}/bin/matlab
    config set INCPATH { /usr/lib/matlab-7.4 /usr/lib/matlab-7.4/extern/include/}
    config set LIBPATH { /usr/lib/matlab-7.4/bin/glnx86 }
}

namespace eval mex {

    config set MATLABROOT /usr/lib/matlab-7.4
    config set MATLAB     ${MATLABROOT}/bin/matlab
    config set MEX        ${MATLABROOT}/bin/mex

    config set LIBPATH    ${MATLABROOT}/bin/glnx86
    # PEFER NOT  [mkpath $p sys/java/jre/glnx86/jre1.4.2/lib/i386/client]
    # PEFER NOT [mkpath $p sys/java/jre/glnx86/jre1.4.2/lib/i386]
    # NOT [mkpath $p sys/os/glnx86]	

    config set INCPATH    ${MATLABROOT}/extern/include/cpp 
    lappend INCPATH       ${MATLABROOT}/extern/include 

    config set LIBS    { mwmclmcrrt}
    config set DEPEND  { cxx math }
    config set SYSLIBS { pthread }

    config set MEX_CFLAGS " -DHAVE_MATLAB -DUNIX -DX11 -ansi -D_GNU_SOURCE "
}

namespace eval mcc {
    config set MCC    /usr/lib/matlab-7.4/bin/mcc

    # INCPATH or LIBPATH is necessary to register this module
    config set INCPATH {}     
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted support/tmk/config/site/mpi-sb.mpg.de_confdir/linux.debian4.0.config.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
# -*-Mode: tcl -*-
# $Id: linux.debian4.0.config,v 1.7 2008/10/24 07:25:52 cfuchs_sf Exp $
# site config file, Max-Planck-Institut f"ur Informatik, AG4
# Debian4.0, Etch
#
assert {![string compare $OS   "Linux"]}
assert {[regexp {Debian4\.0.*} $ARCH]}
dbg_msg "reading : [info script]" 1

# directories in which tmk should NOT check dependencies
config set DEPEND_EXCLUDE {
    /usr/include/* 
    /HPS/opt/* 
    /opt/* 
    /usr/X11R6/*
    /usr/*
}

set pckg "/HPS/opt/pckg"

# --------------------------------------------------------------
# X11 (default)
# --------------------------------------------------------------
namespace eval x11 {
    config set INCPATH /usr/X11R6/include
    config set LIBPATH /usr/X11R6/lib
    config set BINDIR  /usr/X11R6/bin
    config set LIBS   {Xt Xi Xext Xmu X11}
}

# --------------------------------------------------------------
# MOTIF
# --------------------------------------------------------------
namespace eval motif {
    config set LIBS   {Xm}
    config set DEPEND {x11}
}

# --------------------------------------------------------------
# DGA (direct gfx access) - only on solaris !
# --------------------------------------------------------------
namespace eval dga {
    config set LIBPATH {}
    config set LIBS    {}
}

# --------------------------------------------------------------
# OpenGL 
# --------------------------------------------------------------
namespace eval opengl {
    config set INCPATH {}
    config set LIBPATH {}
    config set LIBS { GLU GL }
    config set DEPEND { dga x11 }
}

# --------------------------------------------------------------
# OpenInventor
# --------------------------------------------------------------
namespace eval inventor {
    config set LIBS   {Inventor}
    config set DEPEND {opengl}
}

namespace eval inventorxt {
  config set LIBS {InventorXt}
  config set DEPEND {Inventor}
}
   

# --------------------------------------------------------------
# QT 
# --------------------------------------------------------------
namespace eval qt {
    # current version 
    config set DEFS   {QT_CLEAN_NAMESPACE} ; # avoids name conflicts
    # can not find libqt.so (instead of libqt.so.3)
    config set LIBS   {qt-mt}
    config set DEPEND {gui opengl}
    config set DIR     /usr
    config set INCPATH /usr/include/qt3
    config set LIBPATH /usr/lib

    # multi-threaded current version
    namespace eval mt {
	config set DEFS   {QT_THREAD_SUPPORT}
	config set LIBS   {qt-mt}
    }
}


# --------------------------------------------------------------
# QGL (QT's opengl extension)
# --------------------------------------------------------------
namespace eval qgl {
    # current version is integrated in qt (>= 2.2) 
    config set DEPEND {qt}
}

# --------------------------------------------------------------
# QT 4
# Usually you need { qt4 qt4qtcore }
# --------------------------------------------------------------
namespace eval qt4 {
    config set DIR      /usr
    config set INCPATH  { /usr/include/qt4 }
    config set LIBPATH  /usr/lib/qt4
}

namespace eval qt4qtcore {
    config set INCPATH  { /usr/include/qt4/QtCore /usr/include/qt4/Qt }
    config set LIBS   { QtCore }
    config set DEPEND {qt4}
}

#
# new qt feature, modules
#
#namespace eval qt4qtactiveqt {
#    config set INCPATH { /usr/include/qt4/ActiveQt }
#    config set LIBS   {QtGui}
#    config set DEPEND {qt4qtcore}
#}
namespace eval qt4qt3support {
    config set INCPATH { /usr/include/qt4/Qt3Support }
    config set LIBS   {Qt3Support}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtgui {
    config set INCPATH { /usr/include/qt4/QtGui }
    config set LIBS   {QtGui}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtopengl {
    config set INCPATH { /usr/include/qt4/QtOpenGL }
    config set LIBS   {QtOpenGL}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtsvg {
    config set INCPATH { /usr/include/qt4/QtSvg }
    config set LIBS   {QtSvg}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtuitools {
    config set INCPATH { /usr/include/qt4/QtUiTools }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtassistant {
    config set INCPATH { /usr/include/qt4/QtAssistant }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtdesigner {
    config set INCPATH { /usr/include/qt4/QtDesigner }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtnetwork {
    config set INCPATH { /usr/include/qt4/QtNetwork }
    config set LIBS   {QtNetwork}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtsql {
    config set INCPATH { /usr/include/qt4/QtSql }
    config set LIBS   {QtSql}
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qttest {
    config set INCPATH { /usr/include/qt4/QtTest }
    config set DEPEND {qt4qtcore}
}
namespace eval qt4qtxml {
    config set INCPATH { /usr/include/qt4/QtXml }
    config set LIBS   {QtXml}
    config set DEPEND {qt4qtcore}
}

# namespace eval qt3support {
#     config set DIR    /HPS/opt/pckg/Qt4
#     config set INCPATH        /HPS/opt/pckg/Qt4/include
#     config set LIBPATH        /HPS/opt/pckg/Qt4/lib
#     config set DEFS   {QT3_SUPPORT} ;
# }

# --------------------------------------------------------------
# GLUT
# current version: 3.7beta
# --------------------------------------------------------------
namespace eval glut {
    config set DEPEND { opengl }
    config set LIBS   { glut }
}

# --------------------------------------------------------------
# GLOW
# --------------------------------------------------------------
namespace eval glow {
    config set LIBS {glow}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# GLUI
# --------------------------------------------------------------
namespace eval glui {
    config set LIBS    {glui}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# LIB3DS - 3D studio import library
# --------------------------------------------------------------
namespace eval lib3ds {
    config set LIBS { 3ds }
}

# --------------------------------------------------------------
# TIFF
# --------------------------------------------------------------
namespace eval tiff {
    config set LIBS    {tiff}
}

# --------------------------------------------------------------
# OpenEXR
# --------------------------------------------------------------
namespace eval openexr {
    config set LIBPATH {/usr/lib}
    config set INCPATH {/usr/include/OpenEXR}
    config set LIBS    {Imath IlmImf Iex Half }
    config set DEPEND  {zlib}
}

# --------------------------------------------------------------
# PNG
# --------------------------------------------------------------
namespace eval png {
    config set LIBS    {png}
    config set DEPEND  {zlib}
}

# --------------------------------------------------------------
# JPEG
# --------------------------------------------------------------
namespace eval jpeg {
    config set LIBS    {jpeg}
}

# --------------------------------------------------------------
# ZLIB
# --------------------------------------------------------------
namespace eval zlib {
    config set LIBS         {z}
}

# --------------------------------------------------------------
# BZLIB
# --------------------------------------------------------------
namespace eval bzlib {
    config set LIBS    { bz2 }
}

# --------------------------------------------------------------
# flTk
# --------------------------------------------------------------
namespace eval fltk {
    config set DEPEND {gui }
    config set LIBS   {fltk}
}


# --------------------------------------------------------------
# OpenCV - Intel's Computer Vision Library
# --------------------------------------------------------------
namespace eval opencv {
    config set DEPEND {ipl }
    config set LIBS   {opencv}
}

# --------------------------------------------------------------
# IPL - Intel's Image Processing Library
# --------------------------------------------------------------
namespace eval ipl {
  config set DEPEND {}
  config set LIBPATH {}
  config set INCPATH {/usr/include/ipl}
  config set LIBS    {iplpx ipla6 iplm6 }
}

# --------------------------------------------------------------
# ImageMagick C++ 
# --------------------------------------------------------------
namespace eval magick++ {
    config set LIBS   {Magick++}
}

# --------------------------------------------------------------
# ImageMagick  
# --------------------------------------------------------------
namespace eval magick {
    config set DEPEND { pthread }
    config set LIBS    {Magick}
}

# --------------------------------------------------------------
# TCL 
# --------------------------------------------------------------
namespace eval tcl {
  config set INCPATH {/usr/include/tcl8.4}
  config set DEPEND {}
  config set LIBS    {tcl8.4}
}

# --------------------------------------------------------------
# TK 
# --------------------------------------------------------------
namespace eval tk {
  config set INCPATH {/usr/include/tcl8.4}
  config set DEPEND {tcl}
  config set LIBS    {tk8.4}
}

# --------------------------------------------------------------
# POSIX threads
# --------------------------------------------------------------
namespace eval pthread {
    config set LIBS {pthread}
}

# --------------------------------------------------------------
# Math library (includes should be set automatically)
# --------------------------------------------------------------
config set math::LIBS {m}

# --------------------------------------------------------------
# NVIDIA Cg 'C for graphics' toolkit 
# --------------------------------------------------------------
namespace eval cg {
    config set INCPATH $pckg/Cg/include
    config set LIBPATH $pckg/Cg/lib
    config set LIBS    { CgGL Cg  }
    config set DEPEND  { opengl math }
}

# --------------------------------------------------------------
# Fortran->C Compiler 
# --------------------------------------------------------------
namespace eval f2c {
    config set LIBS    { g2c }
}

# --------------------------------------------------------------
# (C)LAPACK/(C)BLAS -> ATLAS. 
# clapack may be obsolete, please use the module name lapack.
# --------------------------------------------------------------
namespace eval clapack {   
    config set LIBPATH /usr/lib/atlas/
    config set LIBS    { blas lapack } 
    config set DEPEND  { math }
}

# --------------------------------------------------------------
# ATLAS LAPACK/BLAS
# --------------------------------------------------------------
namespace eval lapack {   
    config set LIBPATH /usr/lib/atlas/
    config set LIBS    { blas lapack } 
    config set DEPEND  { math }
}

#----------------------------------------
# Metis graph partitioning
#----------------------------------------
namespace eval metis {
    config set INCPATH $pckg/metis/include
    config set LIBPATH $pckg/metis/lib
    config set LIBS    { metis } 
    config set DEPEND  { math }
}

#----------------------------------------
# TAUCS sparse linear solvers
#----------------------------------------
namespace eval taucs {
    config set INCPATH $pckg/taucs/include
    config set LIBPATH $pckg/taucs/lib
    config set LIBS    { taucs } 
    config set DEPEND  { math metis clapack }
}

#----------------------------------------
# J.R. Shewchuk's triangle library/binaries 
# http://www-2.cs.cmu.edu/~quake/triangle.html
#----------------------------------------
namespace eval triangle {
    config set INCPATH $pckg/triangle/include
    config set LIBPATH $pckg/triangle/lib
    config set LIBS    { triangle } 
}


# --------------------------------------------------------------
# Various stuff
# --------------------------------------------------------------
config set g::PCCTS         $pckg/pccts
config set purify::PURIFY   /opt/pure/purify-4.1-irix6/purify
catch {config set doxygen::DOXYGEN [exec which doxygen]}

# we don't have NASM installed - don't use MMX
config set USE_MMX 0

# we don't have pgcc installed
lremove cxx::COMPILERS pgcc
lremove c::COMPILERS   pgcc

# --------------------------------------------------------------
# Digital Media Software Development Kit by SGI
# --------------------------------------------------------------

namespace eval dmsdk {
    config set INCPATH /HPS/projects/medusa/dmsdk/linux/root/usr/include
    config set LIBPATH /HPS/projects/medusa/dmsdk/linux/root/usr/lib
    config set LIBS    {dmutil dmsdk}
}

# --------------------------------------------------------------
# readline 
# --------------------------------------------------------------

namespace eval readline {
    # config set INCPATH {} # it is in /usr/include, no need to put.
    # config set LIBPATH {} # it is in /usr/lib,     no need to put.
    config set LIBS {readline}
}

# --------------------------------------------------------------
# doxygen 
# --------------------------------------------------------------
namespace eval doxygen {
    # accept_version (accept --version) is more than 1.3?
    config set DOXYGEN_VERSION "accept_version"
}

# --------------------------------------------------------------
# namazu 
# --------------------------------------------------------------
namespace eval namazu {
    catch { set MKNMZ [exec which mknmz] }
}

# --------------------------------------------------------------
# matlab, mex, mcc
# --------------------------------------------------------------
namespace eval matlab {
    config set MATLABROOT /usr/lib/matlab-7.4
    config set MATLAB     ${MATLABROOT}/bin/matlab
    config set INCPATH { /usr/lib/matlab-7.4 /usr/lib/matlab-7.4/extern/include/}
    config set LIBPATH { /usr/lib/matlab-7.4/bin/glnx86 }
}

namespace eval mex {

    config set MATLABROOT /usr/lib/matlab-7.4
    config set MATLAB     ${MATLABROOT}/bin/matlab
    config set MEX        ${MATLABROOT}/bin/mex

    config set LIBPATH    ${MATLABROOT}/bin/glnx86
    # PEFER NOT  [mkpath $p sys/java/jre/glnx86/jre1.4.2/lib/i386/client]
    # PEFER NOT [mkpath $p sys/java/jre/glnx86/jre1.4.2/lib/i386]
    # NOT [mkpath $p sys/os/glnx86]	

    config set INCPATH    ${MATLABROOT}/extern/include/cpp 
    lappend INCPATH       ${MATLABROOT}/extern/include 

    config set LIBS    { mwmclmcrrt}
    config set DEPEND  { cxx math }
    config set SYSLIBS { pthread }

    config set MEX_CFLAGS " -DHAVE_MATLAB -DUNIX -DX11 -ansi -D_GNU_SOURCE "
}

namespace eval mcc {
    config set MCC    /usr/lib/matlab-7.4/bin/mcc

    # INCPATH or LIBPATH is necessary to register this module
    config set INCPATH {}     
}

# --------------------------------------------------------------
# UFsparce
#   metis:   partitioning unstructured graphs
#   amd:     approximate minimum degree ordering
#   colmod:  column approximate minimum degree ordering algorithm
#   ccolmod: column approximate minimum degree ordering algorithm 
#   umfpack: space linear system solver
#   cholmod: a sparse Cholesky factorization package.
# --------------------------------------------------------------
# namespace eval metis {
#     config set INCPATH ${pckg}/metis/Program
#     config set LIBPATH ${pckg}/metis 
#     config set LIBS    { metis }
# }
namespace eval amd {
    config set INCPATH ${pckg}/UFsparse/AMD/Include
    config set LIBPATH ${pckg}/UFsparse/AMD/Lib
    config set LIBS    { amd }
}
namespace eval colamd {
    config set INCPATH ${pckg}/UFsparse/COLAMD 
    config set LIBPATH ${pckg}/UFsparse/COLAMD  
    config set LIBS    { colamd }
}
namespace eval ccolamd {
    config set INCPATH ${pckg}/UFsparse/CCOLAMD 
    config set LIBPATH ${pckg}/UFsparse/CCOLAMD  
    config set LIBS    { ccolamd }
}
namespace eval umfpack {
    config set INCPATH ${pckg}/UFsparse/UMFPACK/Include
    config set LIBPATH ${pckg}/UFsparse/UMFPACK/Lib
    config set LIBS    { umfpack }
    config set DEPEND  { amd }
}
namespace eval cholmod {
    config set INCPATH ${pckg}/UFsparse/CHOLMOD/Include 
    config set LIBPATH ${pckg}/UFsparse/CHOLMOD/Lib 
    config set LIBS    { cholmod }
    config set DEPEND  { colamd amd metis ccolamd umfpack } 
}

# --------------------------------------------------------------
# ANN: Approximate Nearest Neighbor Searching
#      http://www.cs.umd.edu/~mount/ANN/
# --------------------------------------------------------------
namespace eval ann {
    config set INCPATH ${pckg}/ann/include/ANN
    config set LIBPATH ${pckg}/ann/lib
    config set LIBS    { ANN }
}

# but with float as primary data type for coordinates

namespace eval ann_float {
    config set INCPATH ${pckg}/ann_float/include
    config set LIBPATH ${pckg}/ann_float/lib
    config set LIBS    { ANN }
}

# --------------------------------------------------------------
# Ruby
# --------------------------------------------------------------
namespace eval ruby {
    config set INCPATH {/usr/lib/ruby/1.8/i486-linux}
    config set DEPEND  {}
    config set LIBS    {ruby1.8}
}

# --------------------------------------------------------------
# Google Performance Tools
# --------------------------------------------------------------
namespace eval googleperf {
    config set LIBS    {tcmalloc}
}

namespace eval googleprofiler {
    config set LIBS    {profiler}
}

# --------------------------------------------------------------
# OpenRT
# --------------------------------------------------------------
namespace eval openrt {
    config set LIBPATH /HPS/opt/pckg/OpenRT/rtrt/lib
    config set INCPATH {/HPS/opt/pckg/OpenRT/rtrt/include}
    config set LIBS    {OpenRT}
}

# --------------------------------------------------------------
# ooqp
# --------------------------------------------------------------
namespace eval ooqp {
    config set LIBPATH /HPS/opt/pckg/ooqp/lib
    config set INCPATH {/HPS/opt/pckg/ooqp/include}
    config set LIBS {ooqpbase ooqpbound ooqpdense ooqpgendense ooqpgensparse ooqpgondzio ooqpmehrotra ooqpsparse g2c blas}
}

# --------------------------------------------------------------
# NVIDIA CUDA SDK (version 1.0)
# --------------------------------------------------------------
namespace eval cuda {
  config set LIBPATH  /HPS/home-1/cfuchs/new_proj/cuda_sdk_2.0/lib
  config set INCPATH /HPS/home-1/cfuchs/new_proj/cuda_sdk_2.0/common/inc
  config set LIBS    { cuda cudart cutil }
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted support/tmk/config/site/mpi-sb.mpg.de_confdir/sunos.config.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
# -*-Mode: tcl -*-
# $Id: sunos.config,v 1.3 2004/08/09 18:41:51 yamauchih Exp $
# SunOS config file, Max-Planck-Institut fuer Informatik, AG4
#
assert {![string compare $OS $STR_SUNOS]}
dbg_msg "reading [info script]." 1

# where to find the AG4 shared projects
config set ::PROJ_LOCATIONS [list /HPS/usr/ag4-adm/solaris_shared_proj]

# directories in which tmk should NOT check dependencies
config set DEPEND_EXCLUDE {
    /usr/include/* 
    /HPS/opt/* 
    /opt/* 
    /usr/X11R6/*
    /usr/*
    /CYGWIN-B20/*
    /cygwin-b20/*
    /CYGWIN/*  
}

# for the automatic compilation at night, we switch ALL dependencies on!
if {[info exists env(USER)]} {
    if {$env(USER) eq "ag4-adm"} {
	puts "switching on ***all*** dependency checks for ag4-adm"
	config set DEPEND_EXCLUDE {}
    }
}

# we use the C++ standard library in our projects 
# (e.g. MIPSpro needs to be configured for that!)
foreach x {cxx::OPTIONS c::OPTIONS link::OPTIONS} {
    config variable $x
    lappend $x std
}

# --------------------------------------------------------------
# where are software packages located?
# special configuration for our test-linux boxes / laptops
# --------------------------------------------------------------
if {! [info exists pckg]} {
    set pckg /HPS/opt/pckg
}

# --------------------------------------------------------------
# X11 (default)
# --------------------------------------------------------------
set xdir /opt/xfree86-4.0.1
namespace eval x11 {
    config set INCPATH $xdir/include
    config set LIBPATH $xdir/lib
    config set BINDIR  $xdir/bin
    config set LIBS    {Xt Xi Xext Xmu X11 nsl socket}
}

# --------------------------------------------------------------
# MOTIF
# --------------------------------------------------------------
namespace eval motif {
    config set LIBPATH {}
    config set INCPATH {}
    config set LIBS {Xm}
    config set DEPEND {x11}
}

# --------------------------------------------------------------
# DGA (direct gfx access) - only on solaris !
# --------------------------------------------------------------
namespace eval dga {
    config set LIBS {dga}
    config set LIBPATH /usr/X/lib
    config set DEPEND {x11}
}

# --------------------------------------------------------------
# OpenGL 
# --------------------------------------------------------------
namespace eval opengl {
    config set INCPATH {}
    config set LIBPATH {}
    config set LIBS { GLU GL }
    config set DEPEND { dga x11 }
}

# --------------------------------------------------------------
# OpenInventor
# --------------------------------------------------------------
namespace eval inventor {
    config set LIBS   {Inventor}
    config set DEPEND {opengl}
}

namespace eval inventorxt {
  config set LIBS {InventorXt}
  config set DEPEND {Inventor}
}

# --------------------------------------------------------------
# QT 
# --------------------------------------------------------------
namespace eval qt {
    # current version 
    config set DEFS   {QT_CLEAN_NAMESPACE} ; # avoids name conflicts
    config set LIBS   {qt-mt}
    config set DEPEND {gui opengl}

    # config set DIR $pckg/qt
    config set DIR /opt/xfree86-4.0.1/qt-3.3.2

    # multi-threaded current version
    namespace eval mt {
	config set DEFS   {QT_THREAD_SUPPORT}
	config set LIBS   {qt-mt}
    }
    
    # other versions
    namespace eval 3 {
	# config set DIR $pckg/qt3
	config set DIR /opt/xfree86-4.0.1/qt-3.3.2	
    }
    namespace eval 2.2 {
	config set DIR $pckg/qt-2.2.1
    }
    namespace eval 2.0 {
	config set DIR $pckg/qt2
        config set DEPEND gui
    }
}


# --------------------------------------------------------------
# QGL (QT's opengl extension)
# --------------------------------------------------------------
namespace eval qgl {

    # current version is integrated in qt (>= 2.2) 
    config set LIBS   {}
    config set DEPEND {qt opengl gui}

    namespace eval 2.0 {
	config set LIBS {qgl}
	config set DEPEND {qt::2.0 opengl gui}
    }
    
    namespace eval 2.2 {
	config set LIBS {}
	config set DEPEND {qt::2.2 opengl gui}
    }
}


# --------------------------------------------------------------
# GLUT
# current version: 3.7beta
# --------------------------------------------------------------

namespace eval glut {

    config set DEPEND { OPENGL }
    config set LIBS {glut}
    config set INCPATH $pckg/glut/include
    # libpath depends on the compiler/linker
    config set_lazy LIBPATH [subst -nocommands {
	switch -glob \$::link::LINKER {
	    *mipspro {return $pckg/glut/lib}
	    *gcc     {return $pckg/glut/lib}
	    default  {return $pckg/glut/lib}
	}
    }]
}

# --------------------------------------------------------------
# GLOW
# --------------------------------------------------------------
namespace eval glow {
    config set INCPATH $pckg/glow/include
    config set LIBPATH $pckg/glow/lib
    config set LIBS {glow}
     config set DEPEND  {glut}
}

# --------------------------------------------------------------
# GLUI
# --------------------------------------------------------------
namespace eval glui {

    set pckgglui $pckg/glui

    config set INCPATH $pckgglui/include
    config set LIBPATH $pckgglui/lib
    config set LIBS    {glui}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# GLE
# --------------------------------------------------------------
namespace eval gle {
    config set INCPATH $pckg/gle/include
    config set LIBPATH $pckg/gle/lib
    config set LIBS    {gle}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# ACGL
# --------------------------------------------------------------
namespace eval acgl {
    config set INCPATH $pckg/ACGL/include
    config set LIBPATH $pckg/ACGL/lib
    config set LIBS    {acgl}
    config set DEPEND  {opengl}
}

# --------------------------------------------------------------
# LIB3DS - 3D studio import library
# --------------------------------------------------------------
namespace eval lib3ds {
    config set LIBPATH $pckg/lib3ds/lib
    config set INCPATH $pckg/lib3ds/include
    config set LIBS { 3ds }
}


# --------------------------------------------------------------
# TIFF
# --------------------------------------------------------------

namespace eval tiff {

    config set LIBPATH $pckg/tiff/lib
    config set INCPATH $pckg/tiff/include 
    config set LIBS    {tiff}

    # patched version
    namespace eval patched {
	config set LIBPATH $pckg/tiff-patched/lib32
	config set INCPATH $pckg/tiff-patched/include 
    }

}

# --------------------------------------------------------------
# PNG
# --------------------------------------------------------------

namespace eval png {
    #    config set INCPATH $pckg/libpng/include
    #    config set LIBPATH $pckg/libpng/lib
    config set LIBS    {png z}
    config set DEPEND  {zlib}
}

# --------------------------------------------------------------
# JPEG
# --------------------------------------------------------------

namespace eval jpeg {
    #    config set INCPATH $pckg/jpeg-6b/include
    #    config set LIBPATH $pckg/jpeg-6b/lib
    config set LIBS    {jpeg}
    config set DEPEND  {}
}

# --------------------------------------------------------------
# ZLIB
# --------------------------------------------------------------

namespace eval zlib {
    config set INCPATH      $pckg/zlib/include
    config set LIBPATH      $pckg/zlib/lib
    config set LIBS         {z}
}

# --------------------------------------------------------------
# BZLIB
# --------------------------------------------------------------

namespace eval bzlib {
    config set INCPATH $pckg/bzip2/include
    config set LIBPATH $pckg/bzip2/lib
    config set LIBS    { bz2 }
}

# --------------------------------------------------------------
# LUG
# --------------------------------------------------------------

namespace eval lug {
    config set INCPATH $pckg/lug/include
    config set LIBPATH $pckg/lug/lib
    config set LIBS    {lug}
}

# --------------------------------------------------------------
# flTk
# --------------------------------------------------------------

namespace eval fltk {
  config set DEPEND {gui}
  config set LIBPATH /HPS/opt/lib32
  config set INCPATH /HPS/opt/include
  config set LIBS    {fltk}
}

# --------------------------------------------------------------
# quicktime4linux - reading & writing .mov files
# --------------------------------------------------------------
namespace eval quicktime4linux {
  config set DEPEND {pthread}
  config set LIBPATH $pckg/quicktime/lib
  config set INCPATH $pckg/quicktime/include
  config set LIBS    {quicktime glib}
}

# --------------------------------------------------------------
# OpenCV - Intel's Computer Vision Library
# --------------------------------------------------------------
namespace eval opencv {
  config set DEPEND {ipl}
  config set LIBPATH $pckg/opencv/lib
  config set INCPATH $pckg/opencv/include
  config set LIBS    {opencv}
}

# --------------------------------------------------------------
# IPL - Intel's Image Processing Library
# --------------------------------------------------------------
namespace eval ipl {
  config set DEPEND {}
  config set LIBPATH {}
  config set INCPATH {/usr/include/ipl}
  config set LIBS    {iplpx ipla6 iplm6 }
}

# --------------------------------------------------------------
# ImageMagick C++ 
# --------------------------------------------------------------
namespace eval magick++ {
    config set DEPEND {}
    config set LIBPATH $pckg/ImageMagick/lib
    config set INCPATH $pckg/ImageMagick/include
#     if { $OSCLASS eq $STR_WINDOWS } {
# 	config set LIBS    { CORE_RL_magick++_}
#     } else {
# 	config set LIBS    {Magick}
#     }
    config set LIBS    {Magick}
    config set DEPEND {Magick}
}

# --------------------------------------------------------------
# ImageMagick  
# --------------------------------------------------------------
namespace eval magick {
    config set LIBPATH $pckg/ImageMagick/lib
    config set INCPATH $pckg/ImageMagick/include
    config set LIBS    {Magick}
}

# --------------------------------------------------------------
# TCL 
# --------------------------------------------------------------
namespace eval tcl {
    config set DEPEND {}
    config set LIBPATH $pckg/tcl8.4a1/lib
    config set INCPATH $pckg/tcl8.4a1/include
    config set LIBS    {tcl8.4}
}

# --------------------------------------------------------------
# TK 
# --------------------------------------------------------------
namespace eval tk {
    config set DEPEND {tcl}
    config set LIBPATH $pckg/tk8.4a1/lib
    config set INCPATH $pckg/tk8.4a1/include
    config set LIBS    {tk8.4}
}

# --------------------------------------------------------------
# POSIX threads
# --------------------------------------------------------------
namespace eval pthread {
    config set LIBS { pthread }
}

# --------------------------------------------------------------
# Math library (includes should be set automatically)
# --------------------------------------------------------------
namespace eval math {
    config set LIBS {}
}

# --------------------------------------------------------------
# NVIDIA Cg 'C for graphics' toolkit 
# --------------------------------------------------------------
namespace eval cg {
    config set INCPATH $pckg/Cg/include
    config set LIBPATH $pckg/Cg/lib
    config set LIBS    { CgGL Cg  }
    config set DEPEND  { opengl math }
}

# --------------------------------------------------------------
# Fortran->C Compiler
# --------------------------------------------------------------
namespace eval f2c {
    # What is the right way to do this???
    config set INCPATH $pckg/f2c/include
    config set LIBPATH $pckg/f2c/lib
    config set LIBS    { f2c }
}

# --------------------------------------------------------------
# CLAPACK/CBLAS
# --------------------------------------------------------------
namespace eval clapack {
    config set INCPATH $pckg/CLAPACK/include
    config set LIBPATH $pckg/CLAPACK/lib
    config set LIBS    { cblas clapack F77 I77 } 
    config set DEPEND  { math }

    #
    # NOTE: This might interfere with f2c!!! Not tested!
    #
}

#----------------------------------------
# Metis graph partitioning
#----------------------------------------
namespace eval metis {
    config set INCPATH $pckg/metis/include
    config set LIBPATH $pckg/metis/lib
    config set LIBS    { metis } 
    config set DEPEND  { math }
}

#----------------------------------------
# TAUCS sparse linear solvers
#----------------------------------------
namespace eval taucs {
    config set INCPATH $pckg/taucs/include
    config set LIBPATH $pckg/taucs/lib
    config set LIBS    { taucs blas clapack } 
    # removed g2c
    config set DEPEND  { math metis }
    # note: BLAS is installed in /usr/lib for Debian3.0 and IRIX
}

#----------------------------------------
# J.R. Shewchuk's triangle library/binaries 
# http://www-2.cs.cmu.edu/~quake/triangle.html
#----------------------------------------
namespace eval triangle {
    config set INCPATH $pckg/triangle/include
    config set LIBPATH $pckg/triangle/lib
    config set LIBS    { triangle } 
}


# --------------------------------------------------------------
# Various stuff
# --------------------------------------------------------------
config set g::PCCTS         $pckg/pccts
config set purify::PURIFY   /opt/pure/purify-4.1-irix6/purify
catch {config set doxygen::DOXYGEN [exec which doxygen]}

# --------------------------------------------------------------
# Digital Media Software Development Kit by SGI
# --------------------------------------------------------------
namespace eval dmsdk {
    config set LIBS {}
}

# config set cxx::gcc::EXECUTABLE /opt/gnu/bin/g++
# config set cxx::gcc::AR /opt/gnu/bin/ar
# config set c::gcc::EXECUTABLE /opt/gnu/bin/gcc
# config set c::gcc::AR /opt/gnu/bin/ar
# lappend ::::FLAGS -DHAVE_SSTREAM

config set gui::DEPEND {dga}
config set qt::DEFAULT_VERSION 3

# ------------------------------------------
# override some of the definitions for SunOS
# ------------------------------------------
# we don't have NASM installed - don't use MMX
config set USE_MMX 0

# we don't have pgcc installed
lremove cxx::COMPILERS pgcc
lremove c::COMPILERS   pgcc
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted support/tmk/config/site/mpi-sb.mpg.de_confdir/windows.config.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
# -*-Mode: tcl -*-
# $Id: windows.config,v 1.3 2004/08/09 15:42:32 yamauchih Exp $
# site config file, Max-Planck-Institut fur Informatik, AG4
# windows environment.
#

dbs_msg "reading [info script]." 1

#
# read config in order to the OS.
#
# config set ::PROJ_LOCATIONS [list /HPS/usr/ag4-adm/shared_proj]

# directories in which tmk should NOT check dependencies
config set DEPEND_EXCLUDE {
    /usr/include/* 
    /HPS/opt/* 
    /opt/* 
    /usr/X11R6/*
    /usr/*
    /CYGWIN-B20/*
    /cygwin-b20/*
    /CYGWIN/*  
}

# for the automatic compilation at night, we switch ALL dependencies on!
if {[info exists env(USER)]} {
    if {$env(USER) eq "ag4-adm"} {
	puts "switching on ***all*** dependency checks for ag4-adm"
	config set DEPEND_EXCLUDE {}
    }
}

# we use the C++ standard library in our projects 
# (e.g. MIPSpro needs to be configured for that!)
foreach x {cxx::OPTIONS c::OPTIONS link::OPTIONS} {
    config variable $x
    lappend $x "std"
}

# --------------------------------------------------------------
# where are software packages located?
# special configuration for our test-linux boxes / laptops
# --------------------------------------------------------------
if { ! [info exists pckg] } {
set pckg "/HPS/opt/pckg"

    if { $OSCLASS eq $STR_WINDOWS } {
	#  set pckg "C:/Projects/pckg"
	set pckg "@@DATA@AG4OPT@pckg"
    }
}

# --------------------------------------------------------------
# X11 (default)
# --------------------------------------------------------------

namespace eval x11 {

    # non-Linux
    config set INCPATH {}
    config set LIBPATH {}
    catch {config set BINDIR [file dirname [exec which xterm]]}
    # config set LIBS    {Xt Xi Xext Xmu X11}
}

# --------------------------------------------------------------
# MOTIF
# --------------------------------------------------------------
namespace eval motif {
    config set LIBPATH {}
    config set INCPATH {}
    config set LIBS {Xm}
    config set DEPEND {x11}
}

# --------------------------------------------------------------
# DGA (direct gfx access) - only on solaris !
# --------------------------------------------------------------
namespace eval dga {
    config set LIBPATH {}
    config set LIBS   {}
}

# --------------------------------------------------------------
# OpenGL 
# --------------------------------------------------------------
namespace eval opengl {
    config set INCPATH {}
    config set LIBPATH {}

    config set LIBS { glu32 opengl32 }
}

# --------------------------------------------------------------
# OpenInventor
# --------------------------------------------------------------
namespace eval inventor {
    config set LIBS   {Inventor}
    config set DEPEND {opengl}
}

namespace eval inventorxt {
  config set LIBS {InventorXt}
  config set DEPEND {Inventor}
}
   

# --------------------------------------------------------------
# QT 
# --------------------------------------------------------------
namespace eval qt {

    # current version 
    config set DEFS   {QT_CLEAN_NAMESPACE} ; # avoids name conflicts
    # config set LIBS   {qt}
    config set LIBS   {qutil qt-mt230nc qtmain}
    config set DEPEND {opengl}

    config set DIR "C:/qt"

    # multi-threaded current version
    namespace eval mt {
	config set DEFS   {QT_THREAD_SUPPORT}
	config set LIBS   {qt-mt}
    }

    # other versions
    namespace eval 3 {
	config set DIR "C:/qt"
    }

    # other versions
    namespace eval 2.2 {
	config set DIR "C:/qt"
    }
    namespace eval 2.0 {
	config set DIR "C:/qt"
    }
}


# --------------------------------------------------------------
# QGL (QT's opengl extension)
# --------------------------------------------------------------
namespace eval qgl {

    # current version is integrated in qt (>= 2.2) 
    config set LIBS   {}
    config set DEPEND {qt opengl }

    namespace eval 2.0 {
	config set LIBS {qgl}
	config set DEPEND {qt::2.0 opengl }
    }
    
    namespace eval 2.2 {
	config set LIBS {}
	config set DEPEND {qt::2.2 opengl }
    }
}


# --------------------------------------------------------------
# GLUT
# current version: 3.7beta
# --------------------------------------------------------------

namespace eval glut {

    config set DEPEND { OPENGL }
    
    config set LIBS    {glut32}
    config set INCPATH "$pckg/glut/include"
    config set LIBPATH "$pckg/glut/lib"
}

# --------------------------------------------------------------
# GLOW
# --------------------------------------------------------------
namespace eval glow {
    config set INCPATH $pckg/glow/include
    config set LIBPATH $pckg/glow/lib
    config set LIBS {glow}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# GLUI
# --------------------------------------------------------------
namespace eval glui {

    set pckgglui $pckg/glui

    config set INCPATH $pckgglui/include
    config set LIBPATH "$pckgglui/lib"
    config set LIBS    {glui32}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# GLE
# --------------------------------------------------------------
namespace eval gle {
    config set INCPATH $pckg/gle/include
    config set LIBPATH $pckg/gle/lib
    config set LIBS    {gle}
    config set DEPEND  {glut}
}

# --------------------------------------------------------------
# ACGL
# --------------------------------------------------------------
namespace eval acgl {
    config set INCPATH $pckg/ACGL/include
    config set LIBPATH $pckg/ACGL/lib
    config set LIBS    {acgl}
    config set DEPEND  {opengl}
}

# --------------------------------------------------------------
# LIB3DS - 3D studio import library
# --------------------------------------------------------------
namespace eval lib3ds {
    config set LIBPATH $pckg/lib3ds/lib
    config set INCPATH $pckg/lib3ds/include
    config set LIBS { 3ds }
}


# --------------------------------------------------------------
# TIFF
# --------------------------------------------------------------

namespace eval tiff {

    config set LIBPATH $pckg/tiff/lib
    config set INCPATH $pckg/tiff/include 
    config set LIBS    {tiff}

    # patched version
    namespace eval patched {
	config set LIBPATH $pckg/tiff-patched/lib32
	config set INCPATH $pckg/tiff-patched/include 
    }

}

# --------------------------------------------------------------
# PNG
# --------------------------------------------------------------

namespace eval png {
    config set LIBS    {png z}
    config set DEPEND  {zlib}
}

# --------------------------------------------------------------
# JPEG
# --------------------------------------------------------------

namespace eval jpeg {
    config set LIBS    {jpeg}
    config set DEPEND  {}
}

# --------------------------------------------------------------
# ZLIB
# --------------------------------------------------------------

namespace eval zlib {
    config set INCPATH      $pckg/zlib/include
    config set LIBPATH      $pckg/zlib/lib
    config set LIBS         {z}
}

# --------------------------------------------------------------
# BZLIB
# --------------------------------------------------------------

namespace eval bzlib {
    config set INCPATH $pckg/bzip2/include
    config set LIBPATH $pckg/bzip2/lib
    config set LIBS    { bz2 }
}

# --------------------------------------------------------------
# LUG
# --------------------------------------------------------------

namespace eval lug {
    config set INCPATH $pckg/lug/include
    config set LIBPATH $pckg/lug/lib
    config set LIBS    {lug}
}

# --------------------------------------------------------------
# flTk
# --------------------------------------------------------------

namespace eval fltk {
  config set DEPEND {gui}
  config set LIBPATH /HPS/opt/lib32
  config set INCPATH /HPS/opt/include
  config set LIBS    {fltk}
}

# --------------------------------------------------------------
# quicktime4linux - reading & writing .mov files
# --------------------------------------------------------------
namespace eval quicktime4linux {
  config set DEPEND {pthread}
  config set LIBPATH $pckg/quicktime/lib
  config set INCPATH $pckg/quicktime/include
  config set LIBS    {quicktime glib}
}

# --------------------------------------------------------------
# OpenCV - Intel's Computer Vision Library
# --------------------------------------------------------------
namespace eval opencv {
  config set DEPEND {ipl}
  config set LIBPATH $pckg/opencv/lib
  config set INCPATH $pckg/opencv/include
  config set LIBS    {opencv}
}

# --------------------------------------------------------------
# IPL - Intel's Image Processing Library
# --------------------------------------------------------------
namespace eval ipl {
  config set DEPEND {}
  config set LIBPATH {}
  config set INCPATH {/usr/include/ipl}
  config set LIBS    {iplpx ipla6 iplm6 }
}

# --------------------------------------------------------------
# ImageMagick C++ 
# --------------------------------------------------------------
namespace eval magick++ {
    config set DEPEND {}
    config set LIBPATH $pckg/ImageMagick/lib
    config set INCPATH $pckg/ImageMagick/include
    config set LIBS    { CORE_RL_magick++_}
    config set DEPEND {Magick}
}

# --------------------------------------------------------------
# ImageMagick  
# --------------------------------------------------------------
namespace eval magick {
    config set LIBPATH $pckg/ImageMagick/lib
    config set INCPATH $pckg/ImageMagick/include
    config set LIBS    {CORE_RL_magick_}
}

# --------------------------------------------------------------
# TCL 
# --------------------------------------------------------------
namespace eval tcl {
  config set DEPEND {}
  config set LIBPATH $pckg/tcl8.4a1/lib
  config set INCPATH $pckg/tcl8.4a1/include
  config set LIBS    {tcl8.4}
}

# --------------------------------------------------------------
# TK 
# --------------------------------------------------------------
namespace eval tk {
  config set DEPEND {tcl}
  config set LIBPATH $pckg/tk8.4a1/lib
  config set INCPATH $pckg/tk8.4a1/include
  config set LIBS    {tk8.4}
}

# --------------------------------------------------------------
# POSIX threads
# --------------------------------------------------------------
namespace eval pthread {
    config set LIBS {pthread}
}

# --------------------------------------------------------------
# Math library (includes should be set automatically)
# --------------------------------------------------------------
namespace eval math {
    config set LIBS { }
}

# --------------------------------------------------------------
# NVIDIA Cg 'C for graphics' toolkit 
# --------------------------------------------------------------

namespace eval cg {
    config set INCPATH $pckg/Cg/include
    config set LIBPATH $pckg/Cg/lib
    config set LIBS    { CgGL Cg  }
    config set DEPEND  { opengl math }
}

# --------------------------------------------------------------
# Fortran->C Compiler
# --------------------------------------------------------------

namespace eval f2c {
    # What is the right way to do this???
    config set DIR "C:/f2c"
    config set INCPATH "C:/f2c/include"
    config set LIBPATH "C:/f2c/lib"
    # config set LIBS    { f2c }
}

# --------------------------------------------------------------
# CLAPACK/CBLAS
# --------------------------------------------------------------

namespace eval clapack {
    config set INCPATH $pckg/CLAPACK/include
    config set LIBPATH $pckg/CLAPACK/lib
    config set LIBS    { cblas clapack F77 I77 } 
    config set DEPEND  { math }

    #
    # NOTE: This might interfere with f2c!!! Not tested!
    #
}

#----------------------------------------
# Metis graph partitioning
#----------------------------------------

namespace eval metis {
    config set INCPATH $pckg/metis/include
    config set LIBPATH $pckg/metis/lib
    config set LIBS    { metis } 
    config set DEPEND  { math }
}

#----------------------------------------
# TAUCS sparse linear solvers
#----------------------------------------

namespace eval taucs {
    config set INCPATH $pckg/taucs/include
    config set LIBPATH $pckg/taucs/lib
    config set LIBS    { taucs blas clapack } 
    #removed g2c
    config set DEPEND  { math metis }

    # note: BLAS is installed in /usr/lib for Debian3.0 and IRIX
}

#----------------------------------------
# J.R. Shewchuk's triangle library/binaries 
# http://www-2.cs.cmu.edu/~quake/triangle.html
#----------------------------------------

namespace eval triangle {
    config set INCPATH $pckg/triangle/include
    config set LIBPATH $pckg/triangle/lib
    config set LIBS    { triangle } 
}


# --------------------------------------------------------------
# Various stuff
# --------------------------------------------------------------
config set g::PCCTS "//DATA/AG4OPT/pckg/pccts"

# --------------------------------------------------------------
# Digital Media Software Development Kit by SGI
# --------------------------------------------------------------

namespace eval dmsdk {
    config set LIBS {}
}

# ------------------------------------------
# override some of the definitions for SunOS
# ------------------------------------------
# we don't have NASM installed - don't use MMX
config set USE_MMX 0

# we don't have pgcc installed
lremove cxx::COMPILERS pgcc
lremove c::COMPILERS pgcc

# ---------------------------
# lex & yacc for windows
regsub -all \@ $pckg \\\\ pckg_tmp
config set ::yacc::YACC         X:/bin/bison.exe
config set ::yacc::BISON_SIMPLE X:/src/bison-1.28-1/src/bison.s1
config set ::yacc::BISON_HAIRY  X:/src/bison-1.28-1/src/bison.hairy
config set ::lex::LEX           X:/bin/flex.exe

namespace eval ghost {
      
    if { $HOST eq "potassium" } {
	if { $::cxx::COMPILER != "gcc" || $::cxx::gcc::VERSION != "2.96" } {
	    puts stderr "*****************************************************************"
	    puts stderr "Error: GHOST SDK can only be used with GNU compiler version 2.96"
	    puts stderr "       please set PATH variable to /HPS/opt/pckg/gcc-2.96/usr/bin"
	    puts stderr "       and re-configure tmk !!!"
	    puts stderr "*****************************************************************"
	    if { $HOST != "samarium" } {
		exit 1
	    }
	}
    }

    config set INCPATH /HPS/opt/pckg/GHOST/usr/include/GHOST
    config set LIBPATH /HPS/opt/pckg/GHOST/usr/lib
    config set LIBS {
	PHANToMIO	
	ghost	
	rt
	dl
    }
    config set DEPEND { pthread }
}

namespace eval ghost_gl {
    config set LIBS { ghostGL ghostGLDraw gstVRML ghostGLManager ghostGLUTManager }
    config set DEPEND { ghost glut X11 }
}

namespace eval ghost_hapticview {
    config set LIBS { widgets-sgi Xm HapticView reset_screen quit pmouseComClient STIComServer }
    config set DEPEND {ghost_gl}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted support/tmk/config/site/mpino4101.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# -*-Mode: tcl -*-
# $Id: mpino4101,v 1.1 2003/12/17 22:18:16 yamauchih Exp $
# site config file, Max-Planck-Institut fr Informatik, AG4


# directories in which tmk should NOT check dependencies
config set DEPEND_EXCLUDE {
    /usr/include/* 
    /HPS/opt/* 
    /opt/* 
    /usr/X11R6/*
    /usr/*
    /CYGWIN-B20/*
    /cygwin-b20/*
    /CYGWIN/*  
}

# for the automatic compilation at night, we switch ALL dependencies on!
if {[info exists env(USER)]} {
    if {$env(USER) eq "ag4-adm"} {
	puts "switching on ***all*** dependency checks for ag4-adm"
	config set DEPEND_EXCLUDE {}
    }
}

set pckg "/HPS/opt/pckg"

namespace eval gcc3modules {
#    config set INCPATH {/usr/include}
#    config set LIBPATH {/usr/lib}
    config set LIBS {}
}

# --------------------------------------------------------------
# X11 (default)
# --------------------------------------------------------------

namespace eval x11 {

    config set INCPATH /usr/X11R6/include
    config set LIBPATH /usr/X11R6/lib
    config set BINDIR  /usr/X11R6/bin
    config set LIBS   {Xt Xi Xext Xmu X11}
}

# --------------------------------------------------------------
# MOTIF
# --------------------------------------------------------------
namespace eval motif {
    config set LIBS {Xm}
    config set DEPEND {x11}
}

# --------------------------------------------------------------
# DGA (direct gfx access) - only on solaris !
# --------------------------------------------------------------
namespace eval dga {
    config set LIBPATH {}
    config set LIBS   {}
}

# --------------------------------------------------------------
# OpenGL 
# --------------------------------------------------------------
namespace eval opengl {

    config set INCPATH {}
    config set LIBPATH {}
    config set LIBS { GLU GL }
    config set DEPEND { dga x11 }
}

# --------------------------------------------------------------
# OpenInventor
# --------------------------------------------------------------
namespace eval inventor {
    config set LIBS   {Inventor}
    config set DEPEND {opengl gcc3modules}
}

namespace eval inventorxt {
  config set LIBS {InventorXt}
  config set DEPEND {Inventor}
}
   

# --------------------------------------------------------------
# QT 
# --------------------------------------------------------------
namespace eval qt {
    
    # current version 
    config set DEFS   {QT_CLEAN_NAMESPACE} ; # avoids name conflicts
    config set LIBS   {qt}
    config set DEPEND {gui opengl}
    config set DIR     /usr/lib/qt3
    config set INCPATH /usr/lib/qt3/include
    config set LIBPATH /usr/lib/qt3/lib


    # multi-threaded current version
    namespace eval mt {
	config set DEFS   {QT_THREAD_SUPPORT}
	config set LIBS   {qt-mt}
    }
}


# --------------------------------------------------------------
# QGL (QT's opengl extension)
# --------------------------------------------------------------
namespace eval qgl {

    # current version is integrated in qt (>= 2.2) 
    config set DEPEND {qt}
}


# --------------------------------------------------------------
# GLUT
# current version: 3.7beta
# --------------------------------------------------------------

namespace eval glut {

    config set DEPEND { opengl }
    config set LIBS   { glut }
}

# --------------------------------------------------------------
# GLOW
# --------------------------------------------------------------
namespace eval glow {
    config set LIBS {glow}
    config set DEPEND  {glut gcc3modules}
}

# --------------------------------------------------------------
# GLUI
# --------------------------------------------------------------
namespace eval glui {
    config set INCPATH /usr/include/GL
    config set LIBS    {glui}
    config set DEPEND  {glut gcc3modules}
}


# --------------------------------------------------------------
# LIB3DS - 3D studio import library
# --------------------------------------------------------------
namespace eval lib3ds {
    config set INCPATH /home/brabec/Projects/3DS/include
    config set LIBPATH /home/brabec/Projects/3DS/lib
    config set LIBS { 3ds }
}


# --------------------------------------------------------------
# TIFF
# --------------------------------------------------------------
namespace eval tiff {
    config set LIBS    {tiff}
}

# --------------------------------------------------------------
# PNG
# --------------------------------------------------------------
namespace eval png {
    config set LIBS    {png}
    config set DEPEND  {zlib}
}

# --------------------------------------------------------------
# JPEG
# --------------------------------------------------------------
namespace eval jpeg {
    config set LIBS    {jpeg}
}

# --------------------------------------------------------------
# ZLIB
# --------------------------------------------------------------
namespace eval zlib {
    config set LIBS         {z}
}

# --------------------------------------------------------------
# BZLIB
# --------------------------------------------------------------

namespace eval bzlib {
    config set LIBS    { bz2 }
}


# --------------------------------------------------------------
# flTk
# --------------------------------------------------------------

namespace eval fltk {
  config set DEPEND {gui gcc3modules}
  config set LIBS    {fltk}
}


# --------------------------------------------------------------
# OpenCV - Intel's Computer Vision Library
# --------------------------------------------------------------
namespace eval opencv {
  config set DEPEND {ipl gcc3modules}
  config set LIBS   {opencv}
}

# --------------------------------------------------------------
# IPL - Intel's Image Processing Library
# --------------------------------------------------------------
namespace eval ipl {
  config set DEPEND {}
  config set LIBPATH {}
  config set INCPATH {/usr/include/ipl}
  config set LIBS    {iplpx ipla6 iplm6 }
}

# --------------------------------------------------------------
# ImageMagick C++ 
# --------------------------------------------------------------
namespace eval magick++ {
    config set DEPEND {Magick gcc3modules}
    config set LIBS    {Magick}
}

# --------------------------------------------------------------
# ImageMagick  
# --------------------------------------------------------------
namespace eval magick {
   config set DEPEND {pthread gcc3modules}
   config set LIBS    {Magick}
}

# --------------------------------------------------------------
# TCL 
# --------------------------------------------------------------
namespace eval tcl {
  config set DEPEND {}
  config set LIBS    {tcl8.3}
}

# --------------------------------------------------------------
# TK 
# --------------------------------------------------------------
namespace eval tk {
  config set DEPEND {tcl}
  config set LIBS    {tk8.3}
}

# --------------------------------------------------------------
# POSIX threads
# --------------------------------------------------------------

namespace eval pthread {
    config set LIBS {pthread}
}

# --------------------------------------------------------------
# Math library (includes should be set automatically)
# --------------------------------------------------------------
config set math::LIBS {m}

# --------------------------------------------------------------
# NVIDIA Cg 'C for graphics' toolkit 
# --------------------------------------------------------------

namespace eval cg {
    config set INCPATH $pckg/Cg/include
    config set LIBPATH $pckg/Cg/lib
    config set LIBS    { CgGL Cg  }
    config set DEPEND  { opengl math }
}

# --------------------------------------------------------------
# Fortran->C Compiler
# --------------------------------------------------------------

namespace eval f2c {
    # What is the right way to do this???
    config set INCPATH $pckg/f2c/include
    config set LIBPATH $pckg/f2c/lib
    config set LIBS    { f2c }
}

# --------------------------------------------------------------
# CLAPACK/CBLAS
# --------------------------------------------------------------

namespace eval clapack {
    config set INCPATH $pckg/CLAPACK/include
    config set LIBPATH $pckg/CLAPACK/lib
    config set LIBS    { cblas clapack F77 I77 } 
    config set DEPEND  { math }

    #
    # NOTE: This might interfere with f2c!!! Not tested!
    #
}

# --------------------------------------------------------------
# Various stuff
# --------------------------------------------------------------
if { $OSCLASS eq $STR_WINDOWS } {
    config set g::PCCTS "//DATA/AG4OPT/pckg/pccts"
} else {
    config set g::PCCTS         $pckg/pccts
    config set purify::PURIFY   /opt/pure/purify-4.1-irix6/purify
    catch {config set doxygen::DOXYGEN [exec which doxygen]}
}

# --------------------------------------------------------------
# Digital Media Software Development Kit by SGI
# --------------------------------------------------------------

namespace eval dmsdk {
    if {$OS eq $STR_LINUX} {
	config set INCPATH /HPS/projects/medusa/dmsdk/linux/root/usr/include
	config set LIBPATH /HPS/projects/medusa/dmsdk/linux/root/usr/lib
	config set LIBS    {dmutil dmsdk}
    } elseif [string match "IRIX*" $OS] {
        config set INCPATH {}
        config set LIBPATH {}
        config set LIBS    {dmedia audio}
    } else {
       config set LIBS {}
    }
}

 
namespace eval cgal {
    config set INCPATH { /home/brabec/Projects/CGAL/include/CGAL/config/i686_Linux-2.4.19-16mdk_g++-3.2.0/ /home/brabec/Projects/CGAL/include }
    config set LIBPATH /home/brabec/Projects/CGAL/lib/i686_Linux-2.4.19-16mdk_g++-3.2.0
    config set LIBS { CGAL }
}

# we don't have NASM installed - don't use MMX
config set USE_MMX 0

# we don't have pgcc installed
lremove cxx::COMPILERS pgcc
lremove c::COMPILERS pgcc

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































































































































































































































































































































































































































































































Deleted support/tmk/config/site/sample.linux.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# -*-Mode: tcl -*-
# $Id: sample.linux,v 1.1 2003/12/17 22:18:16 yamauchih Exp $
# sample config file for a standard linux distribution

# directories in which tmk should NOT check dependencies
config set DEPEND_EXCLUDE {
    /usr/*
    /opt/* 
}

# --------------------------------------------------------------
# X11 
# --------------------------------------------------------------
namespace eval x11 {
    # find X11 
    regsub /bin/X [exec which X] {} ::xpath
    if {0 == [file isdirectory $xpath]} {
	set xpath /usr/X11R6
    } else {
	set all_x [glob -nocomplain /usr/X11*]
	if [llength $all_x] {
	    set xpath [lindex $all_x 0] 
	} else {
	    set xpath /usr/X11R6
	}
    }
    config set XROOT   $xpath
    config set INCPATH $xpath/include
    config set LIBPATH $xpath/lib
    config set BINDIR  $xpath/bin
    config set LIBS   {Xt Xi Xext Xmu X11}
}


# some standard packages
# ----------------------
# we assume that these are located either in /usr/{lib|include} or 
# in /usr/X11... (these are already in the search path, cause all 
# gui-based libs depend on X11 and /usr is in the standard search 
# path)
if {$LINUX_DIST eq "SuSE"} {
    config set qt::INCPATH /usr/lib/qt/include
} else {
    config set qt::INCPATH /usr/include/qt
}
config set qt::LIBS       { qt }
config set qt::DIR        /opt/qt
config set qt::DEPEND     { gui }
config set qgl::LIBS      { qgl }
config set qgl::DEPEND    { qt opengl }
config set glut::LIBS     { glut }
config set glut::DEPEND   { opengl }
config set tiff::LIBS     { tiff }
config set png::LIBS      { png }
config set png::DEPEND    { zlib }
config set zlib::LIBS     { z }
config set bzlib::LIBS    { bz2 }

# test for Mesa or libGL 
if { [file exists /usr/lib/libGL.so] || \
	[file exists ${x11::XROOT}/lib/libGL.so] } {
    config set opengl::LIBS   { GLU GL }
} else {
    config set opengl::LIBS   { MesaGLU MesaGL }
}
config set opengl::DEPEND { gui }
config set math::LIBS     { m }


















<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































Deleted support/tmk/config/site/template/config-vine2.6-linux.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
#
# Configure file for Vine Linux 2.6 (a Japanese RedHat base distribution.) 
# Vine Linux : http://www.vinelinux.org/
#
#   Copyright (C) 2000-2004 by Yamauchi Hitoshi
#   Max-Planck Institute f"ur Informatik
#   email: hitoshi _at_ mpi-sb.mpg.de.delete.here
#
# ----------------------
# Tips of configuration.
# ----------------------
# Until ``Non Redhat7.2 standard'' line, the setting is according to
# RPM packages. If you use rpm packages, before this line should not
# have any problems. Each package name (without minor virsion) of my
# environment is written in ().     
#
# The part of after this line, it is not depend on rpm, so you should
# change the setting. (Usually, just comment out them may work.)
#

# --------------------------------------------------------------
# tmk : (tmk-0.9)
# installed dir : You can find module dir (and so on)  from here.
# and __TMakeDir will be set to here.
# --------------------------------------------------------------
config set INSTALL_DIR  {/usr/lib/tmk}

# --------------------------------------------------------------
# directories in which tmk should NOT check dependencies
# --------------------------------------------------------------
config set DEPEND_EXCLUDE {
    /usr/include/*
    /usr/local/include/*
    /usr/X11R6/include/*
    /usr/X11/include/*
    /opt/*
}

# --------------------------------------------------------------
# X11R6 (XFree86-4)
# --------------------------------------------------------------
namespace eval x11 {
    config set XROOT   /usr/X11R6
    config set INCPATH /usr/X11R6/include
    config set LIBPATH /usr/X11R6/lib
    config set BINDIR  /usr/X11R6/bin
    config set LIBS   {Xt Xi Xext Xmu X11}
}

# --------------------------------------------------------------
# MOTIF : (lesstif-0.9)
# --------------------------------------------------------------
namespace eval motif {
    config set LIBS {Xm}
    config set DEPEND {x11}
}

# --------------------------------------------------------------
# OpenGL : (XFree86-gl-devel-4)
# --------------------------------------------------------------
namespace eval opengl {
    config set DIR 	/usr/X11R6
    config set INCPATH 	/usr/X11R6/include
    config set LIBPATH 	/usr/X11R6/lib
    config set LIBS	{ GLU GL }
    config set DEPEND	{ x11 }
}

# --------------------------------------------------------------
# GLUT : (unknown : XFree86-gl-devel-4 ?)
# --------------------------------------------------------------
namespace eval glut {
    # config set DIR 	/usr/local
    # config set INCPATH 	/usr/local/include
    # config set LIBS	{ glut }
    # config set DEPEND	{ opengl }
    # libpath depends on the compiler/linker
    #config set_lazy LIBPATH [subst -nocommands {
    #        switch -glob \$::link::LINKER {
    #            *mipspro {return ${DIR}/lib32}
    #            *gcc     {return ${DIR}/lib}
    #            default  {return ${DIR}/lib}
    #        }
    #  }]

    config set DEPEND { opengl }
    config set LIBS   { glut }
}

# --------------------------------------------------------------
# GLUI : not standard
# --------------------------------------------------------------
# namespace eval glui {
#    config set DIR 	NOTFOUND
#    config set INCPATH NOTFOUND/include
#    config set LIBPATH NOTFOUND/lib
#    config set LIBS	{ glui }
#    config set DEPEND	{ glut }
#}

# --------------------------------------------------------------
# QT : Vine 2.6 Vine Seed
# --------------------------------------------------------------
# namespace eval qt {
#     # This is Vine 2.6 default
#     config set DIR 	/usr/lib/qt-2.3.1
#     config set INCPATH 	/usr/lib/qt-2.3.1/include
#     config set LIBPATH 	/usr/lib/qt-2.3.1/lib
#     config set DEFS   {QT_CLEAN_NAMESPACE} ; # avoids name conflicts
#     config set LIBS   {qt}
#     config set DEPEND {gui}
# 
#     # multi-threaded current version
#     namespace eval mt {
#         config set DEFS   {QT_THREAD_SUPPORT}
#         config set LIBS   {qt-mt}
#     }
# }

# --------------------------------------------------------------
# TIFF : (libtiff-3)
# --------------------------------------------------------------
namespace eval tiff {
    config set DIR 	/usr
    config set INCPATH 	/usr/include
    config set LIBPATH 	/usr/lib
    config set LIBS	{ tiff }
}

# --------------------------------------------------------------
# PNG : (libpng-1.0)
# --------------------------------------------------------------
namespace eval png {
    config set DIR 	/usr
    config set INCPATH 	/usr/include
    config set LIBPATH 	/usr/lib
    config set LIBS	{ png z }
    config set DEPEND	{ zlib }
}

# --------------------------------------------------------------
# ZLIB : (zlib-1.1)
# --------------------------------------------------------------
namespace eval zlib {
    config set DIR 	/usr
    config set INCPATH 	/usr/include
    config set LIBPATH 	/usr/lib
    config set LIBS	{ z }
}

# --------------------------------------------------------------
# BZLIB : (bzip2-devel-1.0)
# --------------------------------------------------------------
namespace eval bzlib {
    config set DIR 	/usr
    config set INCPATH 	/usr/include
    config set LIBPATH 	/usr/lib
    config set LIBS	{ bz2 }
}

# --------------------------------------------------------------
# LUG
# --------------------------------------------------------------
# namespace eval lug {
#     config set DIR 	NOTFOUND
#     config set INCPATH 	NOTFOUND/include
#     config set LIBPATH 	NOTFOUND/lib
#     config set LIBS	{ lug }
# }

# --------------------------------------------------------------
# Math library (includes should be set automatically)
# --------------------------------------------------------------
namespace eval math {
    config set LIBS	{   }
}

# --------------------------------------------------------------
# POSIX threads
# --------------------------------------------------------------
namespace eval pthread {
    config set LIBS {pthread}
}


# ==============================================================
# Non Redhat7.2 standard 
# ==============================================================
# --------------------------------------------------------------
# gcc 3
# --------------------------------------------------------------
# namespace eval gcc3modules {
namespace eval gcc {
    config set EXECUTABLE {/usr/local/gcc-3.2/usr/bin/gcc-3.2}    
    config set INCPATH {/usr/local/gcc-3.2/usr/include}
    config set LIBPATH {/usr/local/gcc-3.2/usr/lib}
}

# --------------------------------------------------------------
# QT 3 : (qt-x11-free-3.1)
# --------------------------------------------------------------
namespace eval qt {
    config set DIR 	/usr/local/qt
    config set INCPATH 	/usr/local/qt/include
    config set LIBPATH 	/usr/local/qt/lib
    config set DEFS   {QT_CLEAN_NAMESPACE} ; # avoids name conflicts
    config set LIBS   {qt}
    config set DEPEND {gui}

    # multi-threaded current version
    namespace eval mt {
        config set DEFS   {QT_THREAD_SUPPORT}
        config set LIBS   {qt-mt}
    }

    # other versions
    #	namespace eval 3 {
    #        switch $OSCLASS {
    #            windows {config set DIR L:/opt/qt3}
    #            unix    {config set DIR $pckg/qt3}
    #        }
    #    }
}

# --------------------------------------------------------------
# qgl
# --------------------------------------------------------------
namespace eval qgl {
    # In Qt3, qgl is already part of Qt.
    config set DEPEND {qt}
}

# --------------------------------------------------------------
# Digital Media Software Development Kit by SGI
# --------------------------------------------------------------
namespace eval dmsdk {
    if {$OS eq $STR_LINUX} {
        config set INCPATH /HPS/projects/medusa/dmsdk/linux/root/usr/include
        config set LIBPATH /HPS/projects/medusa/dmsdk/linux/root/usr/lib
        config set LIBS    {dmutil dmsdk}
    } elseif [string match IRIX* $OS] {
        config set INCPATH {}
        config set LIBPATH {}
        config set LIBS    {dmedia audio}
    } else {
       config set LIBS {}
    }
}

# --------------------------------------------------------------
# f2c : rpm f2c package has shared lib problem on my environment.
# --------------------------------------------------------------
namespace eval f2c {
    config set INCPATH {/usr/local/include}
    config set LIBPATH {/usr/local/lib}
    config set LIBS    { f2c }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































































































































































































































Deleted support/tmk/config/site/thorium_windows.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# $Id: thorium_windows,v 1.1 2003/12/17 22:18:16 yamauchih Exp $
# thorium:windows config for AG4, MPI Informatik 

# where do we have our good old packages?
config set pckg c:/ag4/pckg

# where is cygwin / g++
config set cygwin::ROOT          c:/ag4/cygwin~1
config set cxx::gcc::EXECUTABLE  $cygwin::ROOT/h-i586~1/bin/g++
config set c::gcc::EXECUTABLE    $cygwin::ROOT/h-i586~1/bin/gcc
config set cxx::gcc::AR	         $cygwin::ROOT/h-i586~1/bin/ar
config set c::gcc::AR	         $cygwin::ROOT/h-i586~1/bin/ar

# opengl
config set opengl::SDK      $pckg/opengl
config set opengl::INCPATH  $opengl::SDK/include 
config set opengl::LIBPATH  $opengl::SDK/lib 
config set opengl::LIBS     {glu32 opengl32} 

# glut
config set glut::INCPATH    $pckg/glut3.7/include
config set glut::LIBPATH    $pckg/glut3.7/lib
config set glut::LIBS       {glut32}
config set glut::DEPEND     {opengl}

# glui
config set glui::INCPATH    $pckg/glui/include
config set glui::LIBPATH    $pckg/glui/lib
config set glui::LIBS       {glui}
config set glui::DEPEND     {GLUT}

# PNG
config set png::INCPATH     $pckg/libpng/include
config set png::LIBPATH     $pckg/libpng/lib
config set png::LIBS        {png}
config set png::DEPEND      {ZLIB}

# ZLIB
config set zlib::INCPATH    $pckg/zlib/include
config set zlib::LIBPATH    $pckg/zlib/lib
config set zlib::LIBS       {z}

# misc
config set g::PCCTS         $pckg/pccts"
config set math::LIBS       {m}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































Deleted support/tmk/config/site/tin.ag4.

1
2
3
4
5
6
7
8



namespace eval cgal {
    config set INCPATH { /HPS/usr/brabec/Projects/CGAL/include/CGAL/config/i686_Linux-2.4.19-16mdk_g++-3.2.0/ /HPS/usr/brabec/Projects/CGAL/include }
    config set LIBPATH /HPS/usr/brabec/Projects/CGAL/lib/i686_Linux-2.4.19-16mdk_g++-3.2.0
    config set LIBS { CGAL }
}
<
<
<
<
<
<
<
<
















Deleted support/tmk/config/soft/comp/gcc-darwin.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#
# gcc.tmk 
# $Id: gcc-darwin.tmk,v 1.1 2005/04/23 20:53:58 yamauchih Exp $
# configure EGCS / GNU C/C++ compilers for Darwin
#

assert {![string compare $OS $STR_DARWIN]}

# additional Mac stuff
foreach x {FLAGS_PRF FLAGS_DBG FLAGS_STD FLAGS_OPT FLAGS_MAX} {
    lappend LD$x -lobjc
}

#playing around, py, 2012-02-28
#set universal_binary_flags [list -force_cpusubtype_ALL \
#    -mmacosx-version-min=10.4 -arch i386 -arch ppc]
#if {[info exists ::cxx::LDFLAGS]} {
#    set ::cxx::LDFLAGS [list {*}$::link::LD_FLAGS {*}$univeral_binary_flags]
#else
#    set ::cxx::LDFLAGS $universal_binary_flags 
#}
#if {info exists ::c::LDFLAGS} {
#    set ::c::LDFLAGS [list {*}$::link::LD_FLAGS {*}$univeral_binary_flags]
#else
#    set ::c::LDFLAGS $universal_binary_flags 
#}

# definition for Darwin.
# link a static lib 
config proc link_lib {lib obj libspec flags opt} {
    variable AR
    # hack: flags are just not passed to AR at all
    set flags [list {*}$flags {*}[meta_option_flags $opt]]
    set cmd [list cmd [file nativename $AR] rs $lib]
	lappend cmd {*}$obj
    uplevel \#0 $cmd
    ### use libspec?
}

# definition for Darwin.
# link a shared lib
config proc link_shlib {lib obj export_obj libspec flags opt} {
    variable EXECUTABLE
    if {$export_obj ne {}} {
	log_msg "warning (gcc): no support for interface subset export"
    }
    if [regexp async $opt] {
	set async 1
    } else {
	set async 0
    }

    # needed?
    if [lcontains $opt soname] {
        # Darwin
	lappend flags -install_name
	lappend flags $::PROJROOT/$::SUBDIR/$lib
	lappend flags -flat_namespace
	lappend flags -undefined
	lappend flags suppress
    }
    set flags [list {*}$flags {*}[meta_option_flags $opt]]
    set libs  [make_lib_options $libspec $opt]
    # Darwin
    set sharedflag -dynamiclib
    if $async {
	set cmd [list ::tmk::cmd_thread $lib {*}$EXECUTABLE $sharedflag]
    } else {
	set cmd [list cmd {*}$EXECUTABLE $sharedflag]
    }
    set cmd [list {*}$cmd {*}$flags -o $lib $obj {*}$libs]
    uplevel \#0 $cmd
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































Deleted support/tmk/config/soft/comp/gcc-irix.tmk.

1
2
3
4
5
6
7
8
#
# gcc.tmk 
# $Id: gcc-irix.tmk,v 1.1 2005/04/23 20:53:58 yamauchih Exp $
# configure EGCS / GNU C/C++ compilers for IRIX
#
assert {[ regexp IRIX.* $OS ]}

# currently, defalut procs are fine.
<
<
<
<
<
<
<
<
















Deleted support/tmk/config/soft/comp/gcc-linux.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#
# gcc.tmk 
# $Id: gcc-linux.tmk,v 1.1 2005/04/23 20:53:58 yamauchih Exp $
# configure EGCS / GNU C/C++ compilers for Linux
#

assert {![string compare $OS $STR_LINUX]}

# switching to new woody ... bis we keep Debian2.2.
if [file readable /usr/gcc-3.2] {
    if {! [file exists $env(HOME)/.tmk_use_old_gcc]} {
	switch $__module {
	    cxx     {config set EXECUTABLE /usr/bin/g++-3.2}
	    c       {config set EXECUTABLE /usr/bin/gcc-3.2}
	}
    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































Deleted support/tmk/config/soft/comp/gcc-sun.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#
# gcc.tmk 
# $Id: gcc-sun.tmk,v 1.1 2005/04/23 20:53:58 yamauchih Exp $
# configure EGCS / GNU C/C++ compilers for SunOS
#

assert {![string compare $OS SunOS]}

# Sun specialities 
lappend ::${__module}::FLAGS -fPIC
config set METAOPT(64bit)    -m64   

# Definition for SunOS : rpathflag
#
# generate all flags for linking libs with what we are generating.
# recognized options:
# - rpath: store runtime linker paths in lib
# - circular: resolve circular inter-lib symbol dependencies 
# - twice: obsolete, should use "circular"
config proc make_lib_options {libspec opt_expr} {

    set paths {}
    set libs  {}
    
    # ??? wie kann das sein ??? depends on system. -R or -Wl,-rpath,
    set rpathflag -R
    
    # ??? muss das echt sein? und was ist mit /usr/local? ???
    # set paths -L/usr/lib $rpathflag/usr/lib

    # expand options expression, look for some of the options
    eval set opt \[list $opt_expr\]
    set circ [expr [lcontains $opt circular] || [lcontains $opt twice]]
    set rpath [lcontains $opt rpath]

    # process pairs (dir shortname)
    foreach lib [::link::libspec projlib_list $libspec] {
	
	set dir  [lindex $lib 0]
	set name [lindex $lib 1]
	if {![file isdirectory $dir]} {
	    exit_msg "directory $dir does not exist."
	}
	lappend paths -L[file nativename $dir]
	if $rpath {lappend paths $rpathflag[file nativename $dir]}
	lappend libs -l[file nativename ${name}]
    }
    
    # lib path + sys libs
    foreach dir [::link::libspec libpath $libspec] {
	lappend paths -L[file nativename $dir] 
	if $rpath {lappend paths $rpathflag[file nativename $dir]}
    }
    foreach lib [::link::libspec syslibs $libspec] {
	lappend libs -l[file nativename $lib]
    }
    
    # resolve circular inter-lib dependencies?
    # well, we can't really do this, so we just put every lib twice
    if {$circ && ([llength $libs] > 1)} {
	return [list {*}$paths {*}$libs {*}$libs]
    } else {
	return [list {*}$paths {*}$libs]
    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































Deleted support/tmk/config/soft/comp/gcc-windows.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#
# gcc.tmk 
# $Id: gcc-windows.tmk,v 1.1 2005/04/23 20:53:58 yamauchih Exp $
# configure EGCS / GNU C/C++ compilers for Windows
#

assert {![string compare $OSCLASS $STR_WINDOWS]}

# Windows specialities 
#lappend ::${__module}::FLAGS -DWIN32 -mno-cygwin -mwindows
#-mno-cywing flag has been removed from gcc
lappend ::${__module}::FLAGS -DWIN32 -mwindows

# additional flags are needed for cygwin ;-(
if $__IsCygwinSystem {
    foreach x {FLAGS_PRF FLAGS_DBG FLAGS_STD FLAGS_OPT FLAGS_MAX} {
	############################# AAAAAAAAAAAAAAAAAAAAAARRRRRRGGGGGHHHHHHH!!!!
 	lappend $x -DWIN32 -D_WIN32 -I[file nativename /pckg/mingw/include]
 	#lappend $x -mno-cygwin -mwindows
 	lappend $x -mwindows
 	#lappend LD_$x  -L[file nativename /pckg/mingw/lib] -mno-cygwin 
 	lappend LD_$x  -L[file nativename /pckg/mingw/lib]
 	lappend LD_$x  -mwindows -Wl,-e,_mainCRTStartup
    }
}

# link_exe For Windows : link an executable
config proc link_exe {prog obj libspec flags opt} {

    set flags [list {*}$flags {*}[meta_option_flags $opt]]
    set libs  [make_lib_options $libspec $opt]

    if [regexp async $opt] {
	set async 1
    } else {
	set async 0
    }

    # Windows
    lappend flags -Wl,-e,_mainCRTStartup

    variable EXECUTABLE
    if $async {
	set cmd \
	    [list ::tmk::cmd_thread $prog {*}$EXECUTABLE {*}$flags]
    } else {
	set cmd [list cmd {*}$EXECUTABLE {*}$flags]
    }	
    set cmd [list {*}$cmd -o $prog {*}$obj {*}$libs]
    uplevel \#0 $cmd 

}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































Deleted support/tmk/config/soft/comp/gcc.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
#
# gcc.tmk
# $Id: gcc.tmk,v 1.36 2007/10/26 11:37:02 cfuchs_sf Exp $
# configure EGCS / GNU C/C++ compilers : general setting.
#

#
# try to find executables, so we don't need this in the site config
# User can specify the gcc name like tmk -setrunmode gccexename=gcc-3.4
#

#override default OS settings for filname_obj
config proc ::filename_obj {shortname} {return $shortname.o}

set gccname [::tmk::get_runmodestat gccexename]

switch $__module {
    cxx {
	regsub ^gcc $gccname g++ gccname
    }
    c   {
	# no need to change the gccname
    }
    $STR_DEFAULT {log_msg "warning: gcc is not configured for module $__module" }
}

if {[lindex [config set EXECUTABLE [lreplace $gccname 0 0 \
	[auto_execok [lindex $gccname 0]]]] 0] eq {}} {

    exit_msg "Configuration failed.\n\
              gcc.tmk can not find -setrunmode gccexename=\[$gccname\].\n\
              Please make sure your gcc is on your path."
}

# does this belong HERE?
config variable ::${__module}::FLAGS

# we need 'ar' for linking static libs...
#todo: use gcc itself as AR when possible
config set AR [auto_execok ar]

# check version ...
config set VERSION unknown
catch {
    config set VERSION [string trim [exec {*}$EXECUTABLE --version 2>@stdout]]
}

if [regexp pgcc $VERSION] {
    config set BRANCH PGCC
} elseif [regexp egcs $VERSION] {
    config set BRANCH EGCS
} else {
    config set BRANCH GCC
}

#
# dumpversion
#
config set DUMPVERSION unknown
catch {
    config set DUMPVERSION [string trim [exec {*}$EXECUTABLE -dumpversion 2>@stdout]]
}

set verlist [split $DUMPVERSION .]
config set GCCRELEASE      [lindex $verlist 0]
config set GCCMINERVERSION [lindex $verlist 1]
config set GCCPATCHLEVEL   [lindex $verlist 2]

config set NEW_CPP_API 0
if [expr $GCCRELEASE >= 3] {
    if [expr $GCCMINERVERSION >= 1] {
 	lappend ::${__module}::FLAGS -DHAVE_SSTREAM
	# after 3.1
 	config set NEW_CPP_API 1
    }
}

# default flags for g++ as well as for gcc
config set FLAGS_PRF {-fPIC -g3 -pg}
config set FLAGS_DBG {-fPIC -g -Wno-uninitialized}
config set FLAGS_STD {-fPIC -O}
config set FLAGS_OPT {-fPIC -O2}
switch $BRANCH {
    PGCC {config set FLAGS_MAX [list -O6]}
    default {
	if [expr $GCCMINERVERSION >= 1] {
	    config set FLAGS_MAX [list -O6 -DNDEBUG \
		    -fomit-frame-pointer \
		    -falign-functions=4 \
		    -fexpensive-optimizations \
		    -fschedule-insns2 \
		    -finline-functions \
		    -funroll-loops]
	} else {
	    config set FLAGS_MAX [list -O6 -DNDEBUG \
		    -fomit-frame-pointer\
		    -malign-functions=4\
		    -fexpensive-optimizations\
		    -fschedule-insns2\
		    -finline-functions \
		    -funroll-loops]
	}
    }
}


if {$GCCRELEASE eq 2} {
    switch -regexp $GCCMINERVERSION {
	# 2.95.x
	95 {
	    switch -regexp $CPU {
	       pentium[2-9] {
		  lappend FLAGS_MAX -mpentiumpro -DCPU=686
	       }
	       pentium {
		  lappend FLAGS_MAX -mpentium
	       }
	       default {}
	    }
	}
	# else
	default {}	
    }
} elseif {$GCCRELEASE eq 3} {
    switch -regexp $GCCMINERVERSION {
	0 {
	    # 3.0
	    switch -regexp $CPU {
		pentium[2-9] {
		    lappend FLAGS_MAX -march=pentiumpro -mcpu=pentiumpro \
			-DCPU=686
		}
		pentium {
		    lappend FLAGS_MAX -march=pentium -mcpu=pentium -DCPU=586
		}
		athlon {
		    lappend FLAGS_MAX -march=athlon -mcpu=athlon -DCPU=ATHLON
		}
		default {}
	    }
	}
	[1-3] {
	    # 3.1, 3.2, 3.3
	    switch -regexp $CPU {
		pentium4 {
		    lappend FLAGS_MAX -mfpmath=sse -march=pentium4 \
			-mcpu=pentium4 -DCPU=686
		}
		pentium3 {
		    lappend FLAGS_MAX -mfpmath=sse -march=pentium3 \
			-mcpu=pentium3 -DCPU=686
		}
		pentium2 {
		    lappend FLAGS_MAX -march=pentium2 -mcpu=pentium2 -DCPU=686
		}
		pentium {
		    lappend FLAGS_MAX -march=pentium -mcpu=pentium -DCPU=586
		}
		athlon {
		    lappend FLAGS_MAX -march=athlon -mcpu=athlon -DCPU=ATHLON
		}
		sun4u {
		    lappend FLAGS_MAX -fPIC -mcpu=ultrasparc \
			-mtune=ultrasparc -DCPU=ultrasparc
		}
		"Power Macintosh" {
		    lappend FLAGS_MAX -mcpu=powerpc -maltivec -DCPU=POWERPC
		}
		default {}
	    }
	}
	4 {
	    # 3.4
	    switch -regexp $CPU {
		pentium4 {
		    lappend FLAGS_MAX -mfpmath=sse -mtune=pentium4 \
			-march=pentium4 -DCPU=686
		}
		pentium3 {
		    lappend FLAGS_MAX -mfpmath=sse -mtune=pentium3 \
			-march=pentium3 -DCPU=686
		}
		pentium2 {
		    lappend FLAGS_MAX -mtune=pentium2 -march=pentium2 -DCPU=686
		}
		pentium {
		    lappend FLAGS_MAX -mtune=pentium  -march=pentium -DCPU=586
		}
		athlon {
		    lappend FLAGS_MAX -mtune=athlon -DCPU=ATHLON
		}
		opteron {
		    lappend FLAGS_MAX -mtune=opteron -march=opteron -DCPU=ATHLON
		}
		sun4u {
		    lappend FLAGS_MAX -fPIC -mtune=ultrasparc -march=ultrasparc
			-DCPU=ultraspar
		}
		"Power Macintosh" {
			lappend FLAGS_MAX -mcpu=powerpc -mtune=powerpc \
			    -maltivec -DCPU=POWERPC
		}
		default {}
	    }
	}
	
	default {
	    switch -regexp $CPU {
		pentium[2-9] {
		    lappend FLAGS_MAX -march=pentiumpro -mcpu=pentiumpro \
			-DCPU=686
		}
		pentium {
		    lappend FLAGS_MAX -march=pentium -mcpu=pentium -DCPU=586
		}
		athlon {
		    lappend FLAGS_MAX -march=athlon -mcpu=athlon -DCPU=ATHLON
		}
		default {}
	    }
	}
    }
} elseif {$GCCRELEASE eq 4} {
	puts $CPU
    switch -regexp $GCCMINERVERSION {
	[0-9] {
	    switch -regexp $CPU {
		pentium4 {
		    lappend FLAGS_MAX -mfpmath=sse -mtune=pentium4 \
			-march=pentium4 -DCPU=686
		}
		pentium3 {
		    lappend FLAGS_MAX -mfpmath=sse -mtune=pentium3 \
			-march=pentium3 -DCPU=686
		}
		pentium2 {
		    lappend FLAGS_MAX -mtune=pentium2 -march=pentium2 -DCPU=686
		}
		pentium {
		    lappend FLAGS_MAX -mtune=pentium  -march=pentium -DCPU=586
		}
		athlon {
		    lappend FLAGS_MAX -fPIC -mtune=opteron -DCPU=ATHLON
		}
		ix86 {
		    lappend FLAGS_MAX -fPIC -mtune=opteron -DCPU=ATHLON
		}
		opteron {
		    lappend FLAGS_MAX -fPIC -mtune=opteron -march=opteron \
			-DCPU=ATHLON
		}
		sun4u {
		    lappend FLAGS_MAX -fPIC -mtune=ultrasparc \
			-march=ultrasparc -DCPU=ultrasparc
		}
		"Power Macintosh" {
			lappend FLAGS_MAX -mcpu=powerpc -mtune=powerpc \
			    -maltivec -DCPU=POWERPC
		}
		default {}
	    }
	}

	default {
	    switch -regexp $CPU {
		pentium[2-9] {
		    lappend FLAGS_MAX -march=pentiumpro -mcpu=pentiumpro \
			-DCPU=686
		}
		pentium {
		    lappend FLAGS_MAX -march=pentium -mcpu=pentium -DCPU=586
		}
		athlon {
		    lappend FLAGS_MAX -march=athlon -mcpu=athlon -DCPU=ATHLON
		}
		default {}
	    }
	}
    }
} else {
    # 5?
    puts "FLAGS_MAX has not yet supported for gcc $DUMPVERSION."
}


if {$CPU eq "athlon" && $BRANCH ne "PGCC"} {
    if [regexp 2\.\(\[0-9\]+\) $VERSION dummyMatch minorVer] {
	if [expr $minorVer > 95] {
		lappend FLAGS_MAX -mcpu=opteron -march=opteron
	}
    }
}

# what the heck is INCTEMP?
if {$__module eq "cxx"} {
    foreach x {FLAGS_PRF FLAGS_DBG FLAGS_STD FLAGS_OPT FLAGS_MAX} {
	lappend $x -D_INCTEMP
    }
}

#
# 64bit option
#
set addressmode [::tmk::get_runmodestat addressmode]
if {$addressmode eq "64bit"} {
    foreach x {FLAGS_PRF FLAGS_DBG FLAGS_STD FLAGS_OPT FLAGS_MAX} {
	lappend $x -m64 -fPIC
    }
}

# default flags if this compiler is used as the linker
config set LDFLAGS_PRF -pg
config set LDFLAGS_DBG {}
config set LDFLAGS_STD {}
config set LDFLAGS_OPT {}
config set LDFLAGS_MAX {}
if {$addressmode eq "64bit"} {
    foreach x {LDFLAGS_PRF LDFLAGS_DBG LDFLAGS_STD LDFLAGS_OPT LDFLAGS_MAX} {
	lappend $x -m64 -fPIC
    }
}


# flags for some of the meta compiler options
config set METAOPT(nowarn)   -wall
config set METAOPT(warn)     {}
config set METAOPT(fullwarn) -fullwarn
config set METAOPT(ansi)     -ansi
config set METAOPT(stl)      {}
config set METAOPT(shared)   -fPIC ;# ??? really ???
# config set METAOPT(32bit)   -Wl,-n32

# with gcc we don't need an external makedepend
config set EXPLICIT_MAKEDEPEND 0

# gcc work around
# don't use optimization for a given list of object files
config proc ::gccNoOpt {_files} {
    if {($cxx::COMPILER eq "gcc") &&
	(($::CODELEVEL eq "max") || ($::CODELEVEL eq "opt"))} {
	exception $_files {::cxx::gcc::FLAGS} {
	    set ::cxx::gcc::FLAGS $::cxx::gcc::FLAGS_DBG
	}
    }
}

#-----------------------------------------------------------------
# OS depended part.
# please define OS depended proc and variables here.
#-----------------------------------------------------------------
if {$OS eq $STR_LINUX} {
    source $::tmk::dir_soft/comp/gcc-linux.tmk
} elseif {$OS eq $STR_IRIX} {
    source $::tmk::dir_soft/comp/gcc-irix.tmk
} elseif {$OS eq $STR_IRIX64} {
    source $::tmk::dir_soft/comp/gcc-irix.tmk
} elseif {$OS eq $STR_SUNOS} {
    source $::tmk::dir_soft/comp/gcc-sun.tmk
} elseif {$OSCLASS eq $STR_WINDOWS} {
    source $::tmk::dir_soft/comp/gcc-windows.tmk
} elseif {$OS eq $STR_DARWIN} {
    source $::tmk::dir_soft/comp/gcc-darwin.tmk
} else {
    log_msg "Warning! : OS ($OS) is not recognized, use default."
}

#-----------------------------------------------------------------
# config default procs when not exists.
#-----------------------------------------------------------------
# return desired meta compiler options
if {[ info procs meta_option_flags ] eq {}} {
    dbg_msg "use default meta_option_flags."
    config proc meta_option_flags {opt} {
	variable METAOPT
	set result {}
	foreach o $opt {
	    if {[info exists METAOPT($o)]} {
		dbg_msg "meta option $o: flags $METAOPT($o)" 2
		#todo: should this be {*}$METAOPT($o)?
		lappend result $METAOPT($o)
	    } else {
		dbg_msg "no flags for meta option $o" 2
	    }
	}
	return $result
    }
} else {
    dbg_msg "config proc meta_option_flags is already defined."
}

# compile a source file (C or C++)
if {[ info procs compile_obj ] eq {}} {
    dbg_msg "use default compile_obj."
    config proc compile_obj {obj src dep flags opt} {

	variable EXECUTABLE
	if [regexp async $opt] {
	    set async 1
	} else {
	    set async 0
	}

	# convert filenames to native representation, and pay attention
	#   attention that no argument is evaluated too often ('\' problem)!
	set flags [concat $flags [meta_option_flags $opt]]
	if $async {
	    set cmd [list ::tmk::cmd_thread $obj {*}$EXECUTABLE -Wp,-MD,$dep]
	} else {
	    set cmd [list cmd {*}$EXECUTABLE -Wp,-MD,$dep]
	}
	lappend cmd {*}$flags
	lappend cmd  -o $obj -c $src
	uplevel \#0 $cmd
    }
} else {
    dbg_msg "config proc compile_obj is already defined."
}

# # only update dependency file, but do not compile
if {[ info procs update_dependencies ] eq {}} {
    dbg_msg "use default update_dependencies."
    config proc update_dependencies {obj src dep flags opt} {
	variable EXECUTABLE
	# convert filenames to native representation, and pay attention
	#   attention that no argument is evaluated too often ('\' problem)!
	if [file exists $dep] {file delete $dep}
	lappend flags {*}[meta_option_flags $opt]
	puts "updating dependencies for $obj"
	set cmd [list cmd_quiet {*}$EXECUTABLE -M]
	lappend cmd -Wp,-MG -Wp,-MD,$dep
	lappend cmd {*}flags
	lappend cmd $src
	uplevel \#0 $cmd
	### why no -o option? How does gcc know which is the target???
    }
} else {
    dbg_msg "config proc update_dependencies is already defined."
}

# link a static lib
if {[ info procs link_lib ] eq {}} {
    dbg_msg "use default link_lib."
    config proc link_lib {lib obj libspec flags opt} {
	variable AR
	# hack: flags are just not passed to AR at all
	set flags [concat $flags [meta_option_flags $opt]]
	set cmd [list cmd $AR rf $lib]
	lappend cmd {*}$obj
	uplevel \#0 $cmd
	### use libspec?
    }
} else {
    dbg_msg "config proc link_lib is already defined."
}

# # link a shared lib
if {[ info procs link_shlib ] eq {}} {
    dbg_msg "use default link_shlib."
    config proc link_shlib {lib obj export_obj libspec flags opt} {
	variable EXECUTABLE
	if {$export_obj ne {}} {
	    dbg_msg "warning (gcc): no support for interface subset export"
	}
	if [regexp async $opt] {
	    set async 1
	} else {
	    set async 0
	}

	# needed?
	if [lcontains $opt soname] {
	    lappend flags -Wl,-soname=[file tail $lib]
	}
	lappend flags {*}[meta_option_flags $opt]
	set libs  [make_lib_options $libspec $opt]
	set sharedflag -shared
	if $async {
	    set cmd [list ::tmk::cmd_thread $lib {*}$EXECUTABLE $sharedflag]
	} else {
	    set cmd [list cmd {*}$EXECUTABLE $sharedflag]
	}
	lappend cmd {*}$flags -o $lib {*}$obj {*}$libs
	uplevel \#0 $cmd
    }
} else {
    dbg_msg "config proc link_shlib is already defined."
}

# link an executable
if {[ info procs link_exe ] eq {}} {
    dbg_msg "use default link_exe."
    config proc link_exe {prog obj libspec flags opt} {
	lappend flags {*}[meta_option_flags $opt]
	set libs  [make_lib_options $libspec $opt]
	
	if [regexp async $opt] {
	    set async 1
	} else {
	    set async 0
	}
	
	variable EXECUTABLE
	if $async {
	    set cmd [list ::tmk::cmd_thread $prog {*}$EXECUTABLE  {*}$flags]
	} else {
	    set cmd [list cmd {*}$EXECUTABLE {*}$flags]
	}	
	lappend cmd -o $prog {*}$obj {*}$libs
	uplevel \#0 $cmd
    }
} else {
    dbg_msg "config proc link_exe is already defined."
}

# generate all flags for linking libs with what we are generating.
# recognized options:
# - rpath: store runtime linker paths in lib
# - circular: resolve circular inter-lib symbol dependencies
# - twice: obsolete, should use "circular"
if {[ info procs make_lib_options ] eq {}} {
    dbg_msg "use default make_lib_options."
    config proc make_lib_options {libspec opt_expr} {

	set paths {}
	set libs  {}
	
	# rpathflag is depends on environment (see gcc-sunos.tmk). ??? wie kann das sein ???
	set rpathflag -Wl,-rpath,
	
	# ??? muss das echt sein? und was ist mit /usr/local? ???
	# set paths -L/usr/lib $rpathflag/usr/lib
	
	# expand options expression, look for some of the options
	eval set opt \[list $opt_expr\]
	set circ [expr [lcontains $opt circular] || [lcontains $opt twice]]
	set rpath [lcontains $opt rpath]
	
	# process pairs (dir shortname)
	foreach lib [::link::libspec projlib_list $libspec] {
	
	    set dir  [lindex $lib 0]
	    set name [lindex $lib 1]
	    if {![file isdirectory $dir]} {
		exit_msg "directory $dir does not exist."
	    }
	    lappend paths -L[file nativename $dir]
	    if $rpath {lappend paths $rpathflag[file nativename $dir]}
	    lappend libs -l[file nativename ${name}]
	}
	
	# lib path + sys libs
	foreach dir [::link::libspec libpath $libspec] {
	    lappend paths -L[file nativename $dir]
	    if $rpath {lappend paths $rpathflag[file nativename $dir]}
	}
	foreach lib [::link::libspec syslibs $libspec] {
	    lappend libs -l[file nativename $lib]
	}

	# resolve circular inter-lib dependencies?
	# well, we can't really do this, so we just put every lib twice
	if {$circ && ([llength $libs] > 1)} {
	    return [list {*}$paths {*}$libs {*}$libs]
	} else {
	    return [list {*}$paths {*}$libs]
	}
    }
} else {
    dbg_msg "config proc make_lib_options is already defined."
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted support/tmk/config/soft/comp/icc.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# $Id: icc.tmk,v 1.7 2008/04/21 12:04:09 cfuchs_sf Exp $
# configure for Intels C/C++ for linux

# TODO 
# ----
# -ipo is currently buggy (not used)

# try to find executables, so we don't need this in the site config
set EXECUTABLE icc
catch { config set EXECUTABLE [exec which icc] }

# we need 'ar' for linking static libs...
catch {config set AR [exec which ar]}

set out_ver "Version 5.0" 
catch { set out_ver [exec {*}$EXECUTABLE -V -help 2>@stdout] }
if [regexp {Version ([0-9])+\.[0-9]+} $out_ver a b ] {
    config set VERSION [string trim $b]
}


config set FLAGS_PRF {}
config set FLAGS_DBG -g
config set FLAGS_STD {}
config set FLAGS_OPT {}
config set FLAGS_MAX {}

# what the heck is INCTEMP? - INCTEMP tells header files to include templates
# from .cxx files (a poor-mans template mechanism)
if {$__module eq "cxx"} {
    foreach x {FLAGS_PRF FLAGS_DBG FLAGS_STD FLAGS_OPT FLAGS_MAX} {
#	append $x " -Kc++eh -Krtti -Tnoauto -Kc++ -D_INCTEMP"
	lappend x -Kc++eh -Krtti -fPIC -Kc++ -D_INCTEMP
    }
} 

# general options for c and c++
foreach x {FLAGS_PRF FLAGS_DBG FLAGS_STD FLAGS_OPT FLAGS_MAX} {
    lappend x -restrict
}


#switch $CPU {
#    pentium4 {lappend FLAGS_MAX -xWKiM -tpp6}
#    pentium3 {lappend FLAGS_MAX -xKiM -tpp6}
#    pentium2 {lappend FLAGS_MAX -xiM -tpp6}
#    pentium  {lappend FLAGS_MAX -xM -tpp5}
#    athlon   {lappend FLAGS_MAX -xiM -tpp6}
#    ix86     {}
#}

lappend FLAGS_MAX -O3 -vec_report1

if [expr $VERSION > 5] {
    lappend FLAGS_MAX -ipo -ipo_obj
    config set LDFLAGS_MAX [list -ipo -i_dynamic]
} else {
    lappend FLAGS_MAX -ip
    config set LDFLAGS_MAX [list -ip -i_dynamic]
}


# default flags if this compiler is used as the linker 
config set LDFLAGS_PRF -i_dynamic
config set LDFLAGS_DBG -i_dynamic
config set LDFLAGS_STD -i_dynamic
config set LDFLAGS_OPT -i_dynamic



# flags for some of the meta compiler options
config set METAOPT(nowarn)   -w
config set METAOPT(warn)     {}
config set METAOPT(fullwarn) -w2
config set METAOPT(ansi)     -ansi
config set METAOPT(stl)      {}
config set METAOPT(shared)   -KPIC ;# ??? really ???

# with gcc we don't need an external makedepend
config set EXPLICIT_MAKEDEPEND 0

# return desired meta compiler options 
config proc meta_option_flags {opt} {
    variable METAOPT 
    set result {}
    foreach o $opt {
	if [info exists METAOPT($o)] {
	    dbg_msg "meta option $o: flags $METAOPT($o)" 2
		#todo: should this be {*}$METAOPT($o)?
		lappend result $METAOPT($o)
	} else {
	    dbg_msg "no flags for meta option $o" 2
	}
    }
    return $result
}

# compile a source file (C or C++) 
config proc compile_obj {obj src dep flags opt} {

    variable EXECUTABLE

    # convert filenames to native representation, and pay attention
    #   attention that no argument is evaluated too often ('\' problem)!
    catch { update_dependencies $obj $src $dep $flags $opt }
    set flags [list {*}$flags {*}[meta_option_flags $opt]]
    set cmd [list cmd {*}$EXECUTABLE ]
	lappend cmd {*}$flags
    lappend cmd  -o $obj -c $src
    uplevel \#0 $cmd


}

# only update dependency file, but do not compile
config proc update_dependencies {obj src dep flags opt} {
    variable EXECUTABLE
    # convert filenames to native representation, and pay attention
    #   attention that no argument is evaluated too often ('\' problem)!
    if [file exists $dep] {file delete $dep}
    lappend flags {*}[meta_option_flags $opt]
    puts "updating dependencies for $obj"
    set cmd [list cmd_quiet {*}$EXECUTABLE -M]
    lappend cmd -Qoption,cpp,-o$dep
    lappend cmd {*}$flags
    lappend cmd $src
    uplevel \#0 $cmd 
    ### why no -o option? How does gcc know which is the target???
}

# link a static lib
config proc link_lib {lib obj libspec flags opt} {
    variable AR
    # hack: flags are just not passed to AR at all
    lappend flags {*}[meta_option_flags $opt]
#    set libs  [make_lib_options $libspec $opt]
    set cmd [list cmd [file nativename $AR] rf $lib]
    lappend cmd {*}$obj
    uplevel \#0 $cmd
    ### use libspec?
}

# link a shared lib
config proc link_shlib {lib obj export_obj libspec flags opt} {
    variable EXECUTABLE
    if {$export_obj ne {}} {
	log_msg "warning (gcc): no support for interface subset export"
    }
    # needed?
    if [lcontains $opt soname] {
	lappend flags -Qoption,ld,-soname=[file tail $lib]
    }
    lappend flags {*}[meta_option_flags $opt]
    set libs  [make_lib_options $libspec $opt]
    set cmd [list cmd {*}$EXECUTABLE -shared]
    lappend cmd {*}$flags -o $lib {*}$obj {*}$libs]
    uplevel \#0 $cmd
}

# link an executable
config proc link_exe {prog obj libspec flags opt} {

    lappend flags {*}[meta_option_flags $opt]
    set libs  [make_lib_options $libspec $opt]

    variable EXECUTABLE
    lappend cmd {*}$EXECUTABLE {*}$flags
    lappend cmd -o $prog {*}$obj {*}$libs
    uplevel \#0 $cmd 

}

# generate all flags for linking libs with what we are generating.
# recognized options:
# - rpath: store runtime linker paths in lib
# - circular: resolve circular inter-lib symbol dependencies 
# - twice: obsolete, should use "circular"
config proc make_lib_options {libspec opt_expr} {

    set paths {}
    set libs  {}
    
    set rpathflag -Qoption,ld,-rpath,
    
    # ??? muss das echt sein? und was ist mit /usr/local? ???
    # set paths -L/usr/lib $rpathflag/usr/lib
    set paths -L/HPS/opt/pckg/icc/lib $rpathflag/HPS/opt/pckg/icc/lib

    # expand options expression, look for some of the options
    eval set opt \[list $opt_expr\]
    set circ [expr [lcontains $opt circular] || [lcontains $opt twice]]
    set rpath [lcontains $opt rpath]

    # process pairs (dir shortname)
    foreach lib [::link::libspec projlib_list $libspec] {
	
	set dir  [lindex $lib 0]
	set name [lindex $lib 1]
	if {![file isdirectory $dir]} {
	    exit_msg "directory $dir does not exist."
	}
	lappend paths -L[file nativename $dir]
	if $rpath {lappend paths $rpathflag[file nativename $dir]}
	lappend libs -l[file nativename ${name}]
    }
    
    # lib path + sys libs
    foreach dir [::link::libspec libpath $libspec] {
	lappend paths -L[file nativename $dir] 
	if $rpath {lappend paths $rpathflag[file nativename $dir]}
    }
    foreach lib [::link::libspec syslibs $libspec] {
	lappend libs -l[file nativename $lib]
    }
    
    # resolve circular inter-lib dependencies?
    # well, we can't really do this, so we just put every lib twice
    if {$circ && ([llength $libs] > 1)} {
	return [list {*}$paths {*}$libs {*}$libs]
    } else {
	return [list {*}$paths {*}$libs]
    }
}



# gcc work around
# don't use optimization for a given list of object files
config proc ::gccNoOpt {_files} {
    if {($cxx::COMPILER eq "gcc") &&
	(($::CODELEVEL eq "max") || ($::CODELEVEL eq "opt"))} {
	exception $_files {::cxx::gcc::FLAGS} {
	    set ::cxx::gcc::FLAGS $::cxx::gcc::FLAGS_DBG
	}
    }
}

    
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































































































































































































































































































































































Deleted support/tmk/config/soft/comp/mipspro.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# $Id: mipspro.tmk,v 1.7 2002/12/10 13:34:44 ag4-adm Exp $
# configure SGI MIPSpro compiler (for both C and C++) 

# try to find executables, so we don't need this in the site config
if {[file exists /etc/compiler.defaults]} {
    dbg_msg "MIPSpro: found /etc/compiler.defaults"
    switch $__module {
	cxx {catch {config set EXECUTABLE [exec which CC]}}
	c   {catch {config set EXECUTABLE [exec which cc]}}
	default {
	    log_msg "warning: MIPSpro is not configured for module $__module"
	}
    }
} else {
    dbg_msg "MIPSpro: no file /etc/compiler.defaults"
} 


if { $__module eq "cxx" } {
    config set USE_PRELINK_THREADS 1
} else {
    config set USE_PRELINK_THREADS 0
}

# default flags for MIPSpro compilers (C++ as well as C)
config set FLAGS_PRF [list -DHAVE_SSTREAM -g3]
config set FLAGS_DBG [list -DHAVE_SSTREAM -g]
config set FLAGS_STD [list -DHAVE_SSTREAM -g -O]
config set FLAGS_OPT [list -DHAVE_SSTREAM -OPT:Olimit=30000 -O2]
config set FLAGS_MAX [list -DHAVE_SSTREAM -OPT:Olimit=50000 -O3 -INLINE -LNO -IPA]

 

# default flags if MIPSpro is used as the linker 
config set LDFLAGS_PRF {}
config set LDFLAGS_DBG {}
config set LDFLAGS_STD {}
config set LDFLAGS_OPT {}
config set LDFLAGS_MAX -IPA

# flags for some of the meta compiler options
config set METAOPT(nowarn)   [list -woff all]
config set METAOPT(warn)     -Wl,-woff,15,-woff,84,-woff,129,-multigot
config set METAOPT(fullwarn) -fullwarn
config set METAOPT(ansi)     -ansi
config set METAOPT(std)      -LANG:std
config set METAOPT(32bit)    -n32
config set METAOPT(64bit)    -64 -TENV:large_got=ON

# with MIPSpro we don't need an external makedepend
config set EXPLICIT_MAKEDEPEND 0

# return desired meta compiler options 
config proc meta_option_flags {opt} {
    variable METAOPT
    set result {}
    foreach o $opt {
	if [info exists METAOPT($o)] {
	    dbg_msg "meta option $o: flags $METAOPT($o)" 2
		#todo: should this be {*}$METAOPT($o)?
		lappend result $METAOPT($o)
	} else {
	    dbg_msg "no flags for meta option $o" 2
	}
    }
    return $result
}

# compile a source file (C or C++) 
config proc compile_obj {obj src dep flags opt} {
    variable EXECUTABLE

    # 'compile it' command
    variable USE_PRELINK_THREADS

    set flags_prelink {}
    if $USE_PRELINK_THREADS {
	if [info exists ::__UseThreads] {
	    if $::__UseThreads { 
		set flags_prelink [list -J $::__MaxThreads]
	    }
	}
    }

	lappend flags {*}[meta_option_flags $opt]
    if [regexp async $opt] {
	uplevel \#0 [list ::tmk::cmd_thread $obj {*}$EXECUTABLE -MDupdate \
		{*}$dep -c {*}$flags_prelink {*}$flags -o $obj $src]
    } else {
	uplevel \#0 [list cmd {*}$EXECUTABLE -MDupdate {*}$dep -c {*}$flags \
	    -o $obj $src]
    }
}


# only regenerate dependency information file, do not compile
config proc update_dependencies {obj src dep flags opt } {
    variable EXECUTABLE

    # delete old dependency information file
    if [file exists $dep] {file delete $dep}
    
    # 'update dependencies' command
	lappend flags {*}[meta_option_flags $opt]
    puts "updating dependencies for $obj"
    uplevel \#0 [list cmd_quiet {*}$EXECUTABLE -M -MDupdate {*}$dep \
	{*}$flags {*}$src]
    ### why no -o option? How does MIPSpro know which is the target???
}

# link a static lib
config proc link_lib {lib obj libspec flags opt} {
    variable EXECUTABLE

    lappend flags {*}[meta_option_flags $opt]
    set libs  [make_lib_options $libspec $opt]
    set soloc [file dirname $lib]/so_locations
    uplevel \#0 [list cmd {*}$EXECUTABLE -Wl,-update_registry,$soloc \
	-o $lib {*}$flags -ar $obj {*}$libs]
    ### why not use libspec?
}

# link a shared lib
config proc link_shlib {lib obj export_obj libspec flags opt } {
    variable EXECUTABLE
    if {$export_obj ne {}} {
	log_msg "warning (mipspro): no support for interface subset export"
    }

    # needed?
    if [lcontains $opt soname] {
	lappend flags -soname [file tail $lib]
    }

    lappend flags {*}[meta_option_flags $opt]
    set libs  [make_lib_options $libspec $opt]
    set soloc [file dirname $lib]/so_locations
    uplevel \#0 [list cmd {*}$EXECUTABLE -Wl,-update_registry,$soloc \
	-o $lib -shared -all {*}$flags {*}$obj {*}$libs]
}

# MIPSpro command for linking an executable
config proc link_exe {prog obj libspec flags opt} {
    variable EXECUTABLE
    lappend flags {*}[meta_option_flags $opt]
    set libs  [make_lib_options $libspec $opt]
    set soloc [file dirname $prog]/so_locations
    if [regexp async $opt] {
	uplevel \#0 [list ::tmk::cmd_thread $prog {*}$EXECUTABLE \
	    -Wl,-update_registry,$soloc -o $prog {*}$obj {*}$flags {*}$libs]
    } else {
	uplevel \#0 [list cmd {*}$EXECUTABLE -Wl,-update_registry,$soloc \
	    -o $prog {*}$obj {*}$flags {*}$libs]
    }
}

# generate all flags for linking libs with what we are generating
# recognized options:
# - rpath: store runtime linker paths in lib
# - circular: resolve circular inter-lib symbol dependencies 
# - twice: obsolete, should use "circular"
config proc make_lib_options {libspec opt_expr} {
	
    set paths {}
    set libs  {}

    # expand options expression, look for some of the options
    eval set opt \[list $opt_expr\]
    set circ [expr [lcontains $opt circular] || [lcontains $opt twice]]
    set rpath [lcontains $opt rpath]
    
    # process pairs (dir shortname)
    foreach lib [::link::libspec projlib_list $libspec] {

	
	set dir  [lindex $lib 0]
	set name [lindex $lib 1]
	if {![file isdirectory $dir]} {
	    exit_msg "directory $dir does not exist."
	}
	lappend paths -L$dir
	if $rpath {lappend paths -Wl,-rpath,$dir}
	lappend libs -l${name}
    }
    
    # lib path + sys libs
    foreach dir [::link::libspec libpath $libspec] {
	lappend paths -L$dir 
	if $rpath {lappend paths -Wl,-rpath,$dir}
    }
    foreach lib [::link::libspec syslibs $libspec] {
	lappend libs -l$lib
    }
    
    # resolve circular inter-lib dependencies?
    # well, we can't really do this, so we just put every lib twice
    if {$circ && ([llength $libs] > 1)} {
	return [list {*}$paths {*}$libs {*}$libs]
    } else {
	return [list {*}$paths {*}$libs]
    }
}
  
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































































































































Deleted support/tmk/config/soft/comp/nvcc.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
#
# gcc.tmk
# $Id: nvcc.tmk,v 1.2 2008/10/24 07:25:52 cfuchs_sf Exp $
# configure EGCS / GNU C/C++ compilers : general setting.
#

#
# try to find executables, so we don't need this in the site config
# User can specify the gcc name like tmk -setrunmode gccexename=gcc-3.4
#
# set gccname [::tmk::get_runmodestat gccexename ]
# if {$gccname eq "default"} {set gccname gcc}

# # [regsub ^gcc $gccname g++] is after tcl8.4 .
# # [regsub ^gcc $gccname g++ variable] is before tcl8.4. But the result is changed.
# switch $__module {
#     cxx {
#       regsub ^gcc $gccname g++ tmpgccname
#       set gccname $tmpgccname
#     }
#     c   {
#       # no need to change the gccname
#     }
#     default {log_msg "warning: gcc is not configured for module $__module" }
# }

if {[catch {config setifndef EXECUTABLE [exec which nvcc]}]} {
#    exit_msg "Configuration failed.\n\
#              gcc.tmk can not find -setrunmode gccexename=\[gccname\].\n\
#              Please make sure your gcc is on your path."
	       set EXECUTABLE /bin/true
}


# does this belong HERE?
config variable ::${__module}::FLAGS

# we need 'ar' for linking static libs...
catch {config set AR [exec which ar]}

# check version ...
config set VERSION unknown
catch {
    config set VERSION [string trim [exec gcc --version 2>@stdout]]
}

config set BRANCH GCC

#
# dumpversion
#
config set DUMPVERSION unknown
catch {
    config set DUMPVERSION [string trim [exec gcc -dumpversion 2>@stdout]]
}

set verlist [split $DUMPVERSION .]
config set GCCRELEASE      [lindex $verlist 0]
config set GCCMINERVERSION [lindex $verlist 1]
config set GCCPATCHLEVEL   [lindex $verlist 2]

config set NEW_CPP_API 0
if [expr $GCCRELEASE >= 3] {
    if {[expr $GCCMINERVERSION >= 1] || [expr $GCCRELEASE >= 4]} {
        lappend ::${__module}::FLAGS -DHAVE_SSTREAM
        # after 3.1
        config set NEW_CPP_API 1
    }
}

# default flags for g++ as well as for gcc
config set FLAGS_PRF [list -fPIC -g3 -pg]
config set FLAGS_DBG [list -fPIC -g  -D_DEBUG]
config set FLAGS_STD [list -fPIC -O]
config set FLAGS_OPT [list -fPIC -O2]
switch $BRANCH {
    PGCC  {config set FLAGS_MAX [list -O6]}
    default {
        if {[expr $GCCMINERVERSION >= 1] || [expr $GCCRELEASE >=4]} {
            config set FLAGS_MAX [list -O3 -DNDEBUG \
                    -fomit-frame-pointer\
                    -falign-functions=4\
                    -fexpensive-optimizations\
                    -fschedule-insns2\
                    -finline-functions \
                    -funroll-loops]
        } else {
            config set FLAGS_MAX [list -O3 -DNDEBUG \
                    -fomit-frame-pointer\
                    -malign-functions=4\
                    -fexpensive-optimizations\
                    -fschedule-insns2\
                    -finline-functions \
                    -funroll-loops]
        }
    }
}

if {$GCCRELEASE eq 2} {
    switch -regexp $GCCMINERVERSION {
	# 2.95.x
	95 {
	    switch -regexp $CPU {
		pentium[2-9] {
		    lappend FLAGS_MAX -mpentiumpro -DCPU=686
		}
		pentium {
		    lappend FLAGS_MAX -mpentium
		}
		default {}
	    }
	}
	# else 
	default {}	
    }
} elseif {$GCCRELEASE eq 3} {
    switch -regexp $GCCMINERVERSION {
	0 {
	    # 3.0
	    switch -regexp $CPU {
		{pentium[2-9]} {
		    lappend FLAGS_MAX -march=pentiumpro -mcpu=pentiumpro \
			-DCPU=686
		}
		pentium {
		    lappend FLAGS_MAX -march=pentium -mcpu=pentium -DCPU=586
		}
		athlon {
		    lappend FLAGS_MAX -march=athlon -mcpu=athlon -DCPU=ATHLON
		}
		default {}
	    }
	}
	
	[1-3] {
	    # 3.1, 3.2, 3.3
	    switch -regexp $CPU {
		pentium4 {
		    lappend FLAGS_MAX -mfpmath=sse -march=pentium4 \
			-mcpu=pentium4 -DCPU=686
		}
		pentium3 {
		    lappend FLAGS_MAX -mfpmath=sse -march=pentium3 \
			-mcpu=pentium3 -DCPU=686
		}
		pentium2 {
		    lappend FLAGS_MAX -march=pentium2 -mcpu=pentium2 -DCPU=686
		}
		pentium {
		    lappend FLAGS_MAX -march=pentium -mcpu=pentium -DCPU=586
		}
		athlon {
		    lappend FLAGS_MAX -march=athlon -mcpu=athlon -DCPU=ATHLON
		}
		sun4u {
		    lappend FLAGS_MAX -fPIC -mcpu=ultrasparc -mtune=ultrasparc \
			-DCPU=ultrasparc
		}
		"Power Macintosh" {
		    lappend FLAGS_MAX -mcpu=powerpc -maltivec -DCPU=POWERPC
		}
		default {}
	    }
	}
	
	4 {
	    # 3.4
	    switch -regexp $CPU {
		pentium4 {
		    lappend FLAGS_MAX -mfpmath=sse -mtune=pentium4 \
			-march=pentium4 -DCPU=686
		}
		pentium3 {
		    lappend FLAGS_MAX -mfpmath=sse -mtune=pentium3 \
			-march=pentium3 -DCPU=686
		}
		pentium2 {
		    lappend FLAGS_MAX -mtune=pentium2 -march=pentium2 -DCPU=686
		}
		pentium {
		    lappend FLAGS_MAX -mtune=pentium -march=pentium -DCPU=586
		}
		athlon {
		    lappend FLAGS_MAX -mtune=athlon -DCPU=ATHLON
		}
		opteron {
		    lappend FLAGS_MAX -mtune=opteron -march=opteron \
			-DCPU=ATHLON
		}
		sun4u {
		    lappend FLAGS_MAX -fPIC -mtune=ultrasparc \
			-march=ultrasparc -DCPU=ultrasparc
		}
		"Power Macintosh" {
		    lappend FLAGS_MAX -mcpu=powerpc -mtune=powerpc \
			-maltivec -DCPU=POWERPC
		}
		default {}
	    }
	}
	
	default {
	    switch -regexp $CPU {
		pentium[2-9] {
		    lappend FLAGS_MAX -march=pentiumpro -mcpu=pentiumpro \
			-DCPU=686
		}
		pentium {
		    lappend FLAGS_MAX -march=pentium -mcpu=pentium -DCPU=586
		}
		athlon {
		    lappend FLAGS_MAX -march=athlon -mcpu=athlon -DCPU=ATHLON
		}
		default {}
	    }
	}
    }
} elseif {$GCCRELEASE eq 4} {
	puts $CPU
    switch -regexp $GCCMINERVERSION {
	[0-9] {
	    switch -regexp $CPU {
		pentium4 {
		    lappend FLAGS_MAX -mfpmath=sse -mtune=pentium4 \
			-march=pentium4 -DCPU=686
		}
		pentium3 {
		    lappend FLAGS_MAX -mfpmath=sse -mtune=pentium3 \
			-march=pentium3 -DCPU=686
		}
		pentium2 {
		    lappend FLAGS_MAX -mtune=pentium2 -march=pentium2 -DCPU=686
		}
		pentium {
		    lappend FLAGS_MAX -mtune=pentium -march=pentium -DCPU=586
		}
		athlon {
		    lappend FLAGS_MAX -fPIC -mtune=opteron -DCPU=ATHLON
		}
		ix86 {
		    lappend FLAGS_MAX -fPIC -mtune=opteron -DCPU=ATHLON
		}
		opteron {
		    lappend FLAGS_MAX -fPIC -mtune=opteron -march=opteron \
			-DCPU=ATHLON
		}
		sun4u {
		    lappend FLAGS_MAX -fPIC -mtune=ultrasparc \
			-march=ultrasparc -DCPU=ultrasparc
		}
		"Power Macintosh" {
		    lappend FLAGS_MAX -mcpu=powerpc -mtune=powerpc \
			-maltivec -DCPU=POWERPC
		}
		default {}
	    }
	}

	default {
	    switch -regexp $CPU {
		pentium[2-9] {
		    lappend FLAGS_MAX -march=pentiumpro -mcpu=pentiumpro \
			-DCPU=686
		}
		pentium  {
		    lappend FLAGS_MAX -march=pentium -mcpu=pentium -DCPU=586
		}
		athlon {
		    lappend FLAGS_MAX -march=athlon -mcpu=athlon -DCPU=ATHLON
		}
		default {}
	    }
	}
    }
} else {
    # 5?
    puts "FLAGS_MAX has not yet supported for gcc $DUMPVERSION."
}


# convert FLAGS for nvcc
set FLAGS_MAX [concat --compiler-options [join $FLAGS_MAX ,]]
set FLAGS_DBG [concat --compiler-options [join $FLAGS_DBG ,]]
set FLAGS_OPT [concat --compiler-options [join $FLAGS_OPT ,]]
set FLAGS_STD [concat --compiler-options [join $FLAGS_STD ,]]

# what the heck is INCTEMP?
if {$__module eq "cxx"} {
    foreach x {FLAGS_PRF FLAGS_DBG FLAGS_STD FLAGS_OPT FLAGS_MAX} {
        lappend $x -D_INCTEMP
    }
}

#
# 64bit option
#
set addressmode [::tmk::get_runmodestat addressmode ]
if {$addressmode eq "64bit"} {
    foreach x {FLAGS_PRF FLAGS_DBG FLAGS_STD FLAGS_OPT FLAGS_MAX} {
        lappend $x -m64 -fPIC
    }
}

# default flags if this compiler is used as the linker
config set LDFLAGS_PRF -pg
config set LDFLAGS_DBG {}
config set LDFLAGS_STD {} 
config set LDFLAGS_OPT {}
config set LDFLAGS_MAX {}
if {$addressmode eq "64bit"} {
    foreach x {LDFLAGS_PRF LDFLAGS_DBG LDFLAGS_STD LDFLAGS_OPT LDFLAGS_MAX } {
        lappend $x -m64 -fPIC
    }
}


# flags for some of the meta compiler options
config set METAOPT(nowarn)   -wall
config set METAOPT(warn)     {}
config set METAOPT(fullwarn) -fullwarn
config set METAOPT(ansi)     -ansi
config set METAOPT(stl)      {}
config set METAOPT(shared)   -fPIC ;# ??? really ???
# config set METAOPT(32bit)   -Wl,-n32

# with gcc we don't need an external makedepend
config set EXPLICIT_MAKEDEPEND 0

# gcc work around
# don't use optimization for a given list of object files
config proc ::gccNoOpt {_files} {
    if {($cxx::COMPILER eq "gcc") &&
        (($::CODELEVEL eq "max") || ($::CODELEVEL eq "opt"))} {
        exception $_files {::cxx::gcc::FLAGS} {
            set ::cxx::gcc::FLAGS $::cxx::gcc::FLAGS_DBG
        }
    }
}

#-----------------------------------------------------------------
# OS depended part.
# please define OS depended proc and variables here.
#-----------------------------------------------------------------
if {$OS eq $STR_LINUX} {
    source $::tmk::dir_soft/comp/gcc-linux.tmk
} elseif {$OS eq $STR_IRIX} {
    source $::tmk::dir_soft/comp/gcc-irix.tmk
} elseif {$OS eq $STR_IRIX64} {
    source $::tmk::dir_soft/comp/gcc-irix.tmk
} elseif {$OS eq $STR_SUNOS} {
    source $::tmk::dir_soft/comp/gcc-sun.tmk
} elseif {$OSCLASS eq $STR_WINDOWS} {
    source $::tmk::dir_soft/comp/gcc-windows.tmk
} elseif {$OS eq $STR_DARWIN} {
    source $::tmk::dir_soft/comp/gcc-darwin.tmk
} else {
    log_msg "Warning! : OS ($OS) is not recognized, use default."
}

#-----------------------------------------------------------------
# config default procs when not exists.
#-----------------------------------------------------------------
# return desired meta compiler options
if {[ info procs meta_option_flags ] eq {}} {
    dbg_msg "use default meta_option_flags."
    config proc meta_option_flags {opt} {
        variable METAOPT
        set result {}
        foreach o $opt {
            if [info exists METAOPT($o)] {
                dbg_msg "meta option $o: flags $METAOPT($o)" 2
				lappend result $METAOPT($o)
            } else {
                dbg_msg "no flags for meta option $o" 2
            }
        }
        return $result
    }
} else {
    dbg_msg "config proc meta_option_flags is already defined."
}

# compile a source file (C or C++)
if {[ info procs compile_obj ] eq {}} {
    dbg_msg "use default compile_obj."
    config proc compile_obj {obj src dep flags opt} {

        variable EXECUTABLE
        if [regexp async $opt] {
            set async 1
        } else {
            set async 0
        }

        # convert filenames to native representation, and pay attention
        #   attention that no argument is evaluated too often ('\' problem)!
		lappend flags {*}[meta_option_flags $opt]

        # removed the dependency generation for nvcc
        if $async {
            set cmd [list ::tmk::cmd_thread $obj {*}$EXECUTABLE ]
        } else {
            set cmd [list cmd {*}$EXECUTABLE]
        }
#       if $async {
#           set cmd [list ::tmk::cmd_thread $obj {*}$EXECUTABLE -Wp,-MD,$dep]
#       } else {
#           set cmd [list cmd {*}$EXECUTABLE -Wp,-MD,$dep]
#       }

		lappend cmd {*}$flags
        lappend cmd  -o $obj -c $src
        uplevel \#0 $cmd
    }
} else {
    dbg_msg "config proc compile_obj is already defined."
}

# # only update dependency file, but do not compile
if {[ info procs update_dependencies ] eq {}} {
    dbg_msg "use default update_dependencies."
    config proc update_dependencies {obj src dep flags opt} {
        variable EXECUTABLE
        # convert filenames to native representation, and pay attention
        #   attention that no argument is evaluated too often ('\' problem)!
        if [file exists $dep] {file delete $dep}
		lappend flags {*}[meta_option_flags $opt]
        puts "updating dependencies for $obj"
        set cmd [list cmd_quiet {*}$EXECUTABLE -M]
        lappend cmd {*}[list -Wp,-MG -Wp,-MD,$dep]
		lapend cmd {*}$flags
        lappend cmd $src
        uplevel \#0 $cmd
        ### why no -o option? How does gcc know which is the target???
    }
} else {
    dbg_msg "config proc update_dependencies is already defined."
}

# # link a static lib
if {[info procs link_lib] eq {}} {
    dbg_msg "use default link_lib."
    config proc link_lib {lib obj libspec flags opt} {
        variable AR
        # hack: flags are just not passed to AR at all
		lappend flags {*}[meta_option_flags $opt]
        set cmd [list cmd [file nativename $AR] rf $lib]
		lappend cmd {*}$obj
        uplevel \#0 $cmd
        ### use libspec?
    }
} else {
    dbg_msg "config proc link_lib is already defined."
}

# # link a shared lib
if {[info procs link_shlib] eq {}} {
    dbg_msg "use default link_shlib."
    config proc link_shlib {lib obj export_obj libspec flags opt} {
        variable EXECUTABLE
        if {$export_obj != {}} {
            dbg_msg "warning (gcc): no support for interface subset export"
        }
        if [regexp async $opt] {
            set async 1
        } else {
            set async 0
        }

        # needed?
        if [lcontains $opt soname] {
            lappend flags -Wl,-soname=[file tail $lib]
        }
	lappend flags {*}[meta_option_flags $opt]
        set libs  [make_lib_options $libspec $opt]
        set sharedflag -shared
        if $async {
            set cmd [list ::tmk::cmd_thread $lib {*}$EXECUTABLE $sharedflag]
        } else {
            set cmd [list cmd {*}$EXECUTABLE $sharedflag]
        }
		lappend cmd {*}$flags -o $lib {*}$obj {*}$libs
        uplevel \#0 $cmd
    }
} else {
    dbg_msg "config proc link_shlib is already defined."
}

# link an executable
if {[info procs link_exe] eq {}} {
    dbg_msg "use default link_exe."
    config proc link_exe {prog obj libspec flags opt} {
		lappend flags {*}[meta_option_flags $opt]
        set libs [make_lib_options $libspec $opt]

        if [regexp async $opt] {
            set async 1
        } else {
            set async 0
        }

        variable EXECUTABLE
        if $async {
            set cmd [list ::tmk::cmd_thread $prog {*}$EXECUTABLE {*}$flags]
        } else {
            set cmd [list cmd {*}$EXECUTABLE {*}$flags]
        }
		lappend cmd -o $prog {*}libs
        uplevel \#0 $cmd
    }
} else {
    dbg_msg "config proc link_exe is already defined."
}

# generate all flags for linking libs with what we are generating.
# recognized options:
# - rpath: store runtime linker paths in lib
# - circular: resolve circular inter-lib symbol dependencies
# - twice: obsolete, should use "circular"
if {[info procs make_lib_options] eq {}} {
    dbg_msg "use default make_lib_options."
    config proc make_lib_options {libspec opt_expr} {

        set paths {}
        set libs  {}

        # rpathflag is depends on environment (see gcc-sunos.tmk). ??? wie kann das sein ???
        set rpathflag -Wl,-rpath,

        # ??? muss das echt sein? und was ist mit /usr/local? ???
        # set paths [list -L/usr/lib $rpathflag/usr/lib]

        # expand options expression, look for some of the options
        eval set opt \[list $opt_expr\]
        set circ [expr [lcontains $opt circular] || [lcontains $opt twice]]
        set rpath [lcontains $opt rpath]

        # process pairs (dir shortname)
        foreach lib [::link::libspec projlib_list $libspec] {

            set dir  [lindex $lib 0]
            set name [lindex $lib 1]
            if {![file isdirectory $dir]} {
                exit_msg "directory $dir does not exist."
            }
            lappend paths -L[file nativename $dir]
            if $rpath {lappend paths $rpathflag[file nativename $dir]}
            lappend libs -l[file nativename ${name}]
        }

        # lib path + sys libs
        foreach dir [::link::libspec libpath $libspec] {
            lappend paths -L[file nativename $dir]
            if $rpath {lappend paths $rpathflag[file nativename $dir]}
        }
        foreach lib [::link::libspec syslibs $libspec] {
            lappend libs -l[file nativename $lib]
        }

        # resolve circular inter-lib dependencies?
        # well, we can't really do this, so we just put every lib twice
        if {$circ && ([llength $libs] > 1)} {
            return [list {*}$paths {*}$libs {*}$libs]
        } else {
            return [list {*}$paths {*}$libs]
        }
    }
} else {
    dbg_msg "config proc make_lib_options is already defined."
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted support/tmk/config/soft/comp/pgi.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# $Id: pgi.tmk,v 1.1 2001/02/20 16:05:16 brabec Exp $
# configure PGI C/C++ compilers
# not fully functional !
# try to find executables, so we don't need this in the site config
switch $__module {
    cxx     {config set EXECUTABLE [auto_execok pgCC]}
    c       {config set EXECUTABLE [auto_execok pgcc]}
    default {log_msg "warning: pgi is not configured for module $__module" }
}

# we need 'ar' for linking static libs...
config set AR [auto_execok ar]


# default flags for g++ as well as for gcc
config set FLAGS_PRF {}
config set FLAGS_DBG -O0
config set FLAGS_STD -O0
config set FLAGS_OPT -O1
config set FLAGS_MAX [list -Minfo -Minline -Munroll  -Mvect=sse -fast \
    -Minline=levels:10 --no_exceptions]

# what the heck is INCTEMP?
if {$__module eq "cxx"} {
    foreach x {FLAGS_PRF FLAGS_DBG FLAGS_STD FLAGS_OPT FLAGS_MAX} {
	lappend $x -D_INCTEMP
	lappend $x --instantiation_dir
	lappend $x /var/tmp/Templates.PGCC
	lappend $x -tlocal
	lappend $x --gnu_extensions
	lappend $x --no_using_std
	lappend $x -I/usr/pgi/linux86/include/CC
	lappend $x -I/usr/pgi/linux86/include
    }
}

# default flags if this compiler is used as the linker
config set LDFLAGS_PRF {}
config set LDFLAGS_DBG {}
config set LDFLAGS_STD {}
config set LDFLAGS_OPT {}
config set LDFLAGS_MAX [list -Minline -Munroll -tp athlon -Mvect=prefetch \
    -fast -Minline=levels:10 --no_exceptions]


# flags for some of the meta compiler options
config set METAOPT(nowarn)   {}
config set METAOPT(warn)     {}
config set METAOPT(fullwarn) {}
config set METAOPT(ansi)     {}
config set METAOPT(stl)      {}
config set METAOPT(shared)   -fpic ;# ??? really ???
# config set METAOPT(32bit)   -Wl,-n32

# with gcc we don't need an external makedepend
config set EXPLICIT_MAKEDEPEND 0

# return desired meta compiler options
config proc meta_option_flags {opt} {
    variable METAOPT
    set result {}
    foreach o $opt {
	if [info exists METAOPT($o)] {
	    dbg_msg "meta option $o: flags $METAOPT($o)" 2
		#todo: should this be {*}$METAOPT($o)?
		lappend result $METAOPT($o)
	} else {
	    dbg_msg "no flags for meta option $o" 2
	}
    }
    return $result
}

# compile a source file (C or C++)
config proc compile_obj {obj src dep flags opt} {

    variable EXECUTABLE

    # convert filenames to native representation, and pay attention
    #   attention that no argument is evaluated too often ('\' problem)!
	lappend flags {*}[meta_option_flags $opt]
    set cmd [list cmd {*}$EXECUTABLE -c \
	     --one_instantiation_per_object --dependencies_to_file $dep -MD]
	lappend cmd {*}$flags
    lappend cmd  -o $obj $src
    uplevel \#0 $cmd
}

# only update dependency file, but do not compile
config proc update_dependencies {obj src dep flags opt} {
    variable EXECUTABLE
    # convert filenames to native representation, and pay attention
    #   attention that no argument is evaluated too often ('\' problem)!
    if [file exists $dep] {file delete $dep}
    lappend flags {*}[meta_option_flags $opt]
    puts "updating dependencies for $obj"
    set cmd [list cmd_quiet {*}$EXECUTABLE -E -MD --dependencies_to_file $dep]
    lappend cmd {*}$flags
    lappend cmd $src
    uplevel \#0 $cmd
    ### why no -o option? How does gcc know which is the target???
}

# link a static lib
config proc link_lib {lib obj libspec flags opt} {
    variable AR
    # hack: flags are just not passed to AR at all
	lappend flags {*}[meta_option_flags $opt]
#    set libs  [make_lib_options $libspec $opt]
    set cmd [list cmd [file nativename $AR] rf $lib]
    lappend cmd {*}$obj
    uplevel \#0 $cmd
    ### use libspec?
}

# link a shared lib
config proc link_shlib {lib obj export_obj libspec flags opt} {
    variable EXECUTABLE
    if {$export_obj ne {}} {
	log_msg "warning (gcc): no support for interface subset export"
    }
    # needed?
    if [lcontains $opt soname] {
	lappend flags -Wl,-soname=[file tail $lib]
    }
    lappend flags {*}[meta_option_flags $opt]
    set libs  [make_lib_options $libspec $opt]
    set cmd [list cmd {*}$EXECUTABLE -shared]
    lappend cmd {*}$flags -o $lib {*}$obj \
		{*}[glob -nocomplain Template.dir/*.o] {*}$libs

    set prelink [list cmd {*}$EXECUTABLE --prelink_objects]
	lappend prelink {*}$obj {*}[glob -nocomplain Template.dir/*.o] {*}$libs
    uplevel \#0 $prelink
    uplevel \#0 $cmd
}

# link an executable
config proc link_exe {prog obj libspec flags opt} {

    lappend flags {*}[meta_option_flags $opt]
    set libs  [make_lib_options $libspec $opt]

    global OSCLASS
    if {$OSCLASS eq $STR_WINDOWS} {
	lappend flags -Wl,-e,_mainCRTStartup
    }

    variable EXECUTABLE
    set cmd [list cmd {*}$EXECUTABLE {*}$flags]
	lappend cmd -o $prog {*}$obj {*}$libs
    set prelink [list cmd {*}$EXECUTABLE --prelink_objects]
    lappend prelink {*}$obj {*}[glob -nocomplain Template.dir/*.o] {*}$libs
    uplevel \#0 $prelink
    uplevel \#0 $cmd

}

# generate all flags for linking libs with what we are generating.
# recognized options:
# - rpath: store runtime linker paths in lib
# - circular: resolve circular inter-lib symbol dependencies
# - twice: obsolete, should use "circular"
config proc make_lib_options {libspec opt_expr} {

    set paths {}
    set libs  {}

    # ??? wie kann das sein ???
    switch $::OS {
	$STR_SUNOS   {set rpathflag -R}
	default {set rpathflag -Wl,-rpath,}
    }

    # ??? muss das echt sein? und was ist mit /usr/local? ???
    # set paths [list -L/usr/lib $rpathflag/usr/lib]

    # expand options expression, look for some of the options
    eval set opt \[list $opt_expr\]
    set circ [expr [lcontains $opt circular] || [lcontains $opt twice]]
    set rpath [lcontains $opt rpath]

    # process pairs (dir shortname)
    foreach lib [::link::libspec projlib_list $libspec] {
	
	set dir  [lindex $lib 0]
	set name [lindex $lib 1]
	if {![file isdirectory $dir]} {
	    exit_msg "directory $dir does not exist."
	}
	lappend paths -L[file nativename $dir]
	if $rpath {lappend paths $rpathflag[file nativename $dir]}
	lappend libs -l[file nativename ${name}]
    }

    # lib path + sys libs
    foreach dir [::link::libspec libpath $libspec] {
	lappend paths -L[file nativename $dir]
	if $rpath {lappend paths $rpathflag[file nativename $dir]}
    }
    foreach lib [::link::libspec syslibs $libspec] {
	lappend libs -l[file nativename $lib]
    }

    # resolve circular inter-lib dependencies?
    # well, we can't really do this, so we just put every lib twice
    if {$circ && ([llength $libs] > 1)} {
	return [list {*}$paths {*}$libs {*}$libs]
    } else {
	return [list {*}$paths {*}$libs]
    }
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































Deleted support/tmk/config/soft/comp/vc.tmk.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
# $Id: vc.tmk,v 1.15 2002/12/09 20:13:58 brabec Exp $
# configure Microsoft Visual C++ compilers 

set commonDir {}
# try to find product dir etc.
if $__UseRegistry {
    set searchVC {
	{HKEY_LOCAL_MACHINE\Software\Microsoft\DevStudio\6.0\Products\Microsoft Visual C++} \
	{HKEY_LOCAL_MACHINE\Software\Microsoft\DevStudio\5.0\Products\Microsoft Visual C++} 
    }
    set productDir {} 
    foreach i $searchVC {
	if {![catch {set productDir [registry get $i ProductDir ]}]} {
	    break
	}
    }

    if {$productDir eq {}} {
	set searchVNET {
	    {HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\7.0\Setup\VC} 
	}
    
	foreach i $searchVNET {
	    if {![catch {set productDir [registry get $i ProductDir ]}]} {
		break
	    }
	}
	if {$productDir ne {}} {
	    set commonDir {}
	    catch {set commonDir [registry get {HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\7.0} InstallDir]}
	}
	
	puts "got $productDir and $commonDir"
    }

 

    if {$productDir eq {}} {
	log_msg "cannot find Microsoft DevStudio 5.0/6.0"
    }
} else {
    if $__IsCygwinSystem {
	set searchPath [split $env(PATH) :]
        set productDir {}
	foreach i $searchPath {
	    if [file executable $i/cl.exe] {
		set productDir [exec cygpath -w [file dirname $i]]
	    }
	}
        if {$productDir eq {}} {
	    set searchVC {
		"/machine/software/microsoft/devstudio/6.0/products/microsoft visual c++" \
	    	"/machine/software/microsoft/devstudio/5.0/products/microsoft visual c++"
	    }
	    if {![catch {
	       set productDir [exec regtool get \
		  [lindex $searchVC 0]/productdir]}]} {

	       catch {set productDir [exec regtool get \
		  [lindex $searchVC 1]/productdir]}
	    }
	    if {![file exists $productDir]} {
		log_msg "cannot find Microsoft VC++, please add to path ($productDir)"
	    }
        }
    } else {
	log_msg "cannot find Microsoft Visual C++, please add to search path (cl.exe)"
    }
}

config set DIR $productDir
if {$commonDir != {}} {
   config set COMMON_DIR $commonDir
} else {
    config set COMMON_DIR [file join [file dirname $productDir] COMMON]
}
config set DEV_DIR    [file join $COMMON_DIR msdev98]
config set VC_DIR     [file join [file dirname $productDir] VC98]
if {[string match NT* $OSVER]} {
    config set OS_DIR WINNT
} else {
    config set OS_DIR WIN95
}


config set MAKEDEPEND [file nativename $::tmk::dir_arch/util/mkdep.exe]

config set WINPATH "${COMMON_DIR};${DEV_DIR}\\BIN;${COMMON_DIR}\\TOOLS\\${OS_DIR};${COMMON_DIR}\\TOOLS"
config set INCPATH "${DIR}\\PlatformSDK\\INCLUDE;${DIR}\\ATL\\INCLUDE;${DIR}\\INCLUDE;${DIR}\\MFC\\INCLUDE"
config set WINLIB "${DIR}\\Lib;${DIR}\\PlatformSDK\\LIB;${VC_DIR}\\LIB;${VC_DIR}\\MFC\\LIB"
config set CONSOLE_FLAGS {/D WIN32 /D _CONSOLE /D _MBCS}
config set CONSOLE_LDFLAGS {kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /subsystem:console /incremental:yes /pdbtype:sept}

# the executable for both C and C++
config set EXECUTABLE [file join $DIR BIN CL.EXE]
if {![file exists $EXECUTABLE]} {
    log_msg "cannot find $EXECUTABLE"
}


config set AR [file join $DIR BIN LIB.EXE]
if {![file exists $AR]} {
    log_msg "cannot find $AR"
}

# default flags for g++ as well as for gcc
if {$__module eq "cxx"} {
    config set FLAGS_PRF {/D_INCTEMP /DHAVE_SSTREAM /nologo /FD /W3 /MDd /Zi /GXm}
    config set FLAGS_DBG {/D_INCTEMP /DHAVE_SSTREAM /nologo /MDd /GX /Z7 /Od /FD}
    config set FLAGS_STD {/D_INCTEMP /DHAVE_SSTREAM /nologo /MDd /GX /Z7 /Od /FD}
    config set FLAGS_OPT {/D_INCTEMP /DHAVE_SSTREAM /nologo /FD /W3 /MD /O2 /GX}
    config set FLAGS_MAX {/D_INCTEMP /DHAVE_SSTREAM /nologo /EHsc /FD /W3 /MD /Ox /G6 /GL}
} else {
    config set FLAGS_PRF {/D_INCTEMP /DHAVE_SSTREAM /nologo /FD /W3 /MDd /Zi /Gm}
    config set FLAGS_DBG {/D_INCTEMP /DHAVE_SSTREAM /nologo /MDd /GX /Z7 /Od /FD}
    config set FLAGS_STD {/D_INCTEMP /DHAVE_SSTREAM /nologo /FD /W3 /MDd /ZI /O1 /Gm }
    config set FLAGS_OPT {/D_INCTEMP /DHAVE_SSTREAM /nologo /FD /W3 /MD /O2}
    config set FLAGS_MAX {/D_INCTEMP /DHAVE_SSTREAM /nologo /FD /W3 /MD /Ox /G6 /GL}
} 


# default flags if this compiler is used as the linker 
if [regexp Vc7 $productDir] {

config set LDFLAGS_PRF {/fixed:no /nologo /NODEFAULTLIB:LIBC}
config set LDFLAGS_DBG {/fixed:no /nologo /NODEFAULTLIB:LIBC /NODEFAULTLIB:MSVCRT /NODEFAULTLIB:LIBCD /DEBUG}
config set LDFLAGS_STD {/nologo /NODEFAULTLIB:LIBC}
config set LDFLAGS_OPT {/nologo /NODEFAULTLIB:LIBC}
config set LDFLAGS_MAX {/nologo /LTCG /NODEFAULTLIB:LIBC /NODEFAULTLIB:LIBCD}
} else {
config set LDFLAGS_PRF {/nologo /NODEFAULTLIB:LIBC /PDB:NONE}
config set LDFLAGS_DBG {/nologo /NODEFAULTLIB:LIBC /NODEFAULTLIB:LIBCD /PDB:NONE /DEBUG}
config set LDFLAGS_STD {/nologo /NODEFAULTLIB:LIBC /PDB:NONE}
config set LDFLAGS_OPT {/nologo /NODEFAULTLIB:LIBC /PDB:NONE}
config set LDFLAGS_MAX {/nologo /NODEFAULTLIB:LIBC /PDB:NONE}
}

# flags for some of the meta compiler options
config set METAOPT(nowarn)   {}
config set METAOPT(warn)     {}
config set METAOPT(fullwarn) {}
config set METAOPT(ansi)     {}
config set METAOPT(stl)      {}
config set METAOPT(shared)   {}

# with gcc we don't need an external makedepend
config set EXPLICIT_MAKEDEPEND 0

# return desired meta compiler options 
config proc meta_option_flags {opt} {
    variable METAOPT 
    set result {}
    foreach o $opt {
	if [info exists METAOPT($o)] {
	    dbg_msg "meta option $o: flags $METAOPT($o)" 2
	    #todo: should this be {*}$METAOPT($o)?
	    lappend result $METAOPT($o)
	} else {
	    dbg_msg "no flags for meta option $o" 2
	}
    }
	
    return $result
}
config set genDependenciesProc {
    proc genDependencies {in_idb obj out absolutePath msstrings is_cxx} {
	set depout [open $out w]
	puts -nonewline $depout "[file tail $obj]: "
	
	set allStrings {}
	set allStrings [exec $msstrings $in_idb ]
	set allDeps    {}
	regsub -all \\\\ $allStrings / allStrings
	foreach i $allStrings {
	    set i [string trim $i]
	    set extension [file extension $i]
	    if {-1 != [lsearch {.h .hh .cxx .cpp .c .c++} \
		[string tolower $extension]] } {

		if {![regexp /vc7 $i] && ![regexp /vc98 $i] \
		    && ![regexp /p\[a-zA-Z\]+c98 $i] } {

		    if {[regexp ^/ipm/header $i]} {
			set i [string range $i 12 end]
		    }
		    if {[file pathtype $i] eq "relative"} {
			set $i $absolutePath/$i
		    }
		    if [file readable $i] {
			lappend allDeps $i
		    }
		}
	    }
	}
	# unique sort (we want *every* dependency only once)
	set allDeps [lsort \
		[foreach x $allDeps {set _x($x) 1}; array names _x]]
	catch {unset _x}
	puts $depout [join $allDeps]
	close $depout
    }
}

# convert some common flags to VC++ notation (e.g. -D -> /D)
config proc vc_flags {flags} {
    set result {}
    foreach flag $flags {
	switch -glob -- $flag {
	    -D* {
		lappend result /D [string range $flag 2 end]
	    }
	    -I* {
		lappend result /I [string range $flag 2 end]
	    }
	    default {lappend result $flag}
	}
    }
    regsub -all @ $result {\\\\} result
    return $result
}
# compile a source file (C or C++) 
config proc compile_obj {obj src dep flags opt} {
    global __IsCygwinSystem

    variable EXECUTABLE 
    variable CONSOLE_FLAGS
    variable genDependenciesProc
    if [regexp async $opt] {
	set async 1
    } else {
	set async 0
    }

    # convert filenames to native representation, and pay attention
    #   attention that no argument is evaluated too often ('\' problem)!
    set flags [list $flags {*}[meta_option_flags $opt]]
    if $async {
	set cmd [list [file nativename $EXECUTABLE]]
    } else {
	set cmd [list cmd [file nativename $EXECUTABLE]]
    }
    lappend cmd {*}$CONSOLE_FLAGS
    lappend cmd {*}[vc_flags $flags]
    if [regexp cxx [namespace current]] {
	set languageType /Tp
    } else {
	set languageType /Tc
    }
    lappend cmd {*}[list \
	/c $languageType$src /Fd[file rootname $obj].pdb /Fo$obj]

    if $async {
	set script "exec $cmd  >@stdout 2>@stderr <@stdin\n $genDependenciesProc \n genDependencies [file rootname $obj].idb $obj [file rootname $obj].dep [pwd] $::tmk::dir_arch/util/msstrings.exe [regexp cxx [namespace current]]"
	set th [::tmk::script_thread $obj $script]
    } else {
	uplevel \#0 $cmd
	eval $genDependenciesProc
	genDependencies [file rootname $obj].idb $obj [file rootname $obj].dep \
	    [pwd] $::tmk::dir_arch/util/msstrings.exe [regexp cxx [namespace current]]	
    }
}

# compile a source file (C or C++) 
config proc compile_obj_old {obj_out src_in dep_out flags opt} {
    global __IsCygwinSystem

    set all_threads {}
    foreach src $src_in {
	if {llength $src_in] > 1} {
	    set obj [filename_obj [file rootname $src]]
	} else {
	    set obj $obj_out
	}
	variable EXECUTABLE 
	variable CONSOLE_FLAGS

	# convert filenames to native representation, and pay attention
	#   attention that no argument is evaluated too often ('\' problem)!
	lappend flags {*}[meta_option_flags $opt]
	set cmd [list cmd_thread [file nativename $EXECUTABLE]]
	lappend cmd {*}$CONSOLE_FLAGS
	lappend cmd {*}[vc_flags $flags]
	if [regexp cxx [namespace current]] {
	    set languageType /Tp
	} else {
	    set languageType /Tc
	}
	lappend cmd {*}[list \
	    /c $languageType$src /Fd[file rootname $obj].pdb /Fo$obj]
	set th [uplevel \#0 $cmd]
	puts "Thread $th : $src"
	lappend all_threads $th
    }
    puts "Joining threads..."
    foreach th $all_threads {
	if [thread::exists $th] {
	    thread::join $th
	}
    }
    puts Done.
 

   # now we generate the dependecies by hand
    foreach src $src_in {
	if {[llength $src_in] > 1} {
	    regsub ALL_OBJS_PARALLEL $dep_out [file rootname $src] dep
	    set obj [filename_obj [file rootname $src]]
	    puts $dep
	} else {
	    set dep $dep_out
	    set obj $obj_out
	}
	
	set is_cxx [regexp cxx [namespace current]]
	set depout [open [file rootname $obj].dep w]
	puts -nonewline $depout "[file tail $obj]: "

	set allStrings {}
	if {[set stringscmd [auto_execok strings]] ne {}} {
	    catch {set allStrings [exec $stringscmd [file rootname $obj].idb]}
	}
	if {$allStrings eq {}} {
	    set allStrings [exec $::tmk::dir_arch/util/msstrings.exe \
		[file rootname $obj].idb]
	}
	regsub -all {\\} $allStrings / allStrings

	if $__IsCygwinSystem {
	    set absolutePath [exec cygpath -a -u [file dirname $src]]
	} else {
	    set absolutePath [pwd]
	}

	foreach i $allStrings {
	    set i [string trim $i]
	    set extension [file extension $i]
	    if {-1 != [lsearch {.h .hh .cxx .cpp .c .c++} \
	       [string tolower $extension]]} {

		if {![regexp /vc98 $i] && ![regexp /p\[a-zA-Z\]+c98 $i]} {
		    if [regexp ^/ipm/header $i] {
			set i [string range $i 12 end]
		    }
		    if {[file pathtype $i] eq "relative"} {
			set $i $absolutePath/$i
		    }
		    if [file readable $i] {
			lappend allDeps $i
		    } 
		}
	    }
	}
	# unique sort (we want *every* dependency only once
	set allDeps [lsort \
			 [foreach x $allDeps {set _x($x) 1}; array names _x]]
	catch {unset _x}
	puts $depout [join $allDeps]
	close $depout
    }
}

# only update dependency file, but do not compile
config proc update_dependencies {obj src dep flags opt} {
    global __VC_nodepend 
    if {![info exists __VC_nodepend]} {
	set __VC_nodepend 1
	log_msg "explicit dendencies update not supported for VC++"
    }
}

# link a static lib
config proc link_lib {lib obj libspec flags opt} {
    variable AR
    # hack: flags are just not passed to AR at all
    lappend flags {*}[meta_option_flags $opt]
#    set libs  [make_lib_options $libspec $opt]
    set cmd [list cmd [file nativename $AR] /nologo /OUT:$lib]
    lappend cmd {*}$obj
    uplevel \#0 $cmd
    ### use libspec?
}

# link a shared lib
config proc link_shlib {lib obj export_obj libspec flags opt} {
    variable EXECUTABLE
    if {$export_obj != {}} {
	log_msg "warning (gcc): no support for interface subset export"
    }
    # needed?
    if [lcontains $opt soname] {
	lappend flags -Wl,-soname=[file tail $lib]
    }
    lappend flags {*}[meta_option_flags $opt]
    set libs [make_lib_options $libspec $opt]
    set cmd [list cmd [file nativename $EXECUTABLE] -shared]
    lappend cmd {*}$flags -o $lib {*}$obj {*}$libs
    uplevel \#0 $cmd
}

# link an executable
config proc link_exe {prog obj libspec flags opt} {

    lappend flags {*}[meta_option_flags $opt]
    lappend flags {*}[make_lib_options $libspec $opt]

    variable EXECUTABLE
    set cmd [list cmd [file nativename $EXECUTABLE]]
    regsub -all \\\\ $prog \/ prog
    lappend cmd {*}$obj /Fe$prog
    lappend cmd /link {*}$flags
    
    regsub -all \@ $cmd \\\\\\\\ cmd
    uplevel \#0 $cmd 

}

# generate all flags for linking libs with what we are generating.
# recognized options:
# - circular: resolve circular inter-lib symbol dependencies 
# - twice: obsolete, should use "circular"
config proc make_lib_options {libspec opt_expr} {

    set paths {}
    set libs  {}
    
    # expand options expression, look for some of the options
    eval set opt \[list $opt_expr\]
    set circ [expr [lcontains $opt circular] || [lcontains $opt twice]]
    set rpath [lcontains $opt rpath]

    # process pairs (dir shortname)
    foreach lib [::link::libspec projlib_list $libspec] {
	
	set dir  [lindex $lib 0]
	set name [lindex $lib 1]
	if {![file isdirectory $dir]} {
	    exit_msg "directory $dir does not exist."
	}
	append paths " /LIBPATH:$dir"
	append libs  " [filename_lib $name]"
    }
    
    # lib path + sys libs
    foreach dir [::link::libspec libpath $libspec] {
	append paths " /LIBPATH:$dir"
    }
    foreach lib [::link::libspec syslibs $libspec] {
	append libs " [filename_lib $lib]"
    }
    
    # resolve circular inter-lib dependencies?
    # well, we can't really do this, so we just put every lib twice
    if {$circ && ([llength $libs] > 1)} {
	return [list {*}$paths {*}$libs {*}$libs]
    } else {
	return [list {*}$paths {*}$libs]
    }
}

# this is called initially from the language module
config proc init {} {
    global cxx::vc::IS_INITIALIZED 
    global ::env
    global __IsCygwinSystem
    variable WINPATH
    variable INCPATH
 
    set ::env(MSDevDir) ${::cxx::vc::COMMON_DIR}
    set ::env(MSVCDir)  ${::cxx::vc::VC_DIR}
    
    if $__IsCygwinSystem {
	regsub -all \(\[A-Z\]\)\: ${::cxx::vc::WINPATH} /cygdrive/\\1 tmp
	regsub -all \\\\ $tmp / tmp
	regsub -all \; $tmp \: tmp
	set ::env(PATH) $env(PATH):$tmp
    } else {
	set ::env(PATH) $env(PATH);${::cxx::vc::WINPATH}
    }

    set ::env(INCLUDE) ${::cxx::vc::INCPATH}
    set ::env(LIB)  ${cxx::vc::WINLIB}
}

    
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted support/tmk/contrib/cgi/README.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
This is the README to cgi.tcl, a library of Tcl procedures to assist
in writing CGI scripts.  Review the HISTORY file for significant changes.

The cgi.tcl home page is http://expect.nist.gov/cgi.tcl

--------------------
Introduction
--------------------

This is the README file for cgi.tcl, a set of procedures for writing
CGI scripts in Tcl.  The procedures implement the code described in
the paper "Writing CGI scripts in Tcl" which was published in the
Proceedings of the Fourth Tcl Workshop (Tcl '96).

--------------------
Getting Started
--------------------

First, read the paper "Writing CGI Scripts in Tcl", from Tcl '96.  If
you can't find the paper in this archive, it can also be found at:

	http://www.nist.gov/msidlibrary/doc/libes96c.ps

That paper will give you a lot of good ideas for using Tcl, not only
with CGI but plain everyday HTML as well.

Next, try some of the examples in the example directory.  Please read
the "Instructions" section in example/README first.

A rough draft of complete documentation of the individual functions
can be found in ref.txt in the doc directory.  

Note that you are expected to understand Tcl.  I'm not going to
explain how to write Tcl scripts here.  (If you're looking for a Tcl
tutorial, please consider my Expect book which includes a very nice
tutorial on Tcl.)

Similarly, you are expected to understand HTML.  There are plenty of
web tutorials and books on it.  Go read one.  You don't have to become
an expert on HTML, but it is important to get a feel for it.  (The
cgi.tcl package will take care of the details.)  If you plan to do
CGI, you should know a couple more basic things.  Here's a simple CGI
intro:

	http://hoohoo.ncsa.uiuc.edu/cgi/intro.html


--------------------
Status
--------------------

The library is reasonably complete.  It supports forms, tables,
cookies, Netscape extensions, file upload, plug-ins, etc, etc.  On the
other hand, there are some things missing - such as certain deprecated
things in HTML, things I can't believe anyone would use, things that
are special extensions to a browser I'm not familiar with, etc.

This library should run on any system (UNIX, Win, or Mac) which
supports Tcl 8.0.

----------------------
Examples
----------------------

This distribution contains example scripts.  They can be found in the
example directory of this distribution.  Please read the
"Instructions" section in example/README first.

--------------------
Installation
--------------------

If you are on UNIX, read the INSTALL file.
If you are on W95/NT, read the install.win file.
If you are on Mac, read the install.mac file.

--------------------
How to get the latest version of this code
--------------------

The latest version of this code may be received from:

	http://expect.nist.gov/cgi.tcl/cgi.tcl.tar.gz
or	ftp://ftp.nist.gov/mel/div826/subject/expect/cgi.tcl/cgi.tcl.tar.gz

Request email delivery by mailing to "library@cme.nist.gov".  The
contents of the message should be (no subject line) "send
pub/cgi/cgi.tcl.tar.gz".

--------------------
Support from Don Libes or NIST
--------------------

Although I can't promise anything in the way of support, I'd be
interested to hear about your experiences using it (good or bad).  I'm
also interested in hearing bug reports and suggestions for improvement
even though I can't promise to implement them.

If you send me a bug, fix, or question, include the version of
cgi.tcl, version of Tcl, and name and version of the OS that you are
using.  Before sending mail, it may be helpful to verify that your
problem still exists in the latest version.  You can check on the
current release and whether it addresses your problems by retrieving
the latest HISTORY file (see "History" above).


Awards, love letters, and bug reports may be sent to:

Don Libes
National Institute of Standards and Technology
Bldg 220, Rm A-127
Gaithersburg, MD  20899
(301) 975-3535
libes@nist.gov

I hereby place this software in the public domain.  NIST and I would
appreciate credit if this program or parts of it are used.

Design and implementation of this program was funded primarily by
myself.  Funding contributors include the NIST Automated Manufacturing
Research Facility (funded by the Navy Manufacturing Technology
Program), the NIST Scientific and Technical Research Services, the
ARPA Persistent Object Bases project and the Computer-aided
Acquisition and the Logistic Support (CALS) program of the Office of
the Secretary of Defense.

--------------------
Support for Don Libes or NIST
--------------------

NIST accepts external funding and other resources (hardware, software,
and personnel).  This can be a fine way to work more closely with NIST
and encourage particular areas of research.

Funding can be earmarked for specific purposes or for less-specific
purposes.  For example, if you simply like the work I do, you can
contribute directly to my funding which will reduce the amount of time
I have to spend writing proposals and submitting them to other people
for funding on my own.

I can also participate in the NIST Fellows program allowing me to
spend several months to a year working directly with your company and
potentially even at your location.  I am also interested in returning
to an academic program.  I presently have an MS and am hunting for
Ph.D. topics and advisors.  Let me know if you have ideas or are
interested in being my advisor.
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































































Deleted support/tmk/contrib/cgi/cgi.tcl.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
##################################################
#
# cgi.tcl - routines for writing CGI scripts in Tcl
# Author: Don Libes <libes@nist.gov>, January '95
#
# These routines implement the code described in the paper
# "Writing CGI scripts in Tcl" which appeared in the Tcl '96 conference.
# Please read the paper before using this code.  The paper is:
# http://www.cme.nist.gov/msid/pubs/libes96c.ps
#
##################################################

##################################################
# http header support
##################################################

proc cgi_http_head {args} {
    global _cgi env errorInfo

    if {[info exists _cgi(http_head_done)]} return

    set _cgi(http_head_in_progress) 1

    if {0 == [llength $args]} {
	cgi_content_type
    } else {
	if {[catch {uplevel 1 [lindex $args 0]} errMsg]} {
	    set savedInfo $errorInfo
	    cgi_content_type
	}
    }
    cgi_puts ""

    unset _cgi(http_head_in_progress)
    set _cgi(http_head_done) 1

    if {[info exists savedInfo]} {
	error $errMsg $savedInfo
    }
}

# avoid generating http head if not in CGI environment
# to allow generation of pure HTML files
proc _cgi_http_head_implicit {} {
    global env

    if {[info exists env(REQUEST_METHOD)]} cgi_http_head
}

proc cgi_status {num str} {
    global _cgi

    if {[info exists _cgi(http_status_done)]} return
    set _cgi(http_status_done) 1
    puts "Status: $num $str"
}

# If these are called manually, they automatically generate the extra newline

proc cgi_content_type {args} {
    global _cgi

    if {0==[llength $args]} {
	set t text/html
    } else {
	set t [lindex $args 0]
	if {[regexp ^multipart/ $t]} {
	    set _cgi(multipart) 1
	}
    }

    if {[info exists _cgi(http_head_in_progress)]} {
	cgi_puts "Content-type: $t"
    } else {
	cgi_http_head "cgi_content_type $t"
    }
}

proc cgi_redirect {t} {
    global _cgi

    if {[info exists _cgi(http_head_in_progress)]} {
	cgi_status 302 Redirected
	cgi_puts "Uri: $t"
	cgi_puts "Location: $t"
    } else {
	cgi_http_head {
	    cgi_redirect $t
	}
    }
}

# deprecated, use cgi_redirect
proc cgi_location {t} {
    global _cgi

    if {[info exists _cgi(http_head_in_progress)]} {
	cgi_puts "Location: $t"
    } else {
	cgi_http_head "cgi_location $t"
    }
}

proc cgi_target {t} {
    global _cgi

    if {![info exists _cgi(http_head_in_progress)]} {
	error "cgi_target must be set from within cgi_http_head."
    }
    cgi_puts "Window-target: $t"
}

# Make client retrieve url in this many seconds ("client pull").
# With no 2nd arg, current url is retrieved.
proc cgi_refresh {seconds {url ""}} {
    global _cgi

    if {![info exists _cgi(http_head_in_progress)]} {
	error "cgi_refresh must be set from within cgi_http_head.  Try using cgi_http_equiv instead."
    }
    cgi_put "Refresh: $seconds"

    if {0==[string compare $url ""]} {
	cgi_put "; $url"
    }
    cgi_puts ""
}

# Example: cgi_pragma no-cache
proc cgi_pragma {arg} {
    global _cgi

    if {![info exists _cgi(http_head_in_progress)]} {
	error "cgi_pragma must be set from within cgi_http_head."
    }
    cgi_puts "Pragma: $arg"
}

##################################################
# support for debugging or other crucial things we need immediately
##################################################

proc cgi_comment	{args}	{}	;# need this asap

proc cgi_html_comment	{args}	{
    regsub -all {>} $args {\&gt;} args
    cgi_puts "<!--[_cgi_list_to_string $args] -->"
}

set _cgi(debug) -off
proc cgi_debug {args} {
    global _cgi

    set old $_cgi(debug)
    set arg [lindex $args 0]
    if {$arg == "-on"} {
	set _cgi(debug) -on
	set args [lrange $args 1 end]
    } elseif {$arg == "-off"} {
	set _cgi(debug) -off
	set args [lrange $args 1 end]
    } elseif {[regexp "^-t" $arg]} {
	set temp 1
	set _cgi(debug) -on
	set args [lrange $args 1 end]
    } elseif {[regexp "^-noprint$" $arg]} {
	set noprint 1
	set args [lrange $args 1 end]
    }

    set arg [lindex $args 0]
    if {$arg == "--"} {
	set args [lrange $args 1 end]
    }

    if {[llength $args]} {
	if {$_cgi(debug) == "-on"} {

	    _cgi_close_tag
	    # force http head and open html, head, body
	    catch {
		if {[info exists noprint]} {
		    uplevel 1 [lindex $args 0]
		} else {
		    cgi_html {
			cgi_head {
			    cgi_title "debugging before complete HTML head"
			}
			# force body open and leave open
			_cgi_body_start
			uplevel 1 [lindex $args 0]
			# bop back out to catch, so we don't close body
			error "ignore"
		    }
		}
	    }
	}
    }

    if {[info exists temp]} {
	set _cgi(debug) $old
    }
    return $old
}

proc cgi_uid_check {user} {
    global env

    # leave in so old scripts don't blow up
    if {[regexp "^-off$" $user]} return

    if {[info exists env(USER)]} {
	set whoami $env(USER)
    } elseif {0==[catch {exec whoami} whoami]} {
	# "who am i" on some Linux hosts returns "" so try whoami first
    } elseif {0==[catch {exec who am i} whoami]} {
	# skip over "host!"
	regexp "(.*!)?(\[^ \t]*)" $whoami dummy dummy whoami
    } elseif {0==[catch {package require registry}]} {
	set whoami [registry get HKEY_LOCAL_MACHINE\\Network\\Logon username]
    } else {
	set whoami $user  ;# give up and let go
    }
    if {$whoami != "$user"} {
	error "Warning: This CGI script expects to run with uid \"$user\".  However, this script is running as \"$whoami\"."
    }
}

# print out elements of an array
# like Tcl's parray, but formatted for browser
proc cgi_parray {a {pattern *}} {
    upvar 1 $a array
    if {![array exists array]} {
	error "\"$a\" isn't an array"
    }

    set maxl 0
    foreach name [lsort [array names array $pattern]] {
	if {[string length $name] > $maxl} {
	    set maxl [string length $name]
	}
    }
    cgi_preformatted {
	set maxl [expr {$maxl + [string length $a] + 2}]
	foreach name [lsort [array names array $pattern]] {
	    set nameString [format %s(%s) $a $name]
	    cgi_puts [cgi_quote_html [format "%-*s = %s" $maxl $nameString $array($name)]]
	}
    }
}

proc cgi_eval {cmd} {
    global env _cgi

    # put cmd somewhere that uplevel can find it
    set _cgi(body) $cmd

    uplevel 1 {
	global env _cgi

	if {1==[catch $_cgi(body) errMsg]} {
	    # error occurred, handle it
	    set _cgi(errorInfo) $errorInfo

	    if {![info exists env(REQUEST_METHOD)]} {
		puts stderr $_cgi(errorInfo)
		return
	    }
	    # the following code is all to force browsers into a state
	    # such that diagnostics can be reliably shown

	    # close irrelevant things
	    _cgi_close_procs
	    # force http head and open html, head, body
	    cgi_html {
		cgi_body {
		    if {[info exists _cgi(client_error)]} {
			cgi_h3 "Client Error"
			cgi_p "$errMsg  Report this to your system administrator or browser vendor."
		    } else {
			cgi_h3 "An internal error was detected in the service\
				software.  The diagnostics are being emailed to\
				the service system administrator ($_cgi(admin_email))."

			if {$_cgi(debug) == "-on"} {
			    cgi_puts "Heck, since you're debugging, I'll show you the\
				    errors right here:"
			    # suppress formatting
			    cgi_preformatted {
				cgi_puts [cgi_quote_html $_cgi(errorInfo)]
			    }
			} else {
			    cgi_mail_start $_cgi(admin_email)
			    cgi_mail_add "Subject: [cgi_name] CGI problem"
			    cgi_mail_add
			    cgi_mail_add "CGI environment:"
			    cgi_mail_add "REQUEST_METHOD: $env(REQUEST_METHOD)"
			    cgi_mail_add "SCRIPT_NAME: $env(SCRIPT_NAME)"
			    # this next few things probably don't need
			    # a catch but I'm not positive
			    catch {cgi_mail_add "HTTP_USER_AGENT: $env(HTTP_USER_AGENT)"}
			    catch {cgi_mail_add "HTTP_REFERER: $env(HTTP_REFERER)"}
			    catch {cgi_mail_add "HTTP_HOST: $env(HTTP_HOST)"}
			    catch {cgi_mail_add "REMOTE_HOST: $env(REMOTE_HOST)"}
			    catch {cgi_mail_add "REMOTE_ADDR: $env(REMOTE_ADDR)"}
			    cgi_mail_add "cgi.tcl version: 1.2.1"
			    cgi_mail_add "input:"
			    catch {cgi_mail_add $_cgi(input)}
			    cgi_mail_add "cookie:"
			    catch {cgi_mail_add $env(HTTP_COOKIE)}
			    cgi_mail_add "errorInfo:"
			    cgi_mail_add "$_cgi(errorInfo)"
			    cgi_mail_end
			}
		    }
		} ;# end cgi_body
	    } ;# end cgi_html
	} ;# end catch
    } ;# end uplevel
}

# return true if cgi_eval caught an error
proc cgi_error_occurred {} {
    global _cgi

    return [info exists _cgi(errorInfo)]
}

##################################################
# CGI URL creation
##################################################

# declare location of root of CGI files
# this allows all CGI references to be relative in the source
# making it easy to move everything in the future
# If you have multiple roots, just don't call this.
proc cgi_root {args} {
    global _cgi

    if {[llength $args]} {
	set _cgi(root) [lindex $args 0]
    } else {
	set _cgi(root)
    }
}

# make a URL for a CGI script
proc cgi_cgi {args} {
    global _cgi

    set root $_cgi(root)
    if {0!=[string compare $root ""]} {
	if {![regexp "/$" $root]} {
		append root "/"
	}
    }
		
    set suffix [cgi_suffix]
    set arg [lindex $args 0]
    if {0==[string compare $arg "-suffix"]} {
	set suffix [lindex $args 1]
	set args [lrange $args 2 end]
    }

    if {[llength $args]==1} {
	return $root[lindex $args 0]$suffix
    } else {
	return $root[lindex $args 0]$suffix?[join [lrange $args 1 end] &]
    }
}

proc cgi_suffix {args} {
    global _cgi
    if {[llength $args] > 0} {
	set _cgi(suffix) [lindex $args 0]
    }
    if {![info exists _cgi(suffix)]} {
	return .cgi
    } else {
	return $_cgi(suffix)
    }
}

proc cgi_cgi_set {variable value} {
    regsub -all {%}  $value "%25" value
    regsub -all {&}  $value "%26" value
    regsub -all {\+} $value "%2b" value
    regsub -all { }  $value "+"   value
    regsub -all {=}  $value "%3d" value
    regsub -all {#}  $value "%23" value
    regsub -all {/}  $value "%2f" value   ;# Added...
    return $variable=$value
}

##################################################
# URL dictionary support
##################################################

proc cgi_link {args} {
    global _cgi_link _cgi_link_url

    set tag [lindex $args 0]
    if {[llength $args] >= 3} {
	set _cgi_link_url($tag) [lrange $args 2 end]
	set _cgi_link($tag) [eval cgi_url [lrange $args 1 end]]
    } elseif {[llength $args] == 2} {
	return [eval cgi_url [lindex $args end] $_cgi_link_url($tag)]
    }

    return $_cgi_link($tag)
}

# same as above but for images
# note: uses different namespace
proc cgi_imglink {args} {
    global _cgi_imglink

    set tag [lindex $args 0]
    if {[llength $args] >= 2} {
	set _cgi_imglink($tag) [eval cgi_img [lrange $args 1 end]]
    }
    return $_cgi_imglink($tag)
}

##################################################
# hyperlink support
##################################################

# construct a hyperlink labeled "display"
# last arg is the link destination
# any other args are passed through into <a> display
proc cgi_url {display args} {
    set buf "<a href=\"[lindex $args 0]\""
    foreach a [lrange $args 1 end] {
	if {[regexp "^(target|onClick|onMouseOver|onMouseOut)=(.*)" $a dummy attr str]} {
	    append buf " $attr=\"$str\""
	} else {
	    append buf " $a"
	}
    }
    return "$buf>$display</a>"
}

# generate an image reference (<img ...>)
# first arg is image url
# other args are passed through into <img> tag
proc cgi_img {args} {
    set buf "<img src=\"[lindex $args 0]\""
    foreach a [lrange $args 1 end] {
	if {[regexp "^(alt|width|height|lowsrc|usemap)=(.*)" $a dummy attr str]} {
	    append buf " $attr=[cgi_dquote_html $str]"
	} elseif {[regexp "^onError" $a dummy str]} {
	    append buf " onError=\"$str\""
	} else {
	    append buf " $a"
	}
    }
    return "$buf>"
}

# names an anchor so that it can be linked to
proc cgi_anchor_name {name} {
    return "<a name=\"$name\">"
}

proc cgi_base {args} {
    cgi_put "<base"
    foreach a $args {
	if {[regexp "^href=(.*)" $a dummy str]} {
	    cgi_put " href=[cgi_dquote_html $str]"
	} elseif {[regexp "^target=(.*)" $a dummy str]} {
	    cgi_put " target=\"$str\""
	} else {
	    cgi_put " $a"
	}
    }
    cgi_puts ">"
}

##################################################
# quoting support
##################################################

if {[info tclversion] >= 8.2} {
    proc cgi_unquote_input buf {
	# rewrite "+" back to space
	# protect \ from quoting another \ and throwing off other things
	# replace line delimiters with newlines
	set buf [string map -nocase [list + { } "\\" "\\\\" %0d%0a \n] $buf]

	# prepare to process all %-escapes
	regsub -all -nocase {%([a-f0-9][a-f0-9])} $buf {\\u00\1} buf

	# process \u unicode mapped chars
	return [subst -novar -nocommand $buf]
    }
} elseif {[info tclversion] >= 8.1} {
    proc cgi_unquote_input buf {
	# rewrite "+" back to space
	regsub -all {\+} $buf { } buf
	# protect \ from quoting another \ and throwing off other things
	regsub -all {\\} $buf {\\\\} buf

	# replace line delimiters with newlines
	regsub -all -nocase "%0d%0a" $buf "\n" buf

	# prepare to process all %-escapes
	regsub -all -nocase {%([a-f0-9][a-f0-9])} $buf {\\u00\1} buf
	# process \u unicode mapped chars
	return [subst -novar -nocommand $buf]
    }
} else {
    proc cgi_unquote_input {buf} {
	# rewrite "+" back to space
	regsub -all {\+} $buf { } buf
	# protect \ from quoting another \ and throwing off other things first
	# protect $ from doing variable expansion
	# protect [ from doing evaluation
	# protect " from terminating string
	regsub -all {([\\["$])} $buf {\\\1} buf
	
	# replace line delimiters with newlines
	regsub -all -nocase "%0d%0a" $buf "\n" buf
	# Mosaic sends just %0A.  This is handled in the next command.

	# prepare to process all %-escapes 
	regsub -all -nocase {%([a-f0-9][a-f0-9])} $buf {[format %c 0x\1]} buf
	# process %-escapes and undo all protection
	eval return \"$buf\"
    }
}

# return string but with html-special characters escaped,
# necessary if you want to send unknown text to an html-formatted page.
proc cgi_quote_html {s} {
    regsub -all {&}	$s {\&amp;}	s	;# must be first!
    regsub -all {"}	$s {\&quot;}	s
    regsub -all {<}	$s {\&lt;}	s
    regsub -all {>}	$s {\&gt;}	s
    return $s
}

proc cgi_dquote_html {s} {
    return \"[cgi_quote_html $s]\"
}

# return string quoted appropriately to appear in a url
proc cgi_quote_url {in} {
    regsub -all {%}  $in "%25" in
    regsub -all { }  $in "%20" in
    regsub -all {"}  $in "%22" in
    regsub -all {\?} $in "%3f" in
    return $in
}

##################################################
# short or single paragraph support
##################################################

proc cgi_br {args} {
    cgi_put "<br"
    if {[llength $args]} {
	cgi_put "[_cgi_list_to_string $args]"
    }
    cgi_puts ">"
}

# generate cgi_h1 and others
for {set _cgi(tmp) 1} {$_cgi(tmp)<8} {incr _cgi(tmp)} {
    proc cgi_h$_cgi(tmp) {{args}} "eval cgi_h $_cgi(tmp) \$args"
}
proc cgi_h {num args} {
    cgi_put "<h$num"
    if {[llength $args] > 1} {
	cgi_put "[_cgi_lrange $args 0 [expr [llength $args]-2]]"
	set args [lrange $args end end]
    }
    cgi_puts ">[lindex $args 0]</h$num>"
}

proc cgi_p {args} {
    cgi_put "<p"
    if {[llength $args] > 1} {
	cgi_put "[_cgi_lrange $args 0 [expr [llength $args]-2]]"
	set args [lrange $args end end]
    }
    cgi_puts ">[lindex $args 0]</p>"
}

proc cgi_address      {s} {cgi_puts <address>$s</address>}
proc cgi_blockquote   {s} {cgi_puts <blockquote>$s</blockquote>}

##################################################
# long or multiple paragraph support
##################################################

# Shorthand for <div align=center>.  We used to use <center> tags but that
# is now officially unsupported.
proc cgi_center	{cmd}	{
    uplevel 1 "cgi_division align=center [list $cmd]"
}

proc cgi_division {args} {
    cgi_put "<div"
    _cgi_close_proc_push "cgi_puts </div>"

    if {[llength $args]} {
	cgi_put "[_cgi_lrange $args 0 [expr [llength $args]-2]]"
    }
    cgi_puts ">"
    uplevel 1 [lindex $args end]
    _cgi_close_proc
}

proc cgi_preformatted {args} {
    cgi_put "<pre"
    _cgi_close_proc_push "cgi_puts </pre>"

    if {[llength $args]} {
	cgi_put "[_cgi_lrange $args 0 [expr [llength $args]-2]]"
    }
    cgi_puts ">"
    uplevel 1 [lindex $args end]
    _cgi_close_proc
}

##################################################
# list support
##################################################

proc cgi_li {args} {
    cgi_put <li
    if {[llength $args] > 1} {
	cgi_put "[_cgi_lrange $args 0 [expr [llength $args]-2]]"
    }
    cgi_puts ">[lindex $args end]"
}

proc cgi_number_list {args} {
    cgi_put "<ol"
    _cgi_close_proc_push "cgi_puts </ol>"

    if {[llength $args] > 1} {
	cgi_put "[_cgi_lrange $args 0 [expr [llength $args]-2]]"
    }
    cgi_puts ">"
    uplevel 1 [lindex $args end]

    _cgi_close_proc
}

proc cgi_bullet_list {args} {
    cgi_put "<ul"
    _cgi_close_proc_push "cgi_puts </ul>"

    if {[llength $args] > 1} {
	cgi_put "[_cgi_lrange $args 0 [expr [llength $args]-2]]"
    }
    cgi_puts ">"
    uplevel 1 [lindex $args end]

    _cgi_close_proc
}

# Following two are normally used from within definition lists
# but are actually paragraph types on their own.
proc cgi_term            {s} {cgi_puts <dt>$s}
proc cgi_term_definition {s} {cgi_puts <dd>$s}

proc cgi_definition_list {cmd} {
    cgi_puts "<dl>"
    _cgi_close_proc_push "cgi_puts </dl>"

    uplevel 1 $cmd
    _cgi_close_proc
}

proc cgi_menu_list {cmd} {
    cgi_puts "<menu>"
    _cgi_close_proc_push "cgi_puts </menu>"

    uplevel 1 $cmd
    _cgi_close_proc
}
proc cgi_directory_list {cmd} {
    cgi_puts "<dir>"
    _cgi_close_proc_push "cgi_puts </dir>"

    uplevel 1 $cmd
    _cgi_close_proc
}

##################################################
# text support
##################################################

proc cgi_put	    {s} {cgi_puts -nonewline $s}

# some common special characters
proc cgi_lt	     {}  {return "&lt;"}
proc cgi_gt	     {}  {return "&gt;"}
proc cgi_amp	     {}  {return "&amp;"}
proc cgi_quote	     {}  {return "&quot;"}
proc cgi_enspace     {}  {return "&ensp;"}
proc cgi_emspace     {}  {return "&emsp;"}
proc cgi_nbspace     {}  {return "&#160;"} ;# nonbreaking space
proc cgi_tm	     {}  {return "&#174;"} ;# registered trademark
proc cgi_copyright   {}  {return "&#169;"}
proc cgi_isochar     {n} {return "&#$n;"}
proc cgi_breakable   {}  {return "<wbr>"}

proc cgi_unbreakable_string {s} {return "<nobr>$s</nobr>"}
proc cgi_unbreakable {cmd} {
    cgi_puts "<nobr>"
    _cgi_close_proc_push "cgi_puts </nobr>"
    uplevel 1 $cmd
    _cgi_close_proc
}

proc cgi_nl          {args} {
    set buf "<br"
    if {[llength $args]} {
	append buf "[_cgi_list_to_string $args]"
    }
    return "$buf>"
}

proc cgi_bold	    {s} {return "<b>$s</b>"}
proc cgi_italic     {s} {return "<i>$s</i>"}
proc cgi_underline  {s} {return "<u>$s</u>"}
proc cgi_strikeout  {s} {return "<s>$s</s>"}
proc cgi_subscript  {s} {return "<sub>$s</sub>"}
proc cgi_superscript {s} {return "<sup>$s</sup>"}
proc cgi_typewriter {s} {return "<tt>$s</tt>"}
proc cgi_blink	    {s} {return "<blink>$s</blink>"}
proc cgi_emphasis   {s} {return "<em>$s</em>"}
proc cgi_strong	    {s} {return "<strong>$s</strong>"}
proc cgi_cite	    {s} {return "<cite>$s</cite>"}
proc cgi_sample     {s} {return "<samp>$s</samp>"}
proc cgi_keyboard   {s} {return "<kbd>$s</kbd>"}
proc cgi_variable   {s} {return "<var>$s</var>"}
proc cgi_definition {s} {return "<dfn>$s</dfn>"}
proc cgi_big	    {s} {return "<big>$s</big>"}
proc cgi_small	    {s} {return "<small>$s</small>"}

proc cgi_basefont   {size} {cgi_puts "<basefont size=$size>"}

proc cgi_font {args} {
    set buf "<font"
    foreach a [lrange $args 0 [expr [llength $args]-2]] {
	if {[regexp "^color=(.*)" $a dummy str]} {
	    append buf " color=\"$str\""
	} else {
	    append buf " $a"
	}
    }
    return "$buf>[lindex $args end]</font>"
}

# take a cgi func and have it return what would normally print
# This command is reentrant (that's why it's so complex).
proc cgi_buffer {cmd} {
    global _cgi

    if {0==[info exists _cgi(returnIndex)]} {
	set _cgi(returnIndex) 0
    }

    rename cgi_puts cgi_puts$_cgi(returnIndex)
    incr _cgi(returnIndex)
    set _cgi(return[set _cgi(returnIndex)]) ""

    proc cgi_puts args {
	global _cgi
	upvar #0 _cgi(return[set _cgi(returnIndex)]) buffer

	append buffer [lindex $args end]
	if {[llength $args] == 1} {
	    append buffer $_cgi(buffer_nl)
	}
    }

    # must restore things before allowing the eval to fail
    # so catch here and rethrow later
    if {[catch {uplevel 1 $cmd} errMsg]} {
	global errorInfo
	set savedInfo $errorInfo
    }

    # not necessary to put remainder of code in close_proc_push since it's
    # all buffered anyway and hasn't yet put browser into a funky state.

    set buffer $_cgi(return[set _cgi(returnIndex)])

    incr _cgi(returnIndex) -1
    rename cgi_puts ""
    rename cgi_puts$_cgi(returnIndex) cgi_puts

    if {[info exists savedInfo]} {
	error $errMsg $savedInfo
    }
    return $buffer
}

set _cgi(buffer_nl) "\n"
proc cgi_buffer_nl {nl} {
    global _cgi

    set old $_cgi(buffer_nl)
    set _cgi(buffer_nl) $nl
    return $old
}

##################################################
# html and tags that can appear in html top-level
##################################################

proc cgi_html {html} {
    _cgi_html_start
    uplevel 1 $html
    _cgi_html_end
}

proc _cgi_html_start {} {
    global _cgi
    
    if {[info exists _cgi(html_in_progress)]} return
    _cgi_http_head_implicit

    set _cgi(html_in_progress) 1
    cgi_doctype
    cgi_puts "<html>"
}

proc _cgi_html_end {} {
    global _cgi
    unset _cgi(html_in_progress)
    set _cgi(html_done) 1
    cgi_puts "</html>"
}

# force closure of all tags and exit without going through normal returns.
# Very useful if you want to call exit from a deeply stacked CGI script
# and still have the HTML be correct.
proc cgi_exit {} {
    _cgi_close_procs
    cgi_html {cgi_body {}}
    exit
}

##################################################
# head support
##################################################

proc cgi_head {{head {}}} {
    global _cgi

    if {[info exists _cgi(head_done)]} {
	return
    }

    # allow us to be recalled so that we can display errors
    if {0 == [info exists _cgi(head_in_progress)]} {
	_cgi_http_head_implicit
	set _cgi(head_in_progress) 1
	cgi_puts "<head>"
    }

    # prevent cgi_html (during error handling) from generating html tags
    set _cgi(html_in_progress) 1
    # don't actually generate html tags since there's nothing to clean
    # them up

    if {0 == [string length $head]} {
	if {[catch {cgi_title}]} {
	    set head "cgi_title untitled"
	}
    }
    uplevel 1 $head
    if {![info exists _cgi(head_suppress_tag)]} {
	cgi_puts "</head>"
    } else {
	unset _cgi(head_suppress_tag)
    }

    set _cgi(head_done) 1

    # debugging can unset this in the uplevel above
    catch {unset _cgi(head_in_progress)}
}

# with one arg: set, print, and return title
# with no args: return title
proc cgi_title {args} {
    global _cgi

    set title [lindex $args 0]

    if {[llength $args]} {
	_cgi_http_head_implicit

	# we could just generate <head></head> tags, but head-level commands
	# might follow so just suppress the head tags entirely
	if {![info exists _cgi(head_in_progress)]} {
	    set _cgi(head_in_progress) 1
	    set _cgi(head_suppress_tag) 1
	}

	set _cgi(title) $title
	cgi_puts "<title>$title</title>"
    }
    return $_cgi(title)
}

# This tag can only be called from with cgi_head.
# example: cgi_http_equiv Refresh 1
# There's really no reason to call this since it can be done directly
# from cgi_http_head.
proc cgi_http_equiv {type contents} {
    _cgi_http_head_implicit
    cgi_puts "<meta http-equiv=\"$type\" content=[cgi_dquote_html $contents]>"
}

# Do whatever you want with meta tags.
# Example: <meta name="author" content="Don Libes">
proc cgi_meta {args} {
    cgi_put "<meta"
    foreach a $args {
	if {[regexp "^(name|content|http-equiv)=(.*)" $a dummy attr str]} {
	    cgi_put " $attr=[cgi_dquote_html $str]"
	} else {
	    cgi_put " $a"
	}
    }
    cgi_puts ">"
}

proc cgi_relationship {rel href args} {
    cgi_puts "<link rel=$rel href=\"$href\""
    foreach a $args {
	if {[regexp "^title=(.*)" $a dummy str]} {
	    cgi_put " title=[cgi_dquote_html $str]"
	} elseif {[regexp "^type=(.*)" $a dummy str]} {
	    cgi_put " type=[cgi_dquote_html $str]"
	} else {
	    cgi_put " $a"
	}
    }
    cgi_puts ">"
}

proc cgi_name {args} {
    global _cgi

    if {[llength $args]} {
	set _cgi(name) [lindex $args 0]
    }
    return $_cgi(name)
}

##################################################
# body and other top-level support
##################################################

proc cgi_body {args} {
    global errorInfo _cgi

    # allow user to "return" from the body without missing _cgi_body_end
    if {1==[catch {
	eval _cgi_body_start [lrange $args 0 [expr [llength $args]-2]]
	uplevel 1 [lindex $args end]
    } errMsg]} {
	set savedInfo $errorInfo
	error $errMsg $savedInfo
    }
    _cgi_body_end
}

proc _cgi_body_start {args} {
    global _cgi
    if {[info exists _cgi(body_in_progress)]} return

    cgi_head

    set _cgi(body_in_progress) 1

    cgi_put "<body"
    foreach a "$args $_cgi(body_args)" {
	if {[regexp "^(background|bgcolor|text|link|vlink|alink|onLoad|onUnload)=(.*)" $a dummy attr str]} {
	    cgi_put " $attr=\"$str\""
	} else {
	    cgi_put " $a"
	}
    }
    cgi_puts ">"

    cgi_debug {
	global env
	catch {cgi_puts "Input: <pre>$_cgi(input)</pre>"}
	catch {cgi_puts "Cookie: <pre>$env(HTTP_COOKIE)</pre>"}
    }

    if {![info exists _cgi(errorInfo)]} {
	uplevel 2 app_body_start
    }
}

proc _cgi_body_end {} {
    global _cgi
    if {![info exists _cgi(errorInfo)]} {
	uplevel 2 app_body_end
    }
    unset _cgi(body_in_progress)
    cgi_puts "</body>"

    if {[info exists _cgi(multipart)]} {
	unset _cgi(http_head_done)
	catch {unset _cgi(http_status_done)}
	unset _cgi(head_done)
	catch {unset _cgi(head_suppress_tag)}
    }
}

proc cgi_body_args {args} {
    global _cgi

    set _cgi(body_args) $args
}

proc cgi_script {args} {
    cgi_puts "<script[_cgi_lrange $args 0 [expr [llength $args]-2]]>"
    _cgi_close_proc_push "cgi_puts </script>"

    uplevel 1 [lindex $args end]

    _cgi_close_proc
}

proc cgi_javascript {args} {
    cgi_puts "<script[_cgi_lrange $args 0 [expr [llength $args]-2]]>"
    cgi_puts "<!--- Hide script from browsers that don't understand JavaScript"
    _cgi_close_proc_push {cgi_puts "// End hiding -->\n</script>"}

    uplevel 1 [lindex $args end]

    _cgi_close_proc
}

proc cgi_noscript {args} {
    cgi_puts "<noscript[_cgi_lrange $args 0 [expr [llength $args]-2]]>"
    _cgi_close_proc_push {puts "</noscript>"}

    uplevel 1 [lindex $args end]

    _cgi_close_proc
}

proc cgi_applet {args} {
    cgi_puts "<applet[_cgi_lrange $args 0 [expr [llength $args]-2]]>"
    _cgi_close_proc_push "cgi_puts </applet>"

    uplevel 1 [lindex $args end]
    _cgi_close_proc
}

proc cgi_param {nameval} {
    regexp "(\[^=]*)(=?)(.*)" $nameval dummy name q value

    if {$q != "="} {
	set value ""
    }
    cgi_puts "<param name=\"$name\" value=[cgi_dquote_html $value]>"
}

# record any proc's that must be called prior to displaying an error
proc _cgi_close_proc_push {p} {
    global _cgi
    if {![info exists _cgi(close_proc)]} {
	set _cgi(close_proc) ""
    }
    set _cgi(close_proc) "$p; $_cgi(close_proc)"
}

proc _cgi_close_proc_pop {} {
    global _cgi
    regexp "^(\[^;]*);(.*)" $_cgi(close_proc) dummy lastproc _cgi(close_proc)
    return $lastproc
}

# generic proc to close whatever is on the top of the stack
proc _cgi_close_proc {} {
    eval [_cgi_close_proc_pop]
}

proc _cgi_close_procs {} {
    global _cgi

    _cgi_close_tag
    if {[info exists _cgi(close_proc)]} {
	uplevel #0 $_cgi(close_proc)
    }
}

proc _cgi_close_tag {} {
    global _cgi

    if {[info exists _cgi(tag_in_progress)]} {
	cgi_puts ">"
	unset _cgi(tag_in_progress)
    }
}

##################################################
# hr support
##################################################

proc cgi_hr {args} {
    global _cgi

    cgi_put "<hr"
    if {[llength $args]} {
	cgi_put "[_cgi_list_to_string $args]"
    }
    cgi_puts ">"
}

##################################################
# form & isindex
##################################################

proc cgi_form {action args} {
    global _cgi

    _cgi_form_multiple_check
    set _cgi(form_in_progress) 1

    _cgi_close_proc_push _cgi_form_end
    cgi_put "<form action="
    if {[regexp {^[a-z]*:} $action]} {
	cgi_put "\"$action\""
    } else {
	cgi_put "\"[cgi_cgi $action]\""
    }
    set method "method=post"
    foreach a [lrange $args 0 [expr [llength $args]-2]] {
	if {[regexp "^method=" $a]} {
	    set method $a
	} elseif {[regexp "^(target|onReset|onSubmit)=(.*)" $a dummy attr str]} {
	    cgi_put " $attr=\"$str\""
	} elseif {[regexp "^enctype=(.*)" $a dummy str]} {
	    cgi_put " enctype=\"$str\""
	    set _cgi(form,enctype) $str
	} else {
	    cgi_put " $a"
	}
    }
    cgi_puts " $method>"
    uplevel 1 [lindex $args end]
    catch {unset _cgi(form,enctype)}
    _cgi_close_proc
}

proc _cgi_form_end {} {
    global _cgi
    unset _cgi(form_in_progress)
    cgi_puts "</form>"
}

proc _cgi_form_multiple_check {} {
    global _cgi
    if {[info exists _cgi(form_in_progress)]} {
	error "Cannot create form (or isindex) with form already in progress."
    }
}

proc cgi_isindex {args} {
    _cgi_form_multiple_check

    cgi_put "<isindex"
    foreach a $args {
	if {[regexp "^href=(.*)" $a dummy str]} {
	    cgi_put " href=\"$str\""
	} elseif {[regexp "^prompt=(.*)" $a dummy str]} {
	    cgi_put " prompt=[cgi_dquote_html $str]"
	} else {
	    cgi_put " $a"
	}
    }
    cgi_puts ">"
}

##################################################
# argument handling
##################################################

proc cgi_input {{fakeinput {}} {fakecookie {}}} {
    global env _cgi _cgi_uservar _cgi_cookie _cgi_cookie_shadowed

    set _cgi(uservars) {}

    if {[info exists env(CONTENT_TYPE)] && [regexp ^multipart/form-data $env(CONTENT_TYPE)]} {
	if {![info exists env(REQUEST_METHOD)]} {
	    # running by hand
	    set fid [open $fakeinput]
	} else {
	    set fid stdin
	}
	if {([info tclversion] >= 8.1) || [catch exp_version] || [info exists _cgi(no_binary_upload)]} {
	    _cgi_input_multipart $fid
	} else {
	    _cgi_input_multipart_binary $fid
	}
    } else {
	if {![info exists env(REQUEST_METHOD)]} {
	    set input $fakeinput
	    set env(HTTP_COOKIE) $fakecookie
	} elseif { $env(REQUEST_METHOD) == "GET" } {
	    set input ""
	    catch {set input $env(QUERY_STRING)} ;# doesn't have to be set
	} elseif { $env(REQUEST_METHOD) == "HEAD" } {
	    set input ""
	} elseif {![info exists env(CONTENT_LENGTH)]} {
	    set _cgi(client_error) 1
	    error "Your browser failed to generate the content-length during a POST method."
	} else {
	    set length $env(CONTENT_LENGTH)
	    if {0!=[string compare $length "-1"]} {
		set input [read stdin $env(CONTENT_LENGTH)]		
	    } else {
		set _cgi(client_error) 1
		error "Your browser generated a content-length of -1 during a POST method."
	    }
	}
	# save input for possible diagnostics later
	set _cgi(input) $input

	set pairs [split $input &]
	foreach pair $pairs {
	    if {0 == [regexp (.*)=(.*) $pair dummy varname val]} {
		# if no match, unquote and leave it at that
		# this is typical of <isindex>-style queries
		set varname anonymous
		set val $pair
	    }

	    set varname [cgi_unquote_input $varname]
	    set val [cgi_unquote_input $val]
	    _cgi_set_uservar $varname $val
	}
    }

    # O'Reilly's web server incorrectly uses COOKIE
    catch {set env(HTTP_COOKIE) $env(COOKIE)}
    if {![info exists env(HTTP_COOKIE)]} return
    foreach pair [split $env(HTTP_COOKIE) ";"] {
	# pairs are actually split by "; ", sigh
	set pair [string trimleft $pair " "]
	# spec is not clear but seems to allow = unencoded
	# only sensible interpretation is to assume no = in var names
	# appears MS IE can omit "=val"
	set val ""
	regexp (\[^=]*)=?(.*) $pair dummy varname val

	set varname [cgi_unquote_input $varname]
	set val [cgi_unquote_input $val]

	if {[info exists _cgi_cookie($varname)]} {
	    lappend _cgi_cookie_shadowed($varname) $val
	} else {
	    set _cgi_cookie($varname) $val
	}
    }
}

proc _cgi_input_multipart {fin} {
    global env _cgi _cgi_uservar _cgi_userfile

    cgi_debug -noprint {
	# save file for debugging purposes
	set dbg_filename [file join $_cgi(tmpdir) CGIdbg.[pid]]
	# explicitly flush all writes to fout, because sometimes the writer
	# can hang and we won't get to the termination code
	set dbg_fout [open $dbg_filename w]
	set _cgi(input) $dbg_filename
	catch {fconfigure $dbg_fout -translation binary}
    }

    # figure out boundary
    if {0==[regexp boundary=(.*) $env(CONTENT_TYPE) dummy boundary]} {
	set _cgi(client_error) 1
	error "Your browser failed to generate a \"boundary=\" line in a multipart response (CONTENT_TYPE: $env(CONTENT_TYPE)).  Please upgrade (or fix) your browser."
    }
    set boundary --$boundary

    # don't corrupt or modify uploads yet allow Tcl 7.4 to work
    catch {fconfigure $fin -translation binary}

    # get first boundary line
    gets $fin buf
    if {[info exists dbg_fout]} {puts $dbg_fout $buf; flush $dbg_fout}

    set filecount 0
    while {1} {
	# process Content-Disposition:
	if {-1 == [gets $fin buf]} break
	if {[info exists dbg_fout]} {puts $dbg_fout $buf; flush $dbg_fout}
	catch {unset filename}
	foreach b $buf {
	    regexp {^name="(.*)"} $b dummy varname
	}
	if {0==[info exists varname]} {
	    set _cgi(client_error) 1
	    error "In response to a request for a multipart form, your browser generated a part header without a name field.  Please upgrade (or fix) your browser."
	}	    
	# Lame-o encoding (on Netscape at least) doesn't escape field
	# delimiters (like quotes)!!  Since all we've ever seen is filename=
	# at end of line, assuming nothing follows.  Sigh.
	regexp {filename="(.*)"} $buf dummy filename

	# Skip remaining headers until blank line.
	# Content-Type: can appear here.  Ignore it.
	while {1} {
	    if {-1 == [gets $fin buf]} break
	    if {[info exists dbg_fout]} {puts $dbg_fout $buf; flush $dbg_fout}
	    if {0==[string compare $buf "\r"]} break
	}

	if {[info exists filename]} {
	    # read the part into a file
	    set foutname /tmp/CGI[pid].[incr filecount]
	    set foutname [file join $_cgi(tmpdir) CGI[pid].[incr filecount]]
	    set fout [open $foutname w]
	    # "catch" permits this to work with Tcl 7.4
	    catch {fconfigure $fout -translation binary}
	    _cgi_set_uservar $varname [list $foutname $filename]
	    set _cgi_userfile($varname) [list $foutname $filename]

	    #
	    # Look for a boundary line preceded by \r\n.
	    #
	    # To do this, we buffer line terminators that might
	    # be the start of the special \r\n$boundary sequence.
	    # The buffer is called "leftover" and is just inserted
	    # into the front of the next output (assuming it's
	    # not a boundary line).

	    set leftover ""
	    while {1} {
		if {-1 == [gets $fin buf]} break
		if {[info exists dbg_fout]} {puts $dbg_fout $buf; flush $dbg_fout}

		if {0 == [string compare "\r\n" $leftover]} {
		    if {[regexp ^[set boundary](--)?\r$ $buf dummy dashdash]} {
			if {$dashdash == "--"} {set eof 1}
			break
		    }
		}
		if {[regexp (.*)\r$ $buf x data]} {
		    puts -nonewline $fout $leftover$data
		    set leftover "\r\n"
		} else {
		    puts -nonewline $fout $leftover$buf
		    set leftover "\n"
		}
	    }

	    close $fout
	    unset fout
	} else {
	    # read the part into a variable
	    set val ""
	    while {1} {
		if {-1 == [gets $fin buf]} break
		if {[info exists dbg_fout]} {puts $dbg_fout $buf; flush $dbg_fout}
		if {[regexp ^[set boundary](--)?\r$ $buf dummy dashdash]} {
		    if {$dashdash == "--"} {set eof 1}
		    break
		}
		if {0!=[string compare $val ""]} {
		    append val \n
		}
		regexp (.*)\r$ $buf dummy buf
		append val $buf
	    }
	    _cgi_set_uservar $varname $val
	}
        if {[info exists eof]} break
    }
    if {[info exists dbg_fout]} {close $dbg_fout}
}

proc _cgi_input_multipart_binary {fin} {
    global env _cgi _cgi_uservar _cgi_userfile

    log_user 0
    set timeout -1

    cgi_debug -noprint {
	# save file for debugging purposes
	set dbg_filename [file join $_cgi(tmpdir) CGIdbg.[pid]]
	set _cgi(input) $dbg_filename
	spawn -open [open $dbg_filename w]
	set dbg_sid $spawn_id
    }
    spawn -open $fin
    set fin_sid $spawn_id
    remove_nulls 0

    if {0} {
	# dump input to screen
	cgi_debug {
	    puts "<xmp>"
	    expect {
		-i $fin_sid
		-re ^\r {puts -nonewline "CR"; exp_continue}
		-re ^\n {puts "NL"; exp_continue}
		-re . {puts -nonewline $expect_out(buffer); exp_continue}
	    }
	    puts "</xmp>"
	    exit
	}
    }

    # figure out boundary
    if {0==[regexp boundary=(.*) $env(CONTENT_TYPE) dummy boundary]} {
	set _cgi(client_error) 1
	error "Your browser failed to generate a \"boundary=\" definition in a multipart response (CONTENT_TYPE: $env(CONTENT_TYPE)).  Please upgrade (or fix) your browser."
    }

    set boundary --$boundary
    set linepat "(\[^\r]*)\r\n"

    # get first boundary line
    expect {
	-i $fin_sid
	-re $linepat {
	    set buf $expect_out(1,string)
	    if {[info exists dbg_sid]} {send -i $dbg_sid -- $buf\n}
	}
	eof {
	    set _cgi(client_error) 1
	    error "Your browser failed to provide an initial boundary ($boundary) in a multipart response.  Please upgrade (or fix) your browser."
	}
    }

    set filecount 0
    while {1} {
	# process Content-Disposition:
	expect {
	    -i $fin_sid
	    -re $linepat {
		set buf $expect_out(1,string)
		if {[info exists dbg_sid]} {send -i $dbg_sid -- $buf\n}
	    }
	    eof break
	}
	catch {unset filename}
	foreach b $buf {
	    regexp {^name="(.*)"} $b dummy varname
	}
	if {0==[info exists varname]} {
	    set _cgi(client_error) 1
	    error "In response to a request for a multipart form, your browser generated a part header without a name field.  Please upgrade (or fix) your browser."
	}	    

	# Lame-o encoding (on Netscape at least) doesn't escape field
	# delimiters (like quotes)!!  Since all we've ever seen is filename=
	# at end of line, assuming nothing follows.  Sigh.
	regexp {filename="(.*)"} $buf dummy filename

	# Skip remaining headers until blank line.
	# Content-Type: can appear here.  Ignore it.
	expect {
	    -i $fin_sid
	    -re $linepat {
		set buf $expect_out(1,string)
		if {[info exists dbg_sid]} {send -i $dbg_sid -- $buf\n}
		if {0!=[string compare $buf ""]} exp_continue
	    }
	    eof break
	}

	if {[info exists filename]} {
	    # read the part into a file
	    set foutname [file join $_cgi(tmpdir) CGI[pid].[incr filecount]]
	    spawn -open [open $foutname w]
	    set fout_sid $spawn_id

	    _cgi_set_uservar $varname [list $foutname $filename]
	    set _cgi_userfile($varname) [list $foutname $filename]

	    # This is tricky stuff - be very careful changing anything here!
	    # In theory, all we have to is record everything up to
	    # \r\n$boundary\r\n.  Unfortunately, we can't simply wait on
	    # such a pattern because the input can overflow any possible
	    # buffer we might choose.  We can't simply catch buffer_full
	    # because the boundary might straddle a buffer.  I doubt that
	    # doing my own buffering would be any faster than taking the
	    # approach I've done here.
	    #
	    # The code below basically implements a simple scanner that
	    # keeps track of whether it's seen crlfs or pieces of them.
	    # The idea is that we look for crlf pairs, separated by
	    # things that aren't crlfs (or pieces of them).  As we encounter
	    # things that aren't crlfs (or pieces of them), or when we decide
	    # they can't be, we mark them for output and resume scanning for
	    # new pairs.
	    #
	    # The scanner runs tolerably fast because the [...]+ pattern picks
	    # up most things.  The \r and \n are ^-anchored so the pattern
	    # match is pretty fast and these don't happen that often so the
	    # huge \n action is executed rarely (once per line on text files).
	    # The null pattern is, of course, only used when everything
	    # else fails.

	    # crlf	== "\r\n" if we've seen one, else == ""
	    # cr	== "\r" if we JUST saw one, else == ""
	    #           Yes, strange, but so much more efficient
	    #		that I'm willing to sacrifice readability, sigh.
	    # buf	accumulated data between crlf pairs

	    set buf ""
	    set cr ""
	    set crlf ""

	    expect {
		-i $fin_sid
		-re "^\r" {
		    if {$cr == "\r"} {
			append buf "\r"
		    }
		    set cr \r
		    exp_continue
		} -re "^\n" {
		    if {$cr == "\r"} {
			if {$crlf == "\r\n"} {
			    # do boundary test
			    if {[regexp ^[set boundary](--)?$ $buf dummy dashdash]} {
				if {$dashdash == "--"} {
				    set eof 1
				}
			    } else {
				# boundary test failed
				if {[info exists dbg_sid]} {send -i $dbg_sid -- \r\n$buf}
				send -i $fout_sid \r\n$buf ; set buf ""
				set cr ""
				exp_continue
			    }
			} else {
			    set crlf "\r\n"
			    set cr ""
			    if {[info exists dbg_sid]} {send -i $dbg_sid -- $buf}
			    send -i $fout_sid -- $buf ; set buf ""
			    exp_continue
			}
		    } else {
			if {[info exists dbg_sid]} {send -i $dbg_sid -- $crlf$buf\n}
			send -i $fout_sid -- $crlf$buf\n ; set buf ""
			set crlf ""
			exp_continue
		    }
		} -re "\[^\r\n]+" {
		    if {$cr == "\r"} {
			set buf $crlf$buf\r$expect_out(buffer)
			set crlf ""
			set cr ""
		    } else {
			append buf $expect_out(buffer)
		    }
		    exp_continue
		} null {
		    if {[info exists dbg_sid]} {
			send -i $dbg_sid -- $crlf$buf$cr
			send -i $dbg_sid -null
		    }
		    send -i $fout_sid -- $crlf$buf$cr ; set buf ""
		    send -i $fout_sid -null
		    set cr ""
		    set crlf ""
		    exp_continue
		} eof {
		    set _cgi(client_error) 1
		    error "Your browser failed to provide an ending boundary ($boundary) in a multipart response.  Please upgrade (or fix) your browser."
		}
	    }
	    exp_close -i $fout_sid    ;# implicitly closes fout
	    exp_wait -i $fout_sid
	    unset fout_sid
	} else {
	    # read the part into a variable
	    set val ""
	    expect {
		-i $fin_sid
		-re $linepat {
		    set buf $expect_out(1,string)
		    if {[info exists dbg_sid]} {send -i $dbg_sid -- $buf\n}
		    if {[regexp ^[set boundary](--)?$ $buf dummy dashdash]} {
			if {$dashdash == "--"} {set eof 1}
		    } else {
			regexp (.*)\r$ $buf dummy buf
			if {0!=[string compare $val ""]} {
			    append val \n
			}
			append val $buf
			exp_continue
		    }
		}
	    }
	    _cgi_set_uservar $varname $val
	}	    
        if {[info exists eof]} break
    }
    if {[info exists fout]} {
	exp_close -i $dbg_sid
	exp_wait -i $dbg_sid
    }

    # no need to close fin, fin_sid, or dbg_sid
}

# internal routine for defining user variables
proc _cgi_set_uservar {varname val} {
    global _cgi _cgi_uservar

    set exists [info exists _cgi_uservar($varname)]

    if {0==$exists} {
	lappend _cgi(uservars) $varname
    }

    # handle lists of values correctly
    if {[regexp List$ $varname]} {
	lappend _cgi_uservar($varname) $val
    } else {
	if {$exists} {
	    error "Multiple definitions of $varname encountered in input.
	    If you're trying to do this intentionally (such as with select),
	    the variable must have a \"List\" suffix."
	} else {
	    set _cgi_uservar($varname) $val
	}
    }
}

# export named variable
proc cgi_export {nameval} {
    regexp "(\[^=]*)(=?)(.*)" $nameval dummy name q value

    if {$q != "="} {
	set value [uplevel 1 set [list $name]]
    }

    cgi_puts "<input type=hidden name=\"$name\" value=[cgi_dquote_html $value]>"
}

proc cgi_export_cookie {name args} {
    upvar 1 $name x
    eval cgi_cookie_set [list $name=$x] $args
}

# return list of variables available for import
# Explicit list is used to keep items in order originally found in form.
proc cgi_import_list {} {
    global _cgi

    return $_cgi(uservars)
}

# import named variable
proc cgi_import {name} {
    global _cgi_uservar
    upvar 1 $name var

    set var $_cgi_uservar($name)
}

proc cgi_import_as {name tclvar} {
    global _cgi_uservar
    upvar 1 $tclvar var

    set var $_cgi_uservar($name)
}

# like cgi_import but if not available, try cookie
proc cgi_import_cookie {name} {
    global _cgi_uservar
    upvar 1 $name var

    if {0==[catch {set var $_cgi_uservar($name)}]} return
    set var [cgi_cookie_get $name]
}

# like cgi_import but if not available, try cookie
proc cgi_import_cookie_as {name tclvar} {
    global _cgi_uservar
    upvar 1 $tclvar var

    if {0==[catch {set var $_cgi_uservar($name)}]} return
    set var [cgi_cookie_get $name]
}

proc cgi_import_filename {type name} {
    global _cgi_userfile
    upvar 1 $name var

    set var $_cgi_userfile($name)
    if {$type == "-server" || $type == "-local"} {
	# -local is deprecated
	lindex $var 0
    } else {
	lindex $var 1
    }
}

##################################################
# button support
##################################################

# not sure about arg handling, do we need to support "name="?
proc cgi_button {value args} {
    cgi_put "<input type=button value=[cgi_dquote_html $value]"
    foreach a $args {
	if {[regexp "^onClick=(.*)" $a dummy str]} {
	    cgi_put " onClick=\"$str\""
	} else {
	    cgi_put " $a"
	}
    }
    cgi_puts ">"
}

proc cgi_submit_button {{nameval {=Submit Query}} args} {
    regexp "(\[^=]*)=(.*)" $nameval dummy name value
    cgi_put "<input type=submit"
    if {0!=[string compare "" $name]} {
	cgi_put " name=\"$name\""
    }
    cgi_put " value=[cgi_dquote_html $value]"
    foreach a $args {
	if {[regexp "^onClick=(.*)" $a dummy str]} {
	    cgi_put " onClick=\"$str\""
	} else {
	    cgi_put " $a"
	}
    }
    cgi_puts ">"
}


proc cgi_reset_button {{value Reset} args} {
    cgi_put "<input type=reset value=[cgi_dquote_html $value]"

    foreach a $args {
	if {[regexp "^onClick=(.*)" $a dummy str]} {
	    cgi_put " onClick=\"$str\""
	} else {
	    cgi_put " $a"
	}
    }
    cgi_puts ">"
}

proc cgi_radio_button {nameval args} {
    regexp "(\[^=]*)=(.*)" $nameval dummy name value

    cgi_put "<input type=radio name=\"$name\" value=[cgi_dquote_html $value]"

    foreach a $args {
	if {[regexp "^checked_if_equal=(.*)" $a dummy default]} {
	    if {0==[string compare $default $value]} {
		cgi_put " checked"
	    }
	} elseif {[regexp "^onClick=(.*)" $a dummy str]} {
	    cgi_put " onClick=\"$str\""
	} else {
	    cgi_put " $a"
	}
    }
    cgi_puts ">"
}

proc cgi_image_button {nameval args} {
    regexp "(\[^=]*)=(.*)" $nameval dummy name value
    cgi_put "<input type=image"
    if {0!=[string compare "" $name]} {
	cgi_put " name=\"$name\""
    }
    cgi_put " src=\"$value\""
    foreach a $args {
	if {[regexp "^onClick=(.*)" $a dummy str]} {
	    cgi_put " onClick=\"$str\""
	} else {
	    cgi_put " $a"
	}
    }
    cgi_puts ">"
}

# map/area implement client-side image maps
proc cgi_map {name cmd} {
    cgi_put "<map name=\"$name\">"
    _cgi_close_proc_push "cgi_puts </map>"

    uplevel 1 $cmd
    _cgi_close_proc
}

proc cgi_area {args} {
    cgi_put "<area"
    foreach a $args {
	if {[regexp "^(coords|shape|href|target|onMouseOut|alt)=(.*)" $a dummy attr str]} {
	    cgi_put " $attr=\"$str\""
	} else {
	    cgi_put " $a"
	}
    }
    cgi_puts ">"
}

##################################################
# checkbox support
##################################################

proc cgi_checkbox {nameval args} {
    regexp "(\[^=]*)(=?)(.*)" $nameval dummy name q value
    cgi_put "<input type=checkbox name=\"$name\""

    if {0!=[string compare "" $value]} {
	cgi_put " value=[cgi_dquote_html $value]"
    }

    foreach a $args {
	if {[regexp "^checked_if_equal=(.*)" $a dummy default]} {
	    if {0==[string compare $default $value]} {
		cgi_put " checked"
	    }
	} elseif {[regexp "^onClick=(.*)" $a dummy str]} {
	    cgi_put " onClick=\"$str\""
	} else {
	    cgi_put " $a"
	}
    }
    cgi_puts ">"
}

##################################################
# textentry support
##################################################

proc cgi_text {nameval args} {
    regexp "(\[^=]*)(=?)(.*)" $nameval dummy name q value

    cgi_put "<input name=\"$name\""

    if {$q != "="} {
	set value [uplevel 1 set [list $name]]
    }
    cgi_put " value=[cgi_dquote_html $value]"

    foreach a $args {
	if {[regexp "^on(Select|Focus|Blur|Change)=(.*)" $a dummy event str]} {
	    cgi_put " on$event=\"$str\""
	} else {
	    cgi_put " $a"
	}
    }
    cgi_puts ">"
}

##################################################
# textarea support
##################################################

proc cgi_textarea {nameval args} {
    regexp "(\[^=]*)(=?)(.*)" $nameval dummy name q value

    cgi_put "<textarea name=\"$name\""
    foreach a $args {
	if {[regexp "^on(Select|Focus|Blur|Change)=(.*)" $a dummy event str]} {
	    cgi_put " on$event=\"$str\""
	} else {
	    cgi_put " $a"
	}
    }
    cgi_puts ">"

    if {$q != "="} {
	set value [uplevel 1 set [list $name]]
    }
    cgi_puts [cgi_quote_html $value]

    cgi_puts "</textarea>"
}

##################################################
# file upload support
##################################################

# for this to work, pass enctype=multipart/form-data to cgi_form
proc cgi_file_button {name args} {
    global _cgi
    if {[info exists _cgi(formtype)] && ("multipart/form-data" != $_cgi(form,enctype))} {
	error "cgi_file_button requires that cgi_form have the argument enctype=multipart/form-data"
    }
    cgi_puts "<input type=file name=\"$name\"[_cgi_list_to_string $args]>"
}

##################################################
# select support
##################################################

proc cgi_select {name args} {
    cgi_put "<select name=\"$name\""
    _cgi_close_proc_push "cgi_puts </select>"
    foreach a [lrange $args 0 [expr [llength $args]-2]] {
	if {[regexp "^on(Focus|Blur|Change)=(.*)" $a dummy event str]} {
	    cgi_put " on$event=\"$str\""
	} else {
	    if {0==[string compare multiple $a]} {
		;# sanity check
		if {![regexp "List$" $name]} {
		    cgi_puts ">" ;# prevent error from being absorbed
		    error "When selecting multiple options, select variable \
			    must end in \"List\" to allow the value to be \
			    recognized as a list when it is processed later."
		}
	    }
	    cgi_put " $a"
	}
    }
    cgi_puts ">"
    uplevel 1 [lindex $args end]
    _cgi_close_proc
}

proc cgi_option {o args} {
    cgi_put "<option"
    set value $o
    set selected 0
    foreach a $args {
	if {[regexp "^selected_if_equal=(.*)" $a dummy selected_if_equal]} {
	} elseif {[regexp "^value=(.*)" $a dummy value]} {
	    cgi_put " value=[cgi_dquote_html $value]"
	} else {
	    cgi_put " $a"
	}
    }
    if {[info exists selected_if_equal]} {
	if {0 == [string compare $selected_if_equal $value]} {
	    cgi_put " selected"
	}
    }
    cgi_puts ">[cgi_quote_html $o]"
}

##################################################
# plug-in support
##################################################

proc cgi_embed {src wh args} {
    regexp (.*)x(.*) $wh dummy width height
    cgi_put "<embed src=[cgi_dquote_html $src] width=\"$width\" height=\"$height\""
    foreach a $args {
	if {[regexp "^palette=(.*)" $a dummy str]} {
	    cgi_put " palette=\"$str\""
	} elseif {[regexp -- "-quote" $a]} {
	    set quote 1
	} else {
	    if {[info exists quote]} {
		regexp "(\[^=]*)=(.*)" $a dummy var val
		cgi_put " var=[cgi_dquote_url $var]"
	    } else {
		cgi_put " $a"
	    }
	}
    }
    cgi_puts ">"
}

##################################################
# mail support
##################################################

# mail to/from the service itself
proc cgi_mail_addr {args} {
    global _cgi

    if {[llength $args]} {
	set _cgi(email) [lindex $args 0]
    }
    return $_cgi(email)
}

proc cgi_mail_start {to} {
    global _cgi

    set _cgi(mailfile) [file join $_cgi(tmpdir) cgimail.[pid]]
    set _cgi(mailfid) [open $_cgi(mailfile) w+]
    set _cgi(mailto) $to

    # mail is actually sent by "nobody".  To force bounce messages
    # back to us, override the default return-path.
    cgi_mail_add "Return-Path: <$_cgi(email)>"
    cgi_mail_add "From: [cgi_name] <$_cgi(email)>"
    cgi_mail_add "To: $to"
}

# add another line to outgoing mail
# if no arg, add a blank line
proc cgi_mail_add {{arg {}}} {
    global _cgi

    puts $_cgi(mailfid) $arg
}	

# end the outgoing mail and send it
proc cgi_mail_end {} {
    global _cgi

    flush $_cgi(mailfid)

    if {[file executable /usr/lib/sendmail]} {
	exec /usr/lib/sendmail -t -odb < $_cgi(mailfile)
	# Explanation:
	# -t   means: pick up recipient from body
	# -odb means: deliver in background
	# note: bogus local address cause sendmail to fail immediately
    } else {
	# fallback for sites without sendmail

	if {0==[info exists _cgi(mail_relay)]} {
	    regexp "@(.*)" $_cgi(mailto) dummy _cgi(mail_relay)
	}

	set s [socket $_cgi(mail_relay) 25]
	gets $s answer
	if {[lindex $answer 0] != 220} {error $answer} 
	puts $s "MAIL FROM:<$_cgi(email)>";flush $s
	gets $s answer
	if {[lindex $answer 0] != 250} {error $answer}  
	puts $s "RCPT TO:<$_cgi(mailto)>";flush $s
	gets $s answer
	if {[lindex $answer 0] != 250} {error $answer}  
	puts $s DATA;flush $s
	gets $s answer
	if {[lindex $answer 0] != 354} {error $answer}  
	seek $_cgi(mailfid) 0 start
	puts $s [read $_cgi(mailfid)];flush $s
	puts $s .;flush $s
	gets $s answer
	if {[lindex $answer 0] != 250} {error $answer}  
	close $s
    }
    close $_cgi(mailfid)
    file delete -force $_cgi(mailfile)
}

proc cgi_mail_relay {host} {
    global _cgi

    set _cgi(mail_relay) $host
}

##################################################
# cookie support
##################################################

# calls to cookie_set look like this:
#   cgi_cookie_set user=don domain=nist.gov expires=never
#   cgi_cookie_set user=don domain=nist.gov expires=now
#   cgi_cookie_set user=don domain=nist.gov expires=...actual date...

proc cgi_cookie_set {nameval args} {
    global _cgi

    if {![info exists _cgi(http_head_in_progress)]} {
	error "Cookies must be set from within cgi_http_head."
    }
    cgi_puts -nonewline "Set-Cookie: [cgi_cookie_encode $nameval];"

    foreach a $args {
	if {[regexp "^expires=(.*)" $a dummy expiration]} {
	    if {0==[string compare $expiration "never"]} {
		set expiration "Friday, 11-Jan-2038 23:59:59 GMT"
	    } elseif {0==[string compare $expiration "now"]} {
		set expiration "Friday, 31-Dec-1990 23:59:59 GMT"
	    }
	    cgi_puts -nonewline " expires=$expiration;"
	} elseif {[regexp "^(domain|path)=(.*)" $a dummy attr str]} {
	    cgi_puts -nonewline " $attr=[cgi_cookie_encode $str];"
	} elseif {[regexp "^secure$" $a]} {
	    cgi_puts -nonewline " secure;"
	}
    }
    cgi_puts ""
}

# return list of cookies available for import
proc cgi_cookie_list {} {
    global _cgi_cookie

    array names _cgi_cookie
}

proc cgi_cookie_get {args} {
    global _cgi_cookie

    set flag ""
    if {[llength $args]>1} {
	set flag [lindex $args 0]
	set args [lrange $args 1 end]
    }
    set name [lindex $args 0]

    if {$flag == "-all"} {
	global _cgi_cookie_shadowed

	foreach {flag name} $args {}
	if {[info exists $_cgi_cookie_shadowed($name)]} {
	    return [list {*}$_cgi_cookie($name) {*}$_cgi_cookie_shadowed($name)]
	} else {
	    return [list {*}$_cgi_cookie($name)]
	}
    }
    return $_cgi_cookie($name)
}

proc cgi_cookie_encode {in} {
    regsub -all " " $in "+" in
    regsub -all "%" $in "%25" in   ;# must preceed other subs that produce %
    regsub -all ";" $in "%3B" in
    regsub -all "," $in "%2C" in
    regsub -all "\n" $in "%0D%0A" in
    return $in
}

##################################################
# table support
##################################################

proc cgi_table {args} {
    cgi_put "<table"
    _cgi_close_proc_push "cgi_puts </table>"

    if {[llength $args]} {
	cgi_put "[_cgi_lrange $args 0 [expr [llength $args]-2]]"
    }
    cgi_puts ">"
    uplevel 1 [lindex $args end]
    _cgi_close_proc
}

proc cgi_caption {args} {
    cgi_put "<caption"
    _cgi_close_proc_push "cgi_puts </caption>"

    if {[llength $args]} {
	cgi_put "[_cgi_lrange $args 0 [expr [llength $args]-2]]"
    }
    cgi_puts ">"
    uplevel 1 [lindex $args end]
    _cgi_close_proc
}

proc cgi_table_row {args} {
    cgi_put "<tr"
    _cgi_close_proc_push "cgi_puts </tr>"
    if {[llength $args]} {
	cgi_put "[_cgi_lrange $args 0 [expr [llength $args]-2]]"
    }
    cgi_puts ">"
    uplevel 1 [lindex $args end]
    _cgi_close_proc
}

# like table_row but without eval
proc cgi_tr {args} {
    cgi_puts <tr
    if {[llength $args] > 1} {
	cgi_put "[_cgi_lrange $args 0 [expr [llength $args]-2]]"
    }
    cgi_puts ">"
    foreach i [lindex $args end] {
	cgi_td $i
    }
    cgi_puts </tr>
}

proc cgi_table_head {args} {
    cgi_put "<th"
    _cgi_close_proc_push "cgi_puts </th>"

    if {[llength $args]} {
	cgi_put "[_cgi_lrange $args 0 [expr [llength $args]-2]]"
    }
    cgi_puts ">"
    uplevel 1 [lindex $args end]
    _cgi_close_proc
}

# like table_head but without eval
proc cgi_th {args} {
    cgi_put "<th"

    if {[llength $args] > 1} {
	cgi_put "[_cgi_lrange $args 0 [expr [llength $args]-2]]"
    }
    cgi_puts ">[lindex $args end]</th>"
}

proc cgi_table_data {args} {
    cgi_put "<td"
    _cgi_close_proc_push "cgi_puts </td>"

    if {[llength $args]} {
	cgi_put "[_cgi_lrange $args 0 [expr [llength $args]-2]]"
    }
    cgi_puts ">"
    uplevel 1 [lindex $args end]
    _cgi_close_proc
}

# like table_data but without eval
proc cgi_td {args} {
    cgi_put "<td"

    if {[llength $args] > 1} {
	cgi_put "[_cgi_lrange $args 0 [expr [llength $args]-2]]"
    }
    cgi_puts ">[lindex $args end]</td>"
}

##################################################
# stylesheets - not yet documented
##################################################

proc cgi_stylesheet {href} {
    puts "<link rel=stylesheet href=\"$href\" type=\"text/css\">"
}

proc cgi_span {args} {
    set buf "<span"
    foreach a [lrange $args 0 [expr [llength $args]-2]] {
	if {[regexp "style=(.*)"] $a dummy str]} {
	    append buf " style=\"$str\""
	} elseif {[regexp "class=(.*)"] $a dummy str]} {
	    append buf " class=\"$str\""
	} else {
	    append buf " $a"
	}
    }
    return "$buf>[lindex $args end]</span>"
}

##################################################
# frames
##################################################

proc cgi_frameset {args} {
    cgi_head ;# force it out, just in case none

    cgi_put "<frameset"
    _cgi_close_proc_push "cgi_puts </frameset>"

    foreach a [lrange $args 0 [expr [llength $args]-2]] {
	if {[regexp "^(rows|cols|onUnload|onLoad|onBlur)=(.*)" $a dummy attr str]} {
	    cgi_put " $attr=\"$str\""
	} else {
	    cgi_put " $a"
	}
    }
    cgi_puts ">"
    uplevel 1 [lindex $args end]

    _cgi_close_proc
}

proc cgi_frame {namesrc args} {
    cgi_put "<frame"

    regexp "(\[^=]*)(=?)(.*)" $namesrc dummy name q src

    if {$name != ""} {
	cgi_put " name=\"$name\""
    }

    if {$src != ""} {
	cgi_put " src=\"$src\""
    }

    foreach a $args {
	if {[regexp "^(marginwidth|marginheight|scrolling|onFocus)=(.*)" $a dummy attr str]} {
	    cgi_put " $attr=\"$str\""
	} else {
	    cgi_put " $a"
	}
    }
    cgi_puts ">"
}

proc cgi_noframes {args} {
    cgi_puts "<noframes>"
    _cgi_close_proc_push "cgi_puts </noframes>"
    uplevel 1 [lindex $args end]
    _cgi_close_proc
}

##################################################
# admin support
##################################################

# mail address of the administrator
proc cgi_admin_mail_addr {args} {
    global _cgi

    if {[llength $args]} {
	set _cgi(admin_email) [lindex $args 0]
    }
    return $_cgi(admin_email)
}

##################################################
# if possible, make each cmd available without cgi_ prefix
##################################################

if {[info tclversion] >= 7.5} {
    foreach _cgi(old) [info procs cgi_*] {
	regexp "^cgi_(.*)" $_cgi(old) _cgi(dummy) _cgi(new)
	if {[llength [info commands $_cgi(new)]]} continue
	interp alias {} $_cgi(new) {} $_cgi(old)
    }
} else {
    foreach _cgi(old) [info procs cgi_*] {
	regexp "^cgi_(.*)" $_cgi(old) _cgi(dummy) _cgi(new)
	if {[llength [info commands $_cgi(new)]]} continue
	proc $_cgi(new) {args} "uplevel 1 $_cgi(old) \$args"
	#proc $_cgi(new) {args} "upvar 1 _cgi_local x; set x \$args; uplevel 1 \"$_cgi(old) \$x\""
    }
}

##################################################
# internal utilities
##################################################

# undo Tcl's quoting due to list protection
# This leaves a space at the beginning if the string is non-null
# but this is always desirable in the HTML context in which it is called
# and the resulting HTML looks more readable.
# (It makes the Tcl callers a little less readable - however, there aren't
# more than a handful and they're all right here, so we'll live with it.)
proc _cgi_list_to_string {list} {
    set string ""
    foreach l $list {
	append string " $l"
    }
    # remove first space if possible
    # regexp "^ ?(.*)" $string dummy string
    return $string
}

# do lrange but return as string
# needed for stuff like: cgi_puts "[_cgi_lrange $args ...]
# Like _cgi_list_to_string, also returns string with initial blank if non-null
proc _cgi_lrange {list i1 i2} {
    _cgi_list_to_string [lrange $list $i1 $i2]
}

##################################################
# user-defined procedures
##################################################

# User-defined procedure called immediately after <body>
# Good mechanism for controlling things such as if all of your pages
# start with the same graphic or other boilerplate.
proc app_body_start {} {}

# User-defined procedure called just before </body>
# Good place to generate signature lines, last-updated-by, etc.
proc app_body_end {} {}

proc cgi_puts {args} {
    eval puts $args
}

# User-defined procedure to generate DOCTYPE declaration
proc cgi_doctype {} {}

##################################################
# do some initialization
##################################################

cgi_name ""
cgi_root ""
cgi_body_args ""

# email addr of person responsible for this service
cgi_admin_mail_addr "root"	;# you should override this!

# most services won't have an actual email addr
cgi_mail_addr "CGI script - do not reply"

# deduce tmp directory
switch $tcl_platform(platform) {
    unix {
	set _cgi(tmpdir) /tmp
    } macintosh {
	set _cgi(tmpdir) [pwd]
    } default {
	set _cgi(tmpdir) [pwd]
	catch {set _cgi(tmpdir) $env(TMP)}
	catch {set _cgi(tmpdir) $env(TEMP)}
    }
}

#package provide cgi 1.2.1
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted support/tmk/contrib/makedepend/CHANGES.

1
2
3
4
5
Modifications:

- changed name main.c to mkdep.c (executable)
- removed compiler-dependent defines (cross-includes to xc/)

<
<
<
<
<










Deleted support/tmk/contrib/makedepend/TMakefile.

1
2
3
4
5
6


module cxx
lappend CFLAGS -DOBJSUFFIX=\"[FileName_StaticObj "" ]\"  
set PROGRAMS mkdep 

<
<
<
<
<
<












Deleted support/tmk/contrib/makedepend/cpp.ed.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#
# $XConsortium: cpp.ed,v 1.3 89/12/12 12:44:18 jim Exp $
#
# $Locker $
#
/struct symtab stab/d
/struct symtab \*defloc;/d
/struct symtab \*udfloc;/d
/struct symtab \*incloc;/d
/struct symtab \*ifloc;/d
/struct symtab \*elsloc;/d
/struct symtab \*eifloc;/d
/struct symtab \*ifdloc;/d
/struct symtab \*ifnloc;/d
/struct symtab \*ysysloc;/d
/struct symtab \*varloc;/d
/struct symtab \*lneloc;/d
/struct symtab \*ulnloc;/d
/struct symtab \*uflloc;/d
/^sayline(/s/$/	DELETED/p
.,/^}/d
/^unfill(/s/$/	DELETED/p
.-1,/^}/d
/^doincl(/s/$/	DELETED/p
.-1,/^}/d
/^equfrm(/s/$/	DELETED/p
.,/^}/d
/^dodef(/s/$/	DELETED/p
.-1,/^}/d
/^control(/s/$/	DELETED/p
.-1,/^}/d
/^savestring(/s/$/	DELETED/p
.-1,/^}/d
/^stsym(/s/$/	DELETED/p
.-1,/^}/d
/^ppsym(/s/$/	DELETED/p
.-1,/^}/d
/^yyerror(/s/$/	DELETED/p
.,/^}/d
/^ppwarn(/s/$/	DELETED/p
.,/^}/d
/^lookup(/s/$/	DELETED/p
.-1,/^}/d
/^subst(/s/$/	DELETED/p
.-1,/^}/d
/^trmdir(/s/$/	DELETED/p
.-1,/^}/d
/^copy(/s/$/	DELETED/p
.-1,/^}/d
/^pperror(/s/$/	DELETED/p
.,/^}/d
/^main(/s/$/	CHANGED to cpp_varsetup(argc,argv)/p
.c
cpp_varsetup(argc,argv)
.
/^strdex(/s/$/	DELETED/p
.-1,/^}/d
/^ for(i=1; i<argc; i++)/s/$/	To the end DELETED/p
.,$c
}
.
/^dump(/s/$/	DELETED/p
.,/^}/c
dump() { fatal("dump\n"); }
.
/^refill(/s/$/	DELETED/p
.,/^}/c
refill() { fatal("refill\n"); }
.
/^slookup(/s/$/	DELETED/p
.-1,/^}/c
static struct symtab *slookup() { fatal("slookup\n"); }
.
w
q
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































Deleted support/tmk/contrib/makedepend/cppsetup.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
/* $XConsortium: cppsetup.c /main/17 1996/09/28 16:15:03 rws $ */
/*

Copyright (c) 1993, 1994  X Consortium

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.

*/
/* $XFree86: xc/config/makedepend/cppsetup.c,v 3.2 1996/12/30 13:57:53 dawes Exp $ */

#include "def.h"

#ifdef	CPP
/*
 * This file is strictly for the sake of cpy.y and yylex.c (if
 * you indeed have the source for cpp).
 */
#define IB 1
#define SB 2
#define NB 4
#define CB 8
#define QB 16
#define WB 32
#define SALT '#'
#if defined(pdp11) || defined(vax) || defined(ns16000) || defined(mc68000) || defined(ibm032)
#define COFF 128
#else
#define COFF 0
#endif
/*
 * These variables used by cpy.y and yylex.c
 */
extern char	*outp, *inp, *newp, *pend;
extern char	*ptrtab;
extern char	fastab[];
extern char	slotab[];

/*
 * cppsetup
 */
struct filepointer	*currentfile;
struct inclist		*currentinc;

cppsetup(line, filep, inc)
	register char	*line;
	register struct filepointer	*filep;
	register struct inclist		*inc;
{
	register char *p, savec;
	static boolean setupdone = FALSE;
	boolean	value;

	if (!setupdone) {
		cpp_varsetup();
		setupdone = TRUE;
	}

	currentfile = filep;
	currentinc = inc;
	inp = newp = line;
	for (p=newp; *p; p++)
		;

	/*
	 * put a newline back on the end, and set up pend, etc.
	 */
	*p++ = '\n';
	savec = *p;
	*p = '\0';
	pend = p;

	ptrtab = slotab+COFF;
	*--inp = SALT; 
	outp=inp; 
	value = yyparse();
	*p = savec;
	return(value);
}

struct symtab **lookup(symbol)
	char	*symbol;
{
	static struct symtab    *undefined;
	struct symtab   **sp;

	sp = isdefined(symbol, currentinc, NULL);
	if (sp == NULL) {
		sp = &undefined;
		(*sp)->s_value = NULL;
	}
	return (sp);
}

pperror(tag, x0,x1,x2,x3,x4)
	int	tag,x0,x1,x2,x3,x4;
{
	warning("\"%s\", line %d: ", currentinc->i_file, currentfile->f_line);
	warning(x0,x1,x2,x3,x4);
}


yyerror(s)
	register char	*s;
{
	fatalerr("Fatal error: %s\n", s);
}
#else /* not CPP */

#include "ifparser.h"
struct _parse_data {
    struct filepointer *filep;
    struct inclist *inc;
    const char *line;
};

static const char *
my_if_errors (ip, cp, expecting)
    IfParser *ip;
    const char *cp;
    const char *expecting;
{
    struct _parse_data *pd = (struct _parse_data *) ip->data;
    int lineno = pd->filep->f_line;
    char *filename = pd->inc->i_file;
    char prefix[300];
    int prefixlen;
    int i;

    sprintf (prefix, "\"%s\":%d", filename, lineno);
    prefixlen = strlen(prefix);
    fprintf (stderr, "%s:  %s", prefix, pd->line);
    i = cp - pd->line;
    if (i > 0 && pd->line[i-1] != '\n') {
	putc ('\n', stderr);
    }
    for (i += prefixlen + 3; i > 0; i--) {
	putc (' ', stderr);
    }
    fprintf (stderr, "^--- expecting %s\n", expecting);
    return NULL;
}


#define MAXNAMELEN 256

static struct symtab **
lookup_variable (ip, var, len)
    IfParser *ip;
    const char *var;
    int len;
{
    char tmpbuf[MAXNAMELEN + 1];
    struct _parse_data *pd = (struct _parse_data *) ip->data;

    if (len > MAXNAMELEN)
	return 0;

    strncpy (tmpbuf, var, len);
    tmpbuf[len] = '\0';
    return isdefined (tmpbuf, pd->inc, NULL);
}


static int
my_eval_defined (ip, var, len)
    IfParser *ip;
    const char *var;
    int len;
{
    if (lookup_variable (ip, var, len))
	return 1;
    else
	return 0;
}

#define isvarfirstletter(ccc) (isalpha(ccc) || (ccc) == '_')

static long
my_eval_variable (ip, var, len)
    IfParser *ip;
    const char *var;
    int len;
{
    struct symtab **s;

    s = lookup_variable (ip, var, len);
    if (!s)
	return 0;
    do {
	var = (*s)->s_value;
	if (!isvarfirstletter(*var))
	    break;
	s = lookup_variable (ip, var, strlen(var));
    } while (s);

    return strtol(var, NULL, 0);
}


cppsetup(line, filep, inc)
	register char	*line;
	register struct filepointer	*filep;
	register struct inclist		*inc;
{
    IfParser ip;
    struct _parse_data pd;
    long val = 0;

    pd.filep = filep;
    pd.inc = inc;
    pd.line = line;
    ip.funcs.handle_error = my_if_errors;
    ip.funcs.eval_defined = my_eval_defined;
    ip.funcs.eval_variable = my_eval_variable;
    ip.data = (char *) &pd;

    (void) ParseIfExpression (&ip, line, &val);
    if (val)
	return IF;
    else
	return IFFALSE;
}
#endif /* CPP */

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































































































































































































































Deleted support/tmk/contrib/makedepend/def.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/* $XConsortium: def.h /main/30 1996/12/04 10:11:12 swick $ */
/* $XFree86: xc/config/makedepend/def.h,v 3.3 1997/01/12 10:38:17 dawes Exp $ */
/*

Copyright (c) 1993, 1994  X Consortium

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.

*/
#if 0
#include "Xos.h"
#include "Xfuncproto.h"
#endif
#include <stdio.h>
#ifndef X_NOT_STDC_ENV
#include <string.h>
#endif
#include <ctype.h>
#ifndef X_NOT_POSIX
#ifndef _POSIX_SOURCE
#define _POSIX_SOURCE
#endif
#endif
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>

#define MAXDEFINES	512
#define MAXFILES	1024
#define MAXDIRS		64
#define SYMTABINC	10	/* must be > 1 for define() to work right */
#define	TRUE		1
#define	FALSE		0

/* the following must match the directives table in main.c */
#define	IF		0
#define	IFDEF		1
#define	IFNDEF		2
#define	ELSE		3
#define	ENDIF		4
#define	DEFINE		5
#define	UNDEF		6
#define	INCLUDE		7
#define	LINE		8
#define	PRAGMA		9
#define ERROR           10
#define IDENT           11
#define SCCS            12
#define ELIF            13
#define EJECT           14
#define WARNING         15
#define IFFALSE         16     /* pseudo value --- never matched */
#define ELIFFALSE       17     /* pseudo value --- never matched */
#define INCLUDEDOT      18     /* pseudo value --- never matched */
#define IFGUESSFALSE    19     /* pseudo value --- never matched */
#define ELIFGUESSFALSE  20     /* pseudo value --- never matched */

#ifdef DEBUG
extern int	_debugmask;
/*
 * debug levels are:
 * 
 *     0	show ifn*(def)*,endif
 *     1	trace defined/!defined
 *     2	show #include
 *     3	show #include SYMBOL
 *     4-6	unused
 */
#define debug(level,arg) { if (_debugmask & (1 << level)) warning arg; }
#else
#define	debug(level,arg) /**/
#endif /* DEBUG */

typedef	unsigned char boolean;

struct symtab {
	char	*s_name;
	char	*s_value;
};

/* possible i_flag */
#define DEFCHECKED	(1<<0)	/* whether defines have been checked */
#define NOTIFIED	(1<<1)	/* whether we have revealed includes */
#define MARKED		(1<<2)	/* whether it's in the makefile */
#define SEARCHED	(1<<3)	/* whether we have read this */
#define FINISHED	(1<<4)	/* whether we are done reading this */
#define INCLUDED_SYM	(1<<5)	/* whether #include SYMBOL was found
				   Can't use i_list if TRUE */
struct	inclist {
	char		*i_incstring;	/* string from #include line */
	char		*i_file;	/* path name of the include file */
	struct inclist	**i_list;	/* list of files it itself includes */
	int		i_listlen;	/* length of i_list */
	struct symtab	**i_defs;	/* symbol table for this file and its
					   children when merged */
	int		i_ndefs;	/* current # defines */
	boolean		*i_merged;      /* whether we have merged child
					   defines */
	unsigned char   i_flags;
};

struct filepointer {
	char	*f_p;
	char	*f_base;
	char	*f_end;
	long	f_len;
	long	f_line;
};

#ifndef X_NOT_STDC_ENV
#include <stdlib.h>
#if defined(macII) && !defined(__STDC__)  /* stdlib.h fails to define these */
char *malloc(), *realloc();
#endif /* macII */
#else
char			*malloc();
char			*realloc();
#endif

char			*copy();
char			*base_name();
char			*getline();
struct symtab		**slookup();
struct symtab		**isdefined();
struct symtab		**fdefined();
struct filepointer	*getfile();
struct inclist		*newinclude();
struct inclist		*inc_path();

#if NeedVarargsPrototypes
extern void fatalerr(char *, ...);
extern void warning(char *, ...);
extern void warning1(char *, ...);
#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































































Deleted support/tmk/contrib/makedepend/ifparser.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
/*
 * $XConsortium: ifparser.c /main/10 1996/09/28 16:15:18 rws $
 * $XFree86: xc/config/makedepend/ifparser.c,v 3.6 1996/12/30 13:57:55 dawes Exp $
 *
 * Copyright 1992 Network Computing Devices, Inc.
 * 
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose and without fee is hereby granted, provided
 * that the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the name of Network Computing Devices may not be
 * used in advertising or publicity pertaining to distribution of the software
 * without specific, written prior permission.  Network Computing Devices makes
 * no representations about the suitability of this software for any purpose.
 * It is provided ``as is'' without express or implied warranty.
 * 
 * NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
 * IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL,
 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 * 
 * Author:  Jim Fulton
 *          Network Computing Devices, Inc.
 * 
 * Simple if statement processor
 *
 * This module can be used to evaluate string representations of C language
 * if constructs.  It accepts the following grammar:
 * 
 *     EXPRESSION	:=	VALUE
 * 			 |	VALUE  BINOP	EXPRESSION
 *			 |	VALUE	'?'	EXPRESSION ':'	EXPRESSION
 * 
 *     VALUE		:=	'('  EXPRESSION  ')'
 * 			 |	'!'  VALUE
 * 			 |	'-'  VALUE
 *			 |	'~'  VALUE
 * 			 |	'defined'  '('  variable  ')'
 * 			 |	'defined'  variable
 *			 |	# variable '(' variable-list ')'
 * 			 |	variable
 * 			 |	number
 * 
 *     BINOP		:=	'*'	|  '/'	|  '%'
 * 			 |	'+'	|  '-'
 * 			 |	'<<'	|  '>>'
 * 			 |	'<'	|  '>'	|  '<='  |  '>='
 * 			 |	'=='	|  '!='
 * 			 |	'&'	|  '^'  |  '|'
 * 			 |	'&&'	|  '||'
 * 
 * The normal C order of precedence is supported.
 * 
 * 
 * External Entry Points:
 * 
 *     ParseIfExpression		parse a string for #if
 */

#include "ifparser.h"
#include <ctype.h>

/****************************************************************************
		   Internal Macros and Utilities for Parser
 ****************************************************************************/

#define DO(val) if (!(val)) return NULL
#define CALLFUNC(ggg,fff) (*((ggg)->funcs.fff))
#define SKIPSPACE(ccc) while (isspace(*ccc)) ccc++
#define isvarfirstletter(ccc) (isalpha(ccc) || (ccc) == '_')


static const char *
parse_variable (g, cp, varp)
    IfParser *g;
    const char *cp;
    const char **varp;
{
    SKIPSPACE (cp);

    if (!isvarfirstletter (*cp))
	return CALLFUNC(g, handle_error) (g, cp, "variable name");

    *varp = cp;
    /* EMPTY */
    for (cp++; isalnum(*cp) || *cp == '_'; cp++) ;
    return cp;
}


static const char *
parse_number (g, cp, valp)
    IfParser *g;
    const char *cp;
    long *valp;
{
    SKIPSPACE (cp);

    if (!isdigit(*cp))
	return CALLFUNC(g, handle_error) (g, cp, "number");

    *valp = strtol(cp, &cp, 0);
    /* skip trailing qualifiers */
    while (*cp == 'U' || *cp == 'u' || *cp == 'L' || *cp == 'l') cp++;
#if 0
    *valp = atoi (cp);
    /* EMPTY */
    for (cp++; isdigit(*cp); cp++) ;
#endif
    return cp;
}

static const char *
parse_character (g, cp, valp)
    IfParser *g;
    const char *cp;
    long *valp;
{
    char val;

    SKIPSPACE (cp);
    if (*cp == '\\')
	switch (cp[1]) {
	case 'n': val = '\n'; break;
	case 't': val = '\t'; break;
	case 'v': val = '\v'; break;
	case 'b': val = '\b'; break;
	case 'r': val = '\r'; break;
	case 'f': val = '\f'; break;
	case 'a': val = '\a'; break;
	case '\\': val = '\\'; break;
	case '?': val = '\?'; break;
	case '\'': val = '\''; break;
	case '\"': val = '\"'; break;
	case 'x': val = (char) strtol (cp + 2, NULL, 16); break;
	default: val = (char) strtol (cp + 1, NULL, 8); break;
	}
    else
	val = *cp;
    while (*cp != '\'') cp++;
    *valp = (long) val;
    return cp;
}

static const char *
parse_value (g, cp, valp)
    IfParser *g;
    const char *cp;
    long *valp;
{
    const char *var;

    *valp = 0;

    SKIPSPACE (cp);
    if (!*cp)
	return cp;

    switch (*cp) {
      case '(':
	DO (cp = ParseIfExpression (g, cp + 1, valp));
	SKIPSPACE (cp);
	if (*cp != ')') 
	    return CALLFUNC(g, handle_error) (g, cp, ")");

	return cp + 1;			/* skip the right paren */

      case '!':
	DO (cp = parse_value (g, cp + 1, valp));
	*valp = !(*valp);
	return cp;

      case '-':
	DO (cp = parse_value (g, cp + 1, valp));
	*valp = -(*valp);
	return cp;

      case '~':
	DO (cp = parse_value (g, cp + 1, valp));
	*valp = ~(*valp);
	return cp;

      case '#':
	DO (cp = parse_variable (g, cp + 1, &var));
	SKIPSPACE (cp);
	if (*cp != '(')
	    return CALLFUNC(g, handle_error) (g, cp, "(");
	do {
	    DO (cp = parse_variable (g, cp + 1, &var));
	    SKIPSPACE (cp);
	} while (*cp && *cp != ')');
	if (*cp != ')')
	    return CALLFUNC(g, handle_error) (g, cp, ")");
	*valp = 1; /* XXX */
	return cp + 1;

      case '\'':
	DO (cp = parse_character (g, cp + 1, valp));
	if (*cp != '\'')
	    return CALLFUNC(g, handle_error) (g, cp, "'");
	return cp + 1;

      case 'd':
	if (strncmp (cp, "defined", 7) == 0 && !isalnum(cp[7])) {
	    int paren = 0;
	    int len;

	    cp += 7;
	    SKIPSPACE (cp);
	    if (*cp == '(') {
		paren = 1;
		cp++;
	    }
	    DO (cp = parse_variable (g, cp, &var));
	    len = cp - var;
	    SKIPSPACE (cp);
	    if (paren && *cp != ')')
		return CALLFUNC(g, handle_error) (g, cp, ")");
	    *valp = (*(g->funcs.eval_defined)) (g, var, len);
	    return cp + paren;		/* skip the right paren */
	}
	/* fall out */
    }

    if (isdigit(*cp)) {
	DO (cp = parse_number (g, cp, valp));
    } else if (!isvarfirstletter(*cp))
	return CALLFUNC(g, handle_error) (g, cp, "variable or number");
    else {
	DO (cp = parse_variable (g, cp, &var));
	*valp = (*(g->funcs.eval_variable)) (g, var, cp - var);
    }
    
    return cp;
}



static const char *
parse_product (g, cp, valp)
    IfParser *g;
    const char *cp;
    long *valp;
{
    long rightval;

    DO (cp = parse_value (g, cp, valp));
    SKIPSPACE (cp);

    switch (*cp) {
      case '*':
	DO (cp = parse_product (g, cp + 1, &rightval));
	*valp = (*valp * rightval);
	break;

      case '/':
	DO (cp = parse_product (g, cp + 1, &rightval));
	*valp = (*valp / rightval);
	break;

      case '%':
	DO (cp = parse_product (g, cp + 1, &rightval));
	*valp = (*valp % rightval);
	break;
    }
    return cp;
}


static const char *
parse_sum (g, cp, valp)
    IfParser *g;
    const char *cp;
    long *valp;
{
    long rightval;

    DO (cp = parse_product (g, cp, valp));
    SKIPSPACE (cp);

    switch (*cp) {
      case '+':
	DO (cp = parse_sum (g, cp + 1, &rightval));
	*valp = (*valp + rightval);
	break;

      case '-':
	DO (cp = parse_sum (g, cp + 1, &rightval));
	*valp = (*valp - rightval);
	break;
    }
    return cp;
}


static const char *
parse_shift (g, cp, valp)
    IfParser *g;
    const char *cp;
    long *valp;
{
    long rightval;

    DO (cp = parse_sum (g, cp, valp));
    SKIPSPACE (cp);

    switch (*cp) {
      case '<':
	if (cp[1] == '<') {
	    DO (cp = parse_shift (g, cp + 2, &rightval));
	    *valp = (*valp << rightval);
	}
	break;

      case '>':
	if (cp[1] == '>') {
	    DO (cp = parse_shift (g, cp + 2, &rightval));
	    *valp = (*valp >> rightval);
	}
	break;
    }
    return cp;
}


static const char *
parse_inequality (g, cp, valp)
    IfParser *g;
    const char *cp;
    long *valp;
{
    long rightval;

    DO (cp = parse_shift (g, cp, valp));
    SKIPSPACE (cp);

    switch (*cp) {
      case '<':
	if (cp[1] == '=') {
	    DO (cp = parse_inequality (g, cp + 2, &rightval));
	    *valp = (*valp <= rightval);
	} else {
	    DO (cp = parse_inequality (g, cp + 1, &rightval));
	    *valp = (*valp < rightval);
	}
	break;

      case '>':
	if (cp[1] == '=') {
	    DO (cp = parse_inequality (g, cp + 2, &rightval));
	    *valp = (*valp >= rightval);
	} else {
	    DO (cp = parse_inequality (g, cp + 1, &rightval));
	    *valp = (*valp > rightval);
	}
	break;
    }
    return cp;
}


static const char *
parse_equality (g, cp, valp)
    IfParser *g;
    const char *cp;
    long *valp;
{
    long rightval;

    DO (cp = parse_inequality (g, cp, valp));
    SKIPSPACE (cp);

    switch (*cp) {
      case '=':
	if (cp[1] == '=')
	    cp++;
	DO (cp = parse_equality (g, cp + 1, &rightval));
	*valp = (*valp == rightval);
	break;

      case '!':
	if (cp[1] != '=')
	    break;
	DO (cp = parse_equality (g, cp + 2, &rightval));
	*valp = (*valp != rightval);
	break;
    }
    return cp;
}


static const char *
parse_band (g, cp, valp)
    IfParser *g;
    const char *cp;
    long *valp;
{
    long rightval;

    DO (cp = parse_equality (g, cp, valp));
    SKIPSPACE (cp);

    switch (*cp) {
      case '&':
	if (cp[1] != '&') {
	    DO (cp = parse_band (g, cp + 1, &rightval));
	    *valp = (*valp & rightval);
	}
	break;
    }
    return cp;
}


static const char *
parse_bxor (g, cp, valp)
    IfParser *g;
    const char *cp;
    long *valp;
{
    long rightval;

    DO (cp = parse_band (g, cp, valp));
    SKIPSPACE (cp);

    switch (*cp) {
      case '^':
	DO (cp = parse_bxor (g, cp + 1, &rightval));
	*valp = (*valp ^ rightval);
	break;
    }
    return cp;
}


static const char *
parse_bor (g, cp, valp)
    IfParser *g;
    const char *cp;
    long *valp;
{
    long rightval;

    DO (cp = parse_bxor (g, cp, valp));
    SKIPSPACE (cp);

    switch (*cp) {
      case '|':
	if (cp[1] != '|') {
	    DO (cp = parse_bor (g, cp + 1, &rightval));
	    *valp = (*valp | rightval);
	}
	break;
    }
    return cp;
}


static const char *
parse_land (g, cp, valp)
    IfParser *g;
    const char *cp;
    long *valp;
{
    long rightval;

    DO (cp = parse_bor (g, cp, valp));
    SKIPSPACE (cp);

    switch (*cp) {
      case '&':
	if (cp[1] != '&')
	    return CALLFUNC(g, handle_error) (g, cp, "&&");
	DO (cp = parse_land (g, cp + 2, &rightval));
	*valp = (*valp && rightval);
	break;
    }
    return cp;
}


static const char *
parse_lor (g, cp, valp)
    IfParser *g;
    const char *cp;
    long *valp;
{
    long rightval;

    DO (cp = parse_land (g, cp, valp));
    SKIPSPACE (cp);

    switch (*cp) {
      case '|':
	if (cp[1] != '|')
	    return CALLFUNC(g, handle_error) (g, cp, "||");
	DO (cp = parse_lor (g, cp + 2, &rightval));
	*valp = (*valp || rightval);
	break;
    }
    return cp;
}


static const char *
parse_cond(g, cp, valp)
    IfParser *g;
    const char *cp;
    long *valp;
{
    long trueval, falseval;

    DO (cp = parse_lor (g, cp, valp));
    SKIPSPACE (cp);

    switch (*cp) {
      case '?':
	DO (cp = parse_cond (g, cp + 1, &trueval));
	SKIPSPACE (cp);
	if (*cp != ':')
	    return CALLFUNC(g, handle_error) (g, cp, ":");
	DO (cp = parse_cond (g, cp + 1, &falseval));
	*valp = (*valp ? trueval : falseval);
	break;
    }
    return cp;
}


/****************************************************************************
			     External Entry Points
 ****************************************************************************/

const char *
ParseIfExpression (g, cp, valp)
    IfParser *g;
    const char *cp;
    long *valp;
{
    return parse_cond (g, cp, valp);
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted support/tmk/contrib/makedepend/ifparser.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
 * $XConsortium: ifparser.h /main/4 1996/09/28 16:15:24 rws $
 *
 * Copyright 1992 Network Computing Devices, Inc.
 * 
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose and without fee is hereby granted, provided
 * that the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the name of Network Computing Devices may not be
 * used in advertising or publicity pertaining to distribution of the software
 * without specific, written prior permission.  Network Computing Devices makes
 * no representations about the suitability of this software for any purpose.
 * It is provided ``as is'' without express or implied warranty.
 * 
 * NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
 * IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL,
 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 * 
 * Author:  Jim Fulton
 *          Network Computing Devices, Inc.
 * 
 * Simple if statement processor
 *
 * This module can be used to evaluate string representations of C language
 * if constructs.  It accepts the following grammar:
 * 
 *     EXPRESSION	:=	VALUE
 * 			 |	VALUE  BINOP	EXPRESSION
 *			 |	VALUE	'?'	EXPRESSION ':'	EXPRESSION
 * 
 *     VALUE		:=	'('  EXPRESSION  ')'
 * 			 |	'!'  VALUE
 * 			 |	'-'  VALUE
 *			 |	'~'  VALUE
 * 			 |	'defined'  '('  variable  ')'
 * 			 |	variable
 * 			 |	number
 * 
 *     BINOP		:=	'*'	|  '/'	|  '%'
 * 			 |	'+'	|  '-'
 * 			 |	'<<'	|  '>>'
 * 			 |	'<'	|  '>'	|  '<='  |  '>='
 * 			 |	'=='	|  '!='
 * 			 |	'&'	|  '^'  |  '|'
 * 			 |	'&&'	|  '||'
 * 
 * The normal C order of precedence is supported.
 * 
 * 
 * External Entry Points:
 * 
 *     ParseIfExpression		parse a string for #if
 */

/* $XFree86: xc/config/makedepend/ifparser.h,v 3.2 1996/12/30 13:57:56 dawes Exp $ */

#include <stdio.h>

#define const /**/
typedef int Bool;
#define False 0
#define True 1

typedef struct _if_parser {
    struct {				/* functions */
	char *(*handle_error) (/* struct _if_parser *, const char *,
				 const char * */);
	long (*eval_variable) (/* struct _if_parser *, const char *, int */);
	int (*eval_defined) (/* struct _if_parser *, const char *, int */);
    } funcs;
    char *data;
} IfParser;

char *ParseIfExpression (
#ifdef __STDC__
    IfParser *, 
    const char *, 
    long *
#endif
);

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































Deleted support/tmk/contrib/makedepend/include.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
/* $XConsortium: include.c /main/20 1996/12/04 10:11:18 swick $ */
/*

Copyright (c) 1993, 1994  X Consortium

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.

*/


#include "def.h"

extern struct	inclist	inclist[ MAXFILES ],
			*inclistp;
extern char	*includedirs[ ];
extern char	*notdotdot[ ];
extern boolean show_where_not;
extern boolean warn_multiple;

boolean
isdot(p)
	register char	*p;
{
	if(p && *p++ == '.' && *p++ == '\0')
		return(TRUE);
	return(FALSE);
}

boolean
isdotdot(p)
	register char	*p;
{
	if(p && *p++ == '.' && *p++ == '.' && *p++ == '\0')
		return(TRUE);
	return(FALSE);
}

boolean
issymbolic(dir, component)
	register char	*dir, *component;
{
#ifdef S_IFLNK
	struct stat	st;
	char	buf[ BUFSIZ ], **pp;

	sprintf(buf, "%s%s%s", dir, *dir ? "/" : "", component);
	for (pp=notd