Re: libcody: Fix for dash

2020-12-16 Thread Nathan Sidwell

On 12/16/20 5:02 AM, Richard Sandiford wrote:

Nathan Sidwell  writes:

Apparently 'var+=...' is not a dash thing.  Fixed thusly.

* config.m4: Avoid non-dash idiom
  * configure: Rebuilt.

pushed (2 patches, because I didn't look carefully enough the first time)


Thanks.  I think the other uses of += need the same treatment though:


thanks, I think this gets them all.

There were still some dash-killing uses of +=.  Fixed thusly.

* config.m4: Replace V+="..." with V="$V..."
* configure: Rebuilt.

nathan

--
Nathan Sidwell
diff --git i/libcody/config.m4 w/libcody/config.m4
index 801cfbdb593..ce5e84d0278 100644
--- i/libcody/config.m4
+++ w/libcody/config.m4
@@ -2,6 +2,8 @@
 # Copyright (C) 2020 Nathan Sidwell, nat...@acm.org
 # License: Apache v2.0
 
+# Note: VAR+=... is not dashing, despite its looks
+
 AC_DEFUN([NMS_NOT_IN_SOURCE],
 [if test -e configure ; then
 AC_MSG_ERROR([Do not build in the source tree.  Reasons])
@@ -28,14 +30,13 @@ fi])
 
 AC_DEFUN([NMS_TOOL_DIRS],
 [if test "$tools" && test -d "$tools/include" ; then
-  CXX+=" -I$tools/include"
+  CXX="$CXX -I$tools/include"
 fi
 if test "$tools" && test -d "$tools/lib" ; then
   toollib="$tools/lib"
   if os=$(CXX -print-multi-os-directory 2>/dev/null) ; then
-toollib+="/${os}"
+toollib="$toollib/${os}"
   fi
-  ## VAR+=... is not dashing
   LDFLAGS="$LDFLAGS -L $toollib"
   unset toollib
 fi])
@@ -86,7 +87,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
 ]])],
 [AC_MSG_RESULT([yes])],
 [CXX_ORIG="$CXX"
-CXX+=" -std=c++11"
+CXX="$CXX -std=c++11"
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
 [#if __cplusplus != 201103
 #error "C++11 is required"
@@ -112,7 +113,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
 #endif
 ]])],
 [AC_MSG_RESULT([yes])],
