The upstream Makefile for net-fs/autofs-5.0.3-r6 unconditionally sets LDFLAGS, overriding user settings. It also puts some values in LDFLAGS that should be in LIBS. I have a patch that corrects both issues.
Created attachment 177057 [details, diff]
Patch to s/\<LDFLAGS/AUTOFS_LDFLAGS/ in assignments, and update the one use of LDFLAGS
This patch changes occurrences of LDFLAGS to AUTOFS_LDFLAGS in variable assignments. In the one place where LDFLAGS was used in a make rule, I added a reference to AUTOFS_LDFLAGS and moved plain LDFLAGS after DAEMON_LDFLAGS, to give user LDFLAGS precedence.
Warning: this patch also drops the line "LDFLAGS += -lpthread", since that is a library inclusion, not an ld flag. As such, my patch for bug #247969 needs to be merged first. Merging this patch without that one will result in daemon/automount not even attempting to link libpthread, which will cause the build to fail. The patch in attachment #177056 [details, diff] adds a -lpthread to the daemon/Makefile LIBS variable, after which the use of -lpthread in LDFLAGS can be dropped safely.
Patch applied in net-fs/autofs-5.0.4. Thanks.