diff --git a/configure.ac b/configure.ac index 06678220..897c4833 100644 --- a/configure.ac +++ b/configure.ac @@ -32,6 +32,27 @@ to install it.]])], [AC_MSG_ERROR([[GNU gperf required, please install it.]])]) ]) +GPERF_TEST="$(echo foo,bar | ${GPERF} -L ANSI-C)" + +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + #include + const char * in_word_set(const char *, size_t); + $GPERF_TEST] + )], + [GPERF_LEN_TYPE=size_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + #include + const char * in_word_set(const char *, unsigned); + $GPERF_TEST] + )], + [GPERF_LEN_TYPE=unsigned], + [AC_MSG_ERROR([** unable to determine gperf len type])] + )] +) + +AC_DEFINE_UNQUOTED([GPERF_LEN_TYPE], [$GPERF_LEN_TYPE], [gperf len type]) AC_PATH_PROG([ANTLR], [[antlr3]]) AS_IF([[test -z "$ANTLR"]], [AS_IF([[test -f "$srcdir/src/SMARTPLLexer.h"]], diff --git a/src/dmap_common.h b/src/dmap_common.h index a595558d..93a2bdc0 100644 --- a/src/dmap_common.h +++ b/src/dmap_common.h @@ -2,6 +2,7 @@ #ifndef __DMAP_HELPERS_H__ #define __DMAP_HELPERS_H__ +#include "config.h" #include #include @@ -46,7 +47,7 @@ dmap_get_fields_table(int *nfields); /* From dmap_fields.gperf - keep in sync, don't alter */ const struct dmap_field * -dmap_find_field (register const char *str, register unsigned int len); +dmap_find_field (register const char *str, register GPERF_LEN_TYPE len); void