~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Open Mash Cross Reference
mash/conf/configure.in.dynamic

Component: ~ [ mash ] ~ [ apps ] ~ [ gsm ] ~ [ lib ] ~ [ otcl ] ~ [ srm ] ~ [ tcl8.3 ] ~ [ tclcl ] ~ [ tk8.3 ] ~ [ tutorials ] ~

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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.