138889Sjdpdnl GAS_CHECK_DECL_NEEDED(name, typedefname, typedef, headers)
2130561SobrienAC_DEFUN([GAS_CHECK_DECL_NEEDED],[
338889SjdpAC_MSG_CHECKING(whether declaration is required for $1)
438889SjdpAC_CACHE_VAL(gas_cv_decl_needed_$1,
538889SjdpAC_TRY_LINK([$4],
638889Sjdp[
738889Sjdptypedef $3;
838889Sjdp$2 x;
938889Sjdpx = ($2) $1;
1038889Sjdp], gas_cv_decl_needed_$1=no, gas_cv_decl_needed_$1=yes))dnl
1138889SjdpAC_MSG_RESULT($gas_cv_decl_needed_$1)
1260484Sobrienif test $gas_cv_decl_needed_$1 = yes; then
1360484Sobrien AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
1460484Sobrien	   [Define if $1 is not declared in system header files.])
1560484Sobrienfi
1638889Sjdp])dnl
1738889Sjdpdnl
1838889Sjdpdnl Some non-ANSI preprocessors botch requoting inside strings.  That's bad
1938889Sjdpdnl enough, but on some of those systems, the assert macro relies on requoting
2038889Sjdpdnl working properly!
2138889Sjdpdnl GAS_WORKING_ASSERT
22130561SobrienAC_DEFUN([GAS_WORKING_ASSERT],
2338889Sjdp[AC_MSG_CHECKING([for working assert macro])
2438889SjdpAC_CACHE_VAL(gas_cv_assert_ok,
2538889SjdpAC_TRY_LINK([#include <assert.h>
2638889Sjdp#include <stdio.h>], [
2738889Sjdp/* check for requoting problems */
2838889Sjdpstatic int a, b, c, d;
2938889Sjdpstatic char *s;
3038889Sjdpassert (!strcmp(s, "foo bar baz quux"));
3138889Sjdp/* check for newline handling */
3238889Sjdpassert (a == b
3338889Sjdp        || c == d);
3438889Sjdp], gas_cv_assert_ok=yes, gas_cv_assert_ok=no))dnl
3538889SjdpAC_MSG_RESULT($gas_cv_assert_ok)
3660484Sobrientest $gas_cv_assert_ok = yes || AC_DEFINE(BROKEN_ASSERT, 1, [assert broken?])
3738889Sjdp])dnl
3838889Sjdpdnl
3938889Sjdpdnl Since many Bourne shell implementations lack subroutines, use this
4038889Sjdpdnl hack to simplify the code in configure.in.
4138889Sjdpdnl GAS_UNIQ(listvar)
42130561SobrienAC_DEFUN([GAS_UNIQ],
4338889Sjdp[_gas_uniq_list="[$]$1"
4438889Sjdp_gas_uniq_newlist=""
4538889Sjdpdnl Protect against empty input list.
4638889Sjdpfor _gas_uniq_i in _gas_uniq_dummy [$]_gas_uniq_list ; do
4738889Sjdp  case [$]_gas_uniq_i in
4838889Sjdp  _gas_uniq_dummy) ;;
4938889Sjdp  *) case " [$]_gas_uniq_newlist " in
5038889Sjdp       *" [$]_gas_uniq_i "*) ;;
5138889Sjdp       *) _gas_uniq_newlist="[$]_gas_uniq_newlist [$]_gas_uniq_i" ;;
5238889Sjdp     esac ;;
5338889Sjdp  esac
5438889Sjdpdone
5538889Sjdp$1=[$]_gas_uniq_newlist
5638889Sjdp])dnl
57