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