acinclude.m4 revision 104834
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,
7777298Sobrien   [AC_TRY_COMPILE([
7877298Sobrien#define _SYSCALL32
7977298Sobrien#include <sys/procfs.h>],
8060484Sobrien      [$1 avar],
8160484Sobrien      bfd_cv_have_sys_procfs_type_$1=yes,
8260484Sobrien      bfd_cv_have_sys_procfs_type_$1=no
8360484Sobrien   )])
8460484Sobrien if test $bfd_cv_have_sys_procfs_type_$1 = yes; then
8560484Sobrien   AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1,
8660484Sobrien	     [Define if <sys/procfs.h> has $1.])
8760484Sobrien fi
8860484Sobrien AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
8960484Sobrien])
9060484Sobrien
9160484Sobrien
9260484Sobriendnl Check for existence of member $2 in type $1 in sys/procfs.h
9360484Sobrien
9460484SobrienAC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
9560484Sobrien[AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
9660484Sobrien AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
9777298Sobrien   [AC_TRY_COMPILE([
9877298Sobrien#define _SYSCALL32
9977298Sobrien#include <sys/procfs.h>],
10060484Sobrien      [$1 avar; void* aref = (void*) &avar.$2],
10160484Sobrien      bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
10260484Sobrien      bfd_cv_have_sys_procfs_type_member_$1_$2=no
10360484Sobrien   )])
10460484Sobrien if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then
10560484Sobrien   AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1,
10660484Sobrien	     [Define if <sys/procfs.h> has $1.$2.])
10760484Sobrien fi
10860484Sobrien AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
10960484Sobrien])
11060484Sobrien
11177298Sobriensinclude(../libtool.m4)
11277298Sobriendnl The lines below arrange for aclocal not to bring libtool.m4
11377298Sobriendnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
11477298Sobriendnl to add a definition of LIBTOOL to Makefile.in.
11577298Sobrienifelse(yes,no,[
11677298SobrienAC_DEFUN([AM_PROG_LIBTOOL],)
11777298SobrienAC_DEFUN([AM_DISABLE_SHARED],)
11877298SobrienAC_SUBST(LIBTOOL)
11977298Sobrien])
12060484Sobrien
12177298Sobriensinclude(../gettext.m4)
12277298Sobrienifelse(yes,no,[
12377298SobrienAC_DEFUN([CY_WITH_NLS],)
12477298SobrienAC_SUBST(INTLLIBS)
12577298Sobrien])
126104834Sobrien
127104834SobrienAC_DEFUN([AM_INSTALL_LIBBFD],
128104834Sobrien[AC_MSG_CHECKING([whether to install libbfd])
129104834Sobrien  AC_ARG_ENABLE(install-libbfd,
130104834Sobrien[  --install-libbfd controls installation of libbfd and related headers],
131104834Sobrien      install_libbfd_p=$enableval,
132104834Sobrien      if test "${host}" = "${target}" -o "$enable_shared" = "yes"; then
133104834Sobrien        install_libbfd_p=yes
134104834Sobrien      else
135104834Sobrien        install_libbfd_p=no
136104834Sobrien      fi)
137104834Sobrien  AC_MSG_RESULT($install_libbfd_p)
138104834Sobrien  AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes)
139104834Sobrien  # libbfd.a is a host library containing target dependent code
140104834Sobrien  bfdlibdir='$(libdir)'
141104834Sobrien  bfdincludedir='$(includedir)'
142104834Sobrien  if test "${host}" != "${target}"; then
143104834Sobrien    bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib'
144104834Sobrien    bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include'
145104834Sobrien  fi
146104834Sobrien  AC_SUBST(bfdlibdir)
147104834Sobrien  AC_SUBST(bfdincludedir)
148104834Sobrien]
149104834Sobrien)
150