Debian Codegraph @

m4/ax_check_framework.m4

raw
1 dnl ax_check_framework.m4
2 dnl
3 dnl COPYRIGHT (c) 2008 John Reppy (http://cs.uchicago.edu/~jhr)
4 dnl All rights reserved.
5 dnl
6 dnl @synopsis AX_CHECK_FRAMEWORK(framework, [action-if-found], [action-if-not-found])
7 dnl
8 dnl This macro is similar to the AC_CHECK_LIB macro, except that it works
9 dnl for macOS frameworks. It checks to see if the given framework exists
10 dnl on the host system and if so prepends "-framework framework" to the FRAMEWORKS
11 dnl variable.
12 dnl
13 dnl @author John Reppy <http://cs.uchicago.edu/~jhr>
14 dnl
15 AC_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