libtool
[Top][All Lists]
Advanced

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

Re: shl_load/dld_link


From: libtool
Subject: Re: shl_load/dld_link
Date: Sun, 5 Aug 2001 23:25:23 -0500
User-agent: Mutt/1.2.5i

On Sun, Aug 05, 2001 at 02:05:57PM +0100, Gary V. Vaughan wrote:
> On Tuesday 31 July 2001 4:29 pm, address@hidden wrote:
> > On Mon, Jul 30, 2001 at 03:03:39PM -0700, Steve Ellcey wrote:
> > > I am not an autoconf expert so I may be missing something, but is this
> > > right?
> > >
> > > >From line 741 of the latest mainline libtool.m4
> > >
> > >   *)
> > >     AC_CHECK_FUNC(shl_load, lt_cv_dlopen="shl_load",
> > >       [AC_CHECK_LIB(dld, shl_load,
> > >         [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"],
> > >         [AC_CHECK_LIB(dl, dlopen,
> > >           [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
> > >           [AC_CHECK_FUNC(dlopen, lt_cv_dlopen="dlopen",
> > >             [AC_CHECK_LIB(svld, dlopen,
> > >              [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"])
> > >             ])
> > >           ])
> > >         ])
> > >       ])
> > >     ;;
> > >   esac
> > >
> > > Is it the case that if shl_load is found in libdld, then lt_cv_dlopen is
> > > set to "dld_link"?  That should be "shl_load", right?  Did someone make
> > > a cut-n-paste error here?
> >
> > I think you're correct. The 1.4 branch has the same error. I made the
> > change you suggested and HP-UX 10.20 and 11.00 pass all tests.
> 
> I'm not so sure.  Are there two flavours of shl_load (not necessarily on 
> HP-UX I guess), one in the standard libraries (lt_cv_dlopen="shl_load") and 
> one with the function in libdld (lt_cv_dlopen="shl_load"; 
> lt_cv_dlopen_libs="-dld")?

>From the shl_load(3X):
 DESCRIPTION
      These routines can be used to programmatically load and unload shared
      libraries, and to obtain information about the libraries (such as the
      addresses of symbols defined within them).  On PA32, the routines
      themselves are accessed by specifying the -ldld option on the command
      line with the cc or ld command (see cc(1) and ld(1)).  On PA64, the
      routines are accessed by specifying either -ldld or -ldl on the
      command line.

> My impression is that -dld is a typo for "-ldld" and the second "shl_load" 
> should be "dld_link", like this:
> 
>     AC_CHECK_FUNC(shl_load, lt_cv_dlopen="shl_load",
>       [AC_CHECK_LIB(dld, dld_link,
>         [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"],

It indeed looks like a typo but it doesn't seem any different than the
following construct on Solaris to determine if -lsocket is needed:
  AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))

So, I'd change it to:
  AC_CHECK_FUNC(shl_load, lt_cv_dlopen="shl_load",
    [AC_CHECK_LIB(dld, shl_load,
      [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],

I don't think anyone has reported a problem with dld_link on their OS
so I say drop it in favor of the above unless someone screams.

> If I'm correct, I think the dld_link test needs to be moved back to the end 
> of the list of checks, since it shouldn't override dlopen etc. (I think 
> reformatting into a lispy indented-true-expression; exdented-false-expression 
> is more readable too):
> 
>     AC_CHECK_FUNC([shl_load],
>           [lt_cv_dlopen="shl_load"],
>       [AC_CHECK_LIB([dl], [dlopen],
>               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
>         [AC_CHECK_FUNC([dlopen],
>                 [lt_cv_dlopen="dlopen"],
>           [AC_CHECK_LIB([svld], [dlopen],
>                   [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
>             [AC_CHECK_LIB([dld], [dld_link],
>                     [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
>             ])
>           ])
>         ])
>       ])
> 
> What do you think?

AC_CHECK_FUNC([shl_load],
    [lt_cv_dlopen="shl_load"],
  [AC_CHECK_LIB([dld], [shl_load],
      [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
    [AC_CHECK_FUNC([dlopen],
        [lt_cv_dlopen="dlopen"],
      [AC_CHECK_LIB([dl], [dlopen],
          [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
        [AC_CHECK_LIB([svld], [dlopen],
            [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"])
        ])
      ])
    ])
  ])

This does two things differently:
  1. Does not check for dld_link for the reasons stated above.
  2. Preceeds the check for dlopen in -ldl with AC_CHECK_FUNC
     because -ldl might already be in $LIBS (same reason why
     we AC_CHECK_FUNC for shl_load first).

-- 
albert chin (address@hidden)



reply via email to

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