Fri, 28 Nov 2008 11:21:08 +0100
Fork project trunk at version 0.7.7 to maintain for future usage.
The original Cable & Wireless development team no longer exists.
The OSSP CVS repository is unavailable (cvs co ossp-pkg/as fails),
however http://cvs.ossp.org/dirview?d=ossp-pkg/as/as-gui is working.
1 ##
2 ## OSSP asgui - Accounting system graphical user interface
3 ## Copyright (c) 2002-2004 The OSSP Project (http://www.ossp.org/)
4 ## Copyright (c) 2002-2004 Ralf S. Engelschall <rse@engelschall.com>
5 ## Copyright (c) 2002-2004 Michael Schloh von Bennewitz <michael@schloh.com>
6 ## Copyright (c) 2002-2004 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://www.ossp.org/
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 ## Now search for libs and headers
317 changequote(, )dnl
318 for file in x `find $QTBASE/include -name "qapplication.h" -print`; do
319 test .$file = .x && continue
320 c_dir=`echo $file | sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;'`
321 done
323 dnl ## Scan to find out which Qt library to link against
324 dnl ## FIXME Merge static and dynamic library search blocks
325 dnl ## FIXME Remove this qt-mt check and do --enable-threads instead
326 for file in x `find $QTBASE/lib -name "libqt.so" -print`; do
327 test .$file = .x && continue
328 l_dir=`echo $file | sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;'`
329 lib=`echo $file | sed -e 's;^.*/\(.*\)$;\1;' -e 's;lib\(.*\)\.so;\1;'`
330 done
332 dnl ## If we have a multithreaded shared library, then it's better
333 for file in x `find $QTBASE/lib -name "libqt-mt.so" -print`; do
334 test .$file = .x && continue
335 l_dir=`echo $file | sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;'`
336 lib=`echo $file | sed -e 's;^.*/\(.*\)$;\1;' -e 's;lib\(.*\)\.so;\1;'`
337 done
339 dnl ## If we have static libraries, then prefer to use those
340 for file in x `find $QTBASE/lib -name "libqt.a" -print`; do
341 test .$file = .x && continue
342 l_dir=`echo $file | sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;'`
343 lib=`echo $file | sed -e 's;^.*/\(.*\)$;\1;' -e 's;lib\(.*\)\.a;\1;'`
344 done
346 dnl ## But the static multithreaded library is preferred above all
347 for file in x `find $QTBASE/lib -name "libqt-mt.a" -print`; do
348 test .$file = .x && continue
349 l_dir=`echo $file | sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;'`
350 lib=`echo $file | sed -e 's;^.*/\(.*\)$;\1;' -e 's;lib\(.*\)\.a;\1;'`
351 done
352 changequote([, ])dnl
354 dnl ## Append paths of libs and headers
355 if test ".$lib" != .; then
356 LIBS="$LIBS -l$lib"
357 fi
358 LDFLAGS="$LDFLAGS -L$l_dir"
359 CPPFLAGS="$CPPFLAGS -DQT_THREAD_SUPPORT"
360 CXXCPP="$CXXCPP -DQT_THREAD_SUPPORT"
361 CXXFLAGS="$CXXFLAGS -I$c_dir"
362 ])
365 dnl ##
366 dnl ## UIC check, should come after the Qt check
367 dnl ##
368 dnl ## configure.in:
369 dnl ## AC_CHECK_UIC
370 dnl ##
372 AC_DEFUN(AC_CHECK_UIC,[dnl
373 AC_MSG_CHECKING(UIC location)
374 if test -x ${QTBASE}/bin/uic
375 then
376 UIC=${QTBASE}/bin/uic
377 AC_MSG_RESULT(${QTBASE}/bin/uic)
378 else
379 UIC=uic
380 AC_MSG_RESULT(assumed present)
381 fi
382 ])
385 dnl ##
386 dnl ## MOC check, should come after the Qt check
387 dnl ##
388 dnl ## configure.in:
389 dnl ## AC_CHECK_MOC
390 dnl ##
392 AC_DEFUN(AC_CHECK_MOC,[dnl
393 AC_MSG_CHECKING(MOC location)
394 if test -x ${QTBASE}/bin/moc
395 then
396 MOC=${QTBASE}/bin/moc
397 AC_MSG_RESULT(${QTBASE}/bin/moc)
398 else
399 MOC=moc
400 AC_MSG_RESULT(assumed present)
401 fi
402 ])
405 dnl ## PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
406 dnl ## defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
407 dnl ## also defines GSTUFF_PKG_ERRORS on error
408 AC_DEFUN(PKG_CHECK_MODULES, [
409 succeeded=no
411 if test -z "$PKG_CONFIG"; then
412 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
413 fi
415 if test "$PKG_CONFIG" = "no" ; then
416 echo "*** The pkg-config script could not be found. Make sure it is"
417 echo "*** in your path, or set the PKG_CONFIG environment variable"
418 echo "*** to the full path to pkg-config."
419 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
420 else
421 PKG_CONFIG_MIN_VERSION=0.9.0
422 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
423 AC_MSG_CHECKING(for $2)
425 if $PKG_CONFIG --exists "$2" ; then
426 AC_MSG_RESULT(yes)
427 succeeded=yes
429 AC_MSG_CHECKING($1_CFLAGS)
430 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
431 AC_MSG_RESULT($$1_CFLAGS)
433 AC_MSG_CHECKING($1_LIBS)
434 $1_LIBS=`$PKG_CONFIG --libs "$2"`
435 AC_MSG_RESULT($$1_LIBS)
436 else
437 $1_CFLAGS=""
438 $1_LIBS=""
439 ## If we have a custom action on failure, don't print errors, but
440 ## do set a variable so people can do so.
441 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
442 ifelse([$4], ,echo $$1_PKG_ERRORS,)
443 fi
445 AC_SUBST($1_CFLAGS)
446 AC_SUBST($1_LIBS)
447 else
448 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
449 echo "*** See http://www.freedesktop.org/software/pkgconfig"
450 fi
451 fi
453 if test $succeeded = yes; then
454 ifelse([$3], , :, [$3])
455 else
456 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])
457 fi
458 ])
461 dnl ##
462 dnl ## Debugging Support
463 dnl ##
464 dnl ## configure.in:
465 dnl ## AC_CHECK_DEBUGGING
466 dnl ##
468 AC_DEFUN(AC_CHECK_DEBUGGING,[dnl
469 AC_ARG_ENABLE(debug,dnl
470 [ --enable-debug build for debugging (default=no)],
471 [dnl
472 if test ".$ac_cv_prog_gcc" = ".yes"; then
473 case "$CXXFLAGS" in
474 *-O* ) ;;
475 * ) CXXFLAGS="$CXXFLAGS -O2" ;;
476 esac
477 case "$CXXFLAGS" in
478 *-g* ) ;;
479 * ) CXXFLAGS="$CXXFLAGS -g" ;;
480 esac
481 case "$CXXFLAGS" in
482 *-pipe* ) ;;
483 * ) AC_COMPILER_OPTION(pipe, -pipe, -pipe, CXXFLAGS="$CXXFLAGS -pipe") ;;
484 esac
485 AC_COMPILER_OPTION(defdbg, -DDEBUG, -DDEBUG, CXXFLAGS="$CXXFLAGS -DDEBUG")
486 dnl AC_COMPILER_OPTION(ggdb3, -ggdb3, -ggdb3, CXXFLAGS="$CXXFLAGS -ggdb3")
487 CXXFLAGS="$CXXFLAGS -pedantic"
488 CXXFLAGS="$CXXFLAGS -Wall"
489 WMORE="-Wshadow -Wpointer-arith -Wcast-align -Winline"
490 WMORE="$WMORE -Wmissing-prototypes -Wmissing-declarations -Wnested-externs"
491 AC_COMPILER_OPTION(wmore, -W<xxx>, $WMORE, CXXFLAGS="$CXXFLAGS $WMORE")
492 AC_COMPILER_OPTION(wnolonglong, -Wno-long-long, -Wno-long-long, CXXFLAGS="$CXXFLAGS -Wno-long-long")
493 else
494 case "$CXXFLAGS" in
495 *-g* ) ;;
496 * ) CXXFLAGS="$CXXFLAGS -g" ;;
497 esac
498 fi
499 msg="enabled"
500 dnl AC_DEFINE(DEBUG, 1, [Define to 1 if you want to enable debugging])
501 ],[
502 if test ".$ac_cv_prog_gcc" = ".yes"; then
503 case "$CXXFLAGS" in
504 *-pipe* ) ;;
505 * ) AC_COMPILER_OPTION(pipe, -pipe, -pipe, CXXFLAGS="$CXXFLAGS -pipe") ;;
506 esac
507 fi
508 case "$CXXFLAGS" in
509 *-g* ) CXXFLAGS=`echo "$CXXFLAGS" |\
510 sed -e 's/ -g / /g' -e 's/ -g$//' -e 's/^-g //g' -e 's/^-g$//'` ;;
511 esac
512 case "$CXXFLAGS" in
513 *-g* ) CXXFLAGS=`echo "$CXXFLAGS" |\
514 sed -e 's/ -g / /g' -e 's/ -g$//' -e 's/^-g //g' -e 's/^-g$//'` ;;
515 esac
517 CXXFLAGS="$CXXFLAGS -DQT_NO_DEBUG"
518 msg=disabled
519 ])dnl
520 AC_MSG_CHECKING(for compilation debug mode)
521 AC_MSG_RESULT([$msg])
522 if test ".$msg" = .enabled; then
523 enable_shared=no
524 fi
525 ])
527 define(AC_IFALLYES,[dnl
528 ac_rc=yes
529 for ac_spec in $1; do
530 ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
531 ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
532 case $ac_type in
533 header [)]
534 ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
535 ac_var="ac_cv_header_$ac_item"
536 ;;
537 file [)]
538 ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
539 ac_var="ac_cv_file_$ac_item"
540 ;;
541 func [)] ac_var="ac_cv_func_$ac_item" ;;
542 lib [)] ac_var="ac_cv_lib_$ac_item" ;;
543 define [)] ac_var="ac_cv_define_$ac_item" ;;
544 typedef [)] ac_var="ac_cv_typedef_$ac_item" ;;
545 custom [)] ac_var="$ac_item" ;;
546 esac
547 eval "ac_val=\$$ac_var"
548 if test ".$ac_val" != .yes; then
549 ac_rc=no
550 break
551 fi
552 done
553 if test ".$ac_rc" = .yes; then
554 :
555 $2
556 else
557 :
558 $3
559 fi
560 ])
563 dnl ##
564 dnl ## Check for an external/extension library.
565 dnl ## - is aware of <libname>-config style scripts
566 dnl ## - searches under standard paths include, lib, etc.
567 dnl ## - searches under subareas like .libs, etc.
568 dnl ##
569 dnl ## configure.in:
570 dnl ## AC_CHECK_EXTLIB(<realname>, <libname>, <func>, <header>,
571 dnl ## [<success-action> [, <fail-action>]])
572 dnl ## Makefile.in:
573 dnl ## CFLAGS = @CFLAGS@
574 dnl ## LDFLAGS = @LDFLAGS@
575 dnl ## LIBS = @LIBS@
576 dnl ## shell:
577 dnl ## $ ./configure --with-<libname>[=DIR]
578 dnl ##
580 AC_DEFUN(AC_CHECK_EXTLIB,[dnl
581 AC_ARG_WITH($2, [dnl
582 [ --with-]m4_substr([$2[[=DIR]] ], 0, 19)[build with external $1 library (default=no)]], [dnl
583 if test ".$with_$2" = .yes; then
584 # via config script
585 $2_version=`($2-config --version) 2>/dev/null`
586 if test ".$$2_version" != .; then
587 CFLAGS="$CFLAGS `$2-config --cflags`"
588 LDFLAGS="$LDFLAGS `$2-config --ldflags`"
589 fi
590 else
591 if test -d "$with_$2"; then
592 found=0
593 # via config script
594 for dir in $with_$2/bin $with_$2; do
595 if test -f "$dir/$2-config"; then
596 $2_version=`($dir/$2-config --version) 2>/dev/null`
597 if test ".$$2_version" != .; then
598 CFLAGS="$CFLAGS `$dir/$2-config --cflags`"
599 LDFLAGS="$LDFLAGS `$dir/$2-config --ldflags`"
600 found=1
601 break
602 fi
603 fi
604 done
605 # via standard paths
606 if test ".$found" = .0; then
607 for dir in $with_$2/include/$2 $with_$2/include $with_$2; do
608 if test -f "$dir/$4"; then
609 CFLAGS="$CFLAGS -I$dir"
610 found=1
611 break
612 fi
613 done
614 for dir in $with_$2/lib/$2 $with_$2/lib $with_$2; do
615 if test -f "$dir/lib$2.a" -o -f "$dir/lib$2.so"; then
616 LDFLAGS="$LDFLAGS -L$dir"
617 found=1
618 break
619 fi
620 done
621 fi
622 # in any subarea
623 if test ".$found" = .0; then
624 changequote(, )dnl
625 for file in x `find $with_$2 -name "$4" -type f -print`; do
626 test .$file = .x && continue
627 dir=`echo $file | sed -e 's;[[^/]]*$;;' -e 's;\(.\)/$;\1;'`
628 CFLAGS="$CFLAGS -I$dir"
629 done
630 for file in x `find $with_$2 -name "lib$2.[[aso]]" -type f -print`; do
631 test .$file = .x && continue
632 dir=`echo $file | sed -e 's;[[^/]]*$;;' -e 's;\(.\)/$;\1;'`
633 LDFLAGS="$LDFLAGS -L$dir"
634 done
635 changequote([, ])dnl
636 fi
637 fi
638 fi
639 AC_HAVE_HEADERS($4)
640 AC_CHECK_LIB($2, $3)
641 AC_IFALLYES(header:$4 lib:$2_$3, with_$2=yes, with_$2=no)
642 if test ".$with_$2" = .no; then
643 AC_ERROR([Unable to find $1 library])
644 fi
645 ], [dnl
646 if test ".$with_$2" = .; then
647 with_$2=no
648 fi
649 ])dnl
650 AC_MSG_CHECKING(whether to build against external $1 library)
651 if test ".$with_$2" = .yes; then
652 ifelse([$5], , :, [$5])
653 else
654 ifelse([$6], , :, [$6])
655 fi
656 AC_MSG_RESULT([$with_$2])
657 ])dnl