Skip to content
Browse files

Mostly sync the macros between vw & stereo. This is good either if we…

… stick with autotools or if we switch to something else
  • Loading branch information...
1 parent 4ee7362 commit 54183f266da1efc08bd8bf8b6164abc81b464717 @novas0x2a novas0x2a committed Nov 24, 2008
Showing with 88 additions and 77 deletions.
  1. +5 −0 configure.ac
  2. +50 −27 m4/ax_pkg.m4
  3. +15 −34 m4/ax_pkg_boost.m4
  4. +10 −10 m4/ax_pkg_boost_lib.m4
  5. +3 −3 m4/ax_pkg_gl.m4
  6. +3 −3 m4/ax_pkg_lapack.m4
  7. +2 −0 m4/ax_pkg_pthreads.m4
View
5 configure.ac
@@ -306,6 +306,8 @@ fi
AX_PKG_PTHREADS
AX_PKG_BOOST
+AX_PKG_BOOST_CHECK_VERSION([VW_])
+
AC_MSG_NOTICE([VW will be built using Boost version $BOOST_VERSION])
AX_PKG_BOOST_LIB(PROGRAM_OPTIONS, [-lboost_program_options], [boost/program_options.hpp])
AX_PKG_BOOST_LIB(FILESYSTEM_PRE_1_35, [-lboost_filesystem], [boost/filesystem/path.hpp])
@@ -438,6 +440,9 @@ AC_MSG_NOTICE([VW will use $NUM_THREADS THREADS by default])
# final processing
##################################################
+VW_CPPFLAGS="$OTHER_CPPFLAGS"
+VW_LDFLAGS="$OTHER_LDFLAGS"
+
if test "yes" = "$ENABLE_VERBOSE" ; then
AC_MSG_NOTICE([using CPPFLAGS=$CPPFLAGS])
AC_MSG_NOTICE([using VW_CPPFLAGS=$VW_CPPFLAGS])
View
77 m4/ax_pkg.m4
@@ -19,15 +19,24 @@ AC_DEFUN([AX_PKG],
AC_MSG_RESULT([no (disabled by user)])
else
- # Test for and inherit libraries from dependencies
- PKG_$1_LIBS="$3"
+ if test -z "${FORCE_$1_LDFLAGS}"; then
+ PKG_$1_LIBS="$3"
+ else
+ PKG_$1_LIBS="${FORCE_$1_LDFLAGS}"
+ fi
+
+ # Test for and inherit from dependencies
for x in $2; do
ax_pkg_have_dep=HAVE_PKG_${x}
if test "${!ax_pkg_have_dep}" = "yes"; then
+ ax_pkg_dep_cxxflags="PKG_${x}_CPPFLAGS"
ax_pkg_dep_libs="PKG_${x}_LIBS"
+ PKG_$1_CPPFLAGS="$PKG_$1_CPPFLAGS ${!ax_pkg_dep_cxxflags}"
PKG_$1_LIBS="$PKG_$1_LIBS ${!ax_pkg_dep_libs}"
+ unset ax_pkg_dep_cxxflags
unset ax_pkg_dep_libs
else
+ unset PKG_$1_CPPFLAGS
unset PKG_$1_LIBS
HAVE_PKG_$1="no"
break
@@ -41,44 +50,36 @@ AC_DEFUN([AX_PKG],
elif test "x$HAVE_PKG_$1" = "xyes" ; then
AC_MSG_RESULT([yes (using user-supplied flags)])
- # Add package-specific cppflags/ldflags to what we have so far.
- # This is necessary for systems that have one version of a library
- # installed in a default location, and another that they want to use
- # instead in a separate location.
- if test -n ${PKG_$1_CPPFLAGS} ; then
- VW_CPPFLAGS="${PKG_$1_CPPFLAGS} ${VW_CPPFLAGS}"
- fi
- if test -n ${PKG_$1_LDFLAGS} ; then
- VW_LDFLAGS="${PKG_$1_LDFLAGS} ${VW_LDFLAGS}"
- fi
-
# Otherwise we look for a path that contains the needed headers and libraries
else
if test "x$ENABLE_VERBOSE" = "yes"; then
AC_MSG_RESULT([searching...])
fi
- if test -n "${HAVE_PKG_$1}" && test "${HAVE_PKG_$1}" != "yes" && test "${HAVE_PKG_$1}" != "no"; then
+ if test -n "${FORCE_$1_LDFLAGS}"; then
+ PKG_PATHS_$1=""
+ elif test -n "${HAVE_PKG_$1}" && test "${HAVE_PKG_$1}" != "yes" && test "${HAVE_PKG_$1}" != "no"; then
PKG_PATHS_$1=${HAVE_PKG_$1}
else
- PKG_PATHS_$1=${PKG_PATHS}
+ PKG_PATHS_$1="none ${PKG_PATHS}"
fi
HAVE_PKG_$1=no
ax_pkg_old_libs="$LIBS"
ax_pkg_old_cppflags="$CPPFLAGS"
ax_pkg_old_ldflags="$LDFLAGS"
- ax_pkg_old_vw_cppflags="$VW_CPPFLAGS"
- ax_pkg_old_vw_ldflags="$VW_LDFLAGS"
+ ax_pkg_old_other_cppflags="$OTHER_CPPFLAGS"
+ ax_pkg_old_other_ldflags="$OTHER_LDFLAGS"
+
LIBS="$PKG_$1_LIBS $LIBS"
- for path in none $PKG_PATHS_$1; do
+ for path in $PKG_PATHS_$1; do
- CPPFLAGS="$ax_pkg_old_cppflags"
+ CPPFLAGS="$PKG_$1_CPPFLAGS $ax_pkg_old_cppflags"
LDFLAGS="$ax_pkg_old_ldflags"
- VW_CPPFLAGS="$ax_pkg_old_vw_cppflags"
- VW_LDFLAGS="$ax_pkg_old_vw_ldflags"
+ OTHER_CPPFLAGS="$ax_pkg_old_other_cppflags"
+ OTHER_LDFLAGS="$ax_pkg_old_other_ldflags"
echo > conftest.h
for header in $4 ; do
@@ -90,11 +91,23 @@ AC_DEFUN([AX_PKG],
if test x"$ENABLE_VERBOSE" = "xyes"; then
AC_MSG_CHECKING([for package $1 in $path])
fi
+
+ # ISIS is really stupid, and they use /foo/inc as their include file
+ # location instead of /foo/include. So we check for that. This sees
+ # about any other idiot libraries that use the same design as well.
+ AX_INCLUDE_DIR=include
+ if ! test -d $path/${AX_INCLUDE_DIR}; then
+ if test -d $path/inc; then
+ AX_INCLUDE_DIR=inc
+ fi
+ fi
+
if test -z "$5"; then
- TRY_ADD_CPPFLAGS="-I$path/include"
+ TRY_ADD_CPPFLAGS="$ADD_$1_CPPFLAGS -I$path/${AX_INCLUDE_DIR}"
else
- TRY_ADD_CPPFLAGS="-I$path/include/$5"
+ TRY_ADD_CPPFLAGS="$ADD_$1_CPPFLAGS -I$path/${AX_INCLUDE_DIR}/$5"
fi
+
if test -d $path/${AX_LIBDIR}; then
TRY_ADD_LDFLAGS="-L$path/${AX_LIBDIR}"
elif test x"${AX_LIBDIR}" = "xlib64"; then
@@ -103,6 +116,10 @@ AC_DEFUN([AX_PKG],
CPPFLAGS="$CPPFLAGS $TRY_ADD_CPPFLAGS"
LDFLAGS="$LDFLAGS $TRY_ADD_LDFLAGS"
+ else
+ # search in current paths
+ CPPFLAGS="$CPPFLAGS $OTHER_CPPFLAGS"
+ LDFLAGS="$LDFLAGS $OTHER_LDFLAGS"
fi
AC_LINK_IFELSE(
AC_LANG_PROGRAM([#include "conftest.h"],[]),
@@ -114,8 +131,11 @@ AC_DEFUN([AX_PKG],
fi
done
- VW_CPPFLAGS="$VW_CPPFLAGS $TRY_ADD_CPPFLAGS"
- VW_LDFLAGS="$VW_LDFLAGS $TRY_ADD_LDFLAGS"
+ PKG_$1_CPPFLAGS="$PKG_$1_CPPFLAGS $TRY_ADD_CPPFLAGS"
+ PKG_$1_LIBS="$PKG_$1_LIBS $TRY_ADD_LDFLAGS"
+
+ OTHER_CPPFLAGS="$OTHER_CPPFLAGS $TRY_ADD_CPPFLAGS"
+ OTHER_LDFLAGS="$OTHER_LDFLAGS $TRY_ADD_LDFLAGS"
CPPFLAGS="$ax_pkg_old_cppflags"
LDFLAGS="$ax_pkg_old_ldflags"
LIBS="$ax_pkg_old_libs"
@@ -131,21 +151,24 @@ AC_DEFUN([AX_PKG],
ax_have_pkg_bool=1
else
ax_have_pkg_bool=0
+ PKG_$1_CPPFLAGS=
PKG_$1_LIBS=
fi
AC_DEFINE_UNQUOTED([HAVE_PKG_$1],
[$ax_have_pkg_bool],
[Define to 1 if the $1 package is available.])
+ AC_SUBST(PKG_$1_CPPFLAGS)
AC_SUBST(PKG_$1_LIBS)
AC_SUBST(HAVE_PKG_$1)
if test x"$ENABLE_VERBOSE" == "xyes"; then
AC_MSG_NOTICE([HAVE_PKG_$1 = ${HAVE_PKG_$1}])
+ AC_MSG_NOTICE([PKG_$1_CPPFLAGS= $PKG_$1_CPPFLAGS])
AC_MSG_NOTICE([PKG_$1_LIBS= $PKG_$1_LIBS])
AC_MSG_NOTICE([CPPFLAGS= $CPPFLAGS])
AC_MSG_NOTICE([LDFLAGS= $LDFLAGS])
- AC_MSG_NOTICE([VW_CPPFLAGS= $VW_CPPFLAGS])
- AC_MSG_NOTICE([VW_LDFLAGS= $VW_LDFLAGS])
+ AC_MSG_NOTICE([OTHER_CPPFLAGS= $OTHER_CPPFLAGS])
+ AC_MSG_NOTICE([OTHER_LDFLAGS= $OTHER_LDFLAGS])
fi
])
View
49 m4/ax_pkg_boost.m4
@@ -18,6 +18,7 @@ AC_DEFUN([AX_PKG_BOOST],
# Skip testing if the user has overridden
if test -z ${HAVE_PKG_BOOST}; then
+ PKG_BOOST_CPPFLAGS=
PKG_BOOST_LIBS=
HAVE_PKG_BOOST=no
@@ -64,8 +65,8 @@ AC_DEFUN([AX_PKG_BOOST],
fi
if test "${HAVE_PKG_BOOST}" = "yes" ; then
- ax_pkg_old_vw_cppflags=$VW_CPPFLAGS
- ax_pkg_old_vw_ldflags=$VW_LDFLAGS
+ 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
@@ -80,8 +81,8 @@ AC_DEFUN([AX_PKG_BOOST],
fi
if test "$ax_result" = "yes" ; then break ; fi
# Try it with just the include path
- VW_CPPFLAGS="-I${PKG_BOOST_INCDIR} $VW_CPPFLAGS"
- CPPFLAGS="$ax_pkg_old_cppflags $VW_CPPFLAGS"
+ 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
@@ -91,8 +92,8 @@ AC_DEFUN([AX_PKG_BOOST],
fi
if test "$ax_result" = "yes" ; then break ; fi
# Finally, try it with the linker path
- VW_LDFLAGS="-L${PKG_BOOST_LIBDIR} $VW_LDFLAGS"
- LDFLAGS="$ax_pkg_old_ldflags $VW_LDFLAGS"
+ 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
@@ -103,8 +104,8 @@ AC_DEFUN([AX_PKG_BOOST],
if test "$ax_result" = "yes" ; then break ; fi
# The detected version of boost seems to be invalid!
HAVE_PKG_BOOST="no"
- VW_CPPFLAGS="$ax_pkg_old_vw_cppflags"
- VW_LDFLAGS="$ax_pkg_old_vw_ldflags"
+ OTHER_CPPFLAGS="$ax_pkg_old_other_cppflags"
+ OTHER_LDFLAGS="$ax_pkg_old_other_ldflags"
unset PKG_BOOST_INCDIR
unset PKG_BOOST_LIBDIR
break
@@ -115,43 +116,23 @@ AC_DEFUN([AX_PKG_BOOST],
if test "${HAVE_PKG_BOOST}" = "yes" ; then
ax_have_pkg_bool=1
+ PKG_BOOST_CPPFLAGS="-I${PKG_BOOST_INCDIR}"
+ PKG_BOOST_LIBS="-L${PKG_BOOST_LIBDIR}"
else
ax_have_pkg_bool=0
fi
AC_DEFINE_UNQUOTED([HAVE_PKG_BOOST],
[$ax_have_pkg_bool],
[Define to 1 if the BOOST package is available.])
+ AC_SUBST(PKG_BOOST_CPPFLAGS)
+ AC_SUBST(PKG_BOOST_LIBS)
AC_SUBST(HAVE_PKG_BOOST)
- AC_LANG_CONFTEST(
- [AC_LANG_PROGRAM([[
-#include <iostream>
-#include <boost/version.hpp>
-#define STR2(s) #s
-#define STR(s) STR2(s)
-]],[[
-std::cout << STR(BOOST_VERSION);
-]])])
- $CXX $VW_CPPFLAGS -I${PKG_BOOST_INCDIR} -o conftest conftest.$ac_ext
- BOOST_VERSION=`./conftest`
- AC_DEFINE_UNQUOTED([BOOST_VERSION],
- [$BOOST_VERSION],
- [The version of Boost with which the Vision Workbench was built.])
-
- AH_VERBATIM([_VW_CHECK_BOOST_VERSION],
-[// Check to make sure the user is using the same version of Boost
-// headers that the Vision Workbench was built with.
-#include <boost/version.hpp>
-#if BOOST_VERSION != VW_BOOST_VERSION
-#error You are using a different version of Boost than you used to build the Vision Workbench!
-#endif
-])
-
if test "$ENABLE_VERBOSE" = "yes"; then
AC_MSG_NOTICE([HAVE_PKG_BOOST= $HAVE_PKG_BOOST])
- AC_MSG_NOTICE([VW_CPPFLAGS= $VW_CPPFLAGS])
- AC_MSG_NOTICE([VW_LDFLAGS= $VW_LDFLAGS])
+ 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
View
20 m4/ax_pkg_boost_lib.m4
@@ -64,8 +64,8 @@ AC_DEFUN([AX_PKG_BOOST_LIB],
fi
fi
- ax_pkg_old_vw_cppflags=$VW_CPPFLAGS
- ax_pkg_old_vw_ldflags=$VW_LDFLAGS
+ 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
@@ -78,8 +78,8 @@ AC_DEFUN([AX_PKG_BOOST_LIB],
if test "x${ENABLE_VERBOSE}" = "xyes" ; then
AC_MSG_CHECKING([whether current paths are sufficient...])
fi
- CPPFLAGS="$ax_pkg_old_cppflags $VW_CPPFLAGS"
- LDFLAGS="$ax_pkg_old_ldflags $VW_LDFLAGS"
+ CPPFLAGS="$ax_pkg_old_cppflags $OTHER_CPPFLAGS"
+ LDFLAGS="$ax_pkg_old_ldflags $OTHER_LDFLAGS"
LIBS="$PKG_BOOST_$1_LIBS $ax_pkg_old_libs"
AC_LINK_IFELSE( AC_LANG_PROGRAM([#include "conftest.h"],[]), [ax_result=yes], [ax_result=no] )
if test "x${ENABLE_VERBOSE}" = "xyes" ; then
@@ -90,8 +90,8 @@ AC_DEFUN([AX_PKG_BOOST_LIB],
if test "x${ENABLE_VERBOSE}" = "xyes" ; then
AC_MSG_CHECKING([whether adding the include path is sufficient...])
fi
- VW_CPPFLAGS="-I${PKG_BOOST_INCDIR} $VW_CPPFLAGS"
- CPPFLAGS="$ax_pkg_old_cppflags $VW_CPPFLAGS"
+ OTHER_CPPFLAGS="-I${PKG_BOOST_INCDIR} $OTHER_CPPFLAGS"
+ CPPFLAGS="$ax_pkg_old_cppflags $OTHER_CPPFLAGS"
AC_LINK_IFELSE( AC_LANG_PROGRAM([#include "conftest.h"],[]), [ax_result=yes], [ax_result=no] )
if test "x${ENABLE_VERBOSE}" = "xyes" ; then
AC_MSG_RESULT([$ax_result])
@@ -101,17 +101,17 @@ AC_DEFUN([AX_PKG_BOOST_LIB],
if test "x${ENABLE_VERBOSE}" = "xyes" ; then
AC_MSG_CHECKING([whether adding the include and linker paths works...])
fi
- VW_LDFLAGS="-L${PKG_BOOST_LIBDIR} $VW_LDFLAGS"
- LDFLAGS="$ax_pkg_old_ldflags $VW_LDFLAGS"
+ OTHER_LDFLAGS="-L${PKG_BOOST_LIBDIR} $OTHER_LDFLAGS"
+ LDFLAGS="$ax_pkg_old_ldflags $OTHER_LDFLAGS"
AC_LINK_IFELSE( AC_LANG_PROGRAM([#include "conftest.h"],[]), [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
# The detected version of boost seems to be invalid!
HAVE_PKG_BOOST_$1="no"
- VW_CPPFLAGS="$ax_pkg_old_vw_cppflags"
- VW_LDFLAGS="$ax_pkg_old_vw_ldflags"
+ OTHER_CPPFLAGS="$ax_pkg_old_other_cppflags"
+ OTHER_LDFLAGS="$ax_pkg_old_other_ldflags"
break
done
View
6 m4/ax_pkg_gl.m4
@@ -16,7 +16,7 @@ AC_DEFUN([AX_PKG_GL],
fi
HAVE_PKG_GL="yes"
- PKG_GL_LIBS="$VW_LDFLAGS -framework OpenGL -framework GLUT"
+ PKG_GL_LIBS="$OTHER_LDFLAGS -framework OpenGL -framework GLUT"
if test "$ENABLE_VERBOSE" = "yes"; then
AC_MSG_RESULT([found])
@@ -35,8 +35,8 @@ AC_DEFUN([AX_PKG_GL],
if test "$ENABLE_VERBOSE" = "yes"; then
AC_MSG_NOTICE([HAVE_PKG_GL = ${HAVE_PKG_GL}])
AC_MSG_NOTICE([PKG_GL_LIBS = ${PKG_GL_LIBS}])
- AC_MSG_NOTICE([VW_CPPFLAGS = ${VW_CPPFLAGS}])
- AC_MSG_NOTICE([VW_LDFLAGS = ${VW_LDFLAGS}])
+ 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
View
6 m4/ax_pkg_lapack.m4
@@ -16,7 +16,7 @@ AC_DEFUN([AX_PKG_LAPACK],
fi
HAVE_PKG_LAPACK="yes"
- PKG_LAPACK_LIBS="$VW_LDFLAGS -framework vecLib"
+ PKG_LAPACK_LIBS="$OTHER_LDFLAGS -framework vecLib"
if test "$ENABLE_VERBOSE" = "yes"; then
AC_MSG_RESULT([found])
@@ -35,8 +35,8 @@ AC_DEFUN([AX_PKG_LAPACK],
if test "$ENABLE_VERBOSE" = "yes"; then
AC_MSG_NOTICE([HAVE_PKG_LAPACK = ${HAVE_PKG_LAPACK}])
AC_MSG_NOTICE([PKG_LAPACK_LIBS = ${PKG_LAPACK_LIBS}])
- AC_MSG_NOTICE([VW_CPPFLAGS = ${VW_CPPFLAGS}])
- AC_MSG_NOTICE([VW_LDFLAGS = ${VW_LDFLAGS}])
+ 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
View
2 m4/ax_pkg_pthreads.m4
@@ -69,10 +69,12 @@ AC_DEFUN([AX_PKG_PTHREADS],
[Define to 1 if the PTHREADS package is available.])
AC_SUBST(HAVE_PKG_PTHREADS)
+ AC_SUBST(PKG_PTHREADS_CPPFLAGS)
AC_SUBST(PKG_PTHREADS_LIBS)
if test "$ENABLE_VERBOSE" = "yes"; then
AC_MSG_NOTICE([HAVE_PKG_PTHREADS = ${HAVE_PKG_PTHREADS}])
+ AC_MSG_NOTICE([PKG_PTHREADS_CPPFLAGS = ${PKG_PTHREADS_CPPFLAGS}])
AC_MSG_NOTICE([PKG_PTHREADS_LIBS = ${PKG_PTHREADS_LIBS}])
AC_MSG_NOTICE([CFLAGS= $CFLAGS])
AC_MSG_NOTICE([CXXFLAGS= $CXXFLAGS])

0 comments on commit 54183f2

Please sign in to comment.
Something went wrong with that request. Please try again.