[PATCH] Add -shortname option
Hi/2. This patch adds -shortname option for OS/2. -- KO Myung-Hun Using Mozilla SeaMonkey 2.0.11 Under OS/2 Warp 4 for Korean with FixPak #15 On Intel Core2Duo T5500 1.66 GHz with 2 GB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr From c620c5dd4af864f8d70bbf78eaf0cb4743ca5594 Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Fri, 14 Jan 2011 00:43:38 +0900 Subject: [PATCH 01/10] Add -shortname option. OS/2 limits a length of a DLL base name up to 8 characters. If a name of a shared library is longer than 8 characters, OS/2 cannot load it. So the option to specify a short name is needed. --- NEWS |1 + doc/libtool.texi |4 libltdl/config/ltmain.m4sh | 11 +++ libltdl/m4/libtool.m4 | 38 ++ 4 files changed, 50 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 39eb771..895b77f 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ New in 2.4.2 2011-??-??: git version 2.4.1a, Libtool team: - The --with-pic configure option now supports a list of comma-separated package names. This can be used to build some static libraries with PIC objects while building others with non-PIC objects. + - Added -shortname option to specify a short name for a DLL (OS/2 only) - Initial support for Go, using the gccgo compiler. diff --git a/doc/libtool.texi b/doc/libtool.texi index 727a03d..6fcd210 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -1583,6 +1583,10 @@ In the later case, libtool will signal an error if it was configured with @option{--disable-shared}, or if the host does not support shared libraries. +@item -shortname @var{name} +If @var{name} is specified, replace a name for a DLL with @var{suffix} (effect +on OS/2 only) + @item -shrext @var{suffix} If @var{output-file} is a libtool library, replace the system's standard file name extension for shared libraries with @var{suffix} (most systems diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 7baa6aa..73efab0 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -1638,6 +1638,7 @@ The following components of LINK-COMMAND are treated specially: -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries + -shortname NAME specify a short name for a DLL(effect on OS/2 only) -shrext SUFFIXoverride the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs @@ -4636,6 +4637,11 @@ func_mode_link () prev= continue ;; + shortname) + shortname_cmds="$ECHO $arg | cut -b -8" + prev= + continue + ;; shrext) shrext_cmds="$arg" prev= @@ -4955,6 +4961,11 @@ func_mode_link () continue ;; + -shortname) + prev=shortname + continue + ;; + -shrext) prev=shrext continue diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index fd79dcf..39dd006 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -2202,6 +2202,7 @@ BEGIN {RS=" "; FS="/|\n";} { else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) +shortname_cmds= library_names_spec= libname_spec='lib$name' soname_spec= @@ -2731,9 +2732,15 @@ os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' + # OS/2 limits a length of a DLL basename up to 8 characters. + # So there is need to use a short name instead of a original name + # longer than 8 characters. + shortname_cmds='$ECHO $libname | cut -b -8' + library_names_spec='`eval $shortname_cmds`${shared_ext} ${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; osf3* | osf4* | osf5*) @@ -2879,6 +2886,7 @@ _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) +_LT_DECL([], [shortname_cmds], [2], [Command to make a short name]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) @@ -4752,6 +4760,16 @@ _LT_EOF _LT_TAGVAR(link_all_deplibs, $1)=yes ;; +os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=".dll" + _LT
[PATCH] Don't eliminate duplications in $postdeps and $predeps on OS/2
Hi/2. Subject says all. -- KO Myung-Hun Using Mozilla SeaMonkey 2.0.11 Under OS/2 Warp 4 for Korean with FixPak #15 On Intel Core2Duo T5500 1.66 GHz with 2 GB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr From dafc620b7684e0847d40c0e97479a521a74f7eb6 Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Sat, 15 Jan 2011 17:50:36 +0900 Subject: [PATCH 02/10] Don't eliminate duplications in $postdeps and $predeps on OS/2 --- libltdl/config/ltmain.m4sh |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 73efab0..2aa0980 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -395,7 +395,7 @@ M4SH_GETOPTS( test "$opt_debug" = : || func_append preserve_args " --debug" case $host in -*cygwin* | *mingw* | *pw32* | *cegcc*) +*cygwin* | *mingw* | *pw32* | *cegcc* | *os2*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; -- 1.7.3.2
[PATCH] Set lt_prog_compiler_static to -Bstatic on OS/2
Hi/2. Subject says all. -- KO Myung-Hun Using Mozilla SeaMonkey 2.0.11 Under OS/2 Warp 4 for Korean with FixPak #15 On Intel Core2Duo T5500 1.66 GHz with 2 GB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr From ea574c972441d6c834924016cecdaa03a4a3c52a Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Sat, 15 Jan 2011 17:54:24 +0900 Subject: [PATCH 03/10] Set lt_prog_compiler_static to -Bstatic on OS/2 --- libltdl/m4/libtool.m4 | 15 +++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index 39dd006..3e5ca75 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -3899,6 +3899,11 @@ m4_if([$1], [CXX], [ # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) +_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' +;; + esac ;; darwin* | rhapsody*) # PIC is the default on this platform @@ -4217,6 +4222,11 @@ m4_if([$1], [CXX], [ # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) +_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' +;; + esac ;; darwin* | rhapsody*) @@ -4300,6 +4310,11 @@ m4_if([$1], [CXX], [ # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) +_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' +;; + esac ;; hpux9* | hpux10* | hpux11*) -- 1.7.3.2
[PATCH] OS/2 uses other APIs than on Win32
Hi/2. OS/2 uses other APIs to load a DLL than LoadLibrary() on Win32. -- KO Myung-Hun Using Mozilla SeaMonkey 2.0.11 Under OS/2 Warp 4 for Korean with FixPak #15 On Intel Core2Duo T5500 1.66 GHz with 2 GB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr From 24f31852bc439ba78a1d4b127ce0d002eb919fe2 Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Sat, 15 Jan 2011 17:59:03 +0900 Subject: [PATCH 04/10] OS/2 uses other APIs to load a DLL than LoadLibrary() on Windows. --- libltdl/m4/ltdl.m4 |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libltdl/m4/ltdl.m4 b/libltdl/m4/ltdl.m4 index 42e07e9..8ed1f22 100644 --- a/libltdl/m4/ltdl.m4 +++ b/libltdl/m4/ltdl.m4 @@ -696,7 +696,7 @@ darwin[[1567]].*) beos*) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la" ;; -cygwin* | mingw* | os2* | pw32*) +cygwin* | mingw* | pw32*) AC_CHECK_DECLS([cygwin_conv_path], [], [], [[#include ]]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la" ;; -- 1.7.3.2
[PATCH] OS/2 uses ld compatible GNU ld
Hi/2. I think, it's fine to set with_gnu_ld to yes on OS/2 because OS/2 ld was modified from GNU ld. -- KO Myung-Hun Using Mozilla SeaMonkey 2.0.11 Under OS/2 Warp 4 for Korean with FixPak #15 On Intel Core2Duo T5500 1.66 GHz with 2 GB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr From 5fc395618b414295b0af97fab75e7772f16561ad Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Sat, 15 Jan 2011 18:05:13 +0900 Subject: [PATCH 05/10] OS/2 uses ld inherited from GNU ld --- libltdl/m4/libtool.m4 |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index 3e5ca75..dd3febf 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -4636,6 +4636,9 @@ dnl Note also adjust exclude_expsyms for C++ above. with_gnu_ld=no fi ;; + os2*) +with_gnu_ld=yes +;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes -- 1.7.3.2
[PATCH] Do not relink on OS/2
Hi/2. There is no need to relink DLLs on OS/2. -- KO Myung-Hun Using Mozilla SeaMonkey 2.0.11 Under OS/2 Warp 4 for Korean with FixPak #15 On Intel Core2Duo T5500 1.66 GHz with 2 GB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr From 772507b0125f5901a098500b5fef0e689ecbdce3 Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Sat, 15 Jan 2011 18:06:09 +0900 Subject: [PATCH 06/10] There is no need to relink DLLs on OS/2 --- libltdl/config/ltmain.m4sh |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 2aa0980..23b80ba 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -5905,7 +5905,7 @@ func_mode_link () if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in - *cygwin* | *mingw* | *cegcc*) + *cygwin* | *mingw* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no -- 1.7.3.2
[PATCH] Set lt_cv_deplibs_check_method to pass_all on OS/2
Hi/2. Subject says all. -- KO Myung-Hun Using Mozilla SeaMonkey 2.0.11 Under OS/2 Warp 4 for Korean with FixPak #15 On Intel Core2Duo T5500 1.66 GHz with 2 GB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr From 72d7751940160035ebf6457468efb349258a2274 Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Sat, 15 Jan 2011 18:08:14 +0900 Subject: [PATCH 07/10] Set lt_cv_deplibs_check_method to pass_all on OS/2 --- libltdl/m4/libtool.m4 |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index dd3febf..d824d63 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -3349,6 +3349,9 @@ sysv4 | sysv4.3*) tpf*) lt_cv_deplibs_check_method=pass_all ;; +os2*) + lt_cv_deplibs_check_method=pass_all + ;; esac ]) -- 1.7.3.2
[PATCH] Support -Zxxx options used on OS/2
Hi/2. -Zxxx is used to specify OS/2-specific options on OS/2. -- KO Myung-Hun Using Mozilla SeaMonkey 2.0.11 Under OS/2 Warp 4 for Korean with FixPak #15 On Intel Core2Duo T5500 1.66 GHz with 2 GB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr From 970f4a602404a37a2c89a9befe387ea5758d66be Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Sat, 15 Jan 2011 18:08:45 +0900 Subject: [PATCH 08/10] Support -Zxxx options used on OS/2 --- libltdl/config/ltmain.m4sh | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 23b80ba..f119c1a 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -5079,6 +5079,17 @@ func_mode_link () continue ;; + # OS/2 uses -Zxxx to specify OS/2-specific options + -Z*) + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case $arg in + -Zlinker | -Zstack) prev=xcompiler;; + esac + continue + ;; + # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" -- 1.7.3.2
[PATCH] Create import libraries instead of links to the real library on OS/2
Hi/2. OS/2 does not support links, so it's better to create import libraries instead. -- KO Myung-Hun Using Mozilla SeaMonkey 2.0.11 Under OS/2 Warp 4 for Korean with FixPak #15 On Intel Core2Duo T5500 1.66 GHz with 2 GB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr From 3f89343398f821c9e9a75e74510f6c007334c447 Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Sat, 15 Jan 2011 18:10:09 +0900 Subject: [PATCH 09/10] Create import libraries instead of links to the real library on OS/2 --- libltdl/config/ltmain.m4sh | 23 --- 1 files changed, 20 insertions(+), 3 deletions(-) diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index f119c1a..bd139fa 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -,8 +,17 @@ func_mode_install () # so we also need to try rm && ln -s. for linkname do - test "$linkname" != "$realname" \ - && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + if test "$linkname" != "$realname"; then + case $host_os in + os2*) + # Create import libraries instead of links on OS/2 + func_show_eval "(emximp -o $destdir/$linkname $dir/${linkname%%_dll.$libext}.def)" + ;; + *) + func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + ;; + esac + fi done fi @@ -7794,7 +7803,15 @@ EOF # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then - func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + case $host_os in + os2*) + # Create import libraries instead of links on OS/2 + func_show_eval '(emximp -o $output_objdir/$linkname $output_objdir/$libname.def)' 'exit $?' + ;; + *) + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + ;; + esac fi done -- 1.7.3.2
[PATCH] .la dependency fails on OS/2
Hi/2. If .la is listed as dependency_libs, libtool does not find a proper library from it on OS/2. -- KO Myung-Hun Using Mozilla SeaMonkey 2.0.11 Under OS/2 Warp 4 for Korean with FixPak #15 On Intel Core2Duo T5500 1.66 GHz with 2 GB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr From c8359d25c142858a144415a02a434b1ba9d0f6fa Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Sat, 15 Jan 2011 18:11:16 +0900 Subject: [PATCH 10/10] Fix a problem that it fails to find proper libraries if .la is a dependency on OS/2 --- libltdl/config/ltmain.m4sh | 103 +-- 1 files changed, 79 insertions(+), 24 deletions(-) diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index bd139fa..ce48cda 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -5452,33 +5452,66 @@ func_mode_link () # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if func_lalib_p "$lib"; then - library_names= - old_library= - func_source "$lib" - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + case $host_os in + os2*) + case " $predeps $postdeps " in + *" $deplib "*) ;; + *) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue fi - continue fi - fi + ;; + esac ;; - *) ;; - esac + *) + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + ;; + esac # case $host_os in fi fi ;; # -l @@ -6308,6 +6341,28 @@ func_mode_link () fi fi ;; + *-*-os2*) + depdepl= + deplibrary_names= + if test "$build_old_libs" != yes && test "$link_static" != yes ; then + eval deplibrar