Hi/2.
I've enhanced and fixed libtool 2.4 for OS/2.
Review, please.
Fixed parts.
1. if PATH_SEPARATOR is ';', then make fails.
2. Consider ';' as a path separator as well as ':' when finding an
absolute path.
3. Workaround for a pdksh v5.2.14-bin-2 for OS/2.
4. If .la is a dependency, it is not processed.
5. OS/2 uses a different method from Windows to load a DLL.
Enhanced parts.
1. Do not relink when installing a DLL.
2. Added -shortname option to specify a short name for a DLL.
3. Create import libraries instead of links.
4. Pass OS/2-specific compiler options such as -Zxxx.
5. Set lt_cv_sys_max_cmd_len to -1.
6. Limit a length of a basename of DLL up to 8 characters.
7. Set lt_cv_deplibs_check_method to pass_all.
8. Set with_gnu_ld to yes.
9. Set lt_prog_compiler_static to -Bstatic.
--
KO Myung-Hun
Using Mozilla SeaMonkey 2.0.9
Under OS/2 Warp 4 for Korean with FixPak #15
On AMD ThunderBird 1GHz with 512 MB RAM
Korean OS/2 User Community : http://www.ecomstation.co.kr
diff -uNr Makefile.am.org Makefile.am
--- Makefile.am.org 2010-09-21 16:07:22.000000000 +0900
+++ Makefile.am 2010-11-27 00:19:56.000000000 +0900
@@ -324,7 +324,7 @@
dist_man1_MANS = $(srcdir)/doc/libtool.1 $(srcdir)/doc/libtoolize.1
MAINTAINERCLEANFILES += $(dist_man1_MANS)
update_mans = \
- PATH=.$(PATH_SEPARATOR)$$PATH; export PATH; \
+ PATH=".$(PATH_SEPARATOR)$$PATH"; export PATH; \
$(HELP2MAN) --output=$@
$(srcdir)/doc/libtool.1: $(srcdir)/$(auxdir)/ltmain.sh
$(update_mans) --help-option=--help-all libtool
diff -uNr libltdl/config/general.m4sh.org libltdl/config/general.m4sh
--- libltdl/config/general.m4sh.org 2010-09-01 15:02:44.000000000 +0900
+++ libltdl/config/general.m4sh 2010-11-27 12:15:52.000000000 +0900
@@ -296,10 +296,13 @@
;;
*)
save_IFS="$IFS"
- IFS=:
- for progdir in $PATH; do
- IFS="$save_IFS"
- test -x "$progdir/$progname" && break
+ for pathsep in : ";"; do
+ IFS="$pathsep"
+ for progdir in $PATH$pathsep; do
+ IFS="$save_IFS"
+ test -x "$progdir/$progname" && break
+ done
+ test -n "$progdir" && break
done
IFS="$save_IFS"
test -n "$progdir" || progdir=`pwd`
@@ -564,6 +567,10 @@
my_cmd="$1"
my_fail_exp="${2-:}"
+ # pdksh 5.2.14-bin-2 for OS/2 does not remove trailing CR
+ # when a line length is 1022. Maybe 1022 is a magic number ?
+ my_cmd=`$ECHO "$my_cmd" | $SED s/\r$//`
+
${opt_silent-false} || {
func_quote_for_expand "$my_cmd"
eval "func_echo $func_quote_for_expand_result"
diff -uNr libltdl/config/ltmain.m4sh.org libltdl/config/ltmain.m4sh
--- libltdl/config/ltmain.m4sh.org 2010-09-22 23:45:18.000000000 +0900
+++ libltdl/config/ltmain.m4sh 2010-11-27 11:14:12.000000000 +0900
@@ -395,7 +395,7 @@
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=:
;;
@@ -1638,6 +1638,7 @@
-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 SUFFIX override the standard shared library file extension
-static do not do any dynamic linking of uninstalled libtool libraries
-static-libtool-libs
@@ -2221,8 +2222,17 @@
# 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
@@ -4628,6 +4638,11 @@
prev=
continue
;;
+ shortname)
+ shortname_cmds="$ECHO $arg | cut -b -8"
+ prev=
+ continue
+ ;;
shrext)
shrext_cmds="$arg"
prev=
@@ -4947,6 +4962,14 @@
continue
;;
+ -shortname)
+ # 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.
+ prev=shortname
+ continue
+ ;;
+
-shrext)
prev=shrext
continue
@@ -5060,6 +5083,17 @@
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"
@@ -5413,33 +5447,66 @@
# 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
@@ -5886,7 +5953,7 @@
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
@@ -6269,6 +6336,28 @@
fi
fi
;;
+ *-*-os2*)
+ depdepl=
+ deplibrary_names=
+ if test "$build_old_libs" != yes && test "$link_static" != yes ; then
+ eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+ fi
+ if test -z "$deplibrary_names" ; then
+ # fall back to static library
+ eval deplibrary_names=`${SED} -n -e 's/^old_library=\(.*\)$/\1/p' $deplib`
+ fi
+ if test -n "$deplibrary_names" ; then
+ for tmp in $deplibrary_names ; do
+ depdepl=$tmp
+ done
+ if test -f "$absdir/$objdir/$depdepl" ; then
+ depdepl="$absdir/$objdir/$depdepl"
+ compiler_flags="$compiler_flags $depdepl"
+ linker_flags="$linker_flags $depdepl"
+ fi
+ fi
+ path=
+ ;;
*)
path="-L$absdir/$objdir"
;;
@@ -7763,7 +7852,15 @@
# 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
diff -uNr libltdl/m4/libtool.m4.org libltdl/m4/libtool.m4
--- libltdl/m4/libtool.m4.org 2010-09-22 17:41:18.000000000 +0900
+++ libltdl/m4/libtool.m4 2010-11-27 16:03:50.000000000 +0900
@@ -1624,6 +1624,9 @@
lt_cv_sys_max_cmd_len=32768
fi
;;
+ os2*)
+ lt_cv_sys_max_cmd_len=-1
+ ;;
*)
lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
if test -n "$lt_cv_sys_max_cmd_len"; then
@@ -2163,6 +2166,7 @@
else
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
fi])
+shortname_cmds=
library_names_spec=
libname_spec='lib$name'
soname_spec=
@@ -2692,9 +2696,12 @@
libname_spec='$name'
shrext_cmds=".dll"
need_lib_prefix=no
- library_names_spec='$libname${shared_ext} $libname.a'
+ 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
+ shlibpath_var=BEGINLIBPATH
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
;;
osf3* | osf4* | osf5*)
@@ -2840,6 +2847,7 @@
_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]])
@@ -3302,6 +3310,9 @@
tpf*)
lt_cv_deplibs_check_method=pass_all
;;
+os2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
esac
])
@@ -3851,6 +3862,11 @@
# (--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
@@ -4169,6 +4185,11 @@
# (--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*)
@@ -4250,6 +4271,11 @@
# 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*)
@@ -4555,6 +4581,9 @@
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
@@ -4694,6 +4723,16 @@
_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_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY `eval $shortname_cmds` INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " MULTIPLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ ;;
+
interix[[3-9]]*)
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
@@ -5322,8 +5361,10 @@
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
- _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
- _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ shrext_cmds=".dll"
+ _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY `eval $shortname_cmds` INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " MULTIPLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
;;
osf3*)
@@ -6119,6 +6160,16 @@
_LT_DARWIN_LINKER_FEATURES($1)
;;
+ 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_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY `eval $shortname_cmds` INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " MULTIPLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ ;;
+
dgux*)
case $cc_basename in
ec++*)
diff -uNr libltdl/m4/ltdl.m4.org libltdl/m4/ltdl.m4
--- libltdl/m4/ltdl.m4.org 2010-09-16 19:58:22.000000000 +0900
+++ libltdl/m4/ltdl.m4 2010-11-26 22:58:54.000000000 +0900
@@ -696,7 +696,7 @@
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 <sys/cygwin.h>]])
LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la"
;;
_______________________________________________
http://lists.gnu.org/mailman/listinfo/libtool