1 dnl configure.in.fns --
2 dnl
3 dnl autoconf rules to find things in general
4 dnl
5 dnl Copyright (c) 2000-2002 The Regents of the University of California.
6 dnl All rights reserved.
7 dnl
8 dnl Redistribution and use in source and binary forms, with or without
9 dnl modification, are permitted provided that the following conditions are met:
10 dnl
11 dnl A. Redistributions of source code must retain the above copyright notice,
12 dnl this list of conditions and the following disclaimer.
13 dnl B. Redistributions in binary form must reproduce the above copyright
14 dnl notice, this list of conditions and the following disclaimer in the
15 dnl documentation and/or other materials provided with the distribution.
16 dnl C. Neither the names of the copyright holders nor the names of its
17 dnl contributors may be used to endorse or promote products derived from
18 dnl this software without specific prior written permission.
19 dnl
20 dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
21 dnl IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 dnl THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 dnl PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
24 dnl LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 dnl CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 dnl SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 dnl CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 dnl ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 dnl POSSIBILITY OF SUCH DAMAGE.
31
32
33 dnl
34 dnl General approach to using these macros:
35 dnl
36 dnl bracket a group of them that must succeed or fail together
37 dnl with NS_BEGIN_PACKAGE(s)/NS_END_PACKAGE(s).
38 dnl In between put NS_CHECK_{LIB,HEADER}_PATH().
39 dnl Custom checks can call NS_PACKAGE_NOT_COMPLETE(s) if something's wrong.
40 dnl
41 dnl See configure.in.dmalloc for an example.
42 dnl
43 dnl These macros add their stuff to V_LIBS, V_INCLUDES, V_DEFINES.
44 dnl You should add them to your Makefile.in
45 dnl You also need to put NS_FNS_TAIL in your configure.in
46 dnl (typically just before including configure.in.tail).
47 dnl
48 dnl
49
50
51 dnl
52 dnl NS_BEGIN_PACKAGE(NAME)
53 dnl
54 dnl (Internally, _UNDERWAY says that we found some part of it,
55 dnl _COMPLETE says we've got all of it.)
56 dnl
57 AC_DEFUN(NS_BEGIN_PACKAGE,
58 [
59 NS_PACKAGE_[$1]_UNDERWAY=false
60 NS_PACKAGE_[$1]_COMPLETE=true
61 ])
62
63 dnl
64 dnl If a test fails, call NS_PACKAGE_NOT_COMPLETE(NAME) to cause NS_END_PACKAGE to
65 dnl eventually die.
66 dnl
67 AC_DEFUN(NS_PACKAGE_NOT_COMPLETE,
68 [
69 NS_PACKAGE_[$1]_COMPLETE=false
70 ])
71
72 dnl
73 dnl NS_END_PACKAGE(NAME,REQUIRED)
74 dnl REQUIRED should be "yes" or "no"
75 dnl
76 AC_DEFUN(NS_END_PACKAGE,
77 [
78 NS_PACKAGE_[$1]_VALID=false
79 if $NS_PACKAGE_[$1]_UNDERWAY; then
80 if $NS_PACKAGE_[$1]_COMPLETE; then
81 : [All components of $1 found.]
82 NS_PACKAGE_[$1]_VALID=true
83 else
84 AC_MSG_ERROR([Installation of $1 seems incomplete or can't be found automatically.
85 Please correct the problem by telling configure where $1 is
86 using the argument --with-$1=/path/to/package
87 (perhaps after installing it),
88 or the package is not required, disable it with --with-$1=no.])
89 fi
90 fi
91 if test "x$2" = xyes; then
92 if $NS_PACKAGE_[$1]_VALID; then
93 :
94 else
95 AC_MSG_ERROR([$1 is required but could not be completely found.
96 Please correct the problem by telling configure where $1 is
97 using the argument --with-$1=/path/to/package,
98 or the package is not required, disable it with --with-$1=no.])
99 fi
100 fi
101 ])
102
103 dnl
104 dnl NS_CHECK_LIB_PATH(LIBRARY,PATH,SUGGESTION,SUGGESTION_PATH,VARIABLE,PACKAGE)
105 dnl LIBRARY should be with a dotted version number but without a .a extension
106 dnl PATH is whitespace separated
107 dnl SUGGESTION, no disables, "" or "yes" enables, otherwise search SUGGESTION_PATH
108 dnl SUGGESTION_PATH
109 dnl sets VARIABLE to be the include stuff
110 dnl PACKAGE is the name specified in NS_{BEGIN,END}_PACKAGE or "no"
111 dnl
112 dnl Automatically adds it to V_LIBS and adds a -DHAVE_LIBLIBRARY to V_DEFINES
113 dnl
114
115 AC_DEFUN(NS_CHECK_LIB_PATH,
116 [
117 AC_MSG_CHECKING([for lib$1])
118 if test "x$3" = "xno"; then
119 : disable library
120 $5=FAIL
121 NS_PACKAGE_NOT_COMPLETE($6)
122 AC_MSG_RESULT(no)
123
124 else
125 places="$2"
126 if test "x$3" != "x" -a "x$3" != xyes; then
127 if test ! -d $3; then
128 AC_MSG_ERROR($3 is not a directory)
129 fi
130 places="$4"
131 fi
132
133 $5=""
134 dnl full_lib_name is libtcl7.6
135 full_lib_name="$1"
136 dnl simple_lib_name is libtcl76
137 simple_lib_name=`echo $full_lib_name | sed -e 's/\.//'`
138 dnl other_simple_lib_name is libtcl7_6
139 other_simple_lib_name=`echo $full_lib_name | sed -e 's/\./_/'`
140 dnl simpler_lib_name is libtcl
141 simpler_lib_name=`echo $simple_lib_name | sed -e 'y/0123456789/ /'`
142 double_break=false
143 for dir in $places; do
144 for file in $full_lib_name $simple_lib_name $other_simple_lib_name $simpler_lib_name
145 do
146 if test -r $dir/lib$file.so -o -r $dir/lib$file.a; then
147 $5="-L$dir -l$file"
148 double_break=true
149 break
150 fi
151 done
152 if $double_break; then
153 break
154 fi
155 done
156 if test "FAIL$[$5]" = "FAIL" ; then
157 NS_PACKAGE_NOT_COMPLETE($6)
158 AC_MSG_RESULT(no)
159 else
160 if test "$solaris"; then
161 $5="-R$dir $[$5]"
162 fi
163
164 changequote(, )dnl
165 ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
166 -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
167 changequote([, ])dnl
168 AC_DEFINE_UNQUOTED($ac_tr_lib)
169
170 dnl add to list
171 V_LIBS="$[$5] $V_LIBS"
172 V_DEFINES="-D$ac_tr_lib $V_DEFINES"
173
174 NS_PACKAGE_[$6]_UNDERWAY=true
175
176 AC_MSG_RESULT($[$5])
177 fi
178 fi
179 ])
180
181
182
183 dnl
184 dnl NS_CHECK_HEADER_PATH(HEADER,PATH,SUGGESTION,SUGGESTION_PATH,VARIABLE,PACKAGE)
185 dnl HEADER should be file with an extension
186 dnl PATH is whitespace separated
187 dnl SUGGESTION, no disables, "" or "yes" enables, otherwise search SUGGESTION_PATH
188 dnl SUGGESTION_PATH
189 dnl sets VARIABLE to be the include stuff
190 dnl PACKAGE is the name specified in NS_{BEGIN,END}_PACKAGE or "no"
191 dnl
192 dnl Automatically adds it to V_INCLUDES and adds a -DHAVE_HEADER to V_DEFINES
193 dnl
194
195 AC_DEFUN(NS_CHECK_HEADER_PATH,
196 [
197 AC_MSG_CHECKING([for $1])
198 if test "x$3" = "xno"; then
199 : disable header
200 $5=FAIL
201 NS_PACKAGE_NOT_COMPLETE($6)
202 AC_MSG_RESULT(no)
203
204 else
205 places="$2"
206 if test "x$3" != "x" -a "x$3" != xyes; then
207 if test ! -d $3; then
208 AC_MSG_ERROR($3 is not a directory)
209 fi
210 places="$4"
211 fi
212
213 $5=""
214 for dir in $places; do
215 if test -r $dir/$1; then
216 $5="-I$dir"
217 break
218 fi
219 done
220 if test "FAIL$[$5]" = "FAIL" ; then
221 NS_PACKAGE_NOT_COMPLETE($6)
222 AC_MSG_RESULT(no)
223 else
224
225 changequote(, )dnl
226 ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
227 changequote([, ])dnl
228 AC_DEFINE_UNQUOTED($ac_tr_hdr)
229
230 V_INCLUDES="$[$5] $V_INCLUDES"
231 V_DEFINES="-D$ac_tr_hdr $V_DEFINES"
232
233 NS_PACKAGE_[$6]_UNDERWAY=true
234
235 AC_MSG_RESULT($[$5])
236 fi
237 fi
238 ])
239
240
241 dnl
242 dnl NS_CHECK_ANY_PATH(ANY,PATH,SUGGESTION,SUGGESTION_PATH,VARIABLE,PACKAGE)
243 dnl ANY shoudl be the file
244 dnl PATH is whitespace separated
245 dnl SUGGESTION, no disables, "" or "yes" enables, otherwise search SUGGESTION_PATH
246 dnl SUGGESTION_PATH
247 dnl sets VARIABLE to be the include stuff
248 dnl PACKAGE is the name specified in NS_{BEGIN,END}_PACKAGE or "no"
249 dnl
250
251 AC_DEFUN(NS_CHECK_ANY_PATH,
252 [
253 AC_MSG_CHECKING([for $1])
254 if test "x$3" = "xno"; then
255 : disable header
256 $5=FAIL
257 NS_PACKAGE_NOT_COMPLETE($6)
258 AC_MSG_RESULT(no)
259
260 else
261 places="$2"
262 if test "x$3" != "x" -a "x$3" != xyes; then
263 if test ! -d $3; then
264 AC_MSG_ERROR($3 is not a directory)
265 fi
266 places="$4"
267 fi
268
269 $5=""
270 for dir in $places; do
271 if test -r $dir/$1; then
272 $5="$dir"
273 break
274 fi
275 done
276 if test "FAIL$[$5]" = "FAIL" ; then
277 NS_PACKAGE_NOT_COMPLETE($6)
278 AC_MSG_RESULT(no)
279 else
280
281 NS_PACKAGE_[$6]_UNDERWAY=true
282
283 AC_MSG_RESULT($[$5])
284 fi
285 fi
286 ])
287
288
289 dnl
290 dnl check for ip_mreq_source for Linux versions which
291 dnl messed up their <netinfo/in.h>
292 dnl
293 AC_CHECK_TYPES([struct ip_mreq_source],
294 AC_DEFINE(HAVE_IGMP_V3, [1], [IGMPv3 definition]),
295 , [#include <netinet/in.h>])
296
297 dnl
298 dnl Final stuff for fns
299 dnl
300 AC_DEFUN(NS_FNS_TAIL,
301 [
302 AC_SUBST(V_INCLUDES)
303 AC_SUBST(V_LIBS)
304 AC_SUBST(V_DEFINES)
305 dnl AC_SUBST(V_OBJS)
306 ])
307
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.