configure.host revision 33965
133965Sjdp# This file is a shell script that overrides some of the tools and
233965Sjdp# flags used on a host specific basis.
333965Sjdp
433965Sjdp# Since the "bfd/hosts" directory is shared by the bfd, opcodes, and
533965Sjdp# binutils directories (at least), the index to it is also shared.
633965Sjdp# This is that index.  Each configure.in file should source this file
733965Sjdp# in its per-host part.
833965Sjdp
933965Sjdp# This sets the following shell variables:
1033965Sjdp#  HDEFINES		host specific compiler options
1133965Sjdp#  host64		set to true if 64 bit types are as fast as 32 bit
1233965Sjdp#  HOST_64BIT_TYPE	host 64 bit type
1333965Sjdp#  HOST_U_64BIT_TYPE	unsigned 64 bit type (not needed if 64BIT_TYPE is long)
1433965Sjdp#  SHLIB_CC		compiler to use when building shared library
1533965Sjdp#  SHLIB_CFLAGS		flags to use when building shared library
1633965Sjdp#  SHLIB_LIBS		libraries to use when building shared library
1733965Sjdp#  PICFLAG		may be set to flag to use to compile PIC
1833965Sjdp#  SHLINK		may be set to the name to link the shared library to
1933965Sjdp#  ALLLIBS		may be set to libraries to build
2033965Sjdp#  HLDFLAGS		LDFLAGS specific to the host
2133965Sjdp#  HLDENV		environment variable to set when linking for the host
2233965Sjdp#  RPATH_ENVVAR		environment variable used to find shared libraries
2333965Sjdp#  INSTALL_SHLIB	install a shared library
2433965Sjdp
2533965SjdpHDEFINES=
2633965Sjdphost64=false
2733965SjdpHOST_64BIT_TYPE=
2833965Sjdp
2933965Sjdpcase "${host}" in
3033965Sjdp
3133965Sjdpalpha-*-*)		host64=true; HOST_64BIT_TYPE=long ;;
3233965Sjdp
3333965Sjdphppa*-*-hpux*)		HDEFINES=-DHOST_HPPAHPUX ;;
3433965Sjdphppa*-*-hiux*)		HDEFINES=-DHOST_HPPAHPUX ;;
3533965Sjdphppa*-*-bsd*)		HDEFINES=-DHOST_HPPABSD ;;
3633965Sjdphppa*-*-osf*)		HDEFINES=-DHOST_HPPAOSF ;;
3733965Sjdp
3833965Sjdpi[3456]86-sequent-bsd*)	HDEFINES=-Dshared=genshared ;;
3933965Sjdpi[3456]86-sequent-sysv4*) ;;
4033965Sjdpi[3456]86-sequent-sysv*)	HDEFINES=-Dshared=genshared ;;
4133965Sjdp
4233965Sjdpmips*-dec-netbsd*)	;;
4333965Sjdpmips*-*-openbsd*)	;;
4433965Sjdpmips*-dec-*)		HDEFINES="-G 4"	;;
4533965Sjdpmips*-sgi-irix3*)	HDEFINES="-G 4" ;;
4633965Sjdpmips*-sgi-irix4*)	HDEFINES="-G 4" ;;
4733965Sjdpmips*-sgi-irix6*)	host64=true
4833965Sjdp			HOST_64BIT_TYPE="long long";
4933965Sjdp			HOST_U_64BIT_TYPE="unsigned long long";
5033965Sjdp			;;
5133965Sjdpmips*-*-sysv4*)		;;
5233965Sjdpmips*-*-sysv*)		HDEFINES="-G 4" ;;
5333965Sjdpmips*-*-riscos*)	HDEFINES="-G 4" ;;
5433965Sjdp
5533965Sjdpm68*-hp-hpux*)		HDEFINES=-DHOST_HP300HPUX ;;
5633965Sjdp
5733965Sjdp*-*-solaris*)		HOST_64BIT_TYPE="long long"
5833965Sjdp			HOST_U_64BIT_TYPE="unsigned long long"
5933965Sjdp			;;
6033965Sjdp
6133965Sjdp*-*-windows*)
6233965Sjdp			HOST_64BIT_TYPE=__int64
6333965Sjdp			HOST_U_64BIT_TYPE="unsigned __int64"
6433965Sjdp# The following krock is necessary because we can't run the build compiler
6533965Sjdp# (MSVC) on the configure host, so we have to explicitly set the values here.
6633965Sjdp# Note that this file is never run through autoconf, so we can't use any
6733965Sjdp# autoconf macros here.  Because of this, we have to muck with autoconf
6833965Sjdp# variables explicitly.
6933965Sjdp			ac_cv_func_mmap_fixed_mapped=no
7033965Sjdp			ac_cv_header_time=no
7133965Sjdp			ac_cv_func_getpagesize=no
7233965Sjdp			ac_cv_func_madvise=no
7333965Sjdp			ac_cv_func_mprotect=no
7433965Sjdp			ac_cv_header_sys_file_h=no
7533965Sjdp			ac_cv_header_sys_time_h=no
7633965Sjdp			ac_cv_header_unistd_h=no
7733965Sjdp			;;
7833965Sjdpesac
7933965Sjdp
8033965Sjdp# If we are configuring with --enable-shared, adjust the shared
8133965Sjdp# library support based on the host.  This support must work for both
8233965Sjdp# the BFD and the opcodes libraries.
8333965SjdpHLDFLAGS=
8433965SjdpHLDENV=
8533965SjdpRPATH_ENVVAR=LD_LIBRARY_PATH
8633965SjdpSHLIB_CC='$(CC)'
8733965SjdpSHLIB_CFLAGS='-shared'
8833965SjdpSHLIB_LIBS=
8933965SjdpINSTALL_SHLIB='$(INSTALL_PROGRAM) $$f $(libdir)/$$tf;'
9033965Sjdpif [ "${shared}" = "true" ]; then
9133965Sjdp  case "${host}" in
9233965Sjdp  hppa*-*-*)		picfrag=${srcdir}/../config/mh-papic ;;
9333965Sjdp  i[34566]86-*-*)	picfrag=${srcdir}/../config/mh-x86pic ;;
9433965Sjdp  *-*-*)		picfrag=${srcdir}/../config/mh-${host_cpu}pic ;;
9533965Sjdp  esac
9633965Sjdp  if [ -f "${picfrag}" ]; then
9733965Sjdp    pic=`sed -n -e 's/^PICFLAG[ 	]*=[ 	]*\(.*\)$/\1/p' ${picfrag}`
9833965Sjdp    if [ -n "${pic}" ]; then
9933965Sjdp      PICFLAG=${pic}
10033965Sjdp    fi
10133965Sjdp  fi
10233965Sjdp
10333965Sjdp  case "${host}" in
10433965Sjdp  *-dec-osf*)
10533965Sjdp    # -fpic is not needed on the Alpha.
10633965Sjdp    PICFLAG=
10733965Sjdp    HLDFLAGS='-rpath $(libdir)'
10833965Sjdp    SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)'
10933965Sjdp    ;;
11033965Sjdp  *-*-hpux*)
11133965Sjdp    # HP/UX uses .sl for shared libraries.
11233965Sjdp    SHLINK=`echo ${SHLINK} | sed -e 's/so$/sl/'`
11333965Sjdp    SHLIB_CFLAGS='-shared $(PICFLAG)'
11433965Sjdp    HLDFLAGS='-Wl,+s,+b,$(libdir)'
11533965Sjdp    RPATH_ENVVAR=SHLIB_PATH
11633965Sjdp    INSTALL_SHLIB='$(INSTALL_PROGRAM) $$f $(libdir)/$$tf; chmod -w $(libdir)/$$tf;'
11733965Sjdp    ;;
11833965Sjdp  *-*-irix[56]*)
11933965Sjdp    # -fpic is not needed on Irix 5 or 6.
12033965Sjdp    PICFLAG=
12133965Sjdp    SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)'
12233965Sjdp    HLDFLAGS='-Wl,-rpath,$(libdir)'
12333965Sjdp    ;;
12433965Sjdp  *-*-linux*aout*)
12533965Sjdp    ;;
12633965Sjdp  *-*-linux*)
12733965Sjdp    SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)'
12833965Sjdp    case "${libdir}" in
12933965Sjdp      /lib | /usr/lib) ;;
13033965Sjdp      *) HLDFLAGS='-Wl,-rpath,$(libdir)' ;;
13133965Sjdp    esac
13233965Sjdp    # On Linux, apparently, linking against -lc lets ldconfig figure
13333965Sjdp    # out which version of libc should be used.
13433965Sjdp    SHLIB_LIBS=-lc
13533965Sjdp    ;;
13633965Sjdp  *-*-solaris*)
13733965Sjdp    SHLIB_CFLAGS='-shared -h $(SONAME)'
13833965Sjdp    HLDFLAGS='-R $(libdir)'
13933965Sjdp    ;;
14033965Sjdp  *-*-sysv4*)
14133965Sjdp    SHLIB_CFLAGS='-shared -h $(SONAME)'
14233965Sjdp    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;'
14333965Sjdp    ;;
14433965Sjdp  *-*-sunos*)
14533965Sjdp    # Build a libTARGET-bfd.so.VERSION symlink in the object directory.
14633965Sjdp    ALLLIBS=`echo ${ALLLIBS} | sed -e 's/\$(SHLINK)/stamp-tshlink/'`
14733965Sjdp    ;;
14833965Sjdp  esac
14933965Sjdpfi
15033965Sjdp
15133965Sjdp# On SunOS, if the linker supports the -rpath option, use it to
15233965Sjdp# prevent ../bfd and ../opcodes from being included in the run time
15333965Sjdp# search path.
15433965Sjdpcase "${host}" in
15533965Sjdp  *-*-sunos*)
15633965Sjdp    echo 'main () { }' > conftest.c
15733965Sjdp    ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
15833965Sjdp    if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
15933965Sjdp      :
16033965Sjdp    elif grep 'No such file' conftest.t >/dev/null 2>&1; then
16133965Sjdp      :
16233965Sjdp    elif grep 'do not mix' conftest.t >/dev/null 2>&1; then
16333965Sjdp      :
16433965Sjdp    elif [ "${shared}" = "true" ]; then
16533965Sjdp      HLDFLAGS='-Wl,-rpath=$(libdir)'
16633965Sjdp    else
16733965Sjdp      HLDFLAGS='-Wl,-rpath='
16833965Sjdp    fi
16933965Sjdp    rm -f conftest.t conftest.c conftest
17033965Sjdp    ;;
17133965Sjdpesac
172