1*986ba33cSDag-Erling Smørgrav# =========================================================================== 2*986ba33cSDag-Erling Smørgrav# http://www.gnu.org/software/autoconf-archive/ax_config_feature.html 3*986ba33cSDag-Erling Smørgrav# =========================================================================== 4*986ba33cSDag-Erling Smørgrav# 5*986ba33cSDag-Erling Smørgrav# SYNOPSIS 6*986ba33cSDag-Erling Smørgrav# 7*986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE(FEATURE-NAME, FEATURE-DESCRIPTION, DEFINE, DEFINE-DESCRIPTION, [ACTION-IF-ENABLED [, ACTION-IF-NOT-ENABLED]]) 8*986ba33cSDag-Erling Smørgrav# 9*986ba33cSDag-Erling Smørgrav# DESCRIPTION 10*986ba33cSDag-Erling Smørgrav# 11*986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE is a simple wrapper for AC_ARG_ENABLE, it enables the 12*986ba33cSDag-Erling Smørgrav# feature FEATURE-NAME and AC_DEFINEs the passed DEFINE, depending on the 13*986ba33cSDag-Erling Smørgrav# user choice. DESCRIPTION will be used for AC_DEFINEs. ACTION-IF-ENABLED 14*986ba33cSDag-Erling Smørgrav# and ACTION-IF-NOT-ENABLED are the actions that will be run. A feature is 15*986ba33cSDag-Erling Smørgrav# enabled by default, in order to change this behaviour use the 16*986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE_DEFAULT_ENABLED and AX_CONFIG_FEATURE_DEFAULT_DISABLED 17*986ba33cSDag-Erling Smørgrav# macros. 18*986ba33cSDag-Erling Smørgrav# 19*986ba33cSDag-Erling Smørgrav# A simple example: 20*986ba33cSDag-Erling Smørgrav# 21*986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE_DEFAULT_ENABLED 22*986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE(feature_xxxxx, [turns on/off XXXXX support], 23*986ba33cSDag-Erling Smørgrav# HAVE_XXXXX, [Define if you want XXXXX support]) 24*986ba33cSDag-Erling Smørgrav# 25*986ba33cSDag-Erling Smørgrav# ... 26*986ba33cSDag-Erling Smørgrav# 27*986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE_DEFAULT_DISABLED 28*986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE(feature_yyyyy, [turns on/off YYYYY support], 29*986ba33cSDag-Erling Smørgrav# HAVE_YYYYY, [Define if you want YYYYY support], 30*986ba33cSDag-Erling Smørgrav# [enable_yyyyy="yes"], [enable_yyyyy="no"]) 31*986ba33cSDag-Erling Smørgrav# AM_CONDITIONAL(YYYYY, [test "$enable_yyyyy" = "yes"]) 32*986ba33cSDag-Erling Smørgrav# 33*986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE_DEFAULT_ENABLED 34*986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE(...) 35*986ba33cSDag-Erling Smørgrav# 36*986ba33cSDag-Erling Smørgrav# ... 37*986ba33cSDag-Erling Smørgrav# 38*986ba33cSDag-Erling Smørgrav# If you have lot of features and you want a verbose dumping of each user 39*986ba33cSDag-Erling Smørgrav# selection use AX_CONFIG_FEATURE_VERBOSE. Use AX_CONFIG_FEATURE_SILENT in 40*986ba33cSDag-Erling Smørgrav# order to remove a previously AX_CONFIG_FEATURE_VERBOSE. By default 41*986ba33cSDag-Erling Smørgrav# features are silent. 42*986ba33cSDag-Erling Smørgrav# 43*986ba33cSDag-Erling Smørgrav# Use AX_CONFIG_FEATURE_ENABLE or AX_CONFIG_FEATURE_DISABLE in order to 44*986ba33cSDag-Erling Smørgrav# enable or disable a specific feature. 45*986ba33cSDag-Erling Smørgrav# 46*986ba33cSDag-Erling Smørgrav# Another simple example: 47*986ba33cSDag-Erling Smørgrav# 48*986ba33cSDag-Erling Smørgrav# AS_IF([some_test_here],[AX_CONFIG_FEATURE_ENABLE(feature_xxxxx)],[]) 49*986ba33cSDag-Erling Smørgrav# 50*986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE(feature_xxxxx, [turns on/off XXXXX support], 51*986ba33cSDag-Erling Smørgrav# HAVE_XXXXX, [Define if you want XXXXX support]) 52*986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE(feature_yyyyy, [turns on/off YYYYY support], 53*986ba33cSDag-Erling Smørgrav# HAVE_YYYYY, [Define if you want YYYYY support], 54*986ba33cSDag-Erling Smørgrav# [enable_yyyyy="yes"], [enable_yyyyy="no"]) 55*986ba33cSDag-Erling Smørgrav# 56*986ba33cSDag-Erling Smørgrav# ... 57*986ba33cSDag-Erling Smørgrav# 58*986ba33cSDag-Erling Smørgrav# NOTE: AX_CONFIG_FEATURE_ENABLE() must be placed first of the relative 59*986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE() macro ... 60*986ba33cSDag-Erling Smørgrav# 61*986ba33cSDag-Erling Smørgrav# LICENSE 62*986ba33cSDag-Erling Smørgrav# 63*986ba33cSDag-Erling Smørgrav# Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net> 64*986ba33cSDag-Erling Smørgrav# 65*986ba33cSDag-Erling Smørgrav# This program is free software; you can redistribute it and/or modify it 66*986ba33cSDag-Erling Smørgrav# under the terms of the GNU General Public License as published by the 67*986ba33cSDag-Erling Smørgrav# Free Software Foundation; either version 2 of the License, or (at your 68*986ba33cSDag-Erling Smørgrav# option) any later version. 69*986ba33cSDag-Erling Smørgrav# 70*986ba33cSDag-Erling Smørgrav# This program is distributed in the hope that it will be useful, but 71*986ba33cSDag-Erling Smørgrav# WITHOUT ANY WARRANTY; without even the implied warranty of 72*986ba33cSDag-Erling Smørgrav# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 73*986ba33cSDag-Erling Smørgrav# Public License for more details. 74*986ba33cSDag-Erling Smørgrav# 75*986ba33cSDag-Erling Smørgrav# You should have received a copy of the GNU General Public License along 76*986ba33cSDag-Erling Smørgrav# with this program. If not, see <http://www.gnu.org/licenses/>. 77*986ba33cSDag-Erling Smørgrav# 78*986ba33cSDag-Erling Smørgrav# As a special exception, the respective Autoconf Macro's copyright owner 79*986ba33cSDag-Erling Smørgrav# gives unlimited permission to copy, distribute and modify the configure 80*986ba33cSDag-Erling Smørgrav# scripts that are the output of Autoconf when processing the Macro. You 81*986ba33cSDag-Erling Smørgrav# need not follow the terms of the GNU General Public License when using 82*986ba33cSDag-Erling Smørgrav# or distributing such scripts, even though portions of the text of the 83*986ba33cSDag-Erling Smørgrav# Macro appear in them. The GNU General Public License (GPL) does govern 84*986ba33cSDag-Erling Smørgrav# all other use of the material that constitutes the Autoconf Macro. 85*986ba33cSDag-Erling Smørgrav# 86*986ba33cSDag-Erling Smørgrav# This special exception to the GPL applies to versions of the Autoconf 87*986ba33cSDag-Erling Smørgrav# Macro released by the Autoconf Archive. When you make and distribute a 88*986ba33cSDag-Erling Smørgrav# modified version of the Autoconf Macro, you may extend this special 89*986ba33cSDag-Erling Smørgrav# exception to the GPL to apply to your modified version as well. 90*986ba33cSDag-Erling Smørgrav 91*986ba33cSDag-Erling Smørgrav#serial 10 92*986ba33cSDag-Erling Smørgrav 93*986ba33cSDag-Erling SmørgravAC_DEFUN([AX_CONFIG_FEATURE],[ dnl 94*986ba33cSDag-Erling Smørgravm4_pushdef([FEATURE], patsubst([$1], -, _))dnl 95*986ba33cSDag-Erling Smørgrav 96*986ba33cSDag-Erling SmørgravAC_ARG_ENABLE([$1],AS_HELP_STRING([--enable-$1],[$2]),[ 97*986ba33cSDag-Erling Smørgravcase "${enableval}" in 98*986ba33cSDag-Erling Smørgrav yes) 99*986ba33cSDag-Erling Smørgrav ax_config_feature_[]FEATURE[]="yes" 100*986ba33cSDag-Erling Smørgrav ;; 101*986ba33cSDag-Erling Smørgrav no) 102*986ba33cSDag-Erling Smørgrav ax_config_feature_[]FEATURE[]="no" 103*986ba33cSDag-Erling Smørgrav ;; 104*986ba33cSDag-Erling Smørgrav *) 105*986ba33cSDag-Erling Smørgrav AC_MSG_ERROR([bad value ${enableval} for feature --$1]) 106*986ba33cSDag-Erling Smørgrav ;; 107*986ba33cSDag-Erling Smørgravesac 108*986ba33cSDag-Erling Smørgrav]) 109*986ba33cSDag-Erling Smørgrav 110*986ba33cSDag-Erling SmørgravAS_IF([test "$ax_config_feature_[]FEATURE[]" = yes],[ dnl 111*986ba33cSDag-Erling Smørgrav AC_DEFINE([$3]) 112*986ba33cSDag-Erling Smørgrav $5 113*986ba33cSDag-Erling Smørgrav AS_IF([test "$ax_config_feature_verbose" = yes],[ dnl 114*986ba33cSDag-Erling Smørgrav AC_MSG_NOTICE([Feature $1 is enabled]) 115*986ba33cSDag-Erling Smørgrav ]) 116*986ba33cSDag-Erling Smørgrav],[ dnl 117*986ba33cSDag-Erling Smørgrav $6 118*986ba33cSDag-Erling Smørgrav AS_IF([test "$ax_config_feature_verbose" = yes],[ dnl 119*986ba33cSDag-Erling Smørgrav AC_MSG_NOTICE([Feature $1 is disabled]) 120*986ba33cSDag-Erling Smørgrav ]) 121*986ba33cSDag-Erling Smørgrav]) 122*986ba33cSDag-Erling Smørgrav 123*986ba33cSDag-Erling SmørgravAH_TEMPLATE([$3],[$4]) 124*986ba33cSDag-Erling Smørgrav 125*986ba33cSDag-Erling Smørgravm4_popdef([FEATURE])dnl 126*986ba33cSDag-Erling Smørgrav]) 127*986ba33cSDag-Erling Smørgrav 128*986ba33cSDag-Erling Smørgravdnl Feature global 129*986ba33cSDag-Erling SmørgravAC_DEFUN([AX_CONFIG_FEATURE_VERBOSE],[ dnl 130*986ba33cSDag-Erling Smørgrav ax_config_feature_verbose=yes 131*986ba33cSDag-Erling Smørgrav]) 132*986ba33cSDag-Erling Smørgrav 133*986ba33cSDag-Erling Smørgravdnl Feature global 134*986ba33cSDag-Erling SmørgravAC_DEFUN([AX_CONFIG_FEATURE_SILENT],[ dnl 135*986ba33cSDag-Erling Smørgrav ax_config_feature_verbose=no 136*986ba33cSDag-Erling Smørgrav]) 137*986ba33cSDag-Erling Smørgrav 138*986ba33cSDag-Erling Smørgravdnl Feature specific 139*986ba33cSDag-Erling SmørgravAC_DEFUN([AX_CONFIG_FEATURE_DEFAULT_ENABLED], [ 140*986ba33cSDag-Erling Smørgrav ax_config_feature_[]FEATURE[]_default=yes 141*986ba33cSDag-Erling Smørgrav]) 142*986ba33cSDag-Erling Smørgrav 143*986ba33cSDag-Erling Smørgravdnl Feature specific 144*986ba33cSDag-Erling SmørgravAC_DEFUN([AX_CONFIG_FEATURE_DEFAULT_DISABLED], [ 145*986ba33cSDag-Erling Smørgrav ax_config_feature_[]FEATURE[]_default=no 146*986ba33cSDag-Erling Smørgrav]) 147*986ba33cSDag-Erling Smørgrav 148*986ba33cSDag-Erling Smørgravdnl Feature specific 149*986ba33cSDag-Erling SmørgravAC_DEFUN([AX_CONFIG_FEATURE_ENABLE],[ dnl 150*986ba33cSDag-Erling Smørgrav ax_config_feature_[]patsubst([$1], -, _)[]=yes 151*986ba33cSDag-Erling Smørgrav]) 152*986ba33cSDag-Erling Smørgrav 153*986ba33cSDag-Erling Smørgravdnl Feature specific 154*986ba33cSDag-Erling SmørgravAC_DEFUN([AX_CONFIG_FEATURE_DISABLE],[ dnl 155*986ba33cSDag-Erling Smørgrav ax_config_feature_[]patsubst([$1], -, _)[]=no 156*986ba33cSDag-Erling Smørgrav]) 157