Created attachment 161827 [details] [patch] allow READLINE option to do it's job I think you need to use .include <bsd.port.options.mk> ... .include <bsd.port.mk> instead of bsd.port.pre.mk / post.mk. Otherwise, USES+=readline:ports is set too late and Uses/readline.mk is not included. 'make -V LIB_DEPENDS -V CONFIGURE_ARGS WITH=READLINE' shows devel/readline is in the list of dependencies and --enable-readline is not added to the args for configure. See also bug 202782, comment 7, where this issue was first noticed and mentioned. That bug didn't address this issue (and it's closed), so I've opened a new one here.
I suspect your problem may be local. Here is an example from my local install, which has READLINE option enabled: slippy# ldd /usr/local/bin/kadmin /usr/local/bin/kadmin: libreadline.so.6 => /usr/local/lib/libreadline.so.6 (0x2c431000) libhistory.so.6 => /usr/local/lib/libhistory.so.6 (0x2c67c000) libncurses.so.5 => /usr/local/lib/libncurses.so.5 (0x2c885000) libkadm5clnt_mit.so => /usr/local/lib/libkadm5clnt_mit.so (0x2caa5000) libgssrpc.so => /usr/local/lib/libgssrpc.so (0x2ccba000) libgssapi_krb5.so => /usr/local/lib/libgssapi_krb5.so (0x2ced6000) libkrb5.so => /usr/local/lib/libkrb5.so (0x2d11d000) libk5crypto.so => /usr/local/lib/libk5crypto.so (0x2d3ff000) libcom_err.so => /usr/local/lib/libcom_err.so (0x2d62e000) libkrb5support.so => /usr/local/lib/libkrb5support.so (0x2d831000) libintl.so.8 => /usr/local/lib/libintl.so.8 (0x2da3e000) libc.so.7 => /lib/libc.so.7 (0x2dc49000) libncurses.so.8 => /lib/libncurses.so.8 (0x2dff5000) libtinfo.so.5 => /usr/local/lib/libtinfo.so.5 (0x2e242000) slippy# Rebuilding without READLINE option I get: slippy# ldd /usr/local/bin/kadmin /usr/local/bin/kadmin: libedit.so.0 => /usr/local/lib/libedit.so.0 (0x2c431000) libtinfo.so.5 => /usr/local/lib/libtinfo.so.5 (0x2c66a000) libkadm5clnt_mit.so => /usr/local/lib/libkadm5clnt_mit.so (0x2c89e000) libgssrpc.so => /usr/local/lib/libgssrpc.so (0x2cab3000) libgssapi_krb5.so => /usr/local/lib/libgssapi_krb5.so (0x2cccf000) libkrb5.so => /usr/local/lib/libkrb5.so (0x2cf16000) libk5crypto.so => /usr/local/lib/libk5crypto.so (0x2d1f8000) libcom_err.so => /usr/local/lib/libcom_err.so (0x2d427000) libkrb5support.so => /usr/local/lib/libkrb5support.so (0x2d62a000) libintl.so.8 => /usr/local/lib/libintl.so.8 (0x2d837000) libc.so.7 => /lib/libc.so.7 (0x2da42000) libncurses.so.8 => /lib/libncurses.so.8 (0x2ddee000) slippy#
I was partly wrong. My description of the way to show the problem wasn't quite right - the CONFIGURE_ARGS were correct, but LIB_DEPENDS was not. But the core problem that readline.mk is not included when using .pre.mk/.post.mk is valid. Try reverting the krb5/Makefile before your 2015-10-19 changes in r399631, or just temporarily modify krb5/Makefile to use .include <bsd.port.pre.mk> & .include <bsd.port.post.mk> (instead of using bsd.port.options.mk & bsd.port.mk which were in the suggested patch here and also part of the r399631 changes). Then if you do 'make -V LIB_DEPENDS', you should see that devel/readline is not in the list of LIB_DEPENDS. To further illustrate the issue, you could also add a .warning in Mk/Uses/readline.mk. Then run the 'make -V LIB_DEPENDS' again and see that readline.mk is never included. Then use bsd.port.options.mk/bsd.port.mk (instead of .pre.mk/.post.mk) with the .warning still in readline.mk. You should observe that readline.mk is then included. This happens generally when one uses .pre.mk/.post.mk and test for PORT_OPTIONS in the port Makefile before .post.mk. This is why the typical idiom will include bsd.port.options.mk before the PORT_OPTIONS tests. This is harder to notice for USES=readline, because the effects of missing readline.mk are typically not catastrophic in most cases these days - since /usr/lib/libreadline.so almost always exists at the moment unless you're using -current and have a world built WITHOUT_BINUTILS and WITHOUT_GDB _and_ you don't have the readline port installed _and_ the port in question doesn't detect the missing readline lib and handle it gracefully. Those are lots of conditions necessary to cause the missed readline.mk include to be noticed by the typical observer.
Describe the problem better in the synopsis.
Now that r399631 includes the patch described in this bug report, this can be closed. Thanks, Cy. And sorry for the misleading original description of the problem.