Skip to contentSkip to conversation

autoconf: Add support for SHELL_PATH, PERL_PATH and PYTHON_PATH

PATCH New Jakub Narebski 1 participant 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

cover autoconf: Add support for SHELL_PATH, PERL_PATH and PYTHON_PATH

The following series of patches adds support for setting SHELL_PATH, PERL_PATH and PYTHON_PATH from autoconf configure script using --with-FEATURE=PATH option to ./configure invocation

Needs revision by someone better versed in autoconf than me.

1. autoconf: Add support for setting SHELL_PATH and PERL_PATH
2. autoconf: Move site configuration section earlier in configure.ac
3. autoconf: Add support for setting PYTHON_PATH or NO_PYTHON

Signature · 2 lines
Jakub Narebski
Poland
#1 lore raw

PATCH 1/3 autoconf: Add support for setting SHELL_PATH and PERL_PATH

This patch adds support for setting SHELL_PATH and PERL_PATH to autoconf generated ./configure script via --with-shell=PATH and --with-perl=PATH options.

---
 configure.ac |   35 +++++++++++++++++++++++++++++++++--
 1 files changed, 33 insertions(+), 2 deletions(-)
configure.ac +33 -2
index c1f7751..4688e97 100644
@@ -19,17 +19,47 @@ # --------------------------
 # Append LINE to file ${config_append}
 AC_DEFUN([GIT_CONF_APPEND_LINE],
 [echo "$1" >> "${config_append}"])# GIT_CONF_APPEND_LINE
+#
+# GIT_ARG_SET_PATH(PROGRAM)
+# -------------------------
+# Provide --with-PROGRAM=PATH option to set PATH to PROGRAM
+AC_DEFUN([GIT_ARG_SET_PATH],
+[AC_ARG_WITH([$1],
+ [AS_HELP_STRING([--with-$1=PATH],
+                 [provide PATH to $1])],
+ [GIT_CONF_APPEND_PATH($1)],[])
+])# GIT_ARG_SET_PATH
+#
+# GIT_CONF_APPEND_PATH(PROGRAM)
+# ------------------------------
+# Parse --with-PROGRAM=PATH option to set PROGRAM_PATH=PATH
+# Used by GIT_ARG_SET_PATH(PROGRAM)
+AC_DEFUN([GIT_CONF_APPEND_PATH],
+[PROGRAM=m4_toupper($1); \
+if test "$withval" = "no"; then \
+	AC_MSG_WARN([You cannot use git without $1]); \
+else \
+	if test "$withval" = "yes"; then \
+		AC_MSG_WARN([You should provide path for --with-$1=PATH]); \
+	else \
+		GIT_CONF_APPEND_LINE(${PROGRAM}_PATH=$withval); \
+	fi; \
+fi; \
+]) # GIT_CONF_APPEND_PATH
 
 
 ## Checks for programs.
 AC_MSG_NOTICE([CHECKS for programs])
 #
+GIT_ARG_SET_PATH(shell)
+GIT_ARG_SET_PATH(perl)
+#
+# Define NO_PYTHON if you want to lose all benefits of the recursive merge.
+# Define PYTHON_PATH to provide path to Python.
 AC_PROG_CC
 #AC_PROG_INSTALL		# needs install-sh or install.sh in sources
 AC_CHECK_TOOL(AR, ar, :)
 AC_CHECK_PROGS(TAR, [gtar tar])
-#
-# Define NO_PYTHON if you want to lose all benefits of the recursive merge.
 
 
 ## Checks for libraries.
@@ -127,6 +157,7 @@ # a missing newline at the end of the fi
 
 ## Site configuration
 ## --with-PACKAGE[=ARG] and --without-PACKAGE
+#
 # Define NO_SVN_TESTS if you want to skip time-consuming SVN interopability
 # tests.  These tests take up a significant amount of the total test time
 # but are not needed unless you plan to talk to SVN repos.
Signature · 1 line
1.4.1.1
#2 lore raw

PATCH 2/3 autoconf: Move site configuration section earlier in configure.ac

In reply to Jakub Narebski

Move site configuration section, i.e. --with-PACKAGE[=ARG] and --without-PACKAGE, --enable-FEATURE[=ARG] and --disable-FEATURE options to the beginning of configure.ac file, just after definitions of macros.

---
 configure.ac |  100 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 50 insertions(+), 50 deletions(-)
configure.ac +50 -50
index 4688e97..73e12d3 100644
@@ -48,6 +48,56 @@ fi; \
 ]) # GIT_CONF_APPEND_PATH
 
 
+## Site configuration
+## --with-PACKAGE[=ARG] and --without-PACKAGE
+#
+# Define NO_SVN_TESTS if you want to skip time-consuming SVN interopability
+# tests.  These tests take up a significant amount of the total test time
+# but are not needed unless you plan to talk to SVN repos.
+#
+# Define MOZILLA_SHA1 environment variable when running make to make use of
+# a bundled SHA1 routine coming from Mozilla. It is GPL'd and should be fast
+# on non-x86 architectures (e.g. PowerPC), while the OpenSSL version (default
+# choice) has very fast version optimized for i586.
+#
+# Define PPC_SHA1 environment variable when running make to make use of
+# a bundled SHA1 routine optimized for PowerPC.
+#
+# Define ARM_SHA1 environment variable when running make to make use of
+# a bundled SHA1 routine optimized for ARM.
+#
+# Define NO_OPENSSL environment variable if you do not have OpenSSL.
+# This also implies MOZILLA_SHA1.
+#
+# 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://
+# transports.
+#
+# Define CURLDIR=/foo/bar if your curl header and library files are in
+# /foo/bar/include and /foo/bar/lib directories.
+#
+# Define NO_EXPAT if you do not have expat installed.  git-http-push is
+# not built, and you cannot push using http:// and https:// transports.
+#
+# Define NO_MMAP if you want to avoid mmap.
+#
+# Define NO_PYTHON if you want to loose all benefits of the recursive merge.
+#
+## --enable-FEATURE[=ARG] and --disable-FEATURE
+# Define COLLISION_CHECK below if you believe that SHA1's
+# 1461501637330902918203684832716283019655932542976 hashes do not give you
+# sufficient guarantee that no collisions between objects will ever happen.
+#
+# Define USE_NSEC below if you want git to care about sub-second file mtimes
+# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
+# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
+# randomly break unless your underlying filesystem supports those sub-second
+# times (my ext3 doesn't).
+#
+# Define USE_STDEV below if you want git to care about the underlying device
+# change being considered an inode change from the update-cache perspective.
+
+
 ## Checks for programs.
 AC_MSG_NOTICE([CHECKS for programs])
 #
