1# Macro to test for OS X Frameworks.
2# Taken from: http://lists.apple.com/archives/unix-porting/2009/Jan/msg00029.html
3# Retrieved on 24-10-2013.
4# Original Author: Peter O'Gorman.
5#
6# Example Usage:
7#   AX_CHECK_FRAMEWORK([IOKit])
8# Defines:
9#   HAVE_FRAMEWORK_IOKIT in config.h
10# And substitutes in your Makefiles.
11#   FRAMEWORK_IOKIT="-framework IOKit"
12
13m4_defun([AX_CHECK_FRAMEWORK],
14  [AC_CACHE_CHECK([if -framework ]$1[ works],[my_cv_framework_]$1,
15     [save_LIBS="$LIBS"
16     LIBS="$LIBS -framework ]$1["
17     AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
18             [my_cv_framework_]$1[=yes],
19            [my_cv_framework_]$1[=no])
20    ])
21   LIBS="$save_LIBS"
22   if test "$my_cv_framework_]$1["="yes"; then
23       AC_DEFINE(AS_TR_CPP([HAVE_FRAMEWORK_]$1),1,
24            [Define if you have the ] $1 [ framework])
25   AS_TR_CPP([FRAMEWORK_]$1)="-framework ]$1["
26   AC_SUBST([FRAMEWORK_]AS_TR_CPP($1))
27   fi])
28