| 1 |
dnl -*- shell-script -*- |
| 2 |
|
| 3 |
dnl This file is part of the Avifile packages |
| 4 |
dnl and has been heavily modified for its purposes |
| 5 |
dnl Copyright (C) 2002-8 Zdenek Kabelac ([email protected]) |
| 6 |
dnl |
| 7 |
dnl Originaly this file was part of the KDE libraries/packages |
| 8 |
dnl Copyright (C) 1997 Janos Farkas ([email protected]) |
| 9 |
dnl (C) 1997 Stephan Kulow ([email protected]) |
| 10 |
|
| 11 |
dnl This file is free software; you can redistribute it and/or |
| 12 |
dnl modify it under the terms of the GNU Library General Public |
| 13 |
dnl License as published by the Free Software Foundation; either |
| 14 |
dnl version 2 of the License, or (at your option) any later version. |
| 15 |
|
| 16 |
dnl This library is distributed in the hope that it will be useful, |
| 17 |
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 |
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 19 |
dnl Library General Public License for more details. |
| 20 |
|
| 21 |
dnl You should have received a copy of the GNU Library General Public License |
| 22 |
dnl along with this library; see the file COPYING.LIB. If not, write to |
| 23 |
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 24 |
dnl Boston, MA 02111-1307, USA. |
| 25 |
|
| 26 |
|
| 27 |
dnl ------------------------------------------------------------------------ |
| 28 |
dnl Find a file (or one of more files in a list of dirs) |
| 29 |
dnl ------------------------------------------------------------------------ |
| 30 |
dnl |
| 31 |
AC_DEFUN([AC_FIND_FILE], |
| 32 |
[ |
| 33 |
$3=NO |
| 34 |
for i in $2; |
| 35 |
do |
| 36 |
for j in $1; |
| 37 |
do |
| 38 |
if test -r "$i/$j"; then |
| 39 |
$3=$i |
| 40 |
break 2 |
| 41 |
fi |
| 42 |
done |
| 43 |
done |
| 44 |
]) |
| 45 |
|
| 46 |
|
| 47 |
dnl KDE_MOC_ERROR_MESSAGE |
| 48 |
dnl |
| 49 |
AC_DEFUN([KDE_MOC_ERROR_MESSAGE], |
| 50 |
[ |
| 51 |
AC_MSG_ERROR([No valid Qt meta object compiler (moc) found! |
| 52 |
Please check whether you installed Qt correctly. |
| 53 |
You need to have a running moc binary. |
| 54 |
configure tried to run $ac_cv_path_moc and the test did not |
| 55 |
succeed. If configure should not have tried this one, set |
| 56 |
the environment variable MOC to the right one before running |
| 57 |
configure.]) |
| 58 |
]) |
| 59 |
|
| 60 |
AC_DEFUN([KDE_UIC_ERROR_MESSAGE], |
| 61 |
[ |
| 62 |
AC_MSG_WARN([No valid Qt ui compiler (uic) found! |
| 63 |
Please check whether you installed Qt correctly. |
| 64 |
You need to have a running uic binary. |
| 65 |
configure tried to run $ac_cv_path_uic and the test did not |
| 66 |
succeed. If configure should not have tried this one, set |
| 67 |
the environment variable UIC to the right one before running |
| 68 |
configure.]) |
| 69 |
]) |
| 70 |
|
| 71 |
dnl ------------------------------------------------------------------------ |
| 72 |
dnl Find the meta object compiler in the PATH, in $QTDIR/bin, and some |
| 73 |
dnl more usual places |
| 74 |
dnl ------------------------------------------------------------------------ |
| 75 |
dnl |
| 76 |
AC_DEFUN([AC_PATH_QT_MOC_UIC], |
| 77 |
[ |
| 78 |
dnl usually qt is installed in such a way it might help to |
| 79 |
dnl try this binpath first |
| 80 |
cutlib_binpath=`echo "$ac_qt_libraries" | sed 's%/[[^/]]*$%%'` |
| 81 |
lc_qt_binpath="$ac_qt_binpath:$cutlib_binpath/bin:$PATH:/usr/local/bin:/usr/local/qt3/bin:/usr/local/qt2/bin:/usr/local/qt/bin:/usr/lib/qt3/bin:/usr/lib/qt2/bin:/usr/lib/qt/bin:/usr/bin:/usr/X11R6/bin" |
| 82 |
AC_PATH_PROGS(MOC, moc moc3 moc2, , $lc_qt_binpath) |
| 83 |
dnl AC_PATH_PROGS(UIC, uic, , $lc_qt_binpath) |
| 84 |
|
| 85 |
if test -z "$MOC"; then |
| 86 |
if test -n "$ac_cv_path_moc"; then |
| 87 |
output=`eval "$ac_cv_path_moc --help 2>&1 | sed -e '1q' | grep Qt"` |
| 88 |
fi |
| 89 |
echo "configure:__oline__: tried to call $ac_cv_path_moc --help 2>&1 | sed -e '1q' | grep Qt" >&AS_MESSAGE_LOG_FD |
| 90 |
echo "configure:__oline__: moc output: $output" >&AS_MESSAGE_LOG_FD |
| 91 |
|
| 92 |
if test -z "$output"; then |
| 93 |
KDE_MOC_ERROR_MESSAGE |
| 94 |
fi |
| 95 |
fi |
| 96 |
|
| 97 |
AC_SUBST(MOC) |
| 98 |
|
| 99 |
dnl We do not need UIC |
| 100 |
dnl [KDE_UIC_ERROR_MESSAGE]) |
| 101 |
dnl AC_SUBST(UIC) |
| 102 |
]) |
| 103 |
|
| 104 |
|
| 105 |
dnl AC_PATH_QT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) |
| 106 |
dnl ------------------------------------------------------------------------ |
| 107 |
dnl Try to find the Qt headers and libraries. |
| 108 |
dnl $(QT_LIBS) will be -Lqtliblocation (if needed) -lqt_library_name |
| 109 |
dnl and $(QT_CFLAGS) will be -Iqthdrlocation (if needed) |
| 110 |
dnl ------------------------------------------------------------------------ |
| 111 |
dnl |
| 112 |
AC_DEFUN([AC_PATH_QT], |
| 113 |
[ |
| 114 |
AC_REQUIRE([AC_PATH_XTRA]) |
| 115 |
|
| 116 |
ac_have_qt=yes |
| 117 |
ac_qt_binpath= |
| 118 |
ac_qt_includes= |
| 119 |
ac_qt_libraries= |
| 120 |
ac_qt_notfound= |
| 121 |
qt_libraries= |
| 122 |
qt_includes= |
| 123 |
min_qt_version=ifelse([$1], ,100, $1) |
| 124 |
|
| 125 |
AC_ARG_WITH(qt_prefix, [ --with-qt-prefix where the root of Qt is installed.], |
| 126 |
[ ac_qt_includes="$withval"/include |
| 127 |
ac_qt_libraries="$withval"/lib |
| 128 |
ac_qt_binpath="$withval"/bin |
| 129 |
]) |
| 130 |
|
| 131 |
test -n "$QTDIR" && ac_qt_binpath="$ac_qt_binpath:$QTDIR/bin:$QTDIR" |
| 132 |
|
| 133 |
AC_ARG_WITH(qt_includes, [ --with-qt-includes where the Qt includes are installed.], |
| 134 |
[ ac_qt_includes=$withval ]) |
| 135 |
|
| 136 |
AC_ARG_WITH(qt_libraries, [ --with-qt-libraries where the Qt library is installed.], |
| 137 |
[ ac_qt_libraries=$withval ]) |
| 138 |
|
| 139 |
if test -z "$ac_qt_includes" || test -z "$ac_qt_libraries" ; then |
| 140 |
AC_CACHE_VAL(ac_cv_have_qt, |
| 141 |
[ AC_LANG_PUSH(C++) |
| 142 |
# try to guess Qt locations |
| 143 |
# various paths from various distros - |
| 144 |
# you are welcome to suggest another |
| 145 |
qt_incdirs="$QTINC |
| 146 |
/usr/local/lib/qt3/include |
| 147 |
/usr/local/lib/qt2/include |
| 148 |
/usr/local/qt/include |
| 149 |
/usr/local/include |
| 150 |
/usr/lib/qt-3.1/include |
| 151 |
/usr/lib/qt3/include |
| 152 |
/usr/lib/qt-2.3.1/include |
| 153 |
/usr/lib/qt2/include |
| 154 |
/usr/include/qt3 |
| 155 |
/usr/include/qt |
| 156 |
/usr/lib/qt/include |
| 157 |
$x_includes/qt3 |
| 158 |
$x_includes/qt2 |
| 159 |
$x_includes/X11/qt |
| 160 |
$x_includes |
| 161 |
/usr/include" |
| 162 |
qt_libdirs="$QTLIB |
| 163 |
/usr/local/lib/qt3/lib |
| 164 |
/usr/local/lib/qt2/lib |
| 165 |
/usr/local/qt/lib |
| 166 |
/usr/local/lib |
| 167 |
/usr/lib/qt-3.1/lib |
| 168 |
/usr/lib/qt3/lib |
| 169 |
/usr/lib/qt-2.3.1/lib |
| 170 |
/usr/lib/qt2/lib |
| 171 |
/usr/lib/qt/lib |
| 172 |
/usr/lib/qt |
| 173 |
$x_libraries/qt3 |
| 174 |
$x_libraries/qt2 |
| 175 |
$x_libraries |
| 176 |
/usr/lib" |
| 177 |
|
| 178 |
if test -n "$QTDIR" ; then |
| 179 |
qt_incdirs="$QTDIR/include $QTDIR $qt_incdirs" |
| 180 |
qt_libdirs="$QTDIR/lib $QTDIR $qt_libdirs" |
| 181 |
fi |
| 182 |
|
| 183 |
qt_incdirs="$ac_qt_includes $qt_incdirs" |
| 184 |
qt_libdirs="$ac_qt_libraries $qt_libdirs" |
| 185 |
|
| 186 |
AC_FIND_FILE(qmovie.h, $qt_incdirs, qt_incdir) |
| 187 |
ac_qt_includes="$qt_incdir" |
| 188 |
|
| 189 |
qt_libdir=NONE |
| 190 |
for dir in $qt_libdirs ; do |
| 191 |
for qtname in qt3 qt2 qt ; do |
| 192 |
try="ls -1 $dir/lib$qtname.* $dir/lib$qtname-mt.*" |
| 193 |
if test -n "`$try 2> /dev/null`"; then |
| 194 |
test -z "$QTNAME" && QTNAME=$qtname |
| 195 |
qt_libdir=$dir |
| 196 |
break |
| 197 |
fi |
| 198 |
done |
| 199 |
if test x$qt_libdir != xNONE ; then |
| 200 |
break |
| 201 |
fi |
| 202 |
echo "tried $dir" >&AS_MESSAGE_LOG_FD |
| 203 |
done |
| 204 |
|
| 205 |
ac_qt_libraries=$qt_libdir |
| 206 |
|
| 207 |
test -z "$QTNAME" && QTNAME=qt |
| 208 |
ac_QTNAME=$QTNAME |
| 209 |
|
| 210 |
ac_save_QTLIBS=$LIBS |
| 211 |
LIBS="-L$ac_qt_libraries $LIBS $PTHREAD_LIBS" |
| 212 |
AC_CHECK_LIB($QTNAME-mt, main, ac_QTNAME=$QTNAME-mt) |
| 213 |
LIBS=$ac_save_QTLIBS |
| 214 |
|
| 215 |
ac_cv_have_qt="ac_have_qt=yes ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries ac_QTNAME=$ac_QTNAME" |
| 216 |
|
| 217 |
if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NONE ; then |
| 218 |
ac_cv_have_qt="ac_have_qt=no" |
| 219 |
ac_qt_notfound="(headers)" |
| 220 |
if test "$ac_qt_includes" = NO; then |
| 221 |
if test "$ac_qt_libraries" = NONE; then |
| 222 |
ac_qt_notfound="(headers and libraries)" |
| 223 |
fi |
| 224 |
else |
| 225 |
ac_qt_notfound="(libraries)"; |
| 226 |
fi |
| 227 |
fi |
| 228 |
AC_LANG_POP |
| 229 |
]) |
| 230 |
eval "$ac_cv_have_qt" |
| 231 |
else |
| 232 |
for qtname in qt3 qt2 qt ; do |
| 233 |
try="ls -1 $ac_qt_libraries/lib$qtname.* $ac_qt_libraries/lib$qtname-mt.*" |
| 234 |
if test -n "`$try 2> /dev/null`"; then |
| 235 |
test -z "$QTNAME" && QTNAME=$qtname |
| 236 |
break |
| 237 |
fi |
| 238 |
done |
| 239 |
ac_QTNAME=$QTNAME |
| 240 |
ac_save_QTLIBS=$LIBS |
| 241 |
LIBS="-L$ac_qt_libraries $LIBS $PTHREAD_LIBS" |
| 242 |
AC_CHECK_LIB($QTNAME-mt, main, ac_QTNAME=$QTNAME-mt) |
| 243 |
LIBS=$ac_save_QTLIBS |
| 244 |
fi |
| 245 |
|
| 246 |
if test x$ac_have_qt = xyes ; then |
| 247 |
AC_MSG_CHECKING([for Qt library (version >= $min_qt_version)]) |
| 248 |
AC_CACHE_VAL(ac_cv_qt_version, |
| 249 |
[ |
| 250 |
AC_LANG_PUSH(C++) |
| 251 |
ac_save_QTCXXFLAGS=$CXXFLAGS |
| 252 |
ac_save_QTLIBS=$LIBS |
| 253 |
CXXFLAGS="$CXXFLAGS -I$ac_qt_includes" |
| 254 |
LIBS="-L$ac_qt_libraries -l$ac_QTNAME $X_LIBS $LIBS $PTHREAD_LIBS" |
| 255 |
AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
| 256 |
/*#include <qapplication.h>*/ |
| 257 |
/*#include <qmovie.h>*/ |
| 258 |
#include <qstring.h> |
| 259 |
#include <qglobal.h> |
| 260 |
#include <stdio.h> |
| 261 |
|
| 262 |
int main(int argc, char* argv[]) { |
| 263 |
/*QApplication a( argc, argv );*/ |
| 264 |
/*QMovie m; int s = m.speed();*/ |
| 265 |
QString qa("test"); |
| 266 |
unsigned int v = QT_VERSION; |
| 267 |
FILE* f = fopen("conf.qttest", "w"); |
| 268 |
if (v > 400) v = (((v >> 16) & 0xff) * 100) + (((v >> 8) & 0xff) * 10) + (v & 0xff); |
| 269 |
if (f) fprintf(f, "%d\n", v); |
| 270 |
return 0; |
| 271 |
} |
| 272 |
]])],[ AC_MSG_RESULT(yes); ac_cv_qt_version=`cat conf.qttest`; rm -f conf.qttest ],[ AC_MSG_RESULT(no); ac_have_qt=no; ac_cv_qt_version=ERROR ],[ echo $ac_n "cross compiling; assumed OK... $ac_c" ]) |
| 273 |
|
| 274 |
if test x$ac_cv_qt_version = xERROR ; then |
| 275 |
AC_MSG_WARN([ |
| 276 |
*** Could not run Qt test program, checking why... |
| 277 |
*** Configure discovered/uses these settings: |
| 278 |
*** Qt libraries: $ac_qt_libraries |
| 279 |
*** Qt headers: $ac_qt_includes |
| 280 |
*** Note: |
| 281 |
*** Compilation of Qt utilities also might be turned off (if not wanted). |
| 282 |
*** If you are experiencing problems which will not be described |
| 283 |
*** bellow please report then on '[email protected]' mailing list |
| 284 |
*** (i.e. some misdetection or omitted path)] |
| 285 |
) |
| 286 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <qstring.h> ]], [[ QString qa("test") ]])],[ AC_MSG_ERROR([ |
| 287 |
*** Qt test program compiled, but did not run. This usually means |
| 288 |
*** that the run-time linker is not finding Qt library or finding the wrong |
| 289 |
*** version of Qt. If it is not finding Qt, you will need to set your |
| 290 |
*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point |
| 291 |
*** to the installed location Also, make sure you have run ldconfig if that |
| 292 |
*** is required on your system. |
| 293 |
*** |
| 294 |
*** If you have an old version installed, it is best to remove it, although |
| 295 |
*** you may also be able to get things to work by modifying LD_LIBRARY_PATH |
| 296 |
*** |
| 297 |
*** i.e. bash> export LD_LIBRARY_PATH=$ac_qt_libraries:\$LD_LIBRARY_PATH]) ],[ AC_MSG_ERROR([ |
| 298 |
*** The test program failed to compile or link. See the file config.log for the |
| 299 |
*** exact error that occured. This usually means Qt was incorrectly installed |
| 300 |
*** or that you have moved Qt since it was installed. In the latter case, you |
| 301 |
*** may want to set QTDIR shell variable |
| 302 |
*** |
| 303 |
*** Another possibility is you try to link Qt libraries compiled with |
| 304 |
*** different version of g++. Unfortunately you can not mix C++ libraries |
| 305 |
*** and object files created with different C++ compiler |
| 306 |
*** i.e. g++-2.96 libraries and g++-2.95 objects |
| 307 |
*** The most common case: Some users seems to be downgrading their |
| 308 |
*** compiler without thinking about consequencies...]) |
| 309 |
]) |
| 310 |
fi |
| 311 |
|
| 312 |
CXXFLAGS=$ac_save_QTCXXFLAGS |
| 313 |
LIBS=$ac_save_QTLIBS |
| 314 |
AC_LANG_POP |
| 315 |
]) |
| 316 |
qt_version=$ac_cv_qt_version |
| 317 |
fi |
| 318 |
|
| 319 |
if test x$ac_have_qt != xyes; then |
| 320 |
AC_MSG_WARN([ |
| 321 |
*** Could not find usable Qt $ac_qt_notfound on your system! |
| 322 |
*** If it _is_ installed, delete ./config.cache and re-run ./configure, |
| 323 |
*** specifying path to Qt headers and libraries in configure options. |
| 324 |
*** Switching off Qt compilation!]) |
| 325 |
ac_have_qt=no |
| 326 |
else |
| 327 |
AC_MSG_RESULT([found $ac_QTNAME version $qt_version, libraries $ac_qt_libraries, headers $ac_qt_includes]) |
| 328 |
if test $min_qt_version -le $qt_version ; then |
| 329 |
qt_libraries=$ac_qt_libraries |
| 330 |
qt_includes=$ac_qt_includes |
| 331 |
|
| 332 |
if test "$qt_includes" = "$x_includes" -o -z "$qt_includes" ; then |
| 333 |
QT_CFLAGS= |
| 334 |
else |
| 335 |
QT_CFLAGS="-I$qt_includes" |
| 336 |
all_includes="$QT_CFLAGS $all_includes" |
| 337 |
fi |
| 338 |
QT_CFLAGS="$QT_CFLAGS -DQT_THREAD_SUPPORT" |
| 339 |
|
| 340 |
if test "$qt_libraries" = NONE -o "$qt_libraries" = "$x_libraries" -o -z "$qt_libraries" -o "$qt_libraries" = "/usr/lib" ; then |
| 341 |
QT_LIBS= |
| 342 |
else |
| 343 |
QT_LIBS="-L$qt_libraries" |
| 344 |
all_libraries="$QT_LIBS $all_libraries" |
| 345 |
fi |
| 346 |
|
| 347 |
QT_LIBS="$QT_LIBS -l$ac_QTNAME" |
| 348 |
|
| 349 |
if test x$ac_have_qt = xyes ; then |
| 350 |
AC_PATH_QT_MOC_UIC |
| 351 |
fi |
| 352 |
|
| 353 |
AC_SUBST(qt_version) |
| 354 |
AC_SUBST(QT_CFLAGS) |
| 355 |
AC_SUBST(QT_LIBS) |
| 356 |
else |
| 357 |
AC_MSG_WARN([ |
| 358 |
*** Unsupported old version of Qt library found. Please upgrade.]) |
| 359 |
ac_have_qt=no |
| 360 |
fi |
| 361 |
fi |
| 362 |
|
| 363 |
if test x$ac_have_qt = xyes ; then |
| 364 |
ifelse([$2], , :, [$2]) |
| 365 |
else |
| 366 |
ifelse([$3], , :, [$3]) |
| 367 |
fi |
| 368 |
|
| 369 |
]) |
| 370 |
|
| 371 |
|
| 372 |
AC_DEFUN([AC_FIND_ZLIB], |
| 373 |
[ |
| 374 |
AC_CACHE_CHECK([for libz], ac_cv_lib_z, |
| 375 |
ac_save_LIBS=$LIBS |
| 376 |
LIBS="$LIBS -lz" |
| 377 |
AC_LINK_IFELSE(AC_LANG_PROGRAM([#include<zlib.h>], [return (zlibVersion() == ZLIB_VERSION)]), |
| 378 |
ac_cv_lib_z=yes, ac_cv_lib_z=no) |
| 379 |
LIBS=$ac_save_LIBS) |
| 380 |
if test "$ac_cv_lib_z" = yes; then |
| 381 |
Z_LIBS="-lz" |
| 382 |
have_zlib=yes |
| 383 |
ifelse([$1], , :, [$1]) |
| 384 |
else |
| 385 |
Z_LIBS= |
| 386 |
have_zlib=no |
| 387 |
ifelse([$2], , :, [$2]) |
| 388 |
fi |
| 389 |
AC_SUBST(Z_LIBS) |
| 390 |
]) |
| 391 |
|
| 392 |
|
| 393 |
AC_DEFUN([AC_FIND_PNG], |
| 394 |
[ |
| 395 |
AC_REQUIRE([AC_FIND_ZLIB]) |
| 396 |
AC_MSG_CHECKING([for libpng]) |
| 397 |
AC_CACHE_VAL(ac_cv_lib_png, |
| 398 |
[ac_save_LIBS="$LIBS" |
| 399 |
LIBS="$all_libraries -lpng $Z_LIBS -lm -lX11 $LIBSOCKET" |
| 400 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include<png.h>]], [[ |
| 401 |
png_structp png_ptr = png_create_read_struct( // image ptr |
| 402 |
PNG_LIBPNG_VER_STRING, 0, 0, 0 ); |
| 403 |
return( png_ptr != 0 ); |
| 404 |
]])],[eval "ac_cv_lib_png='-lpng $Z_LIBS -lm'"],[eval "ac_cv_lib_png=no"]) |
| 405 |
LIBS=$ac_save_LIBS |
| 406 |
]) |
| 407 |
if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then |
| 408 |
AC_DEFINE_UNQUOTED(HAVE_LIBPNG) |
| 409 |
LIBPNG="$ac_cv_lib_png" |
| 410 |
AC_SUBST(LIBPNG) |
| 411 |
AC_MSG_RESULT($ac_cv_lib_png) |
| 412 |
else |
| 413 |
AC_MSG_RESULT(no) |
| 414 |
LIBPNG="" |
| 415 |
AC_SUBST(LIBPNG) |
| 416 |
fi |
| 417 |
]) |
| 418 |
|
| 419 |
|
| 420 |
dnl just a wrapper to clean up configure.in |
| 421 |
AC_DEFUN([KDE_PROG_LIBTOOL], |
| 422 |
[ |
| 423 |
AC_REQUIRE([AM_ENABLE_SHARED]) |
| 424 |
AC_REQUIRE([AM_ENABLE_STATIC]) |
| 425 |
dnl libtool is only for C, so I must force him |
| 426 |
dnl to find the correct flags for C++ |
| 427 |
ac_save_cc=$CC |
| 428 |
ac_save_cflags="$CFLAGS" |
| 429 |
CC=$CXX |
| 430 |
CFLAGS="$CXXFLAGS" |
| 431 |
dnl AM_PROG_LIBTOOL dnl for libraries |
| 432 |
CC=$ac_save_cc |
| 433 |
CFLAGS="$ac_save_cflags" |
| 434 |
]) |
| 435 |
|
| 436 |
|
| 437 |
dnl Check for the type of the third argument of getsockname |
| 438 |
AC_DEFUN([AC_CHECK_KSIZE_T], |
| 439 |
[AC_MSG_CHECKING(for the third argument of getsockname) |
| 440 |
AC_LANG([C++]) |
| 441 |
AC_CACHE_VAL(ac_cv_ksize_t, |
| 442 |
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 443 |
#include <sys/types.h> |
| 444 |
#include <sys/socket.h> |
| 445 |
]], [[ |
| 446 |
socklen_t a=0; |
| 447 |
getsockname(0,(struct sockaddr*)0, &a); |
| 448 |
]])],[ac_cv_ksize_t=socklen_t],[ac_cv_ksize_t=]) |
| 449 |
if test -z "$ac_cv_ksize_t"; then |
| 450 |
ac_save_cxxflags="$CXXFLAGS" |
| 451 |
if test "$GCC" = "yes"; then |
| 452 |
CXXFLAGS="-Werror $CXXFLAGS" |
| 453 |
fi |
| 454 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 455 |
#include <sys/types.h> |
| 456 |
#include <sys/socket.h> |
| 457 |
]], [[ |
| 458 |
int a=0; |
| 459 |
getsockname(0,(struct sockaddr*)0, &a); |
| 460 |
]])],[ac_cv_ksize_t=int],[ac_cv_ksize_t=size_t]) |
| 461 |
CXXFLAGS=$ac_save_cxxflags |
| 462 |
fi |
| 463 |
]) |
| 464 |
|
| 465 |
if test -z "$ac_cv_ksize_t"; then |
| 466 |
ac_cv_ksize_t=int |
| 467 |
fi |
| 468 |
|
| 469 |
AC_MSG_RESULT($ac_cv_ksize_t) |
| 470 |
AC_DEFINE_UNQUOTED(ksize_t, $ac_cv_ksize_t) |
| 471 |
|
| 472 |
]) |
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
# Search path for a program which passes the given test. |
| 477 |
# Ulrich Drepper <[email protected]>, 1996. |
| 478 |
|
| 479 |
# Stephan Kulow: I appended a _KDE against name conflicts |
| 480 |
|
| 481 |
dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR, |
| 482 |
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) |
| 483 |
AC_DEFUN([AM_PATH_PROG_WITH_TEST_KDE], |
| 484 |
[# Extract the first word of "$2", so it can be a program name with args. |
| 485 |
set dummy $2; ac_word=[$]2 |
| 486 |
AC_MSG_CHECKING([for $ac_word]) |
| 487 |
AC_CACHE_VAL(ac_cv_path_$1, |
| 488 |
[case "[$]$1" in |
| 489 |
/*) ac_cv_path_$1="[$]$1" # Let the user override the test with a path. |
| 490 |
;; |
| 491 |
*) |
| 492 |
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" |
| 493 |
for ac_dir in ifelse([$5], , $PATH, [$5]); do |
| 494 |
test -z "$ac_dir" && ac_dir=. |
| 495 |
if test -f $ac_dir/$ac_word; then |
| 496 |
if [$3]; then |
| 497 |
ac_cv_path_$1="$ac_dir/$ac_word" |
| 498 |
break |
| 499 |
fi |
| 500 |
fi |
| 501 |
done |
| 502 |
IFS="$ac_save_ifs" |
| 503 |
dnl If no 4th arg is given, leave the cache variable unset, |
| 504 |
dnl so AC_PATH_PROGS will keep looking. |
| 505 |
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" |
| 506 |
]) |
| 507 |
;; |
| 508 |
esac |
| 509 |
]) |
| 510 |
$1="$ac_cv_path_$1" |
| 511 |
if test -n "[$]$1"; then |
| 512 |
AC_MSG_RESULT([$]$1) |
| 513 |
else |
| 514 |
AC_MSG_RESULT(no) |
| 515 |
fi |
| 516 |
AC_SUBST($1)dnl |
| 517 |
]) |
| 518 |
|
| 519 |
|
| 520 |
|
| 521 |
AC_DEFUN([AM_DISABLE_LIBRARIES], |
| 522 |
[ |
| 523 |
AC_PROVIDE([AM_ENABLE_STATIC]) |
| 524 |
AC_PROVIDE([AM_ENABLE_SHARED]) |
| 525 |
enable_static=no |
| 526 |
enable_shared=no |
| 527 |
]) |
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
# Check whether LC_MESSAGES is available in <locale.h>. |
| 532 |
# Ulrich Drepper <[email protected]>, 1995. |
| 533 |
# |
| 534 |
# This file can be copied and used freely without restrictions. It can |
| 535 |
# be used in projects which are not available under the GNU General Public |
| 536 |
# License or the GNU Library General Public License but which still want |
| 537 |
# to provide support for the GNU gettext functionality. |
| 538 |
# Please note that the actual code of the GNU gettext library is covered |
| 539 |
# by the GNU Library General Public License, and the rest of the GNU |
| 540 |
# gettext package package is covered by the GNU General Public License. |
| 541 |
# They are *not* in the public domain. |
| 542 |
|
| 543 |
AC_DEFUN([AM_LC_MESSAGES], |
| 544 |
[ |
| 545 |
if test $ac_cv_header_locale_h = yes; then |
| 546 |
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, |
| 547 |
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <locale.h>]], [[return LC_MESSAGES]])],[am_cv_val_LC_MESSAGES=yes],[am_cv_val_LC_MESSAGES=no])]) |
| 548 |
if test $am_cv_val_LC_MESSAGES = yes; then |
| 549 |
AC_DEFINE(HAVE_LC_MESSAGES, 1, |
| 550 |
[Define if your <locale.h> file defines LC_MESSAGES.]) |
| 551 |
fi |
| 552 |
fi |
| 553 |
]) |
| 554 |
|
| 555 |
|
| 556 |
dnl AM_PATH_LINUX([DEFAULT-PATH], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) |
| 557 |
dnl define LINUX_PATH and LINUX_CFLAGS |
| 558 |
AC_DEFUN([AM_PATH_LINUX], |
| 559 |
[ |
| 560 |
AC_ARG_WITH(linux_prefix, [ --with-linux-prefix=PFX where are linux sources [[=/usr/src/linux]]], |
| 561 |
[], with_linux_prefix=ifelse([$1], [], /usr/src/linux, $1)) |
| 562 |
if test -f $with_linux_prefix/include/linux/modversions.h ; then |
| 563 |
LINUX_CFLAGS="-D__KERNEL__ -DMODULE -I$with_linux_prefix/include -include $with_linux_prefix/include/linux/modversions.h" |
| 564 |
LINUX_PREFIX=$with_linux_prefix |
| 565 |
else |
| 566 |
LINUX_CFLAGS="" |
| 567 |
LINUX_PREFIX="" |
| 568 |
fi |
| 569 |
AC_SUBST(LINUX_CFLAGS) |
| 570 |
AC_SUBST(LINUX_PREFIX) |
| 571 |
|
| 572 |
if test -n "$LINUX_PREFIX"; then |
| 573 |
ifelse([$2], [], [:], [$2]) |
| 574 |
else |
| 575 |
ifelse([$3], [], [:], [$3]) |
| 576 |
fi |
| 577 |
]) |
| 578 |
|
| 579 |
|
| 580 |
dnl AC_AVM_CHECK_LIB([NAME], [TEXT], [TEST-TEXT], [ADLIBS], |
| 581 |
dnl [HEADER], [CODE], [ACTION-m4_toupper([$1])IF-TRUE], [ACTION-IF-FALSE]) |
| 582 |
dnl advanced macro for testing library presence |
| 583 |
AC_DEFUN([AC_AVM_CHECK_LIB], |
| 584 |
[ |
| 585 |
AC_ARG_WITH($1_prefix, AC_HELP_STRING([--with-$1-prefix=PFX],[$3.]), |
| 586 |
m4_toupper([$1])_CFLAGS="-I$withval/include";m4_toupper([$1])_LIBS="-L$withval/lib", |
| 587 |
m4_toupper([$1])_CFLAGS="";m4_toupper([$1])_LIBS="") |
| 588 |
|
| 589 |
AC_ARG_ENABLE($1test, [AC_HELP_STRING([--disable-$1test],[do not try to compile and run a $1 test program.])], |
| 590 |
[], enable_$1test=yes) |
| 591 |
|
| 592 |
test "${have_$1+set}" = set || have_$1=yes |
| 593 |
|
| 594 |
if test "$have_$1" = yes -a "$enable_$1test" = yes; then |
| 595 |
ac_save_CFLAGS=$CFLAGS |
| 596 |
ac_save_LDFLAGS=$LDFLAGS |
| 597 |
ac_save_LIBS=$LIBS |
| 598 |
CFLAGS="$CFLAGS $m4_toupper([$1])_CFLAGS" |
| 599 |
LDFLAGS="$LDFLAGS $m4_toupper([$1])_LIBS" |
| 600 |
LIBS="$LIBS $4" |
| 601 |
unset ac_run_ifelse |
| 602 |
AC_CACHE_CHECK([$2], ac_cv_val_have_$1, [ |
| 603 |
rm -f conf.$1test |
| 604 |
ac_run_ifelse=yes |
| 605 |
AC_RUN_IFELSE(AC_LANG_SOURCE([#include <stdlib.h> |
| 606 |
$5 |
| 607 |
|
| 608 |
int main() { |
| 609 |
int ret = 0; |
| 610 |
$6; |
| 611 |
system("touch conf.$1test"); |
| 612 |
return ret; |
| 613 |
} |
| 614 |
]), ac_cv_val_have_$1=yes, ac_cv_val_have_$1=no, |
| 615 |
[ echo $ac_n "cross compiling; assumed OK... $ac_c" ])]) |
| 616 |
|
| 617 |
if test -n "$ac_run_ifelse" -a ! -f conf.$1test; then |
| 618 |
AC_MSG_WARN([Could not run $1 test program, checking why...]) |
| 619 |
AC_LINK_IFELSE(AC_LANG_PROGRAM([$5], []), [ |
| 620 |
AC_MSG_RESULT([*** The test program compiled, but did not run. This usually means |
| 621 |
*** that the run-time linker is not finding $1 or finding the wrong |
| 622 |
*** version of $1. If it is not finding $1, you will need to set your |
| 623 |
*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point |
| 624 |
*** to the installed location Also, make sure you have run ldconfig if that |
| 625 |
*** is required on your system |
| 626 |
*** |
| 627 |
*** If you have an old version installed, it is best to remove it, although |
| 628 |
*** you may also be able to get things to work by modifying LD_LIBRARY_PATH])], [ |
| 629 |
AC_MSG_RESULT([*** The test program failed to compile or link. See the file config.log for the |
| 630 |
*** exact error that occured. This usually means $1 was incorrectly installed.])]) |
| 631 |
fi |
| 632 |
rm -f conf.$1test |
| 633 |
CFLAGS=$ac_save_CFLAGS |
| 634 |
LDFLAGS=$ac_save_LDFLAGS |
| 635 |
LIBS=$ac_save_LIBS |
| 636 |
test "$ac_cv_val_have_$1" = no && have_$1=no |
| 637 |
fi |
| 638 |
|
| 639 |
if test "$have_$1" = yes; then |
| 640 |
m4_toupper([$1])_LIBS="$m4_toupper([$1])_LIBS $4" |
| 641 |
ifelse([$7], , :, [$7]) |
| 642 |
else |
| 643 |
m4_toupper([$1])_CFLAGS="" |
| 644 |
m4_toupper([$1])_LIBS="" |
| 645 |
ifelse([$8], , :, [$8]) |
| 646 |
fi |
| 647 |
AC_SUBST(m4_toupper([$1])_CFLAGS) |
| 648 |
AC_SUBST(m4_toupper([$1])_LIBS) |
| 649 |
]) |
| 650 |
|
| 651 |
dnl AC_IF_YES([TEST-FOR-YES], [ACTION-IF-TRUE], [ACTION-IF-FALSE]) |
| 652 |
dnl AS_IF() abstraction, checks shell variable for 'yes' |
| 653 |
AC_DEFUN([AC_IF_YES], [AS_IF([test $$1 = yes], [$2], [$3])]) |