Skip to contentSkip to conversation

configure.ac: fix bashism

PATCH Applied Sam James 2 participants 2 messages Dec 29, 2023 – Jan 1, 2024

lore
Share & tools
lore

Sam James

author
#0 lore raw

PATCH 1/1 configure.ac: fix bashism

configure scripts need to be runnable with a POSIX-compliant /bin/sh.

On many (but not all!) systems, /bin/sh is provided by Bash, so errors like this aren't spotted. Notably Debian defaults to /bin/sh provided by dash which doesn't tolerate such bashisms as '+='.

This retains compatibility with bash. Just copy the expanded append like we do on the line above.

Fixes warnings like:

```
./configure: 13352: CFLAGS+= -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2: not found
```
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +1 -1
index 3e9da6bb..57874ab7 100644
@@ -44,7 +44,7 @@ AC_ARG_ENABLE(optimization, AS_HELP_STRING([--disable-optimization],
 
 if (test "${enable_optimization}" != "no"); then
 	CFLAGS="$CFLAGS -O2"
-	CFLAGS+=" -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
+	CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
 fi
 
 AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],
Signature · 1 line
2.43.0
#1 lore raw

Hi Sam,

Quoted 9 lines · Sam James

configure scripts need to be runnable with a POSIX-compliant /bin/sh.

On many (but not all!) systems, /bin/sh is provided by Bash, so errors like this aren't spotted. Notably Debian defaults to /bin/sh provided by dash which doesn't tolerate such bashisms as '+='.

This retains compatibility with bash. Just copy the expanded append like we do on the line above.

Quoted 8 lines

Fixes warnings like:

```
./configure: 13352: CFLAGS+= -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2: not found
```
---
  configure.ac | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Regards,
-Denis