3 # shobj-conf -- output a series of variable assignments to be substituted
4 # into a Makefile by configure which specify system-dependent
5 # information for creating shared objects that may be loaded
6 # into bash with `enable -f'
8 # usage: shobj-conf [-C compiler] -c host_cpu -o host_os -v host_vendor
16 SHOBJ_STATUS=supported
17 SHLIB_STATUS=supported
30 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF)'
32 PROGNAME=`basename $0`
33 USAGE="$PROGNAME [-C compiler] -c host_cpu -o host_os -v host_vendor"
35 while [ $# -gt 0 ]; do
37 -C) shift; SHOBJ_CC="$1"; shift ;;
38 -c) shift; host_cpu="$1"; shift ;;
39 -o) shift; host_os="$1"; shift ;;
40 -v) shift; host_vendor="$1"; shift ;;
41 *) echo "$USAGE" >&2 ; exit 2;;
45 case "${host_os}-${SHOBJ_CC}" in
49 SHOBJ_LDFLAGS='-assert pure-text'
51 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
57 SHOBJ_LDFLAGS='-assert pure-text'
59 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
62 sunos5*-*gcc*|solaris2*-*gcc*)
65 SHOBJ_LDFLAGS='-shared -Wl,-i -Wl,-h,$@'
67 # SHLIB_XLDFLAGS='-R $(libdir)'
68 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
73 SHOBJ_LD=/usr/ccs/bin/ld
74 SHOBJ_LDFLAGS='-G -dy -z text -i -h $@'
76 # SHLIB_XLDFLAGS='-R $(libdir)'
77 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
80 freebsd2* | netbsd* | openbsd*)
83 SHOBJ_LDFLAGS='-x -Bshareable'
85 SHLIB_XLDFLAGS='-R$(libdir)'
86 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
89 # FreeBSD-3.x can have either a.out or ELF object files
93 # SHOBJ_LDFLAGS='-shared'
95 # SHLIB_XLDFLAGS='-R$(libdir)'
96 # SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
100 freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*)
104 if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
105 SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
107 SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
108 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
110 SHOBJ_LDFLAGS='-shared'
112 SHLIB_XLDFLAGS='-R$(libdir)'
113 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
116 # All versions of Linux or the semi-mythical GNU Hurd.
120 SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
122 SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
123 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
131 SHOBJ_LIBS=-lc_s.2.1.0
133 # BSD/OS 2.x and 3.x `shared libraries' are too much of a pain in
134 # the ass -- they require changing {/usr/lib,etc}/shlib.map on
135 # each system, and the library creation process is byzantine
136 SHLIB_STATUS=unsupported
144 SHOBJ_LIBS=-lc_s.3.0.0
146 # BSD/OS 2.x and 3.x `shared libraries' are too much of a pain in
147 # the ass -- they require changing {/usr/lib,etc}/shlib.map on
148 # each system, and the library creation process is byzantine
149 SHLIB_STATUS=unsupported
153 # BSD/OS 4.x now supports ELF and SunOS-style dynamically-linked
154 # shared libraries. gcc 2.x is the standard compiler, and the
155 # `normal' gcc options should work as they do in Linux.
159 SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
161 SHLIB_XLDFLAGS='-Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
162 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
166 # Fix to use gcc linker driver from bfischer@TechFak.Uni-Bielefeld.DE
168 SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
170 SHLIB_XLDFLAGS='-rpath $(libdir)'
171 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
176 SHOBJ_LDFLAGS='-shared -soname $@ -expect_unresolved "*"'
178 SHLIB_XLDFLAGS='-rpath $(libdir)'
179 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
182 aix4.[2-9]*-*gcc*) # lightly tested by jik@cisco.com
185 SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
188 SHLIB_XLDFLAGS='-bM:SRE'
189 SHLIB_LIBS='-lcurses -lc'
190 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
196 SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
199 SHLIB_XLDFLAGS='-bM:SRE'
200 SHLIB_LIBS='-lcurses -lc'
201 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
205 # THE FOLLOWING ARE UNTESTED -- and some may not support the dlopen interface
210 SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
212 SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
213 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
217 SHOBJ_CFLAGS='-K PIC'
219 # SHOBJ_LDFLAGS='-call_shared -hidden_symbol -no_unresolved -soname $@'
220 # Change from David Kaelbling <drk@sgi.com>. If you have problems,
221 # remove the `-no_unresolved'
222 SHOBJ_LDFLAGS='-shared -no_unresolved -soname $@'
224 SHLIB_XLDFLAGS='-rpath $(libdir)'
225 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
229 # must use gcc; the bundled cc cannot compile PIC code
232 SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s'
234 SHLIB_XLDFLAGS='-Wl,+b,$(libdir)'
236 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
240 SHOBJ_STATUS=unsupported
241 SHLIB_STATUS=unsupported
245 # must use gcc; the bundled cc cannot compile PIC code
248 SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s'
250 SHLIB_XLDFLAGS='-Wl,+h,$@ -Wl,+b,$(libdir)'
252 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
256 SHOBJ_STATUS=unsupported
257 SHLIB_STATUS=unsupported
259 # If you are using the HP ANSI C compiler, you can uncomment and use
261 # SHOBJ_STATUS=unsupported
262 # SHLIB_STATUS=unsupported
270 # SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
274 # must use gcc; the bundled cc cannot compile PIC code
277 # SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,-B,symbolic -Wl,+s -Wl,+std -Wl,+h,$@'
278 SHOBJ_LDFLAGS='-shared -fpic -Wl,-b -Wl,+s -Wl,+h,$@'
280 SHLIB_XLDFLAGS='-Wl,+b,$(libdir)'
282 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
286 SHOBJ_STATUS=unsupported
287 SHLIB_STATUS=unsupported
289 # If you are using the HP ANSI C compiler, you can uncomment and use
291 # SHOBJ_STATUS=unsupported
292 # SHLIB_STATUS=unsupported
300 # SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
306 SHOBJ_LDFLAGS='-shared -h $@'
309 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
313 SHOBJ_CFLAGS='-K PIC'
315 SHOBJ_LDFLAGS='-dy -z text -G -h $@'
317 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
321 SHOBJ_CFLAGS='-fpic' # DEFAULTS TO ELF
323 SHOBJ_LDFLAGS='-shared'
325 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
329 SHOBJ_CFLAGS='-K pic -b elf'
331 SHOBJ_LDFLAGS='-G -b elf -dy -z text -h $@'
333 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
339 SHOBJ_LDFLAGS='-shared'
341 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
345 SHOBJ_CFLAGS='-K PIC'
347 SHOBJ_LDFLAGS='-G -dy -z text -h $@'
349 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
355 SHOBJ_LDFLAGS='-shared'
357 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
361 SHOBJ_CFLAGS='-K pic'
363 SHOBJ_LDFLAGS='-G -dy -h $@'
365 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
369 SHOBJ_STATUS=unsupported
370 SHLIB_STATUS=unsupported
374 # Rely on correct gcc configuration for everything else
379 SHOBJ_LDFLAGS='-shared'
381 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
385 SHOBJ_STATUS=unsupported
386 SHLIB_STATUS=unsupported
391 echo SHOBJ_CC=\'"$SHOBJ_CC"\'
392 echo SHOBJ_CFLAGS=\'"$SHOBJ_CFLAGS"\'
393 echo SHOBJ_LD=\'"$SHOBJ_LD"\'
394 echo SHOBJ_LDFLAGS=\'"$SHOBJ_LDFLAGS"\'
395 echo SHOBJ_XLDFLAGS=\'"$SHOBJ_XLDFLAGS"\'
396 echo SHOBJ_LIBS=\'"$SHOBJ_LIBS"\'
398 echo SHLIB_XLDFLAGS=\'"$SHLIB_XLDFLAGS"\'
399 echo SHLIB_LIBS=\'"$SHLIB_LIBS"\'
400 echo SHLIB_LIBSUFF=\'"$SHLIB_LIBSUFF"\'
401 echo SHLIB_LIBVERSION=\'"$SHLIB_LIBVERSION"\'
403 echo SHOBJ_STATUS=\'"$SHOBJ_STATUS"\'
404 echo SHLIB_STATUS=\'"$SHLIB_STATUS"\'