I would like to add flags using automake to the configure.ac file so that I can change the flag package depending on the version of gcc on host. I tried to do that:
configure.ac (I enter the following command at the top of this file)
AM_CONDITIONAL([gcc_v_above_4_9], [test x$(expr `gcc -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$/&00/'` \>= 40900) = x1])
Makefile.am
if gcc_v_above_4_9
AM_CFLAGS += -fstack-protector-strong
endif
then I run a script ./autogen.sh (everything clear), and then ./configure and I have got a message like this:
configure: error: conditional "gcc_v_above_4_9" was never defined.
Usually this means the macro was only invoked conditionally.
What should I do to make flags dependent on the gcc version?