* Makefile.am: New file, based on old Makefile.in.
[external/binutils.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* | *-*-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)])dnl
22
23 dnl See whether we need a declaration for a function.
24 AC_DEFUN(BFD_NEED_DECLARATION,
25 [AC_MSG_CHECKING([whether $1 must be declared])
26 AC_CACHE_VAL(bfd_cv_decl_needed_$1,
27 [AC_TRY_COMPILE([
28 #include <stdio.h>
29 #ifdef HAVE_STRING_H
30 #include <string.h>
31 #else
32 #ifdef HAVE_STRINGS_H
33 #include <strings.h>
34 #endif
35 #endif
36 #ifdef HAVE_STDLIB_H
37 #include <stdlib.h>
38 #endif
39 #ifdef HAVE_UNISTD_H
40 #include <unistd.h>
41 #endif],
42 [char *(*pfn) = (char *(*)) $1],
43 bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)])
44 AC_MSG_RESULT($bfd_cv_decl_needed_$1)
45 if test $bfd_cv_decl_needed_$1 = yes; then
46   bfd_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
47   AC_DEFINE_UNQUOTED($bfd_tr_decl)
48 fi
49 ])dnl