Skip to content

Fix configure to mangle AM_LDFLAGS instead of LDFLAGS, which it has no business to mangle. - #1242

Merged
peternewman merged 4 commits into
OpenLightingProject:masterfrom
yoe:fix_for_1201
May 8, 2017
Merged

peternewman merged 4 commits into
OpenLightingProject:masterfrom
yoe:fix_for_1201

Conversation

@yoe

@yoe yoe commented Apr 30, 2017

Copy link
Copy Markdown
Contributor

Fix #1201

While at it, fix configure to mangle AM_LDFLAGS instead of LDFLAGS, which it has no business to mangle.

yoe added 2 commits April 30, 2017 19:10
Currently we just unconditionally add it to LDFLAGS, without checking
whether it even exists. That creates confusing error messages down the
line.

Instead, use AC_CHECK_LIB to see whether the library is there, and
provide a proper error message if not. This should fix
OpenLightingProject#1201.
Automake defines LDFLAGS (and CFLAGS, and a number of other variables)
as user variables (i.e., reserved for the user, not for the build
system), and provides AM_* alternatives for the build system to mangle
instead.

The advantage of this is that the user can mangle those variables by
running "make LDFLAGS=-lfoo" without having to fiddle with configure,
and without losing whatever flags the configure run added.

In addition, since doing "LDFLAGS=-lfoo ./configure" is also supported,
LDFLAGS is captured at AC_OUTPUT time, and therefore should not be
directly mangled by the configure script; otherwise a user might try to
do something which will break the build.

We do so anyway, which might cause things to break in some corner cases.

Fix this misbehaviour by setting AM_LDFLAGS rather than LDLFLAGS, and
AC_SUBST'ing it into the build system at the end of the configure run.
@peternewman

Copy link
Copy Markdown
Member

Thanks @yoe !

Can we target the tcmalloc bit at the 0.10 branch please as it's a bugfix, but perhaps the LDFLAGS stuff should stay in master, in case it's got unintended consequences.

@peternewman peternewman changed the title Fix for 1201 Fix configure to mangle AM_LDFLAGS instead of LDFLAGS, which it has no business to mangle. Apr 30, 2017
@peternewman peternewman added this to the 0.11.0 milestone Apr 30, 2017
@peternewman

Copy link
Copy Markdown
Member

See #1243 for the fix for #1201 .

@peternewman

Copy link
Copy Markdown
Member

@yoe do the other LDFLAGS references in the m4 scripts in config want fixing too then? https://github.com/OpenLightingProject/ola/search?utf8=%E2%9C%93&q=LDFLAGS&type=

@peternewman peternewman self-assigned this Apr 30, 2017

@peternewman peternewman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per the question, do the other bits need fixing?

@yoe

yoe commented May 1, 2017

Copy link
Copy Markdown
Contributor Author

No, they don't. Those all use the pattern

save_LDFLAGS=$LDFLAGS

(mangle LDFLAGS, run various tests)

MY_LDFLAGS=foo
LDFLAGS=$save_LDFLAGS

etc, which means that while they touch LDFLAGS, they don't actually permanently change things. This is perfectly okay and the right thing to do.

@peternewman
peternewman requested a review from nomis52 May 5, 2017 21:03
@peternewman

Copy link
Copy Markdown
Member

This will go green after #1248 goes in.

@peternewman
peternewman merged commit 2c834b8 into OpenLightingProject:master May 8, 2017
@peternewman peternewman mentioned this pull request Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configure doesn't check for tcmalloc's presence when trying to add it to libs

3 participants