daily update
[binutils.git] / bfd / acinclude.m4
blobb1bd1bec784fb44079a67ac2a9e140c2126ca2a9
1 sinclude(../config/accross.m4)
3 dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
4 AC_DEFUN(BFD_BINARY_FOPEN,
5 [AC_REQUIRE([AC_CANONICAL_SYSTEM])
6 case "${host}" in
7 changequote(,)dnl
8 *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
9 changequote([,])dnl
10   AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
11 esac])dnl
13 dnl Get a default for CC_FOR_BUILD to put into Makefile.
14 AC_DEFUN(BFD_CC_FOR_BUILD,
15 [# Put a plausible default for CC_FOR_BUILD in Makefile.
16 if test -z "$CC_FOR_BUILD"; then
17   if test "x$cross_compiling" = "xno"; then
18     CC_FOR_BUILD='$(CC)'
19   else
20     CC_FOR_BUILD=gcc
21   fi
23 AC_SUBST(CC_FOR_BUILD)
24 # Also set EXEEXT_FOR_BUILD.
25 if test "x$cross_compiling" = "xno"; then
26   EXEEXT_FOR_BUILD='$(EXEEXT)'
27 else
28   AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
29     [rm -f conftest*
30      echo 'int main () { return 0; }' > conftest.c
31      bfd_cv_build_exeext=
32      ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
33      for file in conftest.*; do
34        case $file in
35        *.c | *.o | *.obj | *.ilk | *.pdb) ;;
36        *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
37        esac
38      done
39      rm -f conftest*
40      test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
41   EXEEXT_FOR_BUILD=""
42   test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
44 AC_SUBST(EXEEXT_FOR_BUILD)])dnl
46 dnl See whether we need a declaration for a function.
47 AC_DEFUN(BFD_NEED_DECLARATION,
48 [AC_MSG_CHECKING([whether $1 must be declared])
49 AC_CACHE_VAL(bfd_cv_decl_needed_$1,
50 [AC_TRY_COMPILE([
51 #include <stdio.h>
52 #ifdef HAVE_STRING_H
53 #include <string.h>
54 #else
55 #ifdef HAVE_STRINGS_H
56 #include <strings.h>
57 #endif
58 #endif
59 #ifdef HAVE_STDLIB_H
60 #include <stdlib.h>
61 #endif
62 #ifdef HAVE_UNISTD_H
63 #include <unistd.h>
64 #endif],
65 [char *(*pfn) = (char *(*)) $1],
66 bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)])
67 AC_MSG_RESULT($bfd_cv_decl_needed_$1)
68 if test $bfd_cv_decl_needed_$1 = yes; then
69   AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
70             [Define if $1 is not declared in system header files.])
72 ])dnl
74 dnl Check for existence of a type $1 in sys/procfs.h
76 AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE,
77 [AC_MSG_CHECKING([for $1 in sys/procfs.h])
78  AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
79    [AC_TRY_COMPILE([
80 #define _SYSCALL32
81 #include <sys/procfs.h>],
82       [$1 avar],
83       bfd_cv_have_sys_procfs_type_$1=yes,
84       bfd_cv_have_sys_procfs_type_$1=no
85    )])
86  if test $bfd_cv_have_sys_procfs_type_$1 = yes; then
87    AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1,
88              [Define if <sys/procfs.h> has $1.])
89  fi
90  AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
94 dnl Check for existence of member $2 in type $1 in sys/procfs.h
96 AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
97 [AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
98  AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
99    [AC_TRY_COMPILE([
100 #define _SYSCALL32
101 #include <sys/procfs.h>],
102       [$1 avar; void* aref = (void*) &avar.$2],
103       bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
104       bfd_cv_have_sys_procfs_type_member_$1_$2=no
105    )])
106  if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then
107    AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1,
108              [Define if <sys/procfs.h> has $1.$2.])
109  fi
110  AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
113 sinclude(../libtool.m4)
114 dnl The lines below arrange for aclocal not to bring libtool.m4
115 dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
116 dnl to add a definition of LIBTOOL to Makefile.in.
117 ifelse(yes,no,[
118 AC_DEFUN([AM_PROG_LIBTOOL],)
119 AC_DEFUN([AM_DISABLE_SHARED],)
120 AC_SUBST(LIBTOOL)
123 sinclude(../gettext.m4)
124 ifelse(yes,no,[
125 AC_DEFUN([CY_WITH_NLS],)
126 AC_SUBST(INTLLIBS)
129 AC_DEFUN([AM_INSTALL_LIBBFD],
130 [AC_MSG_CHECKING([whether to install libbfd])
131   AC_ARG_ENABLE(install-libbfd,
132 [  --enable-install-libbfd controls installation of libbfd and related headers],
133       install_libbfd_p=$enableval,
134       if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then
135         install_libbfd_p=yes
136       else
137         install_libbfd_p=no
138       fi)
139   AC_MSG_RESULT($install_libbfd_p)
140   AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes)
141   # libbfd.a is a host library containing target dependent code
142   bfdlibdir='$(libdir)'
143   bfdincludedir='$(includedir)'
144   if test "${host}" != "${target}"; then
145     bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib'
146     bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include'
147   fi
148   AC_SUBST(bfdlibdir)
149   AC_SUBST(bfdincludedir)