summaryrefslogtreecommitdiff
path: root/infrastructure/m4/boxbackup_tests.m4
diff options
context:
space:
mode:
Diffstat (limited to 'infrastructure/m4/boxbackup_tests.m4')
-rw-r--r--infrastructure/m4/boxbackup_tests.m466
1 files changed, 42 insertions, 24 deletions
diff --git a/infrastructure/m4/boxbackup_tests.m4 b/infrastructure/m4/boxbackup_tests.m4
index 09d73e04..59467e66 100644
--- a/infrastructure/m4/boxbackup_tests.m4
+++ b/infrastructure/m4/boxbackup_tests.m4
@@ -10,10 +10,30 @@ solaris*)
;;
esac
-if test "x$GXX" = "xyes"; then
- # Use -Wall if we have gcc. This gives better warnings
- AC_SUBST([CXXFLAGS_STRICT], ['-Wall -Wundef -Werror=return-type'])
+# Enable some compiler flags if the compiler supports them. This gives better warnings
+# and detects some problems early.
+AX_CHECK_COMPILE_FLAG(-Wall, [cxxflags_strict="$cxxflags_strict -Wall"])
+# -Wundef would be a good idea, but Boost is full of undefined variable use, so we need
+# to disable it for now so that we can concentrate on real errors:
+dnl AX_CHECK_COMPILE_FLAG(-Wundef, [cxxflags_strict="$cxxflags_strict -Wundef"])
+AX_CHECK_COMPILE_FLAG(-Werror=return-type,
+ [cxxflags_strict="$cxxflags_strict -Werror=return-type"])
+AX_CHECK_COMPILE_FLAG(-Werror=delete-non-virtual-dtor,
+ [cxxflags_strict="$cxxflags_strict -Werror=delete-non-virtual-dtor"])
+AX_CHECK_COMPILE_FLAG(-Werror=undefined-bool-conversion,
+ [cxxflags_strict="$cxxflags_strict -Werror=undefined-bool-conversion"])
+# We should really enable -Werror=sometimes-uninitialized, but QDBM violates it:
+dnl AX_CHECK_COMPILE_FLAG(-Werror=sometimes-uninitialized,
+dnl [cxxflags_strict="$cxxflags_strict -Werror=sometimes-uninitialized"])
+# This error is detected by MSVC, but not usually by GCC/Clang:
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58114
+AX_CHECK_COMPILE_FLAG(-Werror=delete-incomplete,
+ [cxxflags_strict="$cxxflags_strict -Werror=delete-incomplete"])
+AX_CHECK_COMPILE_FLAG(-Wno-deprecated-declarations,
+ [cxxflags_strict="$cxxflags_strict -Wno-deprecated-declarations"])
+AC_SUBST([CXXFLAGS_STRICT], [$cxxflags_strict])
+if test "x$GXX" = "xyes"; then
# Don't check for gcc -rdynamic on Solaris as it's broken, but returns 0.
# On Cygwin it does nothing except cause gcc to emit a warning message.
case $build_os in
@@ -37,7 +57,6 @@ if test "x$GXX" = "xyes"; then
LDFLAGS=$save_LDFLAGS
;;
esac
-
fi
AC_PATH_PROG([PERL], [perl], [AC_MSG_ERROR([[perl executable was not found]])])
@@ -101,7 +120,7 @@ AX_PATH_BDB([1.x or 4.1], [
])
# need to find libdl before trying to link openssl, apparently
-AC_SEARCH_LIBS([dlsym], ["dl"])
+AC_SEARCH_LIBS([dlsym], [dl])
AC_CHECK_FUNCS([dlsym dladdr])
## Check for Open SSL, use old versions only if explicitly requested
@@ -126,20 +145,12 @@ Upgrade or read the documentation for alternatives]])
### Checks for header files.
-case $target_os in
-mingw32*) ;;
-winnt*) ;;
-*)
- AC_HEADER_DIRENT
- ;;
-esac
-
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS([dlfcn.h fcntl.h getopt.h netdb.h process.h pwd.h signal.h])
-AC_CHECK_HEADERS([syslog.h time.h cxxabi.h])
+AC_CHECK_HEADERS([cxxabi.h dirent.h dlfcn.h fcntl.h getopt.h netdb.h process.h pwd.h signal.h])
+AC_CHECK_HEADERS([syslog.h time.h unistd.h])
AC_CHECK_HEADERS([netinet/in.h netinet/tcp.h])
-AC_CHECK_HEADERS([sys/file.h sys/param.h sys/poll.h sys/socket.h sys/time.h])
+AC_CHECK_HEADERS([sys/file.h sys/param.h sys/poll.h sys/socket.h sys/stat.h sys/time.h])
AC_CHECK_HEADERS([sys/types.h sys/uio.h sys/un.h sys/wait.h sys/xattr.h])
AC_CHECK_HEADERS([sys/ucred.h],,, [
#ifdef HAVE_SYS_PARAM_H
@@ -193,11 +204,11 @@ AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
-AC_CHECK_MEMBERS([struct stat.st_flags])
-AC_CHECK_MEMBERS([struct stat.st_atim])
-AC_CHECK_MEMBERS([struct stat.st_atimespec])
-AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec])
-AC_CHECK_MEMBERS([struct stat.st_atimensec])
+AC_CHECK_MEMBERS([struct stat.st_flags],,, [[#include <sys/stat.h>]])
+AC_CHECK_MEMBERS([struct stat.st_atim],,, [[#include <sys/stat.h>]])
+AC_CHECK_MEMBERS([struct stat.st_atimespec],,, [[#include <sys/stat.h>]])
+AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec],,, [[#include <sys/stat.h>]])
+AC_CHECK_MEMBERS([struct stat.st_atimensec],,, [[#include <sys/stat.h>]])
AC_CHECK_MEMBERS([struct sockaddr_in.sin_len],,, [[
#include <sys/types.h>
#include <netinet/in.h>
@@ -206,13 +217,14 @@ AC_CHECK_MEMBERS([DIR.d_fd],,, [[#include <dirent.h>]])
AC_CHECK_MEMBERS([DIR.dd_fd],,, [[#include <dirent.h>]])
AC_CHECK_MEMBERS([struct tcp_info.tcpi_rtt],,, [[#include <netinet/tcp.h>]])
-AC_CHECK_DECLS([O_BINARY])
+AC_CHECK_DECLS([O_BINARY],,, [[#include <fcntl.h>]])
AC_CHECK_DECLS([ENOTSUP],,, [[#include <sys/errno.h>]])
AC_CHECK_DECLS([INFTIM],,, [[#include <poll.h>]])
AC_CHECK_DECLS([SO_PEERCRED],,, [[#include <sys/socket.h>]])
AC_CHECK_DECLS([SOL_TCP],,, [[#include <netinet/tcp.h>]])
AC_CHECK_DECLS([TCP_INFO],,, [[#include <netinet/tcp.h>]])
+AC_CHECK_DECLS([SYS_open, SYS_openat],,, [[#include <sys/syscall.h>]])
if test -n "$have_sys_socket_h"; then
AC_CHECK_DECLS([SO_SNDBUF],,, [[#include <sys/socket.h>]])
@@ -285,7 +297,7 @@ AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_CHECK_FUNCS([ftruncate getpeereid getpeername getpid gettimeofday lchown])
AC_CHECK_FUNCS([setproctitle utimensat])
-AC_SEARCH_LIBS([setproctitle], ["bsd"])
+AC_SEARCH_LIBS([setproctitle], [bsd])
# NetBSD implements kqueue too differently for us to get it fixed by 0.10
# TODO: Remove this when NetBSD kqueue implementation is working. The main
@@ -345,4 +357,10 @@ fi
;;
esac
-
+AC_CHECK_PROGS(default_debugger, [lldb gdb])
+AC_ARG_WITH([debugger],
+ [AS_HELP_STRING([--with-debugger=<gdb|lldb|...>],
+ [use this debugger in t-gdb scripts to debug tests @<:@default=lldb if present, otherwise gdb@:>@])],
+ [],
+ [with_debugger=$default_debugger])
+AC_SUBST([with_debugger])