-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi/2.

Mike Frysinger wrote:
> On 15 Jan 2024 21:15, KO Myung-Hun wrote:
>> Mike Frysinger wrote:
>>> On 15 Oct 2023 02:04, KO Myung-Hun wrote:
>>>> Some OSes such as OS/2, uses ';' as a path separator. So
>>>> using $PATH_SEPARATOR instead of hard-coded ':' is more
>>>> proper.
>>>> 
>>>> * build-aux-ltmain.in: replace : with $PATH_SEPARATOR. * 
>>>> m4/libtool.m4: Likewise.
>>> 
>>> this doesn't work for me
>>> 
>>> 544675d6b538 2024-01-14 18:06:03 -0500 gnulib: update submodule
>>> to current versions
>>> 
>>> $ ./bootstrap $ ./configure ... checking for mt... no checking
>>> if : is a manifest tool... no ./configure: 1: Syntax error:
>>> Unterminated quoted string $ -mike
>> 
>> How about this?
> 
> it passes configure, but fails `make check` & `make syntax-check`. 
> -mike

Another try.

- -- 
KO Myung-Hun

Korean OS/2 User Community : https://www.os2.kr/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (OS/2)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFlppZFE9YstvghgroRAjFKAJ0fQTTh4qTJtgRvd/pI2TSeFIf4xgCeNEWF
mWoDIYiA2aMRvGaFs3ES9cE=
=fXIc
-----END PGP SIGNATURE-----
From 11d5ba83c5211ec7e149f3170bbaf7d49e6448da Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <komh@chollian.net>
Date: Thu, 3 Nov 2022 23:32:37 +0900
Subject: [PATCH v3 1/2] libtool: replace : with $PATH_SEPARATOR

Some OSes such as OS/2, uses ';' as a path separator. So using
$PATH_SEPARATOR instead of hard-coded ':' is more proper.

* Makefile.am (TESTS_ENVIRONMENT): Pass $PATH_SEPARATOR.
* build-aux-ltmain.in: Replace : with $PATH_SEPARATOR.
* m4/libtool.m4: Likewise.
---
 Makefile.am         |  1 +
 build-aux/ltmain.in | 76 ++++++++++++++++++++++-----------------------
 m4/libtool.m4       | 16 +++++-----
 3 files changed, 47 insertions(+), 46 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 904f3d73..d2838ad2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -745,6 +745,7 @@ TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
 	F77="$(F77)" FFLAGS="$(FFLAGS)" \
 	FC="$(FC)" FCFLAGS="$(FCFLAGS)" \
 	GCJ="$(GCJ)" GCJFLAGS="$(GCJFLAGS)" \
+	PATH_SEPARATOR="$(PATH_SEPARATOR)" \
 	lt_cv_with_aix_soname="$(with_aix_soname)" \
 	lt_cv_to_host_file_cmd="$(to_host_file_cmd)" \
 	lt_cv_to_tool_file_cmd="$(to_tool_file_cmd)"
diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index d5157a8d..8e596847 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -733,8 +733,8 @@ func_resolve_sysroot ()
 # store the result into func_replace_sysroot_result.
 func_replace_sysroot ()
 {
-  case $lt_sysroot:$1 in
-  ?*:"$lt_sysroot"*)
+  case $lt_sysroot$PATH_SEPARATOR$1 in
+  ?*$PATH_SEPARATOR$lt_sysroot*)
     func_stripname "$lt_sysroot" '' "$1"
     func_replace_sysroot_result='='$func_stripname_result
     ;;
@@ -2007,7 +2007,7 @@ func_mode_execute ()
       if eval "test -z \"\$$shlibpath_var\""; then
 	eval "$shlibpath_var=\"\$dir\""
       else
-	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+	eval "$shlibpath_var=\"\$dir\$PATH_SEPARATOR\$$shlibpath_var\""
       fi
     done
 
@@ -3579,7 +3579,7 @@ func_exec_program ()
 	if test -n "$dllsearchpath"; then
 	  $ECHO "\
     # Add the dll search path components to the executable PATH
-    PATH=$dllsearchpath:\$PATH
+    PATH=\"$dllsearchpath$PATH_SEPARATOR\$PATH\"
 "
 	fi
 
@@ -3591,7 +3591,7 @@ func_exec_program ()
 
     # Some systems cannot cope with colon-terminated $shlibpath_var
     # The second colon is a workaround for a bug in BeOS R4 sed
-    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
+    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/$PATH_SEPARATOR$PATH_SEPARATOR*\$//'\`
 
     export $shlibpath_var
 "
@@ -3802,7 +3802,7 @@ EOF
 	    fi
 
 	    if test -n "$dllsearchpath"; then
-              func_to_host_path "$dllsearchpath:"
+              func_to_host_path "$dllsearchpath$PATH_SEPARATOR"
 	      cat <<EOF
 const char * EXE_PATH_VARNAME = "PATH";
 const char * EXE_PATH_VALUE   = "$func_to_host_path_result";
