Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How to cache $CFLAGS, $LIBS etc.



Bart wrote:
> On Aug 11, 12:28pm, Peter Stephenson wrote:
> } Subject: How to cache $CFLAGS, $LIBS etc.
> }
> } 2. Use `--enable-cflags', `--enable-libs', `--enable-ldflags' or whatever.
> } This probably ought to work because the arguments are remembered for use
> } with --recheck.
> 
> I've done this with configure in other packages; it works fine.

Seems OK.  I've only tried it with the CFLAGS and LIBS values.

Index: INSTALL
===================================================================
RCS file: /cvsroot/zsh/zsh/INSTALL,v
retrieving revision 1.1.1.21
diff -u -r1.1.1.21 INSTALL
--- INSTALL	2000/03/01 18:31:21	1.1.1.21
+++ INSTALL	2000/08/11 18:06:38
@@ -127,6 +127,15 @@
 Or on systems that have the "env" program, you can do it like this:
     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
 
+The flags CFLAGS, CPPFLAGS, LDFLAGS and LIBS can also be set as flags to
+configure, where the name appears in lower case:
+    configure --enable-cflags=-O2 --enable-libs=-lposix
+
+The advantage of this form is that `config.status --recheck' will remember
+the flags you originally specified.  You can still override the flags when
+running `make' (although these will not be passed down via `config.status
+--recheck').
+
 Check Generated Files
 ---------------------
 
Index: aczsh.m4
===================================================================
RCS file: /cvsroot/zsh/zsh/aczsh.m4,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 aczsh.m4
--- aczsh.m4	1999/12/06 19:01:52	1.1.1.9
+++ aczsh.m4	2000/08/11 18:06:38
@@ -620,3 +620,29 @@
 rm -f conftestsed
 AC_SUBST(tzsh)dnl
 ])
+
+AC_DEFUN(zsh_COMPILE_FLAGS,
+    [AC_ARG_ENABLE(cppflags,
+	[  --enable-cppflags=...      specify C preprocessor flags],
+	if test "$enableval" = "yes"
+	then CPPFLAGS="$1"
+	else CPPFLAGS="$enable_cppflags"
+	fi)
+    AC_ARG_ENABLE(cflags,
+	[  --enable-cflags=...        specify C compiler flags],
+	if test "$enableval" = "yes"
+	then CFLAGS="$1"
+	else CFLAGS="$enable_cflags"
+	fi)
+    AC_ARG_ENABLE(ldflags,
+	[  --enable-ldflags=...       specify linker flags],
+	if test "$enableval" = "yes"
+	then LDFLAGS="$2"
+	else LDFLAGS="$enable_ldflags"
+	fi)
+    AC_ARG_ENABLE(libs,
+	[  --enable-libs=...          specify link libraries],
+	if test "$enableval" = "yes"
+	then LIBS="$3"
+	else LIBS="$enable_libs"
+	fi)])
Index: configure.in
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.in,v
retrieving revision 1.20
diff -u -r1.20 configure.in
--- configure.in	2000/08/08 14:57:02	1.20
+++ configure.in	2000/08/11 18:06:39
@@ -48,6 +48,9 @@
 dnl Handle --program-prefix, --program-suffix, etc.
 zsh_ARG_PROGRAM
 
+dnl Handle setting of compile flags (CPPFLAGS, CFLAGS, LDFLAGS, LIBS).
+zsh_COMPILE_FLAGS
+
 dnl Do you want to debug zsh?
 undefine([zsh-debug])dnl
 AC_ARG_ENABLE(zsh-debug,

-- 
Peter Stephenson <pws@xxxxxxx>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070



Messages sorted by: Reverse Date, Date, Thread, Author