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])
6 *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows)
8 AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
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
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)'
26 AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
27 [cat > ac_c_test.c << 'EOF'
29 /* Nothing needed here */
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//`
35 test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
37 test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
39 AC_SUBST(EXEEXT_FOR_BUILD)])dnl
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,
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 AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
65 [Define if $1 is not declared in system header files.])
69 dnl Check for existence of a type $1 in sys/procfs.h
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>],
76 bfd_cv_have_sys_procfs_type_$1=yes,
77 bfd_cv_have_sys_procfs_type_$1=no
79 if test $bfd_cv_have_sys_procfs_type_$1 = yes; then
80 AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1,
81 [Define if <sys/procfs.h> has $1.])
83 AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
87 dnl Check for existence of member $2 in type $1 in sys/procfs.h
89 AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
90 [AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
91 AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
92 [AC_TRY_COMPILE([#include <sys/procfs.h>],
93 [$1 avar; void* aref = (void*) &avar.$2],
94 bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
95 bfd_cv_have_sys_procfs_type_member_$1_$2=no
97 if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then
98 AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1,
99 [Define if <sys/procfs.h> has $1.$2.])
101 AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)