@@ -5108,15 +5108,15 @@ func_mode_link ()
 	case $host in
 	*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*)
 	  testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
-	  case :$dllsearchpath: in
-	  *":$dir:"*) ;;
-	  ::) dllsearchpath=$dir;;
-	  *) func_append dllsearchpath ":$dir";;
+	  case $PATH_SEPARATOR$dllsearchpath$PATH_SEPARATOR in
+	  *$PATH_SEPARATOR$dir$PATH_SEPARATOR*) ;;
+	  $PATH_SEPARATOR$PATH_SEPARATOR) dllsearchpath=$dir;;
+	  *) func_append dllsearchpath "$PATH_SEPARATOR$dir";;
 	  esac
-	  case :$dllsearchpath: in
-	  *":$testbindir:"*) ;;
-	  ::) dllsearchpath=$testbindir;;
-	  *) func_append dllsearchpath ":$testbindir";;
+	  case $PATH_SEPARATOR$dllsearchpath$PATH_SEPARATOR in
+	  *$PATH_SEPARATOR$testbindir$PATH_SEPARATOR*) ;;
+	  $PATH_SEPARATOR$PATH_SEPARATOR) dllsearchpath=$testbindir;;
+	  *) func_append dllsearchpath "$PATH_SEPARATOR$testbindir";;
 	  esac
 	  ;;
 	esac
@@ -5600,7 +5600,7 @@ func_mode_link ()
 
     if test -n "$shlibpath_var"; then
       # get the directories listed in $shlibpath_var
-      eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
+      eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/$PATH_SEPARATOR/ /g\'\`
     else
       shlib_search_path=
     fi
@@ -6231,9 +6231,9 @@ func_mode_link ()
 	    # We need to hardcode the library path
 	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
 	      # Make sure the rpath contains only unique directories.
-	      case $temp_rpath: in
-	      *"$absdir:"*) ;;
-	      *) func_append temp_rpath "$absdir:" ;;
+	      case $temp_rpath$PATH_SEPARATOR in
+	      *$absdir$PATH_SEPARATOR*) ;;
+	      *) func_append temp_rpath "$absdir$PATH_SEPARATOR" ;;
 	      esac
 	    fi
 
@@ -6458,9 +6458,9 @@ func_mode_link ()
 	    fi
 
 	    if test -n "$add_shlibpath"; then
-	      case :$compile_shlibpath: in
-	      *":$add_shlibpath:"*) ;;
-	      *) func_append compile_shlibpath "$add_shlibpath:" ;;
+	      case $PATH_SEPARATOR$compile_shlibpath$PATH_SEPARATOR in
+	      *$PATH_SEPARATOR$add_shlibpath$PATH_SEPARATOR*) ;;
+	      *) func_append compile_shlibpath "$add_shlibpath$PATH_SEPARATOR" ;;
 	      esac
 	    fi
 	    if test prog = "$linkmode"; then
@@ -6472,9 +6472,9 @@ func_mode_link ()
 	      if test yes != "$hardcode_direct" &&
 		 test yes != "$hardcode_minus_L" &&
 		 test yes = "$hardcode_shlibpath_var"; then
-		case :$finalize_shlibpath: in
-		*":$libdir:"*) ;;
-		*) func_append finalize_shlibpath "$libdir:" ;;
+		case $PATH_SEPARATOR$finalize_shlibpath$PATH_SEPARATOR in
+		*$PATH_SEPARATOR$libdir$PATH_SEPARATOR*) ;;
+		*) func_append finalize_shlibpath "$libdir$PATH_SEPARATOR" ;;
 		esac
 	      fi
 	    fi
@@ -6492,9 +6492,9 @@ func_mode_link ()
 	      add_dir=-L$libdir
 	      add=-l$name
 	    elif test yes = "$hardcode_shlibpath_var"; then
-	      case :$finalize_shlibpath: in
-	      *":$libdir:"*) ;;
-	      *) func_append finalize_shlibpath "$libdir:" ;;
+	      case $PATH_SEPARATOR$finalize_shlibpath$PATH_SEPARATOR in
+	      *$PATH_SEPARATOR$libdir$PATH_SEPARATOR*) ;;
+	      *) func_append finalize_shlibpath "$libdir$PATH_SEPARATOR" ;;
 	      esac
 	      add=-l$name
 	    elif test yes = "$hardcode_automatic"; then
@@ -7721,7 +7721,7 @@ EOF
 	    # We should set the runpath_var.
 	    rpath=
 	    for dir in $perm_rpath; do
-	      func_append rpath "$dir:"
+	      func_append rpath "$dir$PATH_SEPARATOR"
 	    done
 	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
 	  fi
@@ -8443,15 +8443,15 @@ EOF
 	case $host in
 	*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*)
 	  testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
