Skip to contentSkip to conversation

autoconf: Use autoconf to write installation directories to config.mak

PATCH In review Jakub Narebski 6 participants 30 messages Jun 15, 2016 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 autoconf: Use autoconf to write installation directories to config.mak

This is beginning of patch series introducing installation configuration using autoconf (and no other autotools) to git. The idea is to generate config.mak using ./configure (generated from configure.ac) from config.mak.in, so one can use autoconf as an _alternative_ to ordinary Makefile, and creating one's own config.mak.

This patch includes minimal configure.ac and config.mak.in, so one can set installation directories using ./configure script e.g. ./configure --prefix=/usr

Ignoring files generated by running autoconf and ./configure

---

One of the ideas is to use in .spec RPM macro %configure which takes care of setting all installation directories correctly.

Thoughts?

 .gitignore    |    4 ++++
 config.mak.in |   12 ++++++++++++
 configure.ac  |   11 +++++++++++
 3 files changed, 27 insertions(+), 0 deletions(-)
.gitignore +4 -0
index 7b954d5..b0dd54d 100644
@@ -136,3 +136,7 @@ git-core.spec
 *.py[co]
 config.mak
 git-blame
+autom4te.cache
+config.log
+config.status
+configure
config.mak.in new file +12 -0
new file mode 100644
index 0000000..82d80e2
@@ -0,0 +1,12 @@
+# git Makefile configuration, included in main Makefile
+# @configure_input@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+#gitexecdir = @libexecdir@/git-core/
+template_dir = @datadir@/git-core/templates/
+GIT_PYTHON_DIR = @datadir@/git-core/python
+
+srcdir = @srcdir@
+VPATH = @srcdir@
configure.ac new file +11 -0
new file mode 100644
index 0000000..4003ff6
@@ -0,0 +1,11 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.59)
+AC_INIT([git], [1.4.0], [[email protected]])
+
+AC_CONFIG_SRCDIR([git.c])
+
+# Output files
+AC_CONFIG_FILES([config.mak])
+AC_OUTPUT
Signature · 1 line
1.4.0
#1 lore raw
Quoted 9 lines · Jakub Narebski

This is beginning of patch series introducing installation configuration using autoconf (and no other autotools) to git. The idea is to generate config.mak using ./configure (generated from configure.ac) from config.mak.in, so one can use autoconf as an _alternative_ to ordinary Makefile, and creating one's own config.mak.

This patch includes minimal configure.ac and config.mak.in, so one can set installation directories using ./configure script e.g. ./configure --prefix=/usr

