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

Re: Looking for a autotools/libtool expert: Unnecessarily linked libraries



Andreas Metzler <ametzler@downhill.at.eu.org> writes:

> It seems to stumble over this in web2c/withenable.ac
> ------------
> AC_ARG_ENABLE(ipc,
> [  --enable-ipc            enable TeX's --ipc option, i.e., pipe to a program],
> if test "x$enableval" = xyes; then
>   AC_DEFINE(IPC)
>   # -lsocket is needed on Solaris, at least.  Maybe -lnsl on SCO, too?
>   # See ac_path_xtra.
>   AC_CHECK_FUNC(connect)
>   if test x$ac_cv_func_connect = xno; then
>     AC_CHECK_LIB(socket, connect, socketlibs="-lsocket $socketlibs")
>   fi
> fi
> )
> AC_SUBST(socketlibs)
> ------------
> Perhaps somebody with strong autofoo can see the bug.

At the very least there is insufficient quoting.  The third
argument to AC_ARG_ENABLE should be quoted.

Here is part of what the (non-free) Autoconf manual says about
quoting:

----------------------------------------------------------------------
   When calling macros that take arguments, there must not be any blank
space between the macro name and the open parenthesis.  Arguments should
be enclosed within the M4 quote characters `[' and `]', and be
separated by commas.  Any leading spaces in arguments are ignored,
unless they are quoted.  You may safely leave out the quotes when the
argument is simple text, but _always_ quote complex arguments such as
other macro calls.  This rule applies recursively for every macro call,
including macros called from other macros.

   For instance:

     AC_CHECK_HEADER([stdio.h],
                     [AC_DEFINE([HAVE_STDIO_H])],
                     [AC_MSG_ERROR([Sorry, can't do anything for you])])

is quoted properly.  You may safely simplify its quotation to:

     AC_CHECK_HEADER(stdio.h,
                     [AC_DEFINE(HAVE_STDIO_H)],
                     [AC_MSG_ERROR([Sorry, can't do anything for you])])

Notice that the argument of `AC_MSG_ERROR' is still quoted; otherwise,
its comma would have been interpreted as an argument separator.

   The following example is wrong and dangerous, as it is underquoted:

     AC_CHECK_HEADER(stdio.h,
                     AC_DEFINE(HAVE_STDIO_H),
                     AC_MSG_ERROR([Sorry, can't do anything for you]))
----------------------------------------------------------------------
-- 
Ben Pfaff 
email: blp@cs.stanford.edu
web: http://benpfaff.org



Reply to: