1dnl
2dnl Check whether _Unwind_GetIPInfo is available without doing a link
3dnl test so we can use this with libstdc++-v3 and libjava.  Need to
4dnl use $target to set defaults because automatic checking is not possible
5dnl without a link test (and maybe even with a link test).
6dnl
7
8AC_DEFUN([GCC_CHECK_UNWIND_GETIPINFO], [
9  AC_ARG_WITH(system-libunwind,
10  [  --with-system-libunwind use installed libunwind])
11  # If system-libunwind was not specifically set, pick a default setting.
12  if test x$with_system_libunwind = x; then
13    case ${target} in
14      ia64-*-hpux*) with_system_libunwind=yes ;;
15      *) with_system_libunwind=no ;;
16    esac
17  fi
18  # Based on system-libunwind and target, do we have ipinfo?
19  if  test x$with_system_libunwind = xyes; then
20    case ${target} in
21      ia64-*-*) have_unwind_getipinfo=no ;;
22      *) have_unwind_getipinfo=yes ;;
23    esac
24  else
25    # Darwin before version 9 does not have _Unwind_GetIPInfo.
26    changequote(,)
27    case ${target} in
28      *-*-darwin[3-8]|*-*-darwin[3-8].*) have_unwind_getipinfo=no ;;
29      *) have_unwind_getipinfo=yes ;;
30    esac
31    changequote([,])
32  fi
33
34  if test x$have_unwind_getipinfo = xyes; then
35    AC_DEFINE(HAVE_GETIPINFO, 1, [Define if _Unwind_GetIPInfo is available.])
36  fi
37])
38
39# ACX_PROG_CC_WARNING_OPTS(WARNINGS, [VARIABLE = WARN_CFLAGS])
40#   Sets @VARIABLE@ to the subset of the given options which the
41#   compiler accepts.
42AC_DEFUN([ACX_PROG_CC_WARNING_OPTS],
43[AC_REQUIRE([AC_PROG_CC])dnl
44AC_LANG_PUSH(C)
45m4_pushdef([acx_Var], [m4_default([$2], [WARN_CFLAGS])])dnl
46AC_SUBST(acx_Var)dnl
47m4_expand_once([acx_Var=
48],m4_quote(acx_Var=))dnl
49save_CFLAGS="$CFLAGS"
50for real_option in $1; do
51  # Do the check with the no- prefix removed since gcc silently
52  # accepts any -Wno-* option on purpose
53  case $real_option in
54    -Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;;
55    *) option=$real_option ;;
56  esac
57  AS_VAR_PUSHDEF([acx_Woption], [acx_cv_prog_cc_warning_$option])
58  AC_CACHE_CHECK([whether $CC supports $option], acx_Woption,
59    [CFLAGS="$option"
60    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
61      [AS_VAR_SET(acx_Woption, yes)],
62      [AS_VAR_SET(acx_Woption, no)])
63  ])
64  AS_IF([test AS_VAR_GET(acx_Woption) = yes],
65        [acx_Var="$acx_Var${acx_Var:+ }$real_option"])
66  AS_VAR_POPDEF([acx_Woption])dnl
67done
68CFLAGS="$save_CFLAGS"
69m4_popdef([acx_Var])dnl
70AC_LANG_POP(C)
71])# ACX_PROG_CC_WARNING_OPTS
72
73