-
Notifications
You must be signed in to change notification settings - Fork 49
Description
As a comment in code says it should work like this:
# If the user provided a value to --with-boost, use it and only it.
It does work for header checks, however, this does not seem to be the case for library checks. Even if --with-boost is set, the macros still try to add -L/usr/local:
Here is a sniplet from config.log when searching for boost_system, first attempt is correct, but instead of going on with -L combinations it should already skip to trying other library names, because --with-boos option was specified.
configure:17734: arm-angstrom-linux-gnueabi-g++ -march=armv5te -mno-thumb -mthumb-interwork -mtune=arm926ej-s -mthumb-interwork -mno-thumb --sysroot=/oe/jin/dss-oe/angstrom-devel-build-eglibc/sysroots/at91sam9g20ek -o conftest -O2 -pipe -g -feliminate-unused-debug-types -fpermissive -fvisibility-inlines-hidden -fvisibility-inlines-hidden -I/oe/jin/dss-oe/angstrom-devel-build-eglibc/sysroots/at91sam9g20ek/usr/include -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -L/oe/jin/dss-oe/angstrom-devel-build-eglibc/sysroots/at91sam9g20ek/usr/lib conftest.o -lboost_system-gcc45-mt-1_47 >&5
/oe/jin/dss-oe/angstrom-devel-build-eglibc/sysroots/x86_64-linux/usr/libexec/armv5te-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/4.5.4/ld: cannot find -lboost_system-gcc45-mt-1_47
collect2: ld returned 1 exit status
configure:17743: $? = 1
configure:17728: re-using the existing conftest.o
configure:17734: arm-angstrom-linux-gnueabi-g++ -march=armv5te -mno-thumb -mthumb-interwork -mtune=arm926ej-s -mthumb-interwork -mno-thumb --sysroot=/oe/jin/dss-oe/angstrom-devel-build-eglibc/sysroots/at91sam9g20ek -o conftest -O2 -pipe -g -feliminate-unused-debug-types -fpermissive -fvisibility-inlines-hidden -fvisibility-inlines-hidden -I/oe/jin/dss-oe/angstrom-devel-build-eglibc/sysroots/at91sam9g20ek/usr/include -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -L/usr/local/lib conftest.o -lboost_system-gcc45-mt-1_47 >&5
/oe/jin/dss-oe/angstrom-devel-build-eglibc/sysroots/x86_64-linux/usr/libexec/armv5te-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/4.5.4/ld: warning: library search path "/usr/local/lib" is unsafe for cross-compilation
/oe/jin/dss-oe/angstrom-devel-build-eglibc/sysroots/x86_64-linux/usr/libexec/armv5te-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/4.5.4/ld: cannot find -lboost_system-gcc45-mt-1_47
collect2: ld returned 1 exit status
configure:17743: $? = 1
This patch seems to solve the problem for me:
diff --git a/build-aux/boost.m4 b/build-aux/boost.m4
index b1cb1b1..843df28 100644
--- a/build-aux/boost.m4
+++ b/build-aux/boost.m4
@@ -376,11 +376,12 @@ for boost_rtopt_ in $boost_rtopt '' -d; do
esac
# If with_boost is empty, we'll search in /lib first, which is not quite
# right so instead we'll try to a location based on where the headers are.
- boost_tmp_lib=$with_boost
- test x"$with_boost" = x && boost_tmp_lib=${boost_cv_inc_path%/include}
- for boost_ldpath in "$boost_tmp_lib/lib" '' \
- /opt/local/lib* /usr/local/lib* /opt/lib* /usr/lib* \
- "$with_boost" C:/Boost/lib /lib*
+ boost_tmp_lib=$with_boost/lib
+ test x"$with_boost" = x && boost_tmp_lib="${boost_cv_inc_path%/include} \
+ /opt/local/lib* /usr/local/lib* /opt/lib* /usr/lib* \
+ "$with_boost" C:/Boost/lib /lib*"
+
+ for boost_ldpath in $boost_tmp_lib
do
test -e "$boost_ldpath" || continue
boost_save_LDFLAGS=$LDFLAGS