I need to identify the major version of a software, to do this it's principally to execute
command --version | head | awk -F "." '{print $1}'
Now, i need to assign this output to a AC_DEFINE variable.
I've tried;
majorvar=$(command --version | head | awk -F "." '{print $1}')
AC_DEFINE_UNQUOTED([myVar],["$majorvar"],[description])
here 'command' appeared in the resulting config.h file
and
AC_DEFINE([myVar],0,[descr])
AC_SUBST([myVar],[$(command --version | head | awk -F "." '{print $1}')])
where the value set by the define (0) is appearing in the result.
Is it possible to obtain the result that I want, i.e
#define myVar 5
or am I going about this in the wrong way, and if so, how should I go about it?
BR/Patrik
I needed several month to wrap my head around the concept of macros. As the name already tells, macros are 'bigger' than scripts. I hope this example can help.
The code snippet defines: