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);
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
--- /dev/null
+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.])
+ ])
+])