Skip to content
Browse files

merge in VW build system

  • Loading branch information...
1 parent 9241428 commit 85c5e335d300e9ec7d40439c08b99c7f934b68c8 @novas0x2a novas0x2a committed Sep 16, 2009
Showing with 88 additions and 33 deletions.
  1. +30 −13 configure.ac
  2. +30 −2 m4/ax_app.m4
  3. +5 −3 m4/ax_common_options.m4
  4. +2 −1 m4/ax_load_deps.m4
  5. +11 −7 m4/ax_pkg.m4
  6. +4 −1 m4/ax_pkg_boost_lib.m4
  7. +3 −3 m4/ax_pkg_check_function.m4
  8. +3 −3 m4/ax_pkg_one_of.m4
View
43 configure.ac
@@ -5,10 +5,18 @@ dnl All Rights Reserved.
dnl __END_LICENSE__
m4_pattern_forbid([^AX_])
-m4_pattern_allow([AX_CFLAGS])
-m4_pattern_allow([AX_INCLUDE_DIR])
-m4_pattern_allow([AX_LIBDIR])
-m4_pattern_allow([AX_OTHER_LIBDIR])
+m4_pattern_allow([^AX_CFLAGS$])
+m4_pattern_allow([^AX_INCLUDE_DIR$])
+m4_pattern_allow([^AX_LIBDIR$])
+m4_pattern_allow([^AX_OTHER_LIBDIR$])
+m4_pattern_allow([^PKG_[A-Z_]+_CPPFLAGS$])
+m4_pattern_allow([^PKG_[A-Z_]+_LDFLAGS$])
+m4_pattern_allow([^PKG_[A-Z_]+_LIBS$])
+m4_pattern_allow([^PKG_PATHS$])
+m4_pattern_allow([^PKG_PATHS_[A-Z_]+$])
+m4_pattern_allow([^PKG_BOOST_INCDIR$])
+m4_pattern_allow([^PKG_BOOST_LIBDIR$])
+m4_pattern_allow([^PKG_VW_LIBS_TEMP$])
##################################################
# A few starting bits
@@ -105,36 +113,45 @@ if test x"$HAVE_PKG_BOOST" == "xyes"; then
AX_PKG_BOOST_LIB(PROGRAM_OPTIONS, [-lboost_program_options], [boost/program_options.hpp])
AX_PKG_BOOST_LIB(SYSTEM, [-lboost_system], [boost/system/error_code.hpp])
AX_PKG_BOOST_LIB(FILESYSTEM, [-lboost_filesystem], [boost/filesystem/path.hpp], [$PKG_BOOST_SYSTEM_LIBS])
- AX_PKG_BOOST_LIB(THREAD, [-lboost_thread], [boost/thread/thread.hpp])
+ AX_PKG_BOOST_LIB(DATETIME, [-lboost_date_time], [boost/date_time/gregorian/gregorian_types.hpp])
+ AX_PKG_BOOST_LIB(THREAD, [-lboost_thread], [boost/thread/thread.hpp], [$PKG_BOOST_DATETIME_LIBS], [boost/thread/condition.hpp])
AX_PKG_BOOST_LIB(IOSTREAMS, [-lboost_iostreams], [boost/iostreams/stream_buffer.hpp])
- AX_PKG_BOOST_LIB(GRAPH, [-lboost_graph], [boost/graph/adjacency_list.hpp])
+ AX_PKG_BOOST_LIB(GRAPH, [], [boost/graph/adjacency_list.hpp])
fi
# This provides an easy way for users to override the threads options
# if they are replacing Boost threads with something else for their platform.
AX_PKG(THREADS, [BOOST_THREAD], [], [])
+AX_PKG(M, [], [-lm], [math.h])
+
AX_PKG_ONE_OF(LAPACK,
APPLE_LAPACK,
[AX_PKG_APPLE(LAPACK, [], [-framework vecLib])],
+ INTEL_LAPACK,
+ [case $host_cpu in
+ ia64) AX_PKG(INTEL_LAPACK, [PTHREADS M], [-lmkl_lapack -lmkl -lmkl_i2p -lguide], [mkl_lapack.h], [], [64], [dgelss_]);;
+ x86_64) AX_PKG(INTEL_LAPACK, [PTHREADS M], [-lmkl_lapack -lmkl -lmkl_def -lguide], [mkl_lapack.h], [], [em64t], [dgelss_]);;
+ *) AX_PKG(INTEL_LAPACK, [PTHREADS M], [-lmkl_lapack -lmkl -lguide], [mkl_lapack.h], [], [32], [dgelss_]);;
+ esac],
CLAPACK,
- [AX_PKG(CLAPACK, [], [-lclapack -lblas -lf2c], [])],
+ [AX_PKG(CLAPACK, [], [-lclapack -lblas -lf2c], [], [], [], [dgelss_])],
SLAPACK,
- [AX_PKG(SLAPACK, [], [-llapack -lblas], [])],
+ [AX_PKG(SLAPACK, [], [-llapack -lblas], [], [], [], [dgelss_])],
FLAPACK,
- [AX_PKG(FLAPACK, [], [-llapack -lblas -lgfortran], [])],
+ [AX_PKG(FLAPACK, [], [-llapack -lblas -lgfortran], [], [], [], [dgelss_])],
STANDALONE_LAPACK_BLAS,
[AX_PKG(STANDALONE_BLAS, [], [-lblas], [])
- AX_PKG(STANDALONE_LAPACK, [], [-llapack], [])
+ AX_PKG(STANDALONE_LAPACK, [STANDALONE_BLAS], [-llapack], [], [], [], [dgelss_])
AX_GROUP_PKG(STANDALONE_LAPACK_AND_BLAS, [STANDALONE_LAPACK STANDALONE_BLAS])],
STANDALONE_FLAPACK_FBLAS,
[AX_PKG(STANDALONE_F2C, [], [-lf2c], [])
AX_PKG(STANDALONE_FBLAS, [STANDALONE_F2C], [-lblas], [])
- AX_PKG(STANDALONE_FLAPACK, [STANDALONE_F2C], [-llapack], [])
+ AX_PKG(STANDALONE_FLAPACK, [STANDALONE_FBLAS STANDALONE_F2C], [-llapack], [], [], [], [dgelss_])
AX_GROUP_PKG(STANDALONE_FLAPACK_FBLAS, [STANDALONE_FLAPACK STANDALONE_FBLAS STANDALONE_F2C])])
-AX_PKG(VW, [BOOST BOOST_THREAD BOOST_PROGRAM_OPTIONS], [-lvw], [vw/Image/ImageView.h vw/Math/LinearAlgebra.h])
-AX_PKG(VW_CAMERA, [VW BOOST_FILESYSTEM BOOST_IOSTREAMS], [-lvwCamera], [vw/Camera/CAHVModel.h])
+AX_PKG(VW, [BOOST BOOST_THREAD BOOST_PROGRAM_OPTIONS BOOST_FILESYSTEM LAPACK], [-lvw], [vw/Image/ImageView.h vw/Math/LinearAlgebra.h])
+AX_PKG(VW_CAMERA, [VW BOOST_IOSTREAMS], [-lvwCamera], [vw/Camera/CAHVModel.h])
AX_PKG(VW_STEREO, [VW VW_CAMERA], [-lvwStereo], [vw/Stereo/OptimizedCorrelator.h])
AX_PKG(VW_CARTOGRAPHY, [VW VW_CAMERA], [-lvwCartography], [vw/Cartography/GeoReference.h])
AX_PKG(VW_INTEREST_POINT, [VW], [-lvwInterestPoint])
View
32 m4/ax_app.m4
@@ -7,6 +7,31 @@ dnl __END_LICENSE__
# Usage: AX_APP(<name>, <directory>, <default>, <required dependencies>[, <optional dependencies>])
AC_DEFUN([AX_APP],
[
+ m4_ifdef([_AX_APP_PREPARE], [],
+ [
+ abspath() {
+ if test ${1#/} = [$]1; then
+ echo "$PWD/[$]1"
+ else
+ echo [$]1
+ fi
+ }
+
+ var_uniq() {
+ echo -n "[$]*" | sed 's/ \+/\n/g' | sed -n 'G; s/\n/&&/; /^\(@<:@^\n@:>@*\n\).*\n\1/d; s/\n//; h; P' | tr '\n' ' '
+ }
+
+ get_rpath() {
+ for i in "[$]@"; do
+ case [$i] in
+ -L*) v="`abspath ${i#-L}`"; if test -n "$v"; then echo -n " -R$v"; fi;;
+ esac
+ done
+ echo
+ }
+ m4_define([_AX_APP_PREPARE], [1])
+ ])
+
# Silently ignore apps that don't exist in this distribution
if test -d "$srcdir/$2" ; then
@@ -31,10 +56,13 @@ AC_DEFUN([AX_APP],
# Load args 5 and 6 as required deps, and capture missing deps in missing var.
# If missing is populated, bail out. Then load the optional deps
AS_IF([test x"$ax_app_enable" != "xyes"], [AC_MSG_RESULT([no (disabled)])],
- [AX_LOAD_DEPS([$1], [$4], [missing]) dnl Load required deps
+ [AX_LOAD_DEPS([$1], [$4], [missing]) # Load required deps
AS_IF([test -n "$missing"], [AC_MSG_RESULT([no ([missing] $missing)]); ax_app_enable=no],
- [AX_LOAD_DEPS([$1], [$5]) dnl Load optional deps
+ [AX_LOAD_DEPS([$1], [$5]) # Load optional deps
APP_$1_CPPFLAGS="$PKG_$1_CPPFLAGS"
+ if test x"$ENABLE_RPATH" = "xyes"; then
+ PKG_$1_LIBS="$PKG_$1_LIBS `var_uniq \`get_rpath ${PKG_$1_LIBS}\``"
+ fi
APP_$1_LIBS="$PKG_$1_LIBS"
AC_MSG_RESULT([yes])])])
View
8 m4/ax_common_options.m4
@@ -16,9 +16,10 @@ AX_ARG_ENABLE(debug, no, [none], [generate debugging symbols]
AX_ARG_ENABLE(optimize, 3, [none], [compiler optimization level])
AX_ARG_ENABLE(profile, no, [none], [generate profiling data])
AX_ARG_ENABLE(arch-libs, no, [none], [force /lib64 (=64) or /lib32 (=32) instead of /lib])
-AX_ARG_ENABLE(proper-libs, yes, [none], [useful linker options])
AX_ARG_ENABLE(ccache, no, [none], [try to use ccache, if available])
AX_ARG_ENABLE(multi-arch, [], [none], [build multi-arch (universal) binaries])
+AX_ARG_ENABLE(rpath, no, [none], [set RPATH/RUNPATH on generated binaries])
+AX_ARG_ENABLE(as-needed, no, [none], [set -Wl,-as-needed (might break linking)])
@@ -52,9 +53,10 @@ else
AX_OTHER_LIBDIR=""
fi
-if test x"$ENABLE_PROPER_LIBS" = "xyes"; then
# These are good if they're supported
- AX_TRY_CPPFLAGS([-Wl,-no-undefined], [OTHER_LDFLAGS="$OTHER_LDFLAGS -Wl,-no-undefined"])
+AX_TRY_CPPFLAGS([-Wl,-no-undefined], [OTHER_LDFLAGS="$OTHER_LDFLAGS -Wl,-no-undefined"])
+
+if test x"$ENABLE_AS_NEEDED" = "xyes"; then
AX_TRY_CPPFLAGS([-Wl,-as-needed], [OTHER_LDFLAGS="$OTHER_LDFLAGS -Wl,-as-needed"])
fi
View
3 m4/ax_load_deps.m4
@@ -22,7 +22,8 @@ AC_DEFUN([AX_LOAD_DEPS],
m4_foreach_w(dep, m4_toupper([[$2]]),
[AS_IF([test x"$HAVE_PKG_]dep[" != "xyes"], [missing="$missing dep"],
[pkg_c="$pkg_c $PKG_]dep[_CPPFLAGS"
- pkg_l="$pkg_l $PKG_]dep[_LIBS"])])
+ pkg_l="$pkg_l $PKG_]dep[_LIBS"])
+ ])
AS_VAR_POPDEF([missing])
AS_VAR_POPDEF([pkg_l])
View
18 m4/ax_pkg.m4
@@ -5,7 +5,7 @@ dnl All Rights Reserved.
dnl __END_LICENSE__
-dnl Usage: AX_PKG(<name>, <dependencies>, <libraries>, <headers>[, <relative include path>, <required-functions>])
+dnl Usage: AX_PKG(<name>, <dependencies>, <libraries>, <headers>[, <relative include path>, <relative lib path>, <required-functions>])
AC_DEFUN([AX_PKG],
[
AC_ARG_WITH(m4_tolower([[$1]]),
@@ -26,8 +26,8 @@ AC_DEFUN([AX_PKG],
AX_LOG([APPEND: ADD_]$1[_LDFLAGS=$ADD_]$1[_LDFLAGS])
fi
- m4_ifval([$6],
- [AC_MSG_CHECKING([for package $1 with functions ($6)])],
+ m4_ifval([$7],
+ [AC_MSG_CHECKING([for package $1 with functions ($7)])],
[AC_MSG_CHECKING([for package $1])])
AC_LANG_ASSERT(C++)
@@ -105,9 +105,13 @@ AC_DEFUN([AX_PKG],
[TRY_ADD_CPPFLAGS="$TRY_ADD_CPPFLAGS -I$path/${AX_INCLUDE_DIR}"])
if test -d $path/${AX_LIBDIR}; then
- TRY_ADD_LDFLAGS="$TRY_ADD_LDFLAGS -L$path/${AX_LIBDIR}"
+ m4_ifval([$6],
+ [TRY_ADD_LDFLAGS="$TRY_ADD_LDFLAGS -L$path/${AX_LIBDIR}/]$6["],
+ [TRY_ADD_LDFLAGS="$TRY_ADD_LDFLAGS -L$path/${AX_LIBDIR}"])
elif test x"${AX_OTHER_LIBDIR}" != "x"; then
- TRY_ADD_LDFLAGS="$TRY_ADD_LDFLAGS -L$path/${AX_OTHER_LIBDIR}"
+ m4_ifval([$6],
+ [TRY_ADD_LDFLAGS="$TRY_ADD_LDFLAGS -L$path/${AX_OTHER_LIBDIR}/]$6["],
+ [TRY_ADD_LDFLAGS="$TRY_ADD_LDFLAGS -L$path/${AX_OTHER_LIBDIR}"])
fi
fi
@@ -120,8 +124,8 @@ AC_DEFUN([AX_PKG],
AC_LANG_PROGRAM([#include "conftest.h"],[]),
[ HAVE_PKG_$1=yes ], [continue] )
- m4_ifval([$6],
- AX_CHECK_FUNCTIONS([$6], [$LDFLAGS $LIBS], [], [ HAVE_PKG_$1=no; echo "package $1 did not have function $func" >&AS_MESSAGE_LOG_FD ])
+ m4_ifval([$7],
+ AX_CHECK_FUNCTIONS([$7], [$LDFLAGS $LIBS], [], [ HAVE_PKG_$1=no; echo "package $1 did not have function $func" >&AS_MESSAGE_LOG_FD ])
)
if test x"$HAVE_PKG_$1" = x"yes"; then
View
5 m4/ax_pkg_boost_lib.m4
@@ -19,7 +19,7 @@ dnl Boost with the string in said variable somewhere inside the Boost
dnl library names, but after the initial name of the library (specified
dnl as the second parameter to this function). A blank value will give
dnl normal behavior.
-# Usage: AX_PKG_BOOST_LIB(<name>, <libraries>, <header>, [<ldflags>])
+# Usage: AX_PKG_BOOST_LIB(<name>, <libraries>, <header>, [<ldflags>, <other-headers>])
AC_DEFUN([AX_PKG_BOOST_LIB],
[
AC_MSG_CHECKING(for package BOOST_$1)
@@ -75,6 +75,9 @@ AC_DEFUN([AX_PKG_BOOST_LIB],
ax_pkg_old_libs="$LIBS"
echo > conftest.h
+ for header in $5 ; do
+ echo "#include <$header>" >> conftest.h
+ done
for header in $3 ; do
echo "#include <$header>" >> conftest.h
done
View
6 m4/ax_pkg_check_function.m4
@@ -5,8 +5,8 @@ dnl All Rights Reserved.
dnl __END_LICENSE__
-dnl usage: PKG_CHECK_FUNCTION(pkg, function [, alias])
-dnl check a pkg for an optional function, and perhaps call it by a different name
+dnl usage: PKG_CHECK_FUNCTION(pkg, function, alias, define-in-c)
+dnl check a pkg for an optional function, and call it by a different name
AC_DEFUN([PKG_CHECK_FUNCTION],
[AS_VAR_PUSHDEF([var], [m4_tolower([[$1]])[_has_]m4_tolower(m4_default([$3],[$2]))])
var=0
@@ -18,6 +18,6 @@ AC_DEFUN([PKG_CHECK_FUNCTION],
else
m4_toupper(var)=no
fi
- AC_DEFINE_UNQUOTED(AS_TR_CPP(m4_toupper(var)), [$var], [Define to 1 if $1 has $3 support])
+ m4_if([$4], [yes], [AC_DEFINE_UNQUOTED(AS_TR_CPP(m4_toupper(var)), [$var], [Define to 1 if $1 has $3 support])])
AS_VAR_POPDEF([var])
])
View
6 m4/ax_pkg_one_of.m4
@@ -14,9 +14,9 @@ AC_DEFUN([AX_PKG_ONE_OF],
0, [m4_fatal([$0: too few arguments: $#])],
2, [m4_ifset([$2], [m4_fatal([$0: too few arguments: [$1] [$2] $#])], [$0([$1])])],
1, [AX_GROUP_PKG([$1])],
- [AS_IF([test ! -z "$PKG_$1_CPPFLAGS"], [PKG_$2_CPPFLAGS="$PKG_$2_CPPFLAGS $PKG_$1_CPPFLAGS"]) dnl push cppflags to child
- AS_IF([test ! -z "$PKG_$1_LDFLAGS"], [PKG_$2_LDFLAGS="$PKG_$2_LDFLAGS $PKG_$1_LDFLAGS"]) dnl push ldflags to child
- AS_IF([test -z "$HAVE_PKG_$2"], [HAVE_PKG_$2="$HAVE_PKG_$1"]) dnl push have_pkg to child if it doesn't have one
+ [AS_IF([test ! -z "$PKG_$1_CPPFLAGS"], [PKG_$2_CPPFLAGS="$PKG_$2_CPPFLAGS $PKG_$1_CPPFLAGS"]) # push cppflags to child
+ AS_IF([test ! -z "$PKG_$1_LDFLAGS"], [PKG_$2_LDFLAGS="$PKG_$2_LDFLAGS $PKG_$1_LDFLAGS"]) # push ldflags to child
+ AS_IF([test -z "$HAVE_PKG_$2"], [HAVE_PKG_$2="$HAVE_PKG_$1"]) # push have_pkg to child if it doesn't have one
$3
AS_IF([test x"$HAVE_PKG_$2" = "xyes"], [AX_GROUP_PKG([$1], [$2])],
[$0([$1], m4_shiftn(3, $@))])]

0 comments on commit 85c5e33

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