Commit | Line | Data |
---|---|---|
b7577823 ILT |
1 | # This file is a shell script that overrides some of the tools and |
2 | # flags used on a host specific basis. | |
60ac749c ILT |
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 | ||
b7577823 | 9 | # This sets the following shell variables: |
b7577823 ILT |
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 | |
44f795f7 ILT |
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 | |
b5e4f369 | 19 | # RPATH_ENVVAR environment variable used to find shared libraries |
ab659fd6 | 20 | # INSTALL_SHLIB install a shared library |
b7577823 ILT |
21 | |
22 | HDEFINES= | |
23 | host64=false | |
24 | HOST_64BIT_TYPE= | |
25 | ||
60ac749c | 26 | case "${host}" in |
60ac749c | 27 | |
b7577823 ILT |
28 | alpha-*-*) host64=true; HOST_64BIT_TYPE=long ;; |
29 | ||
b7577823 ILT |
30 | hppa*-*-hpux*) HDEFINES=-DHOST_HPPAHPUX ;; |
31 | hppa*-*-hiux*) HDEFINES=-DHOST_HPPAHPUX ;; | |
32 | hppa*-*-bsd*) HDEFINES=-DHOST_HPPABSD ;; | |
33 | hppa*-*-osf*) HDEFINES=-DHOST_HPPAOSF ;; | |
34 | ||
35 | i[345]86-sequent-bsd*) HDEFINES=-Dshared=genshared ;; | |
36 | i[345]86-sequent-sysv4*) ;; | |
37 | i[345]86-sequent-sysv*) HDEFINES=-Dshared=genshared ;; | |
b7577823 | 38 | |
44f795f7 | 39 | mips-dec-netbsd*) ;; |
b7577823 | 40 | mips-dec-*) HDEFINES="-G 4" ;; |
65eed095 ILT |
41 | mips-sgi-irix3*) HDEFINES="-G 4" ;; |
42 | mips-sgi-irix4*) HDEFINES="-G 4" ;; | |
b7577823 ILT |
43 | mips-*-sysv4*) ;; |
44 | mips-*-sysv*) HDEFINES="-G 4" ;; | |
45 | mips-*-riscos*) HDEFINES="-G 4" ;; | |
46 | ||
b7577823 ILT |
47 | m68*-hp-hpux*) HDEFINES=-DHOST_HP300HPUX ;; |
48 | ||
60ac749c | 49 | esac |
44f795f7 ILT |
50 | |
51 | # If we are configuring with --enable-shared, adjust the shared | |
52 | # library support based on the host. This support must work for both | |
53 | # the BFD and the opcodes libraries. | |
b5e4f369 ILT |
54 | HLDFLAGS= |
55 | RPATH_ENVVAR=LD_LIBRARY_PATH | |
44f795f7 ILT |
56 | SHLIB_CC='$(CC)' |
57 | SHLIB_CFLAGS='-shared' | |
ab659fd6 | 58 | INSTALL_SHLIB='$(INSTALL_PROGRAM) $$f $(libdir)/$$tf;' |
44f795f7 ILT |
59 | if [ "${shared}" = "true" ]; then |
60 | case "${host}" in | |
e8c249cb ILT |
61 | hppa*-*-*) picfrag=${srcdir}/../config/mh-papic ;; |
62 | i[3456]86-*-*) picfrag=${srcdir}/../config/mh-x86pic ;; | |
63 | *-*-*) picfrag=${srcdir}/../config/mh-${host_cpu}pic ;; | |
44f795f7 ILT |
64 | esac |
65 | if [ -f "${picfrag}" ]; then | |
66 | pic=`sed -n -e 's/^PICFLAG[ ]*=[ ]*\(.*\)$/\1/p' ${picfrag}` | |
67 | if [ -n "${pic}" ]; then | |
68 | PICFLAG=${pic} | |
69 | fi | |
70 | fi | |
71 | ||
44f795f7 ILT |
72 | case "${host}" in |
73 | *-dec-osf*) | |
74 | # -fpic is not needed on the Alpha. | |
75 | PICFLAG= | |
6f21f2e3 ILT |
76 | HLDFLAGS='-rpath $(libdir)' |
77 | SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)' | |
44f795f7 ILT |
78 | ;; |
79 | *-*-hpux*) | |
80 | # HP/UX uses .sl for shared libraries. | |
81 | SHLINK=`echo ${SHLINK} | sed -e 's/so$/sl/'` | |
2300e217 | 82 | SHLIB_CFLAGS='-shared $(PICFLAG)' |
b5e4f369 ILT |
83 | HLDFLAGS='-Wl,+s,+b,$(libdir)' |
84 | RPATH_ENVVAR=SHLIB_PATH | |
ab659fd6 | 85 | INSTALL_SHLIB='$(INSTALL_PROGRAM) $$f $(libdir)/$$tf; chmod -w $(libdir)/$$tf;' |
44f795f7 | 86 | ;; |
e8c249cb ILT |
87 | *-*-irix[56]*) |
88 | # -fpic is not needed on Irix 5 or 6. | |
44f795f7 | 89 | PICFLAG= |
b5e4f369 ILT |
90 | SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)' |
91 | HLDFLAGS='-Wl,-rpath,$(libdir)' | |
44f795f7 ILT |
92 | ;; |
93 | *-*-linux*aout*) | |
94 | ;; | |
95 | *-*-linux*) | |
b5e4f369 | 96 | SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)' |
3d9a5986 | 97 | case "${libdir}" in |
6f21f2e3 ILT |
98 | /lib | /usr/lib) ;; |
99 | *) HLDFLAGS='-Wl,-rpath,$(libdir)' ;; | |
100 | esac | |
44f795f7 ILT |
101 | ;; |
102 | *-*-sysv4* | *-*-solaris*) | |
b5e4f369 ILT |
103 | SHLIB_CFLAGS='-shared -h $(SONAME)' |
104 | HLDFLAGS='-R $(libdir)' | |
44f795f7 ILT |
105 | ;; |
106 | *-*-sunos*) | |
b5e4f369 ILT |
107 | # Build a libTARGET-bfd.so.VERSION symlink in the object directory. |
108 | ALLLIBS=`echo ${ALLLIBS} | sed -e 's/\$(SHLINK)/stamp-tshlink/'` | |
44f795f7 ILT |
109 | ;; |
110 | esac | |
111 | fi | |
112 | ||
113 | # On SunOS, if the linker supports the -rpath option, use it to | |
114 | # prevent ../bfd and ../opcodes from being included in the run time | |
115 | # search path. | |
44f795f7 ILT |
116 | case "${host}" in |
117 | *-*-sunos*) | |
118 | echo 'main () { }' > conftest.c | |
65eed095 | 119 | ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t |
44f795f7 ILT |
120 | if grep 'unrecognized' conftest.t >/dev/null 2>&1; then |
121 | : | |
122 | elif grep 'No such file' conftest.t >/dev/null 2>&1; then | |
123 | : | |
9e2ef098 ILT |
124 | elif grep 'do not mix' conftest.t >/dev/null 2>&1; then |
125 | : | |
b5e4f369 ILT |
126 | elif [ "${shared}" = "true" ]; then |
127 | HLDFLAGS='-Wl,-rpath=$(libdir)' | |
44f795f7 ILT |
128 | else |
129 | HLDFLAGS='-Wl,-rpath=' | |
130 | fi | |
131 | rm -f conftest.t conftest.c conftest | |
132 | ;; | |
133 | esac |