tcltest: do a better job of cleanup up after tests
[jimtcl.git] / autosetup / cc-shared.tcl
blob86e169cc9051ceff6771ed7f760c01068632dbc4
1 # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
2 # All rights reserved
4 # @synopsis:
6 # The 'cc-shared' module provides support for shared libraries and shared objects.
7 # It defines the following variables:
9 ## SH_CFLAGS Flags to use compiling sources destined for a shared library
10 ## SH_LDFLAGS Flags to use linking (creating) a shared library
11 ## SH_SOPREFIX Prefix to use to set the soname when creating a shared library
12 ## SH_SOEXT Extension for shared libs
13 ## SH_SOEXTVER Format for versioned shared libs - %s = version
14 ## SHOBJ_CFLAGS Flags to use compiling sources destined for a shared object
15 ## SHOBJ_LDFLAGS Flags to use linking a shared object, undefined symbols allowed
16 ## SHOBJ_LDFLAGS_R - as above, but all symbols must be resolved
17 ## SH_LINKFLAGS Flags to use linking an executable which will load shared objects
18 ## LD_LIBRARY_PATH Environment variable which specifies path to shared libraries
19 ## STRIPLIBFLAGS Arguments to strip a dynamic library
21 module-options {}
23 # Defaults: gcc on unix
24 define SHOBJ_CFLAGS -fpic
25 define SHOBJ_LDFLAGS -shared
26 define SH_CFLAGS -fpic
27 define SH_LDFLAGS -shared
28 define SH_LINKFLAGS -rdynamic
29 define SH_SOEXT .so
30 define SH_SOEXTVER .so.%s
31 define SH_SOPREFIX -Wl,-soname,
32 define LD_LIBRARY_PATH LD_LIBRARY_PATH
33 define STRIPLIBFLAGS --strip-unneeded
35 # Note: This is a helpful reference for identifying the toolchain
36 # http://sourceforge.net/apps/mediawiki/predef/index.php?title=Compilers
38 switch -glob -- [get-define host] {
39 *-*-darwin* {
40 define SHOBJ_CFLAGS "-dynamic -fno-common"
41 define SHOBJ_LDFLAGS "-bundle -undefined dynamic_lookup"
42 define SHOBJ_LDFLAGS_R -bundle
43 define SH_CFLAGS -dynamic
44 define SH_LDFLAGS -dynamiclib
45 define SH_LINKFLAGS ""
46 define SH_SOEXT .dylib
47 define SH_SOEXTVER .%s.dylib
48 define SH_SOPREFIX -Wl,-install_name,
49 define LD_LIBRARY_PATH DYLD_LIBRARY_PATH
50 define STRIPLIBFLAGS -x
52 *-*-ming* - *-*-cygwin - *-*-msys {
53 define SHOBJ_CFLAGS ""
54 define SHOBJ_LDFLAGS -shared
55 define SH_CFLAGS ""
56 define SH_LDFLAGS -shared
57 define SH_LINKFLAGS ""
58 define SH_SOEXT .dll
59 define SH_SOEXTVER .dll
60 define SH_SOPREFIX ""
61 define LD_LIBRARY_PATH PATH
63 sparc* {
64 if {[msg-quiet cc-check-decls __SUNPRO_C]} {
65 msg-result "Found sun stdio compiler"
66 # sun stdio compiler
67 # XXX: These haven't been fully tested.
68 define SHOBJ_CFLAGS -KPIC
69 define SHOBJ_LDFLAGS "-G"
70 define SH_CFLAGS -KPIC
71 define SH_LINKFLAGS -Wl,-export-dynamic
72 define SH_SOPREFIX -Wl,-h,
73 } else {
74 # sparc has a very small GOT table limit, so use -fPIC
75 define SH_CFLAGS -fPIC
76 define SHOBJ_CFLAGS -fPIC
79 *-*-solaris* {
80 if {[msg-quiet cc-check-decls __SUNPRO_C]} {
81 msg-result "Found sun stdio compiler"
82 # sun stdio compiler
83 # XXX: These haven't been fully tested.
84 define SHOBJ_CFLAGS -KPIC
85 define SHOBJ_LDFLAGS "-G"
86 define SH_CFLAGS -KPIC
87 define SH_LINKFLAGS -Wl,-export-dynamic
88 define SH_SOPREFIX -Wl,-h,
91 *-*-hpux {
92 # XXX: These haven't been tested
93 define SHOBJ_CFLAGS "+O3 +z"
94 define SHOBJ_LDFLAGS -b
95 define SH_CFLAGS +z
96 define SH_LINKFLAGS -Wl,+s
97 define LD_LIBRARY_PATH SHLIB_PATH
99 *-*-haiku {
100 define SHOBJ_CFLAGS ""
101 define SHOBJ_LDFLAGS -shared
102 define SH_CFLAGS ""
103 define SH_LDFLAGS -shared
104 define SH_LINKFLAGS ""
105 define SH_SOPREFIX ""
106 define LD_LIBRARY_PATH LIBRARY_PATH
110 if {![is-defined SHOBJ_LDFLAGS_R]} {
111 define SHOBJ_LDFLAGS_R [get-define SHOBJ_LDFLAGS]