OSDN Git Service

Bump copyright dates.
[pf3gnuchains/pf3gnuchains3x.git] / itcl / cygtcl.m4
1 # CYGNUS LOCAL
2 #
3 # This entire file is Cygnus local, it contains a set of cross
4 # platform autoconf macros to be used by Tcl extensions.
5
6 # FIXME: There seems to be a problem with variable
7 # names that still need an expansion (like $foo_FILE)
8 # since another eval might be needed in these macros.
9
10 #--------------------------------------------------------------------
11 # TCL_TOOL_PATH
12 #
13 #       Return a file path that the build system tool will understand.
14 #       This path might be different than the path used in the
15 #       Makefiles.
16 #
17 # Arguments:
18 #       
19 #       VAR
20 #       PATH
21 #       
22 # Results:
23 #
24 #
25 # Example:
26 #
27 # TCL_TOOL_PATH(TCL_CC_PATH, /usr/local/compiler)
28 #
29 #--------------------------------------------------------------------
30
31 AC_DEFUN(TCL_TOOL_PATH, [
32   val=$2
33
34   if test "$val" = "" ; then
35     AC_MSG_ERROR([Empty value for variable $1])
36   fi
37
38   case "${host}" in
39     *windows32* | *mingw32*)
40       if test "${CYGPATH}" = ""; then
41         AC_MSG_ERROR([CYGPATH variable is not defined.])
42       elif test "${CYGPATH}" = "echo"; then
43         # No cygpath when cross compiling
44         $1=$val
45       else
46         # store literal argument text in a variable
47         val=$val
48         # Convert Cygwin to Windows path (/tmp/foo -> C:\Tmp\foo)
49         val="`${CYGPATH} $val`"
50         # Convert path like C:\Tmp\foo to C:/Tmp/foo
51         $1="`echo $val | sed -e s#\\\\\\\\#/#g`"
52       fi
53     ;;
54     *)
55       # Default to a no-op under Unix or Cygwin gcc
56       $1=$val
57     ;;
58   esac
59 ])
60
61 # FIXME: It would simplify things if no SUFFIX had to be passed
62 # into these LONGNAME macros. Using the TCL_SHARED_LIB_SUFFIX
63 # and TCL_UNSHARED_LIB_SUFFIX from tclConfig.sh might do the trick!
64
65 #--------------------------------------------------------------------
66 # TCL_TOOL_STATIC_LIB_LONGNAME
67 #
68 #       Return static library name in the "long format" understood by
69 #       the build tools. This might involve prepending a suffix
70 #       and appending version information to the library name.
71 #
72 # Arguments:
73 #       
74 #       VAR
75 #       LIBNAME
76 #       SUFFIX
77 #       
78 # Depends on:
79 #       TCL_DBGX
80 #       TCL_VENDOR_PREFIX
81 #
82 # Example:
83 #
84 # TCL_TOOL_STATIC_LIB_LONGNAME(TCL_LIB, tcl, $TCL_UNSHARED_LIB_SUFFIX)
85 #
86 # Results:
87 #
88 #       TCL_LIB=libtcl83.a
89 #
90 #       or
91 #
92 #       TCL_LIB=tcl83.lib
93 #
94 #--------------------------------------------------------------------
95
96 AC_DEFUN(TCL_TOOL_STATIC_LIB_LONGNAME, [
97   libname=$2
98   suffix=$3
99
100   case "${host}" in
101     *windows32* | *mingw32*)
102       if test "$GCC" != yes; then
103         eval "long_libname=\"${TCL_VENDOR_PREFIX}${libname}${suffix}\""
104       else
105         eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
106       fi
107     ;;
108     *)
109       eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
110     ;;
111   esac
112
113   eval "long_libname=${long_libname}"
114
115   # Trick to replace DBGX with TCL_DBGX
116   DBGX='${TCL_DBGX}'
117   eval "long_libname=${long_libname}"
118
119   $1=$long_libname
120 ])
121
122 #--------------------------------------------------------------------
123 # TCL_TOOL_SHARED_LIB_LONGNAME
124 #
125 #       Return the shared library name in the "long format" understood by
126 #       the build tools. This might involve prepending a suffix
127 #       and appending version information to the shared library name.
128 #
129 # Arguments:
130 #       
131 #       VAR
132 #       LIBNAME
133 #       SUFFIX
134 #       
135 # Depends on:
136 #       TCL_DBGX
137 #       TCL_VENDOR_PREFIX
138 #
139 # Example:
140 #
141 # TCL_TOOL_SHARED_LIB_LONGNAME(TCL_SHLIB, tcl, $TCL_SHARED_LIB_SUFFIX)
142 #
143 # Results:
144 #       The above example could result in the following.
145 #
146 #       TCL_SHLIB=libtcl83.so
147 #
148 #       or
149 #
150 #       TCL_SHLIB=tcl83.dll
151 #
152 #--------------------------------------------------------------------
153
154 AC_DEFUN(TCL_TOOL_SHARED_LIB_LONGNAME, [
155   libname=$2
156   suffix=$3
157
158   case "${host}" in
159     *windows32* | *mingw32* | *cygwin*)
160       eval "long_libname=\"${TCL_VENDOR_PREFIX}${libname}${suffix}\""
161     ;;
162     *)
163       eval "long_libname=\"lib${TCL_VENDOR_PREFIX}${libname}${suffix}\""
164     ;;
165   esac
166
167   eval "long_libname=${long_libname}"
168
169   # Trick to replace DBGX with TCL_DBGX
170   DBGX='${TCL_DBGX}'
171   eval "long_libname=${long_libname}"
172
173   $1=$long_libname
174 ])
175
176 #--------------------------------------------------------------------
177 # TCL_TOOL_LIB_SHORTNAME
178 #
179 #       Return the library name in the "short format" understood by
180 #       the build tools. This might involve prepending a suffix
181 #       and appending version information to the library name.
182 #       The VC++ compiler does not support short library names
183 #       so we just use the static import lib name in that case.
184 #
185 # Arguments:
186 #       
187 #       VAR
188 #       LIBNAME
189 #       VERSION
190 #       
191 # Depends on:
192 #       TCL_LIB_VERSIONS_OK
193 #       TCL_DBGX
194 #       SHARED_BUILD
195 #       
196 #
197 # Example:
198 #
199 # TCL_TOOL_LIB_SHORTNAME(TCL_LIB, tcl, 8.3)
200 #
201 # Results:
202 #       The above example could result in the following.
203 #
204 #       TCL_LIB=-ltcl83
205 #
206 #       or
207 #
208 #       TCL_LIB=tcl83.lib
209 #
210 #--------------------------------------------------------------------
211
212 AC_DEFUN(TCL_TOOL_LIB_SHORTNAME, [
213   libname=$2
214   version=$3
215
216   # If the . character is not allowed in lib name, remove it from version
217   if test "${TCL_LIB_VERSIONS_OK}" != "ok"; then
218         version=`echo $version | tr -d .`
219   fi
220
221   short_libname="-l${TCL_VENDOR_PREFIX}${libname}${version}\${TCL_DBGX}"
222   $1=$short_libname
223 ])
224
225 #--------------------------------------------------------------------
226 # TCL_TOOL_LIB_SPEC
227 #
228 #       Return the "lib spec format" understood by the build tools.
229 #
230 # Arguments:
231 #       
232 #       VAR
233 #       DIR
234 #       LIBARG
235 #       
236 # Depends on:
237 #       
238 #
239 # Example:
240 #
241 # TCL_TOOL_LIB_SPEC(SPEC, /usr/lib, -ltcl)
242 #
243 # Results:
244 #       The above example could result in the following.
245 #
246 #       SPEC="-L/usr/lib -ltcl83"
247 #
248 #--------------------------------------------------------------------
249
250 AC_DEFUN(TCL_TOOL_LIB_SPEC, [
251   case "${host}" in
252     *windows32* | *mingw32*)
253       if test "$GCC" != yes; then
254         TCL_TOOL_PATH($1, "$2/$3")
255       else
256         TCL_TOOL_PATH(dirname, $2)
257         $1="-L${dirname} $3"
258       fi
259     ;;
260     *)
261       $1="-L$2 $3"
262     ;;
263   esac
264 ])
265
266 #--------------------------------------------------------------------
267 # TCL_TOOL_LIB_PATH
268 #
269 #       Return the "lib path format" understood by the build tools.
270 #       Typically, this is the fully qualified path name of the library.
271 #
272 # Arguments:
273 #       
274 #       VAR
275 #       DIR
276 #       LIBARG
277 #       
278 # Depends on:
279 #       
280 #
281 # Example:
282 #
283 # TCL_TOOL_LIB_PATH(TMP_PATH, /usr/lib, libtcl83.a)
284 #
285 # Results:
286 #       The above example could result in the following.
287 #
288 #       TMP_PATH="/usr/lib/libtcl83.a"
289 #
290 #--------------------------------------------------------------------
291
292 AC_DEFUN(TCL_TOOL_LIB_PATH, [
293   TCL_TOOL_PATH($1, "$2/$3")
294 ])