-	  case :$dllsearchpath: in
-	  *":$libdir:"*) ;;
-	  ::) dllsearchpath=$libdir;;
-	  *) func_append dllsearchpath ":$libdir";;
+	  case $PATH_SEPARATOR$dllsearchpath$PATH_SEPARATOR in
+	  *$PATH_SEPARATOR$libdir$PATH_SEPARATOR*) ;;
+	  $PATH_SEPARATOR$PATH_SEPARATOR) dllsearchpath=$libdir;;
+	  *) func_append dllsearchpath "$PATH_SEPARATOR$libdir";;
 	  esac
-	  case :$dllsearchpath: in
-	  *":$testbindir:"*) ;;
-	  ::) dllsearchpath=$testbindir;;
-	  *) func_append dllsearchpath ":$testbindir";;
+	  case $PATH_SEPARATOR$dllsearchpath$PATH_SEPARATOR in
+	  *$PATH_SEPARATOR$testbindir$PATH_SEPARATOR*) ;;
+	  $PATH_SEPARATOR$PATH_SEPARATOR) dllsearchpath=$testbindir;;
+	  *) func_append dllsearchpath "$PATH_SEPARATOR$testbindir";;
 	  esac
 	  ;;
 	esac
@@ -8565,7 +8565,7 @@ EOF
 	  # We should set the runpath_var.
 	  rpath=
 	  for dir in $perm_rpath; do
-	    func_append rpath "$dir:"
+	    func_append rpath "$dir$PATH_SEPARATOR"
 	  done
 	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
 	fi
@@ -8573,7 +8573,7 @@ EOF
 	  # We should set the runpath_var.
 	  rpath=
 	  for dir in $finalize_perm_rpath; do
-	    func_append rpath "$dir:"
+	    func_append rpath "$dir$PATH_SEPARATOR"
 	  done
 	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
 	fi
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 695ccac4..c3fc64e2 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -2275,18 +2275,18 @@ func_munge_path_list ()
     case x@S|@2 in
     x)
         ;;
-    *:)
-        eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\"
+    *$PATH_SEPARATOR)
+        eval @S|@1=\"`$ECHO @S|@2 | $SED s/$PATH_SEPARATOR/\ /g` \@S|@@S|@1\"
         ;;
-    x:*)
-        eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\"
+    x$PATH_SEPARATOR*)
+        eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED s/$PATH_SEPARATOR/\ /g`\"
         ;;
-    *::*)
-        eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
-        eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\"
+    *$PATH_SEPARATOR$PATH_SEPARATOR*)
+        eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e s/.*$PATH_SEPARATOR$PATH_SEPARATOR// -e s/$PATH_SEPARATOR/\ /g`\"
+        eval @S|@1=\"`$ECHO @S|@2 | $SED -e s/$PATH_SEPARATOR$PATH_SEPARATOR.*// -e s/$PATH_SEPARATOR/\ /g`\ \@S|@@S|@1\"
         ;;
     *)
-        eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\"
+        eval @S|@1=\"`$ECHO @S|@2 | $SED s/$PATH_SEPARATOR/\ /g`\"
         ;;
     esac
 }
-- 
2.42.0

From 59498d6c77255404205aa107d4a907f5068db4d0 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <komh@chollian.net>
Date: Thu, 12 Oct 2023 15:11:18 +0900
Subject: [PATCH v3 2/2] libtool: Limit a length of DLL name to 8.3 correctly

If a length of $release and/or $versionsuffix is more than 8 bytes,
a length of DLL name may be more than 8.

Then, this corrupts a generated DLL on OS/2.

* m4/libtool.m4 (soname_spec) [os2*]: Limit a length of DLL name to 8.3
correctly.
---
 m4/libtool.m4 | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/m4/libtool.m4 b/m4/libtool.m4
index c3fc64e2..8c3e15c3 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -2966,9 +2966,14 @@ os2*)
   need_lib_prefix=no
   # OS/2 can only load a DLL with a base name of 8 characters or less.
   soname_spec='`test -n "$os2dllname" && libname="$os2dllname";
-    v=$($ECHO $release$versuffix | tr -d .-);
-    n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _);
-    $ECHO $n$v`$shared_ext'
+    n=$($ECHO $libname | tr -d .-);
+    l=${#n}; test 3 -lt "$l" && l=3; mr=$((8 - $l));
+    r=$($ECHO $release | tr -d .-);
+    l=${#r}; test 2 -lt "$l" && l=2; mv=$(($mr - $l));
+    v=$($ECHO $versuffix | tr -d .- | cut -b -$mv);
+    r=$($ECHO $r | cut -b -$(($mr - ${#v})));
+    n=$($ECHO $n | cut -b -$((8 - ${#r} - ${#v})));
+    $ECHO $n$r$v`$shared_ext'
   library_names_spec='${libname}_dll.$libext'
   dynamic_linker='OS/2 ld.exe'
   shlibpath_var=BEGINLIBPATH
-- 
2.42.0

Reply via email to