dnl @synopsis AC_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION]) dnl dnl This macro _AC_DEFINEs VARNAME to the expansion of the DIR dnl variable, taking care of fixing up ${prefix} and such. dnl dnl Note that the 3 argument form is only supported with autoconf 2.13 and dnl later (i.e. only where _AC_DEFINE supports 3 arguments). dnl dnl Examples: dnl dnl AC_DEFINE_DIR(DATADIR, datadir) dnl AC_DEFINE_DIR(PROG_PATH, bindir, [Location of installed binaries]) dnl dnl @version $Id: acinclude.m4 1331 2006-04-19 15:37:47Z ghutchis $ dnl @author Guido Draheim , original by Alexandre Oliva AC_DEFUN([AC_DEFINE_DIR], [ test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' ac_define_dir=`eval echo [$]$2` ac_define_dir=`eval echo [$]ac_define_dir` ifelse($3, , AC_DEFINE_UNQUOTED($1, "$ac_define_dir"), AC_DEFINE_UNQUOTED($1, "$ac_define_dir", $3)) ]) dnl @synopsis CHECK_ZLIB() dnl dnl This macro searches for an installed zlib library. If nothing was dnl specified when calling configure, it searches first in /usr/local dnl and then in /usr. If the --with-zlib=DIR is specified, it will try dnl to find it in DIR/include/zlib.h and DIR/lib/libz.a. If dnl --without-zlib is specified, the library is not searched at all. dnl dnl If either the header file (zlib.h) or the library (libz) is not dnl found, the configuration exits on error, asking for a valid zlib dnl installation directory or --without-zlib. dnl dnl The macro defines the symbol HAVE_LIBZ if the library is found. You dnl should use autoheader to include a definition for this symbol in a dnl config.h file. Sample usage in a C/C++ source is as follows: dnl dnl #ifdef HAVE_LIBZ dnl #include dnl #endif /* HAVE_LIBZ */ dnl dnl @category InstalledPackages dnl @author Loic Dachary dnl @version 2004-09-20 dnl @license GPLWithACException AC_DEFUN([CHECK_ZLIB], # # Handle user hints # [AC_MSG_CHECKING(if zlib is wanted) AC_ARG_WITH(zlib, [ --with-zlib=DIR root directory path of zlib installation [defaults to /usr/local or /usr if not found in /usr/local] --without-zlib to disable zlib usage completely], [if test "$withval" != no ; then AC_MSG_RESULT(yes) if test -d "$withval" then ZLIB_HOME="$withval" else AC_MSG_WARN([Sorry, $withval does not exist, checking usual places]) ZLIB_HOME=/usr/local fi if test ! -f "${ZLIB_HOME}/include/zlib.h" then ZLIB_HOME=/usr fi else # --without-zlib AC_MSG_RESULT(no) fi]) # # Locate zlib, if wanted # if test -n "${ZLIB_HOME}" then ZLIB_OLD_LDFLAGS=$LDFLAGS ZLIB_OLD_CPPFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib" CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include" AC_LANG_SAVE AC_LANG_C AC_CHECK_LIB(z, inflateEnd, [zlib_cv_libz=yes], [zlib_cv_libz=no]) AC_CHECK_HEADER(zlib.h, [zlib_cv_zlib_h=yes], [zlib_cv_zlib_h=no]) AC_LANG_RESTORE if test "$zlib_cv_libz" = "yes" -a "$zlib_cv_zlib_h" = "yes" then # # If both library and header were found, use them # AC_CHECK_LIB(z, inflateEnd) AC_MSG_CHECKING(zlib in ${ZLIB_HOME}) AC_MSG_RESULT(ok) else # # If either header or library was not found, revert and bomb # AC_MSG_CHECKING(zlib in ${ZLIB_HOME}) LDFLAGS="$ZLIB_OLD_LDFLAGS" CPPFLAGS="$ZLIB_OLD_CPPFLAGS" AC_MSG_RESULT(failed) AC_MSG_ERROR(either specify a valid zlib installation with --with-zlib=DIR or disable zlib usage with --without-zlib) fi fi ]) dnl @synopsis AX_MAINTAINER_MODE_AUTO_SILENT dnl dnl Set autotools to error/sleep settings so that they are not run when dnl being errornously triggered. Likewise make libtool-silent when dnl libtool has been used. dnl dnl I am using the macro quite a lot since some automake versions had dnl the tendency to try to rerun some autotools on a mere make even dnl when not quite in --maintainer-mode. That is very annoying. dnl Likewise, a user who installs from source does not want to see dnl doubled compiler messages. dnl dnl I did not put an AC-REQUIRE(MAINTAINER_MODE) in here - should I? dnl dnl @category Misc dnl @category Automake dnl @author Guido Draheim dnl @version 2005-01-21 dnl @license GPLWithACException AC_DEFUN([AX_MAINTAINER_MODE_AUTO_SILENT],[dnl dnl ac_REQUIRE([am_MAINTAINER_MODE])dn AC_MSG_CHECKING(auto silent in maintainer mode) if test "$USE_MAINTAINER_MODE" = "no" ; then test ".$TIMEOUT" = "." && TIMEOUT="9" AUTOHEADER="sleep $TIMEOUT ; true || autoheader || skipped" AUTOMAKE="sleep $TIMEOUT ; true || automake || skipped" AUTOCONF="sleep $TIMEOUT ; true || autoconf || skipped" if test ".$LIBTOOL" != "." ; then LIBTOOL="$LIBTOOL --silent" AC_MSG_RESULT([libtool-silent, auto-sleep-9]) else AC_MSG_RESULT([auto-sleep-9]) fi else AC_MSG_RESULT([no]) fi ]) dnl @synopsis AX_CHECK_COMPILER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE]) dnl dnl @summary check whether FLAGS are accepted by the compiler dnl dnl Check whether the given compiler FLAGS work with the current dnl language's compiler, or whether they give an error. (Warnings, dnl however, are ignored.) dnl dnl ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on dnl success/failure. dnl dnl @category Misc dnl @author Steven G. Johnson and Matteo Frigo. dnl @version 2005-05-30 dnl @license GPLWithACException AC_DEFUN([AX_CHECK_COMPILER_FLAGS], [AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1]) dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname: AS_LITERAL_IF([$1], [AC_CACHE_VAL(AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1), [ ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS _AC_LANG_PREFIX[]FLAGS="$1" AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=yes, AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=no) _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])], [ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS _AC_LANG_PREFIX[]FLAGS="$1" AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=yes, eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=no) _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS]) eval ax_check_compiler_flags=$AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1) AC_MSG_RESULT($ax_check_compiler_flags) if test "x$ax_check_compiler_flags" = xyes; then m4_default([$2], :) else m4_default([$3], :) fi ])dnl AX_CHECK_COMPILER_FLAGS