Commit | Line | Data |
---|---|---|
5bf135a7 NC |
1 | dnl |
2 | dnl Copyright 2012 Free Software Foundation | |
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 | ||
bf993e3c JB |
19 | sinclude([../config/zlib.m4]) |
20 | ||
252b5132 | 21 | dnl See whether we need to use fopen-bin.h rather than fopen-same.h. |
f8b73030 | 22 | AC_DEFUN([BFD_BINARY_FOPEN], |
5464f5a1 | 23 | [AC_REQUIRE([AC_CANONICAL_TARGET]) |
252b5132 RH |
24 | case "${host}" in |
25 | changequote(,)dnl | |
855b0be7 | 26 | *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*) |
252b5132 RH |
27 | changequote([,])dnl |
28 | AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;; | |
29 | esac])dnl | |
30 | ||
31 | dnl Get a default for CC_FOR_BUILD to put into Makefile. | |
f8b73030 | 32 | AC_DEFUN([BFD_CC_FOR_BUILD], |
252b5132 RH |
33 | [# Put a plausible default for CC_FOR_BUILD in Makefile. |
34 | if test -z "$CC_FOR_BUILD"; then | |
35 | if test "x$cross_compiling" = "xno"; then | |
36 | CC_FOR_BUILD='$(CC)' | |
37 | else | |
38 | CC_FOR_BUILD=gcc | |
39 | fi | |
40 | fi | |
41 | AC_SUBST(CC_FOR_BUILD) | |
42 | # Also set EXEEXT_FOR_BUILD. | |
43 | if test "x$cross_compiling" = "xno"; then | |
44 | EXEEXT_FOR_BUILD='$(EXEEXT)' | |
45 | else | |
46 | AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext, | |
aab08431 ILT |
47 | [rm -f conftest* |
48 | echo 'int main () { return 0; }' > conftest.c | |
49 | bfd_cv_build_exeext= | |
50 | ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 | |
51 | for file in conftest.*; do | |
52 | case $file in | |
53 | *.c | *.o | *.obj | *.ilk | *.pdb) ;; | |
54 | *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; | |
55 | esac | |
56 | done | |
57 | rm -f conftest* | |
58 | test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no]) | |
252b5132 RH |
59 | EXEEXT_FOR_BUILD="" |
60 | test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} | |
61 | fi | |
62 | AC_SUBST(EXEEXT_FOR_BUILD)])dnl | |
63 | ||
a703a6ea AM |
64 | AC_DEFUN([AM_INSTALL_LIBBFD], |
65 | [AC_MSG_CHECKING([whether to install libbfd]) | |
66 | AC_ARG_ENABLE(install-libbfd, | |
c5d1701e | 67 | [ --enable-install-libbfd controls installation of libbfd and related headers], |
a703a6ea | 68 | install_libbfd_p=$enableval, |
66e25bab | 69 | if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then |
a703a6ea AM |
70 | install_libbfd_p=yes |
71 | else | |
72 | install_libbfd_p=no | |
73 | fi) | |
74 | AC_MSG_RESULT($install_libbfd_p) | |
75 | AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes) | |
5464f5a1 | 76 | # Need _noncanonical variables for this. |
24443139 AS |
77 | ACX_NONCANONICAL_HOST |
78 | ACX_NONCANONICAL_TARGET | |
a703a6ea AM |
79 | # libbfd.a is a host library containing target dependent code |
80 | bfdlibdir='$(libdir)' | |
81 | bfdincludedir='$(includedir)' | |
82 | if test "${host}" != "${target}"; then | |
5464f5a1 NN |
83 | bfdlibdir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/lib' |
84 | bfdincludedir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/include' | |
a703a6ea AM |
85 | fi |
86 | AC_SUBST(bfdlibdir) | |
573e8a1c | 87 | AM_SUBST_NOTMAKE(bfdlibdir) |
a703a6ea | 88 | AC_SUBST(bfdincludedir) |
573e8a1c | 89 | AM_SUBST_NOTMAKE(bfdincludedir) |
a703a6ea AM |
90 | ] |
91 | ) |