]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - bfd/configure.host
* configure.host: Add support for windows host (a build done
[thirdparty/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 # 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 # 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*) # We can use __int64_t here because bfd.h
46 # includes obstack.h which includes stddef.h.
47 host64=true
48 HOST_64BIT_TYPE=__int64_t
49 HOST_U_64BIT_TYPE=__uint64_t
50 ;;
51 mips-*-sysv4*) ;;
52 mips-*-sysv*) HDEFINES="-G 4" ;;
53 mips-*-riscos*) HDEFINES="-G 4" ;;
54
55 m68*-hp-hpux*) HDEFINES=-DHOST_HP300HPUX ;;
56 *-*-windows*)
57 host64=true
58 HOST_64BIT_TYPE=__int64
59 HOST_U_64BIT_TYPE="unsigned __int64"
60 # The following krock is necessary because we can't run the build compiler
61 # (MSVC) on the configure host, so we have to explicitly set the values here.
62 # Note that this file is never run through autoconf, so we can't use any
63 # autoconf macros here. Because of this, we have to muck with autoconf
64 # variables explicitly.
65 ac_cv_func_mmap=no
66 ac_cv_header_time=no
67 ac_cv_func_getpagesize=no
68 ac_cv_func_madvise=no
69 ac_cv_func_mprotect=no
70 ac_cv_header_sys_file_h=no
71 ac_cv_header_sys_time_h=no
72 ac_cv_header_unistd_h=no
73 ;;
74 esac
75
76 # If we are configuring with --enable-shared, adjust the shared
77 # library support based on the host. This support must work for both
78 # the BFD and the opcodes libraries.
79 HLDFLAGS=
80 HLDENV=
81 RPATH_ENVVAR=LD_LIBRARY_PATH
82 SHLIB_CC='$(CC)'
83 SHLIB_CFLAGS='-shared'
84 INSTALL_SHLIB='$(INSTALL_PROGRAM) $$f $(libdir)/$$tf;'
85 if [ "${shared}" = "true" ]; then
86 case "${host}" in
87 hppa*-*-*) picfrag=${srcdir}/../config/mh-papic ;;
88 i[34566]86-*-*) picfrag=${srcdir}/../config/mh-x86pic ;;
89 *-*-*) picfrag=${srcdir}/../config/mh-${host_cpu}pic ;;
90 esac
91 if [ -f "${picfrag}" ]; then
92 pic=`sed -n -e 's/^PICFLAG[ ]*=[ ]*\(.*\)$/\1/p' ${picfrag}`
93 if [ -n "${pic}" ]; then
94 PICFLAG=${pic}
95 fi
96 fi
97
98 case "${host}" in
99 *-dec-osf*)
100 # -fpic is not needed on the Alpha.
101 PICFLAG=
102 HLDFLAGS='-rpath $(libdir)'
103 SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)'
104 ;;
105 *-*-hpux*)
106 # HP/UX uses .sl for shared libraries.
107 SHLINK=`echo ${SHLINK} | sed -e 's/so$/sl/'`
108 SHLIB_CFLAGS='-shared $(PICFLAG)'
109 HLDFLAGS='-Wl,+s,+b,$(libdir)'
110 RPATH_ENVVAR=SHLIB_PATH
111 INSTALL_SHLIB='$(INSTALL_PROGRAM) $$f $(libdir)/$$tf; chmod -w $(libdir)/$$tf;'
112 ;;
113 *-*-irix[56]*)
114 # -fpic is not needed on Irix 5 or 6.
115 PICFLAG=
116 SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)'
117 HLDFLAGS='-Wl,-rpath,$(libdir)'
118 ;;
119 *-*-linux*aout*)
120 ;;
121 *-*-linux*)
122 SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)'
123 case "${libdir}" in
124 /lib | /usr/lib) ;;
125 *) HLDFLAGS='-Wl,-rpath,$(libdir)' ;;
126 esac
127 ;;
128 *-*-solaris*)
129 SHLIB_CFLAGS='-shared -h $(SONAME)'
130 HLDFLAGS='-R $(libdir)'
131 ;;
132 *-*-sysv4*)
133 SHLIB_CFLAGS='-shared -h $(SONAME)'
134 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;'
135 ;;
136 *-*-sunos*)
137 # Build a libTARGET-bfd.so.VERSION symlink in the object directory.
138 ALLLIBS=`echo ${ALLLIBS} | sed -e 's/\$(SHLINK)/stamp-tshlink/'`
139 ;;
140 esac
141 fi
142
143 # On SunOS, if the linker supports the -rpath option, use it to
144 # prevent ../bfd and ../opcodes from being included in the run time
145 # search path.
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 elif grep 'do not mix' conftest.t >/dev/null 2>&1; then
155 :
156 elif [ "${shared}" = "true" ]; then
157 HLDFLAGS='-Wl,-rpath=$(libdir)'
158 else
159 HLDFLAGS='-Wl,-rpath='
160 fi
161 rm -f conftest.t conftest.c conftest
162 ;;
163 esac