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 bush with `enable -f'
8 # usage: shobj-conf [-C compiler] -c host_cpu -o host_os -v host_vendor
13 # Copyright (C) 1996-2019 Free Software Foundation, Inc.
15 # This file is part of GNU Bush, the Bourne Again SHell.
17 # This program is free software: you can redistribute it and/or modify
18 # it under the terms of the GNU General Public License as published by
19 # the Free Software Foundation, either version 3 of the License, or
20 # (at your option) any later version.
22 # This program is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU General Public License for more details.
27 # You should have received a copy of the GNU General Public License
28 # along with this program. If not, see <http://www.gnu.org/licenses/>.
34 SHOBJ_STATUS
=supported
35 SHLIB_STATUS
=supported
51 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF)'
52 SHLIB_DLLVERSION
='$(SHLIB_MAJOR)'
54 PROGNAME
=`basename $0`
55 USAGE
="$PROGNAME [-C compiler] -c host_cpu -o host_os -v host_vendor"
57 while [ $# -gt 0 ]; do
59 -C) shift; SHOBJ_CC
="$1"; shift ;;
60 -c) shift; host_cpu
="$1"; shift ;;
61 -o) shift; host_os
="$1"; shift ;;
62 -v) shift; host_vendor
="$1"; shift ;;
63 *) echo "$USAGE" >&2 ; exit 2;;
67 case "${host_os}-${SHOBJ_CC}-${host_vendor}" in
68 nsk-cc-tandem|nsk-c99-tandem
)
69 SHOBJ_CFLAGS
=-Wglobalized
72 SHOBJ_CFLAGS
="${SHOBJ_CFLAGS} -Wcall_shared" # default on TNS/E, needed on TNS/R
73 SHOBJ_LD
=/usr
/bin
/ld
# for TNS/R
79 SHOBJ_LDFLAGS
='-shared -bglobalized -unres_symbols ignore'
85 SHOBJ_LDFLAGS
='-assert pure-text'
87 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
93 SHOBJ_LDFLAGS
='-assert pure-text'
95 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
98 sunos5
*-*gcc
*|solaris2
*-*gcc
*)
100 ld_used
=`gcc -print-prog-name=ld`
101 if ${ld_used} -V 2>&1 |
grep GNU
>/dev
/null
2>&1; then
102 # This line works for the GNU ld
103 SHOBJ_LDFLAGS
='-shared -Wl,-h,$@'
104 # http://sourceware.org/ml/binutils/2001-08/msg00361.html
107 # This line works for the Solaris linker in /usr/ccs/bin/ld
108 SHOBJ_LDFLAGS
='-shared -Wl,-i -Wl,-h,$@'
112 # SHLIB_XLDFLAGS='-R $(libdir)'
113 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
117 SHOBJ_CFLAGS
='-K pic'
118 SHOBJ_LD
=/usr
/ccs
/bin
/ld
119 SHOBJ_LDFLAGS
='-G -dy -z text -i -h $@'
121 # SHLIB_XLDFLAGS='-R $(libdir)'
122 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
125 # All versions of Linux (including Gentoo/FreeBSD) or the semi-mythical GNU Hurd.
126 linux
*-*|gnu
*-*|k
*bsd
*-gnu-*|freebsd
*|dragonfly
*)
129 SHOBJ_LDFLAGS
='-shared -Wl,-soname,$@'
131 SHLIB_XLDFLAGS
='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
132 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
137 # Common definitions for all darwin/mac os x versions
138 SHOBJ_CFLAGS
='-fno-common'
142 SHLIB_LIBVERSION
='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)'
143 SHLIB_LIBSUFF
='dylib'
145 # unused at this time
146 SHLIB_SONAME
='$(libdir)/`echo $@ | sed "s:\\..*::"`.$(SHLIB_MAJOR).$(SHLIB_LIBSUFF)'
149 # Darwin versions 1, 5, 6, 7 correspond to Mac OS X 10.0, 10.1, 10.2,
150 # and 10.3, respectively.
152 SHOBJ_STATUS
=unsupported
153 SHOBJ_LDFLAGS
='-dynamic'
154 SHLIB_XLDFLAGS
='-arch_only `/usr/bin/arch` -install_name $(libdir)/`echo $@ | sed "s:\\..*::"`.$(SHLIB_MAJOR).$(SHLIB_LIBSUFF) -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -v'
156 # Darwin 8 == Mac OS X 10.4; Mac OS X 10.N == Darwin N+4
159 darwin
[89]*|darwin1
[012]*)
160 SHOBJ_ARCHFLAGS
='-arch_only `/usr/bin/arch`'
162 *) # Mac OS X 10.9 (Mavericks) and later
164 # for 32 and 64bit universal library
165 #SHOBJ_ARCHFLAGS='-arch i386 -arch x86_64'
166 #SHOBJ_CFLAGS=${SHOBJ_CFLAGS}' -arch i386 -arch x86_64'
169 SHOBJ_LDFLAGS
="-dynamiclib -dynamic -undefined dynamic_lookup ${SHOBJ_ARCHFLAGS}"
170 SHLIB_XLDFLAGS
="-dynamiclib ${SHOBJ_ARCHFLAGS}"' -install_name $(libdir)/`echo $@ | sed "s:\\..*::"`.$(SHLIB_MAJOR).$(SHLIB_LIBSUFF) -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -v'
174 SHLIB_LIBS
='-lncurses' # see if -lcurses works on MacOS X 10.1
177 openbsd
*|netbsd
*|mirbsd
*)
180 SHOBJ_LDFLAGS
='-shared'
182 SHLIB_XLDFLAGS
='-R$(libdir)'
183 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
191 SHOBJ_LIBS
=-lc_s.2.1.0
193 # BSD/OS 2.x and 3.x `shared libraries' are too much of a pain in
194 # the ass -- they require changing {/usr/lib,etc}/shlib.map on
195 # each system, and the library creation process is byzantine
196 SHLIB_STATUS
=unsupported
204 SHOBJ_LIBS
=-lc_s.3.0.0
206 # BSD/OS 2.x and 3.x `shared libraries' are too much of a pain in
207 # the ass -- they require changing {/usr/lib,etc}/shlib.map on
208 # each system, and the library creation process is byzantine
209 SHLIB_STATUS
=unsupported
213 # BSD/OS 4.x now supports ELF and SunOS-style dynamically-linked
214 # shared libraries. gcc 2.x is the standard compiler, and the
215 # `normal' gcc options should work as they do in Linux.
219 SHOBJ_LDFLAGS
='-shared -Wl,-soname,$@'
221 SHLIB_XLDFLAGS
='-Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
222 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
226 # Fix to use gcc linker driver from bfischer@TechFak.Uni-Bielefeld.DE
228 SHOBJ_LDFLAGS
='-shared -Wl,-soname,$@'
230 SHLIB_XLDFLAGS
='-rpath $(libdir)'
231 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
236 SHOBJ_LDFLAGS
='-shared -soname $@ -expect_unresolved "*"'
238 SHLIB_XLDFLAGS
='-rpath $(libdir)'
239 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
242 aix4.
[2-9]*-*gcc
*|aix
[5-9].
*-*gcc
*) # lightly tested by jik@cisco.com
245 SHOBJ_LDFLAGS
='-bdynamic -bnoentry -bexpall'
248 SHLIB_XLDFLAGS
='-bM:SRE'
249 SHLIB_LIBS
='-lcurses -lc'
250 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
253 aix4.
[2-9]*|aix
[5-9].
*)
256 SHOBJ_LDFLAGS
='-bdynamic -bnoentry -bexpall'
259 SHLIB_XLDFLAGS
='-bM:SRE'
260 SHLIB_LIBS
='-lcurses -lc'
261 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
265 # THE FOLLOWING ARE UNTESTED -- and some may not support the dlopen interface
270 SHOBJ_LDFLAGS
='-shared -Wl,-soname,$@'
272 SHLIB_XLDFLAGS
='-Wl,-rpath,$(libdir)'
273 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
277 SHOBJ_CFLAGS
='-K PIC'
279 # SHOBJ_LDFLAGS='-call_shared -hidden_symbol -no_unresolved -soname $@'
280 # Change from David Kaelbling <drk@sgi.com>. If you have problems,
281 # remove the `-no_unresolved'
282 SHOBJ_LDFLAGS
='-shared -no_unresolved -soname $@'
284 SHLIB_XLDFLAGS
='-rpath $(libdir)'
285 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
289 # must use gcc; the bundled cc cannot compile PIC code
292 SHOBJ_LDFLAGS
='-shared -Wl,-b -Wl,+s'
294 SHLIB_XLDFLAGS
='-Wl,+b,$(libdir)'
296 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
300 SHOBJ_STATUS
=unsupported
301 SHLIB_STATUS
=unsupported
303 # If you are using the HP ANSI C compiler, you can uncomment and use
304 # this code (I have not tested it)
305 # SHOBJ_STATUS=supported
306 # SHLIB_STATUS=supported
310 # SHOBJ_LDFLAGS='-b +s'
312 # SHLIB_XLDFLAGS='+b $(libdir)'
314 # SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
319 # must use gcc; the bundled cc cannot compile PIC code
322 # if you have problems linking here, moving the `-Wl,+h,$@' from
323 # SHLIB_XLDFLAGS to SHOBJ_LDFLAGS has been reported to work
324 SHOBJ_LDFLAGS
='-shared -fpic -Wl,-b -Wl,+s'
326 SHLIB_XLDFLAGS
='-Wl,+h,$@ -Wl,+b,$(libdir)'
328 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
332 SHOBJ_STATUS
=unsupported
333 SHLIB_STATUS
=unsupported
335 # If you are using the HP ANSI C compiler, you can uncomment and use
336 # this code (I have not tested it)
337 # SHOBJ_STATUS=supported
338 # SHLIB_STATUS=supported
342 # SHOBJ_LDFLAGS='-b +s +h $@'
344 # SHLIB_XLDFLAGS='+b $(libdir)'
346 # SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
351 # must use gcc; the bundled cc cannot compile PIC code
354 # SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,-B,symbolic -Wl,+s -Wl,+std -Wl,+h,$@'
355 SHOBJ_LDFLAGS
='-shared -fpic -Wl,-b -Wl,+s -Wl,+h,$@'
357 SHLIB_XLDFLAGS
='-Wl,+b,$(libdir)'
359 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
363 SHOBJ_STATUS
=unsupported
364 SHLIB_STATUS
=unsupported
366 # If you are using the HP ANSI C compiler, you can uncomment and use
367 # this code from michael.osipov@siemens.com (I have not tested it)
370 # SHOBJ_LDFLAGS='-b -Wl,+s -Wl,+h,$@'
372 # SHLIB_XLDFLAGS='-Wl,+b,$(libdir)'
374 # SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
375 # SHLIB_LIBS='$(TERMCAP_LIB)'
380 SHOBJ_LDFLAGS
='-shared -h $@'
383 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
387 SHOBJ_CFLAGS
='-K PIC'
389 SHOBJ_LDFLAGS
='-dy -z text -G -h $@'
391 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
395 SHOBJ_CFLAGS
='-fpic' # DEFAULTS TO ELF
397 SHOBJ_LDFLAGS
='-shared'
399 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
403 SHOBJ_CFLAGS
='-K pic -b elf'
405 SHOBJ_LDFLAGS
='-G -b elf -dy -z text -h $@'
407 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
413 SHOBJ_LDFLAGS
='-shared'
415 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
419 SHOBJ_CFLAGS
='-K PIC'
421 SHOBJ_LDFLAGS
='-G -dy -z text -h $@'
423 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
426 sysv5UnixWare
*-*gcc
*)
429 SHOBJ_LDFLAGS
='-shared'
431 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
435 SHOBJ_CFLAGS
='-K PIC'
437 SHOBJ_LDFLAGS
='-G -dy -z text -h $@'
439 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
442 sysv5OpenUNIX
*-*gcc
*)
445 SHOBJ_LDFLAGS
='-shared'
447 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
451 SHOBJ_CFLAGS
='-K PIC'
453 SHOBJ_LDFLAGS
='-G -dy -z text -h $@'
455 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
461 SHOBJ_LDFLAGS
='-shared'
463 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
467 SHOBJ_CFLAGS
='-K pic'
469 SHOBJ_LDFLAGS
='-G -dy -h $@'
471 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
475 SHOBJ_STATUS
=unsupported
476 SHLIB_STATUS
=unsupported
481 SHOBJ_LDFLAGS
='-shared -Wl,--enable-auto-import -Wl,--enable-auto-image-base -Wl,--export-all -Wl,--out-implib=$(@).a'
484 SHLIB_LIBVERSION
='$(SHLIB_DLLVERSION).$(SHLIB_LIBSUFF)'
485 SHLIB_LIBS
='$(TERMCAP_LIB)'
488 # For official cygwin releases, DLLVERSION will be defined in the
489 # environment of configure, and will be incremented any time the API
490 # changes in a non-backwards compatible manner. Otherwise, it is just
492 if [ -n "$DLLVERSION" ] ; then
493 SHLIB_DLLVERSION
="$DLLVERSION"
499 SHOBJ_LDFLAGS
='-shared -Wl,--enable-auto-import -Wl,--enable-auto-image-base -Wl,--export-all -Wl,--out-implib=$(@).a'
501 SHLIB_LIBVERSION
='$(SHLIB_DLLVERSION).$(SHLIB_LIBSUFF)'
502 SHLIB_LIBS
='$(TERMCAP_LIB)'
505 # For official cygwin releases, DLLVERSION will be defined in the
506 # environment of configure, and will be incremented any time the API
507 # changes in a non-backwards compatible manner. Otherwise, it is just
509 if [ -n "$DLLVERSION" ] ; then
510 SHLIB_DLLVERSION
="$DLLVERSION"
515 # Rely on correct gcc configuration for everything else
520 SHOBJ_LDFLAGS
='-shared'
522 SHLIB_LIBVERSION
='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
526 SHOBJ_STATUS
=unsupported
527 SHLIB_STATUS
=unsupported
532 echo SHOBJ_CC
=\'"$SHOBJ_CC"\'
533 echo SHOBJ_CFLAGS
=\'"$SHOBJ_CFLAGS"\'
534 echo SHOBJ_LD
=\'"$SHOBJ_LD"\'
535 echo SHOBJ_LDFLAGS
=\'"$SHOBJ_LDFLAGS"\'
536 echo SHOBJ_XLDFLAGS
=\'"$SHOBJ_XLDFLAGS"\'
537 echo SHOBJ_LIBS
=\'"$SHOBJ_LIBS"\'
539 echo SHLIB_XLDFLAGS
=\'"$SHLIB_XLDFLAGS"\'
540 echo SHLIB_LIBS
=\'"$SHLIB_LIBS"\'
542 echo SHLIB_DOT
=\'"$SHLIB_DOT"\'
544 echo SHLIB_LIBPREF
=\'"$SHLIB_LIBPREF"\'
545 echo SHLIB_LIBSUFF
=\'"$SHLIB_LIBSUFF"\'
547 echo SHLIB_LIBVERSION
=\'"$SHLIB_LIBVERSION"\'
548 echo SHLIB_DLLVERSION
=\'"$SHLIB_DLLVERSION"\'
550 echo SHOBJ_STATUS
=\'"$SHOBJ_STATUS"\'
551 echo SHLIB_STATUS
=\'"$SHLIB_STATUS"\'