Subject: [PATCH 4/4] autoconf: Move variables which we always set to config.mak.in

From: Jakub Narebski <[email-masked]>
Date: Tue, 8 Aug 2006 18:39:06 +0200

Move detected NO_STH and NEED_STH variables, which we always output,
either setting or unsetting (setting to empty string) to config.mak.in
and use setting appropriately named variables and doing AC_SUBST
instead of adding them via GIT_CONF_APPEND_LINE macro and
config.mak.append temporary file.

Variables which might and might not be set are still added via
config.mak.append; this include all STH_PATH variables.

Signed-off-by: Jakub Narebski <[email-masked]>
---
This makes our configure.ac more typical.

 config.mak.in |   15 +++++++++++
 configure.ac  |   75 +++++++++++++++++++++++++++++++++------------------------
 2 files changed, 59 insertions(+), 31 deletions(-)

diff --git a/config.mak.in b/config.mak.in
index 04f508a..99b13a7 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -22,3 +22,18 @@ VPATH = @srcdir@
 export exec_prefix mandir
 export srcdir VPATH
 
+NO_PYTHON=@NO_PYTHON@
+NEEDS_SSL_WITH_CRYPTO=@NEEDS_SSL_WITH_CRYPTO@
+NO_CURL=@NO_CURL@
+NO_EXPAT=@NO_EXPAT@
+NEEDS_LIBICONV=@NEEDS_LIBICONV@
+NEEDS_SOCKET=@NEEDS_SOCKET@
+NO_D_INO_IN_DIRENT=@NO_D_INO_IN_DIRENT@
+NO_D_TYPE_IN_DIRENT=@NO_D_TYPE_IN_DIRENT@
+NO_SOCKADDR_STORAGE=@NO_SOCKADDR_STORAGE@
+NO_IPV6=@NO_IPV6@
+NO_C99_FORMAT=@NO_C99_FORMAT@
+NO_STRCASESTR=@NO_STRCASESTR@
+NO_STRLCPY=@NO_STRLCPY@
+NO_SETENV=@NO_SETENV@
+
diff --git a/configure.ac b/configure.ac
index c27a994..bc2824b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -149,7 +149,6 @@ if test -z "$NO_PYTHON"; then
 		NO_PYTHON=""
 	fi
 fi
-GIT_CONF_APPEND_LINE([NO_PYTHON=@NO_PYTHON@])

 ## Checks for libraries.
@@ -158,35 +157,41 @@ #
 # Define NO_OPENSSL environment variable if you do not have OpenSSL.
 # Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin).
 AC_CHECK_LIB([crypto], [SHA1_Init],
-[GIT_CONF_APPEND_LINE(NEEDS_SSL_WITH_CRYPTO=)],
+[NEEDS_SSL_WITH_CRYPTO=],
 [AC_CHECK_LIB([ssl], [SHA1_Init],
- [GIT_CONF_APPEND_LINE(NEEDS_SSL_WITH_CRYPTO=YesPlease)
-  GIT_CONF_APPEND_LINE(NEEDS_SSL_WITH_CRYPTO=)],
- [GIT_CONF_APPEND_LINE(NO_OPENSSL=YesPlease)])])
+ [NEEDS_SSL_WITH_CRYPTO=YesPlease
+  NEEDS_SSL_WITH_CRYPTO=],
+ [NO_OPENSSL=YesPlease])])
+AC_SUBST(NEEDS_SSL_WITH_CRYPTO)
+AC_SUBST(NO_OPENSSL)
 #
 # 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.
 AC_CHECK_LIB([curl], [curl_global_init],
-[GIT_CONF_APPEND_LINE(NO_CURL=)],
-[GIT_CONF_APPEND_LINE(NO_CURL=YesPlease)])
+[NO_CURL=],
+[NO_CURL=YesPlease])
+AC_SUBST(NO_CURL)
 #
 # 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.
 AC_CHECK_LIB([expat], [XML_ParserCreate],
-[GIT_CONF_APPEND_LINE(NO_EXPAT=)],
-[GIT_CONF_APPEND_LINE(NO_EXPAT=YesPlease)])
+[NO_EXPAT=],
+[NO_EXPAT=YesPlease])
+AC_SUBST(NO_EXPAT)
 #
 # Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
 AC_CHECK_LIB([c], [iconv],
-[GIT_CONF_APPEND_LINE(NEEDS_LIBICONV=)],
-[GIT_CONF_APPEND_LINE(NEEDS_LIBICONV=YesPlease)])
+[NEEDS_LIBICONV=],
+[NEEDS_LIBICONV=YesPlease])
+AC_SUBST(NEEDS_LIBICONV)
 #
 # Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
 # Patrick Mauritz).
 AC_CHECK_LIB([c], [socket],
-[GIT_CONF_APPEND_LINE(NEEDS_SOCKET=)],
-[GIT_CONF_APPEND_LINE(NEEDS_SOCKET=YesPlease)])
+[NEEDS_SOCKET=],
+[NEEDS_SOCKET=YesPlease])
+AC_SUBST(NEEDS_SOCKET)

 ## Checks for header files.
