]> git.saurik.com Git - cycript.git/blob - framework.m4
Preempt accidental fall-through setting properties.
[cycript.git] / framework.m4
1 # AC_CHECK_FRAMEWORK(FRAMEWORK, PROLOGUE, BODY,
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])
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.
25 AC_DEFUN([AC_CHECK_FRAMEWORK], [
26 m4_ifval([$4], , [AH_CHECK_FRAMEWORK([$1])])dnl
27 AS_LITERAL_IF([$1], [AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])],
28 [AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1''])]
29 )dnl
30 AC_CACHE_CHECK([for framework $1], ac_Framework, [
31 ac_check_framework_save_LIBS=$LIBS
32 LIBS="-framework $1 $6 $LIBS"
33 AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], [$3])],[
34 AS_VAR_SET(ac_Framework, yes)
35 ], [AS_VAR_SET(ac_Framework, no)])
36 LIBS=$ac_check_framework_save_LIBS]
37 )
38 AS_IF([test AS_VAR_GET(ac_Framework) = yes], [
39 AC_LIB_APPENDTOVAR([LIBS], ["-framework $1 $LIBS"])
40 m4_default([$4], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FRAMEWORK_$1))])
41 ], [$5])dnl
42 AS_VAR_POPDEF([ac_Framework])dnl
43 ])# AC_CHECK_FRAMEWORK
44
45 # AH_CHECK_FRAMEWORK(FRAMEWORK)
46 # ---------------------
47 m4_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[).]
50 )])