| 1 | # This file is a shell script that overrides some of the tools and |
| 2 | # flags used on a host specific basis. |
| 3 | |
| 4 | # Since the "bfd/hosts" directory is shared by the bfd, opcodes, and |
| 5 | # binutils directories (at least), the index to it is also shared. |
| 6 | # This is that index. Each configure.in file should source this file |
| 7 | # in its per-host part. |
| 8 | |
| 9 | # This sets the following shell variables: |
| 10 | # HDEFINES host specific compiler options |
| 11 | # host64 set to true if this is a 64 bit host |
| 12 | # HOST_64BIT_TYPE host 64 bit type |
| 13 | # SHLIB_CC compiler to use when building shared library |
| 14 | # SHLIB_CFLAGS flags to use when building shared library |
| 15 | # PICFLAG may be set to flag to use to compile PIC |
| 16 | # SHLINK may be set to the name to link the shared library to |
| 17 | # ALLLIBS may be set to libraries to build |
| 18 | # HLDFLAGS LDFLAGS specific to the host |
| 19 | # RPATH_ENVVAR environment variable used to find shared libraries |
| 20 | |
| 21 | HDEFINES= |
| 22 | host64=false |
| 23 | HOST_64BIT_TYPE= |
| 24 | |
| 25 | case "${host}" in |
| 26 | |
| 27 | alpha-*-*) host64=true; HOST_64BIT_TYPE=long ;; |
| 28 | |
| 29 | hppa*-*-hpux*) HDEFINES=-DHOST_HPPAHPUX ;; |
| 30 | hppa*-*-hiux*) HDEFINES=-DHOST_HPPAHPUX ;; |
| 31 | hppa*-*-bsd*) HDEFINES=-DHOST_HPPABSD ;; |
| 32 | hppa*-*-osf*) HDEFINES=-DHOST_HPPAOSF ;; |
| 33 | |
| 34 | i[345]86-sequent-bsd*) HDEFINES=-Dshared=genshared ;; |
| 35 | i[345]86-sequent-sysv4*) ;; |
| 36 | i[345]86-sequent-sysv*) HDEFINES=-Dshared=genshared ;; |
| 37 | |
| 38 | mips-dec-netbsd*) ;; |
| 39 | mips-dec-*) HDEFINES="-G 4" ;; |
| 40 | mips-sgi-irix3*) HDEFINES="-G 4" ;; |
| 41 | mips-sgi-irix4*) HDEFINES="-G 4" ;; |
| 42 | mips-*-sysv4*) ;; |
| 43 | mips-*-sysv*) HDEFINES="-G 4" ;; |
| 44 | mips-*-riscos*) HDEFINES="-G 4" ;; |
| 45 | |
| 46 | m68*-hp-hpux*) HDEFINES=-DHOST_HP300HPUX ;; |
| 47 | |
| 48 | esac |
| 49 | |
| 50 | # If we are configuring with --enable-shared, adjust the shared |
| 51 | # library support based on the host. This support must work for both |
| 52 | # the BFD and the opcodes libraries. |
| 53 | HLDFLAGS= |
| 54 | RPATH_ENVVAR=LD_LIBRARY_PATH |
| 55 | SHLIB_CC='$(CC)' |
| 56 | SHLIB_CFLAGS='-shared' |
| 57 | if [ "${shared}" = "true" ]; then |
| 58 | case "${host}" in |
| 59 | hppa*-*-*) picfrag=../config/mh-papic ;; |
| 60 | i[3456]86-*-*) picfrag=../config/mh-x86pic ;; |
| 61 | *-*-*) picfrag=../config/mh-${host_cpu}pic ;; |
| 62 | esac |
| 63 | if [ -f "${picfrag}" ]; then |
| 64 | pic=`sed -n -e 's/^PICFLAG[ ]*=[ ]*\(.*\)$/\1/p' ${picfrag}` |
| 65 | if [ -n "${pic}" ]; then |
| 66 | PICFLAG=${pic} |
| 67 | fi |
| 68 | fi |
| 69 | |
| 70 | case "${host}" in |
| 71 | *-dec-osf*) |
| 72 | # -fpic is not needed on the Alpha. |
| 73 | PICFLAG= |
| 74 | ;; |
| 75 | *-*-hpux*) |
| 76 | # HP/UX uses .sl for shared libraries. |
| 77 | SHLINK=`echo ${SHLINK} | sed -e 's/so$/sl/'` |
| 78 | SHLIB_CFLAGS='-shared $(PICFLAG)' |
| 79 | HLDFLAGS='-Wl,+s,+b,$(libdir)' |
| 80 | RPATH_ENVVAR=SHLIB_PATH |
| 81 | ;; |
| 82 | *-*-irix5*) |
| 83 | # -fpic is not needed on Irix 5. |
| 84 | PICFLAG= |
| 85 | SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)' |
| 86 | HLDFLAGS='-Wl,-rpath,$(libdir)' |
| 87 | ;; |
| 88 | *-*-linux*aout*) |
| 89 | ;; |
| 90 | *-*-linux*) |
| 91 | SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)' |
| 92 | HLDFLAGS='-Wl,-rpath,$(libdir)' |
| 93 | ;; |
| 94 | *-*-sysv4* | *-*-solaris*) |
| 95 | SHLIB_CFLAGS='-shared -h $(SONAME)' |
| 96 | HLDFLAGS='-R $(libdir)' |
| 97 | ;; |
| 98 | *-*-sunos*) |
| 99 | # Build a libTARGET-bfd.so.VERSION symlink in the object directory. |
| 100 | ALLLIBS=`echo ${ALLLIBS} | sed -e 's/\$(SHLINK)/stamp-tshlink/'` |
| 101 | ;; |
| 102 | esac |
| 103 | fi |
| 104 | |
| 105 | # On SunOS, if the linker supports the -rpath option, use it to |
| 106 | # prevent ../bfd and ../opcodes from being included in the run time |
| 107 | # search path. |
| 108 | case "${host}" in |
| 109 | *-*-sunos*) |
| 110 | echo 'main () { }' > conftest.c |
| 111 | ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t |
| 112 | if grep 'unrecognized' conftest.t >/dev/null 2>&1; then |
| 113 | : |
| 114 | elif grep 'No such file' conftest.t >/dev/null 2>&1; then |
| 115 | : |
| 116 | elif [ "${shared}" = "true" ]; then |
| 117 | HLDFLAGS='-Wl,-rpath=$(libdir)' |
| 118 | else |
| 119 | HLDFLAGS='-Wl,-rpath=' |
| 120 | fi |
| 121 | rm -f conftest.t conftest.c conftest |
| 122 | ;; |
| 123 | esac |