bug-libtool
[Top][All Lists]
Advanced

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

libtool 2.2.2 does not work on OSF/1 4.0d


From: Bruno Haible
Subject: libtool 2.2.2 does not work on OSF/1 4.0d
Date: Sun, 6 Apr 2008 19:57:06 +0200
User-agent: KMail/1.5.4

Hi,

In a package that makes use of libtool 2.2.2, on OSF/1 4.0d, every invocation
of libtool fails like this:

  /bin/sh ../libtool --mode=compile cc -nodtk -O -std -I. -I. -I.. -I./.. 
-I../include   -DLIBDIR=\"/nfs/visu/telecom/users/haible/inst-osf1-shared/lib\" 
-DBUILDING_LIBCHARSET -DBUILDING_DLL  -DENABLE_RELOCATABLE=1 -DIN_LIBRARY 
-DINSTALLDIR=\"/nfs/visu/telecom/users/haible/inst-osf1-shared/lib\" 
-DNO_XMALLOC  -Dset_relocation_prefix=libcharset_set_relocation_prefix  
-Drelocate=libcharset_relocate -DHAVE_CONFIG_H -c ./localcharset.c
  ../libtool: bad substitution
  *** Exit 1

Tracing with -x showed that on this system, /bin/sh does not support
the parameter expansions with simultaneous pattern removal:
${var%pattern}, ${var%%pattern}, ${var#pattern}, ${var##pattern}, that are
specified in
  http://www.opengroup.org/susv3/utilities/xcu_chap02.html
section "Parameter Expansion". I had to rewrite several shell functions like
this:

func_opt_split ()
{
  func_opt_split_opt=`echo "$1" | sed -e 's,=.*,,'`
  func_opt_split_arg=`echo "$1" | sed -e "$sed_opt_remove_first"`  
func_opt_split_step3=a
}
sed_opt_remove_first='s,[^=]*=\(.*\),\1,'

func_dirname ()
{
  case ${1} in
    */*) func_dirname_result=`echo "$1" | sed -e 's,/[^/]*,,'`"${2}" ;;
    *  ) func_dirname_result="${3}" ;;
  esac
}

sed_basename_remove_first='s,.*/\(.*\),\1,'
func_basename ()
{
  func_basename_result=`echo "$1" | sed -e "$sed_basename_remove_first"`
}

func_dirname_and_basename ()
{
  case ${1} in
    */*) func_dirname_result=`echo "$1" | sed -e 's,/[^/]*,,'`"${2}" ;;
    *  ) func_dirname_result="${3}" ;;
  esac
  func_basename_result=`echo "$1" | sed -e "$sed_basename_remove_first"`
}

sed_remove_trailing_lo='s,\.lo$,,'
func_lo2o ()
{
  case ${1} in
    *.lo) func_lo2o_result=`echo "$1" | sed -e 
"$sed_remove_trailing_lo"`.${objext} ;;
    *)    func_lo2o_result=${1} ;;
  esac
}

After doing this, I found that libtool.m4 already has similar fallback code.
So what is the problem?

The problem is that the tests on which xsi_shell in libtool.m4 is based
are performed in a "better" shell than /bin/sh. On OSF/1 4.0d it is /bin/ksh.
And the line 1 of the generated libtool script reads: "#! /bin/ksh".
But then the LIBTOOL variable gets assigned the value
  $(SHELL) $(top_builddir)/libtool
And $(SHELL) always expands to /bin/sh.

Changing the value of the LIBTOOL variable to
  /bin/ksh $(top_builddir)/libtool
in the config.status file fixed the problem.

Recall that one cannot in general remove the $(SHELL) before scripts, because
on some Windows installations, execute bits cannot be set or have no effect.

Therefore I think the best solution is that libtool.m4 set LIBTOOL to a value
that starts with the "better" shell, rather than $(SHELL).

Bruno





reply via email to

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