git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] configure: add macros to stash FLAG variables

From
Ben Walton <bwalton@artsci.utoronto.ca>
Date
Mar 12, 2009, 19:20 UTC
Message-ID
<1236885612-22575-4-git-send-email-bwalton@artsci.utoronto.ca>
In-Reply-To
<1236885612-22575-3-git-send-email-bwalton@artsci.utoronto.ca>

Allow for quick stash/unstash of CPPFLAGS and LDFLAGS. Library tests can now be easily bracketted with these macros to allow for values set in user/site arguments.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
---
 configure.ac |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/configure.ac b/configure.ac
index 0bff480..469c9a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,6 +80,32 @@ AC_DEFUN([GIT_CHECK_FUNC],[AC_CHECK_FUNC([$1],[
   AC_SEARCH_LIBS([$1],,
   [$2],[$3])
 ],[$3])])
+
+dnl
+dnl GIT_STASH_FLAGS(BASEPATH_VAR)
+dnl -----------------------------
+dnl Allow for easy stashing of LDFLAGS and CPPFLAGS before running
+dnl tests that may want to take user settings into account.
+AC_DEFUN([GIT_STASH_FLAGS],[
+if test -n "$1"; then
+   old_CPPFLAGS="$CPPFLAGS"
+   old_LDFLAGS="$LDFLAGS"
+   CPPFLAGS="-I$1/include $CPPFLAGS"
+   LDFLAGS="-L$1/$lib $LDFLAGS"
+fi
+])
+
+dnl
+dnl GIT_UNSTASH_FLAGS(BASEPATH_VAR)
+dnl -----------------------------
+dnl Restore the stashed *FLAGS values.
+AC_DEFUN([GIT_UNSTASH_FLAGS],[
+if test -n "$1"; then
+   CPPFLAGS="$old_CPPFLAGS"
+   LDFLAGS="$old_LDFLAGS"
+fi
+])
+
 ## Site configuration related to programs (before tests)
 ## --with-PACKAGE[=ARG] and --without-PACKAGE
 #
-- 
1.6.0.5
Previous: Ben WaltonNext: Ben Walton
Message 4 of 8 in “autoconf changes”
  1. Ben WaltonMar 12, 2009
  2. configure: ensure settings from user are also usable in the scriptBen Walton, Mar 12, 2009
  3. configure: reorganize flow of argument checksBen Walton, Mar 12, 2009
  4. configure: add macros to stash FLAG variablesBen Walton, Mar 12, 2009
  5. configure: wrap some library tests with GIT_STASH_FLAGSBen Walton, Mar 12, 2009
  6. configure: asciidoc version test cleanupBen Walton, Mar 12, 2009
  7. configure: make iconv tests aware of user argumentsBen Walton, Mar 12, 2009
  8. configure: rework pthread handling to allow for user defined flagsBen Walton, Mar 12, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.