Skip to content

Commit d79d9e1

Browse files
Ben Waltongitster
authored andcommitted
configure: add macro to set arbitrary make variables
Add macro GIT_PARSE_WITH_SET_MAKE_VAR to configure.ac to allow --with style options that set values for variables used during the make process. Arguments are the $name part of --with-$name, the name of the variable to set in the Makefile (config.mak.autogen) and the help text for the option. Signed-off-by: Ben Walton <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8cc62c1 commit d79d9e1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

configure.ac

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,26 @@ else \
6868
GIT_CONF_APPEND_LINE(${PACKAGE}DIR=$withval); \
6969
fi \
7070
])# GIT_PARSE_WITH
71+
#
72+
# GIT_PARSE_WITH_SET_MAKE_VAR(WITHNAME, VAR, HELP_TEXT)
73+
# ---------------------
74+
# Set VAR to the value specied by --with-WITHNAME.
75+
# No verification of arguments is performed, but warnings are issued
76+
# if either 'yes' or 'no' is specified.
77+
# HELP_TEXT is presented when --help is called.
78+
# This is a direct way to allow setting variables in the Makefile.
79+
AC_DEFUN([GIT_PARSE_WITH_SET_MAKE_VAR],
80+
[AC_ARG_WITH([$1],
81+
[AS_HELP_STRING([--with-$1=VALUE], $3)],
82+
if test -n "$withval"; then \
83+
if test "$withval" = "yes" -o "$withval" = "no"; then \
84+
AC_MSG_WARN([You likely do not want either 'yes' or 'no' as]
85+
[a value for $1 ($2). Maybe you do...?]); \
86+
fi; \
87+
\
88+
AC_MSG_NOTICE([Setting $2 to $withval]); \
89+
GIT_CONF_APPEND_LINE($2=$withval); \
90+
fi)])# GIT_PARSE_WITH_SET_MAKE_VAR
7191

7292
dnl
7393
dnl GIT_CHECK_FUNC(FUNCTION, IFTRUE, IFFALSE)

0 commit comments

Comments
 (0)