blob: ef7f375058a3e444d6c8ac8900376466b5c19c98 [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001# AC_CHECK_FRAMEWORK(FRAMEWORK, FUNCTION,
2# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
3# [OTHER-LIBRARIES])
4# ------------------------------------------------------
5#
6# Use a cache variable name containing both the framework and function name,
7# because the test really is for framework $1 defining function $2, not
8# just for framework $1. Separate tests with the same $1 and different $2s
9# may have different results.
10#
11# Note that using directly AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1_$2])
12# is asking for troubles, since AC_CHECK_FRAMEWORK($framework, fun) would give
13# ac_cv_framework_$framework_fun, which is definitely not what was meant. Hence
14# the AS_LITERAL_IF indirection.
15#
16# FIXME: This macro is extremely suspicious. It DEFINEs unconditionally,
17# whatever the FUNCTION, in addition to not being a *S macro. Note
18# that the cache does depend upon the function we are looking for.
19#
20# It is on purpose we used `ac_check_framework_save_LIBS' and not just
21# `ac_save_LIBS': there are many macros which don't want to see `LIBS'
22# changed but still want to use AC_CHECK_FRAMEWORK, so they save `LIBS'.
23# And ``ac_save_LIBS' is too tempting a name, so let's leave them some
24# freedom.
25AC_DEFUN([AC_CHECK_FRAMEWORK],
26[m4_ifval([$3], , [AH_CHECK_FRAMEWORK([$1])])dnl
27AS_LITERAL_IF([$1],
28 [AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1_$2])],
29 [AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1''_$2])])dnl
30AC_CACHE_CHECK([for $2 in $1 framework], ac_Framework,
31[ac_check_framework_save_LIBS=$LIBS
32LIBS="-framework $1 $5 $LIBS"
33AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],
34 [AS_VAR_SET(ac_Framework, yes)],
35 [AS_VAR_SET(ac_Framework, no)])
36LIBS=$ac_check_framework_save_LIBS])
37AS_IF([test AS_VAR_GET(ac_Framework) = yes],
38 [m4_default([$3], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FRAMEWORK_$1))
39 LIBS="-framework $1 $LIBS"
40])],
41 [$4])dnl
42AS_VAR_POPDEF([ac_Framework])dnl
43])# AC_CHECK_FRAMEWORK
44
45# AH_CHECK_FRAMEWORK(FRAMEWORK)
46# ---------------------
47m4_define([AH_CHECK_FRAMEWORK],
48[AH_TEMPLATE(AS_TR_CPP(HAVE_FRAMEWORK_$1),
49 [Define to 1 if you have the `]$1[' framework (-framework ]$1[).])])