Debian Codegraph @

conf/configure.in.dynamic

raw
1
2
3 #--------------------------------------------------------------------
4 # The statements below define a collection of symbols related to
5 # dynamic loading and shared libraries:
6 #
7 # DL_LIBS - Library file(s) to include in tclsh and other base
8 # applications in order for the "load" command to work.
9 # DL_LD_FLAGS - Flags to pass to the compiler when linking object
10 # files into an executable application binary such
11 # as tclsh.
12 # DL_LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib"
13 # that tell the run-time dynamic linker where to look
14 # for shared libraries such as libtcl.so. Depends on
15 # the variable SHLIB_RUNTIME_DIR in the Makefile.
16 # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
17 # of a shared library (may request position-independent
18 # code, among other things).
19 # SHLIB_LD - Base command to use for combining object files
20 # into a shared library.
21 # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
22 # creating shared libraries. This symbol typically
23 # goes at the end of the "ld" commands that build
24 # shared libraries. The value of the symbol is
25 # "$V_LIB" if all of the dependent libraries should
26 # be specified when creating a shared library. If
27 # dependent libraries should not be specified (as on
28 # SunOS 4.x, where they cause the link to fail, or in
29 # general if Tcl and Tk aren't themselves shared
30 # libraries), then this symbol has an empty string
31 # as its value.
32 # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
33 # extensions. An empty string means we don't know how
34 # to use shared libraries on this platform.
35 #--------------------------------------------------------------------
36
37
38 ### XXX: AC_ARG_ENABLE(shlib, --enable-shlib enable Makefile flags
39 ###for building shared libraries, , enable_shlib="no")
40
41
42 AC_ARG_ENABLE(shlib, --enable-shlib enable Makefile targets for mash shared libraries, , enable_shlib="no")
43
44
45 # Step 1: set the variable "system" to hold the name and version number
46 # for the system. This can usually be done via the "uname" command, but
47 # there are a few systems, like Next, where this doesn't work.
48
49 AC_MSG_CHECKING([system version (for dynamic loading)])
50 if test -f /usr/lib/NextStep/software_version; then
51 system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
52 else
53 system=`uname -s`-`uname -r`
54 if test "$?" -ne 0 ; then
55 AC_MSG_RESULT([unknown (can't find uname command)])
56 system=unknown
57 else
58 # Special check for weird MP-RAS system (uname returns weird
59 # results, and the version is kept in special file).
60
61 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
62 system=MP-RAS-`awk '{print $3}' /etc/.relid`
63 fi
64 if test "`uname -s`" = "AIX" ; then
65 system=AIX-`uname -v`.`uname -r`
66 fi
67 AC_MSG_RESULT($system)
68 fi
69 fi
70
71 # Step 2: check for existence of -ldl library. This is needed because
72 # Linux can use either -ldl or -ldld for dynamic loading.
73
74 AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
75
76 if test -z "$V_TCLSH"
77 then
78 local_TCLSH=tclsh
79 else
80 local_TCLSH=$V_TCLSH
81 fi
82
83 # Step 3: set configuration options based on system name and version.
84
85 case $system in
86 AIX-*)
87 enable_dl="no"
88 ;;
89 BSD/OS-2.1*|BSD/OS-3*)
90 SHLIB_CFLAGS=""
91 SHLIB_LD="shlicc -r"
92 SHLIB_LD_LIBS="$V_LIB"
93 SHLIB_SUFFIX=".so"
94 DL_LIBS="-ldl"
95 DL_LD_FLAGS=""
96 DL_LD_SEARCH_FLAGS=""
97 ;;
98 Darwin-5.*|Darwin-6.*|Darwin-7.*|Darwin-8.*|Darwin-9.*|Darwin-10.*)
99 LDFLAGS="${LDFLAGS} -Wl,-bind_at_load"
100 ;;
101 dgux*)
102 SHLIB_CFLAGS="-K PIC"
103 SHLIB_LD="cc -G"
104 SHLIB_LD_LIBS=""
105 SHLIB_SUFFIX=".so"
106 DL_LIBS="-ldl"
107 DL_LD_FLAGS=""
108 DL_LD_SEARCH_FLAGS=""
109 ;;
110 HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
111 AC_CHECK_LIB(dld, shl_load, dl_ok=yes, dl_ok=no)
112 if test "$dl_ok" = yes; then
113 SHLIB_CFLAGS="+z"
114 SHLIB_LD="ld -b"
115 SHLIB_LD_LIBS=""
116 SHLIB_SUFFIX=".sl"
117 DL_LIBS="-ldld"
118 DL_LD_FLAGS="-Wl,-E"
119 DL_LD_SEARCH_FLAGS='-Wl,+b,${SHLIB_RUNTIME_DIR}:.'
120 fi
121 ;;
122 IRIX-4.*)
123 SHLIB_CFLAGS="-G 0"
124 SHLIB_SUFFIX=".a"
125 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | $local_TCLSH -r -G 0"
126 SHLIB_LD_LIBS="$V_LIB"
127 DL_LIBS=""
128 DL_LD_FLAGS="-Wl,-D,08000000"
129 DL_LD_SEARCH_FLAGS='-L${SHLIB_RUNTIME_DIR}'
130 ;;
131 IRIX-5.*|IRIX-6.*)
132 SHLIB_CFLAGS=""
133 SHLIB_LD="ld -shared -rdata_shared"
134 SHLIB_LD_LIBS=""
135 SHLIB_SUFFIX=".so"
136 DL_LIBS=""
137 DL_LD_FLAGS=""
138 DL_LD_SEARCH_FLAGS='-Wl,-rpath,${SHLIB_RUNTIME_DIR}'
139 ;;
140 IRIX64-6.*)
141 SHLIB_CFLAGS=""
142 SHLIB_LD="ld -32 -shared -rdata_shared -rpath /usr/local/lib"
143 SHLIB_LD_LIBS=""
144 SHLIB_SUFFIX=".so"
145 DL_LIBS=""
146 DL_LD_FLAGS=""
147 DL_LD_SEARCH_FLAGS='-Wl,-rpath,${SHLIB_RUNTIME_DIR}'
148 ;;
149 Linux*)
150 SHLIB_CFLAGS="-fPIC"
151 SHLIB_LD_LIBS=""
152 SHLIB_SUFFIX=".so"
153 LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
154 if test "$have_dl" = yes; then
155 SHLIB_LD="${CC} -shared"
156 DL_LIBS="-ldl"
157 DL_LD_FLAGS="-rdynamic"
158 DL_LD_SEARCH_FLAGS=""
159 else
160 AC_CHECK_HEADER(dld.h, [
161 SHLIB_LD="ld -shared"
162 DL_LIBS="-ldld"
163 DL_LD_FLAGS=""
164 DL_LD_SEARCH_FLAGS=""])
165 fi
166 ;;
167 CYGWIN*)
168 SHLIB_CFLAGS="-fPIC"
169 SHLIB_LD_LIBS=""
170 SHLIB_SUFFIX=".dll"
171 SHLIB_LD="g++ -shared"
172 LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
173 DL_LIBS="-ldl"
174 DL_LD_FLAGS="-rdynamic"
175 DL_LD_SEARCH_FLAGS=""
176 AC_MSG_CHECKING([for import libraries])
177 V_IMPORT_LIBS=`echo "$V_LIBS" | sed "s/-L//g" | sed "s/ \-l/\/lib/g" | sed "s/ /\.a /g" `
178 for libfile in $V_IMPORT_LIBS ; do
179 if test ! -f "$libfile" ; then
180 AC_MSG_RESULT([failed!])
181 AC_MSG_ERROR([Could not find "$libfile"])
182 fi
183 done
184 AC_MSG_RESULT([ok])
185 AC_SUBST([V_IMPORT_LIBS])
186 ;;
187 MP-RAS-02*)
188 SHLIB_CFLAGS="-K PIC"
189 SHLIB_LD="cc -G"
190 SHLIB_LD_LIBS=""
191 SHLIB_SUFFIX=".so"
192 DL_LIBS="-ldl"
193 DL_LD_FLAGS=""
194 DL_LD_SEARCH_FLAGS=""
195 ;;
196 MP-RAS-*)
197 SHLIB_CFLAGS="-K PIC"
198 SHLIB_LD="cc -G"
199 SHLIB_LD_LIBS=""
200 SHLIB_SUFFIX=".so"
201 DL_LIBS="-ldl"
202 DL_LD_FLAGS="-Wl,-Bexport"
203 DL_LD_SEARCH_FLAGS=""
204 ;;
205 NetBSD-*|FreeBSD-*|OpenBSD-*)
206 # Not available on all versions: check for include file.
207 AC_CHECK_HEADER(dlfcn.h, [
208 SHLIB_CFLAGS="-fpic"
209 SHLIB_LD="ld -Bshareable -x"
210 SHLIB_LD_LIBS=""
211 SHLIB_SUFFIX=".so"
212 DL_LIBS=""
213 DL_LD_FLAGS=""
214 DL_LD_SEARCH_FLAGS=""
215 ], [
216 SHLIB_CFLAGS=""
217 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | $local_TCLSH -r"
218 SHLIB_LD_LIBS='$V_LIB'
219 SHLIB_SUFFIX=".a"
220 DL_LIBS=""
221 DL_LD_FLAGS=""
222 DL_LD_SEARCH_FLAGS='-L${SHLIB_RUNTIME_DIR}'
223 ])
224
225 ;;
226 NEXTSTEP-*)
227 SHLIB_CFLAGS=""
228 SHLIB_LD="cc -nostdlib -r"
229 SHLIB_LD_LIBS=""
230 SHLIB_SUFFIX=".so"
231 DL_LIBS=""
232 DL_LD_FLAGS=""
233 DL_LD_SEARCH_FLAGS=""
234 ;;
235 OSF1-1.0|OSF1-1.1|OSF1-1.2)
236 # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
237 SHLIB_CFLAGS=""
238 # Hack: make package name same as library name
239 SHLIB_LD='ld -R -export $@:'
240 SHLIB_LD_LIBS=""
241 SHLIB_SUFFIX=".so"
242 DL_LIBS=""
243 DL_LD_FLAGS=""
244 DL_LD_SEARCH_FLAGS=""
245 ;;
246 OSF1-1.*)
247 # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
248 SHLIB_CFLAGS="-fpic"
249 SHLIB_LD="ld -shared"
250 SHLIB_LD_LIBS=""
251 SHLIB_SUFFIX=".so"
252 DL_LIBS=""
253 DL_LD_FLAGS=""
254 DL_LD_SEARCH_FLAGS=""
255 ;;
256 OSF1-V*)
257 # Digital OSF/1
258 SHLIB_CFLAGS=""
259 SHLIB_LD='ld -shared -expect_unresolved "*"'
260 SHLIB_LD_LIBS=""
261 SHLIB_SUFFIX=".so"
262 DL_LIBS=""
263 DL_LD_FLAGS=""
264 DL_LD_SEARCH_FLAGS='-Wl,-rpath,${SHLIB_RUNTIME_DIR}'
265 ;;
266 RISCos-*)
267 SHLIB_CFLAGS="-G 0"
268 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | $local_TCLSH -r -G 0"
269 SHLIB_LD_LIBS='$V_LIB'
270 SHLIB_SUFFIX=".a"
271 DL_LIBS=""
272 DL_LD_FLAGS="-Wl,-D,08000000"
273 DL_LD_SEARCH_FLAGS='-L${SHLIB_RUNTIME_DIR}'
274 ;;
275 SCO_SV-3.2*)
276 # Note, dlopen is available only on SCO 3.2.5 and greater. However,
277 # this test works, since "uname -s" was non-standard in 3.2.4 and
278 # below.
279 SHLIB_CFLAGS="-Kpic -belf"
280 SHLIB_LD="ld -G"
281 SHLIB_LD_LIBS=""
282 SHLIB_SUFFIX=".so"
283 DL_LIBS=""
284 DL_LD_FLAGS="-belf -Wl,-Bexport"
285 DL_LD_SEARCH_FLAGS=""
286 ;;
287 SINIX*5.4*)
288 SHLIB_CFLAGS="-K PIC"
289 SHLIB_LD="cc -G"
290 SHLIB_LD_LIBS=""
291 SHLIB_SUFFIX=".so"
292 DL_LIBS="-ldl"
293 DL_LD_FLAGS=""
294 DL_LD_SEARCH_FLAGS=""
295 ;;
296 SunOS-4*)
297 SHLIB_CFLAGS="-PIC"
298 SHLIB_LD="ld"
299 SHLIB_LD_LIBS=""
300 SHLIB_SUFFIX=".so"
301 DL_LIBS="-ldl"
302 DL_LD_FLAGS=""
303 DL_LD_SEARCH_FLAGS='-L${SHLIB_RUNTIME_DIR}'
304 ;;
305 SunOS-5*)
306 SHLIB_CFLAGS="-KPIC"
307 SHLIB_LD="/usr/ccs/bin/ld -G -z text"
308
309 # Note: need the LIBS below, otherwise Tk won't find Tcl's
310 # symbols when dynamically loaded into tclsh.
311
312 SHLIB_LD_LIBS='$V_LIB'
313 SHLIB_SUFFIX=".so"
314 DL_LIBS="-ldl"
315 DL_LD_FLAGS=""
316 DL_LD_SEARCH_FLAGS='-R ${SHLIB_RUNTIME_DIR}'
317 ;;
318 ULTRIX-4.*)
319 SHLIB_CFLAGS="-G 0"
320 SHLIB_SUFFIX=".a"
321 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | $local_TCLSH -r -G 0"
322 SHLIB_LD_LIBS='$V_LIB'
323 DL_LIBS=""
324 DL_LD_FLAGS="-Wl,-D,08000000"
325 DL_LD_SEARCH_FLAGS='-L${SHLIB_RUNTIME_DIR}'
326 ;;
327 UNIX_SV*)
328 SHLIB_CFLAGS="-KPIC"
329 SHLIB_LD="cc -G"
330 SHLIB_LD_LIBS=""
331 SHLIB_SUFFIX=".so"
332 DL_LIBS="-ldl"
333 # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
334 # that don't grok the -Bexport option. Test that it does.
335 hold_ldflags=$LDFLAGS
336 AC_MSG_CHECKING(for ld accepts -Bexport flag)
337 LDFLAGS="${LDFLAGS} -Wl,-Bexport"
338 AC_TRY_LINK(, [int i;], found=yes, found=no)
339 LDFLAGS=$hold_ldflags
340 AC_MSG_RESULT($found)
341 if test $found = yes; then
342 SH_LD_FLAGS="-Wl,-Bexport"
343 else
344 SH_LD_FLAGS=""
345 fi
346 SH_LD_SEARCH_FLAGS=""
347 ;;
348 esac
349
350 # Step 4: disable dynamic loading if requested via a command-line switch.
351 #
352 #XXX:if test $enable_shlib = "no" ; then
353 # echo "Disabling dynamic loading and shared libraries"
354 # SHLIB_CFLAGS=""
355 # SHLIB_LD=""
356 # SHLIB_SUFFIX=""
357 # DL_LIBS=""
358 # DL_LD_FLAGS=""
359 # DL_LD_SEARCH_FLAGS=""
360 #fi
361
362
363 # If we're running gcc, then change the C flags for compiling shared
364 # libraries to the right flags for gcc, instead of those for the
365 # standard manufacturer compiler.
366
367 ####XXX:if test "enable_shlib" != "no" ; then
368 if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
369 case $system in
370 AIX-*)
371 ;;
372 BSD/OS*)
373 ;;
374 IRIX*)
375 ;;
376 NetBSD-*|FreeBSD-*|OpenBSD-*)
377 ;;
378 RISCos-*)
379 ;;
380 ULTRIX-4.*)
381 ;;
382 *)
383 SHLIB_CFLAGS="-fPIC"
384 ;;
385 esac
386 fi
387 ####fi
388
389
390 if test "$enable_shlib" != "no" ; then
391 PKG_SHLIB_CFLAGS=$SHLIB_CFLAGS
392 else
393 PKG_SHLIB_CFLAGS=""
394 fi
395
396
397 AC_SUBST(DL_LIBS)
398 AC_SUBST(DL_LD_FLAGS)
399 AC_SUBST(DL_LD_SEARCH_FLAGS)
400 AC_SUBST(LDFLAGS)
401 AC_SUBST(SHLIB_CFLAGS)
402 AC_SUBST(SHLIB_LD)
403 AC_SUBST(SHLIB_LD_LIBS)
404 AC_SUBST(SHLIB_SUFFIX)
405
406 AC_SUBST(PKG_SHLIB_CFLAGS)