@@ -155,56 +205,6 @@ # Define NO_ACCURATE_DIFF if your diff p
 # a missing newline at the end of the file.
 
 
-## Site configuration
-## --with-PACKAGE[=ARG] and --without-PACKAGE
-#
-# Define NO_SVN_TESTS if you want to skip time-consuming SVN interopability
-# tests.  These tests take up a significant amount of the total test time
-# but are not needed unless you plan to talk to SVN repos.
-#
-# Define MOZILLA_SHA1 environment variable when running make to make use of
-# a bundled SHA1 routine coming from Mozilla. It is GPL'd and should be fast
-# on non-x86 architectures (e.g. PowerPC), while the OpenSSL version (default
-# choice) has very fast version optimized for i586.
-#
-# Define PPC_SHA1 environment variable when running make to make use of
-# a bundled SHA1 routine optimized for PowerPC.
-#
-# Define ARM_SHA1 environment variable when running make to make use of
-# a bundled SHA1 routine optimized for ARM.
-#
-# Define NO_OPENSSL environment variable if you do not have OpenSSL.
-# This also implies MOZILLA_SHA1.
-#
-# 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://
-# transports.
-#
-# Define CURLDIR=/foo/bar if your curl header and library files are in
-# /foo/bar/include and /foo/bar/lib directories.
-#
-# Define NO_EXPAT if you do not have expat installed.  git-http-push is
-# not built, and you cannot push using http:// and https:// transports.
-#
-# Define NO_MMAP if you want to avoid mmap.
-#
-# Define NO_PYTHON if you want to loose all benefits of the recursive merge.
-#
-## --enable-FEATURE[=ARG] and --disable-FEATURE
-# Define COLLISION_CHECK below if you believe that SHA1's
-# 1461501637330902918203684832716283019655932542976 hashes do not give you
-# sufficient guarantee that no collisions between objects will ever happen.
-#
-# Define USE_NSEC below if you want git to care about sub-second file mtimes
-# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
-# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
-# randomly break unless your underlying filesystem supports those sub-second
-# times (my ext3 doesn't).
-#
-# Define USE_STDEV below if you want git to care about the underlying device
-# change being considered an inode change from the update-cache perspective.
-
-
 ## Output files
 AC_CONFIG_FILES(["${config_file}":"${config_in}":"${config_append}"])
 AC_OUTPUT
Signature · 1 line
1.4.1.1
#3 lore raw

PATCH 3/3 autoconf: Add support for setting PYTHON_PATH or NO_PYTHON

In reply to Jakub Narebski

This patch adds support for setting either PYTHON_PATH or NO_PYTHON to autoconf generated ./configure script via --with-python=PATH (sets PYTHON_PATH) or --without-python (sets NO_PYTHON). Autodetect PYTHON_PATH via AC_PATH_PROGS.

---
Tweaked a little to remove accidental trailing whitespace.

 configure.ac |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+)
configure.ac +22 -0
index 73e12d3..0a54b44 100644
@@ -103,6 +103,18 @@ AC_MSG_NOTICE([CHECKS for programs])
 #
 GIT_ARG_SET_PATH(shell)
 GIT_ARG_SET_PATH(perl)
+AC_ARG_WITH(python,[AS_HELP_STRING([--with-python=PATH], [provide PATH to python])
+AS_HELP_STRING([--no-python], [don't use python scripts])],
+ [if test "$withval" = "no"; then \
+    NO_PYTHON=YesPlease; \
+  elif test "$withval" != "yes"; then \
+    PYTHON_PATH=$withval; \
+  fi; \
+ ])
+AC_SUBST(NO_PYTHON)
+AC_SUBST(PYTHON_PATH)
+
+
 #
 # Define NO_PYTHON if you want to lose all benefits of the recursive merge.
 # Define PYTHON_PATH to provide path to Python.
@@ -110,6 +122,16 @@ AC_PROG_CC
 #AC_PROG_INSTALL		# needs install-sh or install.sh in sources
 AC_CHECK_TOOL(AR, ar, :)
 AC_CHECK_PROGS(TAR, [gtar tar])
+if test -z "$NO_PYTHON"; then
+	AC_PATH_PROGS(PYTHON_PATH, [python2.4 python2.3 python2 python])
+	if test -n "$PYTHON_PATH"; then
+		GIT_CONF_APPEND_LINE([PYTHON_PATH=@PYTHON_PATH@])
+	else
+		GIT_CONF_APPEND_LINE([NO_PYTHON=@NO_PYTHON@])
+	fi
+else
+	GIT_CONF_APPEND_LINE([NO_PYTHON=@NO_PYTHON@])
+fi
 
 
 ## Checks for libraries.
Signature · 1 line
1.4.1.1