xref: /openbsd-src/gnu/usr.bin/binutils/bfd/acinclude.m4 (revision cf2f2c5620d6d9a4fd01930983c4b9a1f76d7aa3)
1*cf2f2c56Smiodsinclude(../config/accross.m4)
2*cf2f2c56Smiod
3f7cc78ecSespiednl See whether we need to use fopen-bin.h rather than fopen-same.h.
4*cf2f2c56SmiodAC_DEFUN([BFD_BINARY_FOPEN],
5f7cc78ecSespie[AC_REQUIRE([AC_CANONICAL_SYSTEM])
6f7cc78ecSespiecase "${host}" in
7f7cc78ecSespiechangequote(,)dnl
8f7cc78ecSespie*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
9f7cc78ecSespiechangequote([,])dnl
10f7cc78ecSespie  AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
11f7cc78ecSespieesac])dnl
12f7cc78ecSespie
13f7cc78ecSespiednl Get a default for CC_FOR_BUILD to put into Makefile.
14*cf2f2c56SmiodAC_DEFUN([BFD_CC_FOR_BUILD],
15f7cc78ecSespie[# Put a plausible default for CC_FOR_BUILD in Makefile.
16f7cc78ecSespieif test -z "$CC_FOR_BUILD"; then
17f7cc78ecSespie  if test "x$cross_compiling" = "xno"; then
18f7cc78ecSespie    CC_FOR_BUILD='$(CC)'
19f7cc78ecSespie  else
20f7cc78ecSespie    CC_FOR_BUILD=gcc
21f7cc78ecSespie  fi
22f7cc78ecSespiefi
23f7cc78ecSespieAC_SUBST(CC_FOR_BUILD)
24f7cc78ecSespie# Also set EXEEXT_FOR_BUILD.
25f7cc78ecSespieif test "x$cross_compiling" = "xno"; then
26f7cc78ecSespie  EXEEXT_FOR_BUILD='$(EXEEXT)'
27f7cc78ecSespieelse
28f7cc78ecSespie  AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
29f7cc78ecSespie    [rm -f conftest*
30f7cc78ecSespie     echo 'int main () { return 0; }' > conftest.c
31f7cc78ecSespie     bfd_cv_build_exeext=
32f7cc78ecSespie     ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
33f7cc78ecSespie     for file in conftest.*; do
34f7cc78ecSespie       case $file in
35f7cc78ecSespie       *.c | *.o | *.obj | *.ilk | *.pdb) ;;
36f7cc78ecSespie       *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
37f7cc78ecSespie       esac
38f7cc78ecSespie     done
39f7cc78ecSespie     rm -f conftest*
40f7cc78ecSespie     test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
41f7cc78ecSespie  EXEEXT_FOR_BUILD=""
42f7cc78ecSespie  test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
43f7cc78ecSespiefi
44f7cc78ecSespieAC_SUBST(EXEEXT_FOR_BUILD)])dnl
45f7cc78ecSespie
46f7cc78ecSespiednl See whether we need a declaration for a function.
47*cf2f2c56SmiodAC_DEFUN([BFD_NEED_DECLARATION],
48f7cc78ecSespie[AC_MSG_CHECKING([whether $1 must be declared])
49f7cc78ecSespieAC_CACHE_VAL(bfd_cv_decl_needed_$1,
50f7cc78ecSespie[AC_TRY_COMPILE([
51f7cc78ecSespie#include <stdio.h>
52f7cc78ecSespie#ifdef HAVE_STRING_H
53f7cc78ecSespie#include <string.h>
54f7cc78ecSespie#else
55f7cc78ecSespie#ifdef HAVE_STRINGS_H
56f7cc78ecSespie#include <strings.h>
57f7cc78ecSespie#endif
58f7cc78ecSespie#endif
59f7cc78ecSespie#ifdef HAVE_STDLIB_H
60f7cc78ecSespie#include <stdlib.h>
61f7cc78ecSespie#endif
62f7cc78ecSespie#ifdef HAVE_UNISTD_H
63f7cc78ecSespie#include <unistd.h>
64f7cc78ecSespie#endif],
65f7cc78ecSespie[char *(*pfn) = (char *(*)) $1],
66f7cc78ecSespiebfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)])
67f7cc78ecSespieAC_MSG_RESULT($bfd_cv_decl_needed_$1)
68f7cc78ecSespieif test $bfd_cv_decl_needed_$1 = yes; then
69f7cc78ecSespie  AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
70f7cc78ecSespie	    [Define if $1 is not declared in system header files.])
71f7cc78ecSespiefi
72f7cc78ecSespie])dnl
73f7cc78ecSespie
74f7cc78ecSespiednl Check for existence of a type $1 in sys/procfs.h
75f7cc78ecSespie
76*cf2f2c56SmiodAC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE],
77f7cc78ecSespie[AC_MSG_CHECKING([for $1 in sys/procfs.h])
78f7cc78ecSespie AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
795f210c2aSfgsch   [AC_TRY_COMPILE([
805f210c2aSfgsch#define _SYSCALL32
815f210c2aSfgsch#include <sys/procfs.h>],
82f7cc78ecSespie      [$1 avar],
83f7cc78ecSespie      bfd_cv_have_sys_procfs_type_$1=yes,
84f7cc78ecSespie      bfd_cv_have_sys_procfs_type_$1=no
85f7cc78ecSespie   )])
86f7cc78ecSespie if test $bfd_cv_have_sys_procfs_type_$1 = yes; then
87f7cc78ecSespie   AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1,
88f7cc78ecSespie	     [Define if <sys/procfs.h> has $1.])
89f7cc78ecSespie fi
90f7cc78ecSespie AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
91f7cc78ecSespie])
92f7cc78ecSespie
93f7cc78ecSespie
94f7cc78ecSespiednl Check for existence of member $2 in type $1 in sys/procfs.h
95f7cc78ecSespie
96*cf2f2c56SmiodAC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE_MEMBER],
97f7cc78ecSespie[AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
98f7cc78ecSespie AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
995f210c2aSfgsch   [AC_TRY_COMPILE([
1005f210c2aSfgsch#define _SYSCALL32
1015f210c2aSfgsch#include <sys/procfs.h>],
102f7cc78ecSespie      [$1 avar; void* aref = (void*) &avar.$2],
103f7cc78ecSespie      bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
104f7cc78ecSespie      bfd_cv_have_sys_procfs_type_member_$1_$2=no
105f7cc78ecSespie   )])
106f7cc78ecSespie if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then
107f7cc78ecSespie   AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1,
108f7cc78ecSespie	     [Define if <sys/procfs.h> has $1.$2.])
109f7cc78ecSespie fi
110f7cc78ecSespie AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
111f7cc78ecSespie])
112f7cc78ecSespie
1135f210c2aSfgschsinclude(../libtool.m4)
1145f210c2aSfgschdnl The lines below arrange for aclocal not to bring libtool.m4
1155f210c2aSfgschdnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
1165f210c2aSfgschdnl to add a definition of LIBTOOL to Makefile.in.
1175f210c2aSfgschifelse(yes,no,[
1185f210c2aSfgschAC_DEFUN([AM_PROG_LIBTOOL],)
1195f210c2aSfgschAC_DEFUN([AM_DISABLE_SHARED],)
1205f210c2aSfgschAC_SUBST(LIBTOOL)
1215f210c2aSfgsch])
122f7cc78ecSespie
1235f210c2aSfgschsinclude(../gettext.m4)
1245f210c2aSfgschifelse(yes,no,[
1255f210c2aSfgschAC_DEFUN([CY_WITH_NLS],)
1265f210c2aSfgschAC_SUBST(INTLLIBS)
1275f210c2aSfgsch])
128d2201f2fSdrahn
129d2201f2fSdrahnAC_DEFUN([AM_INSTALL_LIBBFD],
130d2201f2fSdrahn[AC_MSG_CHECKING([whether to install libbfd])
131d2201f2fSdrahn  AC_ARG_ENABLE(install-libbfd,
132d2201f2fSdrahn[  --enable-install-libbfd controls installation of libbfd and related headers],
133d2201f2fSdrahn      install_libbfd_p=$enableval,
134d2201f2fSdrahn      if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then
135d2201f2fSdrahn        install_libbfd_p=yes
136d2201f2fSdrahn      else
137d2201f2fSdrahn        install_libbfd_p=no
138d2201f2fSdrahn      fi)
139d2201f2fSdrahn  AC_MSG_RESULT($install_libbfd_p)
140d2201f2fSdrahn  AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes)
141d2201f2fSdrahn  # libbfd.a is a host library containing target dependent code
142d2201f2fSdrahn  bfdlibdir='$(libdir)'
143d2201f2fSdrahn  bfdincludedir='$(includedir)'
144d2201f2fSdrahn  if test "${host}" != "${target}"; then
145d2201f2fSdrahn    bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib'
146d2201f2fSdrahn    bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include'
147d2201f2fSdrahn  fi
148d2201f2fSdrahn  AC_SUBST(bfdlibdir)
149d2201f2fSdrahn  AC_SUBST(bfdincludedir)
150d2201f2fSdrahn]
151d2201f2fSdrahn)
152