diff --git a/smmapdfw/config.h.in b/smmapdfw/config.h.in index dfe89ab..329eeb1 100644 --- a/smmapdfw/config.h.in +++ b/smmapdfw/config.h.in @@ -1,7 +1,7 @@ /* config.h.in. Generated from configure.ac by autoheader. */ -/* bla */ -#undef DEFAULT_SMMAPD_INI +/* enable verify cache */ +#undef ENABLE_VERIFY_CACHE /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H diff --git a/smmapdfw/configure b/smmapdfw/configure index c948d72..672abe5 100755 --- a/smmapdfw/configure +++ b/smmapdfw/configure @@ -1028,6 +1028,8 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer + --enable-verify-cache Enables the cache in the verify worker. Required a + dbm implemenation. (default) --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] @@ -1829,6 +1831,21 @@ fi ac_config_commands="$ac_config_commands default-1" +ENABLE_VERIFY_CACHE=1 +# Check whether --enable-verify-cache or --disable-verify-cache was given. +if test "${enable_verify_cache+set}" = set; then + enableval="$enable_verify_cache" + if test "x$enableval" = xyes; then ENABLE_VERIFY_CACHE=1; fi + if test "x$enableval" = xno; then ENABLE_VERIFY_CACHE=0; fi + +fi; + +cat >>confdefs.h <<_ACEOF +#define ENABLE_VERIFY_CACHE ${ENABLE_VERIFY_CACHE} +_ACEOF + + + # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -3353,7 +3370,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3356 "configure"' > conftest.$ac_ext + echo '#line 3373 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -4808,7 +4825,7 @@ fi # Provide some information about the compiler. -echo "$as_me:4811:" \ +echo "$as_me:4828:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -5840,11 +5857,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:5843: $lt_compile\"" >&5) + (eval echo "\"\$as_me:5860: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:5847: \$? = $ac_status" >&5 + echo "$as_me:5864: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6073,11 +6090,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6076: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6093: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6080: \$? = $ac_status" >&5 + echo "$as_me:6097: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6133,11 +6150,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6136: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6153: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6140: \$? = $ac_status" >&5 + echo "$as_me:6157: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8321,7 +8338,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:10616: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10603: \$? = $ac_status" >&5 + echo "$as_me:10620: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -10656,11 +10673,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10659: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10676: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10663: \$? = $ac_status" >&5 + echo "$as_me:10680: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12025,7 +12042,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:12970: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12957: \$? = $ac_status" >&5 + echo "$as_me:12974: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13010,11 +13027,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13013: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13030: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13017: \$? = $ac_status" >&5 + echo "$as_me:13034: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15055,11 +15072,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15058: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15075: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15062: \$? = $ac_status" >&5 + echo "$as_me:15079: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15288,11 +15305,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15291: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15308: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15295: \$? = $ac_status" >&5 + echo "$as_me:15312: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15348,11 +15365,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15351: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15368: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15355: \$? = $ac_status" >&5 + echo "$as_me:15372: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17536,7 +17553,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <confcache <<\_ACEOF @@ -21691,7 +21708,6 @@ for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. - "rules.mk" ) CONFIG_FILES="$CONFIG_FILES rules.mk" ;; "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "libsmmapdfw/Makefile" ) CONFIG_FILES="$CONFIG_FILES libsmmapdfw/Makefile" ;; "smmapd/Makefile" ) CONFIG_FILES="$CONFIG_FILES smmapd/Makefile" ;; diff --git a/smmapdfw/configure.ac b/smmapdfw/configure.ac index 4b61f2d..b6637f5 100644 --- a/smmapdfw/configure.ac +++ b/smmapdfw/configure.ac @@ -8,6 +8,18 @@ AM_MAINTAINER_MODE AM_CONFIG_HEADER(config.h) +ENABLE_VERIFY_CACHE=1 +AC_ARG_ENABLE(verify-cache, + [AC_HELP_STRING(--enable-verify-cache, [ + Enables the cache in the verify worker. + Required a dbm implemenation. + (default=yes)])], + if test "x$enableval" = xyes; then ENABLE_VERIFY_CACHE=1; fi + if test "x$enableval" = xno; then ENABLE_VERIFY_CACHE=0; fi +) +AC_DEFINE_UNQUOTED(ENABLE_VERIFY_CACHE, ${ENABLE_VERIFY_CACHE}, [enable verify cache]) + + # Checks for programs. AC_PROG_CC AC_PROG_LIBTOOL @@ -48,6 +60,6 @@ AC_CHECK_FUNCS([inet_ntoa memset select socket strchr strdup strerror strrchr st [AC_MSG_ERROR([*** missing function, we can't go without it])]) -AC_CONFIG_FILES([rules.mk Makefile libsmmapdfw/Makefile smmapd/Makefile modules/test/Makefile modules/verify/Makefile modules/cyrus/Makefile]) +AC_CONFIG_FILES([Makefile libsmmapdfw/Makefile smmapd/Makefile modules/test/Makefile modules/verify/Makefile modules/cyrus/Makefile]) AC_OUTPUT diff --git a/smmapdfw/modules/verify/verify_worker.c b/smmapdfw/modules/verify/verify_worker.c index d802959..9e210d0 100644 --- a/smmapdfw/modules/verify/verify_worker.c +++ b/smmapdfw/modules/verify/verify_worker.c @@ -1,3 +1,9 @@ +#if HAVE_CONFIG_H +# include "config.h" +#endif + + + #include #include #include @@ -8,8 +14,11 @@ #include #include #include + +#if ENABLE_VERIFY_CACHE = 1 #define DB_DBM_HSEARCH 1 #include +#endif #include "containers_public.h" #include "smmapd.h" @@ -252,6 +261,7 @@ int verify_work_destroy(void *handle, void *work_handle) { void cache_insert(verify_container_handle_t *vch, const char *address, int result, const char *output) { +#if ENABLE_VERIFY_CACHE = 1 DBM *cache; datum data, key; int ret; @@ -282,9 +292,11 @@ void cache_insert(verify_container_handle_t *vch, const char *address, int resul free(mydata); } +#endif /* ENABLE_VERIFY_CACHE */ } int cache_lookup(verify_container_handle_t *vch, const char* address, int *result, char **output) { +#if ENABLE_VERIFY_CACHE = 1 DBM *cache; datum data, key; mydata_t *mydata; @@ -335,6 +347,9 @@ int cache_lookup(verify_container_handle_t *vch, const char* address, int *resul } return res; +#else + return -1; +#endif /* ENABLE_VERIFY_CACHE */ }