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
13 # Copyright (C) 1996-2007 Free Software Foundation, Inc.
15 # This program is free software; you can redistribute it and/or modify
16 # it under the terms of the GNU General Public License as published by
17 # the Free Software Foundation; either version 2, or (at your option)
20 # This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
32 SHOBJ_STATUS=supported
33 SHLIB_STATUS=supported
49 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF)'
50 SHLIB_DLLVERSION='$(SHLIB_MAJOR)'
52 PROGNAME=`basename $0`
53 USAGE="$PROGNAME [-C compiler] -c host_cpu -o host_os -v host_vendor"
55 while [ $# -gt 0 ]; do
57 -C) shift; SHOBJ_CC="$1"; shift ;;
58 -c) shift; host_cpu="$1"; shift ;;
59 -o) shift; host_os="$1"; shift ;;
60 -v) shift; host_vendor="$1"; shift ;;
61 *) echo "$USAGE" >&2 ; exit 2;;
65 case "${host_os}-${SHOBJ_CC}" in
69 SHOBJ_LDFLAGS='-assert pure-text'
71 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
77 SHOBJ_LDFLAGS='-assert pure-text'
79 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
82 sunos5*-*gcc*|solaris2*-*gcc*)
85 ld_used=`gcc -print-prog-name=ld`
86 if ${ld_used} -V 2>&1 | grep GNU >/dev/null 2>&1; then
87 # This line works for the GNU ld
88 SHOBJ_LDFLAGS='-shared -Wl,-h,$@'
90 # This line works for the Solaris linker in /usr/ccs/bin/ld
91 SHOBJ_LDFLAGS='-shared -Wl,-i -Wl,-h,$@'
94 # SHLIB_XLDFLAGS='-R $(libdir)'
95 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
100 SHOBJ_LD=/usr/ccs/bin/ld
101 SHOBJ_LDFLAGS='-G -dy -z text -i -h $@'
103 # SHLIB_XLDFLAGS='-R $(libdir)'
104 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
107 # All versions of Linux or the semi-mythical GNU Hurd.
108 linux*-*|gnu*-*|k*bsd*-gnu-*)
111 SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
113 SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
114 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
120 SHOBJ_LDFLAGS='-x -Bshareable'
122 SHLIB_XLDFLAGS='-R$(libdir)'
123 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
127 freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*)
131 if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
132 SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
134 SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
135 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
137 SHOBJ_LDFLAGS='-shared'
139 SHLIB_XLDFLAGS='-R$(libdir)'
140 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
146 SHOBJ_STATUS=supported
147 SHLIB_STATUS=supported
149 SHOBJ_CFLAGS='-fno-common'
151 SHOBJ_LD='MACOSX_DEPLOYMENT_TARGET=10.3 ${CC}'
153 SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)'
154 SHLIB_LIBSUFF='dylib'
156 SHOBJ_LDFLAGS='-dynamiclib -dynamic -undefined dynamic_lookup -arch_only `/usr/bin/arch`'
157 SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
159 SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1
163 SHOBJ_STATUS=unsupported
164 SHLIB_STATUS=supported
166 SHOBJ_CFLAGS='-fno-common'
170 SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)'
171 SHLIB_LIBSUFF='dylib'
174 darwin[789]*) SHOBJ_LDFLAGS=''
175 SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
177 *) SHOBJ_LDFLAGS='-dynamic'
178 SHLIB_XLDFLAGS='-arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
182 SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1
188 SHOBJ_LDFLAGS='-shared'
190 SHLIB_XLDFLAGS='-R$(libdir)'
191 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
199 SHOBJ_LIBS=-lc_s.2.1.0
201 # BSD/OS 2.x and 3.x `shared libraries' are too much of a pain in
202 # the ass -- they require changing {/usr/lib,etc}/shlib.map on
203 # each system, and the library creation process is byzantine
204 SHLIB_STATUS=unsupported
212 SHOBJ_LIBS=-lc_s.3.0.0
214 # BSD/OS 2.x and 3.x `shared libraries' are too much of a pain in
215 # the ass -- they require changing {/usr/lib,etc}/shlib.map on
216 # each system, and the library creation process is byzantine
217 SHLIB_STATUS=unsupported
221 # BSD/OS 4.x now supports ELF and SunOS-style dynamically-linked
222 # shared libraries. gcc 2.x is the standard compiler, and the
223 # `normal' gcc options should work as they do in Linux.
227 SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
229 SHLIB_XLDFLAGS='-Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
230 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
234 # Fix to use gcc linker driver from bfischer@TechFak.Uni-Bielefeld.DE
236 SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
238 SHLIB_XLDFLAGS='-rpath $(libdir)'
239 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
244 SHOBJ_LDFLAGS='-shared -soname $@ -expect_unresolved "*"'
246 SHLIB_XLDFLAGS='-rpath $(libdir)'
247 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
250 aix4.[2-9]*-*gcc*|aix[5-9].*-*gcc*) # lightly tested by jik@cisco.com
253 SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
256 SHLIB_XLDFLAGS='-bM:SRE'
257 SHLIB_LIBS='-lcurses -lc'
258 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
261 aix4.[2-9]*|aix[5-9].*)
264 SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
267 SHLIB_XLDFLAGS='-bM:SRE'
268 SHLIB_LIBS='-lcurses -lc'
269 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
273 # THE FOLLOWING ARE UNTESTED -- and some may not support the dlopen interface
278 SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
280 SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
281 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
285 SHOBJ_CFLAGS='-K PIC'
287 # SHOBJ_LDFLAGS='-call_shared -hidden_symbol -no_unresolved -soname $@'
288 # Change from David Kaelbling <drk@sgi.com>. If you have problems,
289 # remove the `-no_unresolved'
290 SHOBJ_LDFLAGS='-shared -no_unresolved -soname $@'
292 SHLIB_XLDFLAGS='-rpath $(libdir)'
293 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
297 # must use gcc; the bundled cc cannot compile PIC code
300 SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s'
302 SHLIB_XLDFLAGS='-Wl,+b,$(libdir)'
304 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
308 SHOBJ_STATUS=unsupported
309 SHLIB_STATUS=unsupported
311 # If you are using the HP ANSI C compiler, you can uncomment and use
312 # this code (I have not tested it)
313 # SHOBJ_STATUS=supported
314 # SHLIB_STATUS=supported
318 # SHOBJ_LDFLAGS='-b +s'
320 # SHLIB_XLDFLAGS='+b $(libdir)'
322 # SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
327 # must use gcc; the bundled cc cannot compile PIC code
330 # if you have problems linking here, moving the `-Wl,+h,$@' from
331 # SHLIB_XLDFLAGS to SHOBJ_LDFLAGS has been reported to work
332 SHOBJ_LDFLAGS='-shared -fpic -Wl,-b -Wl,+s'
334 SHLIB_XLDFLAGS='-Wl,+h,$@ -Wl,+b,$(libdir)'
336 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
340 SHOBJ_STATUS=unsupported
341 SHLIB_STATUS=unsupported
343 # If you are using the HP ANSI C compiler, you can uncomment and use
344 # this code (I have not tested it)
345 # SHOBJ_STATUS=supported
346 # SHLIB_STATUS=supported
350 # SHOBJ_LDFLAGS='-b +s +h $@'
352 # SHLIB_XLDFLAGS='+b $(libdir)'
354 # SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
359 # must use gcc; the bundled cc cannot compile PIC code
362 # SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,-B,symbolic -Wl,+s -Wl,+std -Wl,+h,$@'
363 SHOBJ_LDFLAGS='-shared -fpic -Wl,-b -Wl,+s -Wl,+h,$@'
365 SHLIB_XLDFLAGS='-Wl,+b,$(libdir)'
367 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
371 SHOBJ_STATUS=unsupported
372 SHLIB_STATUS=unsupported
374 # If you are using the HP ANSI C compiler, you can uncomment and use
375 # this code (I have not tested it)
376 # SHOBJ_STATUS=supported
377 # SHLIB_STATUS=supported
381 # SHOBJ_LDFLAGS='-b +s +h $@'
383 # SHLIB_XLDFLAGS='+b $(libdir)'
385 # SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
391 SHOBJ_LDFLAGS='-shared -h $@'
394 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
398 SHOBJ_CFLAGS='-K PIC'
400 SHOBJ_LDFLAGS='-dy -z text -G -h $@'
402 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
406 SHOBJ_CFLAGS='-fpic' # DEFAULTS TO ELF
408 SHOBJ_LDFLAGS='-shared'
410 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
414 SHOBJ_CFLAGS='-K pic -b elf'
416 SHOBJ_LDFLAGS='-G -b elf -dy -z text -h $@'
418 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
424 SHOBJ_LDFLAGS='-shared'
426 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
430 SHOBJ_CFLAGS='-K PIC'
432 SHOBJ_LDFLAGS='-G -dy -z text -h $@'
434 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
437 sysv5UnixWare*-*gcc*)
440 SHOBJ_LDFLAGS='-shared'
442 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
446 SHOBJ_CFLAGS='-K PIC'
448 SHOBJ_LDFLAGS='-G -dy -z text -h $@'
450 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
453 sysv5OpenUNIX*-*gcc*)
456 SHOBJ_LDFLAGS='-shared'
458 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
462 SHOBJ_CFLAGS='-K PIC'
464 SHOBJ_LDFLAGS='-G -dy -z text -h $@'
466 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
472 SHOBJ_LDFLAGS='-shared'
474 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
478 SHOBJ_CFLAGS='-K pic'
480 SHOBJ_LDFLAGS='-G -dy -h $@'
482 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
486 SHOBJ_STATUS=unsupported
487 SHLIB_STATUS=unsupported
492 SHOBJ_LDFLAGS='-shared -Wl,--enable-auto-import -Wl,--enable-auto-image-base -Wl,--export-all -Wl,--out-implib=$(@).a'
495 SHLIB_LIBVERSION='$(SHLIB_DLLVERSION).$(SHLIB_LIBSUFF)'
496 SHLIB_LIBS='$(TERMCAP_LIB)'
499 # For official cygwin releases, DLLVERSION will be defined in the
500 # environment of configure, and will be incremented any time the API
501 # changes in a non-backwards compatible manner. Otherwise, it is just
503 if [ -n "$DLLVERSION" ] ; then
504 SHLIB_DLLVERSION="$DLLVERSION"
509 # Rely on correct gcc configuration for everything else
514 SHOBJ_LDFLAGS='-shared'
516 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
520 SHOBJ_STATUS=unsupported
521 SHLIB_STATUS=unsupported
526 echo SHOBJ_CC=\'"$SHOBJ_CC"\'
527 echo SHOBJ_CFLAGS=\'"$SHOBJ_CFLAGS"\'
528 echo SHOBJ_LD=\'"$SHOBJ_LD"\'
529 echo SHOBJ_LDFLAGS=\'"$SHOBJ_LDFLAGS"\'
530 echo SHOBJ_XLDFLAGS=\'"$SHOBJ_XLDFLAGS"\'
531 echo SHOBJ_LIBS=\'"$SHOBJ_LIBS"\'
533 echo SHLIB_XLDFLAGS=\'"$SHLIB_XLDFLAGS"\'
534 echo SHLIB_LIBS=\'"$SHLIB_LIBS"\'
536 echo SHLIB_DOT=\'"$SHLIB_DOT"\'
538 echo SHLIB_LIBPREF=\'"$SHLIB_LIBPREF"\'
539 echo SHLIB_LIBSUFF=\'"$SHLIB_LIBSUFF"\'
541 echo SHLIB_LIBVERSION=\'"$SHLIB_LIBVERSION"\'
542 echo SHLIB_DLLVERSION=\'"$SHLIB_DLLVERSION"\'
544 echo SHOBJ_STATUS=\'"$SHOBJ_STATUS"\'
545 echo SHLIB_STATUS=\'"$SHLIB_STATUS"\'