Wed Jun 25 12:48:41 1997 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
[platform/upstream/binutils.git] / ld / configure.host
1 # This is the linker host specific file.  This is invoked by the
2 # autoconf generated configure script.  Putting it in a separate shell
3 # file lets us skip running autoconf when modifying host specific
4 # information.
5
6 # This file sets the following shell variables:
7 #  HDEFINES             host specific compiler flags
8 #  HOSTING_CRT0         crt0.o file used for bootstrapping
9 #  HOSTING_LIBS         libraries used for bootstrapping
10 #  NATIVE_LIB_DIRS      library directories to search on this host
11 #  HLDFLAGS             link flags to use on this host
12 #  HLDENV               environment variable to set when linking for the host
13 #  RPATH_ENVVAR         environment variable used to find shared libraries
14
15 HDEFINES=
16 HOSTING_CRT0=/lib/crt0.o
17 HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc'
18 NATIVE_LIB_DIRS=
19
20 case "${host}" in
21
22 alpha-*-linux*)
23   HOSTING_CRT0=/usr/lib/crt0.o
24   ;;
25
26 alpha-*-*)
27   HOSTING_CRT0=/usr/ccs/lib/crt0.o
28   NATIVE_LIB_DIRS=/usr/ccs/lib
29   ;;
30
31 i[3456]86-*-bsd* | i[3456]86-*-freebsd* | i[3456]86-*-netbsd*)
32   # The new BSD `make' has a bug: it doesn't pass empty arguments in
33   # shell commands.  So we need to make this value non-empty in order
34   # for the genscripts.sh call to work.  There's nothing magic about
35   # the value `/lib'; it's just a dummy.
36   NATIVE_LIB_DIRS=/lib
37   HOSTING_CRT0=/usr/lib/crt0.o
38   ;;
39
40 i[3456]86-*-sysv4*)
41   HOSTING_CRT0='/usr/ccs/lib/crt1.o /usr/ccs/lib/crti.o /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`'
42   HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi` /usr/ccs/lib/crtn.o'
43   NATIVE_LIB_DIRS=/usr/ccs/lib
44   ;;
45
46 i[3456]86-sequent-ptx* | i[3456]86-sequent-sysv*)
47   HOSTING_CRT0='/lib/crt0.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`'
48   HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi`'
49   ;;
50
51 i[3456]86-*-sysv*)
52   HOSTING_CRT0='/lib/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; fi`'
53   HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; fi` /lib/crtn.o'
54   ;;
55
56 i[3456]86-*-solaris*)
57   HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else gcc -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else gcc -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`'
58   HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else gcc -print-file-name=crtn.o; fi`'
59   NATIVE_LIB_DIRS=/usr/ccs/lib
60   ;;
61
62 i[3456]86-*-sco* | i[3456]86-*-isc*)
63   # In some configurations gcc does not use crtbegin.o and crtend.o.
64   # In that case gcc -print-file-name=crtbegin.o will simply print
65   # crtbegin.o.  We create dummy crtbegin.o and crtend.o files to
66   # handle this.
67   echo "int dummy_crtbegin () { return 0; }" > crtbegin.c
68   ${CC} -c crtbegin.c -o crtbegin.o
69   rm -f crtbegin.c
70   echo "int dummy_crteng () { return 0; }" > crtend.c
71   ${CC} -c crtend.c -o crtend.o
72   rm -f crtend.c
73   HOSTING_CRT0='/lib/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`'
74   HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi` /lib/crtn.o'
75   ;;
76
77 i[3456]86-*-linux*aout* | i[3456]86-*-linuxoldld)
78   HOSTING_CRT0=/usr/lib/crt0.o
79   ;;
80
81 i[3456]86-*-linux*)
82   HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; elif [ -f /usr/lib/crtbegin.o ]; then echo /usr/lib/crtbegin.o; else gcc --print-file-name=crtbegin.o; fi`'
83   HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; elif [ -f /usr/lib/crtend.o ]; then echo /usr/lib/crtend.o; else gcc --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
84   ;;
85
86 i[3456]86-*-lynxos*)
87   HOSTING_CRT0=/lib/init1.o
88   HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc -lm /lib/initn.o'
89   ;;
90
91 mips*-dec-bsd*)
92   HOSTING_CRT0=/usr/lib/crt0.o
93   ;;
94
95 mips*-sgi-irix4*)
96   HOSTING_CRT0=/usr/lib/crt1.o
97   HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc /usr/lib/crtn.o'
98   ;;
99
100 mips*-sgi-irix[56]*)
101   HOSTING_CRT0=/usr/lib/crt1.o
102   HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc /usr/lib/crtn.o'
103   ;;
104
105 m68*-*-linux*aout*)
106   HOSTING_CRT0=/usr/lib/crt0.o
107   ;;
108
109 m68*-*-linux*libc1*)
110   HOSTING_CRT0='-dynamic-linker /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; elif [ -f /usr/lib/crtbegin.o ]; then echo /usr/lib/crtbegin.o; else gcc --print-file-name=crtbegin.o; fi`'
111   HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; elif [ -f /usr/lib/crtend.o ]; then echo /usr/lib/crtend.o; else gcc --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
112   ;;
113
114 m68*-*-linux*)
115   HOSTING_CRT0='-dynamic-linker /lib/ld.so.1 /usr/lib/crt1.o /usr/lib/crti.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc --print-file-name=crtbegin.o; fi`'
116   HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc --print-file-name=crtend.o; fi` /usr/lib/crtn.o'
117   ;;
118
119 m68*-*-lynxos*)
120   HOSTING_CRT0=/lib/init1.o
121   HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc -lm /lib/initn.o'
122   ;;
123
124 m68*-motorola-sysv)
125   HOSTING_CRT0='`if [ -f ../gcc/crt0.o ]; then echo ../gcc/crt0.o; elif [ -f \`gcc -print-file-name=\`crt0.o ]; then echo \`gcc -print-file-name=\`crt0.o; else echo /lib/crt0.o; fi`'
126   HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc881 `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi`'
127   ;;
128
129 m68*-sun-*)
130   HOSTING_CRT0='/usr/lib/crt0.o /usr/lib/Fcrt1.o -L/usr/lib/fsoft.o'
131   ;;
132
133 m88*-*-dgux*)
134   HDEFINES=-D__using_DGUX
135   HOSTING_CRT0='/lib/crt0.o -X'
136   HOSTING_LIBS=/usr/sde/m88kbcs/lib/libc.a
137   ;;
138
139 m88*-motorola-sysv3)
140   HOSTING_CRT0='/lib/crt0.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`'
141   HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi` `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi`'
142   ;;
143
144 romp-*-*)
145   HDEFINES=-DNO_VARARGS
146   ;;
147
148 sparc*-*-solaris2*)
149   HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else gcc -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else gcc -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else gcc -print-file-name=crtbegin.o; fi`'
150   HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else gcc -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else gcc -print-file-name=crtn.o; fi`'
151   NATIVE_LIB_DIRS=/usr/ccs/lib
152   ;;
153
154 esac
155
156 HLDFLAGS=
157 HLDENV=
158 RPATH_ENVVAR=LD_LIBRARY_PATH
159 # If we have shared libraries, try to set rpath reasonably.
160 if test "${shared}" = "true"; then
161   case "${host}" in
162   *-*-hpux*)
163     HLDFLAGS='-Wl,+s,+b,$(libdir)'
164     RPATH_ENVVAR=SHLIB_PATH
165     ;;
166   *-*-irix[56]*)
167     HLDFLAGS='-Wl,-rpath,$(libdir)'
168     ;;
169   *-*-linux*aout*)
170     ;;
171   *-*-linux*)
172     HLDFLAGS='-Wl,-rpath,$(libdir)'
173     ;;
174   *-*-solaris*)
175     HLDFLAGS='-R $(libdir)'
176     ;;
177   *-*-sysv4*)
178     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;'
179     ;;
180   esac
181 fi
182
183 # On SunOS, if the linker supports the -rpath option, use it to
184 # prevent ../bfd and ../opcodes from being included in the run time
185 # search path.
186 case "${host}" in
187   *-*-sunos*)
188     echo 'main () { }' > conftest.c
189     ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
190     if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
191       :
192     elif grep 'No such file' conftest.t >/dev/null 2>&1; then
193       :
194     elif grep 'do not mix' conftest.t >/dev/null 2>&1; then
195       :
196     elif test "${shared}" = "true"; then
197       HLDFLAGS='-Wl,-rpath=$(libdir)'
198     else
199       HLDFLAGS='-Wl,-rpath='
200     fi
201     rm -f conftest.t conftest.c conftest
202     ;;
203 esac