Andrew Savchenko

Use proper setup for paranoid options

... and fix some minor bugs for debug options
... ... @@ -4,14 +4,6 @@ clsync_SOURCES = sync.c cluster.c main.c output.c fileutils.c malloc.c
main.o: revision.h
if PARANOID
AM_CPPFLAGS += -DPARANOID
endif
if VERYPARANOID
AM_CPPFLAGS += -DVERYPARANOID
endif
man_MANS = man/man1/clsync.1
doc_DATA = CONTRIB DEVELOPING LICENSE README.md TODO
... ...
... ... @@ -71,12 +71,6 @@
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
#ifdef VERYPARANOID
#ifndef PARANOID
#define PARANOID
#endif
#endif
#ifndef IN_CREATE_SELF
#define IN_CREATE_SELF IN_CREATE
#endif
... ...
... ... @@ -7,32 +7,29 @@ AC_CONFIG_SRCDIR([sync.c])
AM_INIT_AUTOMAKE([1.11 -Wall foreign])
AC_CONFIG_HEADERS([autoconfig.h])
dnl --enable-debug
AC_ARG_ENABLE(debug,
AS_HELP_STRING(--enable-debug,
[enable debugging, default: no]))
dnl -Werror disables std autodetection, so we must specify it here
AS_IF([test "x$enable_debug" = "xyes"],
[CFLAGS+="-pipe -Wall -Werror -ggdb3 -Wno-error=unused-variable"])
[CFLAGS+=" -std=gnu11 -pipe -Wall -Werror -ggdb3 -Wno-error=unused-variable"])
dnl --paranoid-level
AC_ARG_ENABLE(paranoid,
AS_HELP_STRING([--enable-paranoid],
[set paranoid level of code security, default: 1, values: 0, 1, 2]),
[set paranoid level of code security, default: 1, values: 0, 1, 2]),
[case "${enableval}" in
0) paranoid=0 ;;
1) paranoid=1 ;;
2) paranoid=2 ;;
*) AC_MSG_ERROR([bad value ${enableval} for --paranoid-level]) ;;
(0|"no") paranoid=0 ;;
(1|"yes") paranoid=1 ;;
(2) paranoid=2 ;;
(*) AC_MSG_ERROR([bad value ${enableval} for --paranoid-level]) ;;
esac],
[paranoid=1])
AM_CONDITIONAL(PARANOID, test x"$paranoid" = x"1")
AM_CONDITIONAL(VERYPARANOID, test x"$paranoid" = x"2")
AS_IF([test $paranoid -ge 1], [CPPFLAGS+=" -DPARANOID"])
AS_IF([test $paranoid -eq 2], [CPPFLAGS+=" -DVERY_PARANOID"])
# Checks for programs.
AC_PROG_CC_C99
... ...