Wed, 07 Jan 2009 18:49:25 +0100
Bump copyright year number.
1 ##
2 ## OSSP asgui - Accounting system graphical user interface
3 ## Copyright (c) 2002-2009 The OSSP Project (http://www.ossp.org/)
4 ## Copyright (c) 2002-2009 Ralf S. Engelschall <rse@engelschall.com>
5 ## Copyright (c) 2002-2009 Michael Schloh von Bennewitz <michael@schloh.com>
6 ## Copyright (c) 2002-2009 Cable & Wireless Telecommunications Services GmbH
7 ##
8 ## This file is part of OSSP GUI, a graphical user interface
9 ## for OSSP which can be found at http://asgui.europalab.com/
10 ##
11 ## Permission to use, copy, modify, and distribute this software for
12 ## any purpose with or without fee is hereby granted, provided that
13 ## the above copyright notice and this permission notice appear in all
14 ## copies.
15 ##
16 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
17 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
20 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 ## SUCH DAMAGE.
28 ##
29 ## aclocal.m4: Autoconf M4 macros
30 ##
33 dnl ##
34 dnl ## Look for SIOCGIFHWADDR
35 dnl ##
37 AC_DEFUN(AC_CHECK_SIOCGIFHWADDR,[
38 AC_MSG_CHECKING(whether <sys/ioctl.h> has SIOCGIFHWADDR)
39 AC_TRY_COMPILE([#include <sys/sockio.h>
40 #include <sys/ioctl.h>
41 ], [
42 int i = SIOCGIFHWADDR;
43 return 0;],
44 AC_DEFINE(HAVE_SIOCGIFHWADDR, 1, [Define to 1 if <sys/ioctl.h> defines or includes SIOCGIFHWADDR.]),
45 AC_MSG_RESULT([no]),
46 AC_MSG_RESULT([yes]))
47 ])dnl
50 dnl ##
51 dnl ## Look for SIOCGIFCONF
52 dnl ##
54 AC_DEFUN(AC_CHECK_SIOCGIFCONF,[
55 AC_MSG_CHECKING(whether <sys/ioctl.h> has SIOCGIFCONF)
56 AC_TRY_COMPILE([#include <sys/sockio.h>
57 #include <sys/ioctl.h>
58 ], [
59 int i = SIOCGIFCONF;
60 return 0;],
61 AC_DEFINE(HAVE_SIOCGIFCONF, 1, [Define to 1 if <sys/ioctl.h> defines or includes SIOCGIFCONF.]),
62 AC_MSG_RESULT([no]),
63 AC_MSG_RESULT([yes]))
64 ])dnl
67 dnl ##
68 dnl ## Look for SIOGHWADDR
69 dnl ##
71 AC_DEFUN(AC_CHECK_SIOGHWADDR,[
72 AC_MSG_CHECKING(whether <sys/ioctl.h> has SIOGHWADDR)
73 AC_TRY_COMPILE([#include <sys/sockio.h>
74 #include <sys/ioctl.h>
75 ], [
76 int i = SIOGHWADDR;
77 return 0;],
78 AC_DEFINE(HAVE_SIOGHWADDR, 1, [Define to 1 if <sys/ioctl.h> defines or includes SIOGHWADDR.]),
79 AC_MSG_RESULT([no]),
80 AC_MSG_RESULT([yes]))
81 ])dnl
84 dnl ##
85 dnl ## Look for SIOCGENADDR
86 dnl ##
88 AC_DEFUN(AC_CHECK_SIOCGENADDR,[
89 AC_MSG_CHECKING(whether <sys/ioctl.h> has SIOCGENADDR)
90 AC_TRY_COMPILE([#include <sys/sockio.h>
91 #include <sys/ioctl.h>
92 ], [
93 int i = SIOCGENADDR;
94 return 0;],
95 AC_DEFINE(HAVE_SIOCGENADDR, 1, [Define to 1 if <sys/ioctl.h> defines or includes SIOCGENADDR.]),
96 AC_MSG_RESULT([no]),
97 AC_MSG_RESULT([yes]))
98 ])dnl
101 dnl ##
102 dnl ## Check for sa_len member of the sockaddr
103 dnl ## structure found in BSD systems
104 dnl ##
105 dnl ## configure.in:
106 dnl ## AC_STRUCT_SA_LEN
107 dnl ##
109 AC_DEFUN(AC_STRUCT_SA_LEN,
110 [AC_CACHE_CHECK([for sa_len in struct sockaddr], ac_cv_struct_sa_len,
111 [AC_TRY_COMPILE([
112 #include <sys/types.h>
113 #include <sys/socket.h>
114 ],
115 [
116 struct sockaddr s;
117 s.sa_len;
118 ],
119 ac_cv_struct_sa_len=yes, ac_cv_struct_sa_len=no)])
120 if test $ac_cv_struct_sa_len = yes; then
121 AC_DEFINE(HAVE_SA_LEN, 1, [Define to 1 if your sockaddr has a sa_len member.])
122 fi
123 ])
126 dnl ##
127 dnl ## Support for Platform IDs
128 dnl ##
129 dnl ## configure.in:
130 dnl ## AC_PLATFORM(<variable>)
131 dnl ##
133 AC_DEFUN(AC_PLATFORM,[
134 if test ".$host" != .NONE && test ".$host" != .; then
135 $1="$host"
136 else
137 $1=`${CONFIG_SHELL-/bin/sh} $srcdir/config.guess`
138 fi
139 $1=`${CONFIG_SHELL-/bin/sh} $srcdir/config.sub $$1` || exit 1
140 AC_SUBST($1)
141 if test ".$enable_subdir" != .yes; then
142 echo "Platform: ${TB}${$1}${TN}"
143 fi
144 ])dnl
147 dnl ##
148 dnl ## Support for Configuration Headers
149 dnl ##
150 dnl ## configure.in:
151 dnl ## AC_HEADLINE(<short-name>, <long-name>,
152 dnl ## <vers-var>, <vers-file>,
153 dnl ## <copyright>)
154 dnl ##
156 AC_DEFUN(AC_HEADLINE,[dnl
157 # configuration header
158 if test ".`echo dummy [$]@ | grep help`" = .; then
159 # bootstrapping shtool
160 ac_prog=[$]0
161 changequote(, )dnl
162 ac_srcdir=`echo $ac_prog | sed -e 's%/[^/][^/]*$%%' -e 's%\([^/]\)/*$%\1%'`
163 changequote([, ])dnl
164 test ".$ac_srcdir" = ".$ac_prog" && ac_srcdir=.
165 ac_shtool="$ac_srcdir/shtool"
167 # find out terminal sequences
168 TB=`$ac_shtool echo -n -e %B 2>/dev/null`
169 TN=`$ac_shtool echo -n -e %b 2>/dev/null`
171 # find out package version
172 $3_STR="`$ac_shtool version -l c -d long $ac_srcdir/$4`"
173 AC_SUBST($3_STR)
175 # friendly header ;)
176 if test ".$enable_headline" != .no; then
177 echo "Configuring ${TB}$1${TN} ($2), Version ${TB}${$3_STR}${TN}"
178 echo "$5"
179 fi
181 # additionally find out hex version
182 $3_HEX="`$ac_shtool version -l c -d hex $ac_srcdir/$4`"
183 AC_SUBST($3_HEX)
184 fi
185 ])dnl
188 dnl ##
189 dnl ## Check whether compiler option works
190 dnl ##
191 dnl ## configure.in:
192 dnl ## AC_COMPILER_OPTION(<name>, <display>, <option>,
193 dnl ## <action-success>, <action-failure>)
194 dnl ##
196 AC_DEFUN(AC_COMPILER_OPTION,[dnl
197 AC_MSG_CHECKING(whether compiler option(s) $2 work)
198 AC_CACHE_VAL(ac_cv_compiler_option_$1,[
199 SAVE_CXXFLAGS="$CXXFLAGS"
200 CXXFLAGS="$CXXFLAGS $3"
201 AC_LANG(C++)
202 AC_TRY_COMPILE([],[], ac_cv_compiler_option_$1=yes, ac_cv_compiler_option_$1=no)
203 CXXFLAGS="$SAVE_CXXFLAGS"
204 ])dnl
205 if test ".$ac_cv_compiler_option_$1" = .yes; then
206 ifelse([$4], , :, [$4])
207 else
208 ifelse([$5], , :, [$5])
209 fi
210 AC_MSG_RESULT([$ac_cv_compiler_option_$1])
211 ])dnl
214 dnl ##
215 dnl ## Test for the presence of the MICO ORB
216 dnl ##
217 dnl ## configure.in:
218 dnl ## AC_TEST_MICO
219 dnl ##
221 AC_DEFUN(AC_TEST_MICO,[dnl
222 AC_ARG_WITH(mico,dnl
223 [ --with-mico=[DIR] prefix where MICO is installed], micodir=$withval,)
224 if test $micodir; then
225 AC_MSG_CHECKING(the MICO installation path)
227 dnl ## Ensure that we have a basic path to start searching
228 if test -x "$micodir";
229 then
230 CORBABASE=$micodir
231 AC_MSG_RESULT(${CORBABASE})
232 elif test -x "${MICODIR}";
233 then
234 CORBABASE="${MICODIR}"
235 AC_MSG_RESULT(${CORBABASE})
236 else
237 AC_MSG_RESULT(not found)
238 AC_MSG_ERROR([Neither \$MICODIR nor --with-mico=[DIR] paths exist])
239 fi
241 dnl ## Append paths of libs and headers
242 LIBS="$LIBS -lmico -lmicocoss -lssl -lcrypto"
243 LDFLAGS="$LDFLAGS -L${CORBABASE}/lib"
244 CPPFLAGS="$CPPFLAGS -I${CORBABASE}/include"
245 CXXCPP="$CXXCPP -I${CORBABASE}/include"
246 CXXFLAGS="$CXXFLAGS"
247 AC_DEFINE(HAVE_MICO, 1, [Define to 1 if building with the MICO ORB.])
248 fi
249 ])
252 dnl ##
253 dnl ## Test for the presence of EasySOAP
254 dnl ##
255 dnl ## configure.in:
256 dnl ## AC_TEST_ESOAP
257 dnl ##
259 AC_DEFUN(AC_TEST_ESOAP,[dnl
260 AC_ARG_WITH(esoap,dnl
261 [ --with-easysoap=[DIR] prefix where EasySOAP is installed], esoapdir=$withval,)
262 if test $esoapdir; then
263 AC_MSG_CHECKING(the EasySOAP installation path)
265 dnl ## Ensure that we have a basic path to start searching
266 if test -x "$esoapdir";
267 then
268 SOAPBASE=$esoapdir
269 AC_MSG_RESULT(${SOAPBASE})
270 elif test -x "${ESOAPDIR}";
271 then
272 SOAPBASE="${ESOAPDIR}"
273 AC_MSG_RESULT(${SOAPBASE})
274 else
275 AC_MSG_RESULT(not found)
276 AC_MSG_ERROR([Neither \$ESOAPDIR nor --with-easysoap=[DIR] paths exist])
277 fi
279 dnl ## Append paths of libs and headers
280 LIBS="$LIBS -leasysoap -lexpat -lssl -lcrypto"
281 LDFLAGS="$LDFLAGS -L${SOAPBASE}/lib"
282 CPPFLAGS="$CPPFLAGS -I${SOAPBASE}/include"
283 CXXCPP="$CXXCPP -I${SOAPBASE}/include"
284 CXXFLAGS="$CXXFLAGS"
285 AC_DEFINE(HAVE_ESOAP, 1, [Define to 1 if building with EasySOAP.])
286 fi
287 ])
290 dnl ##
291 dnl ## Check the Qt implementation path
292 dnl ##
293 dnl ## configure.in:
294 dnl ## AC_CHECK_QT
295 dnl ##
297 AC_DEFUN(AC_CHECK_QT,[dnl
298 AC_ARG_WITH(qt,dnl
299 [ --with-qt=[DIR] prefix where Qt is installed], qtdir=$withval,)
300 AC_MSG_CHECKING(the Qt installation path)
302 dnl ## Ensure that we have a basic path to start searching
303 if test -x "$qtdir";
304 then
305 QTBASE=$qtdir
306 AC_MSG_RESULT(${QTBASE})
307 elif test -x "${QTDIR}";
308 then
309 QTBASE="${QTDIR}"
310 AC_MSG_RESULT(${QTBASE})
311 else
312 AC_MSG_RESULT(not found)
313 AC_MSG_ERROR([Neither \$QTDIR nor --with-qt=[DIR] paths exist])
314 fi
316 dnl ## Append paths of libs and headers
317 if test ".$lib" != .; then
318 LIBS="$LIBS -l$lib"
319 fi
320 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs-only-L Qt3Support QtCore QtGui`"
321 CPPFLAGS="$CPPFLAGS -DQT_THREAD_SUPPORT"
322 CXXCPP="$CXXCPP -DQT_THREAD_SUPPORT"
323 CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --cflags-only-I Qt3Support QtCore QtGui`"
324 ])
327 dnl ##
328 dnl ## UIC check, should come after the Qt check
329 dnl ##
330 dnl ## configure.in:
331 dnl ## AC_CHECK_UIC
332 dnl ##
334 AC_DEFUN(AC_CHECK_UIC,[dnl
335 AC_MSG_CHECKING(UIC location)
336 if test -x ${QTBASE}/bin/uic
337 then
338 UIC=${QTBASE}/bin/uic
339 AC_MSG_RESULT(${QTBASE}/bin/uic)
340 else
341 UIC=uic
342 AC_MSG_RESULT(assumed present)
343 fi
344 ])
347 dnl ##
348 dnl ## MOC check, should come after the Qt check
349 dnl ##
350 dnl ## configure.in:
351 dnl ## AC_CHECK_MOC
352 dnl ##
354 AC_DEFUN(AC_CHECK_MOC,[dnl
355 AC_MSG_CHECKING(MOC location)
356 if test -x ${QTBASE}/bin/moc
357 then
358 MOC=${QTBASE}/bin/moc
359 AC_MSG_RESULT(${QTBASE}/bin/moc)
360 else
361 MOC=moc
362 AC_MSG_RESULT(assumed present)
363 fi
364 ])
367 dnl ## PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
368 dnl ## defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
369 dnl ## also defines GSTUFF_PKG_ERRORS on error
370 AC_DEFUN(PKG_CHECK_MODULES, [
371 succeeded=no
373 if test -z "$PKG_CONFIG"; then
374 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
375 fi
377 if test "$PKG_CONFIG" = "no" ; then
378 echo "*** The pkg-config script could not be found. Make sure it is"
379 echo "*** in your path, or set the PKG_CONFIG environment variable"
380 echo "*** to the full path to pkg-config."
381 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
382 else
383 PKG_CONFIG_MIN_VERSION=0.9.0
384 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
385 AC_MSG_CHECKING(for $2)
387 if $PKG_CONFIG --exists "$2" ; then
388 AC_MSG_RESULT(yes)
389 succeeded=yes
391 AC_MSG_CHECKING($1_CFLAGS)
392 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
393 AC_MSG_RESULT($$1_CFLAGS)
395 AC_MSG_CHECKING($1_LIBS)
396 $1_LIBS=`$PKG_CONFIG --libs "$2"`
397 AC_MSG_RESULT($$1_LIBS)
398 else
399 $1_CFLAGS=""
400 $1_LIBS=""
401 ## If we have a custom action on failure, don't print errors, but
402 ## do set a variable so people can do so.
403 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
404 ifelse([$4], ,echo $$1_PKG_ERRORS,)
405 fi
407 AC_SUBST($1_CFLAGS)
408 AC_SUBST($1_LIBS)
409 else
410 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
411 echo "*** See http://www.freedesktop.org/software/pkgconfig"
412 fi
413 fi
415 if test $succeeded = yes; then
416 ifelse([$3], , :, [$3])
417 else
418 ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
419 fi
420 ])
423 dnl ##
424 dnl ## Debugging Support
425 dnl ##
426 dnl ## configure.in:
427 dnl ## AC_CHECK_DEBUGGING
428 dnl ##
430 AC_DEFUN(AC_CHECK_DEBUGGING,[dnl
431 AC_ARG_ENABLE(debug,dnl
432 [ --enable-debug build for debugging (default=no)],
433 [dnl
434 if test ".$ac_cv_prog_gcc" = ".yes"; then
435 case "$CXXFLAGS" in
436 *-O* ) ;;
437 * ) CXXFLAGS="$CXXFLAGS -O2" ;;
438 esac
439 case "$CXXFLAGS" in
440 *-g* ) ;;
441 * ) CXXFLAGS="$CXXFLAGS -g" ;;
442 esac
443 case "$CXXFLAGS" in
444 *-pipe* ) ;;
445 * ) AC_COMPILER_OPTION(pipe, -pipe, -pipe, CXXFLAGS="$CXXFLAGS -pipe") ;;
446 esac
447 AC_COMPILER_OPTION(defdbg, -DDEBUG, -DDEBUG, CXXFLAGS="$CXXFLAGS -DDEBUG")
448 dnl AC_COMPILER_OPTION(ggdb3, -ggdb3, -ggdb3, CXXFLAGS="$CXXFLAGS -ggdb3")
449 CXXFLAGS="$CXXFLAGS -pedantic"
450 CXXFLAGS="$CXXFLAGS -Wall"
451 WMORE="-Wshadow -Wpointer-arith -Wcast-align -Winline"
452 WMORE="$WMORE -Wmissing-prototypes -Wmissing-declarations -Wnested-externs"
453 AC_COMPILER_OPTION(wmore, -W<xxx>, $WMORE, CXXFLAGS="$CXXFLAGS $WMORE")
454 AC_COMPILER_OPTION(wnolonglong, -Wno-long-long, -Wno-long-long, CXXFLAGS="$CXXFLAGS -Wno-long-long")
455 else
456 case "$CXXFLAGS" in
457 *-g* ) ;;
458 * ) CXXFLAGS="$CXXFLAGS -g" ;;
459 esac
460 fi
461 msg="enabled"
462 dnl AC_DEFINE(DEBUG, 1, [Define to 1 if you want to enable debugging])
463 ],[
464 if test ".$ac_cv_prog_gcc" = ".yes"; then
465 case "$CXXFLAGS" in
466 *-pipe* ) ;;
467 * ) AC_COMPILER_OPTION(pipe, -pipe, -pipe, CXXFLAGS="$CXXFLAGS -pipe") ;;
468 esac
469 fi
470 case "$CXXFLAGS" in
471 *-g* ) CXXFLAGS=`echo "$CXXFLAGS" |\
472 sed -e 's/ -g / /g' -e 's/ -g$//' -e 's/^-g //g' -e 's/^-g$//'` ;;
473 esac
474 case "$CXXFLAGS" in
475 *-g* ) CXXFLAGS=`echo "$CXXFLAGS" |\
476 sed -e 's/ -g / /g' -e 's/ -g$//' -e 's/^-g //g' -e 's/^-g$//'` ;;
477 esac
479 CXXFLAGS="$CXXFLAGS -DQT_NO_DEBUG"
480 msg=disabled
481 ])dnl
482 AC_MSG_CHECKING(for compilation debug mode)
483 AC_MSG_RESULT([$msg])
484 if test ".$msg" = .enabled; then
485 enable_shared=no
486 fi
487 ])
489 define(AC_IFALLYES,[dnl
490 ac_rc=yes
491 for ac_spec in $1; do
492 ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
493 ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
494 case $ac_type in
495 header [)]
496 ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
497 ac_var="ac_cv_header_$ac_item"
498 ;;
499 file [)]
500 ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
501 ac_var="ac_cv_file_$ac_item"
502 ;;
503 func [)] ac_var="ac_cv_func_$ac_item" ;;
504 lib [)] ac_var="ac_cv_lib_$ac_item" ;;
505 define [)] ac_var="ac_cv_define_$ac_item" ;;
506 typedef [)] ac_var="ac_cv_typedef_$ac_item" ;;
507 custom [)] ac_var="$ac_item" ;;
508 esac
509 eval "ac_val=\$$ac_var"
510 if test ".$ac_val" != .yes; then
511 ac_rc=no
512 break
513 fi
514 done
515 if test ".$ac_rc" = .yes; then
516 :
517 $2
518 else
519 :
520 $3
521 fi
522 ])
525 dnl ##
526 dnl ## Check for an external/extension library.
527 dnl ## - is aware of <libname>-config style scripts
528 dnl ## - searches under standard paths include, lib, etc.
529 dnl ## - searches under subareas like .libs, etc.
530 dnl ##
531 dnl ## configure.in:
532 dnl ## AC_CHECK_EXTLIB(<realname>, <libname>, <func>, <header>,
533 dnl ## [<success-action> [, <fail-action>]])
534 dnl ## Makefile.in:
535 dnl ## CFLAGS = @CFLAGS@
536 dnl ## LDFLAGS = @LDFLAGS@
537 dnl ## LIBS = @LIBS@
538 dnl ## shell:
539 dnl ## $ ./configure --with-<libname>[=DIR]
540 dnl ##
542 AC_DEFUN(AC_CHECK_EXTLIB,[dnl
543 AC_ARG_WITH($2, [dnl
544 [ --with-]m4_substr([$2[[=DIR]] ], 0, 19)[build with external $1 library (default=no)]], [dnl
545 if test ".$with_$2" = .yes; then
546 # via config script
547 $2_version=`($2-config --version) 2>/dev/null`
548 if test ".$$2_version" != .; then
549 CFLAGS="$CFLAGS `$2-config --cflags`"
550 LDFLAGS="$LDFLAGS `$2-config --ldflags`"
551 fi
552 else
553 if test -d "$with_$2"; then
554 found=0
555 # via config script
556 for dir in $with_$2/bin $with_$2; do
557 if test -f "$dir/$2-config"; then
558 $2_version=`($dir/$2-config --version) 2>/dev/null`
559 if test ".$$2_version" != .; then
560 CFLAGS="$CFLAGS `$dir/$2-config --cflags`"
561 LDFLAGS="$LDFLAGS `$dir/$2-config --ldflags`"
562 found=1
563 break
564 fi
565 fi
566 done
567 # via standard paths
568 if test ".$found" = .0; then
569 for dir in $with_$2/include/$2 $with_$2/include $with_$2; do
570 if test -f "$dir/$4"; then
571 CFLAGS="$CFLAGS -I$dir"
572 found=1
573 break
574 fi
575 done
576 for dir in $with_$2/lib/$2 $with_$2/lib $with_$2; do
577 if test -f "$dir/lib$2.a" -o -f "$dir/lib$2.so"; then
578 LDFLAGS="$LDFLAGS -L$dir"
579 found=1
580 break
581 fi
582 done
583 fi
584 # in any subarea
585 if test ".$found" = .0; then
586 changequote(, )dnl
587 for file in x `find $with_$2 -name "$4" -type f -print`; do
588 test .$file = .x && continue
589 dir=`echo $file | sed -e 's;[[^/]]*$;;' -e 's;\(.\)/$;\1;'`
590 CFLAGS="$CFLAGS -I$dir"
591 done
592 for file in x `find $with_$2 -name "lib$2.[[aso]]" -type f -print`; do
593 test .$file = .x && continue
594 dir=`echo $file | sed -e 's;[[^/]]*$;;' -e 's;\(.\)/$;\1;'`
595 LDFLAGS="$LDFLAGS -L$dir"
596 done
597 changequote([, ])dnl
598 fi
599 fi
600 fi
601 AC_HAVE_HEADERS($4)
602 AC_CHECK_LIB($2, $3)
603 AC_IFALLYES(header:$4 lib:$2_$3, with_$2=yes, with_$2=no)
604 if test ".$with_$2" = .no; then
605 AC_ERROR([Unable to find $1 library])
606 fi
607 ], [dnl
608 if test ".$with_$2" = .; then
609 with_$2=no
610 fi
611 ])dnl
612 AC_MSG_CHECKING(whether to build against external $1 library)
613 if test ".$with_$2" = .yes; then
614 ifelse([$5], , :, [$5])
615 else
616 ifelse([$6], , :, [$6])
617 fi
618 AC_MSG_RESULT([$with_$2])
619 ])dnl