acinclude.m4 revision 60484
138889Sjdpdnl See whether we need to use fopen-bin.h rather than fopen-same.h.
238889SjdpAC_DEFUN(BFD_BINARY_FOPEN,
338889Sjdp[AC_REQUIRE([AC_CANONICAL_SYSTEM])
438889Sjdpcase "${host}" in
538889Sjdpchangequote(,)dnl
660484Sobrien*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
738889Sjdpchangequote([,])dnl
860484Sobrien  AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
938889Sjdpesac])dnl
1038889Sjdp
1138889Sjdpdnl Get a default for CC_FOR_BUILD to put into Makefile.
1238889SjdpAC_DEFUN(BFD_CC_FOR_BUILD,
1338889Sjdp[# Put a plausible default for CC_FOR_BUILD in Makefile.
1438889Sjdpif test -z "$CC_FOR_BUILD"; then
1538889Sjdp  if test "x$cross_compiling" = "xno"; then
1638889Sjdp    CC_FOR_BUILD='$(CC)'
1738889Sjdp  else
1838889Sjdp    CC_FOR_BUILD=gcc
1938889Sjdp  fi
2038889Sjdpfi
2138889SjdpAC_SUBST(CC_FOR_BUILD)
2238889Sjdp# Also set EXEEXT_FOR_BUILD.
2338889Sjdpif test "x$cross_compiling" = "xno"; then
2438889Sjdp  EXEEXT_FOR_BUILD='$(EXEEXT)'
2538889Sjdpelse
2638889Sjdp  AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
2760484Sobrien    [rm -f conftest*
2860484Sobrien     echo 'int main () { return 0; }' > conftest.c
2960484Sobrien     bfd_cv_build_exeext=
3060484Sobrien     ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
3160484Sobrien     for file in conftest.*; do
3260484Sobrien       case $file in
3360484Sobrien       *.c | *.o | *.obj | *.ilk | *.pdb) ;;
3460484Sobrien       *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
3560484Sobrien       esac
3660484Sobrien     done
3760484Sobrien     rm -f conftest*
3860484Sobrien     test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
3938889Sjdp  EXEEXT_FOR_BUILD=""
4038889Sjdp  test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
4138889Sjdpfi
4238889SjdpAC_SUBST(EXEEXT_FOR_BUILD)])dnl
4338889Sjdp
4438889Sjdpdnl See whether we need a declaration for a function.
4538889SjdpAC_DEFUN(BFD_NEED_DECLARATION,
4638889Sjdp[AC_MSG_CHECKING([whether $1 must be declared])
4738889SjdpAC_CACHE_VAL(bfd_cv_decl_needed_$1,
4838889Sjdp[AC_TRY_COMPILE([
4938889Sjdp#include <stdio.h>
5038889Sjdp#ifdef HAVE_STRING_H
5138889Sjdp#include <string.h>
5238889Sjdp#else
5338889Sjdp#ifdef HAVE_STRINGS_H
5438889Sjdp#include <strings.h>
5538889Sjdp#endif
5638889Sjdp#endif
5738889Sjdp#ifdef HAVE_STDLIB_H
5838889Sjdp#include <stdlib.h>
5938889Sjdp#endif
6038889Sjdp#ifdef HAVE_UNISTD_H
6138889Sjdp#include <unistd.h>
6238889Sjdp#endif],
6338889Sjdp[char *(*pfn) = (char *(*)) $1],
6438889Sjdpbfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)])
6538889SjdpAC_MSG_RESULT($bfd_cv_decl_needed_$1)
6638889Sjdpif test $bfd_cv_decl_needed_$1 = yes; then
6760484Sobrien  AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
6860484Sobrien	    [Define if $1 is not declared in system header files.])
6938889Sjdpfi
7038889Sjdp])dnl
7160484Sobrien
7260484Sobriendnl Check for existence of a type $1 in sys/procfs.h
7360484Sobrien
7460484SobrienAC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE,
7560484Sobrien[AC_MSG_CHECKING([for $1 in sys/procfs.h])
7660484Sobrien AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
7760484Sobrien   [AC_TRY_COMPILE([#include <sys/procfs.h>],
7860484Sobrien      [$1 avar],
7960484Sobrien      bfd_cv_have_sys_procfs_type_$1=yes,
8060484Sobrien      bfd_cv_have_sys_procfs_type_$1=no
8160484Sobrien   )])
8260484Sobrien if test $bfd_cv_have_sys_procfs_type_$1 = yes; then
8360484Sobrien   AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1,
8460484Sobrien	     [Define if <sys/procfs.h> has $1.])
8560484Sobrien fi
8660484Sobrien AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
8760484Sobrien])
8860484Sobrien
8960484Sobrien
9060484Sobriendnl Check for existence of member $2 in type $1 in sys/procfs.h
9160484Sobrien
9260484SobrienAC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
9360484Sobrien[AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
9460484Sobrien AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
9560484Sobrien   [AC_TRY_COMPILE([#include <sys/procfs.h>],
9660484Sobrien      [$1 avar; void* aref = (void*) &avar.$2],
9760484Sobrien      bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
9860484Sobrien      bfd_cv_have_sys_procfs_type_member_$1_$2=no
9960484Sobrien   )])
10060484Sobrien if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then
10160484Sobrien   AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1,
10260484Sobrien	     [Define if <sys/procfs.h> has $1.$2.])
10360484Sobrien fi
10460484Sobrien AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
10560484Sobrien])
10660484Sobrien
10760484Sobrien
108