Skip to content
Browse files

Bringing ASP's build system up to VW standards

I've reduced the differences between ASP and VW. Hopefully ASP has gained some fixes.
  • Loading branch information...
1 parent a834a21 commit bf8e60a497b3fa6ee7c4c1b9fcc61ff0989ac6d0 Zack Moratto committed
View
90 configure.ac
@@ -1,9 +1,10 @@
dnl __BEGIN_LICENSE__
-dnl Copyright (C) 2006, 2007 United States Government as represented by
+dnl Copyright (C) 2009-2010 United States Government as represented by
dnl the Administrator of the National Aeronautics and Space Administration.
dnl All Rights Reserved.
dnl __END_LICENSE__
+
m4_pattern_forbid([^AX_])
m4_pattern_allow([^AX_CFLAGS$])
m4_pattern_allow([^AX_INCLUDE_DIR$])
@@ -17,19 +18,23 @@ 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$])
+m4_pattern_allow([^PKG_ARBITRARY_QT_NEEDED_HEADERS$])
##################################################
# A few starting bits
##################################################
+AC_PREREQ([2.59])
dnl TODO BEFORE RELEASE: update package version
AC_INIT([NASA Ames Stereo Pipeline], [1.0.1_pre], [asp@nx.arc.nasa.gov], [StereoPipeline])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
-AM_INIT_AUTOMAKE([nostdinc])
+AM_INIT_AUTOMAKE([nostdinc 1.8.5])
AX_CONFIG_HEADER_PREFIX([src/asp/asp_config.h], [ASP_])
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
dnl TODO RIGHT BEFORE RELEASE: update libtool version
dnl if abi changes in any way:
dnl current++
@@ -43,23 +48,18 @@ dnl revision++
dnl (see http://sources.redhat.com/autobook/autobook/autobook_91.html)
dnl
dnl LIBTOOL_VERSION=current:revision:age
-LIBTOOL_VERSION=2:0:0
+LIBTOOL_VERSION=4:0:0
AC_SUBST(LIBTOOL_VERSION)
+m4_divert_text([INIT_PREPARE], [dnl
# load the config.options
if test -f ./config.options; then
AX_LOG([using config.options << EOF])
AX_LOG([`cat ./config.options`])
AX_LOG([EOF])
- source ./config.options
+ . ./config.options
fi
-
-dnl Process all the --with and --enable options here, so the variables are
-dnl available later
-m4_define(AX_DIVERSION_PROCESS_OPTIONS, 42)
-m4_undivert(AX_DIVERSION_PROCESS_OPTIONS)
-
-
+])
##################################################
# Find the necessary programs
@@ -71,6 +71,9 @@ m4_undivert(AX_DIVERSION_PROCESS_OPTIONS)
CFLAGS="$CFLAGS"
CXXFLAGS="$CXXFLAGS"
+# Disable static libraries by default
+AM_DISABLE_STATIC
+
# Find the tools
AC_PROG_CC
AC_PROG_CXX
@@ -81,6 +84,13 @@ AC_PROG_MAKE_SET
AC_LANG(C++)
AX_COMMON_OPTIONS
+# Does the compiler support noreturn?
+AX_CHECK_FUNCTION_ATTRIBUTE([noreturn])
+AX_CHECK_FUNCTION_ATTRIBUTE([deprecated])
+
+# Looking for posix headers
+AC_CHECK_HEADERS([unistd.h pwd.h])
+AC_CHECK_FUNCS([getpwuid getpid])
##################################################
# Compilation options
@@ -111,20 +121,32 @@ AX_PKG_PTHREADS
AX_PKG(OPEN_MPI, [], [-D_REENTRANT -Wl,-u,_munmap -Wl,-multiply_defined,suppress -lmpi_cxx -lmpi -lopen-rte -lopen-pal -lutil], [mpi.h])
-AX_PKG_BOOST
-if test x"$HAVE_PKG_BOOST" == "xyes"; then
- AX_PKG_BOOST_CHECK_VERSION([ASP_])
- AC_MSG_NOTICE([Stereo 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(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(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, [], [boost/graph/adjacency_list.hpp])
- AX_PKG_BOOST_LIB(MPI, [-lboost_mpi], [boost/mpi.hpp], [$PKG_OPEN_MPI_LIBS])
- AX_PKG_BOOST_LIB(SERIALIZATION, [-lboost_serialization], [boost/serialization/string.hpp], [$PKG_OPEN_MPI_LIBS $PKG_BOOST_MPI_LIBS])
+AX_PKG_BOOST([BOOST_PROGRAM_OPTIONS BOOST_SYSTEM BOOST_FILESYSTEM BOOST_THREAD BOOST_GRAPH],
+ BOOST_PROGRAM_OPTIONS,
+ [AX_PKG_BOOST_LIB(PROGRAM_OPTIONS, [-lboost_program_options], [boost/program_options.hpp], [boost::program_options::options_description("Rawr");])],
+ BOOST_SYSTEM,
+ [AX_PKG_BOOST_LIB(SYSTEM, [-lboost_system], [boost/system/error_code.hpp], [boost::system::error_code();])],
+ BOOST_FILESYSTEM,
+ [AX_PKG_BOOST_LIB(FILESYSTEM, [-lboost_filesystem], [boost/filesystem/path.hpp], [boost::filesystem::path();], [$PKG_BOOST_SYSTEM_LIBS])],
+ BOOST_REGEX,
+ [AX_PKG_BOOST_LIB(REGEX, [-lboost_regex], [boost/regex.hpp], [boost::regex(".*");])],
+ BOOST_DATETIME,
+ [AX_PKG_BOOST_LIB(DATETIME, [-lboost_date_time], [boost/date_time/gregorian/gregorian_types.hpp])],
+ BOOST_THREAD,
+ [AX_PKG_BOOST_LIB(THREAD, [-lboost_thread], [boost/thread/thread.hpp], [boost::mutex();], [$PKG_BOOST_DATETIME_LIBS], [boost/thread/condition.hpp])],
+ BOOST_IOSTREAMS,
+ [AX_PKG_BOOST_LIB(IOSTREAMS, [-lboost_iostreams], [boost/iostreams/device/mapped_file.hpp], [boost::iostreams::mapped_file_source();])],
+ BOOST_GRAPH,
+ [AX_PKG_BOOST_LIB(GRAPH, [], [boost/graph/adjacency_list.hpp])],
+ BOOST_MPI,
+ [AX_PKG_BOOST_LIB(MPI, [-lboost_mpi], [boost/mpi.hpp], [], [$PKG_OPEN_MPI_LIBS])],
+ BOOST_SERIALIZATION,
+ [AX_PKG_BOOST_LIB(SERIALIZATION, [-lboost_serialization], [boost/serialization/string.hpp], [], [$PKG_OPEN_MPI_LIBS $PKG_BOOST_MPI_LIBS])]
+)
+
+if test x"$HAVE_PKG_BOOST" = "xyes"; then
+ AX_PKG_BOOST_CHECK_VERSION([VW_])
+ AC_MSG_NOTICE([Using Boost header version $BOOST_VERSION, library suffix $PKG_BOOST_SAME_SUFFIX])
fi
# This provides an easy way for users to override the threads options
@@ -175,7 +197,7 @@ AX_PKG_ONE_OF(GL,
[AX_PKG_APPLE([GL], [], [-framework OpenGL -framework GLUT -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib])],
LINUX_GL,
[AX_PKG(X11, [], [-lXext -lX11 -lXmu -lXi -lXt], [])
- AX_PKG(LINUX_GL, [X11], [-lGL -lGLU -lglut], [GL/gl.h GL/glu.h GL/glut.h], [])])
+ AX_PKG(LINUX_GL, [X11], [-lglut -lGLU -lGL], [GL/gl.h GL/glu.h GL/glut.h], [], [], [glCreateShader])])
AX_PKG(OPENSCENEGRAPH, [GL], [-losg -losgDB -lOpenThreads -losgViewer -losgText -losgGA -losgFX -losgTerrain -losgUtil], [osg/ref_ptr])
@@ -189,7 +211,7 @@ if test "$ENABLE_QT_QMAKE" = no; then
AX_GROUP_PKG([QT_QMAKE])
else
# Qt with AutoTroll.
- AT_WITH_QT([+gui +sql +opengl], [], [], [HAVE_PKG_QT_QMAKE="no:missing QT"], [])
+ AT_WITH_QT([+gui +sql +opengl +network], [], [], [HAVE_PKG_QT_QMAKE="no:missing QT"], [])
if test x"$HAVE_PKG_QT_QMAKE" != x"no:missing QT"; then
AT_REQUIRE_QT_VERSION([4.0], [HAVE_PKG_QT_QMAKE="no:wrong QT version"], [])
@@ -214,18 +236,20 @@ AX_PKG_ONE_OF(QT,
AX_PKG(ARBITRARY_QT, [], [-lQtCore], [$PKG_ARBITRARY_QT_NEEDED_HEADERS])],
APPLE_QMAKE_QT, [AX_PKG_APPLE(QMAKE_QT, [GL QT_QMAKE], [])],
LINUX_QMAKE_QT,
- [AX_PKG(QT_QMAKE_OPENGL, [QT_QMAKE], [], [QtOpenGL])
- AX_PKG(QT_QMAKE_GUI, [QT_QMAKE], [], [QLabel])
- AX_PKG(QT_QMAKE_SQL, [QT_QMAKE], [], [QtSql])
- AX_GROUP_PKG(LINUX_QMAKE_QT, [QT_QMAKE QT_QMAKE_GUI QT_QMAKE_OPENGL QT_QMAKE_SQL])],
+ [AX_PKG(QT_QMAKE_OPENGL, [QT_QMAKE], [], [QtOpenGL])
+ AX_PKG(QT_QMAKE_GUI, [QT_QMAKE], [], [QLabel])
+ AX_PKG(QT_QMAKE_SQL, [QT_QMAKE], [], [QtSql])
+ AX_PKG(QT_QMAKE_NETWORK, [QT_QMAKE], [], [QtNetwork])
+ AX_GROUP_PKG(LINUX_QMAKE_QT, [QT_QMAKE QT_QMAKE_GUI QT_QMAKE_OPENGL QT_QMAKE_SQL QT_QMAKE_NETWORK])],
GUESS_QT,
[PKG_QT_GUESS_BASE_CPPFLAGS="$PKG_QT_GUESS_BASE_CPPFLAGS -DQT_SHARED"
AX_PKG(QT_GUESS_BASE, [], [], [QtCore/qstring.h])
AX_PKG(QT_GUESS_CORE, [QT_GUESS_BASE], [-lQtCore], [QtCore], [QtCore])
AX_PKG(QT_GUESS_GUI, [QT_GUESS_CORE], [-lQtGui], [QtGui], [QtGui])
AX_PKG(QT_GUESS_SQL, [QT_GUESS_CORE], [-lQtSql], [QtSql], [QtSql])
+ AX_PKG(QT_GUESS_NETWORK,[QT_GUESS_CORE], [-lQtNetwork],[QtNetwork],[QtNetwork])
AX_PKG(QT_GUESS_OPENGL, [QT_GUESS_CORE QT_GUESS_GUI], [-lQtOpenGL], [QtOpenGL], [QtOpenGL])
- AX_GROUP_PKG(GUESS_QT, [QT_GUESS_BASE QT_GUESS_CORE QT_GUESS_GUI QT_GUESS_SQL QT_GUESS_OPENGL])])
+ AX_GROUP_PKG(GUESS_QT, [QT_GUESS_BASE QT_GUESS_CORE QT_GUESS_GUI QT_GUESS_SQL QT_GUESS_NETWORK QT_GUESS_OPENGL])])
AX_PKG_ONE_OF(QWT,
APPLE_QWT, [AX_PKG_APPLE(QWT, [QT], [-lqwt.5])],
@@ -365,7 +389,7 @@ AC_CONFIG_FILES([ \
src/asp/Sessions/Pinhole/Makefile \
src/asp/Sessions/RMAX/Makefile \
src/asp/MPI/Makefile \
- src/asp/Tools/Makefile
+ src/asp/Tools/Makefile \
])
AC_OUTPUT
View
15 m4/ax_app.m4
@@ -38,7 +38,7 @@ AC_DEFUN([AX_APP],
HAVE_PKG_$1_SRC=yes
- AC_DIVERT_PUSH(AX_DIVERSION_PROCESS_OPTIONS)dnl
+ m4_divert_once([INIT_PREPARE], [dnl
# Silently ignore apps that don't exist in this distribution
# I'm diverting the output, so i need to do this twice.
if test -d "$srcdir/$2" ; then
@@ -46,14 +46,13 @@ AC_DEFUN([AX_APP],
if test -n "$ENABLE_APP_$1"; then
WANT_APP_$1="$ENABLE_APP_$1"
fi
-
- AC_ARG_ENABLE([app-]m4_tolower([[$1]]),
- AC_HELP_STRING([--enable-app-]m4_tolower([[$1]]), [enable the $1 app @<:@$3@:>@]),
- [ ENABLE_APP_$1=$enableval; WANT_APP_$1=$enableval; ],
- [ if test "x$ENABLE_APP_$1" = x; then ENABLE_APP_$1=`/bin/echo -n $3 | tr [A-Z] [a-z]` ; fi ]
- )
fi
- AC_DIVERT_POP()dnl
+
+ AC_ARG_ENABLE([app-]my_tolower([$1]),
+ AS_HELP_STRING([--enable-app-]my_tolower([$1]), [enable the $1 app @<:@$3@:>@]),
+ [ ENABLE_APP_$1=$enableval; WANT_APP_$1=$enableval; ],
+ [ if test "x$ENABLE_APP_$1" = x; then ENABLE_APP_$1=`/bin/echo -n $3 | tr [A-Z] [a-z]` ; fi ]
+ )])
AC_MSG_CHECKING([whether to build app $1])
View
28 m4/ax_arg.m4
@@ -1,10 +1,12 @@
dnl __BEGIN_LICENSE__
-dnl Copyright (C) 2006-2009 United States Government as represented by
+dnl Copyright (C) 2006-2010 United States Government as represented by
dnl the Administrator of the National Aeronautics and Space Administration.
dnl All Rights Reserved.
dnl __END_LICENSE__
+m4_ifdef([_AX_FIXUPS], [], [m4_include([m4/fixups.m4])])
+
dnl AX_ARG_(ENABLE|WITH)(<arg>, <default>, <tags>, <description>)
dnl possible tags are:
dnl always -> set autoconf macro to value
@@ -19,25 +21,25 @@ dnl variable in question is ether ENABLE_ARG or ARG (the "with" is dropped)
dnl AX_ARG(<type>, <arg>, <default>, <tags>, <description>)
AC_DEFUN([AX_ARG],
[
- m4_define([lower], [m4_tolower([[$2]])])dnl lower-case arg name
- m4_define([type], [m4_toupper([[$1]])])dnl WITH or ENABLE
- AS_VAR_PUSHDEF([value], [m4_if(type, [WITH], [], type[_])[]m4_toupper([[$2]])])dnl
+ m4_pushdef([lower], my_tolower([$2]))dnl lower-case arg name
+ m4_pushdef([type], my_toupper([$1]))dnl WITH or ENABLE
+ AS_VAR_PUSHDEF([value], m4_if(type, [WITH], [], type[_])[]m4_toupper([[$2]]))dnl
+
- AC_DIVERT_PUSH(AX_DIVERSION_PROCESS_OPTIONS)dnl
+ m4_divert_once([INIT_PREPARE], [dnl
dnl switch between AC_ARG_(WITH|ENABLE), since I don't think you can indirect
m4_if(type, [WITH],
dnl WITH case.
[AC_ARG_WITH(lower,
- AC_HELP_STRING([--with]-lower, [$5][ ]m4_ifval([$3],[@<:@$3@:>@])), dnl append default value to the desc
+ AS_HELP_STRING([--with]-lower, [$5][ ]m4_ifval([$3],[@<:@$3@:>@])), dnl append default value to the desc
[ value=[$withval] ], dnl if passed in, set value
[ AS_VAR_SET_IF([value], [], [value="[$3]"]) ])], dnl else set to default if not already set
dnl ENABLE case. same as above except if default is yes, change enable -> disable
[AC_ARG_ENABLE(lower,
- AC_HELP_STRING([--][]m4_if(yes, [$3], disable, enable)-lower, [$5][ ]m4_ifval([$3],[@<:@$3@:>@])),
+ AS_HELP_STRING([--][]m4_if(yes, [$3], disable, enable)-lower, [$5][ ]m4_ifval([$3],[@<:@$3@:>@])),
[ value=[$enableval] ],
- [ AS_VAR_SET_IF([value], [], [value="[$3]"]) ])])
- AC_DIVERT_POP()dnl
+ [ AS_VAR_SET_IF([value], [], [value="[$3]"]) ])])])
dnl if the tag is none, generate no configure code here
m4_bmatch([$4], [none], [], [dnl
@@ -54,7 +56,7 @@ AC_DEFUN([AX_ARG],
dnl check for cpp-bool tag.
m4_bmatch([$4], [cpp-bool], [dnl
- AS_VAR_PUSHDEF([int], m4_tolower(value))
+ AS_VAR_PUSHDEF([int], my_tolower(value))
AS_IF([test x"$value" = x"yes"], int=1, int=0)
AC_DEFINE_UNQUOTED(AS_TR_CPP(value), [$int], [$5])
AS_VAR_POPDEF([int])dnl
@@ -62,7 +64,7 @@ AC_DEFUN([AX_ARG],
dnl check for cpp-int tag.
m4_bmatch([$4], [cpp-int], [dnl
- AS_VAR_PUSHDEF([int], m4_tolower(value))dnl
+ AS_VAR_PUSHDEF([int], my_tolower(value))dnl
int=$value dnl
AC_DEFINE_UNQUOTED(AS_TR_CPP(value), [$int], [$5])dnl
AS_VAR_POPDEF([int])dnl
@@ -76,8 +78,8 @@ AC_DEFUN([AX_ARG],
dnl clean up after myself
AS_VAR_POPDEF([value])dnl
- m4_undefine([type])dnl
- m4_undefine([lower])dnl
+ m4_popdef([type])dnl
+ m4_popdef([lower])dnl
])
AC_DEFUN([AX_ARG_ENABLE], [AX_ARG([enable], [$1], [$2], [$3], [$4])])
View
23 m4/ax_check_attribute.m4
@@ -0,0 +1,23 @@
+dnl __BEGIN_LICENSE__
+dnl Copyright (C) 2006-2010 United States Government as represented by
+dnl the Administrator of the National Aeronautics and Space Administration.
+dnl All Rights Reserved.
+dnl __END_LICENSE__
+
+
+dnl Usage: AX_CHECK_FUNCTION_ATTRIBUTE([attr])
+
+AC_DEFUN([AX_CHECK_FUNCTION_ATTRIBUTE],
+[
+ AS_VAR_PUSHDEF([ac_var], ac_cv_func_attribute_[[$1]])dnl
+ AC_CACHE_CHECK([whether the current compiler supports $1], ac_var,
+ [
+ AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
+ int f(int i) __attribute__(($1));
+ ]], []), [AS_VAR_SET(ac_var,yes)], [AS_VAR_SET(ac_var,no)])
+ ])
+ AS_IF([test x"$ac_var" = "xyes"],
+ [AC_DEFINE([COMPILER_HAS_ATTRIBUTE_]AS_TR_CPP($1), [1], [does the compiler support function __attribute__(($1))?])],
+ [AC_DEFINE([COMPILER_HAS_ATTRIBUTE_]AS_TR_CPP($1), [0], [does the compiler support function __attribute__(($1))?])])
+ AS_VAR_POPDEF([ac_var])dnl
+])
View
4 m4/ax_check_functions.m4
@@ -1,5 +1,5 @@
dnl __BEGIN_LICENSE__
-dnl Copyright (C) 2006-2009 United States Government as represented by
+dnl Copyright (C) 2006-2010 United States Government as represented by
dnl the Administrator of the National Aeronautics and Space Administration.
dnl All Rights Reserved.
dnl __END_LICENSE__
@@ -40,7 +40,7 @@ AC_DEFUN([AX_CHECK_FUNCTIONS],
done
m4_ifval([$3], [
- if test x"$check_function_missing_libs" == x"no"; then
+ if test x"$check_function_missing_libs" = x"no"; then
$3
fi
])
View
20 m4/ax_check_introspection.m4
@@ -1,20 +0,0 @@
-dnl __BEGIN_LICENSE__
-dnl Copyright (C) 2006-2009 United States Government as represented by
-dnl the Administrator of the National Aeronautics and Space Administration.
-dnl All Rights Reserved.
-dnl __END_LICENSE__
-
-
-# This checks for various introspection functions
-AC_DEFUN([AX_CHECK_INTROSPECTION],
-[
- AC_CHECK_HEADERS(execinfo.h cxxabi.h typeinfo dlfcn.h)
-
- AC_CHECK_FUNCS([__cxa_current_exception_type __cxa_demangle backtrace])
-
- old_LIBS="$LIBS"
- LIBS=""
- AC_SEARCH_LIBS(dladdr, dl, [AC_DEFINE(HAVE_DLADDR,1,Define if you have dladdr())])
- LDFLAGS="$LDFLAGS $LIBS"
- LIBS="$old_LIBS"
-])
View
43 m4/ax_common_options.m4
@@ -18,15 +18,35 @@ 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(ccache, no, [none], [try to use ccache, if available])
AX_ARG_ENABLE(multi-arch, [], [none], [build multi-arch (universal) binaries])
+AX_ARG_ENABLE(no-undefined, no, [none], [set -Wl,-no-undefined (might break linking)])
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)])
-
+AX_ARG_ENABLE(google-tcmalloc, yes, [none], [Try to use google perftools' tcmalloc])
+AX_ARG_ENABLE(google-profiler, no, [none], [Try to use google perftools' cpu profiler])
##################################################
# Handle options
##################################################
+if test x"$ENABLE_GOOGLE_TCMALLOC" != x"yes"; then
+ HAVE_PKG_TCMALLOC=no:disabled
+fi
+if test x"$ENABLE_GOOGLE_PROFILER" != x"yes"; then
+ HAVE_PKG_GOOGLE_PROFILER=no:disabled
+fi
+
+AX_PKG(TCMALLOC, [], [-ltcmalloc], [google/tcmalloc.h])
+AX_PKG(GOOGLE_PROFILER, [], [-lprofiler], [google/profiler.h])
+
+if test x"$HAVE_PKG_TCMALLOC" = x"yes"; then
+ LIBS="$LIBS $PKG_TCMALLOC_LIBS"
+fi
+
+if test x"$HAVE_PKG_GOOGLE_PROFILER" = x"yes"; then
+ LIBS="$LIBS $PKG_GOOGLE_PROFILER_LIBS"
+fi
+
# Pass apple gcc options to build a universal binary
for arch in $ENABLE_MULTI_ARCH; do
AX_CFLAGS="$AX_CFLAGS -arch $arch"
@@ -54,7 +74,9 @@ else
fi
# These are good if they're supported
-AX_TRY_CPPFLAGS([-Wl,-no-undefined], [OTHER_LDFLAGS="$OTHER_LDFLAGS -Wl,-no-undefined"])
+if test x"$ENABLE_NO_UNDEFINED" = "xyes"; then
+ AX_TRY_CPPFLAGS([-Wl,-no-undefined], [OTHER_LDFLAGS="$OTHER_LDFLAGS -Wl,-no-undefined"])
+fi
if test x"$ENABLE_AS_NEEDED" = "xyes"; then
AX_TRY_CPPFLAGS([-Wl,-as-needed], [OTHER_LDFLAGS="$OTHER_LDFLAGS -Wl,-as-needed"])
@@ -62,9 +84,9 @@ fi
# Debugging
case "$ENABLE_DEBUG" in
- yes|1) AX_CFLAGS="$AX_CFLAGS -g -DDEBUG -Wall" ;;
- 2) AX_CFLAGS="$AX_CFLAGS -g -DDEBUG -D_GLIBCXX_DEBUG -Wall" ;;
- no) AX_CFLAGS="$AX_CFLAGS -DNDEBUG -Wall" ;;
+ yes|1) AX_CFLAGS="$AX_CFLAGS -g -DDEBUG" ;;
+ 2) AX_CFLAGS="$AX_CFLAGS -g -DDEBUG -D_GLIBCXX_DEBUG" ;;
+ no) AX_CFLAGS="$AX_CFLAGS -DNDEBUG" ;;
ignore) ;;
*) AC_MSG_ERROR([Unknown debug option: "$ENABLE_DEBUG"]) ;;
esac
@@ -73,8 +95,6 @@ esac
case "$ENABLE_OPTIMIZE" in
yes) AX_CFLAGS="$AX_CFLAGS -O3" ;;
3|2|1) AX_CFLAGS="$AX_CFLAGS -O$ENABLE_OPTIMIZE" ;;
- coreduo) AX_CFLAGS="$AX_CFLAGS -O4 -march=prescott -mtune=prescott -funroll-loops -msse -msse2 -msse3 -mfpmath=sse -ftree-vectorize" ;;
- sse3) AX_CFLAGS="$AX_CFLAGS -O4 -funroll-loops -msse -msse2 -msse3 -mfpmath=sse -ftree-vectorize" ;;
no|0) AC_MSG_WARN([*** The Vision Workbench may not work properly with optimization disabled! ***])
AX_CFLAGS="$AX_CFLAGS -O0" ;;
ignore) ;;
@@ -85,8 +105,13 @@ if test x"$ENABLE_PROFILE" = "xyes"; then
AX_TRY_CPPFLAGS([-pg], [AX_CFLAGS="$AX_CFLAGS -pg"], [AC_MSG_ERROR([Cannot enable profiling: compiler doesn't seem to support it])])
fi
-CFLAGS="$AX_CFLAGS $CFLAGS"
-CXXFLAGS="$AX_CFLAGS $CXXFLAGS"
+AX_TRY_CPPFLAGS([-Wno-missing-field-initializers], [
+ CFLAGS="-Wno-missing-field-initializers $CFLAGS "
+ CXXFLAGS="-Wno-missing-field-initializers $CXXFLAGS"
+])
+
+CFLAGS="-Wall -Wextra -Wno-unused-parameter $AX_CFLAGS $CFLAGS"
+CXXFLAGS="-Wall -Wextra -Wno-unused-parameter $AX_CFLAGS $CXXFLAGS"
# These need to be here because automake-1.6 is dumb and does not properly
# process AM_CONDITIONALs unless the first argument is a simple string.
View
38 m4/ax_extract_cpp_symbol.m4
@@ -0,0 +1,38 @@
+dnl __BEGIN_LICENSE__
+dnl Copyright (C) 2006-2010 United States Government as represented by
+dnl the Administrator of the National Aeronautics and Space Administration.
+dnl All Rights Reserved.
+dnl __END_LICENSE__
+
+
+dnl Usage: AX_EXTRACT_CPP_SYMBOL([symbol], [headers], [ifyes], [ifno], [cppflags])
+dnl It the variable $output will contain the extracted value
+dnl example: AX_EXTRACT_CPP_SYMBOL([BOOST_VERSION], [#include <boost/version.hpp>], [BOOST_VERSION=$output])
+AC_DEFUN([AX_EXTRACT_CPP_SYMBOL],
+[
+ AC_REQUIRE_CPP()dnl
+ AC_CHECK_PROGS([SED], [sed gsed])
+AC_LANG_CONFTEST(
+ [AC_LANG_SOURCE([$2
+#define __ac_extract_cpp_symbol_delimiter "__ac_extract_cpp_symbol_delimiter"
+__ac_extract_cpp_symbol_delimiter $1 __ac_extract_cpp_symbol_delimiter])])
+
+old_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$5 $CPPFLAGS"
+AS_VAR_PUSHDEF([output], [ax_extract_cpp_symbol_$1])dnl
+if (eval "$ac_cpp conftest.$ac_ext") >conftest.out 2>&AS_MESSAGE_LOG_FD; then
+ output="`${SED} -n -e 's/^.*"__ac_extract_cpp_symbol_delimiter" \(.*\) "__ac_extract_cpp_symbol_delimiter".*$/\1/p' conftest.out 2>/dev/null`"
+ if test x"${output}" != x"$1"; then
+ ifelse([$3], , :, [$3])
+ ifelse([$4], , , [else
+ $4
+])
+ fi
+ ifelse([$4], , , [else
+ $4
+])dnl
+fi
+CPPFLAGS="$old_CPPFLAGS"
+AS_VAR_POPDEF([output])
+rm -rf conftest*
+])
View
2 m4/ax_find_files.m4
@@ -21,7 +21,7 @@ AC_DEFUN([AX_FIND_FILES],
if test ! -z "$ax_find_files_paths" ; then
AX_LOG([Find Files: Found ${ax_find_files_paths}])
else
- AX_LOG([Fine Files: Not Found])
+ AX_LOG([Find Files: Not Found])
ax_find_files_passed=no
break
fi
View
17 m4/ax_group_pkg.m4
@@ -5,6 +5,8 @@ dnl All Rights Reserved.
dnl __END_LICENSE__
+m4_ifdef([_AX_FIXUPS], [], [m4_include([m4/fixups.m4])])
+
dnl AX_GROUP_PKG(<pkg> [, <dep1> .. <depn>])
dnl A stripped-down AX_PKG that copies the vars from one pkg to another without
dnl re-checking. As long as all deps were found, pkg will be marked found,
@@ -14,22 +16,21 @@ dnl Also, to help other macros: if there are no deps, pkg is marked NOT FOUND.
AC_DEFUN([AX_GROUP_PKG],
[AC_MSG_CHECKING([for package $1])
- m4_define([pkg], m4_toupper([[$1]]))
+ m4_pushdef([pkg], my_toupper([$1]))
AS_VAR_PUSHDEF([have_pkg], [HAVE_PKG_]pkg)
AS_VAR_PUSHDEF([pkg_c], [PKG_]pkg[_CPPFLAGS])
AS_VAR_PUSHDEF([pkg_l], [PKG_]pkg[_LIBS])
AS_VAR_PUSHDEF([missing], [ax_group_pkg_missing_deps])
AS_VAR_PUSHDEF([bool], [ax_group_pkg_have_pkg_bool])
- AC_DIVERT_PUSH(AX_DIVERSION_PROCESS_OPTIONS)dnl
- AC_ARG_WITH(m4_tolower([[$1]]),
- AC_HELP_STRING([--with-]m4_tolower([[$1]]), [enable searching for the $1 package @<:@auto@:>@]),
+ m4_divert_once([INIT_PREPARE], [dnl
+ AC_ARG_WITH(my_tolower([$1]),
+ AS_HELP_STRING([--with-]my_tolower([$1]), [look for the $1 package]),
[ have_pkg=$withval ]
- )
- AC_DIVERT_POP()dnl
+ )])
missing=""
- m4_if([$2], [], [have_pkg=[no_deps]], AX_LOAD_DEPS(pkg, m4_toupper([[$2]]), missing))
+ m4_if([$2], [], [have_pkg=[no_deps]], AX_LOAD_DEPS(pkg, my_toupper([$2]), missing))
AS_IF([test x"$have_pkg" = "xno"], [AS_VAR_SET([bool], 0); AC_MSG_RESULT([no (disabled by user)])],
[AS_IF([test x"$have_pkg" = "xno_deps"], [AS_VAR_SET([bool], 0); AC_MSG_RESULT([no])],
@@ -48,7 +49,7 @@ AC_DEFUN([AX_GROUP_PKG],
AS_VAR_POPDEF([pkg_l])
AS_VAR_POPDEF([pkg_c])
AS_VAR_POPDEF([have_pkg])
- m4_undefine([pkg])
+ m4_popdef([pkg])
])
AC_DEFUN([AX_DISABLE_PKG], [AX_GROUP_PKG([$1])])
View
22 m4/ax_load_deps.m4
@@ -1,31 +1,25 @@
dnl __BEGIN_LICENSE__
-dnl Copyright (C) 2006-2009 United States Government as represented by
+dnl Copyright (C) 2006-2010 United States Government as represented by
dnl the Administrator of the National Aeronautics and Space Administration.
dnl All Rights Reserved.
dnl __END_LICENSE__
+m4_ifdef([_AX_FIXUPS], [], [m4_include([m4/fixups.m4])])
+
dnl AX_LOAD_DEPS(<pkg>, <deps>[, <missing>])
dnl copies deps into the pkg CPPFLAGS/LIBS
dnl missing could be a shell var name in which to store
dnl the names of the missing deps. missing is NOT cleared
-dnl this was introduced in autoconf 2.6, i think.
-m4_ifset([m4_foreach_w], [],
-[m4_define([m4_foreach_w],[m4_foreach([$1], m4_split(m4_normalize([$2])), [$3])])])
-
AC_DEFUN([AX_LOAD_DEPS],
- [AS_VAR_PUSHDEF([pkg_c], [PKG_]m4_toupper([[$1]])[_CPPFLAGS])
- AS_VAR_PUSHDEF([pkg_l], [PKG_]m4_toupper([[$1]])[_LIBS])
- AS_VAR_PUSHDEF([missing], m4_default([$3], [ax_load_deps_missing_deps]))
+ [m4_pushdef([missing], m4_default([$3], [ax_load_deps_missing_deps]))
- m4_foreach_w(dep, m4_toupper([[$2]]),
+ m4_foreach_w(dep, [$2],
[AS_IF([test x"$HAVE_PKG_]dep[" != "xyes"], [missing="$missing dep"],
- [pkg_c="$PKG_]dep[_CPPFLAGS $pkg_c"
- pkg_l="$pkg_l $PKG_]dep[_LIBS"])
+ [PKG_$1_CPPFLAGS="$PKG_]dep[_CPPFLAGS $PKG_$1_CPPFLAGS"
+ PKG_$1_LIBS="$PKG_$1_LIBS $PKG_]dep[_LIBS"])
])
- AS_VAR_POPDEF([missing])
- AS_VAR_POPDEF([pkg_l])
- AS_VAR_POPDEF([pkg_c])
+ m4_popdef([missing])
])
View
19 m4/ax_module.m4
@@ -5,6 +5,8 @@ dnl All Rights Reserved.
dnl __END_LICENSE__
+m4_ifdef([_AX_FIXUPS], [], [m4_include([m4/fixups.m4])])
+
# Usage: AX_MODULE(<name>, <directory>, <library>, <default>, <prerequisites>, <required dependencies>[, <optional dependencies>])
AC_DEFUN([AX_MODULE],
[
@@ -38,7 +40,7 @@ AC_DEFUN([AX_MODULE],
HAVE_PKG_$1_SRC=yes
- AC_DIVERT_PUSH(AX_DIVERSION_PROCESS_OPTIONS)dnl
+ m4_divert_once([INIT_PREPARE], [dnl
# Silently ignore modules that don't exist in this distribution
# I'm diverting the output, so i need to do this twice.
if test -d "$srcdir/$2" ; then
@@ -46,14 +48,13 @@ AC_DEFUN([AX_MODULE],
if test -n "$ENABLE_MODULE_$1"; then
WANT_MODULE_$1="$ENABLE_MODULE_$1"
fi
-
- AC_ARG_ENABLE([module-]m4_tolower([[$1]]),
- AC_HELP_STRING([--enable-module-]m4_tolower([[$1]]), [enable the $1 module @<:@$4@:>@]),
- [ ENABLE_MODULE_$1=$enableval; WANT_MODULE_$1=$enableval; ],
- [ if test x"$ENABLE_MODULE_$1" = x; then ENABLE_MODULE_$1=`/bin/echo -n $4 | tr [A-Z] [a-z]` ; fi ]
- )
fi
- AC_DIVERT_POP()dnl
+
+ AC_ARG_ENABLE([module-]my_tolower([$1]),
+ AS_HELP_STRING([--enable-module-]my_tolower([$1]), [enable the $1 module @<:@$4@:>@]),
+ [ ENABLE_MODULE_$1=$enableval; WANT_MODULE_$1=$enableval; ],
+ [ if test x"$ENABLE_MODULE_$1" = x; then ENABLE_MODULE_$1=`/bin/echo -n $4 | tr [A-Z] [a-z]` ; fi ]
+ )])
AC_MSG_CHECKING([whether to build module $1])
ax_module_enable=$ENABLE_MODULE_$1
@@ -72,7 +73,7 @@ AC_DEFUN([AX_MODULE],
PKG_$1_LIBS="$PKG_$1_LIBS `var_uniq \`get_rpath ${PKG_$1_LIBS}\``"
fi
MODULE_$1_LIBS="$PKG_$1_LIBS"
- m4_ifval([$3], [PKG_$1_LIBS="$PKG_$1_LIBS \$(top_builddir)/$2/$3"])
+ m4_ifval([$3], [PKG_$1_LIBS="\$(top_builddir)/$2/$3 $PKG_$1_LIBS"])
AC_MSG_RESULT([yes])])])
AS_VAR_POPDEF([missing])
View
13 m4/ax_pkg.m4
@@ -1,20 +1,21 @@
dnl __BEGIN_LICENSE__
-dnl Copyright (C) 2006-2009 United States Government as represented by
+dnl Copyright (C) 2006-2010 United States Government as represented by
dnl the Administrator of the National Aeronautics and Space Administration.
dnl All Rights Reserved.
dnl __END_LICENSE__
+m4_ifdef([_AX_FIXUPS], [], [m4_include([m4/fixups.m4])])
+
dnl Usage: AX_PKG(<name>, <dependencies>, <libraries>, <headers>[, <relative include path>, <relative lib path>, <required-functions>])
AC_DEFUN([AX_PKG],
[
- AC_DIVERT_PUSH(AX_DIVERSION_PROCESS_OPTIONS)dnl
- AC_ARG_WITH(m4_tolower([[$1]]),
- AC_HELP_STRING([--with-]m4_tolower([[$1]]), [enable searching for the $1 package @<:@auto@:>@]),
+ m4_divert_once([INIT_PREPARE], [dnl
+ AC_ARG_WITH(my_tolower([$1]),
+ AS_HELP_STRING([--with-]my_tolower([$1]), [look for the $1 package]),
[ HAVE_PKG_$1=$withval ]
- )
- AC_DIVERT_POP()dnl
+ )])
ADD_$1_CPPFLAGS="$PKG_$1_CPPFLAGS"
PKG_$1_CPPFLAGS=""
View
17 m4/ax_pkg_apple.m4
@@ -1,32 +1,33 @@
dnl __BEGIN_LICENSE__
-dnl Copyright (C) 2006-2009 United States Government as represented by
+dnl Copyright (C) 2006-2010 United States Government as represented by
dnl the Administrator of the National Aeronautics and Space Administration.
dnl All Rights Reserved.
dnl __END_LICENSE__
+m4_ifdef([_AX_FIXUPS], [], [m4_include([m4/fixups.m4])])
+
dnl Usage: AX_PKG_APPLE(<name>, <dependencies>, <ldflags>)
dnl This is an AX_PKG for apple-specific packages.
AC_DEFUN([AX_PKG_APPLE],
[
- AS_VAR_PUSHDEF([pkg], [APPLE_]m4_toupper([[$1]]))
+ AS_VAR_PUSHDEF([pkg], [APPLE_]my_toupper([$1]))
AS_VAR_PUSHDEF([have_pkg], [HAVE_PKG_]pkg)
AS_VAR_PUSHDEF([pkg_c], [PKG_]pkg[_CPPFLAGS])
AS_VAR_PUSHDEF([pkg_l], [PKG_]pkg[_LIBS])
AS_VAR_PUSHDEF([bool], [ax_pkg_apple_have_pkg_bool])
- AC_DIVERT_PUSH(AX_DIVERSION_PROCESS_OPTIONS)dnl
- AC_ARG_WITH(m4_tolower(pkg),
- AC_HELP_STRING([--with-]m4_tolower(pkg), [enable searching for the pkg package @<:@auto@:>@]),
+ m4_divert_once([INIT_PREPARE], [dnl
+ AC_ARG_WITH([apple_]my_tolower([$1]),
+ AS_HELP_STRING([--with-apple_]my_tolower([$1]), [look for the APPLE_$1 package]),
[ HAVE_PKG_pkg=$withval ]
- )
- AC_DIVERT_POP()dnl
+ )])
AC_MSG_CHECKING(for package pkg)
AS_IF([test x"$host_vendor" != "xapple"], [ bool=0; AC_MSG_RESULT([no]) ],
[AS_VAR_PUSHDEF([missing], [ax_pkg_apple_missing_deps])
- AX_LOAD_DEPS(pkg, m4_toupper([[$2]]), missing)
+ AX_LOAD_DEPS(pkg, my_toupper([$2]), missing)
pkg_l="$pkg_l $3"
View
118 m4/ax_pkg_boost.m4
@@ -1,25 +1,24 @@
dnl __BEGIN_LICENSE__
-dnl Copyright (C) 2006-2009 United States Government as represented by
+dnl Copyright (C) 2006-2010 United States Government as represented by
dnl the Administrator of the National Aeronautics and Space Administration.
dnl All Rights Reserved.
dnl __END_LICENSE__
-# Usage: AX_PKG_BOOST
+m4_ifdef([_AX_FIXUPS], [], [m4_include([m4/fixups.m4])])
+
+# Usage: AX_PKG_BOOST(<required boost libs> [,boost_lib, how-to-detect-lib]*)
AC_DEFUN([AX_PKG_BOOST],
[
- AC_DIVERT_PUSH(AX_DIVERSION_PROCESS_OPTIONS)dnl
+ m4_divert_once([INIT_PREPARE], [dnl
AC_ARG_WITH(boost,
- AC_HELP_STRING([--with-boost], [enable searching for the boost package @<:@auto@:>@]),
+ AS_HELP_STRING([--with-boost], [look for the boost package]),
[ HAVE_PKG_BOOST=$withval ]
- )
- AC_DIVERT_POP()dnl
-
- AC_MSG_CHECKING(for package BOOST)
+ )])
AC_LANG_ASSERT(C++)
- 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
+ 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}"
else
PKG_PATHS_BOOST="${PKG_PATHS}"
@@ -27,88 +26,69 @@ AC_DEFUN([AX_PKG_BOOST],
# Skip testing if the user has overridden
if test "no" = "$HAVE_PKG_BOOST"; then
- AC_MSG_RESULT([no (disabled by user)])
+ HAVE_PKG_BOOST="no:disabled by user"
elif test x"${HAVE_PKG_BOOST#no:}" != "x$HAVE_PKG_BOOST"; then # read as: if has_prefix(HAVE_PKG_BOOST, "no:")
- dnl { and } break AC_MSG_RESULT
- reason="${HAVE_PKG_BOOST#no:}"
- AC_MSG_RESULT([no ($reason)])
- HAVE_PKG_BOOST=no
+ :
else
- PKG_BOOST_CPPFLAGS=
- PKG_BOOST_LIBS=
HAVE_PKG_BOOST=no
- 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
- 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}"
- HAVE_PKG_BOOST="yes"
- else
- # 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
+ boost_base_path_glob="${ax_boost_base_path}/include/boost-*"
+ for ax_boost_inc_path in ${ax_boost_base_path}/include `echo ${boost_base_path_glob} | xargs -n1 | sort -r` ; do
+ AX_LOG([Checking for a boost in ${ax_boost_inc_path}])
+ if test -f "${ax_boost_inc_path}/boost/version.hpp"; then
+ AC_MSG_NOTICE([Checking if Boost at ${ax_boost_inc_path}/boost is OK])
- 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
+ AX_EXTRACT_CPP_SYMBOL([BOOST_VERSION], [#include <boost/version.hpp>], [BOOST_VERSION=$output],
+ [AX_LOG([Couldn't get boost version for $ax_boost_inc_path/boost]); continue;],
+ ["-I${ax_boost_inc_path}"])
- CPPFLAGS="$ax_pkg_old_cppflags -I${PKG_BOOST_INCDIR}"
- LDFLAGS="$ax_pkg_old_ldflags -L${PKG_BOOST_LIBDIR}"
+ AX_LOG([Found boost includes at ${ax_boost_inc_path}, version(${BOOST_VERSION})])
- echo "#include <boost/version.hpp>" > conftest.h
+ PKG_BOOST_INCDIR="${ax_boost_inc_path}"
+ PKG_BOOST_LIBDIR="${ax_boost_base_path}/${AX_LIBDIR}"
- dnl check for the header
- dnl otherwise, check next path
- AC_LINK_IFELSE(
- AC_LANG_PROGRAM([#include "conftest.h"],[]),
- [ HAVE_PKG_BOOST=yes; break; ])
+ # 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="no"
- unset PKG_BOOST_INCDIR
- unset PKG_BOOST_LIBDIR
+ m4_for([idx], 3, $#, 2, [m4_do(m4_argn(idx, $@)) ])
- fi
+ missing=
+ AC_FOREACH([required], $1,
+ [AS_IF([test x"$HAVE_PKG_]required[" != "xyes"], [missing="${missing} required"])
+ ])
+ AS_IF([test -n "$missing"], [AC_MSG_NOTICE([${ax_boost_inc_path}/boost is missing these required libraries: $missing]); continue;],
+ [
+ HAVE_PKG_BOOST="yes"
+ break 2
+ ])
+ fi
+ done
done
- CPPFLAGS="$ax_pkg_old_cppflags"
- LDFLAGS="$ax_pkg_old_ldflags"
-
- AC_MSG_RESULT([$HAVE_PKG_BOOST])
-
fi
+ AC_MSG_CHECKING(for package 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}"
- OTHER_CPPFLAGS="${OTHER_CPPFLAGS} ${PKG_BOOST_CPPFLAGS}"
- OTHER_LDFLAGS="${OTHER_LDFLAGS} ${PKG_BOOST_LIBS}"
+ OTHER_CPPFLAGS="${OTHER_CPPFLAGS} -I${PKG_BOOST_INCDIR}"
+ OTHER_LDFLAGS="${OTHER_LDFLAGS} -L${PKG_BOOST_LIBDIR}"
+ AC_MSG_RESULT([yes])
+ elif test x"${HAVE_PKG_BOOST#no:}" != "x$HAVE_PKG_BOOST"; then # read as: if has_prefix(HAVE_PKG_BOOST, "no:")
+ dnl { and } break AC_MSG_RESULT
+ reason="${HAVE_PKG_BOOST#no:}"
+ AC_MSG_RESULT([no ($reason)])
else
+ HAVE_PKG_BOOST=no
ax_have_pkg_bool=0
+ AC_MSG_RESULT([no])
fi
+
AC_DEFINE_UNQUOTED([HAVE_PKG_BOOST],
[$ax_have_pkg_bool],
[Define to 1 if the BOOST package is available.])
View
24 m4/ax_pkg_boost_check_version.m4
@@ -1,5 +1,5 @@
dnl __BEGIN_LICENSE__
-dnl Copyright (C) 2006-2009 United States Government as represented by
+dnl Copyright (C) 2006-2010 United States Government as represented by
dnl the Administrator of the National Aeronautics and Space Administration.
dnl All Rights Reserved.
dnl __END_LICENSE__
@@ -9,32 +9,10 @@ dnl __END_LICENSE__
# config-prefix should be the same as was used above
AC_DEFUN([AX_PKG_BOOST_CHECK_VERSION],
[
- boost_check_save_CPPFLAGS="$CPPFLAGS"
- boost_check_save_LDFLAGS="$LDFLAGS"
-
- CPPFLAGS="$PKG_BOOST_CPPFLAGS"
- LDFLAGS="$PKG_BOOST_LDFLAGS"
-
- AC_RUN_IFELSE(
- [AC_LANG_PROGRAM([[
- #include <fstream>
- #include <boost/version.hpp>
- ]], [[
- std::ofstream out("conftest.out");
- if (!out.is_open())
- return 1;
- out << BOOST_VERSION;
- ]])],
- [BOOST_VERSION=`cat conftest.out`],
- [AC_MSG_ERROR([Failed to run Boost version check program])])
-
if test -z "$BOOST_VERSION"; then
AC_MSG_ERROR([Boost version check program did not define BOOST_VERSION])
fi
- CPPFLAGS="$boost_check_save_CPPFLAGS"
- LDFLAGS="$boost_check_save_LDFLAGS"
-
AC_DEFINE_UNQUOTED([BOOST_VERSION],
[$BOOST_VERSION],
[The version of Boost with which the software built.])
View
130 m4/ax_pkg_boost_lib.m4
@@ -1,10 +1,14 @@
dnl __BEGIN_LICENSE__
-dnl Copyright (C) 2006-2009 United States Government as represented by
+dnl Copyright (C) 2006-2010 United States Government as represented by
dnl the Administrator of the National Aeronautics and Space Administration.
dnl All Rights Reserved.
dnl __END_LICENSE__
+m4_ifdef([_AX_FIXUPS], [], [m4_include([m4/fixups.m4])])
+
+m4_pattern_allow([^PKG_BOOST_SAME_SUFFIX])
+
dnl Here's a new version of AX_PKG_BOOST_LIB designed to find the
dnl multithreaded boost libraries and boost libraries that are just weirdly
dnl named in general. Boost libraries follow a weird naming convention
@@ -19,7 +23,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>, <other-headers>])
+# Usage: AX_PKG_BOOST_LIB(<name>, <libraries>, <header>, <function>[, <dep-libs>, <other-headers>])
AC_DEFUN([AX_PKG_BOOST_LIB],
[
AC_MSG_CHECKING(for package BOOST_$1)
@@ -31,72 +35,92 @@ AC_DEFUN([AX_PKG_BOOST_LIB],
HAVE_PKG_BOOST_$1=no
+ module=no eval BOOST_LIB_SUFFIX=$shrext_cmds
+
# Check for general Boost presence
- if test "x${HAVE_PKG_BOOST}" = "xyes" ; then
- # Check for required headers
- AX_FIND_FILES([$3],[${PKG_BOOST_INCDIR}])
- if test ! -z "$ax_find_files_path" ; then
- # Check for required libraries with no suffix, aside from the one
- # given by environment variable.
- AX_FIND_FILES([`echo $2 | sed "s/-l\([[^[:space:]]]*\)/lib\1${BOOST_LIBRARIES_SUFFIX}.*/g"`],[$PKG_BOOST_LIBDIR])
- if test ! -z "$ax_find_files_path" ; then
- HAVE_PKG_BOOST_$1="yes"
- ax_pkg_boost_lib=`echo $2 | sed "s/\(-l[[^[:space:]]]*\)/\1${BOOST_LIBRARIES_SUFFIX}/g"`
- PKG_BOOST_$1_LIBS="$PKG_BOOST_LIBS $ax_pkg_boost_lib $4"
+ if test -n "$PKG_BOOST_INCDIR" -a -n "$PKG_BOOST_LIBDIR"; then
+
+ m4_ifval([$2], [
+ boost_name="$2"
+ boost_name="${boost_name#-l}"
+ # The SAME_SUFFIX macro is sticky from the previously-searched-for boost lib.
+ # They should all have the same suffix.
+ if test -n "${PKG_BOOST_SAME_SUFFIX}"; then
+ AX_LOG([Reusing suffix ${PKG_BOOST_SAME_SUFFIX}])
+ libglob="${PKG_BOOST_LIBDIR}/lib${boost_name}${PKG_BOOST_SAME_SUFFIX}"
+ boost_want_suffix=
else
- # Check for required libraries with some suffix. We have to check
- # for both a suffix before ${BOOST_LIBRARIES_SUFFIX} (pre-suffix)
- # and a suffix after (for example) the -mt (post-suffix), because
- # boost likes to stick the name of the compiler before the -mt.
- # Extremely annoying.
-
- ax_pkg_boost_lib=`echo $2 | awk '{print [$]1}' | sed 's/-l\([[^[:space:]-]]*\).*/lib\1/g'`
- ax_pkg_boost_file=`ls ${PKG_BOOST_LIBDIR}/${ax_pkg_boost_lib}-*${BOOST_LIBRARIES_SUFFIX}${BOOST_LIBRARIES_SUFFIX:+*} | head -n 1 | sed "s,^${PKG_BOOST_LIBDIR}/\(.*\),\1,"`
-
- # The pre-suffix.
- ax_pkg_boost_presuffix=`echo ${ax_pkg_boost_file} | sed "s/${ax_pkg_boost_lib}\([[^.]]*\)${BOOST_LIBRARIES_SUFFIX}.*/\1/"`
-
- # The post-suffix.
- ax_pkg_boost_postsuffix=`echo ${ax_pkg_boost_file} | sed "s/${ax_pkg_boost_lib}${ax_pkg_boost_presuffix}${BOOST_LIBRARIES_SUFFIX}\([[^.]]*\).*/\1/"`
-
- AX_FIND_FILES([`echo $2 | sed "s/-l\([[^[:space:]]]*\)/lib\1${ax_pkg_boost_presuffix}${BOOST_LIBRARIES_SUFFIX}${ax_pkg_boost_postsuffix}.*/g"`],[$PKG_BOOST_LIBDIR])
- if test ! -z $ax_find_files_path ; then
- HAVE_PKG_BOOST_$1="yes"
- PKG_BOOST_$1_LIBS=`echo $2 | sed "s/[[^ ]]*/&${ax_pkg_boost_presuffix}${BOOST_LIBRARIES_SUFFIX}${ax_pkg_boost_postsuffx}/g"`
- PKG_BOOST_$1_LIBS="$PKG_BOOST_LIBS $PKG_BOOST_$1_LIBS $4"
+ AX_LOG([No known suffix. Figuring one out.])
+ libglob="${PKG_BOOST_LIBDIR}/lib${boost_name}*${BOOST_LIB_SUFFIX:-.so}*"
+ # If they ask for a suffix, look for it first
+ if test -n "${BOOST_LIBRARIES_SUFFIX}"; then
+ boost_want_suffix="${PKG_BOOST_LIBDIR}/lib${boost_name}${BOOST_LIBRARIES_SUFFIX}${BOOST_LIB_SUFFIX:-.so}*"
+ else
+ boost_want_suffix=
fi
fi
- fi
- fi
- fi
+ ])
+
+ ax_pkg_old_cppflags="$CPPFLAGS"
+ ax_pkg_old_libs="$LIBS"
+
+ m4_ifval([$2], [
+ dnl first try the requested suffix, then try in descending filename
+ dnl length, descending asciibetically. For boost, longer filenames
+ dnl mean they probably have more information (maybe version?). In this
+ dnl scheme, we prefer longer filenames to shorter ones, and greater
+ dnl version numbers to lesser ones.
+ for boost_libpath in $boost_want_suffix `for i in ${libglob}; do echo "${#i} $i"; done | sort -nr | cut -d ' ' -f 2`; do
+ ], [
+ for boost_libpath in boost_header_only; do
+ ])
+
+ AX_LOG([Checking to see if $boost_libpath works])
+ m4_ifval([$2], [
+ dnl If the glob doesn't expand, we'll get the same path back. Check for that.
+ AS_IF([test ! -f ${boost_libpath}], [continue])
+ dnl for libboost_library_name-blah-pants.so.4.3.5
+ dnl stem is libboost_library_name-blah-pants
+ boost_lib_stem="`basename ${boost_libpath%${BOOST_LIB_SUFFIX:-.so}*}`"
+ dnl post is .so.4.3.5
+ boost_lib_post="${boost_libpath#*${boost_lib_stem}}"
+ dnl and suffix is -blah-pants.so.4.3.5
+ PKG_BOOST_SAME_SUFFIX="${boost_lib_stem#lib${boost_name}}${boost_lib_post}"
+ PKG_BOOST_$1_LIBS="-L${PKG_BOOST_LIBDIR} -l${boost_lib_stem#lib} $5"
+
+ if test ! -z "${PKG_BOOST_$1_MORE_LIBS}"; then
+ AX_LOG([APPEND: BOOST_]$1[ libs ($PKG_BOOST_]$1[_LIBS) with $PKG_BOOST_]$1[_MORE_LIBS])
+ PKG_BOOST_$1_LIBS="$PKG_BOOST_$1_LIBS $PKG_BOOST_$1_MORE_LIBS"
+ fi
+
+ AX_LOG([Using suffix ${PKG_BOOST_SAME_SUFFIX}])
+ ])
- # Check to make sure we found a working one
- ax_pkg_old_cppflags="$CPPFLAGS"
- ax_pkg_old_libs="$LIBS"
+ PKG_BOOST_$1_CPPFLAGS="-I${PKG_BOOST_INCDIR}"
- 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
+ # Check to make sure we found a working one
+ CPPFLAGS="$ax_pkg_old_cppflags $PKG_BOOST_$1_CPPFLAGS"
+ LIBS="$ax_pkg_old_libs $PKG_BOOST_$1_LIBS"
- CPPFLAGS="$CPPFLAGS $PKG_BOOST_CPPFLAGS"
- LIBS="$LIBS $PKG_BOOST_$1_LIBS"
+ AC_LINK_IFELSE(
+ AC_LANG_PROGRAM(m4_foreach_w([header], [$6 $3], [@%:@include <header>
+]), [[$4]]), [ HAVE_PKG_BOOST_$1=yes; break; ], [ continue ] )
+ done
- AC_LINK_IFELSE(
- AC_LANG_PROGRAM([#include "conftest.h"],[]),
- [ HAVE_PKG_BOOST_$1=yes ], [ HAVE_PKG_BOOST_$1=no ] )
+ CPPFLAGS="$ax_pkg_old_cppflags"
+ LIBS="$ax_pkg_old_libs"
- CPPFLAGS="$ax_pkg_old_cppflags"
- LIBS="$ax_pkg_old_libs"
+ fi # PKG_BOOST_INCDIR/LIBDIR set.
+ fi # User override
AC_MSG_RESULT([$HAVE_PKG_BOOST_]$1)
if test "${HAVE_PKG_BOOST_$1}" = "yes" ; then
ax_have_pkg_bool=1
else
+ PKG_BOOST_SAME_SUFFIX=
+ PKG_BOOST_$1_CPPFLAGS=
+ PKG_BOOST_$1_LIBS=
ax_have_pkg_bool=0
fi
AC_DEFINE_UNQUOTED([HAVE_PKG_BOOST_$1],
View
2 m4/ax_pkg_one_of.m4
@@ -1,5 +1,5 @@
dnl __BEGIN_LICENSE__
-dnl Copyright (C) 2006-2009 United States Government as represented by
+dnl Copyright (C) 2006-2010 United States Government as represented by
dnl the Administrator of the National Aeronautics and Space Administration.
dnl All Rights Reserved.
dnl __END_LICENSE__
View
2 m4/ax_pkg_pthreads.m4
@@ -1,5 +1,5 @@
dnl __BEGIN_LICENSE__
-dnl Copyright (C) 2006-2009 United States Government as represented by
+dnl Copyright (C) 2006-2010 United States Government as represented by
dnl the Administrator of the National Aeronautics and Space Administration.
dnl All Rights Reserved.
dnl __END_LICENSE__
View
35 m4/fixups.m4
@@ -0,0 +1,35 @@
+dnl __BEGIN_LICENSE__
+dnl Copyright (C) 2006-2010 United States Government as represented by
+dnl the Administrator of the National Aeronautics and Space Administration.
+dnl All Rights Reserved.
+dnl __END_LICENSE__
+
+
+dnl caller must protect themselves from multiple inclusion
+dnl m4_ifdef([_AX_FIXUPS], [], [m4_exclude([fixups.m4])])
+dnl ^--- this code isn't quite right; the correct code is "include", not "exclude".
+dnl automake 1.9.? will break on includes inside comments.
+
+dnl 2.65 added an additional level of quoting for upper and lower
+m4_pushdef([AAA],[---])dnl
+m4_if(m4_tolower([aaa]), [---],
+ [m4_define([my_tolower], [m4_tolower([[$1]])])],
+ [m4_copy([m4_tolower], [my_tolower])])
+m4_popdef([AAA])
+
+m4_pushdef([AAA],[---])dnl
+m4_if(m4_toupper([aaa]), [---],
+ [m4_define([my_toupper], [m4_toupper([[$1]])])],
+ [m4_copy([m4_toupper], [my_toupper])])
+m4_popdef([AAA])
+
+dnl this was introduced in autoconf 2.6, i think.
+m4_ifset([m4_foreach_w], [],
+[m4_define([m4_foreach_w],[m4_foreach([$1], m4_split(m4_normalize([$2])), [$3])])])
+
+m4_ifset([m4_argn], [],
+[m4_define([m4_argn],
+[m4_car(m4_shiftn($1, $@))])])
+
+
+m4_define([_AX_FIXUPS], [1])

0 comments on commit bf8e60a

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