1dnl ax_check_framework.m4
2dnl
3dnl COPYRIGHT (c) 2008 John Reppy (http://cs.uchicago.edu/~jhr)
4dnl All rights reserved.
5dnl
6dnl @synopsis AX_CHECK_FRAMEWORK(framework, [action-if-found], [action-if-not-found])
7dnl
8dnl This macro is similar to the AC_CHECK_LIB macro, except that it works
9dnl for Mac OS X frameworks.  It checks to see if the given framework exists
10dnl on the host sytem and if so prepends "-framework framework" to the FRAMEWORKS
11dnl variable.
12dnl
13dnl @author John Reppy <http://cs.uchicago.edu/~jhr>
14dnl
15AC_DEFUN([AX_CHECK_FRAMEWORK],[
16  AC_REQUIRE([AC_CANONICAL_HOST])dnl
17  case x"$host_os" in
18    xdarwin*)
19      AS_VAR_PUSHDEF([ax_Check], [ax_cv_check_$1])
20      AC_CACHE_CHECK([for framework $1], [ax_Check],[
21	AC_LANG_PUSH([C])
22	ac_check_framework_save_LIBS=$LIBS
23	LIBS="-framework $1 $LIBS"
24	AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [ax_Check="yes"], [ax_Check="no"])
25	AC_LANG_POP([C])dnl
26      ])
27      if test x"$ax_Check" = "xyes" ; then
28	m4_ifvaln([$2],[$2],[:])dnl
29      else
30	m4_ifvaln([$3],[$3],[:])dnl
31      fi
32      LIBS=$ac_check_framework_save_LIBS
33      AS_VAR_POPDEF([ax_Check])dnl
34    ;;
35  esac
36])dnl
37