1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412
|
dnl Copyright (c) 2002 Leon Bottou and Yann Le Cun.
dnl Copyright (c) 2001 AT&T
dnl
dnl Most of these macros are derived from macros listed
dnl at the GNU Autoconf Macro Archive
dnl http://www.gnu.org/software/ac-archive/
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111 USA
dnl
dnl -------------------------------------------------------
dnl @synopsis AC_DEFINE_VERSION
dnl Defines a hexadecimal version number
dnl -------------------------------------------------------
AC_DEFUN([AC_DEFINE_VERSION], [
IFS=. read major minor revis <<__eof__
$2
__eof__
test -z "$major" && major=0
test -z "$minor" && minor=0
test -z "$revis" && revis=0
hexversion=`printf '0x%x%02x%02x' $major $minor $revis`
AC_DEFINE_UNQUOTED($1,[$hexversion],[hexadecimal version number])
])
dnl -------------------------------------------------------
dnl @synopsis AC_DEFINE_INSTALL_PATHS
dnl Define various installation paths
dnl -------------------------------------------------------
AC_DEFUN([AC_DEFINE_INSTALL_PATHS],[
save_prefix="${prefix}"
save_exec_prefix="${exec_prefix}"
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix="$prefix"
DIR_PREFIX="`eval echo \"$prefix\"`"
AC_DEFINE_UNQUOTED(DIR_PREFIX,["${DIR_PREFIX}"],[directory "prefix"])
DIR_EXEC_PREFIX="`eval echo \"$exec_prefix\"`"
DIR_EXEC_PREFIX="`eval echo \"$DIR_EXEC_PREFIX\"`"
AC_DEFINE_UNQUOTED(DIR_EXEC_PREFIX,["${DIR_EXEC_PREFIX}"],[directory "exec_prefix"])
DIR_BINDIR="`eval echo \"$bindir\"`"
DIR_BINDIR="`eval echo \"$DIR_BINDIR\"`"
AC_DEFINE_UNQUOTED(DIR_BINDIR,["${DIR_BINDIR}"],[directory "bindir"])
DIR_LIBDIR="`eval echo \"$libdir\"`"
DIR_LIBDIR="`eval echo \"$DIR_LIBDIR\"`"
AC_DEFINE_UNQUOTED(DIR_LIBDIR,["${DIR_LIBDIR}"],[directory "libdir"])
DIR_DATADIR="`eval echo \"$datadir\"`"
DIR_DATADIR="`eval echo \"$DIR_DATADIR\"`"
AC_DEFINE_UNQUOTED(DIR_DATADIR,["${DIR_DATADIR}"],[directory "datadir"])
DIR_MANDIR="`eval echo \"$mandir\"`"
DIR_MANDIR="`eval echo \"$DIR_MANDIR\"`"
AC_DEFINE_UNQUOTED(DIR_MANDIR,["${DIR_MANDIR}"],[directory "mandir"])
prefix="${save_prefix}"
exec_prefix="${save_exec_prefix}"
])
dnl -------------------------------------------------------
dnl @synopsis AC_CHECK_CXX_OPT(OPTION,
dnl ACTION-IF-OKAY,ACTION-IF-NOT-OKAY)
dnl Check if compiler accepts option OPTION.
dnl -------------------------------------------------------
AC_DEFUN(AC_CHECK_CXX_OPT,[
opt="$1"
AC_MSG_CHECKING([if $CXX accepts $opt])
echo 'void f(){}' > conftest.cc
if test -z "`${CXX} ${CXXFLAGS} ${OPTS} $opt -c conftest.cc 2>&1`"; then
AC_MSG_RESULT(yes)
rm conftest.*
$2
else
AC_MSG_RESULT(no)
rm conftest.*
$3
fi
])
dnl -------------------------------------------------------
dnl @synopsis AC_CXX_OPTIMIZE
dnl Setup option --enable-debug
dnl Collects optimization/debug option in variable OPTS
dnl Filter options from CFLAGS and CXXFLAGS
dnl -------------------------------------------------------
AC_DEFUN(AC_CXX_OPTIMIZE,[
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],
[Compile with debugging options (default: no)]),
[ac_debug=$enableval],[ac_debug=no])
OPTS=
AC_SUBST(OPTS)
saved_CXXFLAGS="$CXXFLAGS"
saved_CFLAGS="$CFLAGS"
CXXFLAGS=
CFLAGS=
for opt in $saved_CXXFLAGS ; do
case $opt in
-g*) test $ac_debug != no && OPTS="$OPTS $opt" ;;
-O*) ;;
*) CXXFLAGS="$CXXFLAGS $opt" ;;
esac
done
for opt in $saved_CFLAGS ; do
case $opt in
-O*|-g*) ;;
*) CFLAGS="$CFLAGS $opt" ;;
esac
done
if test x$ac_debug = xno ; then
OPTS=-DNDEBUG
AC_CHECK_CXX_OPT([-Wall],[OPTS="$OPTS -Wall"])
AC_CHECK_CXX_OPT([-O2],[OPTS="$OPTS -O2"])
else
AC_CHECK_CXX_OPT([-Wall],[OPTS="$OPTS -Wall"])
fi
])
dnl ------------------------------------------------------------------
dnl @synopsis AC_PATH_TIFF([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
dnl Process option --with-tiff
dnl Search LIBTIFF. Define HAVE_TIFF.
dnl Set output variable TIFF_CFLAGS and TIFF_LIBS
dnl ------------------------------------------------------------------
AC_DEFUN([AC_PATH_TIFF],
[
AC_ARG_VAR(TIFF_LIBS, [Libraries for tiff])
AC_ARG_VAR(TIFF_CFLAGS, [Compilation flags for tiff])
ac_tiff=no
AC_ARG_WITH(tiff,
AC_HELP_STRING([--with-tiff=DIR],
[where libtiff is located]),
[ac_tiff=$withval], [ac_tiff=yes] )
# Process specification
if test x$ac_tiff = xyes ; then
test x${TIFF_LIBS+set} != xset && TIFF_LIBS="-ltiff"
elif test x$ac_tiff != xno ; then
test x${TIFF_LIBS+set} != xset && TIFF_LIBS="-L$ac_tiff/lib -ltiff"
test x${TIFF_CFLAGS+set} != xset && TIFF_CFLAGS="-I$ac_tiff/include"
fi
# Try linking
if test x$ac_tiff != xno ; then
AC_MSG_CHECKING([for the libtiff library])
save_CFLAGS="$CFLAGS"
save_CXXFLAGS="$CXXFLAGS"
save_LIBS="$LIBS"
CFLAGS="$CFLAGS $TIFF_CFLAGS"
CXXFLAGS="$CXXFLAGS $TIFF_CFLAGS"
LIBS="$LIBS $TIFF_LIBS"
AC_TRY_LINK([
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <tiffio.h>
#ifdef __cplusplus
}
#endif ],[
TIFFOpen(0,0);],
[ac_tiff=yes], [ac_tiff=no] )
CFLAGS="$save_CFLAGS"
CXXFLAGS="$save_CXXFLAGS"
LIBS="$save_LIBS"
AC_MSG_RESULT($ac_tiff)
fi
# Finish
if test x$ac_tiff = xno; then
TIFF_CFLAGS= ; TIFF_LIBS=
ifelse([$2],,:,[$2])
else
AC_DEFINE(HAVE_TIFF,1,[Define if you have libtiff.])
AC_MSG_RESULT([setting TIFF_CFLAGS=$TIFF_CFLAGS])
AC_MSG_RESULT([setting TIFF_LIBS=$TIFF_LIBS])
ifelse([$1],,:,[$1])
fi
])
dnl ------------------------------------------------------------------
dnl @synopsis AC_PROG_PKG_CONFIG([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
dnl Sets output variables PKG_CONFIG
dnl ------------------------------------------------------------------
AC_DEFUN([AC_PROG_PKG_CONFIG],
[
AC_ARG_VAR(PKG_CONFIG,[Location of the pkg-config program.])
AC_ARG_VAR(PKG_CONFIG_PATH, [Path for pkg-config descriptors.])
AC_PATH_PROG(PKG_CONFIG, pkg-config)
if test -z "$PKG_CONFIG" ; then
ifelse([$2],,:,[$2])
else
ifelse([$1],,:,[$1])
fi
])
dnl ------------------------------------------------------------------
dnl @synopsis AC_PATH_DDJVUUAPI([action-if-found],[action-if-notfound])
dnl Search for ddjvuapi. Defines HAVE_DDJVUAPI.
dnl Sets output variables DDJVUAPI_CFLAGS and DDJVUAPI_LIBS
dnl ------------------------------------------------------------------
AC_DEFUN([AC_PATH_DDJVUAPI],
[
AC_REQUIRE([AC_PROG_PKG_CONFIG])
AC_ARG_VAR(DDJVUAPI_LIBS, [Libraries for ddjvuapi])
AC_ARG_VAR(DDJVUAPI_CFLAGS, [Compilation flags for ddjvuapi])
AC_MSG_CHECKING([for ddjvuapi])
if test -n "$DDJVUAPI_LIBS" ; then
AC_MSG_RESULT([user defined])
AC_MSG_RESULT([using DDJVUAPI_LIBS=$DDJVUAPI_LIBS])
AC_MSG_RESULT([using DDJVUAPI_CFLAGS=$DDJVUAPI_CFLAGS])
elif test -x "$PKG_CONFIG" ; then
if $PKG_CONFIG ddjvuapi ; then
ac_ddjvuapi=yes
AC_MSG_RESULT([found])
DDJVUAPI_LIBS=`$PKG_CONFIG --libs ddjvuapi`
AC_MSG_RESULT([setting DDJVUAPI_LIBS=$DDJVUAPI_LIBS])
DDJVUAPI_CFLAGS=`$PKG_CONFIG --cflags ddjvuapi`
AC_MSG_RESULT([setting DDJVUAPI_CFLAGS=$DDJVUAPI_CFLAGS])
AC_DEFINE(HAVE_DDJVUAPI,1,[Define if you have ddjvuapi.])
ifelse([$1],,:,[$1])
else
AC_MSG_RESULT([not found by pkg-config])
ac_ddjvuapi=no
ifelse([$2],,:,[$2])
fi
else
AC_MSG_RESULT([no pkg-config])
ac_ddjvuapi=no
ifelse([$2],,:,[$2])
fi
])
dnl ------------------------------------------------------------------
dnl @synopsis AC_PATH_GLIB([action-if-found],[action-if-notfound])
dnl Search for glib. Defines HAVE_GLIB.
dnl Sets output variables GLIB_CFLAGS and GLIB_LIBS
dnl ------------------------------------------------------------------
AC_DEFUN([AC_PATH_GLIB],
[
AC_REQUIRE([AC_PROG_PKG_CONFIG])
AC_ARG_VAR(GLIB_LIBS, [Libraries for glib-2.0])
AC_ARG_VAR(GLIB_CFLAGS, [Compilation flags for glib-2.0])
AC_MSG_CHECKING([for glib])
if test -x "$PKG_CONFIG" ; then
if $PKG_CONFIG glib-2.0 ; then
ac_glib=yes
AC_MSG_RESULT([found])
GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
AC_MSG_RESULT([setting GLIB_LIBS=$GLIB_LIBS])
GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
AC_MSG_RESULT([setting GLIB_CFLAGS=$GLIB_CFLAGS])
AC_DEFINE(HAVE_GLIB,1,[Define if you have glib-2.0.])
ifelse([$1],,:,[$1])
else
AC_MSG_RESULT([not found by pkg-config])
ac_glib=no
ifelse([$2],,:,[$2])
fi
else
AC_MSG_RESULT([no pkg-config])
ac_glib=no
ifelse([$2],,:,[$2])
fi
])
dnl ------------------------------------------------------------------
dnl @synopsis AC_PROGS_QT4
dnl Sets output variables QMAKE, MOC, UIC, RCC, LUPDATE, LRELEASE
dnl Prints an error message if QMAKE is not found or not suitable
dnl ------------------------------------------------------------------
AC_DEFUN([AC_PROGS_QT4],
[
AC_REQUIRE([AC_PATH_X])
AC_REQUIRE([AC_PATH_XTRA])
AC_ARG_VAR(QMAKE,[Location of the QMAKE program.])
AC_ARG_VAR(QMAKESPEC,[Location of the QMAKE specifications.])
AC_ARG_VAR(MOC,[Location of the MOC program.])
AC_ARG_VAR(UIC,[Location of the UIC program.])
AC_ARG_VAR(RCC,[Location of the RCC program.])
AC_ARG_VAR(LUPDATE,[Location of the LUPDATE program.])
AC_ARG_VAR(LRELEASE,[Location of the LRELEASE program.])
AC_ARG_VAR(QTDIR,[Location of the Qt package (deprecated).])
path=$PATH
if test -n "QTDIR" && test -d "$QTDIR/include" ; then
if test -d "$QTDIR/include/Qt" ; then :
elif test -f "$QTDIR/include/qobject.h" ; then
AC_MSG_ERROR([We want Qt4 but your QTDIR variable points to a Qt3 install.
Please check variables QTDIR, QMAKE, QMAKESPEC, etc..
Unsetting them is better than setting them wrong.])
fi
fi
if test -n "$QTDIR" && test -d "$QTDIR/bin" ; then
path=$QTDIR/bin:$PATH
fi
if test -z "$QMAKE" ; then
AC_PATH_PROGS([QMAKE], [qmake-qt4 qmake], [], [$path])
fi
if test -z "$QMAKE" ; then
AC_MSG_ERROR([Cannot find the Qt4 program qmake.
Please define variable QMAKE and possibly QMAKESPEC.
Defining QTDIR can help although it is deprecated.])
fi
mkdir conftest.d
cat > conftest.d/conftest.pro <<\EOF
changequote(<<, >>)dnl
message(QMAKE_UIC="$$QMAKE_UIC")
message(QMAKE_MOC="$$QMAKE_MOC")
message(QT_VERSION="$$[QT_VERSION]")
message(QT_INSTALL_PREFIX="$$[QT_INSTALL_PREFIX]")
message(QT_INSTALL_DATA="$$[QT_INSTALL_DATA]")
message(QT_INSTALL_HEADERS="$$[QT_INSTALL_HEADERS]")
message(QT_INSTALL_BINS="$$[QT_INSTALL_BINS]")
changequote([, ])dnl
EOF
if ( cd conftest.d && $QMAKE > conftest.out 2>&1 ) ; then
sed -e 's/^.*: *//' < conftest.d/conftest.out > conftest.d/conftest.sh
. conftest.d/conftest.sh
rm -rf conftest.d
else
rm -rf conftest.d
AC_MSG_ERROR([Cannot successfully run Qt4 program qmake.
Please define variable QMAKE to a working qmake.
If you define QMAKESPEC, make sure it is correct.])
fi
case "$QT_VERSION" in
4.*)
AC_MSG_RESULT([Program qmake reports Qt version $QT_VERSION.])
;;
*)
AC_MSG_ERROR([Qt version $QT_VERSION is insufficient.
Please define variable QMAKE to a suitable qmake.])
;;
esac
if test -z "$QTDIR" &&
test -n "$QT_INSTALL_DATA" &&
test -d "$QT_INSTALL_DATA/bin" ; then
QTDIR="$QT_INSTALL_DATA"
AC_MSG_RESULT([Defining QTDIR=$QTDIR])
fi
path=$PATH
if test -n "$QTDIR" && test -d "$QTDIR/bin" ; then
path=$QTDIR/bin:$path
fi
if test -d "$QT_INSTALL_BINS" ; then
path=$QT_INSTALL_BINS:$path
fi
if test -z "$MOC" ; then
if test -x "$QMAKE_MOC" ; then
MOC=$QMAKE_MOC
AC_MSG_RESULT([Defining MOC=$MOC])
elif test -d "$QTDIR" && test -d "$QTDIR/bin" && test -x "$QTDIR/bin/moc" ; then
MOC="$QTDIR/bin/moc"
AC_MSG_RESULT([Defining MOC=$MOC])
else
AC_PATH_PROGS([MOC], [moc-qt4 moc], [], [$path])
fi
fi
if test -z "$UIC" ; then
if test -x "$QMAKE_UIC" ; then
UIC=$QMAKE_UIC
AC_MSG_RESULT([Defining UIC=$UIC])
elif test -d "$QTDIR" && test -d "$QTDIR/bin" && test -x "$QTDIR/bin/uic" ; then
UIC="$QTDIR/bin/uic"
AC_MSG_RESULT([Defining UIC=$UIC])
else
AC_PATH_PROGS([UIC], [uic-qt4 uic], [], [$path])
fi
fi
if test -z "$RCC" ; then
AC_PATH_PROGS([RCC], [rcc-qt4 rcc], [], [$path])
fi
if test -z "$LUPDATE" ; then
AC_PATH_PROGS([LUPDATE], [lupdate-qt4 lupdate], [], [$path])
fi
if test -z "$LRELEASE" ; then
AC_PATH_PROGS([LRELEASE], [lrelease-qt4 lrelease], [], [$path])
fi
PATH=$path
])
|