Re: [PATCH 0/2] Set Makefile variables from configure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ben Walton wrote:
> Excerpts from Ben Walton's message of Sat Oct 31 16:41:33 -0400 2009:
 
>> These patches add support for setting the newly created DEFAULT_EDITOR
>> and DEFAULT_PAGER from the configure script.  I also tacked in
>> ETC_GITCONFIG, since I can't currently toggle this without setting a
>> command line value when building, but have need to alter it.
[...]
> Ping?  Is this useful or should I drop it?

I am not sure these patches alone would make the configuration much
easier.  The --help text means one has to check the Makefile to learn
what these options do, anyway:

--with-editor=VALUE	provide value for DEFAULT_EDITOR
--with-pager=VALUE	provide value for DEFAULT_PAGER

But then, why not just set the value directly in the Makefile, 'make'
command line, or config.mak?

Maybe something like this could help.  The help text is not carefully
written; it’s just a placeholder to show the idea.

 configure.ac |   56 ++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 40 insertions(+), 16 deletions(-)

diff --git a/configure.ac b/configure.ac
index f8db034..aeef08c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,20 +68,25 @@ else \
 	GIT_CONF_APPEND_LINE(${PACKAGE}DIR=$withval); \
 fi \
 ])# GIT_PARSE_WITH
+
 dnl
-dnl GIT_WITH_MAKE_VAR(withname, VAR)
-dnl ---------------------
-dnl Set VAR to the value specied by --with-$withname if --with-$withname
-dnl is specified.  This is a direct way to allow setting variables in the
-dnl Makefile.
-AC_DEFUN([GIT_WITH_MAKE_VAR],
-[AC_ARG_WITH([$1],
- [AS_HELP_STRING([--with-$1=VALUE],
-		 [provide value for $2])],
- if test -n "$withval"; then \
-    AC_MSG_NOTICE([Setting $2 to $withval]); \
-    GIT_CONF_APPEND_LINE($2=$withval); \
- fi)])# GIT_WITH_MAKE_VAR
+dnl GIT_PARSE_VALUE(WITHNAME, VAR)
+dnl ------------------------------
+dnl For use in AC_ARG_WITH action-if-found, for tweakable values that
+dnl are not actually enabling or disabling anything.
+dnl  * Set VAR=ARG for --with-WITHNAME=ARG
+dnl  * Complain for --without-WITHNAME or --with-WITHNAME without ARG
+AC_DEFUN([GIT_PARSE_VALUE], [
+if test "$withval" = "no"; then
+	AC_MSG_ERROR([$1 cannot be disabled])
+fi
+if test "$withval" = "yes"; then
+	AC_MSG_WARN([You should provide a value for --with-$1])
+else
+	AC_MSG_NOTICE([Setting $2 to $withval])
+	GIT_CONF_APPEND_LINE($2=$withval)
+fi
+])
 
 dnl
 dnl GIT_CHECK_FUNC(FUNCTION, IFTRUE, IFFALSE)
@@ -242,13 +247,32 @@ GIT_PARSE_WITH(iconv))
 
 #
 # Allow user to set ETC_GITCONFIG variable
-GIT_WITH_MAKE_VAR(gitconfig, ETC_GITCONFIG)
+AC_ARG_WITH(gitconfig,
+  [AS_HELP_STRING([--with-gitconfig=PATH],
+                  [Use PATH instead of /etc/gitconfig.]
+                  [Interpreted by git as a path relative to the computed]
+                  [prefix at run-time.])],
+  [GIT_PARSE_VALUE(gitconfig, ETC_GITCONFIG)])
+
 #
 # Allow user to set the default pager
-GIT_WITH_MAKE_VAR(pager, DEFAULT_PAGER)
+AC_ARG_WITH(pager,
+  [AS_HELP_STRING([--with-pager=CMD],
+                  [Set fall-back pager to CMD instead of less.]
+                  [The fall-back pager will be used by commands such]
+                  [as git log if the user does not specify some]
+                  [preferred pager.])],
+  [GIT_PARSE_VALUE(pager, DEFAULT_PAGER)])
+
 #
 # Allow user to set the default editor
-GIT_WITH_MAKE_VAR(editor, DEFAULT_EDITOR)
+AC_ARG_WITH(editor,
+  [AS_HELP_STRING([--with-editor=CMD],
+                  [Set fall-back text editor to CMD instead of vi.]
+                  [The fall-back editor will be used by commands such]
+                  [as git commit if the user does not specify some]
+                  [preferred editor.])],
+  [GIT_PARSE_VALUE(editor, DEFAULT_EDITOR)])
 
 #
 # Define SHELL_PATH to provide path to shell.
-- 
1.6.5.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]