configure.host revision 33965
14Srgrimes# This file is a shell script that overrides some of the tools and
2122296Speter# flags used on a host specific basis.
34Srgrimes
44Srgrimes# Since the "bfd/hosts" directory is shared by the bfd, opcodes, and
54Srgrimes# binutils directories (at least), the index to it is also shared.
64Srgrimes# This is that index.  Each configure.in file should source this file
74Srgrimes# in its per-host part.
84Srgrimes
94Srgrimes# This sets the following shell variables:
104Srgrimes#  HDEFINES		host specific compiler options
114Srgrimes#  host64		set to true if 64 bit types are as fast as 32 bit
124Srgrimes#  HOST_64BIT_TYPE	host 64 bit type
134Srgrimes#  HOST_U_64BIT_TYPE	unsigned 64 bit type (not needed if 64BIT_TYPE is long)
144Srgrimes#  SHLIB_CC		compiler to use when building shared library
154Srgrimes#  SHLIB_CFLAGS		flags to use when building shared library
164Srgrimes#  SHLIB_LIBS		libraries to use when building shared library
174Srgrimes#  PICFLAG		may be set to flag to use to compile PIC
184Srgrimes#  SHLINK		may be set to the name to link the shared library to
194Srgrimes#  ALLLIBS		may be set to libraries to build
204Srgrimes#  HLDFLAGS		LDFLAGS specific to the host
214Srgrimes#  HLDENV		environment variable to set when linking for the host
224Srgrimes#  RPATH_ENVVAR		environment variable used to find shared libraries
234Srgrimes#  INSTALL_SHLIB	install a shared library
244Srgrimes
254SrgrimesHDEFINES=
264Srgrimeshost64=false
274SrgrimesHOST_64BIT_TYPE=
284Srgrimes
294Srgrimescase "${host}" in
30122940Speter
314Srgrimesalpha-*-*)		host64=true; HOST_64BIT_TYPE=long ;;
324Srgrimes
33118031Sobrienhppa*-*-hpux*)		HDEFINES=-DHOST_HPPAHPUX ;;
34118031Sobrienhppa*-*-hiux*)		HDEFINES=-DHOST_HPPAHPUX ;;
35118031Sobrienhppa*-*-bsd*)		HDEFINES=-DHOST_HPPABSD ;;
36223668Sjonathanhppa*-*-osf*)		HDEFINES=-DHOST_HPPAOSF ;;
37219134Srwatson
382056Swollmani[3456]86-sequent-bsd*)	HDEFINES=-Dshared=genshared ;;
392056Swollmani[3456]86-sequent-sysv4*) ;;
40219134Srwatsoni[3456]86-sequent-sysv*)	HDEFINES=-Dshared=genshared ;;
41217564Skib
4276166Smarkmmips*-dec-netbsd*)	;;
43190620Skibmips*-*-openbsd*)	;;
44190620Skibmips*-dec-*)		HDEFINES="-G 4"	;;
45190620Skibmips*-sgi-irix3*)	HDEFINES="-G 4" ;;
462056Swollmanmips*-sgi-irix4*)	HDEFINES="-G 4" ;;
4776166Smarkmmips*-sgi-irix6*)	host64=true
48190620Skib			HOST_64BIT_TYPE="long long";
4912662Sdg			HOST_U_64BIT_TYPE="unsigned long long";
50147889Sdavidxu			;;
51147889Sdavidxumips*-*-sysv4*)		;;
52190620Skibmips*-*-sysv*)		HDEFINES="-G 4" ;;
53190620Skibmips*-*-riscos*)	HDEFINES="-G 4" ;;
54190620Skib
55190620Skibm68*-hp-hpux*)		HDEFINES=-DHOST_HP300HPUX ;;
56190620Skib
57190620Skib*-*-solaris*)		HOST_64BIT_TYPE="long long"
58190620Skib			HOST_U_64BIT_TYPE="unsigned long long"
59190620Skib			;;
60190620Skib
61147889Sdavidxu*-*-windows*)
62147889Sdavidxu			HOST_64BIT_TYPE=__int64
63190620Skib			HOST_U_64BIT_TYPE="unsigned __int64"
64190620Skib# The following krock is necessary because we can't run the build compiler
65217564Skib# (MSVC) on the configure host, so we have to explicitly set the values here.
66217564Skib# Note that this file is never run through autoconf, so we can't use any
67190620Skib# autoconf macros here.  Because of this, we have to muck with autoconf
68217604Skib# variables explicitly.
69217604Skib			ac_cv_func_mmap_fixed_mapped=no
70217564Skib			ac_cv_header_time=no
71190620Skib			ac_cv_func_getpagesize=no
72217564Skib			ac_cv_func_madvise=no
73217564Skib			ac_cv_func_mprotect=no
74217564Skib			ac_cv_header_sys_file_h=no
75217564Skib			ac_cv_header_sys_time_h=no
76217564Skib			ac_cv_header_unistd_h=no
77217564Skib			;;
78217564Skibesac
79217564Skib
80217564Skib# If we are configuring with --enable-shared, adjust the shared
81217564Skib# library support based on the host.  This support must work for both
82217564Skib# the BFD and the opcodes libraries.
83217564SkibHLDFLAGS=
84190620SkibHLDENV=
85190620SkibRPATH_ENVVAR=LD_LIBRARY_PATH
86190620SkibSHLIB_CC='$(CC)'
87190620SkibSHLIB_CFLAGS='-shared'
88190620SkibSHLIB_LIBS=
89190620SkibINSTALL_SHLIB='$(INSTALL_PROGRAM) $$f $(libdir)/$$tf;'
90190620Skibif [ "${shared}" = "true" ]; then
9112220Sbde  case "${host}" in
926874Sdg  hppa*-*-*)		picfrag=${srcdir}/../config/mh-papic ;;
936874Sdg  i[34566]86-*-*)	picfrag=${srcdir}/../config/mh-x86pic ;;
946874Sdg  *-*-*)		picfrag=${srcdir}/../config/mh-${host_cpu}pic ;;
95132Sdg  esac
9612220Sbde  if [ -f "${picfrag}" ]; then
97132Sdg    pic=`sed -n -e 's/^PICFLAG[ 	]*=[ 	]*\(.*\)$/\1/p' ${picfrag}`
986874Sdg    if [ -n "${pic}" ]; then
99190620Skib      PICFLAG=${pic}
100190620Skib    fi
101190620Skib  fi
102190620Skib
103190620Skib  case "${host}" in
104190620Skib  *-dec-osf*)
105190620Skib    # -fpic is not needed on the Alpha.
106190620Skib    PICFLAG=
107190620Skib    HLDFLAGS='-rpath $(libdir)'
108190620Skib    SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)'
109195104Srwatson    ;;
110190620Skib  *-*-hpux*)
111190620Skib    # HP/UX uses .sl for shared libraries.
112190620Skib    SHLINK=`echo ${SHLINK} | sed -e 's/so$/sl/'`
113190620Skib    SHLIB_CFLAGS='-shared $(PICFLAG)'
114190620Skib    HLDFLAGS='-Wl,+s,+b,$(libdir)'
115190620Skib    RPATH_ENVVAR=SHLIB_PATH
116190620Skib    INSTALL_SHLIB='$(INSTALL_PROGRAM) $$f $(libdir)/$$tf; chmod -w $(libdir)/$$tf;'
117190620Skib    ;;
118190620Skib  *-*-irix[56]*)
119190620Skib    # -fpic is not needed on Irix 5 or 6.
120190620Skib    PICFLAG=
121190620Skib    SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)'
122190620Skib    HLDFLAGS='-Wl,-rpath,$(libdir)'
123217543Sjhb    ;;
124217543Sjhb  *-*-linux*aout*)
125216634Sjkim    ;;
126190620Skib  *-*-linux*)
127217563Skib    SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)'
128217563Skib    case "${libdir}" in
129190620Skib      /lib | /usr/lib) ;;
130190620Skib      *) HLDFLAGS='-Wl,-rpath,$(libdir)' ;;
131190620Skib    esac
132190620Skib    # On Linux, apparently, linking against -lc lets ldconfig figure
133217563Skib    # out which version of libc should be used.
134190620Skib    SHLIB_LIBS=-lc
135190620Skib    ;;
136190620Skib  *-*-solaris*)
137190620Skib    SHLIB_CFLAGS='-shared -h $(SONAME)'
138190620Skib    HLDFLAGS='-R $(libdir)'
139190620Skib    ;;
140190620Skib  *-*-sysv4*)
141190620Skib    SHLIB_CFLAGS='-shared -h $(SONAME)'
142190620Skib    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;'
143190620Skib    ;;
144190620Skib  *-*-sunos*)
145190620Skib    # Build a libTARGET-bfd.so.VERSION symlink in the object directory.
146190620Skib    ALLLIBS=`echo ${ALLLIBS} | sed -e 's/\$(SHLINK)/stamp-tshlink/'`
147190620Skib    ;;
148190620Skib  esac
149216634Sjkimfi
150190620Skib
151190620Skib# On SunOS, if the linker supports the -rpath option, use it to
152190620Skib# prevent ../bfd and ../opcodes from being included in the run time
153190620Skib# search path.
154190620Skibcase "${host}" in
155190620Skib  *-*-sunos*)
156190620Skib    echo 'main () { }' > conftest.c
157190620Skib    ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
158190620Skib    if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
159190620Skib      :
160190620Skib    elif grep 'No such file' conftest.t >/dev/null 2>&1; then
161190620Skib      :
162190620Skib    elif grep 'do not mix' conftest.t >/dev/null 2>&1; then
163190620Skib      :
164216634Sjkim    elif [ "${shared}" = "true" ]; then
165190620Skib      HLDFLAGS='-Wl,-rpath=$(libdir)'
166190620Skib    else
167190620Skib      HLDFLAGS='-Wl,-rpath='
168190620Skib    fi
169190620Skib    rm -f conftest.t conftest.c conftest
170190620Skib    ;;
171190620Skibesac
172190620Skib