Browse Source

configure: be more idiomatic

Lots of code in Git's configure.ac doesn't follow the typical formatting,
idioms and best practices for Autoconf input files.  Improve the situation.

There are probably many more similar improvements to be done, but trying
to clump all of them in a single change would make it unreviewable, so we
content ourselves with a partial improvement.

This change is just cosmetic, and should cause no semantic change.

The most relevant of the changes introduced by this patch are:

 - Do not add trailing '\' characters for line continuation where they
   are not truly needed.

 - In several (but not all) macro calls, properly quote the arguments.

 - Few cosmetic changes in spacing and comments.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Stefano Lattarini 13 years ago committed by Junio C Hamano
parent
commit
5b2d131419
  1. 176
      configure.ac

176
configure.ac

@ -1,54 +1,55 @@
# -*- Autoconf -*- # -*- Autoconf -*-
# Process this file with autoconf to produce a configure script. # Process this file with autoconf to produce a configure script.


## Definitions of macros ## Definitions of private macros.

# GIT_CONF_APPEND_LINE(LINE) # GIT_CONF_APPEND_LINE(LINE)
# -------------------------- # --------------------------
# Append LINE to file ${config_append} # Append LINE to file ${config_append}
AC_DEFUN([GIT_CONF_APPEND_LINE], AC_DEFUN([GIT_CONF_APPEND_LINE],
[echo "$1" >> "${config_append}"])# GIT_CONF_APPEND_LINE [echo "$1" >> "${config_append}"])
#
# GIT_ARG_SET_PATH(PROGRAM) # GIT_ARG_SET_PATH(PROGRAM)
# ------------------------- # -------------------------
# Provide --with-PROGRAM=PATH option to set PATH to PROGRAM # Provide --with-PROGRAM=PATH option to set PATH to PROGRAM
# Optional second argument allows setting NO_PROGRAM=YesPlease if # Optional second argument allows setting NO_PROGRAM=YesPlease if
# --without-PROGRAM version used. # --without-PROGRAM version used.
AC_DEFUN([GIT_ARG_SET_PATH], AC_DEFUN([GIT_ARG_SET_PATH],
[AC_ARG_WITH([$1], [AC_ARG_WITH([$1],
[AS_HELP_STRING([--with-$1=PATH], [AS_HELP_STRING([--with-$1=PATH],
[provide PATH to $1])], [provide PATH to $1])],
[GIT_CONF_APPEND_PATH($1,$2)],[]) [GIT_CONF_APPEND_PATH([$1], [$2])],
])# GIT_ARG_SET_PATH [])])
#
# GIT_CONF_APPEND_PATH(PROGRAM) # GIT_CONF_APPEND_PATH(PROGRAM)
# ------------------------------ # -----------------------------
# Parse --with-PROGRAM=PATH option to set PROGRAM_PATH=PATH # Parse --with-PROGRAM=PATH option to set PROGRAM_PATH=PATH
# Used by GIT_ARG_SET_PATH(PROGRAM) # Used by GIT_ARG_SET_PATH(PROGRAM)
# Optional second argument allows setting NO_PROGRAM=YesPlease if # Optional second argument allows setting NO_PROGRAM=YesPlease if
# --without-PROGRAM is used. # --without-PROGRAM is used.
AC_DEFUN([GIT_CONF_APPEND_PATH], AC_DEFUN([GIT_CONF_APPEND_PATH],
[m4_pushdef([GIT_UC_PROGRAM], m4_toupper([$1]))dnl [m4_pushdef([GIT_UC_PROGRAM], m4_toupper([$1]))dnl
PROGRAM=GIT_UC_PROGRAM; \ PROGRAM=GIT_UC_PROGRAM
if test "$withval" = "no"; then \ if test "$withval" = "no"; then
if test -n "$2"; then \ if test -n "$2"; then
GIT_UC_PROGRAM[]_PATH=$withval; \ GIT_UC_PROGRAM[]_PATH=$withval
AC_MSG_NOTICE([Disabling use of ${PROGRAM}]); \ AC_MSG_NOTICE([Disabling use of ${PROGRAM}])
GIT_CONF_APPEND_LINE(NO_${PROGRAM}=YesPlease); \ GIT_CONF_APPEND_LINE(NO_${PROGRAM}=YesPlease)
GIT_CONF_APPEND_LINE(${PROGRAM}_PATH=); \ GIT_CONF_APPEND_LINE(${PROGRAM}_PATH=)
else \ else
AC_MSG_ERROR([You cannot use git without $1]); \ AC_MSG_ERROR([You cannot use git without $1])
fi; \ fi
else \ else
if test "$withval" = "yes"; then \ if test "$withval" = "yes"; then
AC_MSG_WARN([You should provide path for --with-$1=PATH]); \ AC_MSG_WARN([You should provide path for --with-$1=PATH])
else \ else
GIT_UC_PROGRAM[]_PATH=$withval; \ GIT_UC_PROGRAM[]_PATH=$withval
AC_MSG_NOTICE([Setting GIT_UC_PROGRAM[]_PATH to $withval]); \ AC_MSG_NOTICE([Setting GIT_UC_PROGRAM[]_PATH to $withval])
GIT_CONF_APPEND_LINE(${PROGRAM}_PATH=$withval); \ GIT_CONF_APPEND_LINE(${PROGRAM}_PATH=$withval)
fi; \ fi
fi; \ fi
m4_popdef([GIT_UC_PROGRAM])]) # GIT_CONF_APPEND_PATH m4_popdef([GIT_UC_PROGRAM])])
#
# GIT_PARSE_WITH(PACKAGE) # GIT_PARSE_WITH(PACKAGE)
# ----------------------- # -----------------------
# For use in AC_ARG_WITH action-if-found, for packages default ON. # For use in AC_ARG_WITH action-if-found, for packages default ON.
@ -56,22 +57,22 @@ m4_popdef([GIT_UC_PROGRAM])]) # GIT_CONF_APPEND_PATH
# * Set PACKAGEDIR=PATH for --with-PACKAGE=PATH # * Set PACKAGEDIR=PATH for --with-PACKAGE=PATH
# * Unset NO_PACKAGE for --with-PACKAGE without ARG # * Unset NO_PACKAGE for --with-PACKAGE without ARG
AC_DEFUN([GIT_PARSE_WITH], AC_DEFUN([GIT_PARSE_WITH],
[m4_pushdef([GIT_UC_PACKAGE], m4_toupper([$1]))dnl [m4_pushdef([GIT_UC_PACKAGE], m4_toupper([$1]))dnl
PACKAGE=GIT_UC_PACKAGE; \ PACKAGE=GIT_UC_PACKAGE
if test "$withval" = "no"; then \ if test "$withval" = "no"; then
NO_[]GIT_UC_PACKAGE=YesPlease; \ NO_[]GIT_UC_PACKAGE=YesPlease
elif test "$withval" = "yes"; then \ elif test "$withval" = "yes"; then
NO_[]GIT_UC_PACKAGE=; \ NO_[]GIT_UC_PACKAGE=
else \ else
NO_[]GIT_UC_PACKAGE=; \ NO_[]GIT_UC_PACKAGE=
GIT_UC_PACKAGE[]DIR=$withval; \ GIT_UC_PACKAGE[]DIR=$withval
AC_MSG_NOTICE([Setting GIT_UC_PACKAGE[]DIR to $withval]); \ AC_MSG_NOTICE([Setting GIT_UC_PACKAGE[]DIR to $withval])
GIT_CONF_APPEND_LINE(${PACKAGE}DIR=$withval); \ GIT_CONF_APPEND_LINE(${PACKAGE}DIR=$withval)
fi \ fi
m4_popdef([GIT_UC_PACKAGE])]) # GIT_PARSE_WITH m4_popdef([GIT_UC_PACKAGE])])
#
# GIT_PARSE_WITH_SET_MAKE_VAR(WITHNAME, VAR, HELP_TEXT) # GIT_PARSE_WITH_SET_MAKE_VAR(WITHNAME, VAR, HELP_TEXT)
# --------------------- # -----------------------------------------------------
# Set VAR to the value specied by --with-WITHNAME. # Set VAR to the value specied by --with-WITHNAME.
# No verification of arguments is performed, but warnings are issued # No verification of arguments is performed, but warnings are issued
# if either 'yes' or 'no' is specified. # if either 'yes' or 'no' is specified.
@ -80,33 +81,32 @@ m4_popdef([GIT_UC_PACKAGE])]) # GIT_PARSE_WITH
AC_DEFUN([GIT_PARSE_WITH_SET_MAKE_VAR], AC_DEFUN([GIT_PARSE_WITH_SET_MAKE_VAR],
[AC_ARG_WITH([$1], [AC_ARG_WITH([$1],
[AS_HELP_STRING([--with-$1=VALUE], $3)], [AS_HELP_STRING([--with-$1=VALUE], $3)],
if test -n "$withval"; then \ if test -n "$withval"; then
if test "$withval" = "yes" -o "$withval" = "no"; then \ if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_WARN([You likely do not want either 'yes' or 'no' as] AC_MSG_WARN([You likely do not want either 'yes' or 'no' as]
[a value for $1 ($2). Maybe you do...?]); \ [a value for $1 ($2). Maybe you do...?])
fi; \ fi
\ AC_MSG_NOTICE([Setting $2 to $withval])
AC_MSG_NOTICE([Setting $2 to $withval]); \ GIT_CONF_APPEND_LINE($2=$withval)
GIT_CONF_APPEND_LINE($2=$withval); \
fi)])# GIT_PARSE_WITH_SET_MAKE_VAR fi)])# GIT_PARSE_WITH_SET_MAKE_VAR


dnl #
dnl GIT_CHECK_FUNC(FUNCTION, IFTRUE, IFFALSE) # GIT_CHECK_FUNC(FUNCTION, IFTRUE, IFFALSE)
dnl ----------------------------------------- # -----------------------------------------
dnl Similar to AC_CHECK_FUNC, but on systems that do not generate # Similar to AC_CHECK_FUNC, but on systems that do not generate
dnl warnings for missing prototypes (e.g. FreeBSD when compiling without # warnings for missing prototypes (e.g. FreeBSD when compiling without
dnl -Wall), it does not work. By looking for function definition in # -Wall), it does not work. By looking for function definition in
dnl libraries, this problem can be worked around. # libraries, this problem can be worked around.
AC_DEFUN([GIT_CHECK_FUNC],[AC_CHECK_FUNC([$1],[ AC_DEFUN([GIT_CHECK_FUNC],[AC_CHECK_FUNC([$1],[
AC_SEARCH_LIBS([$1],, AC_SEARCH_LIBS([$1],,
[$2],[$3]) [$2],[$3])
],[$3])]) ],[$3])])


dnl #
dnl GIT_STASH_FLAGS(BASEPATH_VAR) # GIT_STASH_FLAGS(BASEPATH_VAR)
dnl ----------------------------- # -----------------------------
dnl Allow for easy stashing of LDFLAGS and CPPFLAGS before running # Allow for easy stashing of LDFLAGS and CPPFLAGS before running
dnl tests that may want to take user settings into account. # tests that may want to take user settings into account.
AC_DEFUN([GIT_STASH_FLAGS],[ AC_DEFUN([GIT_STASH_FLAGS],[
if test -n "$1"; then if test -n "$1"; then
old_CPPFLAGS="$CPPFLAGS" old_CPPFLAGS="$CPPFLAGS"
@ -164,14 +164,13 @@ AC_ARG_WITH([sane-tool-path],
AC_ARG_WITH([lib], AC_ARG_WITH([lib],
[AS_HELP_STRING([--with-lib=ARG], [AS_HELP_STRING([--with-lib=ARG],
[ARG specifies alternative name for lib directory])], [ARG specifies alternative name for lib directory])],
[if test "$withval" = "no" || test "$withval" = "yes"; then \ [if test "$withval" = "no" || test "$withval" = "yes"; then
AC_MSG_WARN([You should provide name for --with-lib=ARG]); \ AC_MSG_WARN([You should provide name for --with-lib=ARG])
else \ else
lib=$withval; \ lib=$withval
AC_MSG_NOTICE([Setting lib to '$lib']); \ AC_MSG_NOTICE([Setting lib to '$lib'])
GIT_CONF_APPEND_LINE(lib=$withval); \ GIT_CONF_APPEND_LINE(lib=$withval)
fi; \ fi])
],[])


if test -z "$lib"; then if test -z "$lib"; then
AC_MSG_NOTICE([Setting lib to 'lib' (the default)]) AC_MSG_NOTICE([Setting lib to 'lib' (the default)])
@ -237,9 +236,9 @@ AC_MSG_NOTICE([CHECKS for site configuration])
# /foo/bar/include and /foo/bar/lib directories. # /foo/bar/include and /foo/bar/lib directories.
AC_ARG_WITH(openssl, AC_ARG_WITH(openssl,
AS_HELP_STRING([--with-openssl],[use OpenSSL library (default is YES)]) AS_HELP_STRING([--with-openssl],[use OpenSSL library (default is YES)])
AS_HELP_STRING([], [ARG can be prefix for openssl library and headers]),\ AS_HELP_STRING([], [ARG can be prefix for openssl library and headers]),
GIT_PARSE_WITH(openssl)) GIT_PARSE_WITH([openssl]))
#
# Define USE_LIBPCRE if you have and want to use libpcre. git-grep will be # Define USE_LIBPCRE if you have and want to use libpcre. git-grep will be
# able to use Perl-compatible regular expressions. # able to use Perl-compatible regular expressions.
# #
@ -249,17 +248,16 @@ GIT_PARSE_WITH(openssl))
AC_ARG_WITH(libpcre, AC_ARG_WITH(libpcre,
AS_HELP_STRING([--with-libpcre],[support Perl-compatible regexes (default is NO)]) AS_HELP_STRING([--with-libpcre],[support Perl-compatible regexes (default is NO)])
AS_HELP_STRING([], [ARG can be also prefix for libpcre library and headers]), AS_HELP_STRING([], [ARG can be also prefix for libpcre library and headers]),
if test "$withval" = "no"; then \ if test "$withval" = "no"; then
USE_LIBPCRE=; \ USE_LIBPCRE=
elif test "$withval" = "yes"; then \ elif test "$withval" = "yes"; then
USE_LIBPCRE=YesPlease; \ USE_LIBPCRE=YesPlease
else else
USE_LIBPCRE=YesPlease; \ USE_LIBPCRE=YesPlease
LIBPCREDIR=$withval; \ LIBPCREDIR=$withval
AC_MSG_NOTICE([Setting LIBPCREDIR to $withval]); \ AC_MSG_NOTICE([Setting LIBPCREDIR to $withval])
GIT_CONF_APPEND_LINE(LIBPCREDIR=$withval); \ GIT_CONF_APPEND_LINE(LIBPCREDIR=$withval)
fi \ fi)
)
# #
# Define NO_CURL if you do not have curl installed. git-http-pull and # Define NO_CURL if you do not have curl installed. git-http-pull and
# git-http-push are not built, and you cannot use http:// and https:// # git-http-push are not built, and you cannot use http:// and https://
@ -367,7 +365,7 @@ AC_ARG_WITH(tcltk,
AS_HELP_STRING([--with-tcltk],[use Tcl/Tk GUI (default is YES)]) AS_HELP_STRING([--with-tcltk],[use Tcl/Tk GUI (default is YES)])
AS_HELP_STRING([],[ARG is the full path to the Tcl/Tk interpreter.]) AS_HELP_STRING([],[ARG is the full path to the Tcl/Tk interpreter.])
AS_HELP_STRING([],[Bare --with-tcltk will make the GUI part only if]) AS_HELP_STRING([],[Bare --with-tcltk will make the GUI part only if])
AS_HELP_STRING([],[Tcl/Tk interpreter will be found in a system.]),\ AS_HELP_STRING([],[Tcl/Tk interpreter will be found in a system.]),
GIT_PARSE_WITH(tcltk)) GIT_PARSE_WITH(tcltk))
# #



Loading…
Cancel
Save