1dnl GAS_CHECK_DECL_NEEDED(name, typedefname, typedef, headers)
2AC_DEFUN([GAS_CHECK_DECL_NEEDED],[
3AC_MSG_CHECKING(whether declaration is required for $1)
4AC_CACHE_VAL(gas_cv_decl_needed_$1,
5AC_TRY_LINK([$4],
6[
7typedef $3;
8$2 x;
9x = ($2) $1;
10], gas_cv_decl_needed_$1=no, gas_cv_decl_needed_$1=yes))dnl
11AC_MSG_RESULT($gas_cv_decl_needed_$1)
12if test $gas_cv_decl_needed_$1 = yes; then
13 AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
14	   [Define if $1 is not declared in system header files.])
15fi
16])dnl
17dnl
18dnl Some non-ANSI preprocessors botch requoting inside strings.  That's bad
19dnl enough, but on some of those systems, the assert macro relies on requoting
20dnl working properly!
21dnl GAS_WORKING_ASSERT
22AC_DEFUN([GAS_WORKING_ASSERT],
23[AC_MSG_CHECKING([for working assert macro])
24AC_CACHE_VAL(gas_cv_assert_ok,
25AC_TRY_LINK([#include <assert.h>
26#include <stdio.h>], [
27/* check for requoting problems */
28static int a, b, c, d;
29static char *s;
30assert (!strcmp(s, "foo bar baz quux"));
31/* check for newline handling */
32assert (a == b
33        || c == d);
34], gas_cv_assert_ok=yes, gas_cv_assert_ok=no))dnl
35AC_MSG_RESULT($gas_cv_assert_ok)
36test $gas_cv_assert_ok = yes || AC_DEFINE(BROKEN_ASSERT, 1, [assert broken?])
37])dnl
38dnl
39dnl Since many Bourne shell implementations lack subroutines, use this
40dnl hack to simplify the code in configure.in.
41dnl GAS_UNIQ(listvar)
42AC_DEFUN([GAS_UNIQ],
43[_gas_uniq_list="[$]$1"
44_gas_uniq_newlist=""
45dnl Protect against empty input list.
46for _gas_uniq_i in _gas_uniq_dummy [$]_gas_uniq_list ; do
47  case [$]_gas_uniq_i in
48  _gas_uniq_dummy) ;;
49  *) case " [$]_gas_uniq_newlist " in
50       *" [$]_gas_uniq_i "*) ;;
51       *) _gas_uniq_newlist="[$]_gas_uniq_newlist [$]_gas_uniq_i" ;;
52     esac ;;
53  esac
54done
55$1=[$]_gas_uniq_newlist
56])dnl
57