Variable substituion ":+" in automake
0
votes
1
answer
63
views
- On ubuntu 24.04
- GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)
- automake (GNU automake) 1.16.5
- autoconf (GNU Autoconf) 2.71
From [automake doc](https://www.gnu.org/software/autoconf/manual/autoconf-2.71/autoconf.pdf)
>${var:+value}
Old BSD shells, including the Ultrix sh, don’t accept the colon for any shell substitution, and complain and die. Similarly for ${var:=value}, ${var:?value},
etc. However, all shells that support functions allow the use of colon in shell
substitution, and since m4sh requires functions, you can portably use null variable substitution patterns in configure scripts.
The substituion does not happen in the following
example
Given : SOURCE_DATE_EPOCH = 333
src/Makefile.am
bin_PROGRAMS = myproject
myproject_SOURCES = main.c
param6=123
a=${param6:+xyz}
$(info ####### a = $(a)#######)
$(info ####### $(SOURCE_DATE_EPOCH) #######)
$(info ########## ${SOURCE_DATE_EPOCH:+ -d @${SOURCE_DATE_EPOCH}})
output :
####### a = #######
####### 333 #######
##########
The third info log isn't printing SOURCE_DATE_EPOCH value despite it being defined
Is it possible to use variable substitution like ":+" in automake files ?
Asked by maths soso
(3 rep)
Mar 27, 2025, 05:34 AM
Last activity: Mar 31, 2025, 02:46 PM
Last activity: Mar 31, 2025, 02:46 PM