Discussion:
[Freeipa-devel] [freeipa PR#718][opened] configure: fix AC_CHECK_LIB usage
HonzaCholasta
2017-04-18 12:19:09 UTC
Permalink
URL: https://github.com/freeipa/freeipa/pull/718
Author: HonzaCholasta
Title: #718: configure: fix AC_CHECK_LIB usage
Action: opened

PR body:
"""
Replace empty string with a single space in the third argument of
`AC_CHECK_LIB` (`action-if-found`) where applicable.

Empty string in the argument causes `AC_CHECK_LIB` to use the default
action when a library is found which includes adding the library to `LIBS`,
which specifies libraries to be linked in every binary and library in the
project.

This fixes libkrad, liblber, libldap_r and libsss_nss_idmap being linked to
every binary and library in IPA, even where unused.

https://pagure.io/freeipa/issue/6846
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/718/head:pr718
git checkout pr718
tiran
2017-04-18 12:38:49 UTC
Permalink
URL: https://github.com/freeipa/freeipa/pull/718
Title: #718: configure: fix AC_CHECK_LIB usage

tiran commented:
"""
Is this peculiar behavior of ```AC_CHECK_LIB``` documented somewhere?
"""

See the full comment at https://github.com/freeipa/freeipa/pull/718#issuecomment-294823623
HonzaCholasta
2017-04-18 12:44:21 UTC
Permalink
URL: https://github.com/freeipa/freeipa/pull/718
Title: #718: configure: fix AC_CHECK_LIB usage

HonzaCholasta commented:
"""
If ACTION-IF-FOUND is not
specified, the default action prepends `-lLIBRARY' to `LIBS' and
defines `HAVE_LIBLIBRARY' (in all capitals).
It does not explicitly say what constitutes an unspecified value though.
"""

See the full comment at https://github.com/freeipa/freeipa/pull/718#issuecomment-294825956
lslebodn
2017-04-18 13:28:56 UTC
Permalink
URL: https://github.com/freeipa/freeipa/pull/718
Title: #718: configure: fix AC_CHECK_LIB usage

lslebodn commented:
"""
Post by HonzaCholasta
It does not explicitly say what constitutes an unspecified value though.
```[]``` means default action.

BTW it is not peculiar behaviour because most project define custom LIBS using the 3rd argument
and not after invocation of macro.
e.g.
```
AC_CHECK_HEADER(krad.h, [], [AC_MSG_ERROR([krad.h not found])])
-AC_CHECK_LIB(krad, main, [], [AC_MSG_ERROR([libkrad not found])])
+AC_CHECK_LIB(krad, main, [KRAD_LIBS="-lkrad"], [AC_MSG_ERROR([libkrad not found])])
-KRAD_LIBS="-lkrad"
```

And link to online documentation https://www.gnu.org/software/autoconf/manual/autoconf.html#Libraries
"""

See the full comment at https://github.com/freeipa/freeipa/pull/718#issuecomment-294844095
lslebodn
2017-04-18 13:30:33 UTC
Permalink
URL: https://github.com/freeipa/freeipa/pull/718
Title: #718: configure: fix AC_CHECK_LIB usage

lslebodn commented:
"""
Post by HonzaCholasta
It does not explicitly say what constitutes an unspecified value though.
```, , ``` or ``` , [] ,``` are considered as unspecified values and therefore default action was used.

BTW it is not peculiar behaviour because most project define custom LIBS using the 3rd argument
and not after invocation of macro.
e.g.
```
AC_CHECK_HEADER(krad.h, [], [AC_MSG_ERROR([krad.h not found])])
-AC_CHECK_LIB(krad, main, [], [AC_MSG_ERROR([libkrad not found])])
+AC_CHECK_LIB(krad, main, [KRAD_LIBS="-lkrad"], [AC_MSG_ERROR([libkrad not found])])
-KRAD_LIBS="-lkrad"
```

And link to online documentation https://www.gnu.org/software/autoconf/manual/autoconf.html#Libraries
"""

See the full comment at https://github.com/freeipa/freeipa/pull/718#issuecomment-294844095
lslebodn
2017-04-18 13:34:33 UTC
Permalink
URL: https://github.com/freeipa/freeipa/pull/718
Title: #718: configure: fix AC_CHECK_LIB usage

lslebodn commented:
"""
A little bit offtopic. It is interesting that you look for the function `main` in libkrad. Because it does not exist there. I've just noticed it.
```
sh# nm --defined-only --dynamic /usr/lib64/libkrad.so
0000000000000000 A HIDDEN
0000000000000000 A krad_0_MIT
0000000000002540 T krad_attr_name2num
00000000000025d0 T krad_attr_num2name
0000000000002780 T krad_attrset_add
0000000000002850 T krad_attrset_add_number
0000000000002a00 T krad_attrset_copy
00000000000028b0 T krad_attrset_del
00000000000026a0 T krad_attrset_free
0000000000002990 T krad_attrset_get
0000000000002630 T krad_attrset_new
0000000000003310 T krad_client_free
00000000000032a0 T krad_client_new
0000000000003380 T krad_client_send
00000000000036c0 T krad_code_name2num
0000000000003750 T krad_code_num2name
0000000000003940 T krad_packet_bytes_needed
0000000000003f70 T krad_packet_decode_request
0000000000004040 T krad_packet_decode_response
00000000000041a0 T krad_packet_encode
00000000000039c0 T krad_packet_free
0000000000004220 T krad_packet_get_attr
00000000000041e0 T krad_packet_get_code
0000000000003b20 T krad_packet_new_request
0000000000003e10 T krad_packet_new_response
```
"""

See the full comment at https://github.com/freeipa/freeipa/pull/718#issuecomment-294845871
stlaz
2017-04-19 13:50:07 UTC
Permalink
URL: https://github.com/freeipa/freeipa/pull/718
Title: #718: configure: fix AC_CHECK_LIB usage

stlaz commented:
"""
This patch seems to have fixed the problem, ACK.
"""

See the full comment at https://github.com/freeipa/freeipa/pull/718#issuecomment-295276975
stlaz
2017-04-19 13:50:11 UTC
Permalink
URL: https://github.com/freeipa/freeipa/pull/718
Title: #718: configure: fix AC_CHECK_LIB usage

Label: +ack
HonzaCholasta
2017-04-19 13:57:13 UTC
Permalink
URL: https://github.com/freeipa/freeipa/pull/718
Title: #718: configure: fix AC_CHECK_LIB usage

HonzaCholasta commented:
"""
master:

* 4322b57e313105611df39e99097993ba4161ab42 configure: fix AC_CHECK_LIB usage


ipa-4-5:

* 207864a61a748a9032e67bf0f1782379e44fb5aa configure: fix AC_CHECK_LIB usage


"""

See the full comment at https://github.com/freeipa/freeipa/pull/718#issuecomment-295279306
HonzaCholasta
2017-04-19 13:57:17 UTC
Permalink
URL: https://github.com/freeipa/freeipa/pull/718
Title: #718: configure: fix AC_CHECK_LIB usage

Label: +pushed
HonzaCholasta
2017-04-19 13:57:20 UTC
Permalink
URL: https://github.com/freeipa/freeipa/pull/718
Author: HonzaCholasta
Title: #718: configure: fix AC_CHECK_LIB usage
Action: closed

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/718/head:pr718
git checkout pr718

Loading...