[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Patch for AIX support in MLB
From: |
Robert Boehne |
Subject: |
Patch for AIX support in MLB |
Date: |
Thu, 11 Jan 2001 17:57:00 -0600 |
Attached is the patch resulting from the collaboration of David
Edelsohn,
Dan McNichol and myslef to extend support to AIX 4 and 5 (including
IA64)
for the multi-language-branch of libtool.
2001-01-11 Robert Boehne <address@hidden>
* ltcf-c.sh: (AIX) Incorporated changes to the HEAD branch
by Dan McNichol <address@hidden> and changes to MLB
branch by David Edelsohn <address@hidden> to build
standard shared libraries on AIX POWER more like AIX does,
with a shared object archived into lib<xxx>.a.
Add support for AIX 5 and AIX on IA64. Note: AIX on IA64
uses a SYSV type linker.
* ltcf-cxx.sh: ditto
* ltconfig.in: ditto
* libtool.m4: Add support for AIX 5.
--
Robert Boehne Software Engineer
Ricardo Software Chicago Technical Center
TEL: (630)789-0003 x. 238
FAX: (630)789-0127
email: address@hidden
Index: libtool.m4
===================================================================
RCS file: /home/cvs/libtool/libtool.m4,v
retrieving revision 1.71.2.43
diff -u -r1.71.2.43 libtool.m4
--- libtool.m4 2000/12/16 13:43:52 1.71.2.43
+++ libtool.m4 2001/01/11 23:51:35
@@ -516,7 +516,7 @@
# whether `pass_all' will *always* work, you probably want this one.
case "$host_os" in
-aix4*)
+aix4* | aix5*)
lt_cv_deplibs_check_method=pass_all
;;
Index: ltcf-c.sh
===================================================================
RCS file: /home/cvs/libtool/Attic/ltcf-c.sh,v
retrieving revision 1.1.2.24
diff -u -r1.1.2.24 ltcf-c.sh
--- ltcf-c.sh 2000/12/22 23:49:02 1.1.2.24
+++ ltcf-c.sh 2001/01/11 23:51:35
@@ -57,7 +57,7 @@
# See if GNU ld supports shared libraries.
case "$host_os" in
- aix3* | aix4*)
+ aix3* | aix4* | aix5*)
# On AIX, the GNU linker is very broken
ld_shlibs=no
cat <<EOF 1>&2
@@ -263,9 +263,13 @@
fi
;;
- aix4*)
- hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b
${wl}libpath:$libdir:/usr/lib:/lib'
+ aix4* | aix5*)
hardcode_libdir_separator=':'
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
if test "$with_gcc" = yes; then
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" && \
@@ -285,18 +289,59 @@
fi
shared_flag='-shared'
else
- shared_flag='${wl}-bM:SRE'
+ if test "$host_cpu" = ia64; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
hardcode_direct=yes
fi
- allow_undefined_flag=' ${wl}-berok'
- archive_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs
$deplibs $compiler_flags ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}'
- archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname
$libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols
${wl}-bnoentry${allow_undefined_flag}'
- case "$host_os" in aix4.[01]|aix4.[01].*)
- # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on
- always_export_symbols=yes ;;
- esac
- ;;
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # Test if we are trying to use run time linking, or normal AIX style
linking.
+ # If -brtl is somewhere in LDFLAGS, we need to do run time linking.
+ aix_use_runtimelinking=no
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+ # -bexpall does not export symbols beginning with underscore (_)
+ always_export_symbols=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other run time loading flags (-brtl),
-berok will
+ # link without error, but may produce a broken library.
+ allow_undefined_flag=' ${wl}-berok'
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname
$libobjs $deplibs $compiler_flags ${allow_undefined_flag}
'"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname
$libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag}
'"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # -bexpall does not export symbols beginning with underscore (_)
+ always_export_symbols=yes
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec=' '
+ build_libtool_need_lc=yes
+ hardcode_libdir_flag_spec='${wl}-bnolibpath
${wl}-blibpath:$libdir:/usr/lib:/lib'
+ # This is similar to how AIX traditionally builds it's shared
libraries.
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname
$libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols
${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS
$output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
amigaos*)
archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME
$libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >>
$output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >>
$output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >>
$output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd
$output_objdir && a2ixlibrary -32)'
hardcode_libdir_flag_spec='-L$libdir'
@@ -558,13 +603,13 @@
# PIC is the default for these OSes.
;;
aix*)
- # Below there is a dirty hack to force normal static linking with -ldl
- # The problem is because libdl dynamically linked with both libc and
- # libC (AIX C++ library), which obviously doesn't included in libraries
- # list by gcc. This cause undefined symbols with -static flags.
- # This hack allows C programs to be linked with "-static -ldl", but
- # we not sure about C++ programs.
- ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_cv_prog_cc_static='-Bstatic'
+ else
+ lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
+ fi
;;
cygwin* | mingw* | os2*)
# This hack is so that the source file can tell whether it is being
@@ -589,9 +634,9 @@
else
# PORTME Check for PIC flags for the system compiler.
case "$host_os" in
- aix3* | aix4*)
+ aix*)
# All AIX code is PIC.
- ac_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
+ ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
;;
hpux9* | hpux10* | hpux11*)
Index: ltcf-cxx.sh
===================================================================
RCS file: /home/cvs/libtool/Attic/ltcf-cxx.sh,v
retrieving revision 1.1.2.26
diff -u -r1.1.2.26 ltcf-cxx.sh
--- ltcf-cxx.sh 2000/12/22 23:49:02 1.1.2.26
+++ ltcf-cxx.sh 2001/01/11 23:51:35
@@ -116,7 +116,7 @@
# In general, the C++ compiler should always link C++ objects.
case $target in
-*aix3* | *aix4*)
+*aix3* | *aix4* | *aix5*)
# AIX just has to be different, doesn't it? :-\
LD=makeC++SharedLib_r
LDFLAGS="$LDFLAGS -p 0"
@@ -134,9 +134,86 @@
# FIXME: insert proper C++ library support
ld_shlibs=no
;;
- aix4*)
- # FIXME: insert proper C++ library support
- ld_shlibs=no
+ aix4* | aix5*)
+ archive_cmds=''
+ hardcode_libdir_separator=':'
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+ if test "$with_gcc" = yes; then
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ hardcode_direct=yes
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ shared_flag='-shared'
+ else
+ if test "$host_cpu" = ia64; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ hardcode_direct=yes
+ fi
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # Test if we are trying to use run time linking, or normal AIX style
linking.
+ # If -brtl is somewhere in LDFLAGS, we need to do run time linking.
+ aix_use_runtimelinking=no
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
+ allow_undefined_flag=' -Wl,-G'
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname
$libobjs $deplibs $compiler_flags ${allow_undefined_flag}
'"\${wl}$no_entry_flag \${wl}-brtl \${wl}$exp_sym_flag:\$export_symbols"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname
$libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag}
'"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+ else
+ hardcode_libdir_flag_spec='${wl}-bnolibpath
${wl}-blibpath:$libdir:/usr/lib:/lib'
+ # Warning - without using the other run time loading flags, -berok will
+ # link without error, but may produce a broken library.
+ allow_undefined_flag='${wl}-berok"
+ # This is similar to how AIX traditionally builds it's shared
libraries.
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname
$libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols
${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS
$output_objdir/$libname$release.a $output_objdir/$soname'
+ # -bexpall does not export symbols beginning with underscore (_)
+ always_export_symbols=yes
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec=' '
+ build_libtool_need_lc=yes
+ fi
+ no_undefined_flag='${wl}-bnoerok'
+ fi
;;
chorus*)
case "$cc_basename" in
@@ -579,13 +656,13 @@
# PIC is the default for these OSes.
;;
aix*)
- # Below there is a dirty hack to force normal static linking with -ldl
- # The problem is because libdl dynamically linked with both libc and
- # libC (AIX C++ library), which obviously doesn't included in libraries
- # list by gcc. This cause undefined symbols with -static flags.
- # This hack allows C programs to be linked with "-static -ldl", but
- # we not sure about C++ programs.
- ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_cv_prog_cc_static='-Bstatic'
+ else
+ lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
+ fi
;;
cygwin* | mingw* | os2*)
# This hack is so that the source file can tell whether it is being
@@ -609,8 +686,14 @@
esac
else
case "$host_os" in
- aix4*)
+ aix4* | aix5*)
# All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_cv_prog_cc_static='-Bstatic'
+ else
+ lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
+ fi
;;
chorus*)
case "$cc_basename" in
Index: ltconfig.in
===================================================================
RCS file: /home/cvs/libtool/Attic/ltconfig.in,v
retrieving revision 1.246.2.40
diff -u -r1.246.2.40 ltconfig.in
--- ltconfig.in 2000/12/16 13:50:25 1.246.2.40
+++ ltconfig.in 2001/01/11 23:51:35
@@ -938,19 +938,33 @@
library_names_spec='${libname}${release}.so$versuffix $libname.a'
shlibpath_var=LIBPATH
- # AIX has no versioning support, so we append a major version to the name.
+ # AIX 3 has no versioning support, so we append a major version to the name.
soname_spec='${libname}${release}.so$major'
;;
-aix4*)
+aix4* | aix5*)
version_type=linux
- # AIX has no versioning support, so currently we can not hardcode correct
- # soname into executable. Probably we can add versioning support to
- # collect2, so additional links can be useful in future.
- # We preserve .a as extension for shared libraries though AIX4.2
- # and later linker supports .so
- library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so$major $libname.a'
- shlibpath_var=LIBPATH
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so$major $libname.so'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # AIX (on Power*) has no versioning support, so currently we can not
hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
instead of
+ # lib<name>.a to let people know that these are not typical AIX shared
libraries.
+ library_names_spec='${libname}${release}.so$versuffix
${libname}${release}.so$major $libname.so'
+ else
+ # We preserve .a as extension for shared libraries though AIX4.2
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}.so$major.o'
+ export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if
(((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) {
print \$3 } }'\'' | sort -u > $export_symbols'
+ fi
+ shlibpath_var=LIBPATH
+ deplibs_check_method=pass_all
+ fi
;;
amigaos*)
@@ -1436,19 +1450,19 @@
# On AIX, shared libraries and static libraries use the same namespace, and
# are all built from PIC.
-case "$host_os" in
-aix3*)
- test "$enable_shared" = yes && enable_static=no
- if test -n "$RANLIB"; then
- archive_cmds="$archive_cmds~\$RANLIB \$lib"
- postinstall_cmds='$RANLIB $lib'
- fi
- ;;
-
-aix4*)
- test "$enable_shared" = yes && enable_static=no
- ;;
-esac
+#case "$host_os" in
+#aix3*)
+# test "$enable_shared" = yes && enable_static=no
+# if test -n "$RANLIB"; then
+# archive_cmds="$archive_cmds~\$RANLIB \$lib"
+# postinstall_cmds='$RANLIB $lib'
+# fi
+# ;;
+#
+#aix4*)
+# test "$enable_shared" = yes && enable_static=no
+# ;;
+#esac
echo "$ac_t$enable_shared" 1>&6
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Patch for AIX support in MLB,
Robert Boehne <=