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