From 31048f6090b7c82605d2bbf7653d9884a14fe45b Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Sat, 8 Sep 2012 21:35:56 -0400 Subject: [PATCH] Compiler fixes. --- clients/utilities.h | 4 ++-- configure.ac | 5 ++++- m4/debug.m4 | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 m4/debug.m4 diff --git a/clients/utilities.h b/clients/utilities.h index d036bccc..da973b5f 100644 --- a/clients/utilities.h +++ b/clients/utilities.h @@ -49,10 +49,10 @@ extern "C" { char *strdup_cleanup(const char *str); void cleanup(void); long int timedif(struct timeval a, struct timeval b); -void version_command(const char *command_name); +void version_command(const char *command_name) __attribute__ ((noreturn)); void help_command(const char *command_name, const char *description, const struct option *long_options, - memcached_programs_help_st *options); + memcached_programs_help_st *options) __attribute__ ((noreturn)); void process_hash_option(memcached_st *memc, char *opt_hash); bool initialize_sasl(memcached_st *memc, char *user, char *password); void shutdown_sasl(void); diff --git a/configure.ac b/configure.ac index eeaccd82..83177bca 100644 --- a/configure.ac +++ b/configure.ac @@ -286,8 +286,11 @@ fi AX_CHECK_SOCK_CLOEXEC([AC_DEFINE([HAVE_SOCK_CLOEXEC], [1], [Check for SOCK_CLOEXEC.])], [AC_DEFINE([HAVE_SOCK_CLOEXEC], [0], [Check for SOCK_CLOEXEC.])]) +AX_PTHREAD(, [AC_MSG_ERROR(could not find libpthread)]) + AX_HARDEN_COMPILER_FLAGS -AX_PTHREAD + +AX_DEBUG AC_CONFIG_FILES([ Makefile diff --git a/m4/debug.m4 b/m4/debug.m4 new file mode 100644 index 00000000..60557659 --- /dev/null +++ b/m4/debug.m4 @@ -0,0 +1,18 @@ +AC_DEFUN([AX_DEBUG],[ + AC_ARG_WITH([debug], + [AS_HELP_STRING([--with-debug], + [Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])], + [with_debug=$withval], + [with_debug=no]) + AS_IF([test "$with_debug" = "yes"],[ + # Debugging. No optimization. + AM_CFLAGS="${AM_CFLAGS} ${DEBUG_CFLAGS} -DDEBUG" + AM_CXXFLAGS="${AM_CXXFLAGS} ${DEBUG_CXXFLAGS} -DDEBUG" + AC_DEFINE(DEBUG, [ 1 ], [Define to 1 to enable debugging code.]) + ],[ + # Optimized version. No debug + AM_CFLAGS="${AM_CFLAGS} ${OPTIMIZE_CFLAGS}" + AM_CXXFLAGS="${AM_CXXFLAGS} ${OPTIMIZE_CXXFLAGS}" + AC_DEFINE(DEBUG, [ 0 ], [Define to 1 to enable debugging code.]) + ]) +]) -- 2.30.2