This commit was generated by cvs2svn to track changes on a CVS vendor
[deliverable/binutils-gdb.git] / bfd / acinclude.m4
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
6 i[345]86-*-msdos* | i[345]86-*-go32* | i[345]86-*-mingw32* | *-*-cygwin32* | *-*-windows)
7 changequote([,])dnl
8 AC_DEFINE(USE_BINARY_FOPEN) ;;
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,
27 [cat > ac_c_test.c << 'EOF'
28 int main() {
29 /* Nothing needed here */
30 }
31 EOF
32 ${CC_FOR_BUILD} -o ac_c_test am_c_test.c 1>&5 2>&5
33 bfd_cv_build_exeext=`echo ac_c_test.* | grep -v ac_c_test.c | sed -e s/ac_c_test//`
34 rm -f ac_c_test*
35 test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
36 EXEEXT_FOR_BUILD=""
37 test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
38 fi
39 AC_SUBST(EXEEXT_FOR_BUILD)])dnl
40
41 dnl See whether we need a declaration for a function.
42 AC_DEFUN(BFD_NEED_DECLARATION,
43 [AC_MSG_CHECKING([whether $1 must be declared])
44 AC_CACHE_VAL(bfd_cv_decl_needed_$1,
45 [AC_TRY_COMPILE([
46 #include <stdio.h>
47 #ifdef HAVE_STRING_H
48 #include <string.h>
49 #else
50 #ifdef HAVE_STRINGS_H
51 #include <strings.h>
52 #endif
53 #endif
54 #ifdef HAVE_STDLIB_H
55 #include <stdlib.h>
56 #endif
57 #ifdef HAVE_UNISTD_H
58 #include <unistd.h>
59 #endif],
60 [char *(*pfn) = (char *(*)) $1],
61 bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)])
62 AC_MSG_RESULT($bfd_cv_decl_needed_$1)
63 if test $bfd_cv_decl_needed_$1 = yes; then
64 bfd_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
65 AC_DEFINE_UNQUOTED($bfd_tr_decl)
66 fi
67 ])dnl
68
69 dnl Check for existence of a type $1 in sys/procfs.h
70
71 AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE,
72 [AC_MSG_CHECKING([for $1 in sys/procfs.h])
73 AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
74 [AC_TRY_COMPILE([#include <sys/procfs.h>],
75 [$1 avar],
76 bfd_cv_have_sys_procfs_type_$1=yes,
77 bfd_cv_have_sys_procfs_type_$1=no
78 )])
79 if test $bfd_cv_have_sys_procfs_type_$1 = yes; then
80 AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]))
81 fi
82 AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
83 ])
84
85
86 dnl Check for existence of member $2 in type $1 in sys/procfs.h
87
88 AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
89 [AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
90 AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
91 [AC_TRY_COMPILE([#include <sys/procfs.h>],
92 [$1 avar; void* aref = (void*) &avar.$2],
93 bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
94 bfd_cv_have_sys_procfs_type_member_$1_$2=no
95 )])
96 if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then
97 AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]))
98 fi
99 AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
100 ])
101
102
This page took 0.054802 seconds and 5 git commands to generate.