libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Detect the default libpath on aix (to fix MPI support!)


From: Erik Lindahl
Subject: [PATCH] Detect the default libpath on aix (to fix MPI support!)
Date: Mon, 23 Jul 2001 14:24:54 +0200

Hi,

As I wrote on the normal libtool list, the wrapper scripts used to invoke
the xlc compiler with MPI adds a couple of directories to the default
hardcoded library path. The current version of libtool assumes it is
always /usr/lib:/lib, which results in a fatal error when you try to
execute the program.
     
With the attached patch, we instead try to link a small program and
determine the default hardcoded path with the dump -H command. (NB: I
don't use the -X32_64 flag to check both 32 and 64 bit objects,
since this probably wasn't supported in early versions of AIX). Since it
is done in four different places I've implemented it as a short separate
macro.

Thanks to Tim Mooney who suggested the dump -H approach ;-)


Cheers,

Erik Lindahl







--- libtool.m4.vanilla  Sun Jul 22 22:25:58 2001
+++ libtool.m4  Mon Jul 23 14:00:47 2001
@@ -1997,10 +1997,26 @@
   ;;
 esac
 ])# AC_CHECK_LIBM
 
 
+# AC_CHECK_AIX_LIBPATH()
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according 
+# to the aix ld manual.
+AC_DEFUN([AC_CHECK_AIX_LIBPATH],
+[AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | ${AWK-awk} '/Import
File Strings/ { getline; getline; if ($[2] ~ /^\//) print $[2] }'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64
conftest$ac_exeext 2>/dev/null | ${AWK-awk} '/Import File Strings/ {
getline; getline; if ($[2] ~ /^\//) print $[2] }'`; fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])
+
+
 # AC_LIBLTDL_CONVENIENCE([DIRECTORY])
 # -----------------------------------
 # sets LIBLTDL to the link flags for the libltdl convenience library and 
 # INCLTDL to the include flags for the libltdl header and adds
 # --enable-ltdl-convenience to the configure arguments.  Note that
LIBLTDL
@@ -2407,19 +2423,24 @@
     _LT_AC_TAGVAR(always_export_symbols, $1)=yes
     if test "$aix_use_runtimelinking" = yes; then
       # Warning - without using the other runtime loading flags (-brtl),
       # -berok will link without error, but may produce a broken library.
       _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec,
$1)='${wl}-blibpath:$libdir:/usr/lib:/lib'
+      # Determine the default libpath from the value encoded in an empty
executable.
+      AC_CHECK_AIX_LIBPATH
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec,
$1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
       _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o
$output_objdir/$soname $libobjs $deplibs $compiler_flags `if test
"x${allow_undefined_flag}" != "x"; then echo
"${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag
\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
      else
       if test "$host_cpu" = ia64; then
         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R
$libdir:/usr/lib:/lib'
         _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
         _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$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
-        _LT_AC_TAGVAR(hardcode_libdir_flag_spec,
$1)='${wl}-blibpath:$libdir:/usr/lib:/lib'
+        # Determine the default libpath from the value encoded in an
empty executable.
+        AC_CHECK_AIX_LIBPATH
+        _LT_AC_TAGVAR(hardcode_libdir_flag_spec,
$1)='${wl}-blibpath:$libdir:'"$aix_libpath"
         # Warning - without using the other run time loading flags,
         # -berok will link without error, but may produce a broken
library.
         _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bnoerok'
         _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
         # -bexpall does not export symbols beginning with underscore (_)
@@ -4245,19 +4266,23 @@
     _LT_AC_TAGVAR(always_export_symbols, $1)=yes
     if test "$aix_use_runtimelinking" = yes; then
       # Warning - without using the other runtime loading flags (-brtl),
       # -berok will link without error, but may produce a broken library.
       _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec,
$1)='${wl}-blibpath:$libdir:/usr/lib:/lib'
+      # Determine the default libpath from the value encoded in an empty
executable.
+      AC_CHECK_AIX_LIBPATH
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec,
$1)='${wl}-blibpath:$libdir:'"$aix_libpath"
       _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o
$output_objdir/$soname $libobjs $deplibs $compiler_flags `if test
"x${allow_undefined_flag}" != "x"; then echo
"${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag
\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
      else
       if test "$host_cpu" = ia64; then
         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R
$libdir:/usr/lib:/lib'
         _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
         _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$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
-        _LT_AC_TAGVAR(hardcode_libdir_flag_spec,
$1)='${wl}-blibpath:$libdir:/usr/lib:/lib'
+        # Determine the default libpath from the value encoded in an
empty executable.
+        AC_CHECK_AIX_LIBPATH
+        _LT_AC_TAGVAR(hardcode_libdir_flag_spec,
$1)='${wl}-blibpath:$libdir:'"$aix_libpath"
         # Warning - without using the other run time loading flags,
         # -berok will link without error, but may produce a broken
library.
         _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bnoerok'
         _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
         # -bexpall does not export symbols beginning with underscore (_)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]