Skip to content

Commit 3f60fa8

Browse files
committed
configure.ac: escape backslashes when generating preprocessor directives for .build_params; delete backslashes and process parenthesized arguments correctly when generating options.h.
1 parent 7b52913 commit 3f60fa8

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

configure.ac

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8634,8 +8634,8 @@ fi
86348634

86358635
if test "$ENABLED_REPRODUCIBLE_BUILD" != "yes"
86368636
then
8637-
echo "#define LIBWOLFSSL_CONFIGURE_ARGS \"$ac_configure_args\"" > "${output_objdir}/.build_params" &&
8638-
echo "#define LIBWOLFSSL_GLOBAL_CFLAGS \"$CPPFLAGS $AM_CPPFLAGS $CFLAGS $AM_CFLAGS\" LIBWOLFSSL_GLOBAL_EXTRA_CFLAGS" >> "${output_objdir}/.build_params" ||
8637+
echo "#define LIBWOLFSSL_CONFIGURE_ARGS \"$ac_configure_args\"" | sed 's/\\/\\\\/g' > "${output_objdir}/.build_params" &&
8638+
echo "#define LIBWOLFSSL_GLOBAL_CFLAGS \"$CPPFLAGS $AM_CPPFLAGS $CFLAGS $AM_CFLAGS\" LIBWOLFSSL_GLOBAL_EXTRA_CFLAGS" | sed 's/\\/\\\\/g' >> "${output_objdir}/.build_params" ||
86398639
AC_MSG_ERROR([Couldn't create ${output_objdir}/.build_params.])
86408640
else
86418641
rm -f "${output_objdir}/.build_params"
@@ -8680,8 +8680,9 @@ for option in $CPPFLAGS $AM_CPPFLAGS $CFLAGS $AM_CFLAGS; do
86808680
opt_type=$(echo $option | $TRIM )
86818681
case "$opt_type" in
86828682
-D)
8683-
RHS_only=$(echo $option | sed 's/^-D//')
8684-
noequalsign=$(echo $RHS_only | sed 's/=/ /')
8683+
option=$(echo "$option" | tr -d '\\')
8684+
RHS_only=$(echo "$option" | sed 's/^-D//')
8685+
noequalsign=$(echo "$RHS_only" | tr '=' ' ')
86858686
if test "$noequalsign" = "NDEBUG" || test "$noequalsign" = "DEBUG"
86868687
then
86878688
if test "$verbose" = "yes"; then
@@ -8697,7 +8698,9 @@ for option in $CPPFLAGS $AM_CPPFLAGS $CFLAGS $AM_CFLAGS; do
86978698
echo "#ifndef WOLFSSL_OPTIONS_IGNORE_SYS" >> $OPTION_FILE
86988699
fi
86998700

8700-
noarg=$(echo "$RHS_only" | sed 's/=.*//')
8701+
# note need to use both autotools-style [] quoting and shell-style ''
8702+
# quoting for sed script with [] character set expression here.
8703+
noarg=$(echo "$RHS_only" | sed ['s/\(([^=)]*)\)\{0,1\}=.*//'])
87018704
echo "#undef $noarg" >> $OPTION_FILE
87028705
echo "#define $noequalsign" >> $OPTION_FILE
87038706

0 commit comments

Comments
 (0)