1986ba33cSDag-Erling Smørgrav# =========================================================================== 2*5afab0e5SDag-Erling Smørgrav# https://www.gnu.org/software/autoconf-archive/ax_config_feature.html 3986ba33cSDag-Erling Smørgrav# =========================================================================== 4986ba33cSDag-Erling Smørgrav# 5986ba33cSDag-Erling Smørgrav# SYNOPSIS 6986ba33cSDag-Erling Smørgrav# 7986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE(FEATURE-NAME, FEATURE-DESCRIPTION, DEFINE, DEFINE-DESCRIPTION, [ACTION-IF-ENABLED [, ACTION-IF-NOT-ENABLED]]) 8986ba33cSDag-Erling Smørgrav# 9986ba33cSDag-Erling Smørgrav# DESCRIPTION 10986ba33cSDag-Erling Smørgrav# 11986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE is a simple wrapper for AC_ARG_ENABLE, it enables the 12986ba33cSDag-Erling Smørgrav# feature FEATURE-NAME and AC_DEFINEs the passed DEFINE, depending on the 13986ba33cSDag-Erling Smørgrav# user choice. DESCRIPTION will be used for AC_DEFINEs. ACTION-IF-ENABLED 14986ba33cSDag-Erling Smørgrav# and ACTION-IF-NOT-ENABLED are the actions that will be run. A feature is 15986ba33cSDag-Erling Smørgrav# enabled by default, in order to change this behaviour use the 16986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE_DEFAULT_ENABLED and AX_CONFIG_FEATURE_DEFAULT_DISABLED 17986ba33cSDag-Erling Smørgrav# macros. 18986ba33cSDag-Erling Smørgrav# 19986ba33cSDag-Erling Smørgrav# A simple example: 20986ba33cSDag-Erling Smørgrav# 21986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE_DEFAULT_ENABLED 22986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE(feature_xxxxx, [turns on/off XXXXX support], 23986ba33cSDag-Erling Smørgrav# HAVE_XXXXX, [Define if you want XXXXX support]) 24986ba33cSDag-Erling Smørgrav# 25986ba33cSDag-Erling Smørgrav# ... 26986ba33cSDag-Erling Smørgrav# 27986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE_DEFAULT_DISABLED 28986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE(feature_yyyyy, [turns on/off YYYYY support], 29986ba33cSDag-Erling Smørgrav# HAVE_YYYYY, [Define if you want YYYYY support], 30986ba33cSDag-Erling Smørgrav# [enable_yyyyy="yes"], [enable_yyyyy="no"]) 31986ba33cSDag-Erling Smørgrav# AM_CONDITIONAL(YYYYY, [test "$enable_yyyyy" = "yes"]) 32986ba33cSDag-Erling Smørgrav# 33986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE_DEFAULT_ENABLED 34986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE(...) 35986ba33cSDag-Erling Smørgrav# 36986ba33cSDag-Erling Smørgrav# ... 37986ba33cSDag-Erling Smørgrav# 38986ba33cSDag-Erling Smørgrav# If you have lot of features and you want a verbose dumping of each user 39986ba33cSDag-Erling Smørgrav# selection use AX_CONFIG_FEATURE_VERBOSE. Use AX_CONFIG_FEATURE_SILENT in 40986ba33cSDag-Erling Smørgrav# order to remove a previously AX_CONFIG_FEATURE_VERBOSE. By default 41986ba33cSDag-Erling Smørgrav# features are silent. 42986ba33cSDag-Erling Smørgrav# 43986ba33cSDag-Erling Smørgrav# Use AX_CONFIG_FEATURE_ENABLE or AX_CONFIG_FEATURE_DISABLE in order to 44986ba33cSDag-Erling Smørgrav# enable or disable a specific feature. 45986ba33cSDag-Erling Smørgrav# 46986ba33cSDag-Erling Smørgrav# Another simple example: 47986ba33cSDag-Erling Smørgrav# 48986ba33cSDag-Erling Smørgrav# AS_IF([some_test_here],[AX_CONFIG_FEATURE_ENABLE(feature_xxxxx)],[]) 49986ba33cSDag-Erling Smørgrav# 50986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE(feature_xxxxx, [turns on/off XXXXX support], 51986ba33cSDag-Erling Smørgrav# HAVE_XXXXX, [Define if you want XXXXX support]) 52986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE(feature_yyyyy, [turns on/off YYYYY support], 53986ba33cSDag-Erling Smørgrav# HAVE_YYYYY, [Define if you want YYYYY support], 54986ba33cSDag-Erling Smørgrav# [enable_yyyyy="yes"], [enable_yyyyy="no"]) 55986ba33cSDag-Erling Smørgrav# 56986ba33cSDag-Erling Smørgrav# ... 57986ba33cSDag-Erling Smørgrav# 58986ba33cSDag-Erling Smørgrav# NOTE: AX_CONFIG_FEATURE_ENABLE() must be placed first of the relative 59986ba33cSDag-Erling Smørgrav# AX_CONFIG_FEATURE() macro ... 60986ba33cSDag-Erling Smørgrav# 61986ba33cSDag-Erling Smørgrav# LICENSE 62986ba33cSDag-Erling Smørgrav# 63986ba33cSDag-Erling Smørgrav# Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net> 64986ba33cSDag-Erling Smørgrav# 65986ba33cSDag-Erling Smørgrav# This program is free software; you can redistribute it and/or modify it 66986ba33cSDag-Erling Smørgrav# under the terms of the GNU General Public License as published by the 67986ba33cSDag-Erling Smørgrav# Free Software Foundation; either version 2 of the License, or (at your 68986ba33cSDag-Erling Smørgrav# option) any later version. 69986ba33cSDag-Erling Smørgrav# 70986ba33cSDag-Erling Smørgrav# This program is distributed in the hope that it will be useful, but 71986ba33cSDag-Erling Smørgrav# WITHOUT ANY WARRANTY; without even the implied warranty of 72986ba33cSDag-Erling Smørgrav# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 73986ba33cSDag-Erling Smørgrav# Public License for more details. 74986ba33cSDag-Erling Smørgrav# 75986ba33cSDag-Erling Smørgrav# You should have received a copy of the GNU General Public License along 76*5afab0e5SDag-Erling Smørgrav# with this program. If not, see <https://www.gnu.org/licenses/>. 77986ba33cSDag-Erling Smørgrav# 78986ba33cSDag-Erling Smørgrav# As a special exception, the respective Autoconf Macro's copyright owner 79986ba33cSDag-Erling Smørgrav# gives unlimited permission to copy, distribute and modify the configure 80986ba33cSDag-Erling Smørgrav# scripts that are the output of Autoconf when processing the Macro. You 81986ba33cSDag-Erling Smørgrav# need not follow the terms of the GNU General Public License when using 82986ba33cSDag-Erling Smørgrav# or distributing such scripts, even though portions of the text of the 83986ba33cSDag-Erling Smørgrav# Macro appear in them. The GNU General Public License (GPL) does govern 84986ba33cSDag-Erling Smørgrav# all other use of the material that constitutes the Autoconf Macro. 85986ba33cSDag-Erling Smørgrav# 86986ba33cSDag-Erling Smørgrav# This special exception to the GPL applies to versions of the Autoconf 87986ba33cSDag-Erling Smørgrav# Macro released by the Autoconf Archive. When you make and distribute a 88986ba33cSDag-Erling Smørgrav# modified version of the Autoconf Macro, you may extend this special 89986ba33cSDag-Erling Smørgrav# exception to the GPL to apply to your modified version as well. 90986ba33cSDag-Erling Smørgrav 91*5afab0e5SDag-Erling Smørgrav#serial 11 92986ba33cSDag-Erling Smørgrav 93986ba33cSDag-Erling SmørgravAC_DEFUN([AX_CONFIG_FEATURE],[ dnl 94986ba33cSDag-Erling Smørgravm4_pushdef([FEATURE], patsubst([$1], -, _))dnl 95986ba33cSDag-Erling Smørgrav 96986ba33cSDag-Erling SmørgravAC_ARG_ENABLE([$1],AS_HELP_STRING([--enable-$1],[$2]),[ 97986ba33cSDag-Erling Smørgravcase "${enableval}" in 98986ba33cSDag-Erling Smørgrav yes) 99986ba33cSDag-Erling Smørgrav ax_config_feature_[]FEATURE[]="yes" 100986ba33cSDag-Erling Smørgrav ;; 101986ba33cSDag-Erling Smørgrav no) 102986ba33cSDag-Erling Smørgrav ax_config_feature_[]FEATURE[]="no" 103986ba33cSDag-Erling Smørgrav ;; 104986ba33cSDag-Erling Smørgrav *) 105986ba33cSDag-Erling Smørgrav AC_MSG_ERROR([bad value ${enableval} for feature --$1]) 106986ba33cSDag-Erling Smørgrav ;; 107986ba33cSDag-Erling Smørgravesac 108986ba33cSDag-Erling Smørgrav]) 109986ba33cSDag-Erling Smørgrav 110986ba33cSDag-Erling SmørgravAS_IF([test "$ax_config_feature_[]FEATURE[]" = yes],[ dnl 111986ba33cSDag-Erling Smørgrav AC_DEFINE([$3]) 112986ba33cSDag-Erling Smørgrav $5 113986ba33cSDag-Erling Smørgrav AS_IF([test "$ax_config_feature_verbose" = yes],[ dnl 114986ba33cSDag-Erling Smørgrav AC_MSG_NOTICE([Feature $1 is enabled]) 115986ba33cSDag-Erling Smørgrav ]) 116986ba33cSDag-Erling Smørgrav],[ dnl 117986ba33cSDag-Erling Smørgrav $6 118986ba33cSDag-Erling Smørgrav AS_IF([test "$ax_config_feature_verbose" = yes],[ dnl 119986ba33cSDag-Erling Smørgrav AC_MSG_NOTICE([Feature $1 is disabled]) 120986ba33cSDag-Erling Smørgrav ]) 121986ba33cSDag-Erling Smørgrav]) 122986ba33cSDag-Erling Smørgrav 123986ba33cSDag-Erling SmørgravAH_TEMPLATE([$3],[$4]) 124986ba33cSDag-Erling Smørgrav 125986ba33cSDag-Erling Smørgravm4_popdef([FEATURE])dnl 126986ba33cSDag-Erling Smørgrav]) 127986ba33cSDag-Erling Smørgrav 128986ba33cSDag-Erling Smørgravdnl Feature global 129986ba33cSDag-Erling SmørgravAC_DEFUN([AX_CONFIG_FEATURE_VERBOSE],[ dnl 130986ba33cSDag-Erling Smørgrav ax_config_feature_verbose=yes 131986ba33cSDag-Erling Smørgrav]) 132986ba33cSDag-Erling Smørgrav 133986ba33cSDag-Erling Smørgravdnl Feature global 134986ba33cSDag-Erling SmørgravAC_DEFUN([AX_CONFIG_FEATURE_SILENT],[ dnl 135986ba33cSDag-Erling Smørgrav ax_config_feature_verbose=no 136986ba33cSDag-Erling Smørgrav]) 137986ba33cSDag-Erling Smørgrav 138986ba33cSDag-Erling Smørgravdnl Feature specific 139986ba33cSDag-Erling SmørgravAC_DEFUN([AX_CONFIG_FEATURE_DEFAULT_ENABLED], [ 140986ba33cSDag-Erling Smørgrav ax_config_feature_[]FEATURE[]_default=yes 141986ba33cSDag-Erling Smørgrav]) 142986ba33cSDag-Erling Smørgrav 143986ba33cSDag-Erling Smørgravdnl Feature specific 144986ba33cSDag-Erling SmørgravAC_DEFUN([AX_CONFIG_FEATURE_DEFAULT_DISABLED], [ 145986ba33cSDag-Erling Smørgrav ax_config_feature_[]FEATURE[]_default=no 146986ba33cSDag-Erling Smørgrav]) 147986ba33cSDag-Erling Smørgrav 148986ba33cSDag-Erling Smørgravdnl Feature specific 149986ba33cSDag-Erling SmørgravAC_DEFUN([AX_CONFIG_FEATURE_ENABLE],[ dnl 150986ba33cSDag-Erling Smørgrav ax_config_feature_[]patsubst([$1], -, _)[]=yes 151986ba33cSDag-Erling Smørgrav]) 152986ba33cSDag-Erling Smørgrav 153986ba33cSDag-Erling Smørgravdnl Feature specific 154986ba33cSDag-Erling SmørgravAC_DEFUN([AX_CONFIG_FEATURE_DISABLE],[ dnl 155986ba33cSDag-Erling Smørgrav ax_config_feature_[]patsubst([$1], -, _)[]=no 156986ba33cSDag-Erling Smørgrav]) 157