Support for building as a shared library, based on patches from
[deliverable/binutils-gdb.git] / bfd / configure.host
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 # CC compiler to use (only if needed and not already set)
11 # CFLAGS override CFLAGS (only if needed and not already set)
12 # LDFLAGS override LDFLAGS (only if needed and not already set)
13 # AR archiver to use (only if needed and not already set)
14 # RANLIB ranlib to use (only if needed and not already set)
15 # HDEFINES host specific compiler options
16 # host64 set to true if this is a 64 bit host
17 # HOST_64BIT_TYPE host 64 bit type
18 # SHLIB_CC compiler to use when building shared library
19 # SHLIB_CFLAGS flags to use when building shared library
20 # PICFLAG may be set to flag to use to compile PIC
21 # SHLINK may be set to the name to link the shared library to
22 # ALLLIBS may be set to libraries to build
23 # HLDFLAGS LDFLAGS specific to the host
24
25 HDEFINES=
26 host64=false
27 HOST_64BIT_TYPE=
28
29 case "${host}" in
30 # WHEN ADDING ENTRIES TO THIS MATRIX:
31 # Make sure that the left side always has two dashes. Otherwise you
32 # can get spurious matches. Even for unambiguous cases, do this as a
33 # convention, else the table becomes a real mess to understand and maintain.
34 #
35 # Note that these entries cannot be fully alphabetical. Don't try.
36 # The order of matching is critical when multiple lines could match.
37
38 alpha-*-*) host64=true; HOST_64BIT_TYPE=long ;;
39
40 a29k-*-*) CC=${CC-u3cc}; AR=${AR-u3ar} ;;
41
42 hppa*-*-hpux*) HDEFINES=-DHOST_HPPAHPUX ;;
43 hppa*-*-hiux*) HDEFINES=-DHOST_HPPAHPUX ;;
44 hppa*-*-bsd*) HDEFINES=-DHOST_HPPABSD ;;
45 hppa*-*-osf*) HDEFINES=-DHOST_HPPAOSF ;;
46
47 i[345]86-sequent-bsd*) HDEFINES=-Dshared=genshared ;;
48 i[345]86-sequent-sysv4*) ;;
49 i[345]86-sequent-sysv*) HDEFINES=-Dshared=genshared ;;
50 i[345]86-ncr*-sysv4*) CC=${CC-/usr/ccs/ATT/cc}
51 test -z "$CFLAGS" && CFLAGS=" "
52 ;;
53 i[345]86-*-go32*) test -z "$CC" && CC="i386-go32-gcc -fno-omit-frame-pointer -O2 -Wl,-S"
54 AR=${AR-i386-go32-ar}
55 RANLIB=${RANLIB-i386-go32-ranlib}
56 ;;
57 i[345]86-*-win32) test -z "$CC" && CC="i386-win32-gcc -O2"
58 AR=${AR-i386-win32-ar}
59 RANLIB=${RANLIB-i386-win32-ranlib}
60 ;;
61
62 mips-dec-netbsd*) ;;
63 mips-dec-*) HDEFINES="-G 4" ;;
64 mips-sgi-irix3*) HDEFINES="-G 4"
65 test -z "$LDFLAGS" && LDFLAGS=-lmalloc
66 ;;
67 mips-sgi-irix4*) HDEFINES="-G 4"
68 test -z "$LDFLAGS" && LDFLAGS=-lmalloc
69 ;;
70 mips-*-sysv4*) ;;
71 mips-*-sysv*) HDEFINES="-G 4" ;;
72 mips-*-riscos*) HDEFINES="-G 4" ;;
73
74 m68*-apollo*-sysv*) # sef@cygnus.com says this is how to compile
75 # on an apollo in the SysV environment.
76 test -z "$CC" && CC="cc -A nansi -A cpu,3000 -A runtype,any -A systype,any -DSHORT_ENUM_BUG -DUSG -U__STDC__ -Dm68000=mc68000"
77 ;;
78 m68*-hp-hpux*) HDEFINES=-DHOST_HP300HPUX ;;
79
80 m88*-*-dgux*) test -z "$CC" && CC="gcc -Wall -ansi -D__using_DGUX"
81 ;;
82
83 romp-*-*) # hc/pcc just can't cut it
84 CC=${CC-gcc}
85 ;;
86
87 rs6000-*-aix4) HDEFINES=-DHOST_AIX ;;
88 rs6000-*-*) HDEFINES=-DHOST_AIX ;;
89 powerpc-*-aix4*) HDEFINES=-DHOST_AIX ;;
90 powerpc-*-aix*) HDEFINES=-DHOST_AIX ;;
91
92 esac
93
94 # If we are configuring with --enable-shared, adjust the shared
95 # library support based on the host. This support must work for both
96 # the BFD and the opcodes libraries.
97 SHLIB_CC='$(CC)'
98 SHLIB_CFLAGS='-shared'
99 if [ "${shared}" = "true" ]; then
100 case "${host}" in
101 hppa*-*-*) picfrag=../config/mh-papic ;;
102 i[3456]86-*-*) picfrag=../config/mh-x86pic ;;
103 *-*-*) picfrag=../config/mh-${host_cpu}pic ;;
104 esac
105 if [ -f "${picfrag}" ]; then
106 pic=`sed -n -e 's/^PICFLAG[ ]*=[ ]*\(.*\)$/\1/p' ${picfrag}`
107 if [ -n "${pic}" ]; then
108 PICFLAG=${pic}
109 fi
110 fi
111
112 base_shlib=`echo ${SHLIB} | sed -e 's,^.*/\([^/]*\)$,\1,'`
113
114 case "${host}" in
115 *-dec-osf*)
116 # -fpic is not needed on the Alpha.
117 PICFLAG=
118 ;;
119 *-*-hpux*)
120 # HP/UX uses .sl for shared libraries.
121 SHLINK=`echo ${SHLINK} | sed -e 's/so$/sl/'`
122 ;;
123 *-*-irix5*)
124 # -fpic is not needed on Irix 5.
125 PICFLAG=
126 SHLIB_CFLAGS="-shared -Wl,-soname,${base_shlib}"
127 ;;
128 *-*-linux*aout*)
129 ;;
130 *-*-linux*)
131 SHLIB_CFLAGS="-shared -Wl,-soname,${base_shlib}"
132 ;;
133 *-*-sysv4* | *-*-solaris*)
134 SHLIB_CFLAGS="-shared -h ${base_shlib}"
135 ;;
136 *-*-sunos*)
137 ALLLIBS=`echo ${ALLLIBS} | sed -e 's/\$(SHLINK)//'`
138 ;;
139 esac
140 fi
141
142 # On SunOS, if the linker supports the -rpath option, use it to
143 # prevent ../bfd and ../opcodes from being included in the run time
144 # search path.
145 HLDFLAGS=
146 case "${host}" in
147 *-*-sunos*)
148 echo 'main () { }' > conftest.c
149 ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
150 if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
151 :
152 elif grep 'No such file' conftest.t >/dev/null 2>&1; then
153 :
154 else
155 HLDFLAGS='-Wl,-rpath='
156 fi
157 rm -f conftest.t conftest.c conftest
158 ;;
159 esac
This page took 0.034788 seconds and 5 git commands to generate.