aclocal.m4

Fri, 28 Nov 2008 11:21:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 28 Nov 2008 11:21:08 +0100
changeset 1
d64aaa7d146f
child 3
c1941114ca88
permissions
-rw-r--r--

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.

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

mercurial