Re: [squid-users] compiler-flags.m4 and modifying options

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Wed, 18 Sep 2013 10:39:06 -0600

On 09/17/2013 06:00 PM, Jeffrey Walton wrote:
> Forgive my ignorance here because I still write my makefiles by hand.
>
> If I wanted to delete an option used by the project, is it as simple
> as removing the option from the switch statement around line 155:
>
> AC_DEFUN([SQUID_CC_GUESS_OPTIONS], [
> AC_REQUIRE([SQUID_CC_GUESS_VARIANT])
> AC_MSG_CHECKING([for compiler variant])
> case "$squid_cv_compiler" in
> gcc)
> squid_cv_cc_option_werror="-Werror"
> squid_cv_cxx_option_werror="-Werror"
> squid_cv_cc_option_wall="-Wall"
> squid_cv_cc_option_optimize="-O3"
> squid_cv_cc_arg_pipe="-pipe"
> ;;
> sunstudio)
> ...
>
> So I would delete squid_cv_cc_option_werror="-Werror" and
> squid_cv_cxx_option_werror="-Werror" to remove the option (from all
> compilers under the switch).

BTW, I do not see the --disable-error-checking side effect (that you
have complained previously about) in the trunk configure.ac code:

> if test "x$enable_strict_error_checking" != "xno"; then
> SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_option_werror"
> SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cxx_option_werror"
> fi

Perhaps things have changed or you are dealing with a sub-configure
script that treats enable_strict_error_checking differently.

> How about adding options? Can I define a new option on the fly? For example:
>
> squid_cv_cc_option_nx_stack="-Wl,z,noexecstack"
> squid_cv_cc_option_nx_heap="-Wl,z,noexecheap"

AFAICT, there is no generic code to convert all squid_cv_cc_option_*
variables into compiler options. You can add conversion code for your
variables (easy, see configure.ac quote above) OR you may be able to
temporary (while testing) hijack an existing variable if it is going to
be used in a similar context. For example,

    squid_cv_cc_option_optimize="-O3 -Wl,z,noexecstack"

Please note that I did not check whether squid_cv_cc_option_optimize is
used in the same context where you want your new options to be used.

Still, manually defining correct CXXFLAGS and such when ./configuring
Squid ought to be easier than enhancing configure.ac and .m4 scripts.

> No-exec heaps are only available on PaX enabled kernels (such as
> Gentoo), so can I expect the autotools to do the right thing and only
> add it if available?

I doubt that. Autotools themselves probably do not know which compiler
supports which esoteric options in which environments.

HTH,

Alex.
Received on Wed Sep 18 2013 - 16:39:20 MDT

This archive was generated by hypermail 2.2.0 : Thu Sep 19 2013 - 12:00:04 MDT