-[CXX+=" -std=c++20"
+[CXX="$CXX -std=c++20"
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
 [#if __cplusplus <= 201703
 #error "C++20 is required"
@@ -248,7 +249,7 @@ if test "${enable_backtrace:-maybe}" != no ; then
 AC_CHECK_HEADERS([demangle.h libiberty/demangle.h],[break])
 # libbfd prevents distribution because of licensing
 AC_CHECK_HEADERS([bfd.h])
-AC_SEARCH_LIBS([bfd_openr],[bfd],[LIBS+="-lz -liberty -ldl"],,[-lz -liberty -ldl])
+AC_SEARCH_LIBS([bfd_openr],[bfd],[LIBS="$LIBS -lz -liberty -ldl"],,[-lz -liberty -ldl])
   fi
   if test "$ac_cv_func_backtrace" = yes ; then
 nms_backtrace=yes
@@ -272,8 +273,8 @@ for generated in config.h.in configure ; do
 done
 for dir in . $SUBDIRS
 do
-  CONFIG_FILES+=" $dir/Makesub"
-  test -f ${srcdir}/$dir/tests/Makesub.in && CONFIG_FILES+=" $dir/tests/Makesub"
+  CONFIG_FILES="$CONFIG_FILES $dir/Makesub"
+  test -f ${srcdir}/$dir/tests/Makesub.in && CONFIG_FILES="$CONFIG_FILES $dir/tests/Makesub"
 done
 AC_CONFIG_FILES([$CONFIG_FILES])
 AC_SUBST(configure_args,[$ac_configure_args])
diff --git i/libcody/configure w/libcody/configure
index 1a119c59b9f..4cc03dcaa3a 100755
--- i/libcody/configure
+++ w/libcody/configure
@@ -1824,6 +1824,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 # Copyright (C) 2020 Nathan Sidwell, nat...@acm.org
 # License: Apache v2.0
 
+# Note: VAR+=... is not dashing, despite its looks
+
 
 
 # thanks to Zack Weinberg for fixing this!
@@ -2574,7 +2576,7 @@ if ac_fn_cxx_try_compile "$LINENO"; then :
 $as_echo "yes" >&6; }
 else
   CXX_ORIG="$CXX"
-CXX+=" -std=c++11"
+CXX="$CXX -std=c++11"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -2625,14 +2627,13 @@ unset CXX_ORIG
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 if test "$tools" && test -d "$tools/include" ; then
-  CXX+=" -I$tools/include"
+  CXX="$CXX -I$tools/include"
 fi
 if test "$tools" && test -d "$tools/lib" ; then
   toollib="$tools/lib"
   if os=$(CXX -print-multi-os-directory 2>/dev/null) ; then
-toollib+="/${os}"
+toollib="$toollib/${os}"
   fi
-  ## VAR+=... is not dashing
   LDFLAGS="$LDFLAGS -L $toollib"
   unset toollib
 fi
@@ -2671,8 +2672,8 @@ for generated in config.h.in configure ; do
 done
 for dir in . $SUBDIRS
 do
-  CONFIG_FILES+=" $dir/Makesub"
-  test -f ${srcdir}/$dir/tests/Makesub.in && CONFIG_FILES+=" $dir/tests/Makesub"
+  CONFIG_FILES="$CONFIG_FILES $dir/Makesub"
+  test -f ${srcdir}/$dir/tests/Makesub.in && CONFIG_FILES="$CONFIG_FILES $dir/tests/Makesub"
 done
 ac_config_files="$ac_config_files $CONFIG_FILES"
 


Re: libcody: Fix for dash

2020-12-16 Thread Richard Sandiford via Gcc-patches
Nathan Sidwell  writes:
> Apparently 'var+=...' is not a dash thing.  Fixed thusly.
>
>   * config.m4: Avoid non-dash idiom
>  * configure: Rebuilt.
>
> pushed (2 patches, because I didn't look carefully enough the first time)

Thanks.  I think the other uses of += need the same treatment though:

  CXX+=" -I$tools/include"
toollib+="/${os}"
CXX+=" -std=c++11"
[CXX+=" -std=c++20"
AC_SEARCH_LIBS([bfd_openr],[bfd],[LIBS+="-lz -liberty -ldl"],,[-lz -liberty 
-ldl])
  CONFIG_FILES+=" $dir/Makesub"
  test -f ${srcdir}/$dir/tests/Makesub.in && CONFIG_FILES+=" $dir/tests/Makesub"
Richard


libcody: Fix for dash

2020-12-15 Thread Nathan Sidwell

Apparently 'var+=...' is not a dash thing.  Fixed thusly.

* config.m4: Avoid non-dash idiom
* configure: Rebuilt.

pushed (2 patches, because I didn't look carefully enough the first time)

--
Nathan Sidwell
diff --git i/libcody/config.m4 w/libcody/config.m4
index 364195a9f0b..0ae7b2665f0 100644
--- i/libcody/config.m4
+++ w/libcody/config.m4
@@ -35,7 +35,8 @@ if test "$tools" && test -d "$tools/lib" ; then
   if os=$(CXX -print-multi-os-directory 2>/dev/null) ; then
 toollib+="/${os}"
   fi
-  LDFLAGS+=" -L $toollib"
+  ## VAR+=... is not dashing
+  LDFLAGS="$LDFLAGS -L $toollib"
   unset toollib
 fi])
 
diff --git i/libcody/configure w/libcody/configure
index 35fd4e9db7e..8f22dd78134 100755
--- i/libcody/configure
+++ w/libcody/configure
@@ -2632,7 +2632,8 @@ if test "$tools" && test -d "$tools/lib" ; then
   if os=$(CXX -print-multi-os-directory 2>/dev/null) ; then
 toollib+="/${os}"
   fi
-  LDFLAGS+=" -L $toollib"
+  ## VAR+=... is not dashing
+  LDFLAGS="$LDFLAGS -L $toollib"
   unset toollib
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking adding -Wl,--no-undefined to linker" >&5
diff --git i/libcody/config.m4 w/libcody/config.m4
index 0ae7b2665f0..801cfbdb593 100644
--- i/libcody/config.m4
+++ w/libcody/config.m4
@@ -173,7 +173,7 @@ AC_SUBST(EXCEPTIONS)])
 AC_DEFUN([NMS_LINK_OPT],
 [AC_MSG_CHECKING([adding $1 to linker])
 ORIG_LDFLAGS="$LDFLAGS"
-LDFLAGS+=" $1"
+LDFLAGS="$LDFLAGS $1"
 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
 [AC_MSG_RESULT([ok])],
 [LDFLAGS="$ORIG_LDFLAGS"
@@ -229,8 +229,8 @@ elif test "$withval" = "no" ; then
   AC_MSG_RESULT(installed)
 else
   AC_MSG_RESULT(${withval})
-  CPPFLAGS+=" -I${withval}/include"
-  LDFLAGS+=" -L${withval}/lib"
+  CPPFLAGS="$CPPFLAGS -I${withval}/include"
+  LDFLAGS="$LDFLAGS -L${withval}/lib"
 fi,
 AC_MSG_RESULT(installed))])
 
diff --git i/libcody/configure w/libcody/configure
index 8f22dd78134..1a119c59b9f 100755
--- i/libcody/configure
+++ w/libcody/configure
@@ -2639,7 +2639,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking adding -Wl,--no-undefined to linker" >&5
 $as_echo_n "checking adding -Wl,--no-undefined to linker... " >&6; }
 ORIG_LDFLAGS="$LDFLAGS"
-LDFLAGS+=" -Wl,--no-undefined"
+LDFLAGS="$LDFLAGS -Wl,--no-undefined"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */