[svn] commit: r112 - in /branches/jinmei-cppunittests: configure configure.ac

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Oct 20 23:28:30 UTC 2009


Author: jinmei
Date: Tue Oct 20 23:28:30 2009
New Revision: 112

Log:
supported different types of boost test libs

Modified:
    branches/jinmei-cppunittests/configure
    branches/jinmei-cppunittests/configure.ac

Modified: branches/jinmei-cppunittests/configure
==============================================================================
--- branches/jinmei-cppunittests/configure (original)
+++ branches/jinmei-cppunittests/configure Tue Oct 20 23:28:30 2009
@@ -1682,6 +1682,52 @@
   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
 } # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  return $ac_retval
+
+} # ac_fn_c_try_link
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
@@ -4560,6 +4606,7 @@
 then
 	BOOST_INCLUDES="-I${boost_path}/include"
 	BOOST_LDFLAGS="-L${boost_path}/lib"
+	LIBS="${BOOST_LDFLAGS} ${LIBS}"
 else
 	BOOST_INCLUDES=
 	BOOST_LDFLAGS=
@@ -4578,7 +4625,82 @@
 
 if test "$use_boosttest" != "no"
 then
-BOOSTTEST_LDADD="-lboost_unit_test_framework-mt"
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lboost_unit_test_framework" >&5
+$as_echo_n "checking for main in -lboost_unit_test_framework... " >&6; }
+if test "${ac_cv_lib_boost_unit_test_framework_main+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lboost_unit_test_framework  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+return main ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_boost_unit_test_framework_main=yes
+else
+  ac_cv_lib_boost_unit_test_framework_main=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_boost_unit_test_framework_main" >&5
+$as_echo "$ac_cv_lib_boost_unit_test_framework_main" >&6; }
+if test "x$ac_cv_lib_boost_unit_test_framework_main" = x""yes; then :
+  BOOST_LIBFILE=boost_unit_test_framework
+fi
+
+	if test "X$BOOST_LIBFILE" = X
+	then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lboost_unit_test_framework-mt" >&5
+$as_echo_n "checking for main in -lboost_unit_test_framework-mt... " >&6; }
+if test "${ac_cv_lib_boost_unit_test_framework_mt_main+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lboost_unit_test_framework-mt  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+return main ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_boost_unit_test_framework_mt_main=yes
+else
+  ac_cv_lib_boost_unit_test_framework_mt_main=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_boost_unit_test_framework_mt_main" >&5
+$as_echo "$ac_cv_lib_boost_unit_test_framework_mt_main" >&6; }
+if test "x$ac_cv_lib_boost_unit_test_framework_mt_main" = x""yes; then :
+  BOOST_LIBFILE=boost_unit_test_framework-mt
+fi
+
+	fi
+	if test "X$BOOST_LIBFILE" = X
+	then
+		as_fn_error "function main not found in boost libraries" "$LINENO" 5
+	fi
+	BOOSTTEST_LDADD="-l${BOOST_LIBFILE}"
 
 fi
  if test $use_boosttest != "no"; then

Modified: branches/jinmei-cppunittests/configure.ac
==============================================================================
--- branches/jinmei-cppunittests/configure.ac (original)
+++ branches/jinmei-cppunittests/configure.ac Tue Oct 20 23:28:30 2009
@@ -33,6 +33,7 @@
 then
 	BOOST_INCLUDES="-I${boost_path}/include"
 	BOOST_LDFLAGS="-L${boost_path}/lib"
+	LIBS="${BOOST_LDFLAGS} ${LIBS}"
 else
 	BOOST_INCLUDES=
 	BOOST_LDFLAGS=
@@ -46,8 +47,19 @@
     use_boosttest="$withval", use_boosttest="no")
 if test "$use_boosttest" != "no"
 then
-BOOSTTEST_LDADD="-lboost_unit_test_framework-mt"
-AC_SUBST(BOOSTTEST_LDADD)
+	AC_CHECK_LIB(boost_unit_test_framework, main,
+	BOOST_LIBFILE=boost_unit_test_framework)
+	if test "X$BOOST_LIBFILE" = X
+	then
+		AC_CHECK_LIB(boost_unit_test_framework-mt, main,
+		BOOST_LIBFILE=boost_unit_test_framework-mt)
+	fi
+	if test "X$BOOST_LIBFILE" = X
+	then
+		AC_ERROR([function main not found in boost libraries])
+	fi
+	BOOSTTEST_LDADD="-l${BOOST_LIBFILE}"
+	AC_SUBST(BOOSTTEST_LDADD)
 fi
 AM_CONDITIONAL(USE_BOOSTTEST, test $use_boosttest != "no")
 




More information about the bind10-changes mailing list