-dnl Check for the proper way to build libraries that have no undefined
-dnl symbols; on some hosts this needs to be avoided but the macro
-dnl takes care of it.
-CC_NOUNDEFINED
-
-dnl Check whether to build tests by default (as compile-test) or not
-AC_ARG_ENABLE([default-build-tests],
- AS_HELP_STRING([--disable-default-build-tests], [Build test programs only during make check]))
-
-AM_CONDITIONAL([BUILD_TESTS_DEFAULT], [test "x$enable_default_build_tests" != "xno"])
+# Check for the proper way to build libraries that have no undefined symbols
+case $host in
+ # FreeBSD (et al.) does not complete linking for shared objects when pthreads
+ # are requested, as different implementations are present.
+ *-freebsd* | *-openbsd*) ;;
+ *)
+ for possible_flag in "-Wl,--no-undefined" "-Wl,-z,defs"; do
+ AX_CHECK_LINK_FLAG([$possible_flag], [NOUNDEFINED_LDFLAGS="$possible_flag"; break])
+ done
+ ;;
+esac
+AC_SUBST([NOUNDEFINED_LDFLAGS])