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

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



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.

} But the guide for how configure is used is pretty fascistic about not
} allowing anything RMS wouldn't like, so I don't know if there are
} drawbacks to this.

Zsh isn't a GNU package, so I'm not especially concerned about RMS's
blood pressure.

} Plus we need to be careful if people supply
} environment variables in the standard way.

It actually all works pretty well as long as you don't try to use both
the environment variables and the --enable flags in the same configure
(with different values).  The --enable flags always win.

If you use environment variables or make-command-line variables to change
the CFLAGS at make time, they'll correctly override the --enable settings
for the actual build, but not for any tests run within an automatic re-
configure.  If that's a problem we can most likely rewrite the Makefile.in
to force the appropriate --enable options to be passed to config.status;
e.g.
	config.status --recheck --enable-cflags='$(CFLAGS)' ...

However, I've never yet found this to be an issue.  If the new value of,
say, LIBS would result in a different configuration output, chances are
you should have run configure directly in the first place.

} Does anyone know how to do this properly?

This is lifted (and edited to change the name) from another acinclude.m4
that I wrote:

AC_DEFUN([zsh_compile_flags],
    [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="$1"
	else LDFLAGS="$enable_ldflags"
	fi)])

Add any others that you want, stick it in aczsh.m4, etc., you know the
drill.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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