| 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 64 bit types are as fast as 32 bit |
| 12 | # HOST_64BIT_TYPE host 64 bit type |
| 13 | # HOST_U_64BIT_TYPE unsigned 64 bit type (not needed if 64BIT_TYPE is long) |
| 14 | # SHLIB_CC compiler to use when building shared library |
| 15 | # SHLIB_CFLAGS flags to use when building shared library |
| 16 | # PICFLAG may be set to flag to use to compile PIC |
| 17 | # SHLINK may be set to the name to link the shared library to |
| 18 | # ALLLIBS may be set to libraries to build |
| 19 | # HLDFLAGS LDFLAGS specific to the host |
| 20 | # HLDENV environment variable to set when linking for the host |
| 21 | # RPATH_ENVVAR environment variable used to find shared libraries |
| 22 | # INSTALL_SHLIB install a shared library |
| 23 | |
| 24 | HDEFINES= |
| 25 | host64=false |
| 26 | HOST_64BIT_TYPE= |
| 27 | |
| 28 | case "${host}" in |
| 29 | |
| 30 | alpha-*-*) host64=true; HOST_64BIT_TYPE=long ;; |
| 31 | |
| 32 | hppa*-*-hpux*) HDEFINES=-DHOST_HPPAHPUX ;; |
| 33 | hppa*-*-hiux*) HDEFINES=-DHOST_HPPAHPUX ;; |
| 34 | hppa*-*-bsd*) HDEFINES=-DHOST_HPPABSD ;; |
| 35 | hppa*-*-osf*) HDEFINES=-DHOST_HPPAOSF ;; |
| 36 | |
| 37 | i[3456]86-sequent-bsd*) HDEFINES=-Dshared=genshared ;; |
| 38 | i[3456]86-sequent-sysv4*) ;; |
| 39 | i[3456]86-sequent-sysv*) HDEFINES=-Dshared=genshared ;; |
| 40 | |
| 41 | mips-dec-netbsd*) ;; |
| 42 | mips-dec-*) HDEFINES="-G 4" ;; |
| 43 | mips-sgi-irix3*) HDEFINES="-G 4" ;; |
| 44 | mips-sgi-irix4*) HDEFINES="-G 4" ;; |
| 45 | mips-sgi-irix6*) host64=true |
| 46 | HOST_64BIT_TYPE="long long"; |
| 47 | HOST_U_64BIT_TYPE="unsigned long long"; |
| 48 | ;; |
| 49 | mips-*-sysv4*) ;; |
| 50 | mips-*-sysv*) HDEFINES="-G 4" ;; |
| 51 | mips-*-riscos*) HDEFINES="-G 4" ;; |
| 52 | |
| 53 | m68*-hp-hpux*) HDEFINES=-DHOST_HP300HPUX ;; |
| 54 | |
| 55 | *-*-solaris*) HOST_64BIT_TYPE="long long" |
| 56 | HOST_U_64BIT_TYPE="unsigned long long" |
| 57 | ;; |
| 58 | |
| 59 | *-*-windows*) |
| 60 | host64=true |
| 61 | HOST_64BIT_TYPE=__int64 |
| 62 | HOST_U_64BIT_TYPE="unsigned __int64" |
| 63 | # The following krock is necessary because we can't run the build compiler |
| 64 | # (MSVC) on the configure host, so we have to explicitly set the values here. |
| 65 | # Note that this file is never run through autoconf, so we can't use any |
| 66 | # autoconf macros here. Because of this, we have to muck with autoconf |
| 67 | # variables explicitly. |
| 68 | ac_cv_func_mmap_fixed_mapped=no |
| 69 | ac_cv_header_time=no |
| 70 | ac_cv_func_getpagesize=no |
| 71 | ac_cv_func_madvise=no |
| 72 | ac_cv_func_mprotect=no |
| 73 | ac_cv_header_sys_file_h=no |
| 74 | ac_cv_header_sys_time_h=no |
| 75 | ac_cv_header_unistd_h=no |
| 76 | ;; |
| 77 | esac |
| 78 | |
| 79 | # If we are configuring with --enable-shared, adjust the shared |
| 80 | # library support based on the host. This support must work for both |
| 81 | # the BFD and the opcodes libraries. |
| 82 | HLDFLAGS= |
| 83 | HLDENV= |
| 84 | RPATH_ENVVAR=LD_LIBRARY_PATH |
| 85 | SHLIB_CC='$(CC)' |
| 86 | SHLIB_CFLAGS='-shared' |
| 87 | INSTALL_SHLIB='$(INSTALL_PROGRAM) $$f $(libdir)/$$tf;' |
| 88 | if [ "${shared}" = "true" ]; then |
| 89 | case "${host}" in |
| 90 | hppa*-*-*) picfrag=${srcdir}/../config/mh-papic ;; |
| 91 | i[34566]86-*-*) picfrag=${srcdir}/../config/mh-x86pic ;; |
| 92 | *-*-*) picfrag=${srcdir}/../config/mh-${host_cpu}pic ;; |
| 93 | esac |
| 94 | if [ -f "${picfrag}" ]; then |
| 95 | pic=`sed -n -e 's/^PICFLAG[ ]*=[ ]*\(.*\)$/\1/p' ${picfrag}` |
| 96 | if [ -n "${pic}" ]; then |
| 97 | PICFLAG=${pic} |
| 98 | fi |
| 99 | fi |
| 100 | |
| 101 | case "${host}" in |
| 102 | *-dec-osf*) |
| 103 | # -fpic is not needed on the Alpha. |
| 104 | PICFLAG= |
| 105 | HLDFLAGS='-rpath $(libdir)' |
| 106 | SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)' |
| 107 | ;; |
| 108 | *-*-hpux*) |
| 109 | # HP/UX uses .sl for shared libraries. |
| 110 | SHLINK=`echo ${SHLINK} | sed -e 's/so$/sl/'` |
| 111 | SHLIB_CFLAGS='-shared $(PICFLAG)' |
| 112 | HLDFLAGS='-Wl,+s,+b,$(libdir)' |
| 113 | RPATH_ENVVAR=SHLIB_PATH |
| 114 | INSTALL_SHLIB='$(INSTALL_PROGRAM) $$f $(libdir)/$$tf; chmod -w $(libdir)/$$tf;' |
| 115 | ;; |
| 116 | *-*-irix[56]*) |
| 117 | # -fpic is not needed on Irix 5 or 6. |
| 118 | PICFLAG= |
| 119 | SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)' |
| 120 | HLDFLAGS='-Wl,-rpath,$(libdir)' |
| 121 | ;; |
| 122 | *-*-linux*aout*) |
| 123 | ;; |
| 124 | *-*-linux*) |
| 125 | SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)' |
| 126 | case "${libdir}" in |
| 127 | /lib | /usr/lib) ;; |
| 128 | *) HLDFLAGS='-Wl,-rpath,$(libdir)' ;; |
| 129 | esac |
| 130 | ;; |
| 131 | *-*-solaris*) |
| 132 | SHLIB_CFLAGS='-shared -h $(SONAME)' |
| 133 | HLDFLAGS='-R $(libdir)' |
| 134 | ;; |
| 135 | *-*-sysv4*) |
| 136 | SHLIB_CFLAGS='-shared -h $(SONAME)' |
| 137 | HLDENV='if test -z "$${LD_RUN_PATH}"; then LD_RUN_PATH=$(libdir); else LD_RUN_PATH=$${LD_RUN_PATH}:$(libdir); fi; export LD_RUN_PATH;' |
| 138 | ;; |
| 139 | *-*-sunos*) |
| 140 | # Build a libTARGET-bfd.so.VERSION symlink in the object directory. |
| 141 | ALLLIBS=`echo ${ALLLIBS} | sed -e 's/\$(SHLINK)/stamp-tshlink/'` |
| 142 | ;; |
| 143 | esac |
| 144 | fi |
| 145 | |
| 146 | # On SunOS, if the linker supports the -rpath option, use it to |
| 147 | # prevent ../bfd and ../opcodes from being included in the run time |
| 148 | # search path. |
| 149 | case "${host}" in |
| 150 | *-*-sunos*) |
| 151 | echo 'main () { }' > conftest.c |
| 152 | ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t |
| 153 | if grep 'unrecognized' conftest.t >/dev/null 2>&1; then |
| 154 | : |
| 155 | elif grep 'No such file' conftest.t >/dev/null 2>&1; then |
| 156 | : |
| 157 | elif grep 'do not mix' conftest.t >/dev/null 2>&1; then |
| 158 | : |
| 159 | elif [ "${shared}" = "true" ]; then |
| 160 | HLDFLAGS='-Wl,-rpath=$(libdir)' |
| 161 | else |
| 162 | HLDFLAGS='-Wl,-rpath=' |
| 163 | fi |
| 164 | rm -f conftest.t conftest.c conftest |
| 165 | ;; |
| 166 | esac |