138889Sjdpdnl See whether we need to use fopen-bin.h rather than fopen-same.h.
2130561SobrienAC_DEFUN([BFD_BINARY_FOPEN],
3218822Sdim[AC_REQUIRE([AC_CANONICAL_TARGET])
438889Sjdpcase "${host}" in
538889Sjdpchangequote(,)dnl
660484Sobrien*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
738889Sjdpchangequote([,])dnl
860484Sobrien  AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
938889Sjdpesac])dnl
1038889Sjdp
1138889Sjdpdnl Get a default for CC_FOR_BUILD to put into Makefile.
12130561SobrienAC_DEFUN([BFD_CC_FOR_BUILD],
1338889Sjdp[# Put a plausible default for CC_FOR_BUILD in Makefile.
1438889Sjdpif test -z "$CC_FOR_BUILD"; then
1538889Sjdp  if test "x$cross_compiling" = "xno"; then
1638889Sjdp    CC_FOR_BUILD='$(CC)'
1738889Sjdp  else
1838889Sjdp    CC_FOR_BUILD=gcc
1938889Sjdp  fi
2038889Sjdpfi
2138889SjdpAC_SUBST(CC_FOR_BUILD)
2238889Sjdp# Also set EXEEXT_FOR_BUILD.
2338889Sjdpif test "x$cross_compiling" = "xno"; then
2438889Sjdp  EXEEXT_FOR_BUILD='$(EXEEXT)'
2538889Sjdpelse
2638889Sjdp  AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
2760484Sobrien    [rm -f conftest*
2860484Sobrien     echo 'int main () { return 0; }' > conftest.c
2960484Sobrien     bfd_cv_build_exeext=
3060484Sobrien     ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
3160484Sobrien     for file in conftest.*; do
3260484Sobrien       case $file in
3360484Sobrien       *.c | *.o | *.obj | *.ilk | *.pdb) ;;
3460484Sobrien       *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
3560484Sobrien       esac
3660484Sobrien     done
3760484Sobrien     rm -f conftest*
3860484Sobrien     test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
3938889Sjdp  EXEEXT_FOR_BUILD=""
4038889Sjdp  test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
4138889Sjdpfi
4238889SjdpAC_SUBST(EXEEXT_FOR_BUILD)])dnl
4338889Sjdp
44104834SobrienAC_DEFUN([AM_INSTALL_LIBBFD],
45104834Sobrien[AC_MSG_CHECKING([whether to install libbfd])
46104834Sobrien  AC_ARG_ENABLE(install-libbfd,
47130561Sobrien[  --enable-install-libbfd controls installation of libbfd and related headers],
48104834Sobrien      install_libbfd_p=$enableval,
49130561Sobrien      if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then
50104834Sobrien        install_libbfd_p=yes
51104834Sobrien      else
52104834Sobrien        install_libbfd_p=no
53104834Sobrien      fi)
54104834Sobrien  AC_MSG_RESULT($install_libbfd_p)
55104834Sobrien  AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes)
56218822Sdim  # Need _noncanonical variables for this.
57218822Sdim  ACX_NONCANONICAL_HOST
58218822Sdim  ACX_NONCANONICAL_TARGET
59104834Sobrien  # libbfd.a is a host library containing target dependent code
60104834Sobrien  bfdlibdir='$(libdir)'
61104834Sobrien  bfdincludedir='$(includedir)'
62104834Sobrien  if test "${host}" != "${target}"; then
63218822Sdim    bfdlibdir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/lib'
64218822Sdim    bfdincludedir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/include'
65104834Sobrien  fi
66104834Sobrien  AC_SUBST(bfdlibdir)
67104834Sobrien  AC_SUBST(bfdincludedir)
68104834Sobrien]
69104834Sobrien)
70