Browse Source

[master] Configure now supports static boost_system lib with static linking

    Merges branch 'trac5337'
Thomas Markwalder 7 years ago
parent
commit
42548148cb
2 changed files with 18 additions and 2 deletions
  1. 12 0
      configure.ac
  2. 6 2
      m4macros/ax_boost_for_kea.m4

+ 12 - 0
configure.ac

@@ -440,7 +440,19 @@ if test $enable_shared != "no" -a "X$GXX" = "Xyes"; then
    KEA_CXXFLAGS="$KEA_CXXFLAGS -fPIC"
 fi
 
+# Look for glib static libs if they're trying to do static builds
+if test $enable_static_link != "no"; then
+   CXX_SAVED=$CXX
+   CXX="$CXX -static"
 
+   AC_LINK_IFELSE(
+     [AC_LANG_PROGRAM([#include <math.h>],[(void)sqrt(-1.0);])],
+     [AC_MSG_RESULT([checking for static glib libraries... yes])],
+     [AC_MSG_RESULT([checking for static glib libraries... no])
+      AC_MSG_ERROR([Building with --enable-static-link does not work. You appear to be missing glib static libraries. Check config.log for details.])])
+
+   CXX=$CXX_SAVED
+fi
 
 AC_SUBST(KEA_CXXFLAGS)
 

+ 6 - 2
m4macros/ax_boost_for_kea.m4

@@ -196,14 +196,18 @@ if test "x${BOOST_LIBS}" != "x"; then
    LIBS_SAVED="$LIBS"
    LIBS="$BOOST_LIBS $LIBS"
 
+   if test $enable_static_link = yes; then
+       LIBS="-static $LIBS"
+   fi
+
    AC_LINK_IFELSE(
      [AC_LANG_PROGRAM([#include <boost/system/error_code.hpp>],
                       [boost::system::error_code ec;])],
      [AC_MSG_RESULT([checking for Boost system library... yes])],
      [AC_MSG_RESULT([checking for Boost system library... no])
-      AC_MSG_ERROR([Linking with ${BOOST_LIBS} is not enough: please make sure libboost_system is installed])])
+      AC_MSG_ERROR([Linking with ${BOOST_LIBS} is not enough: please make sure libboost_system is installed; Check config.log for details, you may be missing other libraries.])])
 
-    LIBS="$LIBS_SAVED"
+   LIBS="$LIBS_SAVED"
 fi
 
 CXXFLAGS="$CXXFLAGS_SAVED"