Bug 1296455 - AC_CHECK_LIB() modifies LIBS if if-found action is []
Summary: AC_CHECK_LIB() modifies LIBS if if-found action is []
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: autoconf
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Pavel Raiskup
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-07 10:02 UTC by Petr Pisar
Modified: 2016-01-09 18:54 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-01-09 18:54:00 UTC
Type: Bug


Attachments (Terms of Use)

Description Petr Pisar 2016-01-07 10:02:35 UTC
When upgrading quota to 4.03, I discovered all executables are linked to a library whose presence is checked by:

    AC_CHECK_LIB([ldap], [ldap_initialize], [], [
        build_ldap=no
        AS_IF([test "x$enable_ldapmail" = "xyes"], [
            AC_MSG_ERROR([LDAP support required but library not found.]);
        ])
    ])

Because third argument (if-found action) is defined to empty literal, it should not fall back to default implementation (adding -lldap to LIBS etc.). Documentation reads:

     [..] If ACTION-IF-FOUND is not
     specified, the default action prepends `-lLIBRARY' to `LIBS' and
     defines `HAVE_LIBLIBRARY' (in all capitals).

But autoconf-2.69-21.fc23.noarch seems breaking this rule and modifies LIBS.

I had to work around the bug with this change in quota's configure.ac:

-    AC_CHECK_LIB([ldap], [ldap_initialize], [], [
+    AC_CHECK_LIB([ldap], [ldap_initialize], [:;], [

I believe this is a bug in Autoconf.

Comment 1 Pavel Raiskup 2016-01-07 10:27:46 UTC
If I understand this right, you think that '[]' makes it a explicitly defined
value, but it does not.  M4 compares against empty string and thus
having 'macro(a,,c)' is equivalent to 'macro(a,[],c)'.

Comment 2 Pavel Raiskup 2016-01-07 10:36:32 UTC
You can avoid changing the LIBS variable by:

  old_LIBS=$LIBS
  AC_CHECK_LIB([ldap], [ldap_initialize], , [
  ...
  LIBS=$old_LIBS

.. or more likely, properly specify the ACTION-IF-FOUND.  Having 'true' there
does not look much like work-around to me.  But for really qualified answer
this should be discussed upstream.

Comment 3 Petr Pisar 2016-01-07 11:22:40 UTC
Thank you for the explanation. I will alert quota upstream to rework the configure.ac.


Note You need to log in before you can comment on or make changes to this bug.