Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | dnl See whether we need to use fopen-bin.h rather than fopen-same.h. |
2 | AC_DEFUN(BFD_BINARY_FOPEN, | |
3 | [AC_REQUIRE([AC_CANONICAL_SYSTEM]) | |
4 | case "${host}" in | |
5 | changequote(,)dnl | |
855b0be7 | 6 | *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*) |
252b5132 RH |
7 | changequote([,])dnl |
8 | AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;; | |
9 | esac])dnl | |
10 | ||
11 | dnl Get a default for CC_FOR_BUILD to put into Makefile. | |
12 | AC_DEFUN(BFD_CC_FOR_BUILD, | |
13 | [# Put a plausible default for CC_FOR_BUILD in Makefile. | |
14 | if test -z "$CC_FOR_BUILD"; then | |
15 | if test "x$cross_compiling" = "xno"; then | |
16 | CC_FOR_BUILD='$(CC)' | |
17 | else | |
18 | CC_FOR_BUILD=gcc | |
19 | fi | |
20 | fi | |
21 | AC_SUBST(CC_FOR_BUILD) | |
22 | # Also set EXEEXT_FOR_BUILD. | |
23 | if test "x$cross_compiling" = "xno"; then | |
24 | EXEEXT_FOR_BUILD='$(EXEEXT)' | |
25 | else | |
26 | AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext, | |
aab08431 ILT |
27 | [rm -f conftest* |
28 | echo 'int main () { return 0; }' > conftest.c | |
29 | bfd_cv_build_exeext= | |
30 | ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 | |
31 | for file in conftest.*; do | |
32 | case $file in | |
33 | *.c | *.o | *.obj | *.ilk | *.pdb) ;; | |
34 | *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; | |
35 | esac | |
36 | done | |
37 | rm -f conftest* | |
38 | test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no]) | |
252b5132 RH |
39 | EXEEXT_FOR_BUILD="" |
40 | test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} | |
41 | fi | |
42 | AC_SUBST(EXEEXT_FOR_BUILD)])dnl | |
43 | ||
44 | dnl See whether we need a declaration for a function. | |
45 | AC_DEFUN(BFD_NEED_DECLARATION, | |
46 | [AC_MSG_CHECKING([whether $1 must be declared]) | |
47 | AC_CACHE_VAL(bfd_cv_decl_needed_$1, | |
48 | [AC_TRY_COMPILE([ | |
49 | #include <stdio.h> | |
50 | #ifdef HAVE_STRING_H | |
51 | #include <string.h> | |
52 | #else | |
53 | #ifdef HAVE_STRINGS_H | |
54 | #include <strings.h> | |
55 | #endif | |
56 | #endif | |
57 | #ifdef HAVE_STDLIB_H | |
58 | #include <stdlib.h> | |
59 | #endif | |
60 | #ifdef HAVE_UNISTD_H | |
61 | #include <unistd.h> | |
62 | #endif], | |
63 | [char *(*pfn) = (char *(*)) $1], | |
64 | bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)]) | |
65 | AC_MSG_RESULT($bfd_cv_decl_needed_$1) | |
66 | if test $bfd_cv_decl_needed_$1 = yes; then | |
67 | AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1, | |
68 | [Define if $1 is not declared in system header files.]) | |
69 | fi | |
70 | ])dnl | |
71 | ||
72 | dnl Check for existence of a type $1 in sys/procfs.h | |
73 | ||
74 | AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE, | |
75 | [AC_MSG_CHECKING([for $1 in sys/procfs.h]) | |
76 | AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1, | |
7ee38065 MS |
77 | [AC_TRY_COMPILE([ |
78 | #define _SYSCALL32 | |
79 | #include <sys/procfs.h>], | |
252b5132 RH |
80 | [$1 avar], |
81 | bfd_cv_have_sys_procfs_type_$1=yes, | |
82 | bfd_cv_have_sys_procfs_type_$1=no | |
83 | )]) | |
84 | if test $bfd_cv_have_sys_procfs_type_$1 = yes; then | |
85 | AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1, | |
86 | [Define if <sys/procfs.h> has $1.]) | |
87 | fi | |
88 | AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1) | |
89 | ]) | |
90 | ||
91 | ||
92 | dnl Check for existence of member $2 in type $1 in sys/procfs.h | |
93 | ||
94 | AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER, | |
95 | [AC_MSG_CHECKING([for $1.$2 in sys/procfs.h]) | |
96 | AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2, | |
7ee38065 MS |
97 | [AC_TRY_COMPILE([ |
98 | #define _SYSCALL32 | |
99 | #include <sys/procfs.h>], | |
252b5132 RH |
100 | [$1 avar; void* aref = (void*) &avar.$2], |
101 | bfd_cv_have_sys_procfs_type_member_$1_$2=yes, | |
102 | bfd_cv_have_sys_procfs_type_member_$1_$2=no | |
103 | )]) | |
104 | if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then | |
105 | AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1, | |
106 | [Define if <sys/procfs.h> has $1.$2.]) | |
107 | fi | |
108 | AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2) | |
109 | ]) | |
110 | ||
ac48eca1 AO |
111 | sinclude(../libtool.m4) |
112 | dnl The lines below arrange for aclocal not to bring libtool.m4 | |
113 | dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake | |
114 | dnl to add a definition of LIBTOOL to Makefile.in. | |
115 | ifelse(yes,no,[ | |
116 | AC_DEFUN([AM_PROG_LIBTOOL],) | |
117 | AC_DEFUN([AM_DISABLE_SHARED],) | |
118 | AC_SUBST(LIBTOOL) | |
119 | ]) | |
252b5132 | 120 | |
ac48eca1 AO |
121 | sinclude(../gettext.m4) |
122 | ifelse(yes,no,[ | |
123 | AC_DEFUN([CY_WITH_NLS],) | |
124 | AC_SUBST(INTLLIBS) | |
125 | ]) | |
a703a6ea AM |
126 | |
127 | AC_DEFUN([AM_INSTALL_LIBBFD], | |
128 | [AC_MSG_CHECKING([whether to install libbfd]) | |
129 | AC_ARG_ENABLE(install-libbfd, | |
130 | [ --install-libbfd controls installation of libbfd and related headers], | |
131 | install_libbfd_p=$enableval, | |
132 | if test "${host}" = "${target}" -o "$enable_shared" = "yes"; then | |
133 | install_libbfd_p=yes | |
134 | else | |
135 | install_libbfd_p=no | |
136 | fi) | |
137 | AC_MSG_RESULT($install_libbfd_p) | |
138 | AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes) | |
139 | # libbfd.a is a host library containing target dependent code | |
140 | bfdlibdir='$(libdir)' | |
141 | bfdincludedir='$(includedir)' | |
142 | if test "${host}" != "${target}"; then | |
143 | bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib' | |
144 | bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include' | |
145 | fi | |
146 | AC_SUBST(bfdlibdir) | |
147 | AC_SUBST(bfdincludedir) | |
148 | ] | |
149 | ) |