acinclude.m4 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. dnl
  2. dnl Copyright (C) 2012-2022 Free Software Foundation, Inc.
  3. dnl
  4. dnl This file is free software; you can redistribute it and/or modify
  5. dnl it under the terms of the GNU General Public License as published by
  6. dnl the Free Software Foundation; either version 3 of the License, or
  7. dnl (at your option) any later version.
  8. dnl
  9. dnl This program is distributed in the hope that it will be useful,
  10. dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. dnl GNU General Public License for more details.
  13. dnl
  14. dnl You should have received a copy of the GNU General Public License
  15. dnl along with this program; see the file COPYING3. If not see
  16. dnl <http://www.gnu.org/licenses/>.
  17. dnl
  18. dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
  19. AC_DEFUN([BFD_BINARY_FOPEN],
  20. [AC_REQUIRE([AC_CANONICAL_TARGET])
  21. case "${host}" in
  22. changequote(,)dnl
  23. *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
  24. changequote([,])dnl
  25. AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
  26. esac])dnl
  27. dnl Get a default for CC_FOR_BUILD to put into Makefile.
  28. AC_DEFUN([BFD_CC_FOR_BUILD],
  29. [# Put a plausible default for CC_FOR_BUILD in Makefile.
  30. if test -z "$CC_FOR_BUILD"; then
  31. if test "x$cross_compiling" = "xno"; then
  32. CC_FOR_BUILD='$(CC)'
  33. else
  34. CC_FOR_BUILD=gcc
  35. fi
  36. fi
  37. AC_SUBST(CC_FOR_BUILD)
  38. # Also set EXEEXT_FOR_BUILD.
  39. if test "x$cross_compiling" = "xno"; then
  40. EXEEXT_FOR_BUILD='$(EXEEXT)'
  41. else
  42. AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
  43. [rm -f conftest*
  44. echo 'int main () { return 0; }' > conftest.c
  45. bfd_cv_build_exeext=
  46. ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
  47. for file in conftest.*; do
  48. case $file in
  49. *.c | *.o | *.obj | *.ilk | *.pdb) ;;
  50. *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
  51. esac
  52. done
  53. rm -f conftest*
  54. test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
  55. EXEEXT_FOR_BUILD=""
  56. test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
  57. fi
  58. AC_SUBST(EXEEXT_FOR_BUILD)])dnl
  59. AC_DEFUN([AM_INSTALL_LIBBFD],
  60. [AC_MSG_CHECKING([whether to install libbfd])
  61. AC_ARG_ENABLE(install-libbfd,
  62. [ --enable-install-libbfd controls installation of libbfd and related headers],
  63. install_libbfd_p=$enableval,
  64. if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then
  65. install_libbfd_p=yes
  66. else
  67. install_libbfd_p=no
  68. fi)
  69. AC_MSG_RESULT($install_libbfd_p)
  70. AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes)
  71. # Need _noncanonical variables for this.
  72. ACX_NONCANONICAL_HOST
  73. ACX_NONCANONICAL_TARGET
  74. # libbfd.a is a host library containing target dependent code
  75. bfdlibdir='$(libdir)'
  76. bfdincludedir='$(includedir)'
  77. if test "${host}" != "${target}"; then
  78. bfdlibdir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/lib'
  79. bfdincludedir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/include'
  80. fi
  81. AC_SUBST(bfdlibdir)
  82. AM_SUBST_NOTMAKE(bfdlibdir)
  83. AC_SUBST(bfdincludedir)
  84. AM_SUBST_NOTMAKE(bfdincludedir)
  85. ]
  86. )