Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix up boost detection to be a little less fragile... i hope.

  • Loading branch information...
commit 80359c7f2603157ddd666063b1dc07dcb0d38a2c 1 parent b95fa64
Mike Lundy novas0x2a authored
Showing with 62 additions and 96 deletions.
  1. +62 −96 m4/ax_pkg_boost.m4
158 m4/ax_pkg_boost.m4
View
@@ -9,17 +9,14 @@ dnl __END_LICENSE__
AC_DEFUN([AX_PKG_BOOST],
[
AC_MSG_CHECKING(for package BOOST)
- if test "$ENABLE_VERBOSE" = "yes"; then
- AC_MSG_RESULT([])
- fi
AC_LANG_ASSERT(C++)
- if test -n "${HAVE_PKG_BOOST}" && test "${HAVE_PKG_BOOST}" != "yes" && test "${HAVE_PKG_BOOST}" != "no" && test x"${HAVE_PKG_$1#no:}" == "x$HAVE_PKG_$1"; then
- PKG_PATHS_BOOST=${HAVE_PKG_BOOST}
+ if test -n "${HAVE_PKG_BOOST}" && test "${HAVE_PKG_BOOST}" != "yes" && test "${HAVE_PKG_BOOST}" != "no" && test x"${HAVE_PKG_BOOST#no:}" == "x$HAVE_PKG_BOOST"; then
+ PKG_PATHS_BOOST="${HAVE_PKG_BOOST}"
unset HAVE_PKG_BOOST
else
- PKG_PATHS_BOOST=${PKG_PATHS}
+ PKG_PATHS_BOOST="${PKG_PATHS}"
fi
# Skip testing if the user has overridden
@@ -29,101 +26,73 @@ AC_DEFUN([AX_PKG_BOOST],
PKG_BOOST_LIBS=
HAVE_PKG_BOOST=no
+ ax_pkg_old_other_cppflags="$OTHER_CPPFLAGS"
+ ax_pkg_old_other_ldflags="$OTHER_LDFLAGS"
+ ax_pkg_old_cppflags="$CPPFLAGS"
+ ax_pkg_old_ldflags="$LDFLAGS"
+
for ax_boost_base_path in $PKG_PATHS_BOOST; do
# First look for a system-style installation
- if test "$ENABLE_VERBOSE" = "yes"; then
- AC_MSG_CHECKING([for system-style boost in ${ax_boost_base_path}])
- fi
- if test -d "${ax_boost_base_path}/include/boost" ; then
+ AX_LOG([Checking for a boost in ${ax_boost_base_path}])
+
+ if test -f "${ax_boost_base_path}/include/boost/version.hpp" ; then
+ AX_LOG([Found a system-style boost])
PKG_BOOST_INCDIR="${ax_boost_base_path}/include"
PKG_BOOST_LIBDIR="${ax_boost_base_path}/${AX_LIBDIR}"
- # In case it's not in lib64 despite specifying lib64...
- if test ! -d $PKG_BOOST_LIBDIR -a x"${AX_OTHER_LIBDIR}" != "x"; then
- PKG_BOOST_LIBDIR="${ax_boost_base_path}/${AX_OTHER_LIBDIR}"
- fi
HAVE_PKG_BOOST="yes"
- if test "$ENABLE_VERBOSE" = "yes"; then
- AC_MSG_RESULT([found])
- fi
- break
else
- if test "$ENABLE_VERBOSE" = "yes"; then
- AC_MSG_RESULT([not found])
- fi
+ # Next look for a default-style installation
+ for ax_boost_inc_path in `ls -d ${ax_boost_base_path}/include/boost-* 2> /dev/null` ; do
+ AX_LOG([Checking for default-style boost in ${ax_boost_inc_path}])
+ if test -f "${ax_boost_inc_path}/boost/version.hpp"; then
+ AX_LOG([Found a default-style boost in ${ax_boost_inc_path}])
+ # At the moment we greedily accept the first one we find, regardless of version
+ PKG_BOOST_INCDIR="${ax_boost_inc_path}"
+ PKG_BOOST_LIBDIR="${ax_boost_base_path}/${AX_LIBDIR}"
+ HAVE_PKG_BOOST="yes"
+ fi
+ done
fi
- # Next look for a default-style installation
- if test "$ENABLE_VERBOSE" = "yes"; then
- AC_MSG_CHECKING([for default-style boost in ${ax_boost_base_path}])
- fi
- for ax_boost_inc_path in `ls -d ${ax_boost_base_path}/include/boost-* 2> /dev/null` ; do
- # At the moment we greedily accept the first one we find, regardless of version
- PKG_BOOST_INCDIR="${ax_boost_inc_path}"
- PKG_BOOST_LIBDIR="${ax_boost_base_path}/${AX_LIBDIR}"
+
+ if test x"${HAVE_PKG_BOOST}" = "xyes"; then
+
+ HAVE_PKG_BOOST="no"
+
# In case it's not in lib64 despite specifying lib64...
if test ! -d $PKG_BOOST_LIBDIR -a x"${AX_OTHER_LIBDIR}" != "x"; then
PKG_BOOST_LIBDIR="${ax_boost_base_path}/${AX_OTHER_LIBDIR}"
fi
- HAVE_PKG_BOOST="yes"
- if test "$ENABLE_VERBOSE" = "yes"; then
- AC_MSG_RESULT([found])
- fi
- break 2
- done
- if test "$ENABLE_VERBOSE" = "yes"; then
- AC_MSG_RESULT([not found])
- fi
- done
- fi
- if test "${HAVE_PKG_BOOST}" = "yes" ; then
- ax_pkg_old_other_cppflags=$OTHER_CPPFLAGS
- ax_pkg_old_other_ldflags=$OTHER_LDFLAGS
- ax_pkg_old_cppflags=$CPPFLAGS
- ax_pkg_old_ldflags=$LDFLAGS
- ax_pkg_old_libs=$LIBS
- while true ; do
- # First see if the current paths are sufficient
- if test "x${ENABLE_VERBOSE}" = "xyes" ; then
- AC_MSG_CHECKING([whether current paths are sufficient...])
- fi
- AC_LINK_IFELSE( AC_LANG_PROGRAM([#include <boost/version.hpp>],[]), [ax_result=yes], [ax_result=no] )
- if test "x${ENABLE_VERBOSE}" = "xyes" ; then
- AC_MSG_RESULT([$ax_result])
- fi
- if test "$ax_result" = "yes" ; then break ; fi
- # Try it with just the include path
- OTHER_CPPFLAGS="-I${PKG_BOOST_INCDIR} $OTHER_CPPFLAGS"
- CPPFLAGS="$ax_pkg_old_cppflags $OTHER_CPPFLAGS"
- if test "x${ENABLE_VERBOSE}" = "xyes" ; then
- AC_MSG_CHECKING([whether adding the include path is sufficient...])
- fi
- AC_LINK_IFELSE( AC_LANG_PROGRAM([#include <boost/version.hpp>],[]), [ax_result=yes], [ax_result=no] )
- if test "x${ENABLE_VERBOSE}" = "xyes" ; then
- AC_MSG_RESULT([$ax_result])
- fi
- if test "$ax_result" = "yes" ; then break ; fi
- # Finally, try it with the linker path
- OTHER_LDFLAGS="-L${PKG_BOOST_LIBDIR} $OTHER_LDFLAGS"
- LDFLAGS="$ax_pkg_old_ldflags $OTHER_LDFLAGS"
- if test "x${ENABLE_VERBOSE}" = "xyes" ; then
- AC_MSG_CHECKING([whether adding the include and linker paths works...])
- fi
- AC_LINK_IFELSE( AC_LANG_PROGRAM([#include <boost/version.hpp>],[]), [ax_result=yes], [ax_result=no] )
- if test "x${ENABLE_VERBOSE}" = "xyes" ; then
- AC_MSG_RESULT([$ax_result])
+ OTHER_CPPFLAGS="-I${PKG_BOOST_INCDIR} $OTHER_CPPFLAGS"
+ OTHER_LDFLAGS="-L${PKG_BOOST_LIBDIR} $OTHER_LDFLAGS"
+
+ CPPFLAGS="$ax_pkg_old_cppflags $OTHER_CPPFLAGS"
+ LDFLAGS="$ax_pkg_old_ldflags $OTHER_LDFLAGS"
+
+ echo "#include <boost/version.hpp>" > conftest.h
+
+ dnl check for the header
+ dnl otherwise, check next path
+ AC_LINK_IFELSE(
+ AC_LANG_PROGRAM([#include "conftest.h"],[]),
+ [ HAVE_PKG_BOOST=yes; break; ])
+
+ HAVE_PKG_BOOST="no"
+ OTHER_CPPFLAGS="$ax_pkg_old_other_cppflags"
+ OTHER_LDFLAGS="$ax_pkg_old_other_ldflags"
+ unset PKG_BOOST_INCDIR
+ unset PKG_BOOST_LIBDIR
+
fi
- if test "$ax_result" = "yes" ; then break ; fi
- # The detected version of boost seems to be invalid!
- HAVE_PKG_BOOST="no"
- OTHER_CPPFLAGS="$ax_pkg_old_other_cppflags"
- OTHER_LDFLAGS="$ax_pkg_old_other_ldflags"
- unset PKG_BOOST_INCDIR
- unset PKG_BOOST_LIBDIR
- break
+
done
+
+ CPPFLAGS="$ax_pkg_old_cppflags"
+ LDFLAGS="$ax_pkg_old_ldflags"
+
fi
- CPPFLAGS="$ax_pkg_old_cppflags"
- LDFLAGS="$ax_pkg_old_ldflags"
+
+ AC_MSG_RESULT([$HAVE_PKG_BOOST])
if test "${HAVE_PKG_BOOST}" = "yes" ; then
ax_have_pkg_bool=1
@@ -140,14 +109,11 @@ AC_DEFUN([AX_PKG_BOOST],
AC_SUBST(PKG_BOOST_LIBS)
AC_SUBST(HAVE_PKG_BOOST)
- if test "$ENABLE_VERBOSE" = "yes"; then
- AC_MSG_NOTICE([HAVE_PKG_BOOST= $HAVE_PKG_BOOST])
- AC_MSG_NOTICE([OTHER_CPPFLAGS= $OTHER_CPPFLAGS])
- AC_MSG_NOTICE([OTHER_LDFLAGS= $OTHER_LDFLAGS])
- AC_MSG_NOTICE([CPPFLAGS= $CPPFLAGS])
- AC_MSG_NOTICE([LDFLAGS= $LDFLAGS])
- else
- AC_MSG_RESULT([$HAVE_PKG_BOOST])
- fi
-
+ AX_LOG(HAVE_PKG_BOOST=${HAVE_PKG_BOOST})
+ AX_LOG(PKG_BOOST_CPPFLAGS=$PKG_BOOST_CPPFLAGS)
+ AX_LOG(PKG_BOOST_LIBS=$PKG_BOOST_LIBS)
+ AX_LOG(CPPFLAGS=$CPPFLAGS)
+ AX_LOG(LDFLAGS=$LDFLAGS)
+ AX_LOG(OTHER_CPPFLAGS=$OTHER_CPPFLAGS)
+ AX_LOG(OTHER_LDFLAGS=$OTHER_LDFLAGS)
])
Please sign in to comment.
Something went wrong with that request. Please try again.