bfd/
[binutils.git] / gas / acinclude.m4
blob096b0afe16e943eda7323777edc544499973feaf
1 sinclude(../bfd/warning.m4)
2 sinclude(../config/gettext-sister.m4)
3 sinclude(../config/nls.m4)
4 sinclude(../config/po.m4)
5 sinclude(../config/progtest.m4)
7 dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
8 AC_DEFUN([BFD_BINARY_FOPEN],
9 [AC_REQUIRE([AC_CANONICAL_TARGET])
10 case "${host}" in
11 changequote(,)dnl
12 *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
13 changequote([,])dnl
14   AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
15 esac])dnl
17 dnl GAS_CHECK_DECL_NEEDED(name, typedefname, typedef, headers)
18 AC_DEFUN([GAS_CHECK_DECL_NEEDED],[
19 AC_MSG_CHECKING(whether declaration is required for $1)
20 AC_CACHE_VAL(gas_cv_decl_needed_$1,
21 AC_TRY_LINK([$4],
23 typedef $3;
24 $2 x;
25 x = ($2) $1;
26 ], gas_cv_decl_needed_$1=no, gas_cv_decl_needed_$1=yes))dnl
27 AC_MSG_RESULT($gas_cv_decl_needed_$1)
28 if test $gas_cv_decl_needed_$1 = yes; then
29  AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
30            [Define if $1 is not declared in system header files.])
32 ])dnl
33 dnl
34 dnl Some non-ANSI preprocessors botch requoting inside strings.  That's bad
35 dnl enough, but on some of those systems, the assert macro relies on requoting
36 dnl working properly!
37 dnl GAS_WORKING_ASSERT
38 AC_DEFUN([GAS_WORKING_ASSERT],
39 [AC_MSG_CHECKING([for working assert macro])
40 AC_CACHE_VAL(gas_cv_assert_ok,
41 AC_TRY_LINK([#include <assert.h>
42 #include <stdio.h>], [
43 /* check for requoting problems */
44 static int a, b, c, d;
45 static char *s;
46 assert (!strcmp(s, "foo bar baz quux"));
47 /* check for newline handling */
48 assert (a == b
49         || c == d);
50 ], gas_cv_assert_ok=yes, gas_cv_assert_ok=no))dnl
51 AC_MSG_RESULT($gas_cv_assert_ok)
52 test $gas_cv_assert_ok = yes || AC_DEFINE(BROKEN_ASSERT, 1, [assert broken?])
53 ])dnl
54 dnl
55 dnl Since many Bourne shell implementations lack subroutines, use this
56 dnl hack to simplify the code in configure.in.
57 dnl GAS_UNIQ(listvar)
58 AC_DEFUN([GAS_UNIQ],
59 [_gas_uniq_list="[$]$1"
60 _gas_uniq_newlist=""
61 dnl Protect against empty input list.
62 for _gas_uniq_i in _gas_uniq_dummy [$]_gas_uniq_list ; do
63   case [$]_gas_uniq_i in
64   _gas_uniq_dummy) ;;
65   *) case " [$]_gas_uniq_newlist " in
66        *" [$]_gas_uniq_i "*) ;;
67        *) _gas_uniq_newlist="[$]_gas_uniq_newlist [$]_gas_uniq_i" ;;
68      esac ;;
69   esac
70 done
71 $1=[$]_gas_uniq_newlist
72 ])dnl
74 sinclude(../libtool.m4)
75 dnl The lines below arrange for aclocal not to bring libtool.m4
76 dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
77 dnl to add a definition of LIBTOOL to Makefile.in.
78 ifelse(yes,no,[
79 AC_DEFUN([AM_PROG_LIBTOOL],)
80 AC_DEFUN([AC_CHECK_LIBM],)
81 AC_SUBST(LIBTOOL)