From 3cf2faf81f4990d231c42c0151eef6738bf0160c Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 18 Nov 2010 22:24:11 +0000 Subject: Added autodetection to configure for bullet libraries installed in /usr or /usr/local, added --enable-static-bullet option to staticly link the libraries. Updated installation instructions. --- configure.in | 64 ++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 21 deletions(-) (limited to 'configure.in') diff --git a/configure.in b/configure.in index ede99bf..e33b46b 100644 --- a/configure.in +++ b/configure.in @@ -16,6 +16,8 @@ AC_LANG_CPLUSPLUS AC_PROG_CXX AM_PROG_LIBTOOL +AC_CONFIG_MACRO_DIR([m4]) + dnl KDE_FIND_PATH(programm-name, variable-name, list of directories, dnl if-not-found, test-parameter) AC_DEFUN([KDE_FIND_PATH], @@ -150,9 +152,7 @@ dnl AC_MSG_CHECKING(whether to abort on compiler warnings) WARN_CFLAGS="" AC_ARG_ENABLE(warn, - AC_HELP_STRING( - [--disable-warn], [do not abort on compiler warnings] - ), + AC_HELP_STRING([--disable-warn], [do not abort on compiler warnings]), AC_MSG_RESULT(no), AC_MSG_RESULT(yes) WARN_CFLAGS="$WARN_CFLAGS -Wall -Werror" @@ -165,9 +165,7 @@ dnl AC_MSG_CHECKING(whether to include debug messages) AC_ARG_ENABLE(debug_messages, - AC_HELP_STRING( - [--disable-debug-messages], [build without extra debug messages] - ), + AC_HELP_STRING([--disable-debug-messages], [build without extra debug messages]), AC_MSG_RESULT(no), AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_DEBUG_MESSAGES, 1, [Define this to enable debug messages]) @@ -237,35 +235,59 @@ dnl HAVE_BULLET=no +AC_ARG_ENABLE(static_bullet, + AC_HELP_STRING([--enable-static-bullet], [staticly link with bullet physics libraries]), + AC_MSG_RESULT(yes), + STATIC_BULLET="yes" + AC_MSG_RESULT(no) + STATIC_BULLET="no" +) + AC_ARG_WITH(bullet, - AC_HELP_STRING([--with-bullet=DIR], - [use the bullet physics library in DIR (read the documentation)] + AC_HELP_STRING([--with-bullet=PREFIX], + [link with bullet physics library installed in PREFIX] ) ) LD_FLAGS_save="$LD_FLAGS" CPPFLAGS_save="$CPPFLAGS" -AC_MSG_CHECKING(for bullet directory) - -BULLET_DIR="/usr/local" +BULLET_DIRS="/usr/local /usr" if test "x${with_bullet}" != "x"; then - BULLET_DIR="${with_bullet}" + BULLET_DIRS="${with_bullet}" fi -AC_MSG_RESULT([$BULLET_DIR]) -BULLET_CPPFLAGS="-I${BULLET_DIR}/include/bullet" -BULLET_LIBS="$BULLET_DIR/lib/libBulletDynamics.a $BULLET_DIR/lib/libBulletCollision.a $BULLET_DIR/lib/libLinearMath.a" +for dir_to_test in ${BULLET_DIRS}; do + if test "x${BULLET_DIR}" = "x"; then + CPPFLAGS="-I${dir_to_test}/include/bullet" + AC_CHECK_HEADER(btBulletDynamicsCommon.h, + BULLET_DIR="${dir_to_test}", + [] + ) + fi +done + +if test "x${BULLET_DIR}" = "x"; then + AC_MSG_ERROR([bullet physics library not found in ${BULLET_DIRS}]) +fi + +AC_MSG_CHECKING([for bullet prefix]) +AC_MSG_RESULT([${BULLET_DIR}]) + +AC_MSG_CHECKING([if static linking of the bullet libraries is requested]) +if test "x${enable_static_bullet}" = "xyes"; then + BULLET_CPPFLAGS="-I${BULLET_DIR}/include/bullet" + BULLET_LIBS="$BULLET_DIR/lib/libBulletDynamics.a $BULLET_DIR/lib/libBulletCollision.a $BULLET_DIR/lib/libLinearMath.a" + AC_MSG_RESULT([yes]) +else + BULLET_CPPFLAGS="-I${BULLET_DIR}/include/bullet" + BULLET_LIBS="-lBulletDynamics -lBulletCollision -lLinearMath" + AC_MSG_RESULT([no]) +fi CPPFLAGS="$CPPFLAGS_save $BULLET_CPPFLAGS" LD_FLAGS="$LD_FLAGS_save $BULLET_LIBS" -AC_CHECK_HEADER(btBulletDynamicsCommon.h, - AC_DEFINE(HAVE_BULLET, yes, [Define this if you have the bullet physics library]) - HAVE_BULLET="yes", - AC_MSG_ERROR([bullet physics library not found (http://bulletphysics.org)]) -) - CPPFLAGS="$CPPFLAGS_save" LD_FLAGS="$LD_FLAGS_save" -- cgit v1.2.3