configure: add macros to stash FLAG variables
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ben Walton committed
Mar 12, 2009 at 15:20 UTC
918c8120172514704809cbdf889794d8b1345d0a
1 file changed
+26
configure.ac
+26
@@ -80,6 +80,32 @@ AC_DEFUN([GIT_CHECK_FUNC],[AC_CHECK_FUNC([$1],[
80
AC_SEARCH_LIBS([$1],,
81
[$2],[$3])
82
],[$3])])
83
+
84
+dnl
85
+dnl GIT_STASH_FLAGS(BASEPATH_VAR)
86
+dnl -----------------------------
87
+dnl Allow for easy stashing of LDFLAGS and CPPFLAGS before running
88
+dnl tests that may want to take user settings into account.
89
+AC_DEFUN([GIT_STASH_FLAGS],[
90
+if test -n "$1"; then
91
+ old_CPPFLAGS="$CPPFLAGS"
92
+ old_LDFLAGS="$LDFLAGS"
93
+ CPPFLAGS="-I$1/include $CPPFLAGS"
94
+ LDFLAGS="-L$1/$lib $LDFLAGS"
95
+fi
96
+])
97
+
98
+dnl
99
+dnl GIT_UNSTASH_FLAGS(BASEPATH_VAR)
100
+dnl -----------------------------
101
+dnl Restore the stashed *FLAGS values.
102
+AC_DEFUN([GIT_UNSTASH_FLAGS],[
103
+if test -n "$1"; then
104
+ CPPFLAGS="$old_CPPFLAGS"
105
+ LDFLAGS="$old_LDFLAGS"
106
+fi
107
+])
108
+
109
## Site configuration related to programs (before tests)
110
## --with-PACKAGE[=ARG] and --without-PACKAGE
111
#