[PATCH] fix configure for libparted
Dan Nicholson
dbn.lists at gmail.com
Tue Jan 15 06:28:02 PST 2008
On Jan 15, 2008 5:54 AM, Danny Kukawka <danny.kukawka at web.de> wrote:
> On Dienstag, 11. Dezember 2007, Dan Nicholson wrote:
> [...]
> > It would be nice if you also used the pkg-config file if it exists
> > since then you get any necessary -L's in the PARTED_LIBS variable.
> > Something like
> >
> > if $PKG_CONFIG --atleast-version 1.8.0; then
> > PKG_CHECK_MODULES(PARTED, parted)
> > else
> > ...header check...
> > PARTED_LIBS=-lparted
> > fi
> > AC_SUBST(PARTED_LIBS)
> >
> > Looks, nice, though.
>
> Commited something like that, I hope it is what you proposed:
> http://lists.freedesktop.org/archives/hal-commit/2008-January/004108.html
Yeah, that seems sufficient. I notice a couple bad things in the
fallback test, though (not that you wrote that part):
* LDFLAGS aren't cached, so the user loses their settings
* LDFLAGS should not be used for the test in AC_RUN_IFELSE. People do
this a lot, but it often breaks linking, especially for --as-needed.
The reason is that putting libraries in LDFLAGS moves it to the
beginning of the command line. So, you end up with something like
this:
gcc -lparted conftest.c -o conftest
When using the GNU ld feature --as-needed, the linker will drop
-lparted because it hasn't seen any objects that would use it and the
feature test will fail. If you use the LIBS variable instead, it will
be placed at the end of the command line and the linker will see
-lparted as being needed by conftest.
So, it would be nice if you could change the fallback test to something like:
save_LIBS=$LIBS
LIBS=-lparted
AC_RUN_IFELSE(...)
PARTED_LIBS=-lparted
LIBS=$save_LIBS
Thanks, Danny.
--
Dan
More information about the hal
mailing list