ax_cflags_no_writable_strings

Synopsis

AX_CFLAGS_NO_WRITABLE_STRINGS [(shellvar [,default, [A/NA]])]

Description

Try to find a compiler option that makes all string literals readonly.

The sanity check is done by looking at string.h which has a set of strcpy definitions that should be defined with const-modifiers to not emit a warning in all so many places.

For the GNU CC compiler it will be -fno-writable-strings -Wwrite-strings The result is added to the shellvar being CFLAGS by default.

DEFAULTS:

 - $1 shell-variable-to-add-to : CFLAGS
 - $2 add-value-if-not-found : nothing
 - $3 action-if-found : add value to shellvariable
 - $4 action-if-not-found : nothing

NOTE: These macros depend on AX_APPEND_FLAG.

Source Code

Download the latest version of ax_cflags_no_writable_strings.m4 or browse the macro’s revision history.

License

Copyright © 2008 Guido U. Draheim 

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.