Re: help setting LDFLAGS and CFLAGS within AC_ARG_ENABLE

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

 



Hello Patrick,
  I haven't read your code snippet thouroughly either, but I have a few
comments, too:

> > AC_ARG_ENABLE(
> >   [certification],
> >   AC_HELP_STRING(
> >     [--enable-certification],
> >     [Include code for interfacing to an information currency server. 
> >     (default)]), ,
> >   [enable_certification=yes])

If the feature is enabled by default, then help should mention the
--disable variant, which switches it off.

The whole AC_HELP_STRING(...) should be quoted.  Otherwise m4 expands it
while it collects parameters for AC_ARG_ENABLE, before it expands
AC_ARG_ENABLE.  Similarly, the second parameter to AC_CHECK_HEADERS
must be quoted.

Please note that the second parameter of AC_CHECK_HEADERS is called as
soon as one of the headers is called.  This is probably not what you
meant.

And if the user says explicitely --enable-certification, and the feature
cannot be enabled, configure should report an error and give up.

So the code should look like this:

AC_ARG_ENABLE(
   [certification],
   [AC_HELP_STRING(
     [--disble-certification],
     [Do not innclude code for interfacing to an information currency server.])])

if test no != "$enable_certification"; then
  certification=yes
  AC_CHECK_HEADERS(
    [openssl/evp.h libxml/tree.h libcsoap/soap-client.h xmlsec/xmlsec.h],
    [],
    [certification=no])
  AC_CHECK_LIB(ssl,xyz,[LIBS="-lssl $LIBS"], [certification=no])
  AC_CHECK_LIB(xml2,xmlfoo,[LIBS="-lxml2 $LIBS"], [certification=no])
  AC_CHECK_LIB(xmlsec1,xmlSecCryptoInit,[LIBS="-lxmlsec1 $LIBS"], [certification=no])
  AC_CHECK_LIB(csoap,sapon_init,[LIBS="-lcsoap $LIBS"], [certification=no])
  CFLAGS="$CFLAGS -g `xmlsec1-config --cflags`" || certification=no
  LDFLAGS="$LDFLAGS -g `xmlsec1-config --libs`" || certification=no

  if test $certification = yes; then
    AC_DEFINE(
      [CERTIFICATION_SUPPORT], [1],
      [Define if you want CVS to be able to create information currency from
      submitted code.])
  else if test "$enable_certification" != ""; then
    AC_MSG_ERROR([Prerequisities for interfacing to an information currency server
	are not available.])
  fi
fi
  
On Fri, Aug 19, 2005 at 10:02:37AM +0200, Ralf Wildenhues wrote:
> but I think Autoconf sanitizes the $enable_* variables so that it is not
> necessary to do so (`-' is changed to `_').

No, this is not true.  

If the user, calls ./configure --enable-certification=-n, then variable
enable_certification="-n".

The documentation say that there are platforms which would be confused by
	test "-n" != no
so Autoconf traditionally uses
	test x"$enable_certification" != xno

I'm not sure whether
	test no != -n
can couse problems on some platforms...

> I see that several examples in the Autoconf manual do this differently.
> Below is a proposed patch to fix this.

Yes, Ralph, the patch looks good.

Stepan


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux