]> granicus.if.org Git - imagemagick/blob - m4/framework.m4
https://github.com/ImageMagick/ImageMagick/issues/876
[imagemagick] / m4 / framework.m4
1 #  http://svn.saurik.com/repos/cycript/trunk/framework.m4
2 #
3 #                    GNU LESSER GENERAL PUBLIC LICENSE
4 #                        Version 3, 29 June 2007
5
6 #  Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
7 #  Everyone is permitted to copy and distribute verbatim copies
8 #  of this license document, but changing it is not allowed.
9
10
11 #   This version of the GNU Lesser General Public License incorporates
12 # the terms and conditions of version 3 of the GNU General Public
13 # License, supplemented by the additional permissions listed below.
14
15 #   0. Additional Definitions.
16
17 #   As used herein, "this License" refers to version 3 of the GNU Lesser
18 # General Public License, and the "GNU GPL" refers to version 3 of the GNU
19 # General Public License.
20
21 #   "The Library" refers to a covered work governed by this License,
22 # other than an Application or a Combined Work as defined below.
23
24 #   An "Application" is any work that makes use of an interface provided
25 # by the Library, but which is not otherwise based on the Library.
26 # Defining a subclass of a class defined by the Library is deemed a mode
27 # of using an interface provided by the Library.
28
29 #   A "Combined Work" is a work produced by combining or linking an
30 # Application with the Library.  The particular version of the Library
31 # with which the Combined Work was made is also called the "Linked
32 # Version".
33
34 #   The "Minimal Corresponding Source" for a Combined Work means the
35 # Corresponding Source for the Combined Work, excluding any source code
36 # for portions of the Combined Work that, considered in isolation, are
37 # based on the Application, and not on the Linked Version.
38
39 #   The "Corresponding Application Code" for a Combined Work means the
40 # object code and/or source code for the Application, including any data
41 # and utility programs needed for reproducing the Combined Work from the
42 # Application, but excluding the System Libraries of the Combined Work.
43
44 #   1. Exception to Section 3 of the GNU GPL.
45
46 #   You may convey a covered work under sections 3 and 4 of this License
47 # without being bound by section 3 of the GNU GPL.
48
49 #   2. Conveying Modified Versions.
50
51 #   If you modify a copy of the Library, and, in your modifications, a
52 # facility refers to a function or data to be supplied by an Application
53 # that uses the facility (other than as an argument passed when the
54 # facility is invoked), then you may convey a copy of the modified
55 # version:
56
57 #    a) under this License, provided that you make a good faith effort to
58 #    ensure that, in the event an Application does not supply the
59 #    function or data, the facility still operates, and performs
60 #    whatever part of its purpose remains meaningful, or
61
62 #    b) under the GNU GPL, with none of the additional permissions of
63 #    this License applicable to that copy.
64
65 #   3. Object Code Incorporating Material from Library Header Files.
66
67 #   The object code form of an Application may incorporate material from
68 # a header file that is part of the Library.  You may convey such object
69 # code under terms of your choice, provided that, if the incorporated
70 # material is not limited to numerical parameters, data structure
71 # layouts and accessors, or small macros, inline functions and templates
72 # (ten or fewer lines in length), you do both of the following:
73
74 #    a) Give prominent notice with each copy of the object code that the
75 #    Library is used in it and that the Library and its use are
76 #    covered by this License.
77
78 #    b) Accompany the object code with a copy of the GNU GPL and this license
79 #    document.
80
81 #   4. Combined Works.
82
83 #   You may convey a Combined Work under terms of your choice that,
84 # taken together, effectively do not restrict modification of the
85 # portions of the Library contained in the Combined Work and reverse
86 # engineering for debugging such modifications, if you also do each of
87 # the following:
88
89 #    a) Give prominent notice with each copy of the Combined Work that
90 #    the Library is used in it and that the Library and its use are
91 #    covered by this License.
92
93 #    b) Accompany the Combined Work with a copy of the GNU GPL and this license
94 #    document.
95
96 #    c) For a Combined Work that displays copyright notices during
97 #    execution, include the copyright notice for the Library among
98 #    these notices, as well as a reference directing the user to the
99 #    copies of the GNU GPL and this license document.
100
101 #    d) Do one of the following:
102
103 #        0) Convey the Minimal Corresponding Source under the terms of this
104 #        License, and the Corresponding Application Code in a form
105 #        suitable for, and under terms that permit, the user to
106 #        recombine or relink the Application with a modified version of
107 #        the Linked Version to produce a modified Combined Work, in the
108 #        manner specified by section 6 of the GNU GPL for conveying
109 #        Corresponding Source.
110
111 #        1) Use a suitable shared library mechanism for linking with the
112 #        Library.  A suitable mechanism is one that (a) uses at run time
113 #        a copy of the Library already present on the user's computer
114 #        system, and (b) will operate properly with a modified version
115 #        of the Library that is interface-compatible with the Linked
116 #        Version.
117
118 #    e) Provide Installation Information, but only if you would otherwise
119 #    be required to provide such information under section 6 of the
120 #    GNU GPL, and only to the extent that such information is
121 #    necessary to install and execute a modified version of the
122 #    Combined Work produced by recombining or relinking the
123 #    Application with a modified version of the Linked Version. (If
124 #    you use option 4d0, the Installation Information must accompany
125 #    the Minimal Corresponding Source and Corresponding Application
126 #    Code. If you use option 4d1, you must provide the Installation
127 #    Information in the manner specified by section 6 of the GNU GPL
128 #    for conveying Corresponding Source.)
129
130 #   5. Combined Libraries.
131
132 #   You may place library facilities that are a work based on the
133 # Library side by side in a single library together with other library
134 # facilities that are not Applications and are not covered by this
135 # License, and convey such a combined library under terms of your
136 # choice, if you do both of the following:
137
138 #    a) Accompany the combined library with a copy of the same work based
139 #    on the Library, uncombined with any other library facilities,
140 #    conveyed under the terms of this License.
141
142 #    b) Give prominent notice with the combined library that part of it
143 #    is a work based on the Library, and explaining where to find the
144 #    accompanying uncombined form of the same work.
145
146 #   6. Revised Versions of the GNU Lesser General Public License.
147
148 #   The Free Software Foundation may publish revised and/or new versions
149 # of the GNU Lesser General Public License from time to time. Such new
150 # versions will be similar in spirit to the present version, but may
151 # differ in detail to address new problems or concerns.
152
153 #   Each version is given a distinguishing version number. If the
154 # Library as you received it specifies that a certain numbered version
155 # of the GNU Lesser General Public License "or any later version"
156 # applies to it, you have the option of following the terms and
157 # conditions either of that published version or of any later version
158 # published by the Free Software Foundation. If the Library as you
159 # received it does not specify a version number of the GNU Lesser
160 # General Public License, you may choose any version of the GNU Lesser
161 # General Public License ever published by the Free Software Foundation.
162
163 #   If the Library as you received it specifies that a proxy can decide
164 # whether future versions of the GNU Lesser General Public License shall
165 # apply, that proxy's public statement of acceptance of any version is
166 # permanent authorization for you to choose that version for the
167 # Library.
168
169 # AC_CHECK_FRAMEWORK(FRAMEWORK, FUNCTION,
170 #              [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
171 #              [OTHER-LIBRARIES])
172 # ------------------------------------------------------
173 #
174 # Use a cache variable name containing both the framework and function name,
175 # because the test really is for framework $1 defining function $2, not
176 # just for framework $1.  Separate tests with the same $1 and different $2s
177 # may have different results.
178 #
179 # Note that using directly AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1_$2])
180 # is asking for troubles, since AC_CHECK_FRAMEWORK($framework, fun) would give
181 # ac_cv_framework_$framework_fun, which is definitely not what was meant.  Hence
182 # the AS_LITERAL_IF indirection.
183 #
184 # FIXME: This macro is extremely suspicious.  It DEFINEs unconditionally,
185 # whatever the FUNCTION, in addition to not being a *S macro.  Note
186 # that the cache does depend upon the function we are looking for.
187 #
188 # It is on purpose we used `ac_check_framework_save_LIBS' and not just
189 # `ac_save_LIBS': there are many macros which don't want to see `LIBS'
190 # changed but still want to use AC_CHECK_FRAMEWORK, so they save `LIBS'.
191 # And ``ac_save_LIBS' is too tempting a name, so let's leave them some
192 # freedom.
193 AC_DEFUN([AC_CHECK_FRAMEWORK],
194 [m4_ifval([$3], , [AH_CHECK_FRAMEWORK([$1])])dnl
195 AS_LITERAL_IF([$1],
196          [AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1_$2])],
197          [AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1''_$2])])dnl
198 AC_CACHE_CHECK([for $2 in $1 framework], ac_Framework,
199 [ac_check_framework_save_LIBS=$LIBS
200 LIBS="-framework $1 $5 $LIBS"
201 AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],
202           [AS_VAR_SET(ac_Framework, yes)],
203           [AS_VAR_SET(ac_Framework, no)])
204 LIBS=$ac_check_framework_save_LIBS])
205 AS_IF([test AS_VAR_GET(ac_Framework) = yes],
206       [m4_default([$3], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FRAMEWORK_$1))
207   LIBS="-framework $1 $LIBS"
208 ])],
209       [$4])dnl
210 AS_VAR_POPDEF([ac_Framework])dnl
211 ])# AC_CHECK_FRAMEWORK
212
213 # AH_CHECK_FRAMEWORK(FRAMEWORK)
214 # ---------------------
215 m4_define([AH_CHECK_FRAMEWORK],
216 [AH_TEMPLATE(AS_TR_CPP(HAVE_FRAMEWORK_$1),
217         [Define to 1 if you have the `]$1[' framework (-framework ]$1[).])])