@@ -197,33 +202,38 @@ AC_MSG_NOTICE([CHECKS for typedefs, stru
 #
 # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
 AC_CHECK_MEMBER(struct dirent.d_ino,
-[GIT_CONF_APPEND_LINE(NO_D_INO_IN_DIRENT=)],
-[GIT_CONF_APPEND_LINE(NO_D_INO_IN_DIRENT=YesPlease)],
+[NO_D_INO_IN_DIRENT=],
+[NO_D_INO_IN_DIRENT=YesPlease],
 [#include <dirent.h>])
+AC_SUBST(NO_D_INO_IN_DIRENT)
 #
 # Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
 # d_type in struct dirent (latest Cygwin -- will be fixed soonish).
 AC_CHECK_MEMBER(struct dirent.d_type,
-[GIT_CONF_APPEND_LINE(NO_D_TYPE_IN_DIRENT=)],
-[GIT_CONF_APPEND_LINE(NO_D_TYPE_IN_DIRENT=YesPlease)],
+[NO_D_TYPE_IN_DIRENT=],
+[NO_D_TYPE_IN_DIRENT=YesPlease],
 [#include <dirent.h>])
+AC_SUBST(NO_D_TYPE_IN_DIRENT)
 #
 # Define NO_SOCKADDR_STORAGE if your platform does not have struct
 # sockaddr_storage.
 AC_CHECK_TYPE(struct sockaddr_storage,
-[GIT_CONF_APPEND_LINE(NO_SOCKADDR_STORAGE=)],
-[GIT_CONF_APPEND_LINE(NO_SOCKADDR_STORAGE=YesPlease)],
+[NO_SOCKADDR_STORAGE=],
+[NO_SOCKADDR_STORAGE=YesPlease],
 [#include <netinet/in.h>])
+AC_SUBST(NO_SOCKADDR_STORAGE)
+#
 # Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
 AC_CHECK_TYPE([struct addrinfo],[
  AC_CHECK_FUNC([getaddrinfo],
-  [GIT_CONF_APPEND_LINE(NO_IPV6=)],
-  [GIT_CONF_APPEND_LINE(NO_IPV6=YesPlease)])
-],[GIT_CONF_APPEND_LINE(NO_IPV6=YesPlease)],[
+  [NO_IPV6=],
+  [NO_IPV6=YesPlease])
+],[NO_IPV6=YesPlease],[
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netdb.h>
 ])
+AC_SUBST(NO_IPV6)
 #
 # Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
 # do not support the 'size specifiers' introduced by C99, namely ll, hh,
@@ -243,11 +253,11 @@ AC_RUN_IFELSE(
 	[ac_cv_c_c99_format=no])
 ])
 if test $ac_cv_c_c99_format = no; then
-	GIT_CONF_APPEND_LINE(NO_C99_FORMAT=YesPlease)
+	NO_C99_FORMAT=YesPlease
 else
-	GIT_CONF_APPEND_LINE(NO_C99_FORMAT=)
+	NO_C99_FORMAT=
 fi
-
+AC_SUBST(NO_C99_FORMAT)
 
 ## Checks for library functions.
 ## (in default C library and libraries checked by AC_CHECK_LIB)
@@ -255,18 +265,21 @@ AC_MSG_NOTICE([CHECKS for library functi
 #
 # Define NO_STRCASESTR if you don't have strcasestr.
 AC_CHECK_FUNC(strcasestr,
-[GIT_CONF_APPEND_LINE(NO_STRCASESTR=)],
-[GIT_CONF_APPEND_LINE(NO_STRCASESTR=YesPlease)])
+[NO_STRCASESTR=],
+[NO_STRCASESTR=YesPlease])
+AC_SUBST(NO_STRCASESTR)
 #
 # Define NO_STRLCPY if you don't have strlcpy.
 AC_CHECK_FUNC(strlcpy,
-[GIT_CONF_APPEND_LINE(NO_STRLCPY=)],
-[GIT_CONF_APPEND_LINE(NO_STRLCPY=YesPlease)])
+[NO_STRLCPY=],
+[NO_STRLCPY=YesPlease])
+AC_SUBST(NO_STRLCPY)
 #
 # Define NO_SETENV if you don't have setenv in the C library.
 AC_CHECK_FUNC(setenv,
-[GIT_CONF_APPEND_LINE(NO_SETENV=)],
-[GIT_CONF_APPEND_LINE(NO_SETENV=YesPlease)])
+[NO_SETENV=],
+[NO_SETENV=YesPlease])
+AC_SUBST(NO_SETENV)
 #
 # Define NO_MMAP if you want to avoid mmap.
 #
-- 
1.4.1.1