configure: Detect type of length parameter for gperf generated function

Since 3.1 gperf uses size_t for the length parameter instead of an
unsigned int.
This commit is contained in:
Tobias Brunner
2017-09-19 13:24:43 +02:00
parent d4593353c9
commit e0e4322973
4 changed files with 21 additions and 6 deletions
+15
View File
@@ -378,6 +378,21 @@ AC_PATH_PROG([GPERF], [gperf], [], [$PATH:/bin:/usr/bin:/usr/local/bin])
AC_MSG_CHECKING([gperf version >= 3.0.0])
if test -x "$GPERF"; then
if test "`$GPERF --version | $AWK -F' ' '/^GNU gperf/ { print $3 }' | $AWK -F. '{ print $1 }'`" -ge "3"; then
GPERF_OUTPUT="`echo foo | ${GPERF}`"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <string.h>
const char *in_word_set(const char*, size_t); $GPERF_OUTPUT]])],
[GPERF_LEN_TYPE=size_t],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <string.h>
const char *in_word_set(const char*, unsigned); $GPERF_OUTPUT]])],
[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_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])