add autoconf test and fallback code for systems without gperf
This commit is contained in:
parent
45b238fc6f
commit
22e4898519
@ -204,6 +204,15 @@ fi #manpage_support_enabled
|
|||||||
|
|
||||||
AM_CONDITIONAL(HAVE_POD2MAN, test "x$POD2MAN" != "x" -a "x$POD2MAN" != "xno")
|
AM_CONDITIONAL(HAVE_POD2MAN, test "x$POD2MAN" != "x" -a "x$POD2MAN" != "xno")
|
||||||
|
|
||||||
|
AC_PATH_PROG(GPERF, gperf, no)
|
||||||
|
AM_CONDITIONAL(HAVE_GPERF, test "x$GPERF" != "x" -a "x$GPERF" != "xno")
|
||||||
|
AH_TEMPLATE([HAVE_GPERF],
|
||||||
|
[Whether you have gperf installed for faster config parsing.])
|
||||||
|
|
||||||
|
if test "x$GPERF" != "x" -a "x$GPERF" != "xno" ; then
|
||||||
|
AC_DEFINE(HAVE_GPERF)
|
||||||
|
fi
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
Makefile
|
Makefile
|
||||||
src/Makefile
|
src/Makefile
|
||||||
|
@ -60,5 +60,8 @@ EXTRA_tinyproxy_SOURCES = filter.c filter.h \
|
|||||||
tinyproxy_DEPENDENCIES = @ADDITIONAL_OBJECTS@
|
tinyproxy_DEPENDENCIES = @ADDITIONAL_OBJECTS@
|
||||||
tinyproxy_LDADD = @ADDITIONAL_OBJECTS@ -lpthread
|
tinyproxy_LDADD = @ADDITIONAL_OBJECTS@ -lpthread
|
||||||
|
|
||||||
conf-tokens.c: conf-tokens.gperf
|
if HAVE_GPERF
|
||||||
gperf $< > $@
|
conf-tokens.c: conf-tokens-gperf.inc
|
||||||
|
conf-tokens-gperf.inc: conf-tokens.gperf
|
||||||
|
$(GPERF) $< > $@
|
||||||
|
endif
|
||||||
|
70
src/conf-tokens.c
Normal file
70
src/conf-tokens.c
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "conf-tokens.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_GPERF
|
||||||
|
#include "conf-tokens-gperf.inc"
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <strings.h>
|
||||||
|
|
||||||
|
const struct config_directive_entry *
|
||||||
|
config_directive_find (register const char *str, register size_t len)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
static const struct config_directive_entry wordlist[] =
|
||||||
|
{
|
||||||
|
{"",CD_NIL}, {"",CD_NIL},
|
||||||
|
{"allow", CD_allow},
|
||||||
|
{"stathost", CD_stathost},
|
||||||
|
{"listen", CD_listen},
|
||||||
|
{"timeout", CD_timeout},
|
||||||
|
{"statfile", CD_statfile},
|
||||||
|
{"pidfile", CD_pidfile},
|
||||||
|
{"bindsame", CD_bindsame},
|
||||||
|
{"reversebaseurl", CD_reversebaseurl},
|
||||||
|
{"viaproxyname", CD_viaproxyname},
|
||||||
|
{"upstream", CD_upstream},
|
||||||
|
{"anonymous", CD_anonymous},
|
||||||
|
{"group", CD_group},
|
||||||
|
{"defaulterrorfile", CD_defaulterrorfile},
|
||||||
|
{"startservers", CD_startservers},
|
||||||
|
{"filtercasesensitive", CD_filtercasesensitive},
|
||||||
|
{"filterurls", CD_filterurls},
|
||||||
|
{"filter", CD_filter},
|
||||||
|
{"reversemagic", CD_reversemagic},
|
||||||
|
{"errorfile", CD_errorfile},
|
||||||
|
{"minspareservers", CD_minspareservers},
|
||||||
|
{"user", CD_user},
|
||||||
|
{"disableviaheader", CD_disableviaheader},
|
||||||
|
{"deny", CD_deny},
|
||||||
|
{"xtinyproxy", CD_xtinyproxy},
|
||||||
|
{"reversepath", CD_reversepath},
|
||||||
|
{"bind", CD_bind},
|
||||||
|
{"maxclients", CD_maxclients},
|
||||||
|
{"reverseonly", CD_reverseonly},
|
||||||
|
{"port", CD_port},
|
||||||
|
{"maxspareservers", CD_maxspareservers},
|
||||||
|
{"syslog", CD_syslog},
|
||||||
|
{"filterdefaultdeny", CD_filterdefaultdeny},
|
||||||
|
{"loglevel", CD_loglevel},
|
||||||
|
{"filterextended", CD_filterextended},
|
||||||
|
{"connectport", CD_connectport},
|
||||||
|
{"logfile", CD_logfile},
|
||||||
|
{"basicauth", CD_basicauth},
|
||||||
|
{"addheader", CD_addheader},
|
||||||
|
{"maxrequestsperchild", CD_maxrequestsperchild}
|
||||||
|
};
|
||||||
|
|
||||||
|
for(i=0;i<sizeof(wordlist)/sizeof(wordlist[0]);++i) {
|
||||||
|
if(!strcasecmp(str, wordlist[i].name))
|
||||||
|
return &wordlist[i];
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user