aboutsummaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4')
-rw-r--r--m4/gnulib-common.m443
1 files changed, 38 insertions, 5 deletions
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 8b73f1d022e..843efe05181 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
1# gnulib-common.m4 serial 25 1# gnulib-common.m4 serial 26
2dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. 2dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -61,16 +61,49 @@ AC_DEFUN([gl_COMMON_BODY], [
61# expands to a C preprocessor expression that evaluates to 1 or 0, depending 61# expands to a C preprocessor expression that evaluates to 1 or 0, depending
62# whether a gnulib module that has been requested shall be considered present 62# whether a gnulib module that has been requested shall be considered present
63# or not. 63# or not.
64AC_DEFUN([gl_MODULE_INDICATOR_CONDITION], [1]) 64m4_define([gl_MODULE_INDICATOR_CONDITION], [1])
65 65
66# gl_MODULE_INDICATOR_SET_VARIABLE([modulename]) 66# gl_MODULE_INDICATOR_SET_VARIABLE([modulename])
67# sets the shell variable that indicates the presence of the given module to 67# sets the shell variable that indicates the presence of the given module to
68# a C preprocessor expression that will evaluate to 1. 68# a C preprocessor expression that will evaluate to 1.
69AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE], 69AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE],
70[ 70[
71 GNULIB_[]m4_translit([[$1]], 71 gl_MODULE_INDICATOR_SET_VARIABLE_AUX(
72 [abcdefghijklmnopqrstuvwxyz./-], 72 [GNULIB_[]m4_translit([[$1]],
73 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=gl_MODULE_INDICATOR_CONDITION 73 [abcdefghijklmnopqrstuvwxyz./-],
74 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])],
75 [gl_MODULE_INDICATOR_CONDITION])
76])
77
78# gl_MODULE_INDICATOR_SET_VARIABLE_AUX([variable])
79# modifies the shell variable to include the gl_MODULE_INDICATOR_CONDITION.
80# The shell variable's value is a C preprocessor expression that evaluates
81# to 0 or 1.
82AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX],
83[
84 m4_if(m4_defn([gl_MODULE_INDICATOR_CONDITION]), [1],
85 [
86 dnl Simplify the expression VALUE || 1 to 1.
87 $1=1
88 ],
89 [gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([$1],
90 [gl_MODULE_INDICATOR_CONDITION])])
91])
92
93# gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([variable], [condition])
94# modifies the shell variable to include the given condition. The shell
95# variable's value is a C preprocessor expression that evaluates to 0 or 1.
96AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR],
97[
98 dnl Simplify the expression 1 || CONDITION to 1.
99 if test "$[]$1" != 1; then
100 dnl Simplify the expression 0 || CONDITION to CONDITION.
101 if test "$[]$1" = 0; then
102 $1=$2
103 else
104 $1="($[]$1 || $2)"
105 fi
106 fi
74]) 107])
75 108
76# gl_MODULE_INDICATOR([modulename]) 109# gl_MODULE_INDICATOR([modulename])