autoconf does to much things, even with that little configure.ac. (But I agree, it's much better than automake :-)

E.g.

	./configure --prefix=$HOME/usr --mandir=$HOME/usr/share/man

is supported by the configure script, but the manpages are installed in $HOME/usr/man all the same.

BTW: Even if I specify mandir=... in config.mak, it is not respected, because only the toplevel Makefile includes config.mak. (I didn't test it, but I think I could export mandir in config.mak ...)

Best regards
Uwe

Signature · 3 lines
Uwe Zeisberger

http://www.google.com/search?q=1+hertz+in+sec**-1
#2 lore raw

PATCH 1/1 autoconf: Use autoconf to check for libraries: openssl/crypto, curl, expat

In reply to Jakub Narebski

./configure script checks now if the following libraries are present:
* -lcrypto (checks for SHA1_Init, sets NO_OPENSSL=YesPlease if not found)
* -lcurl (checks for curl_easy_setopt, sets NO_CURL=YesPlease if not found)
* -lexpat (checks for XML_ParserCreate, sets NO_EXPAT=YesPlease if not found)

Appropriate lines in config.mak are generated using MY_APPEND_LINE macro by adding lines to temporary file config.mak.append

---

Second patch in series introducing nonintrusive autoconf support to git build process.

I'm not that sure about -lcrypto equals openssl.

 configure.ac |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
configure.ac +16 -1
index 4003ff6..55d7a9b 100644
@@ -6,6 +6,21 @@ AC_INIT([git], [1.4.0], [[email protected]
 
 AC_CONFIG_SRCDIR([git.c])
 
+# Definitions of macros
+# MY_APPEND_LINE(LINE)
+# --------------------
+# Append LINE to file config.mak.append
+AC_DEFUN([MY_APPEND_LINE],
+[[echo "$1" >> config.mak.append]])# AC_APPEND_LINE
+
+# Checks for libraries.
+AC_MSG_NOTICE(CHECKS for libraries)
+AC_CHECK_LIB([crypto], [SHA1_Init],,MY_APPEND_LINE(NO_OPENSSL=YesPlease))
+AC_CHECK_LIB([curl], [curl_easy_setopt],,MY_APPEND_LINE(NO_CURL=YesPlease))
+AC_CHECK_LIB([expat], [XML_ParserCreate],,MY_APPEND_LINE(NO_EXPAT=YesPlease))
+
 # Output files
-AC_CONFIG_FILES([config.mak])
+AC_CONFIG_FILES([config.mak:config.mak.in:config.mak.append], 
+[rm -f config.mak.append], 
+[echo >> config.mak.append])
 AC_OUTPUT
Signature · 1 line
1.4.0
#3 lore raw

[RFC/PATCH] autoconf: Use autoconf to check for some types and library functions

./configure script checks now for existence of the following types and structure members:
* dirent.d_ino in dirent.h (NO_D_INO_IN_DIRENT)
* dirent.d_type in dirent.h (NO_D_TYPE_IN_DIRENT)
* 'struct sockaddr_storage' in netinet/in.h (NO_SOCKADDR_STORAGE)

./configure script checks now for the following library functions:
* strcasestr (NO_STRCASESTR)
* strlcpy (NO_STRLCPY)
* setenv (NO_SETENV)
in default C library and in libraries which have AC_CHECK_LIB done for them (crypto, curl, expat).

NOTE: not all checks are implemented!

---

This patch needs review by someone better versed in compiling git on different platforms, namely AC_CHECK_MEMBER and AC_CHECK_TYPE needs checking if all header files where git search for specified structure member or specified type.

I don't know (yet) how to implement checking for NEEDS_SSL_WITH_CRYPTO (probably also checlking for crypto library needs correction), NEEDS_LIBICONV, NEEDS_SOCKET, NO_IPV6, NO_ICONV, Python < 2.3 and Python == 2.3, if to check for NO_MMAP, and for NO_ACCURATE_DIFF.

This patch is to be considered preliminary!

 configure.ac |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)
configure.ac +25 -1
index 55d7a9b..fbd46e2 100644
@@ -14,17 +14,41 @@ AC_CONFIG_SRCDIR([git.c])
 AC_DEFUN([MY_APPEND_LINE],
 [[echo "$1" >> config.mak.append]])# AC_APPEND_LINE
 
+
 # Checks for libraries.
-AC_MSG_NOTICE(CHECKS for libraries)
+AC_MSG_NOTICE([CHECKS for libraries])
 AC_CHECK_LIB([crypto], [SHA1_Init],,MY_APPEND_LINE(NO_OPENSSL=YesPlease))
 AC_CHECK_LIB([curl], [curl_easy_setopt],,MY_APPEND_LINE(NO_CURL=YesPlease))
 AC_CHECK_LIB([expat], [XML_ParserCreate],,MY_APPEND_LINE(NO_EXPAT=YesPlease))
 
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_MSG_NOTICE([CHECKS for typedefs, structures, and compiler characteristics])
+
+AC_CHECK_MEMBER(struct dirent.d_ino,,
+MY_APPEND_LINE(NO_D_INO_IN_DIRENT=YesPlease),
+[#include <dirent.h>])
+AC_CHECK_MEMBER(struct dirent.d_type,,
+MY_APPEND_LINE(NO_D_TYPE_IN_DIRENT=YesPlease),
+[#include <dirent.h>])
+
+AC_CHECK_TYPE(struct sockaddr_storage,,
+MY_APPEND_LINE(NO_SOCKADDR_STORAGE=YesPlease),
+[#include <netinet/in.h>])
+
+
+# Checks for library functions.
+AC_MSG_NOTICE([CHECKS for library functions])
+AC_CHECK_FUNC(strcasestr,,MY_APPEND_LINE(NO_STRCASESTR=YesPlease))
+AC_CHECK_FUNC(strlcpy,,MY_APPEND_LINE(NO_STRLCPY=YesPlease))
+AC_CHECK_FUNC(setenv,,MY_APPEND_LINE(NO_SETENV=YesPlease))
+
+
 # Output files
 AC_CONFIG_FILES([config.mak:config.mak.in:config.mak.append], 
 [rm -f config.mak.append], 
Signature · 1 line
1.4.0
#4 lore raw

PATCH 1/1 autoconf: Cleanup generation of config.mak.append by ./configure

---
 configure.ac |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
configure.ac +4 -3
index fbd46e2..f48307c 100644
@@ -6,12 +6,14 @@ AC_INIT([git], [1.4.0], [[email protected]
 
 AC_CONFIG_SRCDIR([git.c])
 
+echo "# config.mak.append.  Generated by configure." >> config.mak.append
+
 # Definitions of macros
 # MY_APPEND_LINE(LINE)
 # --------------------
 # Append LINE to file config.mak.append
 AC_DEFUN([MY_APPEND_LINE],
-[[echo "$1" >> config.mak.append]])# AC_APPEND_LINE
+[[echo "$1" >> config.mak.append]])# MY_APPEND_LINE
 
 
 # Checks for libraries.
@@ -45,6 +47,5 @@ AC_CHECK_FUNC(setenv,,MY_APPEND_LINE(NO_
 
 # Output files
 AC_CONFIG_FILES([config.mak:config.mak.in:config.mak.append], 
-[rm -f config.mak.append], 
-[echo >> config.mak.append])
+[rm -f config.mak.append])
 AC_OUTPUT
Signature · 1 line
1.4.0
#5 lore raw

PATCH 1/1 Allow INSTALL, bindir, mandir to be set in main Makefile

Makefiles in subdirectories now use existing value of INSTALL, bindir, mandir if it is set, allowing those to be set in main Makefile or in config.mak. Main Makefile exports variables which it sets.

Renames man1 and man7 variables to man1dir and man7dir, according to "Makefile Conventions: Variables for Installation Directories" in make.info of GNU Make. Renames bin to bindir (unused, perhaps to be removed).

---
Part of autoconf series, but independent.

Should probably be split into two patches:
* first with export + '?='
* second renaming man1 and man7 to man1dir and man7dir

 Documentation/Makefile   |   14 +++++++-------
 Makefile                 |    2 ++
 contrib/emacs/Makefile   |    4 ++--
 contrib/git-svn/Makefile |    8 ++++----
 4 files changed, 15 insertions(+), 13 deletions(-)
Documentation/Makefile +7 -7
index 2b0efe7..cc83610 100644
@@ -25,10 +25,10 @@ DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT
 DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
 
 prefix?=$(HOME)
-bin=$(prefix)/bin
-mandir=$(prefix)/man
-man1=$(mandir)/man1
-man7=$(mandir)/man7
+bindir?=$(prefix)/bin
+mandir?=$(prefix)/man
+man1dir=$(mandir)/man1
+man7dir=$(mandir)/man7
 # DESTDIR=
 
 INSTALL?=install
@@ -52,9 +52,9 @@ man1: $(DOC_MAN1)
 man7: $(DOC_MAN7)
 
 install: man
-	$(INSTALL) -d -m755 $(DESTDIR)$(man1) $(DESTDIR)$(man7)
-	$(INSTALL) $(DOC_MAN1) $(DESTDIR)$(man1)
-	$(INSTALL) $(DOC_MAN7) $(DESTDIR)$(man7)
+	$(INSTALL) -d -m755 $(DESTDIR)$(man1dir) $(DESTDIR)$(man7dir)
+	$(INSTALL) $(DOC_MAN1) $(DESTDIR)$(man1dir)
+	$(INSTALL) $(DOC_MAN7) $(DESTDIR)$(man7dir)
 
 
 #
Makefile +2 -0
index cde619c..b8fe669 100644
@@ -100,6 +100,8 @@ template_dir = $(prefix)/share/git-core/
 GIT_PYTHON_DIR = $(prefix)/share/git-core/python
 # DESTDIR=
 
+export prefix bindir gitexecdir template_dir GIT_PYTHON_DIR
+
 CC = gcc
 AR = ar
 TAR = tar
contrib/emacs/Makefile +2 -2
index d3619db..350846d 100644
@@ -3,9 +3,9 @@ ## Build and install stuff
 EMACS = emacs
 
 ELC = git.elc vc-git.elc
-INSTALL = install
+INSTALL ?= install
 INSTALL_ELC = $(INSTALL) -m 644
-prefix = $(HOME)
+prefix ?= $(HOME)
 emacsdir = $(prefix)/share/emacs/site-lisp
 
 all: $(ELC)
contrib/git-svn/Makefile +4 -4
index 7c20946..8cac688 100644
@@ -1,9 +1,9 @@
 all: git-svn
 
 prefix?=$(HOME)
-bindir=$(prefix)/bin
-mandir=$(prefix)/man
-man1=$(mandir)/man1
+bindir?=$(prefix)/bin
+mandir?=$(prefix)/man
+man1dir=$(mandir)/man1
 INSTALL?=install
 doc_conf=../../Documentation/asciidoc.conf
 -include ../../config.mak
@@ -17,7 +17,7 @@ install: all
 	$(INSTALL) git-svn $(DESTDIR)$(bindir)
 
 install-doc: doc
-	$(INSTALL) git-svn.1 $(DESTDIR)$(man1)
+	$(INSTALL) git-svn.1 $(DESTDIR)$(man1dir)
 
 doc: git-svn.1
 git-svn.1 : git-svn.xml
Signature · 1 line
1.4.0
#6 lore raw

PATCH 1/1 autoconf: Set mandir in config.mak.in and export variables not in Makefile

This patch with the previous "[PATCH] Allow INSTALL, bindir, mandir to be set in main Makefile" patch allows ./configure script to set where manpages will be installed using --mandir=DIR (./configure defaults to PREFIX/man).

---

Quoted 5 lines · Uwe Zeisberger

autoconf does to much things, even with that little configure.ac. (But I agree, it's much better than automake :-)

E.g.

Quoted 8 lines

        ./configure --prefix=$HOME/usr --mandir=$HOME/usr/share/man

is supported by the configure script, but the manpages are installed in $HOME/usr/man all the same.

BTW: Even if I specify mandir=... in config.mak, it is not respected, because only the toplevel Makefile includes config.mak.  (I didn't test it, but I think I could export mandir in config.mak ...)

This patch and previous one adressess this.

 config.mak.in |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
config.mak.in +6 -0
index 82d80e2..82c9781 100644
@@ -8,5 +8,11 @@ #gitexecdir = @libexecdir@/git-core/
 template_dir = @datadir@/git-core/templates/
 GIT_PYTHON_DIR = @datadir@/git-core/python
 
+mandir=@mandir@
+
 srcdir = @srcdir@
 VPATH = @srcdir@
+
+export exec_prefix mandir
+export srcdir VPATH
+
Signature · 1 line
1.4.0
#7 lore raw

PATCH 1/1 autoconf: configure.ac uses variables to set in, out and temp files

configure.ac now uses variables to set input file (containing strings substituted by ./configure script), temporary file (for appending lines to output file) and output file (with the result configuration).

This is preparation to using other file than config.mak for output.

---
 configure.ac |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
configure.ac +9 -5
index f48307c..58ec57a 100644
@@ -6,14 +6,18 @@ AC_INIT([git], [1.4.0], [[email protected]
 
 AC_CONFIG_SRCDIR([git.c])
 
-echo "# config.mak.append.  Generated by configure." >> config.mak.append
+config_file=config.mak
+config_append=config.mak.append
+config_in=config.mak.in
+
+echo "# ${config_append}.  Generated by configure." >> "${config_append}"
 
 # Definitions of macros
 # MY_APPEND_LINE(LINE)
 # --------------------
-# Append LINE to file config.mak.append
+# Append LINE to file ${config_append}
 AC_DEFUN([MY_APPEND_LINE],
-[[echo "$1" >> config.mak.append]])# MY_APPEND_LINE
+[[echo "$1" >> "${config_append}"]])# MY_APPEND_LINE
 
 
 # Checks for libraries.
@@ -46,6 +50,6 @@ AC_CHECK_FUNC(setenv,,MY_APPEND_LINE(NO_
 
 
 # Output files
-AC_CONFIG_FILES([config.mak:config.mak.in:config.mak.append], 
-[rm -f config.mak.append])
+AC_CONFIG_FILES(["${config_file}":"${config_in}":"${config_append}"], 
+[rm -f "${config_append}"])
 AC_OUTPUT
Signature · 1 line
1.4.0
#8 lore raw

PATCH 1/1 autoconf: ./configure script outputs to config.mac.auto

---
So now to actually use ./configure output you either have to add
-include config.mak.auto
to Makefile before including config.mak, link config.mak.auto to config.mak, or rename (move) config.mak.auto to config.mak after done with ./configure

 configure.ac |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
configure.ac +1 -1
index 58ec57a..799bc87 100644
@@ -6,7 +6,7 @@ AC_INIT([git], [1.4.0], [[email protected]
 
 AC_CONFIG_SRCDIR([git.c])
 
-config_file=config.mak
+config_file=config.mak.auto
 config_append=config.mak.append
 config_in=config.mak.in
 
Signature · 1 line
1.4.0
#9 lore raw

PATCH 1/1 autoconf: Cleanup generation of temporary "append" file

---
 configure.ac |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
configure.ac +4 -3
index 799bc87..e387f5b 100644
@@ -10,7 +10,7 @@ config_file=config.mak.auto
 config_append=config.mak.append
 config_in=config.mak.in
 
-echo "# ${config_append}.  Generated by configure." >> "${config_append}"
+echo "# ${config_append}.  Generated by configure." > "${config_append}"
 
 # Definitions of macros
 # MY_APPEND_LINE(LINE)
@@ -50,6 +50,7 @@ AC_CHECK_FUNC(setenv,,MY_APPEND_LINE(NO_
 
 
 # Output files
-AC_CONFIG_FILES(["${config_file}":"${config_in}":"${config_append}"], 
-[rm -f "${config_append}"])
+AC_CONFIG_FILES(["${config_file}":"${config_in}":"${config_append}"])
 AC_OUTPUT
+
+rm -f "${config_append}"
Signature · 1 line
1.4.0
#10 lore raw

PATCH 1/1 autoconf: Write how to use ./configure generated file in git build process

---
Probably there is better way to do this.

 configure.ac |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
configure.ac +6 -0
index e387f5b..ef310ee 100644
@@ -54,3 +54,9 @@ AC_CONFIG_FILES(["${config_file}":"${con
 AC_OUTPUT
 
 rm -f "${config_append}"
+
+cat <<_ACEOF
+
+Add '-include ${config_file}' to your config.mak, 
+or rename ${config_file} to config.mak
+_ACEOF
Signature · 1 line
1.4.0
#11 lore raw

PATCH 1/1 autoconf: Rename ./configure output file to config.mak.autogen

---
Choose the name you are more comfortable with

 configure.ac |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
configure.ac +1 -1
index ef310ee..f01fc17 100644
@@ -6,7 +6,7 @@ AC_INIT([git], [1.4.0], [[email protected]
 
 AC_CONFIG_SRCDIR([git.c])
 
-config_file=config.mak.auto
+config_file=config.mak.autogen
 config_append=config.mak.append
 config_in=config.mak.in
 
Signature · 1 line
1.4.0
#12 lore raw

PATCH 1/1 Revert "autoconf: Write how to use ./configure generated file in git build process"

This reverts 6015ccba6c0439b0b615615aacefaf463c546ba4 commit.

To be replaced by better solution, idea by Andreas Ericsson
---
Or just not apply [PATCH 10] (and this patch)

 configure.ac |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
configure.ac +0 -6
index f01fc17..1ead656 100644
@@ -54,9 +54,3 @@ AC_CONFIG_FILES(["${config_file}":"${con
 AC_OUTPUT
 
 rm -f "${config_append}"
-
-cat <<_ACEOF
-
-Add '-include ${config_file}' to your config.mak, 
-or rename ${config_file} to config.mak
-_ACEOF
Signature · 1 line
1.4.0
#13 lore raw

PATCH 1/1 autoconf: Append '-include config.mak.autogen' to config.mak if it is not present

---

Quoted 16 lines · Andreas Ericsson
Quoted 3 lines · Jakub Narebski

The idea was to use ./configure to _generate_ config.mak, which the user can then edit.

This is bad, since it forces users to do one thing first and then do what they're used to. Better to have the script add

-include config.mak.autogen

LAST in config.mak, unless it's already in the file and generate config.mak.autogen with configure, e.g. with

grep -q autogen config.mak || \
echo "-include config.mak.autogen" >> config.mak

Quoted 7 lines

Since Make does things bottoms-up (much like swedish students and midsummer celebrators), the previous hand-edited defaults in config.mak will beat the ones in config.mak.autogen (a good thing).

I wouldn't want my long-standing, functioning config.mak overwritten, but I *might* be interested in trying some of the options provided by ./configure.

Done, with small changes.

Can anyone tell me if frep use is portable enough?

 configure.ac |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
configure.ac +3 -0
index 1ead656..2904077 100644
@@ -54,3 +54,6 @@ AC_CONFIG_FILES(["${config_file}":"${con
 AC_OUTPUT
 
 rm -f "${config_append}"
+
+grep -q -s -F "-include ${config_file}" config.mak || \
+        echo  "-include ${config_file}" >> config.mak
Signature · 1 line
1.4.0
#14 lore raw

[RFC/PATCH 14] autoconf: Added --with/--without for openssl, curl, expat to ./configure

Added --with-PACKAGE[=PATH] (where PATH is prefix for PACKAGE libraries and includes) and --without-PACKAGE (--with-PACKAGE=no) support for curl, openssl, expat to configure.ac

---

I'm not autoconf/m4 expert: could anyone tell me how to uppercase PACKAGE name, so one could write MY_PARSE_WITH(openssl)?

How to add [=PATH] to --with-PACKAGE option description in a way which does not screw up AS_HELP_WITH calculations. I could use @<:@=PATH@:>@ which transforms to [=PATH], but AS_HELP_WITH counts number of characters in source I think.

 configure.ac |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
configure.ac +34 -0
index fcfc9ce..26d6f4d 100644
@@ -19,6 +19,22 @@ # Append LINE to file ${config_append}
 AC_DEFUN([MY_APPEND_LINE],
 [[echo "$1" >> "${config_append}"]])# MY_APPEND_LINE
 
+# MY_PARSE_WITH(PACKAGE)
+# ----------------------
+# For use in AC_ARG_WITH action-if-found, for packages default ON. 
+# * Set NO_PACKAGE=YesPlease  for --without-PACKAGE
+# * Set PACKAGEDIR=ARG for --with-PACKAGE=ARG
+# * Do nothing for --with-PACKAGE without ARG
+# PACKAGE option must be all uppercase
+AC_DEFUN([MY_PARSE_WITH],
+[[if test "$withval" = "no"; then \
+    MY_APPEND_LINE(NO_$1=YesPlease); \
+  elif test "$withval" != "yes"; then \
+    MY_APPEND_LINE($1DIR=$withval); \
+  fi; \
+]])# MY_PARSE_WITH
+
+
 # Checks for libraries.
 AC_MSG_NOTICE([CHECKS for libraries])
 AC_CHECK_LIB([crypto], [SHA1_Init],,MY_APPEND_LINE(NO_OPENSSL=YesPlease))
@@ -48,6 +64,24 @@ AC_CHECK_FUNC(strlcpy,,MY_APPEND_LINE(NO
 AC_CHECK_FUNC(setenv,,MY_APPEND_LINE(NO_SETENV=YesPlease))
 
 
+# Site configuration
+AC_MSG_NOTICE([CHECKS for site configuration])
+AC_ARG_WITH(curl, 
+AS_HELP_STRING([--with-curl],[support http(s):// transports (default is YES)])
+AS_HELP_STRING([],           [ARG can be also prefix for curl library and headers]),\
+MY_PARSE_WITH(CURL))
+
+AC_ARG_WITH(openssl,
+AS_HELP_STRING([--with-openssl],[use OpenSSL library (default is YES)])
+AS_HELP_STRING([],              [ARG can be prefix for openssl library and headers]),\
+MY_PARSE_WITH(OPENSSL))
+
+AC_ARG_WITH(expat,
+AS_HELP_STRING([--with-expat],[support git-push using http:// and https:// transports via WebDAV (default is YES)])
+AS_HELP_STRING([],            [ARG can be also prefix for expat library and headers]),\
+MY_PARSE_WITH(EXPAT))
+
+
 # Output files
 AC_CONFIG_FILES(["${config_file}":"${config_in}":"${config_append}"])
 AC_OUTPUT
Signature · 1 line
1.4.0
#15 lore raw

Re: [RFC/PATCH 14] autoconf: Added --with/--without for openssl, curl, expat to ./configure

Hi Jakub,

Quoted 2 lines · Jakub Narebski

I'm not autoconf/m4 expert: could anyone tell me how to uppercase PACKAGE name, so one could write MY_PARSE_WITH(openssl)?

I don't quite understand what you want, but you could check m4_toupper.

Quoted 4 lines

How to add [=PATH] to --with-PACKAGE option description in a way which does not screw up AS_HELP_WITH calculations. I could use @<:@=PATH@:>@ which transforms to [=PATH], but AS_HELP_WITH counts number of characters in source I think.

Try another pair of square brackets as quotes for literal contents. In this case, use [[=PATH]]

Quoted 1 line

+# MY_PARSE_WITH(PACKAGE)

By the way, it's better to use a prefix other than MY. I thing GIT_PARSE_WITH would be great.

Signature · 2 lines
Regards,
Pavel Roskin
#16 lore raw

Re: [RFC/PATCH 14] autoconf: Added --with/--without for openssl, curl, expat to ./configure

<posted & mailed>

Quoted 5 lines · Pavel Roskin
Quoted 2 lines · Jakub Narebski

I'm not autoconf/m4 expert: could anyone tell me how to uppercase PACKAGE name, so one could write MY_PARSE_WITH(openssl)?

I don't quite understand what you want, but you could check m4_toupper.

Thanks. It works great. GIT_PARSE_WITH is now:

AC_DEFUN([GIT_PARSE_WITH],
[[PACKAGE=m4_toupper($1); \

if test "$withval" = "no"; then \
    GIT_APPEND_LINE(NO_${PACKAGE}=YesPlease); \
  elif test "$withval" != "yes"; then \
    GIT_APPEND_LINE(${PACKAGE}DIR=$withval); \

fi; \
]])# GIT_PARSE_WITH

Quoted 7 lines
Quoted 4 lines

How to add [=PATH] to --with-PACKAGE option description in a way which does not screw up AS_HELP_WITH calculations. I could use @<:@=PATH@:>@ which transforms to [=PATH], but AS_HELP_WITH counts number of characters in source I think.

Try another pair of square brackets as quotes for literal contents. In this case, use [[=PATH]]

I suspect that AS_HELP_WITH does some strange quoting, or stripping. Both [=PATH] and [[=PATH]] produces =PATH in ./configure --help output. When using @<:@=PATH@:>@ I get [=PATH], but the description of option begins line below.

Quoted 4 lines
Quoted 1 line

+# MY_PARSE_WITH(PACKAGE)

By the way, it's better to use a prefix other than MY. I thing GIT_PARSE_WITH would be great.

Any ideas for name of MY_APPEND_LINE(LINE)/GIT_APPEND_LINE(LINE) macro, which as a result adds line to output (e.g. LINE = "NO_CURL=YesPlease")?

Thanks for all suggestions

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

A message that is not in the archive (sent off-list or not yet received): [email protected]

#18 lore raw

Re: [RFC/PATCH 14] autoconf: Added --with/--without for openssl, curl, expat to ./configure

Quoted 3 lines · Pavel Roskin

Hi Jakub,

you lost cc: but please feel free to return to the list.

Sending reply to GMane newsgroup tied to mailing list, and via email to author, but _not_ via mail to mailing list would do that... especially if the author I'm replying to doesn't use newsgroup interface.

Quoted 8 lines

Quoting Jakub Narebski <[email protected]>:

Quoted 4 lines

I suspect that AS_HELP_WITH does some strange quoting, or stripping. Both [=PATH] and [[=PATH]] produces =PATH in ./configure --help output. When using @<:@=PATH@:>@ I get [=PATH], but the description of option begins line below.

If you are not following quoting rules, every macro can do strange things!

Well, [=PATH] or [[=PATH]] doesn't work even if GIT_APPEND_LINE is without double quotes. Besides, that doesn't matter because this is inside of AS_HELP_STRING macro. No combination of quoting (I think I tried all) works... I guess I would just not use AS_HELP_STRING, and format help message "by hand".

Quoted 10 lines
Quoted 2 lines

Any ideas for name of MY_APPEND_LINE(LINE)/GIT_APPEND_LINE(LINE) macro, which as a result adds line to output (e.g. LINE = "NO_CURL=YesPlease")?

GIT_LIB_CURL

Generally, please try to avoid negations. They are confising to the end users. Lack of curl may be an anomaly to git developers, but it is not an anomaly for a user who has never heard of curl. If you can, try to use positive logic, like CURL=1, and translate it to negative logic only as a temporary solution and far away from the user's eyes.

I'm following example set by main Makefile. That, and I tried to make configure.ac as simple as possible...

By the way, if you know autoconf well, perhaps you could tell me how to write tests for the following programs: ar, tar, rpmbuild, how to write test for Python version (or rather for WITH_OWN_SUBPROCESS_PY) and other test autoconf.ac lacks now (NEEDS_SSL_WITH_CRYPTO, NEEDS_LIBICONV, NEEDS_SOCKET, NO_MMAP, NO_IPV6, NO_ICONV, NO_ACCURATE_DIFF unless that was removed or changed name).

Signature · 2 lines
Jakub Narebski
ShadeHawk on #git
#19 lore raw

Re: [RFC/PATCH 14] autoconf: Added --with/--without for openssl, curl, expat to ./configure

Hello, Jakub!

Quoted 4 lines · Jakub Narebski
Quoted 4 lines
Quoted 4 lines

I suspect that AS_HELP_WITH does some strange quoting, or stripping. Both [=PATH] and [[=PATH]] produces =PATH in ./configure --help output. When using @<:@=PATH@:>@ I get [=PATH], but the description of option begins line below.

Sorry, I misunderstood the problem. I think it's pure cosmetics. Please don't let it stop you.

Quoted 2 lines

I guess I would just not use AS_HELP_STRING, and format help message "by hand".

Please don't wast time on such minor things. It's more important to get the functionality implemented.

Quoted 5 lines

By the way, if you know autoconf well, perhaps you could tell me how to write tests for the following programs: ar, tar, rpmbuild, how to write test for Python version (or rather for WITH_OWN_SUBPROCESS_PY) and other test autoconf.ac lacks now (NEEDS_SSL_WITH_CRYPTO, NEEDS_LIBICONV, NEEDS_SOCKET, NO_MMAP, NO_IPV6, NO_ICONV, NO_ACCURATE_DIFF unless that was removed or changed name).

Generally, see the Autoconf manual for the specific test first, then for more common test.

For ar, use AC_CHECK_TOOL to allow cross-compilation. For tar and rpmbiuld, use
AC_CHECK_PROG. Python will have to run to find the version, I'm afraid, which would complicate cross builds. Fortunately, it's on the way out.

Tests for sockets are described in the Autoconf documentation. Other tests should probably be implemented as test programs unless they can be reduced to checking for a specific symbol in a specific library.

Signature · 2 lines
Regards,
Pavel Roskin
#20 lore raw

Re: [RFC/PATCH 14] autoconf: Added --with/--without for openssl, curl, expat to ./configure

In reply to Jakub Narebski

configure.ac AC_CHECK_FUNC(strlcpy,,MY_APPEND_LINE(NO · line 82

Quoted 4 lines · Jakub Narebski
configure.ac +4 -0
+AC_ARG_WITH(expat,
+AS_HELP_STRING([--with-expat],[support git-push using http:// and https:// transports via WebDAV (default is YES)])
+AS_HELP_STRING([],            [ARG can be also prefix for expat library and headers]),\
+MY_PARSE_WITH(EXPAT))

Of course to do anything for --with-expat=PATH case this patch needs the one that introduces EXPATDIR (there was such patch on the list, I'm not sure if it got accepted).

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#21 lore raw

Re: [PATCH 13] autoconf: Append '-include config.mak.autogen' to config.mak if it is not present

In reply to Jakub Narebski

configure.ac AC_CONFIG_FILES(["${config_file}":"${con · line 59

Quoted 2 lines · Jakub Narebski
configure.ac +2 -0
+grep -q -s -F "-include ${config_file}" config.mak || \
+        echo  "-include ${config_file}" >> config.mak

Gah, should be of course

+grep -q -s -F -e "-include ${config_file}" config.mak || \
+ echo "-include ${config_file}" >> config.mak

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#22 lore raw

Re: [PATCH] Allow INSTALL, bindir, mandir to be set in main Makefile

In reply to Jakub Narebski
Quoted 1 line · Jakub Narebski

Part of autoconf series, but independent.

I'd like to take something like this, independently from "optionally managing config.mak with autoconf" series.

Quoted 3 lines

Should probably be split into two patches:
* first with export + '?='
* second renaming man1 and man7 to man1dir and man7dir

And I think it is probably a good idea to somehow keep people's configurations that have been overriding man1 and man7 if possible. Otherwise things would regress for them.

#23 lore raw

Re: [PATCH] Allow INSTALL, bindir, mandir to be set in main Makefile

Quoted 7 lines · Junio C Hamano
Quoted 1 line · Jakub Narebski

Part of autoconf series, but independent.

I'd like to take something like this, independently from "optionally managing config.mak with autoconf" series.

Quoted 7 lines
Quoted 3 lines

Should probably be split into two patches:
* first with export + '?='
* second renaming man1 and man7 to man1dir and man7dir

And I think it is probably a good idea to somehow keep people's configurations that have been overriding man1 and man7 if possible. Otherwise things would regress for them.

Done. Resent as two patch "series", starting with
Message-Id: <[email protected]>

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#24 lore raw
In reply to Jakub Narebski
Quoted 5 lines

This is beginning of patch series introducing installation configuration using autoconf (and no other autotools) to git. The idea is to generate config.mak using ./configure (generated from configure.ac) from config.mak.in, so one can use autoconf as an _alternative_ to ordinary Makefile, and creating one's own config.mak.

Are you sure this should be named config.mak? From INSTALL:

Quoted 3 lines

You can place local settings in config.mak and the Makefile will include them. Note that config.mak is not distributed; the name is reserved for local settings.

So with another filename either include it
- before config.mak: the user may override ./configure options with config.mak
- after config.mak: ./configure overrides config.mak
At least do not overwrite config.mak if it exists.

#25 lore raw
Quoted 11 lines · Matthias Lederhofer
Quoted 5 lines

This is beginning of patch series introducing installation configuration using autoconf (and no other autotools) to git. The idea is to generate config.mak using ./configure (generated from configure.ac) from config.mak.in, so one can use autoconf as an _alternative_ to ordinary Makefile, and creating one's own config.mak.

Are you sure this should be named config.mak? From INSTALL:

Quoted 3 lines

You can place local settings in config.mak and the Makefile will include them. Note that config.mak is not distributed; the name is reserved for local settings.

Quoted 5 lines

So with another filename either include it
- before config.mak: the user may override ./configure options with config.mak
- after config.mak: ./configure overrides config.mak
At least do not overwrite config.mak if it exists.

Think of it as an incredibly smart editor that you can use to edit your config.mak. As far as I understand it, this is an "opt-in" way for you to manage config.mak without editing it yourself, so I do not have much objections to the series in principle.

I think it is fair to say that autoconf is not so bad compared to its worse friends, but I am biased -- I used to deal with autoconf quite a lot in old days (before there were automake nor libtool), and my own changes to autoconf might still be surviving in a few .m4 files but I doubt it it was so long ago.

Having said that, I am skeptical how well we can keep this contained only to config.mak and keep it "opt-in", so I am not enthused to have this series at the toplevel of the tree.

It would have been a bit easier to swallow if this whole machinery to build config.mk were somewhere under contrib/ (say in contrib/autoconf), with an instruction to make an "opt-in" symlink "ln -s contrib/autoconf/config.mk config.mk" for people who want to use it in the toplevel INSTALL file, perhaps.

The one that touches the Makefile to propagate some variables down to submakes is probably a desirable change but that is pretty much independent from the series.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#27 lore raw
Quoted 9 lines · Petr Baudis

Dear diary, on Thu, Jun 29, 2006 at 08:23:31PM CEST, I got a letter where Junio C Hamano <[email protected]> said that...

Quoted 5 lines

It would have been a bit easier to swallow if this whole machinery to build config.mk were somewhere under contrib/ (say in contrib/autoconf), with an instruction to make an "opt-in" symlink "ln -s contrib/autoconf/config.mk config.mk" for people who want to use it in the toplevel INSTALL file, perhaps.

Quoted 6 lines

Well, I don't get the point of that - it doesn't make any sense to me to require this.

The point of ./configure is to make things easier for the user, so to balance that we should make the ./configure harder to _call_ by requiring the user to do strange arbitrary steps after calling it.

Easiest way is to output ./configure result to e.g. configure.mak.autoconf, and include this file just before configure.mak in main Makefile.

Just as in patches (although you have to discard or revert two alternate mechanism patches)

Signature · 1 line
Jakub Narebski
#28 lore raw
In reply to Matthias Lederhofer
Quoted 7 lines · Matthias Lederhofer
Quoted 5 lines

This is beginning of patch series introducing installation configuration using autoconf (and no other autotools) to git. The idea is to generate config.mak using ./configure (generated from configure.ac) from config.mak.in, so one can use autoconf as an _alternative_ to ordinary Makefile, and creating one's own config.mak.

Are you sure this should be named config.mak? From INSTALL:

Quoted 8 lines
Quoted 3 lines

You can place local settings in config.mak and the Makefile will include them. Note that config.mak is not distributed; the name is reserved for local settings.

So with another filename either include it
- before config.mak: the user may override ./configure options with config.mak
- after config.mak: ./configure overrides config.mak

The idea was to use ./configure to _generate_ config.mak, which the user can then edit.

But perhaps using another filename for results of ./configure script (and including it in main Makefile) would be better idea.

Quoted 1 line

At least do not overwrite config.mak if it exists.

But one might want to run ./configure with different options, to finally arrive at the set which is satisfactionary. So unless some magic to detect if config.mak was generated from ./configure script, or generated by user is used...

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#29 lore raw
Quoted 15 lines · Jakub Narebski
Quoted 12 lines · Matthias Lederhofer
Quoted 5 lines

This is beginning of patch series introducing installation configuration using autoconf (and no other autotools) to git. The idea is to generate config.mak using ./configure (generated from configure.ac) from config.mak.in, so one can use autoconf as an _alternative_ to ordinary Makefile, and creating one's own config.mak.

Are you sure this should be named config.mak? From INSTALL:

Quoted 3 lines

You can place local settings in config.mak and the Makefile will include them. Note that config.mak is not distributed; the name is reserved for local settings.

Quoted 9 lines
Quoted 4 lines

So with another filename either include it
- before config.mak: the user may override ./configure options with config.mak
- after config.mak: ./configure overrides config.mak

The idea was to use ./configure to _generate_ config.mak, which the user can then edit.

This is bad, since it forces users to do one thing first and then do what they're used to. Better to have the script add

-include config.mak.autogen

LAST in config.mak, unless it's already in the file and generate config.mak.autogen with configure.

Since Make does things bottoms-up (much like swedish students and midsummer celebrators), the previous hand-edited defaults in config.mak will beat the ones in config.mak.autogen (a good thing).

Quoted 11 lines

But perhaps using another filename for results of ./configure script (and including it in main Makefile) would be better idea.

Quoted 1 line

At least do not overwrite config.mak if it exists.

But one might want to run ./configure with different options, to finally arrive at the set which is satisfactionary. So unless some magic to detect if config.mak was generated from ./configure script, or generated by user is used...

grep -q autogen config.mak || \
echo "-include config.mak.autogen" >> config.mak

I wouldn't want my long-standing, functioning config.mak overwritten, but I *might* be interested in trying some of the options provided by ./configure.

Signature · 3 lines
Andreas Ericsson                   [email protected]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
#30 lore raw
Quoted 6 lines · Andreas Ericsson

grep -q autogen config.mak || \
echo "-include config.mak.autogen" >> config.mak

I wouldn't want my long-standing, functioning config.mak overwritten, but I *might* be interested in trying some of the options provided by ./configure.

Thanks for the solution. Done in my latest patch.

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#31 lore raw
In reply to Andreas Ericsson
Quoted 11 lines · Andreas Ericsson

This is bad, since it forces users to do one thing first and then do what they're used to. Better to have the script add

-include config.mak.autogen

LAST in config.mak, unless it's already in the file and generate config.mak.autogen with configure.

Since Make does things bottoms-up (much like swedish students and midsummer celebrators), the previous hand-edited defaults in config.mak will beat the ones in config.mak.autogen (a good thing).

That's not true, unless we use '?=' assignment in Makefile. And we _want_ to override defaults provided in main git Makefile, so in config.mak.autoconf, and probably in user's own config.mak we use '=' overriding assignment. So it would be better to just add "-include config.mak.autogen" to makefile before "-include config.mak", as in patch below.

Makefile +1 -0
index ccd7c62..a37d400 100644
@@ -333,6 +333,7 @@ ifneq (,$(findstring arm,$(uname_M)))
        ARM_SHA1 = YesPlease
 endif
 
+-include config.mak.autogen
 -include config.mak
 
 ifdef WITH_OWN_SUBPROCESS_PY
Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git