acinclude.m4 revision 130561
1130561Sobriensinclude(../config/accross.m4)
2130561Sobrien
338889Sjdpdnl See whether we need to use fopen-bin.h rather than fopen-same.h.
4130561SobrienAC_DEFUN([BFD_BINARY_FOPEN],
538889Sjdp[AC_REQUIRE([AC_CANONICAL_SYSTEM])
638889Sjdpcase "${host}" in
738889Sjdpchangequote(,)dnl
860484Sobrien*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
938889Sjdpchangequote([,])dnl
1060484Sobrien  AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
1138889Sjdpesac])dnl
1238889Sjdp
1338889Sjdpdnl Get a default for CC_FOR_BUILD to put into Makefile.
14130561SobrienAC_DEFUN([BFD_CC_FOR_BUILD],
1538889Sjdp[# Put a plausible default for CC_FOR_BUILD in Makefile.
1638889Sjdpif test -z "$CC_FOR_BUILD"; then
1738889Sjdp  if test "x$cross_compiling" = "xno"; then
1838889Sjdp    CC_FOR_BUILD='$(CC)'
1938889Sjdp  else
2038889Sjdp    CC_FOR_BUILD=gcc
2138889Sjdp  fi
2238889Sjdpfi
2338889SjdpAC_SUBST(CC_FOR_BUILD)
2438889Sjdp# Also set EXEEXT_FOR_BUILD.
2538889Sjdpif test "x$cross_compiling" = "xno"; then
2638889Sjdp  EXEEXT_FOR_BUILD='$(EXEEXT)'
2738889Sjdpelse
2838889Sjdp  AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
2960484Sobrien    [rm -f conftest*
3060484Sobrien     echo 'int main () { return 0; }' > conftest.c
3160484Sobrien     bfd_cv_build_exeext=
3260484Sobrien     ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
3360484Sobrien     for file in conftest.*; do
3460484Sobrien       case $file in
3560484Sobrien       *.c | *.o | *.obj | *.ilk | *.pdb) ;;
3660484Sobrien       *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
3760484Sobrien       esac
3860484Sobrien     done
3960484Sobrien     rm -f conftest*
4060484Sobrien     test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
4138889Sjdp  EXEEXT_FOR_BUILD=""
4238889Sjdp  test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
4338889Sjdpfi
4438889SjdpAC_SUBST(EXEEXT_FOR_BUILD)])dnl
4538889Sjdp
4638889Sjdpdnl See whether we need a declaration for a function.
47130561SobrienAC_DEFUN([BFD_NEED_DECLARATION],
4838889Sjdp[AC_MSG_CHECKING([whether $1 must be declared])
4938889SjdpAC_CACHE_VAL(bfd_cv_decl_needed_$1,
5038889Sjdp[AC_TRY_COMPILE([
5138889Sjdp#include <stdio.h>
5238889Sjdp#ifdef HAVE_STRING_H
5338889Sjdp#include <string.h>
5438889Sjdp#else
5538889Sjdp#ifdef HAVE_STRINGS_H
5638889Sjdp#include <strings.h>
5738889Sjdp#endif
5838889Sjdp#endif
5938889Sjdp#ifdef HAVE_STDLIB_H
6038889Sjdp#include <stdlib.h>
6138889Sjdp#endif
6238889Sjdp#ifdef HAVE_UNISTD_H
6338889Sjdp#include <unistd.h>
6438889Sjdp#endif],
6538889Sjdp[char *(*pfn) = (char *(*)) $1],
6638889Sjdpbfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)])
6738889SjdpAC_MSG_RESULT($bfd_cv_decl_needed_$1)
6838889Sjdpif test $bfd_cv_decl_needed_$1 = yes; then
6960484Sobrien  AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
7060484Sobrien	    [Define if $1 is not declared in system header files.])
7138889Sjdpfi
7238889Sjdp])dnl
7360484Sobrien
7460484Sobriendnl Check for existence of a type $1 in sys/procfs.h
7560484Sobrien
76130561SobrienAC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE],
7760484Sobrien[AC_MSG_CHECKING([for $1 in sys/procfs.h])
7860484Sobrien AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
7977298Sobrien   [AC_TRY_COMPILE([
8077298Sobrien#define _SYSCALL32
8177298Sobrien#include <sys/procfs.h>],
8260484Sobrien      [$1 avar],
8360484Sobrien      bfd_cv_have_sys_procfs_type_$1=yes,
8460484Sobrien      bfd_cv_have_sys_procfs_type_$1=no
8560484Sobrien   )])
8660484Sobrien if test $bfd_cv_have_sys_procfs_type_$1 = yes; then
8760484Sobrien   AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1,
8860484Sobrien	     [Define if <sys/procfs.h> has $1.])
8960484Sobrien fi
9060484Sobrien AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
9160484Sobrien])
9260484Sobrien
9360484Sobrien
9460484Sobriendnl Check for existence of member $2 in type $1 in sys/procfs.h
9560484Sobrien
96130561SobrienAC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE_MEMBER],
9760484Sobrien[AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
9860484Sobrien AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
9977298Sobrien   [AC_TRY_COMPILE([
10077298Sobrien#define _SYSCALL32
10177298Sobrien#include <sys/procfs.h>],
10260484Sobrien      [$1 avar; void* aref = (void*) &avar.$2],
10360484Sobrien      bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
10460484Sobrien      bfd_cv_have_sys_procfs_type_member_$1_$2=no
10560484Sobrien   )])
10660484Sobrien if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then
10760484Sobrien   AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1,
10860484Sobrien	     [Define if <sys/procfs.h> has $1.$2.])
10960484Sobrien fi
11060484Sobrien AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
11160484Sobrien])
11260484Sobrien
11377298Sobriensinclude(../libtool.m4)
11477298Sobriendnl The lines below arrange for aclocal not to bring libtool.m4
11577298Sobriendnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
11677298Sobriendnl to add a definition of LIBTOOL to Makefile.in.
11777298Sobrienifelse(yes,no,[
11877298SobrienAC_DEFUN([AM_PROG_LIBTOOL],)
11977298SobrienAC_DEFUN([AM_DISABLE_SHARED],)
12077298SobrienAC_SUBST(LIBTOOL)
12177298Sobrien])
12260484Sobrien
12377298Sobriensinclude(../gettext.m4)
12477298Sobrienifelse(yes,no,[
12577298SobrienAC_DEFUN([CY_WITH_NLS],)
12677298SobrienAC_SUBST(INTLLIBS)
12777298Sobrien])
128104834Sobrien
129104834SobrienAC_DEFUN([AM_INSTALL_LIBBFD],
130104834Sobrien[AC_MSG_CHECKING([whether to install libbfd])
131104834Sobrien  AC_ARG_ENABLE(install-libbfd,
132130561Sobrien[  --enable-install-libbfd controls installation of libbfd and related headers],
133104834Sobrien      install_libbfd_p=$enableval,
134130561Sobrien      if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then
135104834Sobrien        install_libbfd_p=yes
136104834Sobrien      else
137104834Sobrien        install_libbfd_p=no
138104834Sobrien      fi)
139104834Sobrien  AC_MSG_RESULT($install_libbfd_p)
140104834Sobrien  AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes)
141104834Sobrien  # libbfd.a is a host library containing target dependent code
142104834Sobrien  bfdlibdir='$(libdir)'
143104834Sobrien  bfdincludedir='$(includedir)'
144104834Sobrien  if test "${host}" != "${target}"; then
145104834Sobrien    bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib'
146104834Sobrien    bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include'
147104834Sobrien  fi
148104834Sobrien  AC_SUBST(bfdlibdir)
149104834Sobrien  AC_SUBST(bfdincludedir)
150104834Sobrien]
151104834Sobrien)
152