Imported from ../bash-3.1.tar.gz.
[platform/upstream/bash.git] / support / shobj-conf
index a7c5810..0e306bc 100755 (executable)
 # Chet Ramey
 # chet@po.cwru.edu
 
+# Copyright (C) 1996-2002 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
 #
 # defaults
 #
@@ -25,9 +41,13 @@ SHOBJ_LIBS=
 
 SHLIB_XLDFLAGS=
 SHLIB_LIBS=
+
+SHLIB_DOT='.'
+SHLIB_LIBPREF='lib'
 SHLIB_LIBSUFF='so'
 
 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF)'
+SHLIB_DLLVERSION='$(SHLIB_MAJOR)'
 
 PROGNAME=`basename $0`
 USAGE="$PROGNAME [-C compiler] -c host_cpu -o host_os -v host_vendor"
@@ -62,7 +82,14 @@ sunos4*)
 sunos5*-*gcc*|solaris2*-*gcc*)
        SHOBJ_CFLAGS=-fpic
        SHOBJ_LD='${CC}'
-       SHOBJ_LDFLAGS='-shared -Wl,-i -Wl,-h,$@'
+       ld_used=`gcc -print-prog-name=ld`
+       if ${ld_used} -V 2>&1 | grep GNU >/dev/null 2>&1; then
+               # This line works for the GNU ld
+               SHOBJ_LDFLAGS='-shared -Wl,-h,$@'
+       else
+               # This line works for the Solaris linker in /usr/ccs/bin/ld
+               SHOBJ_LDFLAGS='-shared -Wl,-i -Wl,-h,$@'
+       fi
 
 #      SHLIB_XLDFLAGS='-R $(libdir)'
        SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
@@ -78,7 +105,7 @@ sunos5*|solaris2*)
        ;;
 
 # All versions of Linux or the semi-mythical GNU Hurd.
-linux*|gnu*)
+linux*-*|gnu*-*|k*bsd*-gnu-*)
        SHOBJ_CFLAGS=-fPIC
        SHOBJ_LD='${CC}'
        SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
@@ -97,7 +124,7 @@ freebsd2* | netbsd*)
        ;;
 
 # FreeBSD-3.x ELF
-freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*)
+freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*)
        SHOBJ_CFLAGS=-fpic
        SHOBJ_LD='${CC}'
 
@@ -119,17 +146,23 @@ darwin*|macosx*)
        SHOBJ_STATUS=unsupported
        SHLIB_STATUS=supported
 
-       SHOBJ_CFLAGS='-dynamic -fno-common'
+       SHOBJ_CFLAGS='-fno-common'
 
-       SHOBJ_LD=/usr/bin/libtool
+       SHOBJ_LD='${CC}'
 
        SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)'
        SHLIB_LIBSUFF='dylib'
 
-       SHOBJ_LDFLAGS='-dynamic'
-       SHLIB_XLDFLAGS='-arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
+       case "${host_os}" in
+       darwin[78]*)    SHOBJ_LDFLAGS=''
+                       SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
+                       ;;
+       *)              SHOBJ_LDFLAGS='-dynamic'
+                       SHLIB_XLDFLAGS='-arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
+                       ;;
+       esac
 
-       SHLIB_LIBS='-lSystem'
+       SHLIB_LIBS='-lncurses'  # see if -lcurses works on MacOS X 10.1 
        ;;
 
 openbsd*)
@@ -277,6 +310,8 @@ hpux10*-*gcc*)
        # must use gcc; the bundled cc cannot compile PIC code
        SHOBJ_CFLAGS='-fpic'
        SHOBJ_LD='${CC}'
+       # if you have problems linking here, moving the `-Wl,+h,$@' from
+       # SHLIB_XLDFLAGS to SHOBJ_LDFLAGS has been reported to work
        SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s'
 
        SHLIB_XLDFLAGS='-Wl,+h,$@ -Wl,+b,$(libdir)'
@@ -381,7 +416,39 @@ sysv5uw7*)
 
        SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
        ;;
-       
+
+sysv5UnixWare*-*gcc*)
+       SHOBJ_CFLAGS=-fpic
+       SHOBJ_LD='${CC}'
+       SHOBJ_LDFLAGS='-shared'
+
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+sysv5UnixWare*)
+       SHOBJ_CFLAGS='-K PIC'
+       SHOBJ_LD=ld
+       SHOBJ_LDFLAGS='-G -dy -z text -h $@'
+
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+sysv5OpenUNIX*-*gcc*)
+       SHOBJ_CFLAGS=-fpic
+       SHOBJ_LD='${CC}'
+       SHOBJ_LDFLAGS='-shared'
+
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
+sysv5OpenUNIX*)
+       SHOBJ_CFLAGS='-K PIC'
+       SHOBJ_LD=ld
+       SHOBJ_LDFLAGS='-G -dy -z text -h $@'
+
+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+       ;;
+
 dgux*-*gcc*)
        SHOBJ_CFLAGS=-fpic
        SHOBJ_LD='${CC}'
@@ -403,6 +470,24 @@ msdos*)
        SHLIB_STATUS=unsupported
        ;;
 
+cygwin*)
+       SHOBJ_LD='$(CC)'
+        SHOBJ_LDFLAGS='-shared -Wl,--enable-auto-import -Wl,--enable-auto-image-base -Wl,--export-all -Wl,--out-implib=$(@).a'
+        SHLIB_LIBPREF='cyg'
+        SHLIB_LIBSUFF='dll'
+        SHLIB_LIBVERSION='$(SHLIB_DLLVERSION).$(SHLIB_LIBSUFF)'
+        SHLIB_LIBS='$(TERMCAP_LIB)'
+
+       SHLIB_DOT=
+        # For official cygwin releases, DLLVERSION will be defined in the
+        # environment of configure, and will be incremented any time the API
+        # changes in a non-backwards compatible manner.  Otherwise, it is just
+        # SHLIB_MAJOR.
+        if [ -n "$DLLVERSION" ] ; then
+               SHLIB_DLLVERSION="$DLLVERSION"
+        fi
+       ;;
+
 #
 # Rely on correct gcc configuration for everything else
 #
@@ -430,8 +515,14 @@ echo SHOBJ_LIBS=\'"$SHOBJ_LIBS"\'
 
 echo SHLIB_XLDFLAGS=\'"$SHLIB_XLDFLAGS"\'
 echo SHLIB_LIBS=\'"$SHLIB_LIBS"\'
+
+echo SHLIB_DOT=\'"$SHLIB_DOT"\'
+
+echo SHLIB_LIBPREF=\'"$SHLIB_LIBPREF"\'
 echo SHLIB_LIBSUFF=\'"$SHLIB_LIBSUFF"\'
+
 echo SHLIB_LIBVERSION=\'"$SHLIB_LIBVERSION"\'
+echo SHLIB_DLLVERSION=\'"$SHLIB_DLLVERSION"\'
 
 echo SHOBJ_STATUS=\'"$SHOBJ_STATUS"\'
 echo SHLIB_STATUS=\'"$SHLIB_STATUS"\'