acinclude.m4 revision 38889
138889Sjdpdnl GAS_CHECK_DECL_NEEDED(name, typedefname, typedef, headers)
238889SjdpAC_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)
1238889Sjdptest $gas_cv_decl_needed_$1 = no || {
1338889Sjdp ifelse(index($1,[$]),-1,
1438889Sjdp    [AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]))],
1538889Sjdp    [gas_decl_name_upcase=`echo $1 | tr '[a-z]' '[A-Z]'`
1638889Sjdp     AC_DEFINE_UNQUOTED(NEED_DECLARATION_$gas_decl_name_upcase)])
1738889Sjdp}
1838889Sjdp])dnl
1938889Sjdpdnl
2038889Sjdpdnl Some non-ANSI preprocessors botch requoting inside strings.  That's bad
2138889Sjdpdnl enough, but on some of those systems, the assert macro relies on requoting
2238889Sjdpdnl working properly!
2338889Sjdpdnl GAS_WORKING_ASSERT
2438889SjdpAC_DEFUN(GAS_WORKING_ASSERT,
2538889Sjdp[AC_MSG_CHECKING([for working assert macro])
2638889SjdpAC_CACHE_VAL(gas_cv_assert_ok,
2738889SjdpAC_TRY_LINK([#include <assert.h>
2838889Sjdp#include <stdio.h>], [
2938889Sjdp/* check for requoting problems */
3038889Sjdpstatic int a, b, c, d;
3138889Sjdpstatic char *s;
3238889Sjdpassert (!strcmp(s, "foo bar baz quux"));
3338889Sjdp/* check for newline handling */
3438889Sjdpassert (a == b
3538889Sjdp        || c == d);
3638889Sjdp], gas_cv_assert_ok=yes, gas_cv_assert_ok=no))dnl
3738889SjdpAC_MSG_RESULT($gas_cv_assert_ok)
3838889Sjdptest $gas_cv_assert_ok = yes || AC_DEFINE(BROKEN_ASSERT)
3938889Sjdp])dnl
4038889Sjdpdnl
4138889Sjdpdnl Since many Bourne shell implementations lack subroutines, use this
4238889Sjdpdnl hack to simplify the code in configure.in.
4338889Sjdpdnl GAS_UNIQ(listvar)
4438889SjdpAC_DEFUN(GAS_UNIQ,
4538889Sjdp[_gas_uniq_list="[$]$1"
4638889Sjdp_gas_uniq_newlist=""
4738889Sjdpdnl Protect against empty input list.
4838889Sjdpfor _gas_uniq_i in _gas_uniq_dummy [$]_gas_uniq_list ; do
4938889Sjdp  case [$]_gas_uniq_i in
5038889Sjdp  _gas_uniq_dummy) ;;
5138889Sjdp  *) case " [$]_gas_uniq_newlist " in
5238889Sjdp       *" [$]_gas_uniq_i "*) ;;
5338889Sjdp       *) _gas_uniq_newlist="[$]_gas_uniq_newlist [$]_gas_uniq_i" ;;
5438889Sjdp     esac ;;
5538889Sjdp  esac
5638889Sjdpdone
5738889Sjdp$1=[$]_gas_uniq_newlist
5838889Sjdp])dnl
59