dnl @synopsis AX_ARG_WITH_CHECK(PACKAGE, HELP-STRING, RESULT-ID, TEST-SCRIPT, ACTION-IF-TRUE [, ACTION-IF-FALSE]) dnl dnl @summary Check for an external requirement and add a switch to force it on or off. dnl dnl This macro is used to peform a test on the availability dnl of a feature that needs an external requirement, giving dnl the user the possibility to explicitely enable or dnl disable the feature through a configure switch. dnl dnl If the user gave `configure' the option `--with-PACKAGE', dnl or no option was given, run commands TEST-SCRIPT, which dnl are supposed to store the result in RESULT-ID. If the value dnl of RESULT-ID is `no', the test is considered failed, and dnl ACTION-IF-FALSE is run. Any other value is considered a dnl success, and ACTION-IF-TRUE is run. If the user gave dnl `--without-PACKAGE', ACTION-IF-FALSE is run. If the user dnl gave `--with-PACKAGE' and the test failed, exit with an dnl error. dnl dnl Example: dnl dnl AX_ARG_WITH_CHECK(libidn, AC_HELP_STRING([--with-libidn],[enable support for the idn library]), have_libidn, dnl [ dnl AC_CHECK_LIB(idn, idna_to_ascii_4i, have_libidn=yes, have_libidn=no) dnl ], dnl [ dnl LIBIDN="-lidn" dnl AC_DEFINE_UNQUOTED(HAVE_LIBIDN, 1, [Define if you have libidn]) dnl ], dnl [ dnl LIBIDN= dnl ]) dnl AC_SUBST(LIBIDN) dnl dnl @author Gregorio Guidi dnl @version 2005-02-03 dnl @license AllPermissive AC_DEFUN(AX_ARG_WITH_CHECK, [AC_ARG_WITH([$1], [$2 @<:@default=check@:>@], , [with_]patsubst([$1], -, _)=check) if test "[x$with_]patsubst([$1], -, _)" != xno; then $4 if test "x$[$3]" != xno; then ifelse([$5], , :, [$5]) else if test "[x$with_]patsubst([$1], -, _)" != xcheck; then AC_MSG_ERROR([--with-[$1] was given, but test for [$1] failed]) fi fi fi ifelse([$6], , , [if test "[x$with_]patsubst([$1], -, _)" = xno || test "x$[$3]" = xno; then $6 fi])]) dnl @synopsis AX_ARG_ENABLE_CHECK(FEATURE, HELP-STRING, RESULT-ID, TEST-SCRIPT, ACTION-IF-TRUE [, ACTION-IF-FALSE]) dnl dnl @summary Check for a feature and add a switch to force it on or off. dnl dnl This macro is used to peform a test on the availability dnl of an internal feature, giving the user the possibility to dnl explicitely enable or disable the feature through a dnl configure switch. dnl dnl If the user gave `configure' the option `--enable-FEATURE', dnl or no option was given, run commands TEST-SCRIPT, which dnl are supposed to store the result in RESULT-ID. If the value dnl of RESULT-ID is `no', the test is considered failed, and dnl ACTION-IF-FALSE is run. Any other value is considered a dnl success, and ACTION-IF-TRUE is run. If the user gave dnl `--disable-FEATURE', ACTION-IF-FALSE is run. If the user dnl gave `--enable-FEATURE' and the test failed, exit with an dnl error. dnl dnl Example: dnl dnl AX_ARG_ENABLE_CHECK(internal-malloc, AC_HELP_STRING([--enable-internal-malloc],[use own malloc implementation]), ac_cv_internal_malloc, dnl [ dnl AC_CACHE_CHECK([whether own malloc implementation can be used], ac_cv_internal_malloc, dnl [ dnl case $target_cpu in dnl i?86) dnl ac_cv_internal_malloc=yes;; dnl *) dnl ac_cv_internal_malloc=no;; dnl esac dnl ]) dnl ], dnl [ dnl AC_DEFINE_UNQUOTED(USE_INTERNAL_MALLOC, 1, [Define to use internal malloc implementation]) dnl ]) dnl dnl @author Gregorio Guidi dnl @version 2005-02-03 dnl @license AllPermissive AC_DEFUN(AX_ARG_ENABLE_CHECK, [AC_ARG_ENABLE([$1], [$2 @<:@default=check@:>@], , [enable_]patsubst([$1], -, _)=check) if test "[x$enable_]patsubst([$1], -, _)" != xno; then $4 if test "x$[$3]" != xno; then ifelse([$5], , :, [$5]) else if test "[x$enable_]patsubst([$1], -, _)" != xcheck; then AC_MSG_ERROR([--enable-[$1] was given, but test for [$1] failed]) fi fi fi ifelse([$6], , , [if test "[x$enable_]patsubst([$1], -, _)" = xno || test "x$[$3]" = xno; then $6 fi])])