Re: AC_FUNC_GETMNTENT look in libc before -lsun

From:

Mark D. Baushke

Subject:

Re: AC_FUNC_GETMNTENT look in libc before -lsun

Date:

Mon, 06 Dec 2004 16:31:24 -0800

Noah Misch <address@hidden> wrote:
> That `AC_CHECK_LIB' call runs the commands in the third argument iff
> linking an object referencing `getmntent' with -lsun succeeds;
> Autoconf expects the link to fail if -lsun does not exist or if
> getmntent remains undefined, but as Stepan supposed, linking with a
> nonexistent library is not an error on your system:
>
> configure:16535: checking for getmntent in -lsun
> configure:16565: cc -o conftest -g conftest.c -lsun -lsun >&5
> ldr-334 cc: CAUTION
> File 'libsun.a' cannot be found in any of the search directories.
> configure:16571: $? = 0
>
> That is bad; it makes `configure' scripts not behave as documented.
> Does your `cc' have an option to make linking to nonexistent libraries
> an error?
I have been unable to locate such an option.
It always just prints a warning about libraries like:
ldr-334 cc: CAUTION
File 'libsun.a' cannot be found in any of the search directories.
A google search for "cannot be found in any of the search directories."
turns up that this same baisc problem for zsh:
http://www.zsh.org/mla/workers/1996/msg01407.html
and here for gettext:
http://lists.gnu.org/archive/html/bug-gnu-utils/2001-09/msg00108.html
> > I belive that Paul Eggert's latest patch should do the trick, but I
> > don't think I will have access to the UNICOS machine again until this
> > weekend...
>
> `configure' will still add `-lsun' for `getpwnam'. You'll need a patch like
> this, too. Unlike Paul's patch, it's not a net improvement in its own right.
>
> --- lib/autoconf/specific.m4~ 2004-05-03 16:15:44.000000000 -0400
> +++ lib/autoconf/specific.m4 2004-12-06 17:34:56.189420050 -0500
> @@ -469,7 +469,7 @@ AU_DEFUN([AC_DYNIX_SEQ], [AC_FUNC_GETMNT
> # -----------
> AU_DEFUN([AC_IRIX_SUN],
> [AC_FUNC_GETMNTENT
> -AC_CHECK_LIB(sun, getpwnam)])
> +AC_SEARCH_LIBS(getpwnam, sun)])
>
>
> # AC_SCO_INTL
Okay, I am confused...
Given everything else I have seen, I would have expected a need for this
kind of a line:
AC_SEARCH_LIBS(getpwnam, -lsun, [AC_CHECK_FUNCS(getpwnam)])
I suspect there may need to be a separate test to see if the entry
points are in the default libraries before looking to add new libraries
to the LIBS list. That would seem to be the general fix for supporting a
system such as UNICOS that does not seem to do what you want it to do.
However, it is not clear to me as to what changes are needed in autoconf
to deal with this situation in a complete manner.
-- Mark